The patch titled
     x86: clear pci_mmcfg_virt when mmcfg get rejected
has been removed from the -mm tree.  Its filename was
     x86-clear-pci_mmcfg_virt-when-mmcfg-get-rejected.patch

This patch was dropped because an updated version will be merged

The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/

------------------------------------------------------
Subject: x86: clear pci_mmcfg_virt when mmcfg get rejected
From: Yinghai Lu <[EMAIL PROTECTED]>

For x86_64, need to free pci_mmcfg_virt, and iounmap some pointers
when MMCONF is not reserved in E820 or acpi _CRS and get rejected

Signed-off-by: Yinghai Lu <[EMAIL PROTECTED]>
Cc: Greg KH <[EMAIL PROTECTED]>
Cc: Ingo Molnar <[EMAIL PROTECTED]>
Cc: Thomas Gleixner <[EMAIL PROTECTED]>
Cc: Andi Kleen <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
---

 arch/x86/pci/mmconfig-shared.c |    1 +
 arch/x86/pci/mmconfig_32.c     |    4 ++++
 arch/x86/pci/mmconfig_64.c     |   22 +++++++++++++++++++++-
 arch/x86/pci/pci.h             |    1 +
 4 files changed, 27 insertions(+), 1 deletion(-)

diff -puN 
arch/x86/pci/mmconfig-shared.c~x86-clear-pci_mmcfg_virt-when-mmcfg-get-rejected 
arch/x86/pci/mmconfig-shared.c
--- 
a/arch/x86/pci/mmconfig-shared.c~x86-clear-pci_mmcfg_virt-when-mmcfg-get-rejected
+++ a/arch/x86/pci/mmconfig-shared.c
@@ -333,6 +333,7 @@ static void __init pci_mmcfg_reject_brok
 
 reject:
        printk(KERN_ERR "PCI: Not using MMCONFIG.\n");
+       pci_mmcfg_arch_free();
        kfree(pci_mmcfg_config);
        pci_mmcfg_config = NULL;
        pci_mmcfg_config_num = 0;
diff -puN 
arch/x86/pci/mmconfig_32.c~x86-clear-pci_mmcfg_virt-when-mmcfg-get-rejected 
arch/x86/pci/mmconfig_32.c
--- 
a/arch/x86/pci/mmconfig_32.c~x86-clear-pci_mmcfg_virt-when-mmcfg-get-rejected
+++ a/arch/x86/pci/mmconfig_32.c
@@ -146,3 +146,7 @@ int __init pci_mmcfg_arch_init(void)
        raw_pci_ops = &pci_mmcfg;
        return 1;
 }
+
+void __init pci_mmcfg_arch_free(void)
+{
+}
diff -puN 
arch/x86/pci/mmconfig_64.c~x86-clear-pci_mmcfg_virt-when-mmcfg-get-rejected 
arch/x86/pci/mmconfig_64.c
--- 
a/arch/x86/pci/mmconfig_64.c~x86-clear-pci_mmcfg_virt-when-mmcfg-get-rejected
+++ a/arch/x86/pci/mmconfig_64.c
@@ -135,7 +135,7 @@ int __init pci_mmcfg_arch_reachable(unsi
 int __init pci_mmcfg_arch_init(void)
 {
        int i;
-       pci_mmcfg_virt = kmalloc(sizeof(*pci_mmcfg_virt) *
+       pci_mmcfg_virt = kzalloc(sizeof(*pci_mmcfg_virt) *
                                 pci_mmcfg_config_num, GFP_KERNEL);
        if (pci_mmcfg_virt == NULL) {
                printk(KERN_ERR "PCI: Can not allocate memory for mmconfig 
structures\n");
@@ -149,9 +149,29 @@ int __init pci_mmcfg_arch_init(void)
                        printk(KERN_ERR "PCI: Cannot map mmconfig aperture for "
                                        "segment %d\n",
                                pci_mmcfg_config[i].pci_segment);
+                       pci_mmcfg_arch_free();
                        return 0;
                }
        }
        raw_pci_ops = &pci_mmcfg;
        return 1;
 }
+
+void __init pci_mmcfg_arch_free(void)
+{
+       int i;
+
+       if (pci_mmcfg_virt == NULL)
+               return;
+
+       for (i = 0; i < pci_mmcfg_config_num; ++i) {
+               if (pci_mmcfg_virt[i].virt) {
+                       iounmap(pci_mmcfg_virt[i].virt);
+                       pci_mmcfg_virt[i].virt = NULL;
+                       pci_mmcfg_virt[i].cfg = NULL;
+               }
+       }
+
+       kfree(pci_mmcfg_virt);
+       pci_mmcfg_virt = NULL;
+}
diff -puN arch/x86/pci/pci.h~x86-clear-pci_mmcfg_virt-when-mmcfg-get-rejected 
arch/x86/pci/pci.h
--- a/arch/x86/pci/pci.h~x86-clear-pci_mmcfg_virt-when-mmcfg-get-rejected
+++ a/arch/x86/pci/pci.h
@@ -105,6 +105,7 @@ extern DECLARE_BITMAP(pci_mmcfg_fallback
 extern int __init pci_mmcfg_arch_reachable(unsigned int seg, unsigned int bus,
                                           unsigned int devfn);
 extern int __init pci_mmcfg_arch_init(void);
+extern void __init pci_mmcfg_arch_free(void);
 
 /*
  * AMD Fam10h CPUs are buggy, and cannot access MMIO config space
_

Patches currently in -mm which might be from [EMAIL PROTECTED] are

origin.patch
sata_mv-fix-loop-with-last-port.patch
git-x86.patch
pci-dont-load-acpi_php-when-acpi-is-disabled.patch
x86-clear-pci_mmcfg_virt-when-mmcfg-get-rejected.patch
x86-mmconf-enable-mcfg-early.patch
x86_64-check-msr-to-get-mmconfig-for-amd-family-10h-opteron-v3.patch
x86_64-set-cfg_size-for-amd-family-10h-in-case-mmconfig-is-used.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to