]> xenbits.xensource.com Git - xen.git/commitdiff
Intel VT-D: Don't turn x2APIC if there is a missing DRHD entry for the IOAPIC.
authorKeir Fraser <keir.fraser@citrix.com>
Tue, 9 Mar 2010 17:58:11 +0000 (17:58 +0000)
committerKeir Fraser <keir.fraser@citrix.com>
Tue, 9 Mar 2010 17:58:11 +0000 (17:58 +0000)
Follow the Linux kernel lead in which the x2APIC is only turned on
only if there is an DRHD entry for all IOAPICs in the system. If we
don't do this we might enable x2APIC and see various devices not
covered by the IOAPIC mentioned in DRHD, not receive any interrupts.

From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
xen/drivers/passthrough/vtd/intremap.c

index 9459a81736ed7f290ca0fe82364baf84b065a1c9..0b3d95827b4c125fc21f66ac323a3fd581d43a9a 100644 (file)
@@ -127,10 +127,16 @@ static void set_ioapic_source_id(int apic_id, struct iremap_entry *ire)
 int iommu_supports_eim(void)
 {
     struct acpi_drhd_unit *drhd;
+    int apic;
 
     if ( !iommu_enabled || !iommu_qinval || !iommu_intremap )
         return 0;
 
+    /* We MUST have a DRHD unit for each IOAPIC. */
+    for ( apic = 0; apic < nr_ioapics; apic++ )
+        if ( !ioapic_to_iommu(IO_APIC_ID(apic)) )
+            return 0;
+
     if ( list_empty(&acpi_drhd_units) )
         return 0;