From: Danilo Krummrich <dakr@redhat.com>
To: airlied@gmail.com, daniel@ffwll.ch, bskeggs@redhat.com,
kherbst@redhat.com, lyude@redhat.com, sfr@canb.auug.org.au
Cc: dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org,
linux-kernel@vger.kernel.org, Danilo Krummrich <dakr@redhat.com>
Subject: [PATCH drm-misc-next 5/5] drm/nouveau: uvmm: remove dedicated VM pointer from VMAs
Date: Mon, 7 Aug 2023 18:32:26 +0200 [thread overview]
Message-ID: <20230807163238.2091-6-dakr@redhat.com> (raw)
In-Reply-To: <20230807163238.2091-1-dakr@redhat.com>
VMAs can find their corresponding VM through their embedded struct
drm_gpuva which already carries a pointer to a struct drm_gpuva_manager
which the VM is based on. Hence, remove the struct nouveau_uvmm pointer
from struct nouveau_uvma to save a couple of bytes per mapping.
Signed-off-by: Danilo Krummrich <dakr@redhat.com>
---
drivers/gpu/drm/nouveau/nouveau_uvmm.c | 9 ++++-----
drivers/gpu/drm/nouveau/nouveau_uvmm.h | 10 +++++-----
2 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/drivers/gpu/drm/nouveau/nouveau_uvmm.c b/drivers/gpu/drm/nouveau/nouveau_uvmm.c
index 91b964ef98b1..3a1e8538f205 100644
--- a/drivers/gpu/drm/nouveau/nouveau_uvmm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_uvmm.c
@@ -181,7 +181,7 @@ nouveau_uvma_vmm_put(struct nouveau_uvma *uvma)
u64 addr = uvma->va.va.addr;
u64 range = uvma->va.va.range;
- return nouveau_uvmm_vmm_put(uvma->uvmm, addr, range);
+ return nouveau_uvmm_vmm_put(to_uvmm(uvma), addr, range);
}
static int
@@ -192,7 +192,7 @@ nouveau_uvma_map(struct nouveau_uvma *uvma,
u64 offset = uvma->va.gem.offset;
u64 range = uvma->va.va.range;
- return nouveau_uvmm_vmm_map(uvma->uvmm, addr, range,
+ return nouveau_uvmm_vmm_map(to_uvmm(uvma), addr, range,
offset, uvma->kind, mem);
}
@@ -206,7 +206,7 @@ nouveau_uvma_unmap(struct nouveau_uvma *uvma)
if (drm_gpuva_invalidated(&uvma->va))
return 0;
- return nouveau_uvmm_vmm_unmap(uvma->uvmm, addr, range, sparse);
+ return nouveau_uvmm_vmm_unmap(to_uvmm(uvma), addr, range, sparse);
}
static int
@@ -586,7 +586,6 @@ op_map_prepare(struct nouveau_uvmm *uvmm,
if (ret)
return ret;
- uvma->uvmm = uvmm;
uvma->region = args->region;
uvma->kind = args->kind;
@@ -794,7 +793,7 @@ op_unmap_range(struct drm_gpuva_op_unmap *u,
bool sparse = !!uvma->region;
if (!drm_gpuva_invalidated(u->va))
- nouveau_uvmm_vmm_unmap(uvma->uvmm, addr, range, sparse);
+ nouveau_uvmm_vmm_unmap(to_uvmm(uvma), addr, range, sparse);
}
static void
diff --git a/drivers/gpu/drm/nouveau/nouveau_uvmm.h b/drivers/gpu/drm/nouveau/nouveau_uvmm.h
index 534baadc3bf7..fc7f6fd2a4e1 100644
--- a/drivers/gpu/drm/nouveau/nouveau_uvmm.h
+++ b/drivers/gpu/drm/nouveau/nouveau_uvmm.h
@@ -37,12 +37,15 @@ struct nouveau_uvma_region {
struct nouveau_uvma {
struct drm_gpuva va;
- struct nouveau_uvmm *uvmm;
struct nouveau_uvma_region *region;
-
u8 kind;
};
+#define uvmm_from_mgr(x) container_of((x), struct nouveau_uvmm, umgr)
+#define uvma_from_va(x) container_of((x), struct nouveau_uvma, va)
+
+#define to_uvmm(x) uvmm_from_mgr((x)->va.mgr)
+
struct nouveau_uvmm_bind_job {
struct nouveau_job base;
@@ -79,9 +82,6 @@ struct nouveau_uvmm_bind_job_args {
#define to_uvmm_bind_job(job) container_of((job), struct nouveau_uvmm_bind_job, base)
-#define uvmm_from_mgr(x) container_of((x), struct nouveau_uvmm, umgr)
-#define uvma_from_va(x) container_of((x), struct nouveau_uvma, va)
-
int nouveau_uvmm_init(struct nouveau_uvmm *uvmm, struct nouveau_cli *cli,
u64 kernel_managed_addr, u64 kernel_managed_size);
void nouveau_uvmm_fini(struct nouveau_uvmm *uvmm);
--
2.41.0
next prev parent reply other threads:[~2023-08-07 16:34 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-07 16:32 [PATCH drm-misc-next 0/5] Nouveau VM_BIND uAPI Fixes Danilo Krummrich
2023-08-07 16:32 ` [PATCH drm-misc-next 1/5] nouveau/dmem: fix copy-paste error in nouveau_dmem_migrate_chunk() Danilo Krummrich
2023-08-07 16:32 ` [PATCH drm-misc-next 2/5] drm/nouveau: nvkm: vmm: silence warning from cast Danilo Krummrich
2023-08-07 16:32 ` [PATCH drm-misc-next 3/5] drm/nouveau: remove incorrect __user annotations Danilo Krummrich
2023-08-07 16:32 ` [PATCH drm-misc-next 4/5] drm/nouveau: uvmm: remove incorrect calls to mas_unlock() Danilo Krummrich
2023-08-07 16:32 ` Danilo Krummrich [this message]
2023-08-08 2:37 ` [PATCH drm-misc-next 0/5] Nouveau VM_BIND uAPI Fixes 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=20230807163238.2091-6-dakr@redhat.com \
--to=dakr@redhat.com \
--cc=airlied@gmail.com \
--cc=bskeggs@redhat.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=kherbst@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lyude@redhat.com \
--cc=nouveau@lists.freedesktop.org \
--cc=sfr@canb.auug.org.au \
/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