[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] Asus X99-A VT-d problems



>>> On 09.09.15 at 10:56, <JBeulich@xxxxxxxx> wrote:
>>>> On 08.09.15 at 15:21, <kiviniemi.valtteri@xxxxxxxxx> wrote:
>> I got Xen booting now with VT-d enabled, lot's of errors and the system is
>> unstable. xl dmesg output:
> 
> Lots of errors? I don't see much - can you point out the errors you see?
> There are two interesting things:
> 
>> (XEN) [VT-D]iommu.c:1149: drhd->address = fbffd000 iommu->reg = 
>> ffff82c000201000
>> (XEN) [VT-D]iommu.c:1151: cap = d2008c10ef0466 ecap = f0205b
>>[...]
>> (XEN) [VT-D]iommu.c:1149: drhd->address = fbffc000 iommu->reg = 
>> ffff82c000203000
>> (XEN) [VT-D]iommu.c:1151: cap = d2078c106f0466 ecap = f020df
> 
> Two IOMMUs with different capabilities. I'll have to look at what
> specifically one supports which the other doesn't, but I wouldn't
> be surprised if code wouldn't fully cope with that.

cap[40..42] represent the number of fault registers (afaict not an
issue if there's just one).

ecap[2] (device IOTLB) is relevant only when using ATS, which you
don't enable.

ecap[7] (snoop control) unavailable on any IOMMU will just lead
to it not getting used at all (equivalent to "iommu=no-snoop" on
the command line).

So all in all the feature differences are benign.

>> (XEN) Failed to enable Interrupt Remapping: Will not enable x2APIC.
> 
> But later ...
> 
>> (XEN) Intel VT-d iommu 0 supported page sizes: 4kB, 2MB, 1GB.
>> (XEN) Intel VT-d iommu 1 supported page sizes: 4kB, 2MB, 1GB.
>> (XEN) Intel VT-d Snoop Control not enabled.
>> (XEN) Intel VT-d Dom0 DMA Passthrough not enabled.
>> (XEN) Intel VT-d Queued Invalidation enabled.
>> (XEN) Intel VT-d Interrupt Remapping enabled.
> 
> ... and ...
> 
>> (XEN) I/O virtualisation enabled
>> (XEN)  - Dom0 mode: Relaxed
>> (XEN) Interrupt remapping enabled
> 
> I'll have to check what this inconsistency means.

So from all I can tell this is bogus message wording when the firmware
requests the OS not to enabled x2APIC mode. Below a patch hopefully
making this less confusing.

Jan

--- unstable.orig/xen/arch/x86/apic.c
+++ unstable/xen/arch/x86/apic.c
@@ -943,8 +943,18 @@ void __init x2apic_bsp_setup(void)
     mask_8259A();
     mask_IO_APIC_setup(ioapic_entries);
 
-    if ( iommu_enable_x2apic_IR() )
+    switch ( iommu_enable_x2apic_IR() )
     {
+    case 0:
+        break;
+    case -ENXIO: /* ACPI_DMAR_X2APIC_OPT_OUT set */
+        if ( !x2apic_enabled )
+        {
+            printk("Not enabling x2APIC (upon firmware request)\n");
+            goto restore_out;
+        }
+        /* fall through */
+    default:
         if ( x2apic_enabled )
             panic("Interrupt remapping could not be enabled while "
                   "x2APIC is already enabled by BIOS");
--- unstable.orig/xen/drivers/passthrough/vtd/intremap.c
+++ unstable/xen/drivers/passthrough/vtd/intremap.c
@@ -143,10 +143,10 @@ static void set_hpet_source_id(unsigned 
     set_ire_sid(ire, SVT_VERIFY_SID_SQ, SQ_13_IGNORE_3, hpetid_to_bdf(id));
 }
 
-int iommu_supports_eim(void)
+bool_t iommu_supports_eim(void)
 {
     struct acpi_drhd_unit *drhd;
-    int apic;
+    unsigned int apic;
 
     if ( !iommu_qinval || !iommu_intremap || list_empty(&acpi_drhd_units) )
         return 0;
@@ -154,12 +154,12 @@ int iommu_supports_eim(void)
     /* We MUST have a DRHD unit for each IOAPIC. */
     for ( apic = 0; apic < nr_ioapics; apic++ )
         if ( !ioapic_to_drhd(IO_APIC_ID(apic)) )
-    {
+        {
             dprintk(XENLOG_WARNING VTDPREFIX,
                     "There is not a DRHD for IOAPIC %#x (id: %#x)!\n",
                     apic, IO_APIC_ID(apic));
             return 0;
-    }
+        }
 
     for_each_drhd_unit ( drhd )
         if ( !ecap_queued_inval(drhd->iommu->ecap) ||
@@ -833,10 +833,10 @@ int iommu_enable_x2apic_IR(void)
     struct iommu *iommu;
 
     if ( !iommu_supports_eim() )
-        return -1;
+        return -EOPNOTSUPP;
 
     if ( !platform_supports_x2apic() )
-        return -1;
+        return -ENXIO;
 
     for_each_drhd_unit ( drhd )
     {
@@ -861,7 +861,7 @@ int iommu_enable_x2apic_IR(void)
         {
             dprintk(XENLOG_INFO VTDPREFIX,
                     "Failed to enable Queued Invalidation!\n");
-            return -1;
+            return -EIO;
         }
     }
 
@@ -873,7 +873,7 @@ int iommu_enable_x2apic_IR(void)
         {
             dprintk(XENLOG_INFO VTDPREFIX,
                     "Failed to enable Interrupt Remapping!\n");
-            return -1;
+            return -EIO;
         }
     }
 
--- unstable.orig/xen/include/asm-x86/iommu.h
+++ unstable/xen/include/asm-x86/iommu.h
@@ -27,7 +27,7 @@ int iommu_setup_hpet_msi(struct msi_desc
 /* While VT-d specific, this must get declared in a generic header. */
 int adjust_vtd_irq_affinities(void);
 void iommu_pte_flush(struct domain *d, u64 gfn, u64 *pte, int order, int 
present);
-int iommu_supports_eim(void);
+bool_t iommu_supports_eim(void);
 int iommu_enable_x2apic_IR(void);
 void iommu_disable_x2apic_IR(void);
 


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.