Skip to content

Commit 4d841ed

Browse files
krystian-hebelSergiiDmytruk
authored andcommitted
arch/x86/smp: remove MONITOR/MWAIT loop for TXT AP bringup
This is no longer necessary, since AP loops on cpu_state and CPU index is passed as argument. In addition, move TXT JOIN structure to static data. There is no guarantee that it would be consumed before it is overwritten on BSP stack. Signed-off-by: Krystian Hebel <[email protected]>
1 parent 981eb5f commit 4d841ed

File tree

1 file changed

+9
-28
lines changed

1 file changed

+9
-28
lines changed

xen/arch/x86/smpboot.c

Lines changed: 9 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -320,28 +320,6 @@ void asmlinkage start_secondary(unsigned int cpu)
320320
* want to limit the things done here to the most necessary things.
321321
*/
322322

323-
if ( ap_boot_method == AP_BOOT_TXT ) {
324-
uint64_t misc_enable;
325-
uint32_t my_apicid;
326-
struct txt_sinit_mle_data *sinit_mle =
327-
txt_sinit_mle_data_start(__va(read_txt_reg(TXTCR_HEAP_BASE)));
328-
329-
/* TXT released us with MONITOR disabled in IA32_MISC_ENABLE. */
330-
rdmsrl(MSR_IA32_MISC_ENABLE, misc_enable);
331-
wrmsrl(MSR_IA32_MISC_ENABLE,
332-
misc_enable | MSR_IA32_MISC_ENABLE_MONITOR_ENABLE);
333-
334-
/* get_apic_id() reads from x2APIC if it thinks it is enabled. */
335-
x2apic_ap_setup();
336-
my_apicid = get_apic_id();
337-
338-
while ( my_apicid != cpu_physical_id(cpu) ) {
339-
asm volatile ("monitor; xor %0,%0; mwait"
340-
:: "a"(__va(sinit_mle->rlp_wakeup_addr)), "c"(0),
341-
"d"(0) : "memory");
342-
}
343-
}
344-
345323
/* Critical region without IDT or TSS. Any fault is deadly! */
346324

347325
/* Wait until data set up by CPU_UP_PREPARE notifiers is ready. */
@@ -455,13 +433,16 @@ static int wake_aps_in_txt(void)
455433
struct txt_sinit_mle_data *sinit_mle =
456434
txt_sinit_mle_data_start(__va(read_txt_reg(TXTCR_HEAP_BASE)));
457435
uint32_t *wakeup_addr = __va(sinit_mle->rlp_wakeup_addr);
436+
static uint32_t join[4] = {0};
437+
438+
/* Check if already started. */
439+
if ( join[0] != 0 )
440+
return -1;
458441

459-
uint32_t join[4] = {
460-
trampoline_gdt[1], /* GDT limit */
461-
bootsym_phys(trampoline_gdt), /* GDT base */
462-
TXT_AP_BOOT_CS, /* CS selector, DS = CS+8 */
463-
bootsym_phys(txt_ap_entry) /* EIP */
464-
};
442+
join[0] = trampoline_gdt[1]; /* GDT limit */
443+
join[1] = bootsym_phys(trampoline_gdt); /* GDT base */
444+
join[2] = TXT_AP_BOOT_CS; /* CS selector, DS = CS+8 */
445+
join[3] = bootsym_phys(txt_ap_entry); /* EIP */
465446

466447
write_txt_reg(TXTCR_MLE_JOIN, __pa(join));
467448

0 commit comments

Comments
 (0)