]> xenbits.xensource.com Git - people/aperard/xen-arm.git/commitdiff
IOMMU/ATS: fix maximum queue depth calculation
authorJan Beulich <jbeulich@suse.com>
Wed, 5 Dec 2012 08:52:14 +0000 (09:52 +0100)
committerJan Beulich <jbeulich@suse.com>
Wed, 5 Dec 2012 08:52:14 +0000 (09:52 +0100)
The capabilities register field is a 5-bit value, and the 5 bits all
being zero actually means 32 entries.

Under the assumption that amd_iommu_flush_iotlb() really just tried
to correct for the miscalculation above when adding 32 to the value,
that adjustment is also being removed.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by Xiantao Zhang <xiantao.zhang@intel.com>
Acked-by: Wei Huang <wei.huang2@amd.com>
xen/drivers/passthrough/amd/iommu_cmd.c
xen/drivers/passthrough/ats.h
xen/drivers/passthrough/x86/ats.c

index 5aaad9e766f1c8ec0e28bdc08d7fae3ad0d4c60b..e39e7e1440901fbdd88fcb8d226edf48578512f7 100644 (file)
@@ -321,7 +321,7 @@ void amd_iommu_flush_iotlb(struct pci_dev *pdev,
 
     req_id = get_dma_requestor_id(iommu->seg, bdf);
     queueid = req_id;
-    maxpend = (ats_pdev->ats_queue_depth + 32) & 0xff;
+    maxpend = ats_pdev->ats_queue_depth & 0xff;
 
     /* send INVALIDATE_IOTLB_PAGES command */
     spin_lock_irqsave(&iommu->lock, flags);
index 0c9f1ffd63c8572b327c9fc0554eeb2a31862ee2..cf649d4a91c75ff1b92480e34ac0f960a55ca68c 100644 (file)
@@ -28,7 +28,7 @@ struct pci_ats_dev {
 
 #define ATS_REG_CAP    4
 #define ATS_REG_CTL    6
-#define ATS_QUEUE_DEPTH_MASK     0xF
+#define ATS_QUEUE_DEPTH_MASK     0x1f
 #define ATS_ENABLE               (1<<15)
 
 extern struct list_head ats_devices;
index 3aff8e1bce91c80baa2297118322b06b5c508066..674b54a4f6cdbdbd2c4e258c1f168e0df2e44a7f 100644 (file)
@@ -93,7 +93,8 @@ int enable_ats_device(int seg, int bus, int devfn)
         pdev->devfn = devfn;
         value = pci_conf_read16(seg, bus, PCI_SLOT(devfn),
                                 PCI_FUNC(devfn), pos + ATS_REG_CAP);
-        pdev->ats_queue_depth = value & ATS_QUEUE_DEPTH_MASK;
+        pdev->ats_queue_depth = value & ATS_QUEUE_DEPTH_MASK ?:
+                                ATS_QUEUE_DEPTH_MASK + 1;
         list_add(&pdev->list, &ats_devices);
     }