When CONFIG_X86_X2APIC is disabled, jailhouse fails to build:We can't do that, adding a macro for the X2APIC=n case is enough
arch/x86/kernel/jailhouse.c: In function 'jailhouse_get_smp_config':
arch/x86/kernel/jailhouse.c:73:3: error: 'x2apic_phys' undeclared (first use in this function); did you mean 'x2apic_mode'?
The code is protected by an appropriate x2apic_enabled() check that leads
to the assignment being optimized out without a link-time reference to
x2apic_phys, so we just lack a declaration.
Let's move x2apic_mode and x2apic_phys outside of the #ifdef together,
for consistency.
Fixes: 11c8dc419bbc ("x86/jailhouse: Enable APIC and SMP support")
Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
---
arch/x86/include/asm/apic.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h
index 98722773391d..0317d635d9ba 100644
--- a/arch/x86/include/asm/apic.h
+++ b/arch/x86/include/asm/apic.h
@@ -188,6 +188,8 @@ static inline void lapic_assign_system_vectors(void) { }
static inline void lapic_assign_legacy_vector(unsigned int i, bool r) { }
#endif /* !CONFIG_X86_LOCAL_APIC */
+extern int x2apic_mode;
+extern int x2apic_phys;