From: Jiang Liu Date: Wed, 7 Jan 2015 07:31:38 +0000 (+0800) Subject: x86/apic: Only disable CPU x2apic mode when necessary X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=5fcee53ce705d49c766f8a302c7e93bdfc33c124;p=linux-beck.git x86/apic: Only disable CPU x2apic mode when necessary When interrupt remapping hardware is not in X2APIC, CPU X2APIC mode will be disabled if: 1) Maximum CPU APIC ID is bigger than 255 2) hypervisior doesn't support x2apic mode. But we should only check whether hypervisor supports X2APIC mode when hypervisor(CONFIG_HYPERVISOR_GUEST) is enabled, otherwise X2APIC will always be disabled when CONFIG_HYPERVISOR_GUEST is disabled and IR doesn't work in X2APIC mode. Signed-off-by: Jiang Liu Tested-by: Joerg Roedel Cc: Tony Luck Cc: iommu@lists.linux-foundation.org Cc: H. Peter Anvin Cc: Benjamin Herrenschmidt Cc: Yinghai Lu Cc: Borislav Petkov Cc: David Rientjes Cc: HATAYAMA Daisuke Cc: Jan Beulich Cc: Richard Weinberger Cc: Oren Twaig Link: http://lkml.kernel.org/r/1420615903-28253-12-git-send-email-jiang.liu@linux.intel.com Signed-off-by: Thomas Gleixner --- diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c index 04aec6bc7481..2f16116ced90 100644 --- a/arch/x86/kernel/apic/apic.c +++ b/arch/x86/kernel/apic/apic.c @@ -1601,7 +1601,8 @@ static __init void try_to_enable_x2apic(int ir_stat) * under KVM */ if (max_physical_apicid > 255 || - !hypervisor_x2apic_available()) { + (IS_ENABLED(CONFIG_HYPERVISOR_GUEST) && + !hypervisor_x2apic_available())) { pr_info("IRQ remapping doesn't support X2APIC mode, disable x2apic.\n"); if (x2apic_preenabled) disable_x2apic();