Skip to content

Commit be6d447

Browse files
committed
x86/jailhouse: Hide x2apic code when CONFIG_X86_X2APIC=n
x2apic_phys is not available when CONFIG_X86_X2APIC=n and the code is not optimized out resulting in a build fail: jailhouse.c: In function ‘jailhouse_get_smp_config’: jailhouse.c:73:3: error: ‘x2apic_phys’ undeclared (first use in this function) Fixes: 11c8dc4 ("x86/jailhouse: Enable APIC and SMP support") Reported-by: Ingo Molnar <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Cc: Jan Kiszka <[email protected]> Cc: [email protected]
1 parent a0c01e4 commit be6d447

File tree

1 file changed

+19
-14
lines changed

1 file changed

+19
-14
lines changed

arch/x86/kernel/jailhouse.c

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,24 @@ static unsigned long jailhouse_get_tsc(void)
5252
return precalibrated_tsc_khz;
5353
}
5454

55+
static void __init jailhouse_x2apic_init(void)
56+
{
57+
#ifdef CONFIG_X86_X2APIC
58+
if (!x2apic_enabled())
59+
return;
60+
/*
61+
* We do not have access to IR inside Jailhouse non-root cells. So
62+
* we have to run in physical mode.
63+
*/
64+
x2apic_phys = 1;
65+
/*
66+
* This will trigger the switch to apic_x2apic_phys. Empty OEM IDs
67+
* ensure that only this APIC driver picks up the call.
68+
*/
69+
default_acpi_madt_oem_check("", "");
70+
#endif
71+
}
72+
5573
static void __init jailhouse_get_smp_config(unsigned int early)
5674
{
5775
struct ioapic_domain_cfg ioapic_cfg = {
@@ -65,20 +83,7 @@ static void __init jailhouse_get_smp_config(unsigned int early)
6583
};
6684
unsigned int cpu;
6785

68-
if (x2apic_enabled()) {
69-
/*
70-
* We do not have access to IR inside Jailhouse non-root cells.
71-
* So we have to run in physical mode.
72-
*/
73-
x2apic_phys = 1;
74-
75-
/*
76-
* This will trigger the switch to apic_x2apic_phys.
77-
* Empty OEM IDs ensure that only this APIC driver picks up
78-
* the call.
79-
*/
80-
default_acpi_madt_oem_check("", "");
81-
}
86+
jailhouse_x2apic_init();
8287

8388
register_lapic_address(0xfee00000);
8489

0 commit comments

Comments
 (0)