Skip to contentSkip to conversation

x86-64/mmcfg: fix pci_mmcfg_arch_free()

PATCH New Jan Beulich 1 participant 1 message Jul 1, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86-64/mmcfg: fix pci_mmcfg_arch_free()

While only used on error paths so far, it should still actually do something (which iounmap(), being an empty stub, doesn't).

xen/arch/x86/x86_64/mmconfig_64.c +6 -1
@@ -166,7 +166,12 @@ void __init pci_mmcfg_arch_free(void)
 
     for (i = 0; i < pci_mmcfg_config_num; ++i) {
         if (pci_mmcfg_virt[i].virt) {
-            iounmap(pci_mmcfg_virt[i].virt);
+            unsigned long size;
+            const struct acpi_mcfg_allocation *cfg = pci_mmcfg_virt[i].cfg;
+
+            size = (cfg->end_bus_number - cfg->start_bus_number + 1) << 20;
+            destroy_xen_mappings((unsigned long)pci_mmcfg_virt[i].virt,
+                                 (unsigned long)pci_mmcfg_virt[i].virt + size);
             pci_mmcfg_virt[i].virt = NULL;
             pci_mmcfg_virt[i].cfg = NULL;
         }

While only used on error paths so far, it should still actually do something (which iounmap(), being an empty stub, doesn't).

xen/arch/x86/x86_64/mmconfig_64.c +6 -1
@@ -166,7 +166,12 @@ void __init pci_mmcfg_arch_free(void)
 
     for (i = 0; i < pci_mmcfg_config_num; ++i) {
         if (pci_mmcfg_virt[i].virt) {
-            iounmap(pci_mmcfg_virt[i].virt);
+            unsigned long size;
+            const struct acpi_mcfg_allocation *cfg = pci_mmcfg_virt[i].cfg;
+
+            size = (cfg->end_bus_number - cfg->start_bus_number + 1) << 20;
+            destroy_xen_mappings((unsigned long)pci_mmcfg_virt[i].virt,
+                                 (unsigned long)pci_mmcfg_virt[i].virt + size);
             pci_mmcfg_virt[i].virt = NULL;
             pci_mmcfg_virt[i].cfg = NULL;
         }

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel