Skip to content

Commit 48811c4

Browse files
LuBaolujoergroedel
authored andcommitted
iommu/vt-d: Allow devices to have more than 32 outstanding PRs
The minimum per-IOMMU PRQ queue size is one 4K page, this is more entries than the hardcoded limit of 32 in the current VT-d code. Some devices can support up to 512 outstanding PRQs but underutilized by this limit of 32. Although, 32 gives some rough fairness when multiple devices share the same IOMMU PRQ queue, but far from optimal for customized use case. This extends the per-IOMMU PRQ queue size to four 4K pages and let the devices have as many outstanding page requests as they can. Signed-off-by: Jacob Pan <[email protected]> Signed-off-by: Lu Baolu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joerg Roedel <[email protected]>
1 parent 289b3b0 commit 48811c4

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

drivers/iommu/intel/iommu.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include <linux/iommu.h>
3434
#include <linux/dma-iommu.h>
3535
#include <linux/intel-iommu.h>
36+
#include <linux/intel-svm.h>
3637
#include <linux/syscore_ops.h>
3738
#include <linux/tboot.h>
3839
#include <linux/dmi.h>
@@ -1541,7 +1542,7 @@ static void iommu_enable_dev_iotlb(struct device_domain_info *info)
15411542

15421543
if (info->pri_supported &&
15431544
(info->pasid_enabled ? pci_prg_resp_pasid_required(pdev) : 1) &&
1544-
!pci_reset_pri(pdev) && !pci_enable_pri(pdev, 32))
1545+
!pci_reset_pri(pdev) && !pci_enable_pri(pdev, PRQ_DEPTH))
15451546
info->pri_enabled = 1;
15461547
#endif
15471548
if (info->ats_supported && pci_ats_page_aligned(pdev) &&

drivers/iommu/intel/svm.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ static irqreturn_t prq_event_thread(int irq, void *d);
3131
static void intel_svm_drain_prq(struct device *dev, u32 pasid);
3232
#define to_intel_svm_dev(handle) container_of(handle, struct intel_svm_dev, sva)
3333

34-
#define PRQ_ORDER 0
35-
3634
static DEFINE_XARRAY_ALLOC(pasid_private_array);
3735
static int pasid_private_add(ioasid_t pasid, void *priv)
3836
{
@@ -724,8 +722,6 @@ struct page_req_dsc {
724722
u64 priv_data[2];
725723
};
726724

727-
#define PRQ_RING_MASK ((0x1000 << PRQ_ORDER) - 0x20)
728-
729725
static bool is_canonical_address(u64 addr)
730726
{
731727
int shift = 64 - (__VIRTUAL_MASK_SHIFT + 1);

include/linux/intel-svm.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@
1414
#define SVM_REQ_EXEC (1<<1)
1515
#define SVM_REQ_PRIV (1<<0)
1616

17+
/* Page Request Queue depth */
18+
#define PRQ_ORDER 2
19+
#define PRQ_RING_MASK ((0x1000 << PRQ_ORDER) - 0x20)
20+
#define PRQ_DEPTH ((0x1000 << PRQ_ORDER) >> 5)
21+
1722
/*
1823
* The SVM_FLAG_SUPERVISOR_MODE flag requests a PASID which can be used only
1924
* for access to kernel addresses. No IOTLB flushes are automatically done

0 commit comments

Comments
 (0)