Skip to content

Commit

Permalink
iommu/vt-d: Fix to flush cache of PASID directory table
Browse files Browse the repository at this point in the history
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 it by
calculating the size by page order.

Found this when reading the code, no real problem encountered for now.

Fixes: 194b334 ("iommu/vt-d: Fix PASID directory pointer coherency")
Suggested-by: Lu Baolu <baolu.lu@linux.intel.com>
Signed-off-by: Yanfei Xu <yanfei.xu@intel.com>
Link: https://lore.kernel.org/r/20230616081045.721873-1-yanfei.xu@intel.com
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
  • Loading branch information
YanfeiXu authored and joergroedel committed Aug 9, 2023
1 parent d3aedf9 commit 8a3b8e6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/iommu/intel/pasid.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ int intel_pasid_alloc_table(struct device *dev)
info->pasid_table = pasid_table;

if (!ecap_coherent(info->iommu->ecap))
clflush_cache_range(pasid_table->table, size);
clflush_cache_range(pasid_table->table, (1 << order) * PAGE_SIZE);

return 0;
}
Expand Down

0 comments on commit 8a3b8e6

Please sign in to comment.