Skip to content

Commit

Permalink
x86/jailhouse: Hide x2apic code when CONFIG_X86_X2APIC=n
Browse files Browse the repository at this point in the history
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 <mingo@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Jan Kiszka <jan.kiszka@siemens.com>
Cc: jailhouse-dev@googlegroups.com
  • Loading branch information
Thomas Gleixner committed Jan 15, 2018
1 parent a0c01e4 commit be6d447
Showing 1 changed file with 19 additions and 14 deletions.
33 changes: 19 additions & 14 deletions arch/x86/kernel/jailhouse.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,24 @@ static unsigned long jailhouse_get_tsc(void)
return precalibrated_tsc_khz;
}

static void __init jailhouse_x2apic_init(void)
{
#ifdef CONFIG_X86_X2APIC
if (!x2apic_enabled())
return;
/*
* We do not have access to IR inside Jailhouse non-root cells. So
* we have to run in physical mode.
*/
x2apic_phys = 1;
/*
* This will trigger the switch to apic_x2apic_phys. Empty OEM IDs
* ensure that only this APIC driver picks up the call.
*/
default_acpi_madt_oem_check("", "");
#endif
}

static void __init jailhouse_get_smp_config(unsigned int early)
{
struct ioapic_domain_cfg ioapic_cfg = {
Expand All @@ -65,20 +83,7 @@ static void __init jailhouse_get_smp_config(unsigned int early)
};
unsigned int cpu;

if (x2apic_enabled()) {
/*
* We do not have access to IR inside Jailhouse non-root cells.
* So we have to run in physical mode.
*/
x2apic_phys = 1;

/*
* This will trigger the switch to apic_x2apic_phys.
* Empty OEM IDs ensure that only this APIC driver picks up
* the call.
*/
default_acpi_madt_oem_check("", "");
}
jailhouse_x2apic_init();

register_lapic_address(0xfee00000);

Expand Down

0 comments on commit be6d447

Please sign in to comment.