Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm: Drop HPAGE_PMD_SIZE dependency in dma_iova_try_alloc calls
@ 2026-05-07  9:16 Francois Dugast
  2026-05-07  9:21 ` ✗ CI.checkpatch: warning for " Patchwork
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Francois Dugast @ 2026-05-07  9:16 UTC (permalink / raw)
  To: intel-xe; +Cc: dri-devel, matthew.brost, himal.prasad.ghimiray, Francois Dugast

The phys argument to dma_iova_try_alloc() is used only to compute
the sub-granule offset (phys & (granule - 1)). Since HPAGE_PMD_SIZE
is a power of two larger than any IOMMU granule, this expression
always evaluates to zero.

Replace the ternary expressions with a plain 0, which is what the
API documentation recommends for callers doing PAGE_SIZE-aligned
transfers. This also removes the dependency on HPAGE_PMD_SIZE and
thus on CONFIG_PGTABLE_HAS_HUGE_LEAVES / HAVE_ARCH_TRANSPARENT_HUGEPAGE,
fixing build failures on architectures such as arm32 that lack that
config.

Signed-off-by: Francois Dugast <francois.dugast@intel.com>
Assisted-by: GitHub Copilot:claude-sonnet-4.6 # Documentation
Link: https://lore.kernel.org/intel-xe/c36e7dfb-cf62-4d21-a3b1-f54cb43e0832@infradead.org/
---
 drivers/gpu/drm/drm_gpusvm.c  | 5 +----
 drivers/gpu/drm/drm_pagemap.c | 5 +----
 2 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/drm_gpusvm.c b/drivers/gpu/drm/drm_gpusvm.c
index 365a9c0b522a..958cb605aedd 100644
--- a/drivers/gpu/drm/drm_gpusvm.c
+++ b/drivers/gpu/drm/drm_gpusvm.c
@@ -1556,10 +1556,7 @@ int drm_gpusvm_get_pages(struct drm_gpusvm *gpusvm,
 
 			if (!i)
 				dma_iova_try_alloc(gpusvm->drm->dev, state,
-						   npages * PAGE_SIZE >=
-						   HPAGE_PMD_SIZE ?
-						   HPAGE_PMD_SIZE : 0,
-						   npages * PAGE_SIZE);
+						   0, npages * PAGE_SIZE);
 
 			if (dma_use_iova(state)) {
 				err = dma_iova_link(gpusvm->drm->dev, state,
diff --git a/drivers/gpu/drm/drm_pagemap.c b/drivers/gpu/drm/drm_pagemap.c
index d82ea7ccb8da..15c78eca180b 100644
--- a/drivers/gpu/drm/drm_pagemap.c
+++ b/drivers/gpu/drm/drm_pagemap.c
@@ -347,10 +347,7 @@ drm_pagemap_migrate_map_system_pages(struct device *dev,
 
 		if (!try_alloc) {
 			dma_iova_try_alloc(dev, &state->dma_state,
-					   (npages - i) * PAGE_SIZE >=
-					   HPAGE_PMD_SIZE ?
-					   HPAGE_PMD_SIZE : 0,
-					   npages * PAGE_SIZE);
+					   0, npages * PAGE_SIZE);
 			try_alloc = true;
 		}
 
-- 
2.43.0


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

end of thread, other threads:[~2026-05-07 20:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-07  9:16 [PATCH] drm: Drop HPAGE_PMD_SIZE dependency in dma_iova_try_alloc calls Francois Dugast
2026-05-07  9:21 ` ✗ CI.checkpatch: warning for " Patchwork
2026-05-07  9:23 ` ✓ CI.KUnit: success " Patchwork
2026-05-07 10:27 ` ✓ Xe.CI.BAT: " Patchwork
2026-05-07 13:50 ` [PATCH] " Matthew Brost
2026-05-07 20:25 ` ✗ Xe.CI.FULL: failure for " Patchwork

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