public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iommu/vt-d: Fix to flush cache of PASID directory table
@ 2023-06-15  7:16 Yanfei Xu
  2023-06-15 23:43 ` Zhang, Tina
  2023-06-16  2:01 ` Baolu Lu
  0 siblings, 2 replies; 6+ messages in thread
From: Yanfei Xu @ 2023-06-15  7:16 UTC (permalink / raw)
  To: dwmw2, baolu.lu, joro, will, robin.murphy; +Cc: iommu, linux-kernel, yanfei.xu

Even the PCI devices don't support pasid capability, PASID
table is mandatory for a PCI device in scalable mode. However
flushing cache of pasid directory table for these devices are
not taken after pasid table is allocated as the "size" of
table is zero. Fix to assign it with a page size.

Fixes: 194b3348bdbb ("iommu/vt-d: Fix PASID directory pointer coherency")
Signed-off-by: Yanfei Xu <yanfei.xu@intel.com>
---
 drivers/iommu/intel/pasid.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/iommu/intel/pasid.c b/drivers/iommu/intel/pasid.c
index c5d479770e12..bde7df055865 100644
--- a/drivers/iommu/intel/pasid.c
+++ b/drivers/iommu/intel/pasid.c
@@ -115,7 +115,9 @@ int intel_pasid_alloc_table(struct device *dev)
 				  intel_pasid_max_id);
 
 	size = max_pasid >> (PASID_PDE_SHIFT - 3);
-	order = size ? get_order(size) : 0;
+	if (!size)
+		size = PAGE_SIZE;
+	order = get_order(size);
 	pages = alloc_pages_node(info->iommu->node,
 				 GFP_KERNEL | __GFP_ZERO, order);
 	if (!pages) {
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-06-16  3:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-15  7:16 [PATCH] iommu/vt-d: Fix to flush cache of PASID directory table Yanfei Xu
2023-06-15 23:43 ` Zhang, Tina
2023-06-16  1:37   ` Yanfei Xu
2023-06-16  2:01 ` Baolu Lu
2023-06-16  3:06   ` Yanfei Xu
2023-06-16  3:11     ` Baolu Lu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox