Kernel KVM virtualization development
 help / color / mirror / Atom feed
* [PATCH] vfio/spapr: Remove the redundant TCE page containment check
@ 2026-12-04 15:09 Wanhui Fu
  2026-12-04 17:28 ` Alex Williamson
  0 siblings, 1 reply; 2+ messages in thread
From: Wanhui Fu @ 2026-12-04 15:09 UTC (permalink / raw)
  To: tpearson, alex; +Cc: kvm, Wanhui Fu

tce_iommu_build() uses a default DMA window with 4 KB TCE pages. A
successfully pinned system page is at least 4 KB, so the containment
check always succeeds for system memory. The device memory case requires
a region registered through mm_iommu_newdev(), which has no in-tree
callers since the removal of the NVLink2 driver.

Remove the redundant check from tce_iommu_build(). The v2 mapping path
still needs the check because it supports larger TCE pages.

Found by self-developed static analysis tool and compile-test passed.

Signed-off-by: Wanhui Fu <fuwh1120@163.com>
---
 drivers/vfio/vfio_iommu_spapr_tce.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/drivers/vfio/vfio_iommu_spapr_tce.c b/drivers/vfio/vfio_iommu_spapr_tce.c
index 1c0eec228cc6..ea1509d93005 100644
--- a/drivers/vfio/vfio_iommu_spapr_tce.c
+++ b/drivers/vfio/vfio_iommu_spapr_tce.c
@@ -512,12 +512,6 @@ static long tce_iommu_build(struct tce_container *container,
 		if (ret)
 			break;
 
-		if (!tce_page_is_contained(container->mm, hpa,
-				tbl->it_page_shift)) {
-			ret = -EPERM;
-			break;
-		}
-
 		hpa |= offset;
 		dirtmp = direction;
 		ret = iommu_tce_xchg_no_kill(container->mm, tbl, entry + i,
-- 
2.25.1


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

end of thread, other threads:[~2026-12-04 17:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-04 15:09 [PATCH] vfio/spapr: Remove the redundant TCE page containment check Wanhui Fu
2026-12-04 17:28 ` Alex Williamson

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