rpms/kernel/F-8 linux-2.6-x86-pci-detect-end_bus_number.patch, NONE, 1.1 kernel.spec, 1.534, 1.535
Chuck Ebbert
cebbert at fedoraproject.org
Fri Sep 19 14:02:29 UTC 2008
Author: cebbert
Update of /cvs/pkgs/rpms/kernel/F-8
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv8120
Modified Files:
kernel.spec
Added Files:
linux-2.6-x86-pci-detect-end_bus_number.patch
Log Message:
x86: pci: detect end_bus_number according to acpi/e820 reserved, v2 (F9#462210)
linux-2.6-x86-pci-detect-end_bus_number.patch:
--- NEW FILE linux-2.6-x86-pci-detect-end_bus_number.patch ---
From: Yinghai Lu <yhlu.kernel at gmail.com>
Date: Fri, 18 Jul 2008 20:22:36 +0000 (-0700)
Subject: x86, pci: detect end_bus_number according to acpi/e820 reserved, v2
X-Git-Tag: v2.6.27-rc4~36^2^2^2
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=a83fe32fa668c0a17b3f99a1480b006f7d649924
x86, pci: detect end_bus_number according to acpi/e820 reserved, v2
Jack Howarth reported that 2.6.26-rc9-git9 doesn't boot on MacBookPro2.
the reason is a faulty BIOS update that reportes faulty resources.
Nevertheless it's possible for Linux to be more resolent about this
situation (and similar situations) and work around this bug, by
cross-checking the mmconf range against the e820 table and ACPI resources.
Change the mconf bus range from [0,0xff] to to [0, 0x3f]
to match range [0xf0000000, 0xf4000000) in e820 tables.
[ v2, yhlu.kernel at gmail.com:
x86, pci: detect end_bus_number according to acpi/e820 reserved - fix ]
Reported-by: Jack Howarth <howarth at bromo.msbb.uc.edu>
Signed-off-by: Yinghai Lu <yhlu.kernel at gmail.com>
Cc: jbarnes at virtuousgeek.org
Cc: Jack Howarth <howarth at bromo.msbb.uc.edu>
Signed-off-by: Ingo Molnar <mingo at elte.hu>
---
diff --git a/arch/x86/pci/mmconfig-shared.c b/arch/x86/pci/mmconfig-shared.c
index 23faaa8..429c701 100644
--- a/arch/x86/pci/mmconfig-shared.c
+++ b/arch/x86/pci/mmconfig-shared.c
@@ -293,7 +293,7 @@ static acpi_status __init find_mboard_resource(acpi_handle handle, u32 lvl,
return AE_OK;
}
-static int __init is_acpi_reserved(unsigned long start, unsigned long end)
+static int __init is_acpi_reserved(u64 start, u64 end, unsigned not_used)
{
struct resource mcfg_res;
@@ -310,6 +310,41 @@ static int __init is_acpi_reserved(unsigned long start, unsigned long end)
return mcfg_res.flags;
}
+typedef int (*check_reserved_t)(u64 start, u64 end, unsigned type);
+
+static int __init is_mmconf_reserved(check_reserved_t is_reserved,
+ u64 addr, u64 size, int i,
+ typeof(pci_mmcfg_config[0]) *cfg, int with_e820)
+{
+ u64 old_size = size;
+ int valid = 0;
+
+ while (!is_reserved(addr, addr + size - 1, E820_RESERVED)) {
+ size >>= 1;
+ if (size < (16UL<<20))
+ break;
+ }
+
+ if (size >= (16UL<<20) || size == old_size) {
+ printk(KERN_NOTICE
+ "PCI: MCFG area at %Lx reserved in %s\n",
+ addr, with_e820?"E820":"ACPI motherboard resources");
+ valid = 1;
+
+ if (old_size != size) {
+ /* update end_bus_number */
+ cfg->end_bus_number = cfg->start_bus_number + ((size>>20) - 1);
+ printk(KERN_NOTICE "PCI: updated MCFG configuration %d: base %lx "
+ "segment %hu buses %u - %u\n",
+ i, (unsigned long)cfg->address, cfg->pci_segment,
+ (unsigned int)cfg->start_bus_number,
+ (unsigned int)cfg->end_bus_number);
+ }
+ }
+
+ return valid;
+}
+
static void __init pci_mmcfg_reject_broken(int early)
{
typeof(pci_mmcfg_config[0]) *cfg;
@@ -324,21 +359,22 @@ static void __init pci_mmcfg_reject_broken(int early)
for (i = 0; i < pci_mmcfg_config_num; i++) {
int valid = 0;
- u32 size = (cfg->end_bus_number + 1) << 20;
+ u64 addr, size;
+
cfg = &pci_mmcfg_config[i];
+ addr = cfg->start_bus_number;
+ addr <<= 20;
+ addr += cfg->address;
+ size = cfg->end_bus_number + 1 - cfg->start_bus_number;
+ size <<= 20;
printk(KERN_NOTICE "PCI: MCFG configuration %d: base %lx "
"segment %hu buses %u - %u\n",
i, (unsigned long)cfg->address, cfg->pci_segment,
(unsigned int)cfg->start_bus_number,
(unsigned int)cfg->end_bus_number);
- if (!early &&
- is_acpi_reserved(cfg->address, cfg->address + size - 1)) {
- printk(KERN_NOTICE "PCI: MCFG area at %Lx reserved "
- "in ACPI motherboard resources\n",
- cfg->address);
- valid = 1;
- }
+ if (!early)
+ valid = is_mmconf_reserved(is_acpi_reserved, addr, size, i, cfg, 0);
if (valid)
continue;
@@ -347,16 +383,11 @@ static void __init pci_mmcfg_reject_broken(int early)
printk(KERN_ERR "PCI: BIOS Bug: MCFG area at %Lx is not"
" reserved in ACPI motherboard resources\n",
cfg->address);
+
/* Don't try to do this check unless configuration
type 1 is available. how about type 2 ?*/
- if (raw_pci_ops && e820_all_mapped(cfg->address,
- cfg->address + size - 1,
- E820_RESERVED)) {
- printk(KERN_NOTICE
- "PCI: MCFG area at %Lx reserved in E820\n",
- cfg->address);
- valid = 1;
- }
+ if (raw_pci_ops)
+ valid = is_mmconf_reserved(e820_all_mapped, addr, size, i, cfg, 1);
if (!valid)
goto reject;
Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-8/kernel.spec,v
retrieving revision 1.534
retrieving revision 1.535
diff -u -r1.534 -r1.535
--- kernel.spec 19 Sep 2008 13:37:24 -0000 1.534
+++ kernel.spec 19 Sep 2008 14:01:59 -0000 1.535
@@ -592,6 +592,7 @@
Patch97: linux-2.6-x86-hpet-04-workaround-sb700-bios.patch
Patch98: linux-2.6-x86-fix-memmap-exactmap-boot-argument.patch
Patch99: linux-2.6-x86-intel-msr-backport.patch
+Patch100: linux-2.6-x86-pci-detect-end_bus_number.patch
#ALSA
@@ -1046,6 +1047,8 @@
ApplyPatch linux-2.6-x86-fix-memmap-exactmap-boot-argument.patch
# backport MSR patch
ApplyPatch linux-2.6-x86-intel-msr-backport.patch
+# fix e820 reservation checking
+ApplyPatch linux-2.6-x86-pci-detect-end_bus_number.patch
#
# PowerPC
@@ -1854,6 +1857,9 @@
%changelog
+* Fri Sep 19 2008 Chuck Ebbert <cebbert at redhat.com> 2.6.26.5-25
+- x86: pci: detect end_bus_number according to acpi/e820 reserved, v2 (F9#462210)
+
* Fri Sep 19 2008 Chuck Ebbert <cebbert at redhat.com> 2.6.26.5-24
- utrace: Fix common oops in ptrace EPERM case (from F9)
More information about the fedora-extras-commits
mailing list