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>
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;