[kvm-unit-tests PATCH v5 14/27] x86: Add a helper for the BSP's final init sequence common to all flavors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add bsp_rest_init() to dedup bringing up APs and doing SMP initialization
across 32-bit, 64-bit, and EFI flavors of KVM-unit-tests.  The common
bucket will also be used in future to patches to init things that aren't
SMP related and thus don't fit in smp_init(), e.g. PMU setup.

No functional change intended.

Signed-off-by: Sean Christopherson <seanjc@xxxxxxxxxx>
---
 lib/x86/asm/setup.h |  1 +
 lib/x86/setup.c     | 11 ++++++++---
 x86/cstart.S        |  4 +---
 x86/cstart64.S      |  4 +---
 4 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/lib/x86/asm/setup.h b/lib/x86/asm/setup.h
index 8502e7d9..1f384274 100644
--- a/lib/x86/asm/setup.h
+++ b/lib/x86/asm/setup.h
@@ -17,6 +17,7 @@ void setup_5level_page_table(void);
 #endif /* CONFIG_EFI */
 
 void save_id(void);
+void bsp_rest_init(void);
 void ap_start64(void);
 
 #endif /* _X86_ASM_SETUP_H_ */
diff --git a/lib/x86/setup.c b/lib/x86/setup.c
index 7df0256e..a7b3edbe 100644
--- a/lib/x86/setup.c
+++ b/lib/x86/setup.c
@@ -356,9 +356,7 @@ efi_status_t setup_efi(efi_bootinfo_t *efi_bootinfo)
 	setup_page_table();
 	enable_apic();
 	save_id();
-	bringup_aps();
-	enable_x2apic();
-	smp_init();
+	bsp_rest_init();
 
 	return EFI_SUCCESS;
 }
@@ -394,3 +392,10 @@ void ap_start64(void)
 	enable_x2apic();
 	ap_online();
 }
+
+void bsp_rest_init(void)
+{
+	bringup_aps();
+	enable_x2apic();
+	smp_init();
+}
diff --git a/x86/cstart.S b/x86/cstart.S
index e82bed7b..ceee58f9 100644
--- a/x86/cstart.S
+++ b/x86/cstart.S
@@ -112,9 +112,7 @@ start32:
 	call save_id
 	call mask_pic_interrupts
 	call enable_apic
-	call bringup_aps
-	call enable_x2apic
-	call smp_init
+	call bsp_rest_init
         push $__environ
         push $__argv
         push __argc
diff --git a/x86/cstart64.S b/x86/cstart64.S
index 570ed2ed..4dff1102 100644
--- a/x86/cstart64.S
+++ b/x86/cstart64.S
@@ -118,9 +118,7 @@ start64:
 	mov %rax, __args(%rip)
 	call __setup_args
 
-	call bringup_aps
-	call enable_x2apic
-	call smp_init
+	call bsp_rest_init
 
 	mov __argc(%rip), %edi
 	lea __argv(%rip), %rsi
-- 
2.38.1.431.g37b22c650d-goog




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux