From: Arnd Bergmann <arnd@kernel.org>
To: "Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
"Maxime Ripard" <mripard@kernel.org>,
"Thomas Zimmermann" <tzimmermann@suse.de>,
"David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>,
"Matthew Brost" <matthew.brost@intel.com>,
"Thomas Hellström" <thomas.hellstrom@linux.intel.com>,
"Rodrigo Vivi" <rodrigo.vivi@intel.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>,
Lucas De Marchi <demarchi@kernel.org>,
Matthew Auld <matthew.auld@intel.com>,
Francois Dugast <francois.dugast@intel.com>,
Andrew Morton <akpm@linux-foundation.org>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
intel-xe@lists.freedesktop.org
Subject: [PATCH] [v2] drm/pagemap: pass pagemap_addr by reference
Date: Mon, 16 Feb 2026 14:46:01 +0100 [thread overview]
Message-ID: <20260216134644.1025365-1-arnd@kernel.org> (raw)
From: Arnd Bergmann <arnd@arndb.de>
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.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/gpu/drm/drm_gpusvm.c | 2 +-
drivers/gpu/drm/drm_pagemap.c | 2 +-
drivers/gpu/drm/xe/xe_svm.c | 8 ++++----
include/drm/drm_pagemap.h | 2 +-
4 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/drm_gpusvm.c b/drivers/gpu/drm/drm_gpusvm.c
index c25f50cad6fe..81626b00b755 100644
--- a/drivers/gpu/drm/drm_gpusvm.c
+++ b/drivers/gpu/drm/drm_gpusvm.c
@@ -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;
}
diff --git a/drivers/gpu/drm/drm_pagemap.c b/drivers/gpu/drm/drm_pagemap.c
index d0041c947a28..22579806c055 100644
--- a/drivers/gpu/drm/drm_pagemap.c
+++ b/drivers/gpu/drm/drm_pagemap.c
@@ -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);
diff --git a/drivers/gpu/drm/xe/xe_svm.c b/drivers/gpu/drm/xe/xe_svm.c
index 213f0334518a..78f4b2c60670 100644
--- a/drivers/gpu/drm/xe/xe_svm.c
+++ b/drivers/gpu/drm/xe/xe_svm.c
@@ -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)
diff --git a/include/drm/drm_pagemap.h b/include/drm/drm_pagemap.h
index 2baf0861f78f..c848f578e3da 100644
--- a/include/drm/drm_pagemap.h
+++ b/include/drm/drm_pagemap.h
@@ -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,
--
2.39.5
next reply other threads:[~2026-02-16 13:46 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-16 13:46 Arnd Bergmann [this message]
2026-02-16 13:57 ` ✗ CI.checkpatch: warning for drm/pagemap: pass pagemap_addr by reference (rev2) Patchwork
2026-02-16 13:59 ` ✓ CI.KUnit: success " Patchwork
2026-02-16 13:59 ` [PATCH] [v2] drm/pagemap: pass pagemap_addr by reference Thomas Hellström
2026-02-17 12:21 ` Thomas Hellström
2026-02-16 15:11 ` ✓ Xe.CI.BAT: success for drm/pagemap: pass pagemap_addr by reference (rev2) Patchwork
2026-02-16 18:57 ` ✗ Xe.CI.FULL: failure " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260216134644.1025365-1-arnd@kernel.org \
--to=arnd@kernel.org \
--cc=airlied@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=demarchi@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=francois.dugast@intel.com \
--cc=himal.prasad.ghimiray@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=matthew.auld@intel.com \
--cc=matthew.brost@intel.com \
--cc=mripard@kernel.org \
--cc=rodrigo.vivi@intel.com \
--cc=simona@ffwll.ch \
--cc=thomas.hellstrom@linux.intel.com \
--cc=tzimmermann@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox