All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Airlie <airlied@gmail.com>
To: dri-devel@lists.freedesktop.org
Cc: nouveau@lists.freedesktop.org, dakr@kernel.org
Subject: [PATCH 1/6] nouveau/gsp: refactor libos entry handling for r535.
Date: Wed, 29 Jul 2026 14:15:25 +1000	[thread overview]
Message-ID: <20260729041653.3985549-2-airlied@gmail.com> (raw)
In-Reply-To: <20260729041653.3985549-1-airlied@gmail.com>

From: Dave Airlie <airlied@redhat.com>

This just refactors the libos entries that are the same pattern,
allocate + fill out entry.

Signed-off-by: Dave Airlie <airlied@redhat.com>
---
 .../drm/nouveau/nvkm/subdev/gsp/rm/r535/gsp.c | 49 ++++++++++---------
 1 file changed, 25 insertions(+), 24 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/gsp.c b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/gsp.c
index f544afa12b6b..f4f4142ec8d0 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/gsp.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/gsp.c
@@ -1470,6 +1470,28 @@ static void create_pte_array(u64 *ptes, dma_addr_t addr, size_t size)
 		ptes[i] = (u64)addr + (i << GSP_PAGE_SHIFT);
 }
 
+static int
+gsp_fill_libos_entry(struct nvkm_gsp *gsp,
+		     LibosMemoryRegionInitArgument *arg,
+		     size_t size,
+		     struct nvkm_gsp_mem *mem,
+		     const char *name)
+{
+	int ret;
+
+	ret = nvkm_gsp_mem_ctor(gsp, size, mem);
+	if (ret)
+		return ret;
+
+	arg->id8  = r535_gsp_libos_id8(name);
+	arg->pa   = mem->addr;
+	arg->size = mem->size;
+	arg->kind = LIBOS_MEMORY_REGION_CONTIGUOUS;
+	arg->loc  = LIBOS_MEMORY_REGION_LOC_SYSMEM;
+	create_pte_array(mem->data + sizeof(u64), mem->addr, mem->size);
+	return 0;
+}
+
 /**
  * r535_gsp_libos_init() -- create the libos arguments structure
  * @gsp: gsp pointer
@@ -1516,39 +1538,18 @@ r535_gsp_libos_init(struct nvkm_gsp *gsp)
 
 	args = gsp->libos.data;
 
-	ret = nvkm_gsp_mem_ctor(gsp, 0x10000, &gsp->loginit);
+	ret = gsp_fill_libos_entry(gsp, &args[0], 0x10000, &gsp->loginit, "LOGINIT");
 	if (ret)
 		return ret;
 
-	args[0].id8  = r535_gsp_libos_id8("LOGINIT");
-	args[0].pa   = gsp->loginit.addr;
-	args[0].size = gsp->loginit.size;
-	args[0].kind = LIBOS_MEMORY_REGION_CONTIGUOUS;
-	args[0].loc  = LIBOS_MEMORY_REGION_LOC_SYSMEM;
-	create_pte_array(gsp->loginit.data + sizeof(u64), gsp->loginit.addr, gsp->loginit.size);
-
-	ret = nvkm_gsp_mem_ctor(gsp, 0x10000, &gsp->logintr);
+	ret = gsp_fill_libos_entry(gsp, &args[1], 0x10000, &gsp->logintr, "LOGINTR");
 	if (ret)
 		return ret;
 
-	args[1].id8  = r535_gsp_libos_id8("LOGINTR");
-	args[1].pa   = gsp->logintr.addr;
-	args[1].size = gsp->logintr.size;
-	args[1].kind = LIBOS_MEMORY_REGION_CONTIGUOUS;
-	args[1].loc  = LIBOS_MEMORY_REGION_LOC_SYSMEM;
-	create_pte_array(gsp->logintr.data + sizeof(u64), gsp->logintr.addr, gsp->logintr.size);
-
-	ret = nvkm_gsp_mem_ctor(gsp, 0x10000, &gsp->logrm);
+	ret = gsp_fill_libos_entry(gsp, &args[2], 0x10000, &gsp->logrm, "LOGRM");
 	if (ret)
 		return ret;
 
-	args[2].id8  = r535_gsp_libos_id8("LOGRM");
-	args[2].pa   = gsp->logrm.addr;
-	args[2].size = gsp->logrm.size;
-	args[2].kind = LIBOS_MEMORY_REGION_CONTIGUOUS;
-	args[2].loc  = LIBOS_MEMORY_REGION_LOC_SYSMEM;
-	create_pte_array(gsp->logrm.data + sizeof(u64), gsp->logrm.addr, gsp->logrm.size);
-
 	ret = r535_gsp_rmargs_init(gsp, false);
 	if (ret)
 		return ret;
-- 
2.55.0


  reply	other threads:[~2026-07-29  4:17 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-29  4:15 nouveau/gsp: some r570 additions and refactoring Dave Airlie
2026-07-29  4:15 ` Dave Airlie [this message]
2026-07-29  4:15 ` [PATCH 2/6] nouveau/gsp: make libos init per-gsp version Dave Airlie
2026-07-29  4:32   ` sashiko-bot
2026-07-29  4:15 ` [PATCH 3/6] nouveau/gsp: add logging entries for r570 Dave Airlie
2026-07-29  4:33   ` sashiko-bot
2026-07-29  4:15 ` [PATCH 4/6] nouveau/gsp: refactor the chan allocation arguments into a struct Dave Airlie
2026-07-29  4:15 ` [PATCH 5/6] nouveau/gsp: add some more fields to r570 system info Dave Airlie
2026-07-29  4:29   ` sashiko-bot
2026-07-29  4:15 ` [PATCH 6/6] nouveau: set wpr boost flags like open driver does Dave Airlie

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=20260729041653.3985549-2-airlied@gmail.com \
    --to=airlied@gmail.com \
    --cc=dakr@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=nouveau@lists.freedesktop.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.