aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/apic/io_apic.c
diff options
context:
space:
mode:
authorSuresh Siddha <suresh.b.siddha@intel.com>2012-03-12 14:36:33 -0400
committerIngo Molnar <mingo@elte.hu>2012-03-13 00:52:02 -0400
commit73d63d038ee9f769f5e5b46792d227fe20e442c5 (patch)
tree8d595eccf1d62bc212ee6bf362e4ee2bf38bd3df /arch/x86/kernel/apic/io_apic.c
parenta5c2edf5765a6efedfd862bce6c616bfec46306a (diff)
x86/ioapic: Add register level checks to detect bogus io-apic entries
With the recent changes to clear_IO_APIC_pin() which tries to clear remoteIRR bit explicitly, some of the users started to see "Unable to reset IRR for apic .." messages. Close look shows that these are related to bogus IO-APIC entries which return's all 1's for their io-apic registers. And the above mentioned error messages are benign. But kernel should have ignored such io-apic's in the first place. Check if register 0, 1, 2 of the listed io-apic are all 1's and ignore such io-apic. Reported-by: Álvaro Castillo <midgoon@gmail.com> Tested-by: Jon Dufresne <jon@jondufresne.org> Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com> Cc: yinghai@kernel.org Cc: kernel-team@fedoraproject.org Cc: Josh Boyer <jwboyer@redhat.com> Cc: <stable@kernel.org> Link: http://lkml.kernel.org/r/1331577393.31585.94.camel@sbsiddha-desk.sc.intel.com [ Performed minor cleanup of affected code. ] Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/apic/io_apic.c')
-rw-r--r--arch/x86/kernel/apic/io_apic.c40
1 files changed, 32 insertions, 8 deletions
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index fb072754bc1d..6d10a66fc5a9 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -3967,18 +3967,36 @@ int mp_find_ioapic_pin(int ioapic, u32 gsi)
3967static __init int bad_ioapic(unsigned long address) 3967static __init int bad_ioapic(unsigned long address)
3968{ 3968{
3969 if (nr_ioapics >= MAX_IO_APICS) { 3969 if (nr_ioapics >= MAX_IO_APICS) {
3970 printk(KERN_WARNING "WARNING: Max # of I/O APICs (%d) exceeded " 3970 pr_warn("WARNING: Max # of I/O APICs (%d) exceeded (found %d), skipping\n",
3971 "(found %d), skipping\n", MAX_IO_APICS, nr_ioapics); 3971 MAX_IO_APICS, nr_ioapics);
3972 return 1; 3972 return 1;
3973 } 3973 }
3974 if (!address) { 3974 if (!address) {
3975 printk(KERN_WARNING "WARNING: Bogus (zero) I/O APIC address" 3975 pr_warn("WARNING: Bogus (zero) I/O APIC address found in table, skipping!\n");
3976 " found in table, skipping!\n");
3977 return 1; 3976 return 1;
3978 } 3977 }
3979 return 0; 3978 return 0;
3980} 3979}
3981 3980
3981static __init int bad_ioapic_register(int idx)
3982{
3983 union IO_APIC_reg_00 reg_00;
3984 union IO_APIC_reg_01 reg_01;
3985 union IO_APIC_reg_02 reg_02;
3986
3987 reg_00.raw = io_apic_read(idx, 0);
3988 reg_01.raw = io_apic_read(idx, 1);
3989 reg_02.raw = io_apic_read(idx, 2);
3990
3991 if (reg_00.raw == -1 && reg_01.raw == -1 && reg_02.raw == -1) {
3992 pr_warn("I/O APIC 0x%x registers return all ones, skipping!\n",
3993 mpc_ioapic_addr(idx));
3994 return 1;
3995 }
3996
3997 return 0;
3998}
3999
3982void __init mp_register_ioapic(int id, u32 address, u32 gsi_base) 4000void __init mp_register_ioapic(int id, u32 address, u32 gsi_base)
3983{ 4001{
3984 int idx = 0; 4002 int idx = 0;
@@ -3995,6 +4013,12 @@ void __init mp_register_ioapic(int id, u32 address, u32 gsi_base)
3995 ioapics[idx].mp_config.apicaddr = address; 4013 ioapics[idx].mp_config.apicaddr = address;
3996 4014
3997 set_fixmap_nocache(FIX_IO_APIC_BASE_0 + idx, address); 4015 set_fixmap_nocache(FIX_IO_APIC_BASE_0 + idx, address);
4016
4017 if (bad_ioapic_register(idx)) {
4018 clear_fixmap(FIX_IO_APIC_BASE_0 + idx);
4019 return;
4020 }
4021
3998 ioapics[idx].mp_config.apicid = io_apic_unique_id(id); 4022 ioapics[idx].mp_config.apicid = io_apic_unique_id(id);
3999 ioapics[idx].mp_config.apicver = io_apic_get_version(idx); 4023 ioapics[idx].mp_config.apicver = io_apic_get_version(idx);
4000 4024
@@ -4015,10 +4039,10 @@ void __init mp_register_ioapic(int id, u32 address, u32 gsi_base)
4015 if (gsi_cfg->gsi_end >= gsi_top) 4039 if (gsi_cfg->gsi_end >= gsi_top)
4016 gsi_top = gsi_cfg->gsi_end + 1; 4040 gsi_top = gsi_cfg->gsi_end + 1;
4017 4041
4018 printk(KERN_INFO "IOAPIC[%d]: apic_id %d, version %d, address 0x%x, " 4042 pr_info("IOAPIC[%d]: apic_id %d, version %d, address 0x%x, GSI %d-%d\n",
4019 "GSI %d-%d\n", idx, mpc_ioapic_id(idx), 4043 idx, mpc_ioapic_id(idx),
4020 mpc_ioapic_ver(idx), mpc_ioapic_addr(idx), 4044 mpc_ioapic_ver(idx), mpc_ioapic_addr(idx),
4021 gsi_cfg->gsi_base, gsi_cfg->gsi_end); 4045 gsi_cfg->gsi_base, gsi_cfg->gsi_end);
4022 4046
4023 nr_ioapics++; 4047 nr_ioapics++;
4024} 4048}