From: Steven Price <steven.price@arm.com>
To: Danilo Krummrich <dakr@redhat.com>,
airlied@gmail.com, daniel@ffwll.ch, tzimmermann@suse.de,
mripard@kernel.org, corbet@lwn.net, christian.koenig@amd.com,
bskeggs@redhat.com, Liam.Howlett@oracle.com,
matthew.brost@intel.com, boris.brezillon@collabora.com,
alexdeucher@gmail.com, ogabbay@kernel.org, bagasdotme@gmail.com,
willy@infradead.org, jason@jlekstrand.net,
donald.robson@imgtec.com
Cc: nouveau@lists.freedesktop.org, linux-kernel@vger.kernel.org,
dri-devel@lists.freedesktop.org, linux-doc@vger.kernel.org
Subject: Re: [PATCH drm-misc-next v8 02/12] drm: debugfs: provide infrastructure to dump a DRM GPU VA space
Date: Thu, 20 Jul 2023 11:51:27 +0100 [thread overview]
Message-ID: <010b58cd-1225-02f7-33f0-c678e5cd349d@arm.com> (raw)
In-Reply-To: <20230720001443.2380-3-dakr@redhat.com>
On 20/07/2023 01:14, Danilo Krummrich wrote:
> This commit adds a function to dump a DRM GPU VA space and a macro for
> drivers to register the struct drm_info_list 'gpuvas' entry.
>
> Most likely, most drivers might maintain one DRM GPU VA space per struct
> drm_file, but there might also be drivers not having a fixed relation
> between DRM GPU VA spaces and a DRM core infrastructure, hence we need the
> indirection via the driver iterating it's maintained DRM GPU VA spaces.
>
> Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
> Signed-off-by: Danilo Krummrich <dakr@redhat.com>
> ---
> drivers/gpu/drm/drm_debugfs.c | 40 +++++++++++++++++++++++++++++++++++
> include/drm/drm_debugfs.h | 25 ++++++++++++++++++++++
> 2 files changed, 65 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c
> index 4855230ba2c6..c90dbcffa0dc 100644
> --- a/drivers/gpu/drm/drm_debugfs.c
> +++ b/drivers/gpu/drm/drm_debugfs.c
> @@ -39,6 +39,7 @@
> #include <drm/drm_file.h>
> #include <drm/drm_gem.h>
> #include <drm/drm_managed.h>
> +#include <drm/drm_gpuva_mgr.h>
>
> #include "drm_crtc_internal.h"
> #include "drm_internal.h"
> @@ -175,6 +176,45 @@ static const struct file_operations drm_debugfs_fops = {
> .release = single_release,
> };
>
> +/**
> + * drm_debugfs_gpuva_info - dump the given DRM GPU VA space
> + * @m: pointer to the &seq_file to write
> + * @mgr: the &drm_gpuva_manager representing the GPU VA space
> + *
> + * Dumps the GPU VA mappings of a given DRM GPU VA manager.
> + *
> + * For each DRM GPU VA space drivers should call this function from their
> + * &drm_info_list's show callback.
> + *
> + * Returns: 0 on success, -ENODEV if the &mgr is not initialized
> + */
> +int drm_debugfs_gpuva_info(struct seq_file *m,
> + struct drm_gpuva_manager *mgr)
> +{
> + struct drm_gpuva *va, *kva = &mgr->kernel_alloc_node;
> +
> + if (!mgr->name)
> + return -ENODEV;
> +
> + seq_printf(m, "DRM GPU VA space (%s) [0x%016llx;0x%016llx]\n",
> + mgr->name, mgr->mm_start, mgr->mm_start + mgr->mm_range);
> + seq_printf(m, "Kernel reserved node [0x%016llx;0x%016llx]\n",
> + kva->va.addr, kva->va.addr + kva->va.range);
> + seq_puts(m, "\n");
> + seq_puts(m, " VAs | start | range | end | object | object offset\n");
> + seq_puts(m, "-------------------------------------------------------------------------------------------------------------\n");
> + drm_gpuva_for_each_va(va, mgr) {
> + if (unlikely(va == kva))
> + continue;
> +
> + seq_printf(m, " | 0x%016llx | 0x%016llx | 0x%016llx | 0x%016llx | 0x%016llx\n",
> + va->va.addr, va->va.range, va->va.addr + va->va.range,
> + (u64)va->gem.obj, va->gem.offset);
Casting a pointer to u64 generates a warning on 32 bit systems:
drivers/gpu/drm/drm_debugfs.c:212:7: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
212 | (u64)va->gem.obj, va->gem.offset);
| ^
Adding an extra cast to uintptr_t shuts the compiler up (alternatively a
proper pointer type like %px could be used in the format string, but
that does make the table layout harder).
The patch below fixes the warning for me.
Steve
----8<----
From bea59724d68fec0b3a56f82a42d0e4e59c514565 Mon Sep 17 00:00:00 2001
From: Steven Price <steven.price@arm.com>
Date: Thu, 20 Jul 2023 11:45:11 +0100
Subject: [PATCH] drm: debugfs: Silence warning from cast
Casting a pointer to an integer of a different size generates a warning
from the compiler. First cast the pointer to a pointer-sized type to
keep the compiler happy.
Fixes: 4f66feeab173 ("drm: debugfs: provide infrastructure to dump a DRM GPU VA space")
Signed-off-by: Steven Price <steven.price@arm.com>
---
drivers/gpu/drm/drm_debugfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c
index c90dbcffa0dc..a3a488205009 100644
--- a/drivers/gpu/drm/drm_debugfs.c
+++ b/drivers/gpu/drm/drm_debugfs.c
@@ -209,7 +209,7 @@ int drm_debugfs_gpuva_info(struct seq_file *m,
seq_printf(m, " | 0x%016llx | 0x%016llx | 0x%016llx | 0x%016llx | 0x%016llx\n",
va->va.addr, va->va.range, va->va.addr + va->va.range,
- (u64)va->gem.obj, va->gem.offset);
+ (u64)(uintptr_t)va->gem.obj, va->gem.offset);
}
return 0;
--
2.39.2
next prev parent reply other threads:[~2023-07-20 10:51 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-20 0:14 [PATCH drm-misc-next v8 00/12] DRM GPUVA Manager & Nouveau VM_BIND UAPI Danilo Krummrich
2023-07-20 0:14 ` [PATCH drm-misc-next v8 01/12] drm: manager to keep track of GPUs VA mappings Danilo Krummrich
2023-07-20 10:44 ` Steven Price
2023-07-20 21:48 ` Danilo Krummrich
2023-07-28 11:31 ` Maxime Ripard
2023-07-28 12:26 ` Boris Brezillon
2023-07-31 12:04 ` Maxime Ripard
2023-07-20 0:14 ` [PATCH drm-misc-next v8 02/12] drm: debugfs: provide infrastructure to dump a DRM GPU VA space Danilo Krummrich
2023-07-20 10:51 ` Steven Price [this message]
2023-07-20 0:14 ` [PATCH drm-misc-next v8 03/12] drm/nouveau: new VM_BIND uapi interfaces Danilo Krummrich
[not found] ` <CAOFGe95kS0KzSUhjWiikBcx9vRQKnqipFE+a=FPobCgEi=ysAw@mail.gmail.com>
2023-07-25 2:03 ` Danilo Krummrich
2023-07-20 0:14 ` [PATCH drm-misc-next v8 04/12] drm/nouveau: get vmm via nouveau_cli_vmm() Danilo Krummrich
2023-07-20 0:14 ` [PATCH drm-misc-next v8 05/12] drm/nouveau: bo: initialize GEM GPU VA interface Danilo Krummrich
2023-07-20 0:14 ` [PATCH drm-misc-next v8 06/12] drm/nouveau: move usercopy helpers to nouveau_drv.h Danilo Krummrich
2023-07-20 0:14 ` [PATCH drm-misc-next v8 07/12] drm/nouveau: fence: separate fence alloc and emit Danilo Krummrich
2023-07-20 0:14 ` [PATCH drm-misc-next v8 08/12] drm/nouveau: fence: fail to emit when fence context is killed Danilo Krummrich
2023-07-20 0:14 ` [PATCH drm-misc-next v8 09/12] drm/nouveau: chan: provide nouveau_channel_kill() Danilo Krummrich
2023-07-20 0:14 ` [PATCH drm-misc-next v8 10/12] drm/nouveau: nvkm/vmm: implement raw ops to manage uvmm Danilo Krummrich
2023-07-20 0:14 ` [PATCH drm-misc-next v8 11/12] drm/nouveau: implement new VM_BIND uAPI Danilo Krummrich
[not found] ` <CAOFGe945tp344=g-++=EAT89t0qJHZ=3yeW-k9OTbGNJodvwAg@mail.gmail.com>
2023-07-23 23:54 ` Dave Airlie
2023-07-25 2:04 ` Danilo Krummrich
[not found] ` <CAOFGe94sG5==GM+spcTihcAtMCoj2xZYpN8NsYE6CEckdHJ8rQ@mail.gmail.com>
2023-07-25 16:43 ` Danilo Krummrich
2023-07-25 21:00 ` Danilo Krummrich
2023-07-20 0:14 ` [PATCH drm-misc-next v8 12/12] drm/nouveau: debugfs: implement DRM GPU VA debugfs Danilo Krummrich
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=010b58cd-1225-02f7-33f0-c678e5cd349d@arm.com \
--to=steven.price@arm.com \
--cc=Liam.Howlett@oracle.com \
--cc=airlied@gmail.com \
--cc=alexdeucher@gmail.com \
--cc=bagasdotme@gmail.com \
--cc=boris.brezillon@collabora.com \
--cc=bskeggs@redhat.com \
--cc=christian.koenig@amd.com \
--cc=corbet@lwn.net \
--cc=dakr@redhat.com \
--cc=daniel@ffwll.ch \
--cc=donald.robson@imgtec.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=jason@jlekstrand.net \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=matthew.brost@intel.com \
--cc=mripard@kernel.org \
--cc=nouveau@lists.freedesktop.org \
--cc=ogabbay@kernel.org \
--cc=tzimmermann@suse.de \
--cc=willy@infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®