Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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: 75af93b3f5d0 ("drm/pagemap, drm/xe: Support destination migration over interconnect")
Fixes: 2df55d9e66a2 ("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>

authored by

Arnd Bergmann and committed by
Rodrigo Vivi
b61d5651 4e83a8d5

+7 -7
+1 -1
drivers/gpu/drm/drm_gpusvm.c
··· 1150 1150 addr->dir); 1151 1151 else if (dpagemap && dpagemap->ops->device_unmap) 1152 1152 dpagemap->ops->device_unmap(dpagemap, 1153 - dev, *addr); 1153 + dev, addr); 1154 1154 i += 1 << addr->order; 1155 1155 } 1156 1156
+1 -1
drivers/gpu/drm/drm_pagemap.c
··· 318 318 struct drm_pagemap_zdd *zdd = page->zone_device_data; 319 319 struct drm_pagemap *dpagemap = zdd->dpagemap; 320 320 321 - dpagemap->ops->device_unmap(dpagemap, dev, pagemap_addr[i]); 321 + dpagemap->ops->device_unmap(dpagemap, dev, &pagemap_addr[i]); 322 322 } else { 323 323 dma_unmap_page(dev, pagemap_addr[i].addr, 324 324 PAGE_SIZE << pagemap_addr[i].order, dir);
+4 -4
drivers/gpu/drm/xe/xe_svm.c
··· 1676 1676 1677 1677 static void xe_drm_pagemap_device_unmap(struct drm_pagemap *dpagemap, 1678 1678 struct device *dev, 1679 - struct drm_pagemap_addr addr) 1679 + const struct drm_pagemap_addr *addr) 1680 1680 { 1681 - if (addr.proto != XE_INTERCONNECT_P2P) 1681 + if (addr->proto != XE_INTERCONNECT_P2P) 1682 1682 return; 1683 1683 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); 1686 1686 } 1687 1687 1688 1688 static void xe_pagemap_destroy_work(struct work_struct *work)
+1 -1
include/drm/drm_pagemap.h
··· 95 95 */ 96 96 void (*device_unmap)(struct drm_pagemap *dpagemap, 97 97 struct device *dev, 98 - struct drm_pagemap_addr addr); 98 + const struct drm_pagemap_addr *addr); 99 99 100 100 /** 101 101 * @populate_mm: Populate part of the mm with @dpagemap memory,