iommu/vt-d: Size Page Request Queue to avoid overflow condition
authorLu Baolu <baolu.lu@linux.intel.com>
Tue, 10 May 2022 02:34:03 +0000 (10:34 +0800)
committerJoerg Roedel <jroedel@suse.de>
Fri, 13 May 2022 13:14:56 +0000 (15:14 +0200)
commitea661ad6e1573d5b08c27444ff2ed403bf39ff66
treec415c0ad4eaae5e6b7396c2041b83e01049ed2af
parentbac4e778d67a5f0fd8cc49029c1fff127b86c874
iommu/vt-d: Size Page Request Queue to avoid overflow condition

PRQ overflow may cause I/O throughput congestion, resulting in unnecessary
degradation of I/O performance. Appropriately increasing the length of PRQ
can greatly reduce the occurrence of PRQ overflow. The count of maximum
page requests that can be generated in parallel by a PCIe device is
statically defined in the Outstanding Page Request Capacity field of the
PCIe ATS configure space.

The new length of PRQ is calculated by summing up the value of Outstanding
Page Request Capacity register across all devices where Page Requests are
supported on the real PR-capable platform (Intel Sapphire Rapids). The
result is round to the nearest higher power of 2.

The PRQ length is also double sized as the VT-d IOMMU driver only updates
the Page Request Queue Head Register (PQH_REG) after processing the entire
queue.

Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Link: https://lore.kernel.org/r/20220421113558.3504874-1-baolu.lu@linux.intel.com
Link: https://lore.kernel.org/r/20220510023407.2759143-5-baolu.lu@linux.intel.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
include/linux/intel-svm.h