Skip to contentSkip to conversation

x86_64: force re setting the mmconf for fam10h if acpi=off

PATCH Applied Yinghai Lu 2 participants 3 messages Feb 26, 2008 x86

lore
Share & tools
lore

Yinghai Lu

author
#0 lore raw

PATCH 1/1 x86_64: force re setting the mmconf for fam10h if acpi=off

some BIOS only let AMD fam 10h handle bus0, and nvidia mcp55/ck804 to handle other buses. at that case MCFG will cover all over them.

but with acpi=off, we can not use MCFG. this patch will double check the busnbits, and if it is less handling 256 bues, and acpi=off will forcely reset the mmconf in msr, so we still use mmconf in above case.

arch/x86/kernel/setup_64.c +15 -8
Index: linux-2.6/arch/x86/kernel/setup_64.c
===================================================================
@@ -720,14 +720,21 @@ static void __cpuinit fam10h_check_enabl
 
 	/* try to make sure that AP's setting is identical to BSP setting */
 	if (val & FAM10H_MMIO_CONF_ENABLE) {
-		u64 base;
-		base = val & (0xffffULL << 32);
-		if (fam10h_pci_mmconf_base_status <= 0) {
-			fam10h_pci_mmconf_base = base;
-			fam10h_pci_mmconf_base_status = 1;
-			return;
-		} else if (fam10h_pci_mmconf_base ==  base)
-			return;
+		unsigned busnbits;
+		busnbits = (val >> FAM10H_MMIO_CONF_BUSRANGE_SHIFT) &
+			FAM10H_MMIO_CONF_BUSRANGE_MASK;
+
+		/* only trust the one handle 256 buses, if acpi=off */
+		if (!acpi_pci_disabled || busnbits >= 8) {
+			u64 base;
+			base = val & (0xffffULL << 32);
+			if (fam10h_pci_mmconf_base_status <= 0) {
+				fam10h_pci_mmconf_base = base;
+				fam10h_pci_mmconf_base_status = 1;
+				return;
+			} else if (fam10h_pci_mmconf_base ==  base)
+				return;
+		}
 	}
 
 	/*
Applied
#1 lore raw
Quoted 6 lines · Yinghai Lu

some BIOS only let AMD fam 10h handle bus0, and nvidia mcp55/ck804 to handle other buses. at that case MCFG will cover all over them.

but with acpi=off, we can not use MCFG. this patch will double check the busnbits, and if it is less handling 256 bues, and acpi=off will forcely reset the mmconf in msr, so we still use mmconf in above case.

thanks, applied.

Review static void __cpuinit fam10h_check_enabl

Quoted 1 line
(quoted diff) +0 -0
@@ -720,14 +720,21 @@ static void __cpuinit fam10h_check_enabl

btw., a cleanliness suggestion: wouldnt it be cleaner to separate all the extra AMD family 16 code into a separate file? That should make it more focused and more isolated as well.

Ingo

author
#2 lore raw

PATCH 1/1 x86_64: Seperate mmconf for fam10h out from setup_64.c

Seperate mmconf for fam10h out from setup_64.c

arch/x86/kernel/Makefile +2 -0
index 199f8b5..4f2b9ed 100644
@@ -101,4 +101,6 @@ ifeq ($(CONFIG_X86_64),y)
         obj-$(CONFIG_GART_IOMMU)	+= pci-gart_64.o aperture_64.o
         obj-$(CONFIG_CALGARY_IOMMU)	+= pci-calgary_64.o tce_64.o
         obj-$(CONFIG_SWIOTLB)		+= pci-swiotlb_64.o
+
+        obj-$(CONFIG_PCI_MMCONFIG)	+= mmconf-fam10h_64.o
 endif
arch/x86/kernel/mmconf-fam10h_64.c new file +215 -0

215 lines not on this page · raw message

arch/x86/kernel/setup_64.c +9 -207

234 lines not on this page · raw message