linux-doc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Zimmermann <tzimmermann@suse.de>
To: boris.brezillon@collabora.com, simona@ffwll.ch,
	airlied@gmail.com, mripard@kernel.org,
	maarten.lankhorst@linux.intel.com, ogabbay@kernel.org,
	mamin506@gmail.com, lizhi.hou@amd.com,
	maciej.falkowski@linux.intel.com,
	karol.wachowski@linux.intel.com, tomeu@tomeuvizoso.net,
	frank.binns@imgtec.com, matt.coster@imgtec.com, yuq825@gmail.com,
	robh@kernel.org, steven.price@arm.com,
	adrian.larumbe@collabora.com, liviu.dudau@arm.com,
	mwen@igalia.com, kraxel@redhat.com,
	dmitry.osipenko@collabora.com, gurchetansingh@chromium.org,
	olvaffe@gmail.com, corbet@lwn.net
Cc: dri-devel@lists.freedesktop.org, lima@lists.freedesktop.org,
	virtualization@lists.linux.dev, linux-doc@vger.kernel.org,
	Thomas Zimmermann <tzimmermann@suse.de>
Subject: [PATCH 11/13] accel/amdxdna: Use GEM-UMA helpers for memory management
Date: Tue,  9 Dec 2025 14:42:08 +0100	[thread overview]
Message-ID: <20251209140141.94407-12-tzimmermann@suse.de> (raw)
In-Reply-To: <20251209140141.94407-1-tzimmermann@suse.de>

Convert amdxdna from GEM-SHMEM to GEM-UMA. The latter is just a copy,
so this change it merely renaming symbols. No functional changes.

GEM-SHMEM will become more self-contained for drivers without specific
memory management. GEM-UMA's interfaces will remain flexible for drivers
with UMA hardware, such as amdxdna.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/accel/amdxdna/Kconfig                 |  2 +-
 drivers/accel/amdxdna/aie2_ctx.c              |  1 -
 drivers/accel/amdxdna/aie2_message.c          |  1 -
 drivers/accel/amdxdna/aie2_pci.c              |  1 -
 drivers/accel/amdxdna/aie2_psp.c              |  1 -
 drivers/accel/amdxdna/aie2_smu.c              |  1 -
 drivers/accel/amdxdna/amdxdna_ctx.c           |  7 ++-
 drivers/accel/amdxdna/amdxdna_gem.c           | 49 +++++++++----------
 drivers/accel/amdxdna/amdxdna_gem.h           |  5 +-
 .../accel/amdxdna/amdxdna_mailbox_helper.c    |  1 -
 drivers/accel/amdxdna/amdxdna_pci_drv.c       |  1 -
 drivers/accel/amdxdna/amdxdna_sysfs.c         |  1 -
 12 files changed, 32 insertions(+), 39 deletions(-)

diff --git a/drivers/accel/amdxdna/Kconfig b/drivers/accel/amdxdna/Kconfig
index f39d7a87296c..a417b18b401f 100644
--- a/drivers/accel/amdxdna/Kconfig
+++ b/drivers/accel/amdxdna/Kconfig
@@ -6,8 +6,8 @@ config DRM_ACCEL_AMDXDNA
 	depends on DRM_ACCEL
 	depends on PCI && HAS_IOMEM
 	depends on X86_64
+	select DRM_GEM_UMA_HELPER
 	select DRM_SCHED
-	select DRM_GEM_SHMEM_HELPER
 	select FW_LOADER
 	select HMM_MIRROR
 	help
diff --git a/drivers/accel/amdxdna/aie2_ctx.c b/drivers/accel/amdxdna/aie2_ctx.c
index 42d876a427c5..7e82496495d3 100644
--- a/drivers/accel/amdxdna/aie2_ctx.c
+++ b/drivers/accel/amdxdna/aie2_ctx.c
@@ -6,7 +6,6 @@
 #include <drm/amdxdna_accel.h>
 #include <drm/drm_device.h>
 #include <drm/drm_gem.h>
-#include <drm/drm_gem_shmem_helper.h>
 #include <drm/drm_print.h>
 #include <drm/drm_syncobj.h>
 #include <linux/hmm.h>
