drm/pagemap: pass pagemap_addr by reference

Passing a structure by value into a function is sometimes problematic,
for a number of reasons. Of of these is a warning from the 32-bit arm
compiler:

drivers/gpu/drm/drm_gpusvm.c: In function '__drm_gpusvm_unmap_pages':
drivers/gpu/drm/drm_gpusvm.c:1152:33: note: parameter passing for argument of type 'struct drm_pagemap_addr' changed in GCC 9.1
 1152 |                                 dpagemap->ops->device_unmap(dpagemap,
      |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1153 |                                                             dev, *addr);
      |                                                             ~~~~~~~~~~~

This particular problem is harmless since we are not mixing compiler versions
inside of the compiler. However, passing this by reference avoids the warning
along with providing slightly better calling conventions as it avoids an
extra copy on the stack.

Fixes: 75af93b3f5 ("drm/pagemap, drm/xe: Support destination migration over interconnect")
Fixes: 2df55d9e66 ("drm/xe: Support pcie p2p dma as a fast interconnect")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Link: https://patch.msgid.link/20260216134644.1025365-1-arnd@kernel.org
Acked-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
(cherry picked from commit 95162db0208aee122d10ac1342fe97a1721cd258)
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
This commit is contained in:
Arnd Bergmann 2026-02-16 14:46:01 +01:00 committed by Rodrigo Vivi
parent 4e83a8d58e
commit b61d565166
No known key found for this signature in database
GPG key ID: FA625F640EEB13CA
4 changed files with 7 additions and 7 deletions

View file

@ -1150,7 +1150,7 @@ static void __drm_gpusvm_unmap_pages(struct drm_gpusvm *gpusvm,
addr->dir);
else if (dpagemap && dpagemap->ops->device_unmap)
dpagemap->ops->device_unmap(dpagemap,
dev, *addr);
dev, addr);
i += 1 << addr->order;
}

View file

@ -318,7 +318,7 @@ static void drm_pagemap_migrate_unmap_pages(struct device *dev,
struct drm_pagemap_zdd *zdd = page->zone_device_data;
struct drm_pagemap *dpagemap = zdd->dpagemap;
dpagemap->ops->device_unmap(dpagemap, dev, pagemap_addr[i]);
dpagemap->ops->device_unmap(dpagemap, dev, &pagemap_addr[i]);
} else {
dma_unmap_page(dev, pagemap_addr[i].addr,
PAGE_SIZE << pagemap_addr[i].order, dir);

View file

@ -1676,13 +1676,13 @@ xe_drm_pagemap_device_map(struct drm_pagemap *dpagemap,
static void xe_drm_pagemap_device_unmap(struct drm_pagemap *dpagemap,
struct device *dev,
struct drm_pagemap_addr addr)
const struct drm_pagemap_addr *addr)
{
if (addr.proto != XE_INTERCONNECT_P2P)
if (addr->proto != XE_INTERCONNECT_P2P)
return;
dma_unmap_resource(dev, addr.addr, PAGE_SIZE << addr.order,
addr.dir, DMA_ATTR_SKIP_CPU_SYNC);
dma_unmap_resource(dev, addr->addr, PAGE_SIZE << addr->order,
addr->dir, DMA_ATTR_SKIP_CPU_SYNC);
}
static void xe_pagemap_destroy_work(struct work_struct *work)

View file

@ -95,7 +95,7 @@ struct drm_pagemap_ops {
*/
void (*device_unmap)(struct drm_pagemap *dpagemap,
struct device *dev,
struct drm_pagemap_addr addr);
const struct drm_pagemap_addr *addr);
/**
* @populate_mm: Populate part of the mm with @dpagemap memory,