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

Re: [Xen-devel] [xen-unstable] Commit 2ca9fbd739b8a72b16dd790d0fff7b75f5488fb8 AMD IOMMU: allocate IRTE entries instead of using a static mapping, makes dom0 boot process stall several times.



>>> On 23.08.13 at 17:29, Sander Eikelenboom <linux@xxxxxxxxxxxxxx> wrote:
> (XEN) [2013-08-23 15:22:50]   0000:00:14:0:
> (XEN) [2013-08-23 15:22:50]     IRTE[000] 00a80445
> (XEN) [2013-08-23 15:22:50]     IRTE[001] 00f00145
> (XEN) [2013-08-23 15:22:50]     IRTE[002] 00380145
> (XEN) [2013-08-23 15:22:50]     IRTE[003] 00f10145
> (XEN) [2013-08-23 15:22:50]     IRTE[004] 00400145
> (XEN) [2013-08-23 15:22:50]     IRTE[005] 00480145
> (XEN) [2013-08-23 15:22:50]     IRTE[006] 00500145
> (XEN) [2013-08-23 15:22:50]     IRTE[007] 00580145
> (XEN) [2013-08-23 15:22:50]     IRTE[008] 00680145
> (XEN) [2013-08-23 15:22:50]     IRTE[009] 00700145
> (XEN) [2013-08-23 15:22:50]     IRTE[00a] 00780145
> (XEN) [2013-08-23 15:22:50]     IRTE[00b] 00883f45
> (XEN) [2013-08-23 15:22:50]     IRTE[00c] 00900145
> (XEN) [2013-08-23 15:22:50]     IRTE[00d] 00980145
> (XEN) [2013-08-23 15:22:50]     IRTE[00e] 00600141
> (XEN) [2013-08-23 15:22:50]     IRTE[00f] 00210141
> (XEN) [2013-08-23 15:22:50]     IRTE[010] 00d80141

The use on only entry 0 here made clear that this was a really trivial
oversight of the original patch. Please try the additional change
below.

It also alters a bogus comparison in the original code (note the
extra ! in (!msi_desc->hpet_id != hpet_sbdf.id)) - I can't see why
it would have been coded that way, but double checking the
output with "iommu=debug" for the absence of the respective
message would be very helpful.

Jan

--- a/xen/drivers/passthrough/amd/iommu_intr.c
+++ b/xen/drivers/passthrough/amd/iommu_intr.c
@@ -595,14 +595,31 @@ void* __init amd_iommu_alloc_intremap_ta
 
 int __init amd_setup_hpet_msi(struct msi_desc *msi_desc)
 {
-    if ( (!msi_desc->hpet_id != hpet_sbdf.id) ||
-         (hpet_sbdf.iommu == NULL) )
+    spinlock_t *lock;
+    unsigned long flags;
+    int rc = 0;
+
+    if ( msi_desc->hpet_id != hpet_sbdf.id || !hpet_sbdf.iommu )
     {
-        AMD_IOMMU_DEBUG("Fail to setup HPET MSI remapping\n");
-        return 1;
+        AMD_IOMMU_DEBUG("Failed to setup HPET MSI remapping: %s\n",
+                        hpet_sbdf.iommu ? "Wrong HPET" : "No IOMMU");
+        return -ENODEV;
     }
 
-    return 0;
+    lock = get_intremap_lock(hpet_sbdf.seg, hpet_sbdf.bdf);
+    spin_lock_irqsave(lock, flags);
+
+    msi_desc->remap_index = alloc_intremap_entry(hpet_sbdf.seg,
+                                                 hpet_sbdf.bdf, 1);
+    if ( msi_desc->remap_index >= INTREMAP_ENTRIES )
+    {
+        msi_desc->remap_index = -1;
+        rc = -ENXIO;
+    }
+
+    spin_unlock_irqrestore(lock, flags);
+
+    return rc;
 }
 
 static void dump_intremap_table(const u32 *table)



_______________________________________________
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®.