diff --git a/drivers/accel/amdxdna/aie2_message.c b/drivers/accel/amdxdna/aie2_message.c
index d493bb1c3360..2f639c22ebf1 100644
--- a/drivers/accel/amdxdna/aie2_message.c
+++ b/drivers/accel/amdxdna/aie2_message.c
@@ -7,7 +7,6 @@
 #include <drm/drm_cache.h>
 #include <drm/drm_device.h>
 #include <drm/drm_gem.h>
-#include <drm/drm_gem_shmem_helper.h>
 #include <drm/drm_print.h>
 #include <drm/gpu_scheduler.h>
 #include <linux/bitfield.h>
diff --git a/drivers/accel/amdxdna/aie2_pci.c b/drivers/accel/amdxdna/aie2_pci.c
index ceef1c502e9e..498a23a070c9 100644
--- a/drivers/accel/amdxdna/aie2_pci.c
+++ b/drivers/accel/amdxdna/aie2_pci.c
@@ -6,7 +6,6 @@
 #include <drm/amdxdna_accel.h>
 #include <drm/drm_device.h>
 #include <drm/drm_drv.h>
-#include <drm/drm_gem_shmem_helper.h>
 #include <drm/drm_managed.h>
 #include <drm/drm_print.h>
 #include <drm/gpu_scheduler.h>
diff --git a/drivers/accel/amdxdna/aie2_psp.c b/drivers/accel/amdxdna/aie2_psp.c
index f28a060a8810..81145210abf3 100644
--- a/drivers/accel/amdxdna/aie2_psp.c
+++ b/drivers/accel/amdxdna/aie2_psp.c
@@ -4,7 +4,6 @@
  */
 
 #include <drm/drm_device.h>
-#include <drm/drm_gem_shmem_helper.h>
 #include <drm/drm_managed.h>
 #include <drm/drm_print.h>
 #include <drm/gpu_scheduler.h>
diff --git a/drivers/accel/amdxdna/aie2_smu.c b/drivers/accel/amdxdna/aie2_smu.c
index bd94ee96c2bc..a16942aa10a1 100644
--- a/drivers/accel/amdxdna/aie2_smu.c
+++ b/drivers/accel/amdxdna/aie2_smu.c
@@ -4,7 +4,6 @@
  */
 
 #include <drm/drm_device.h>
-#include <drm/drm_gem_shmem_helper.h>
 #include <drm/drm_print.h>
 #include <drm/gpu_scheduler.h>
 #include <linux/iopoll.h>
diff --git a/drivers/accel/amdxdna/amdxdna_ctx.c b/drivers/accel/amdxdna/amdxdna_ctx.c
index d17aef89a0ad..1c02a97b1865 100644
--- a/drivers/accel/amdxdna/amdxdna_ctx.c
+++ b/drivers/accel/amdxdna/amdxdna_ctx.c
@@ -8,7 +8,6 @@
 #include <drm/drm_drv.h>
 #include <drm/drm_file.h>
 #include <drm/drm_gem.h>
-#include <drm/drm_gem_shmem_helper.h>
 #include <drm/drm_print.h>
 #include <drm/gpu_scheduler.h>
 #include <linux/xarray.h>
