From: Sergio Lopez <slp@redhat.com>
To: gurchetansingh@chromium.org, tzimmermann@suse.de,
mripard@kernel.org, olvaffe@gmail.com, kraxel@redhat.com,
daniel@ffwll.ch, maarten.lankhorst@linux.intel.com,
airlied@redhat.com
Cc: linux-kernel@vger.kernel.org, virtualization@lists.linux.dev,
dri-devel@lists.freedesktop.org, Sergio Lopez <slp@redhat.com>
Subject: [PATCH 2/2] drm/virtio: add VIRTGPU_PARAM_HOST_PAGE_SIZE to params
Date: Tue, 23 Jul 2024 07:49:14 -0400 [thread overview]
Message-ID: <20240723114914.53677-3-slp@redhat.com> (raw)
In-Reply-To: <20240723114914.53677-1-slp@redhat.com>
Add VIRTGPU_PARAM_HOST_PAGE_SIZE as a param that can be read with
VIRTGPU_GETPARAM by userspace applications running in the guest to
obtain the host's page size and find out the right alignment to be used
in shared memory allocations.
Signed-off-by: Sergio Lopez <slp@redhat.com>
---
drivers/gpu/drm/virtio/virtgpu_ioctl.c | 5 +++++
include/uapi/drm/virtgpu_drm.h | 1 +
2 files changed, 6 insertions(+)
diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
index e4f76f315550..c16cdf2d64b4 100644
--- a/drivers/gpu/drm/virtio/virtgpu_ioctl.c
+++ b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
@@ -117,6 +117,11 @@ static int virtio_gpu_getparam_ioctl(struct drm_device *dev, void *data,
case VIRTGPU_PARAM_EXPLICIT_DEBUG_NAME:
value = vgdev->has_context_init ? 1 : 0;
break;
+ case VIRTGPU_PARAM_HOST_PAGE_SIZE:
+ if (!vgdev->has_host_page_size)
+ return -EINVAL;
+ value = vgdev->host_page_size;
+ break;
default:
return -EINVAL;
}
diff --git a/include/uapi/drm/virtgpu_drm.h b/include/uapi/drm/virtgpu_drm.h
index c2ce71987e9b..505f87263a15 100644
--- a/include/uapi/drm/virtgpu_drm.h
+++ b/include/uapi/drm/virtgpu_drm.h
@@ -98,6 +98,7 @@ struct drm_virtgpu_execbuffer {
#define VIRTGPU_PARAM_CONTEXT_INIT 6 /* DRM_VIRTGPU_CONTEXT_INIT */
#define VIRTGPU_PARAM_SUPPORTED_CAPSET_IDs 7 /* Bitmask of supported capability set ids */
#define VIRTGPU_PARAM_EXPLICIT_DEBUG_NAME 8 /* Ability to set debug name from userspace */
+#define VIRTGPU_PARAM_HOST_PAGE_SIZE 9 /* Host's page size */
struct drm_virtgpu_getparam {
__u64 param;
--
2.45.2
next prev parent reply other threads:[~2024-07-23 11:49 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-23 11:49 [PATCH 0/2] drm/virtio: introduce the HOST_PAGE_SIZE feature Sergio Lopez
2024-07-23 11:49 ` [PATCH 1/2] " Sergio Lopez
2024-07-23 11:49 ` Sergio Lopez [this message]
2024-07-24 19:00 ` [PATCH 0/2] " Dmitry Osipenko
2024-08-05 9:14 ` Sergio Lopez Pascual
[not found] ` <CAAfnVBkWKn3+YEhNz0CTmw-T_jjL72axkWqYgkzkSa72t_Gf0A@mail.gmail.com>
2024-08-06 20:15 ` Rob Clark
[not found] ` <CAAfnVBki816fSPuQ_FcvuwYzbSwiS_WaYsGSA1AyitmAA5OsXg@mail.gmail.com>
2024-08-08 10:38 ` Sergio Lopez Pascual
[not found] ` <CAAfnVBkkste=HR2SKRBNWXKcunbA2iEP+rr9yhDy89+WZsYeQw@mail.gmail.com>
2024-08-22 15:29 ` Sergio Lopez Pascual
2025-04-02 16:38 ` Sergio Lopez Pascual
2024-08-05 16:24 ` Rob Clark
2024-08-08 11:15 ` Dmitry Osipenko
2024-08-12 18:22 ` Rob Clark
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=20240723114914.53677-3-slp@redhat.com \
--to=slp@redhat.com \
--cc=airlied@redhat.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=gurchetansingh@chromium.org \
--cc=kraxel@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=olvaffe@gmail.com \
--cc=tzimmermann@suse.de \
--cc=virtualization@lists.linux.dev \
/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®