mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 09:36:22 +02:00
drm: Drop HPAGE_PMD_SIZE dependency in dma_iova_try_alloc calls
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/ Reviewed-by: Matthew Brost <matthew.brost@intel.com> Link: https://patch.msgid.link/20260507091606.1067973-1-francois.dugast@intel.com Fixes:2e0cd372b8("drm/pagemap: Use dma-map IOVA alloc, link, and sync API for DRM pagemap") Fixes:37ad039fb3("drm/gpusvm: Use dma-map IOVA alloc, link, and sync API in GPU SVM") Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
This commit is contained in:
parent
9865948b87
commit
9175f49330
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user