Skip to content

Commit b61d565

Browse files
arndbrodrigovivi
authored andcommitted
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: 75af93b ("drm/pagemap, drm/xe: Support destination migration over interconnect") Fixes: 2df55d9 ("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 95162db) Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
1 parent 4e83a8d commit b61d565

4 files changed

Lines changed: 7 additions & 7 deletions

File tree

drivers/gpu/drm/drm_gpusvm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1150,7 +1150,7 @@ static void __drm_gpusvm_unmap_pages(struct drm_gpusvm *gpusvm,
11501150
addr->dir);
11511151
else if (dpagemap && dpagemap->ops->device_unmap)
11521152
dpagemap->ops->device_unmap(dpagemap,
1153-
dev, *addr);
1153+
dev, addr);
11541154
i += 1 << addr->order;
11551155
}
11561156

drivers/gpu/drm/drm_pagemap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ static void drm_pagemap_migrate_unmap_pages(struct device *dev,
318318
struct drm_pagemap_zdd *zdd = page->zone_device_data;
319319
struct drm_pagemap *dpagemap = zdd->dpagemap;
320320

321-
dpagemap->ops->device_unmap(dpagemap, dev, pagemap_addr[i]);
321+
dpagemap->ops->device_unmap(dpagemap, dev, &pagemap_addr[i]);
322322
} else {
323323
dma_unmap_page(dev, pagemap_addr[i].addr,
324324
PAGE_SIZE << pagemap_addr[i].order, dir);

drivers/gpu/drm/xe/xe_svm.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1676,13 +1676,13 @@ xe_drm_pagemap_device_map(struct drm_pagemap *dpagemap,
16761676

16771677
static void xe_drm_pagemap_device_unmap(struct drm_pagemap *dpagemap,
16781678
struct device *dev,
1679-
struct drm_pagemap_addr addr)
1679+
const struct drm_pagemap_addr *addr)
16801680
{
1681-
if (addr.proto != XE_INTERCONNECT_P2P)
1681+
if (addr->proto != XE_INTERCONNECT_P2P)
16821682
return;
16831683

1684-
dma_unmap_resource(dev, addr.addr, PAGE_SIZE << addr.order,
1685-
addr.dir, DMA_ATTR_SKIP_CPU_SYNC);
1684+
dma_unmap_resource(dev, addr->addr, PAGE_SIZE << addr->order,
1685+
addr->dir, DMA_ATTR_SKIP_CPU_SYNC);
16861686
}
16871687

16881688
static void xe_pagemap_destroy_work(struct work_struct *work)

include/drm/drm_pagemap.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ struct drm_pagemap_ops {
9595
*/
9696
void (*device_unmap)(struct drm_pagemap *dpagemap,
9797
struct device *dev,
98-
struct drm_pagemap_addr addr);
98+
const struct drm_pagemap_addr *addr);
9999

100100
/**
101101
* @populate_mm: Populate part of the mm with @dpagemap memory,

0 commit comments

Comments
 (0)