[PATCH 0/2] drm/virtio: introduce the HOST_PAGE_SIZE feature

From: Sergio Lopez
Date: Tue Jul 23 2024 - 07:49:34 EST


There's an incresing number of machines supporting multiple page sizes
and on these machines the host and a guest can be running, each one,
with a different page size.

For what pertains to virtio-gpu, this is not a problem if the page size
of the guest happens to be bigger or equal than the host, but will
potentially lead to failures in memory allocations and/or mappings
otherwise.

To improve this situation, we introduce here the HOST_PAGE_SIZE feature.
This feature indicates that the host has an extended virtio_gpu_config
structure that include it's own page size a new field.

On the second commit, we also add a new 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.

Sergio Lopez (2):
drm/virtio: introduce the HOST_PAGE_SIZE feature
drm/virtio: add VIRTGPU_PARAM_HOST_PAGE_SIZE to params

drivers/gpu/drm/virtio/virtgpu_drv.c | 1 +
drivers/gpu/drm/virtio/virtgpu_drv.h | 2 ++
drivers/gpu/drm/virtio/virtgpu_ioctl.c | 5 +++++
drivers/gpu/drm/virtio/virtgpu_kms.c | 13 ++++++++++---
include/uapi/drm/virtgpu_drm.h | 1 +
include/uapi/linux/virtio_gpu.h | 5 +++++
6 files changed, 24 insertions(+), 3 deletions(-)

--
2.45.2