]> xenbits.xensource.com Git - people/vhanquez/xen.git/commitdiff
vt-d: Disable VT-d if parsing ACPI DMAR fails
authorKeir Fraser <keir.fraser@citrix.com>
Fri, 18 Jul 2008 10:30:29 +0000 (11:30 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Fri, 18 Jul 2008 10:30:29 +0000 (11:30 +0100)
Signed-off-by: Espen Skoglund <espen.skoglund@netronome.com>
xen-unstable changeset: 18051:e3ead65e75b2e03638c032566033417ed742cd2a
xen-unstable date: Mon Jul 14 15:20:35 2008 +0100

xen/arch/x86/hvm/vmx/vtd/dmar.c

index 62e32e36107555d8967513e3cfaa1e40a66c5c75..a13c2db5644c1cd6f86d6214d704edf3e70bf5e9 100644 (file)
@@ -66,6 +66,29 @@ static int __init acpi_register_rmrr_unit(struct acpi_rmrr_unit *rmrr)
     return 0;
 }
 
+static void __init disable_all_dmar_units(void)
+{
+    struct acpi_drhd_unit *drhd, *_drhd;
+    struct acpi_rmrr_unit *rmrr, *_rmrr;
+    struct acpi_atsr_unit *atsr, *_atsr;
+
+    list_for_each_entry_safe ( drhd, _drhd, &acpi_drhd_units, list )
+    {
+        list_del(&drhd->list);
+        xfree(drhd);
+    }
+    list_for_each_entry_safe ( rmrr, _rmrr, &acpi_rmrr_units, list )
+    {
+        list_del(&rmrr->list);
+        xfree(rmrr);
+    }
+    list_for_each_entry_safe ( atsr, _atsr, &acpi_atsr_units, list )
+    {
+        list_del(&atsr->list);
+        xfree(atsr);
+    }
+}
+
 static int acpi_pci_device_match(struct pci_dev *devices, int cnt,
                                  struct pci_dev *dev)
 {
@@ -534,6 +557,12 @@ static int __init acpi_parse_dmar(unsigned long phys_addr,
     /* Zap APCI DMAR signature to prevent dom0 using vt-d HW. */
     dmar->header.signature[0] = '\0';
 
+    if ( ret )
+    {
+        printk(XENLOG_WARNING "Failed to parse ACPI DMAR.  Disabling VT-d.\n");
+        disable_all_dmar_units();
+    }
+
     return ret;
 }