@@ -387,7 +386,7 @@ amdxdna_arg_bos_lookup(struct amdxdna_client *client,
 		gobj = drm_gem_object_lookup(client->filp, bo_hdls[i]);
 		if (!gobj) {
 			ret = -ENOENT;
-			goto put_shmem_bo;
+			goto put_bos;
 		}
 		abo = to_xdna_obj(gobj);
 
@@ -402,7 +401,7 @@ amdxdna_arg_bos_lookup(struct amdxdna_client *client,
 		if (ret) {
 			mutex_unlock(&abo->lock);
 			drm_gem_object_put(gobj);
-			goto put_shmem_bo;
+			goto put_bos;
 		}
 		abo->pinned = true;
 		mutex_unlock(&abo->lock);
@@ -412,7 +411,7 @@ amdxdna_arg_bos_lookup(struct amdxdna_client *client,
 
 	return 0;
 
-put_shmem_bo:
+put_bos:
 	amdxdna_arg_bos_put(job);
 	return ret;
 }
diff --git a/drivers/accel/amdxdna/amdxdna_gem.c b/drivers/accel/amdxdna/amdxdna_gem.c
index dfa916eeb2d9..33c48498d1eb 100644
--- a/drivers/accel/amdxdna/amdxdna_gem.c
+++ b/drivers/accel/amdxdna/amdxdna_gem.c
@@ -7,7 +7,6 @@
 #include <drm/drm_cache.h>
 #include <drm/drm_device.h>
 #include <drm/drm_gem.h>
-#include <drm/drm_gem_shmem_helper.h>
 #include <drm/drm_print.h>
 #include <drm/gpu_scheduler.h>
 #include <linux/dma-buf.h>
@@ -277,9 +276,9 @@ static int amdxdna_insert_pages(struct amdxdna_gem_obj *abo,
 	int ret;
 
 	if (!is_import_bo(abo)) {
-		ret = drm_gem_shmem_mmap(&abo->base, vma);
+		ret = drm_gem_uma_mmap(&abo->base, vma);
 		if (ret) {
-			XDNA_ERR(xdna, "Failed shmem mmap %d", ret);
+			XDNA_ERR(xdna, "Failed uma mmap %d", ret);
 			return ret;
 		}
 
@@ -358,11 +357,11 @@ static int amdxdna_gem_dmabuf_mmap(struct dma_buf *dma_buf, struct vm_area_struc
 	unsigned long num_pages = vma_pages(vma);
 	int ret;
 
-	vma->vm_ops = &drm_gem_shmem_vm_ops;
+	vma->vm_ops = &drm_gem_uma_vm_ops;
 	vma->vm_private_data = gobj;
 
 	drm_gem_object_get(gobj);
-	ret = drm_gem_shmem_mmap(&abo->base, vma);
+	ret = drm_gem_uma_mmap(&abo->base, vma);
 	if (ret)
 		goto put_obj;
 
@@ -474,23 +473,23 @@ static void amdxdna_gem_obj_free(struct drm_gem_object *gobj)
 		return;
 	}
 
-	drm_gem_shmem_free(&abo->base);
+	drm_gem_uma_free(&abo->base);
 }
 
 static const struct drm_gem_object_funcs amdxdna_gem_dev_obj_funcs = {
 	.free = amdxdna_gem_dev_obj_free,
 };
 
-static const struct drm_gem_object_funcs amdxdna_gem_shmem_funcs = {
+static const struct drm_gem_object_funcs amdxdna_gem_uma_funcs = {
 	.free = amdxdna_gem_obj_free,
-	.print_info = drm_gem_shmem_object_print_info,
-	.pin = drm_gem_shmem_object_pin,
-	.unpin = drm_gem_shmem_object_unpin,
-	.get_sg_table = drm_gem_shmem_object_get_sg_table,
-	.vmap = drm_gem_shmem_object_vmap,
-	.vunmap = drm_gem_shmem_object_vunmap,
+	.print_info = drm_gem_uma_object_print_info,
+	.pin = drm_gem_uma_object_pin,
+	.unpin = drm_gem_uma_object_unpin,
+	.get_sg_table = drm_gem_uma_object_get_sg_table,
+	.vmap = drm_gem_uma_object_vmap,
+	.vunmap = drm_gem_uma_object_vunmap,
 	.mmap = amdxdna_gem_obj_mmap,
-	.vm_ops = &drm_gem_shmem_vm_ops,
+	.vm_ops = &drm_gem_uma_vm_ops,
 	.export = amdxdna_gem_prime_export,
 };
 
@@ -525,21 +524,21 @@ amdxdna_gem_create_object_cb(struct drm_device *dev, size_t size)
 	if (IS_ERR(abo))
 		return ERR_CAST(abo);
 
-	to_gobj(abo)->funcs = &amdxdna_gem_shmem_funcs;
+	to_gobj(abo)->funcs = &amdxdna_gem_uma_funcs;
 
 	return to_gobj(abo);
 }
 
 static struct amdxdna_gem_obj *
-amdxdna_gem_create_shmem_object(struct drm_device *dev, size_t size)
+amdxdna_gem_create_uma_object(struct drm_device *dev, size_t size)
 {
-	struct drm_gem_shmem_object *shmem = drm_gem_shmem_create(dev, size);
+	struct drm_gem_uma_object *uma = drm_gem_uma_create(dev, size);
 
-	if (IS_ERR(shmem))
-		return ERR_CAST(shmem);
+	if (IS_ERR(uma))
+		return ERR_CAST(uma);
 
-	shmem->map_wc = false;
-	return to_xdna_obj(&shmem->base);
+	uma->map_wc = false;
+	return to_xdna_obj(&uma->base);
 }
 
 static struct amdxdna_gem_obj *
@@ -589,7 +588,7 @@ amdxdna_gem_create_object(struct drm_device *dev,
 	if (args->vaddr)
 		return amdxdna_gem_create_ubuf_object(dev, args);
 
-	return amdxdna_gem_create_shmem_object(dev, aligned_sz);
+	return amdxdna_gem_create_uma_object(dev, aligned_sz);
 }
 
 struct drm_gem_object *
@@ -615,7 +614,7 @@ amdxdna_gem_prime_import(struct drm_device *dev, struct dma_buf *dma_buf)
 		goto fail_detach;
 	}
 
-	gobj = drm_gem_shmem_prime_import_sg_table(dev, attach, sgt);
+	gobj = drm_gem_uma_prime_import_sg_table(dev, attach, sgt);
 	if (IS_ERR(gobj)) {
 		ret = PTR_ERR(gobj);
 		goto fail_unmap;
@@ -836,7 +835,7 @@ int amdxdna_gem_pin_nolock(struct amdxdna_gem_obj *abo)
 	if (is_import_bo(abo))
 		return 0;
 
-	ret = drm_gem_shmem_pin(&abo->base);
+	ret = drm_gem_uma_pin(&abo->base);
 
 	XDNA_DBG(xdna, "BO type %d ret %d", abo->type, ret);
 	return ret;
@@ -862,7 +861,7 @@ void amdxdna_gem_unpin(struct amdxdna_gem_obj *abo)
 		return;
 
 	mutex_lock(&abo->lock);
-	drm_gem_shmem_unpin(&abo->base);
+	drm_gem_uma_unpin(&abo->base);
 	mutex_unlock(&abo->lock);
 }
 
diff --git a/drivers/accel/amdxdna/amdxdna_gem.h b/drivers/accel/amdxdna/amdxdna_gem.h
index f79fc7f3c93b..74c78c86125e 100644
--- a/drivers/accel/amdxdna/amdxdna_gem.h
+++ b/drivers/accel/amdxdna/amdxdna_gem.h
@@ -7,6 +7,9 @@
 #define _AMDXDNA_GEM_H_
 
 #include <linux/hmm.h>
+
+#include <drm/drm_gem_uma_helper.h>
+
 #include "amdxdna_pci_drv.h"
 
 struct amdxdna_umap {
@@ -33,7 +36,7 @@ struct amdxdna_mem {
 };
 
 struct amdxdna_gem_obj {
-	struct drm_gem_shmem_object	base;
+	struct drm_gem_uma_object	base;
 	struct amdxdna_client		*client;
 	u8				type;
 	bool				pinned;
diff --git a/drivers/accel/amdxdna/amdxdna_mailbox_helper.c b/drivers/accel/amdxdna/amdxdna_mailbox_helper.c
index 6d0c24513476..63c3b82ff1b0 100644
--- a/drivers/accel/amdxdna/amdxdna_mailbox_helper.c
+++ b/drivers/accel/amdxdna/amdxdna_mailbox_helper.c
@@ -7,7 +7,6 @@
 #include <drm/drm_device.h>
 #include <drm/drm_print.h>
 #include <drm/drm_gem.h>
-#include <drm/drm_gem_shmem_helper.h>
 #include <drm/gpu_scheduler.h>
 #include <linux/completion.h>
 
diff --git a/drivers/accel/amdxdna/amdxdna_pci_drv.c b/drivers/accel/amdxdna/amdxdna_pci_drv.c
index 1973ab67721b..ae069b8805c7 100644
--- a/drivers/accel/amdxdna/amdxdna_pci_drv.c
+++ b/drivers/accel/amdxdna/amdxdna_pci_drv.c
@@ -7,7 +7,6 @@
 #include <drm/drm_accel.h>
 #include <drm/drm_drv.h>
 #include <drm/drm_gem.h>
-#include <drm/drm_gem_shmem_helper.h>
 #include <drm/drm_ioctl.h>
 #include <drm/drm_managed.h>
 #include <drm/gpu_scheduler.h>
diff --git a/drivers/accel/amdxdna/amdxdna_sysfs.c b/drivers/accel/amdxdna/amdxdna_sysfs.c
index f27e4ee960a0..d7fcb9c9b7b5 100644
--- a/drivers/accel/amdxdna/amdxdna_sysfs.c
+++ b/drivers/accel/amdxdna/amdxdna_sysfs.c
@@ -5,7 +5,6 @@
 
 #include <drm/amdxdna_accel.h>
 #include <drm/drm_device.h>
-#include <drm/drm_gem_shmem_helper.h>
 #include <drm/drm_print.h>
 #include <drm/gpu_scheduler.h>
 #include <linux/types.h>
-- 
2.52.0


  parent reply	other threads:[~2025-12-09 14:02 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-09 13:41 [RFC][PATCH 00/13] drm: Introduce GEM-UMA memory management Thomas Zimmermann
2025-12-09 13:41 ` [PATCH 01/13] drm/gem-shmem: Fix typos in documentation Thomas Zimmermann
2025-12-11 10:00   ` Boris Brezillon
2025-12-11 12:03   ` Thomas Zimmermann
2025-12-09 13:41 ` [PATCH 02/13] drm/gem-shmem: Fix the MODULE_LICENSE() string Thomas Zimmermann
2025-12-11 10:01   ` Boris Brezillon
2025-12-11 12:04   ` Thomas Zimmermann
2025-12-09 13:42 ` [PATCH 03/13] drm: Add GEM-UMA helpers for memory management Thomas Zimmermann
2025-12-09 13:42 ` [PATCH 04/13] drm/gem-uma: Remove unused interfaces Thomas Zimmermann
2025-12-09 13:42 ` [PATCH 05/13] drm/imagination: Use GEM-UMA helpers for memory management Thomas Zimmermann
2025-12-09 13:42 ` [PATCH 06/13] drm/lima: " Thomas Zimmermann
2025-12-09 13:42 ` [PATCH 07/13] drm/panfrost: " Thomas Zimmermann
2025-12-09 13:42 ` [PATCH 08/13] drm/panthor: " Thomas Zimmermann
2025-12-09 13:42 ` [PATCH 09/13] drm/v3d: " Thomas Zimmermann
2025-12-09 13:42 ` [PATCH 10/13] drm/virtgpu: " Thomas Zimmermann
2025-12-09 13:42 ` Thomas Zimmermann [this message]
2025-12-09 13:42 ` [PATCH 12/13] accel/ivpu: " Thomas Zimmermann
2025-12-09 14:24   ` Karol Wachowski
2025-12-09 14:25   ` Karol Wachowski
2025-12-09 13:42 ` [PATCH 13/13] accel/rocket: " Thomas Zimmermann
2025-12-09 14:27 ` [RFC][PATCH 00/13] drm: Introduce GEM-UMA " Boris Brezillon
2025-12-09 14:51   ` Thomas Zimmermann
2025-12-09 15:30     ` Boris Brezillon
2025-12-10  7:34       ` Thomas Zimmermann
2025-12-10  9:21         ` Boris Brezillon
2025-12-10  9:57           ` Thomas Zimmermann

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=20251209140141.94407-12-tzimmermann@suse.de \
    --to=tzimmermann@suse.de \
    --cc=adrian.larumbe@collabora.com \
    --cc=airlied@gmail.com \
    --cc=boris.brezillon@collabora.com \
    --cc=corbet@lwn.net \
    --cc=dmitry.osipenko@collabora.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=frank.binns@imgtec.com \
    --cc=gurchetansingh@chromium.org \
    --cc=karol.wachowski@linux.intel.com \
    --cc=kraxel@redhat.com \
    --cc=lima@lists.freedesktop.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=liviu.dudau@arm.com \
    --cc=lizhi.hou@amd.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=maciej.falkowski@linux.intel.com \
    --cc=mamin506@gmail.com \
    --cc=matt.coster@imgtec.com \
    --cc=mripard@kernel.org \
    --cc=mwen@igalia.com \
    --cc=ogabbay@kernel.org \
    --cc=olvaffe@gmail.com \
    --cc=robh@kernel.org \
    --cc=simona@ffwll.ch \
    --cc=steven.price@arm.com \
    --cc=tomeu@tomeuvizoso.net \
    --cc=virtualization@lists.linux.dev \
    --cc=yuq825@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).