From: Boris Brezillon <boris.brezillon@collabora.com>
To: "Adrián Larumbe" <adrian.larumbe@collabora.com>
Cc: Steven Price <steven.price@arm.com>,
Liviu Dudau <liviu.dudau@arm.com>,
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>,
kernel@collabora.com, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/4] drm/panthor: Add driver IOCTL for setting BO labels
Date: Mon, 17 Mar 2025 08:54:36 +0100 [thread overview]
Message-ID: <20250317085436.35edbf47@collabora.com> (raw)
In-Reply-To: <20250316215139.3940623-3-adrian.larumbe@collabora.com>
On Sun, 16 Mar 2025 21:51:33 +0000
Adrián Larumbe <adrian.larumbe@collabora.com> wrote:
> Allow UM to label a BO for which it possesses a DRM handle.
>
> Signed-off-by: Adrián Larumbe <adrian.larumbe@collabora.com>
> ---
> drivers/gpu/drm/panthor/panthor_drv.c | 31 +++++++++++++++++++++++++++
> include/uapi/drm/panthor_drm.h | 14 ++++++++++++
> 2 files changed, 45 insertions(+)
>
> diff --git a/drivers/gpu/drm/panthor/panthor_drv.c b/drivers/gpu/drm/panthor/panthor_drv.c
> index 310bb44abe1a..f41b8946258f 100644
> --- a/drivers/gpu/drm/panthor/panthor_drv.c
> +++ b/drivers/gpu/drm/panthor/panthor_drv.c
> @@ -1330,6 +1330,35 @@ static int panthor_ioctl_vm_get_state(struct drm_device *ddev, void *data,
> return 0;
> }
>
> +static int panthor_ioctl_label_bo(struct drm_device *ddev, void *data,
> + struct drm_file *file)
> +{
> + struct drm_panthor_label_bo *args = data;
> + struct drm_gem_object *obj;
> + const char *label;
> + int ret = 0;
> +
> + obj = drm_gem_object_lookup(file, args->handle);
> + if (!obj)
> + return -ENOENT;
> +
> + if (args->len && args->label) {
We probably want to have a limit on the label length (PAGE_SIZE or
less?). I would also return -EINVAL if the length is not zero and the
label is NULL instead of silently setting the label to NULL.
> + label = strndup_user(u64_to_user_ptr(args->label), args->len + 1);
> + if (IS_ERR(label)) {
> + ret = PTR_ERR(label);
> + goto err_label;
> + }
> + } else
> + label = NULL;
} else {
label = NULL;
}
> +
> + panthor_gem_label_bo(obj, label);
> +
> +err_label:
> + drm_gem_object_put(obj);
> +
> + return ret;
> +}
> +
next prev parent reply other threads:[~2025-03-17 7:54 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-16 21:51 [PATCH 0/4] Panthor BO tagging and GEMS debug display Adrián Larumbe
2025-03-16 21:51 ` [PATCH 1/4] drm/panthor: Introduce BO labeling Adrián Larumbe
2025-03-17 7:45 ` Boris Brezillon
2025-03-16 21:51 ` [PATCH 2/4] drm/panthor: Add driver IOCTL for setting BO labels Adrián Larumbe
2025-03-17 7:50 ` Boris Brezillon
2025-03-19 13:49 ` Adrián Larumbe
2025-03-19 16:28 ` Boris Brezillon
2025-03-17 7:54 ` Boris Brezillon [this message]
2025-03-16 21:51 ` [PATCH 3/4] drm/panthor: show device-wide list of DRM GEM objects over DebugFS Adrián Larumbe
2025-03-17 8:26 ` Boris Brezillon
2025-03-16 21:51 ` [PATCH 4/4] drm/panthor: Display heap chunk entries in DebugFS GEMS file Adrián Larumbe
2025-03-17 8:31 ` Boris Brezillon
2025-03-19 13:18 ` Adrián Larumbe
2025-03-19 16:39 ` Boris Brezillon
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=20250317085436.35edbf47@collabora.com \
--to=boris.brezillon@collabora.com \
--cc=adrian.larumbe@collabora.com \
--cc=airlied@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=kernel@collabora.com \
--cc=linux-kernel@vger.kernel.org \
--cc=liviu.dudau@arm.com \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=simona@ffwll.ch \
--cc=steven.price@arm.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