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

2025-04-04 Thread Sergio Lopez
Introduce a new feature, HOST_PAGE_SIZE, that indicates the host provides its page size as a value in virtio_gpu_config. Signed-off-by: Sergio Lopez --- drivers/gpu/drm/virtio/virtgpu_drv.c | 1 + drivers/gpu/drm/virtio/virtgpu_drv.h | 2 ++ drivers/gpu/drm/virtio/virtgpu_kms.c | 13

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

2025-04-04 Thread Sergio Lopez Pascual
Gurchetan Singh writes: > On Tue, Aug 6, 2024 at 1:15 PM Rob Clark wrote: > >> On Tue, Aug 6, 2024 at 9:15 AM Gurchetan Singh >> wrote: >> > >> > >> > >> > On Mon, Aug 5, 2024 at 2:14 AM Sergio Lopez Pascual >> wrote: >> >&g

[PATCH v2 2/2] drm/virtio: add VIRTGPU_PARAM_HOST_PAGE_SIZE to params

2025-04-02 Thread Sergio Lopez
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 --- drivers/gpu/drm/v

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

2025-04-02 Thread Sergio Lopez
a reference in the cover to the discussion about how device page alignment restrictions should be shared with the driver. Signed-off-by: Sergio Lopez --- Sergio Lopez (2): drm/virtio: introduce the HOST_PAGE_SIZE feature drm/virtio: add VIRTGPU_PARAM_HOST_PAGE_SIZE to params

[PATCH RFC v4 3/4] virtio-mmio: read shm region page size

2025-02-20 Thread Sergio Lopez
Use the newly introduced SHM_PAGE_SHIFT register to read the page shift for the shared memory region, derive the page size from it and store the resulting value into virtio_shm_region. Reviewed-by: Dmitry Osipenko Signed-off-by: Sergio Lopez --- drivers/virtio/virtio_mmio.c | 20

[PATCH RFC v4 2/4] virtio-pci: extend virtio_pci_cap with page_shift

2025-02-20 Thread Sergio Lopez
hold that field, and use it to feed virtio_shm_region with the corresponding page size. Reviewed-by: Dmitry Osipenko Reviewed-by: Daniel Verkamp Signed-off-by: Sergio Lopez --- drivers/virtio/virtio_mmio.c | 2 ++ drivers/virtio/virtio_pci_modern.c | 29

[PATCH RFC v4 4/4] drm/virtio: add VIRTGPU_PARAM_HOST_SHM_PAGE_SIZE to params

2025-02-20 Thread Sergio Lopez
Add VIRTGPU_PARAM_HOST_SHM_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. Reviewed-by: Dmitry Osipenko Signed-off-by: Sergio

[PATCH RFC v4 1/4] virtio: introduce VIRTIO_F_SHM_PAGE_SIZE

2025-02-20 Thread Sergio Lopez
Introduce VIRTIO_F_SHM_PAGE_SIZE, a feature bit which indicates that the transport provides the page size for SHM regions. Reviewed-by: Dmitry Osipenko Signed-off-by: Sergio Lopez --- drivers/virtio/virtio_pci_modern.c | 3 +++ drivers/virtio/virtio_ring.c | 2 ++ include/uapi/linux

[RFC PATCH v4 0/4] virtio: obtain SHM page size from device

2025-02-20 Thread Sergio Lopez
ons. This patch series will be used as a reference to propose such changes. Signed-off-by: Sergio Lopez --- Changes in v4: - Validate page_shift before deriving the page size from it (thanks Daniel Verkamp). - Use an unsigned integer in left shift (thanks Daniel Verkamp). - Link to v3: https://lo

[PATCH RFC v3 2/4] virtio-pci: extend virtio_pci_cap with page_shift

2025-02-20 Thread Sergio Lopez
hold that field, and use it to feed virtio_shm_region with the corresponding page size. Reviewed-by: Dmitry Osipenko Signed-off-by: Sergio Lopez --- drivers/virtio/virtio_mmio.c | 2 ++ drivers/virtio/virtio_pci_modern.c | 21 + include/linux/virtio_config.h | 1

[PATCH RFC v3 4/4] drm/virtio: add VIRTGPU_PARAM_HOST_SHM_PAGE_SIZE to params

2025-02-20 Thread Sergio Lopez
Add VIRTGPU_PARAM_HOST_SHM_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 --- drivers/gpu/drm/v

[PATCH RFC v3 3/4] virtio-mmio: read shm region page size

2025-02-20 Thread Sergio Lopez
Use the newly introduced SHM_PAGE_SHIFT register to read the page shift for the shared memory region, derive the page size from it and store the resulting value into virtio_shm_region. Reviewed-by: Dmitry Osipenko Signed-off-by: Sergio Lopez --- drivers/virtio/virtio_mmio.c | 11

[PATCH RFC v3 1/4] virtio: introduce VIRTIO_F_SHM_PAGE_SIZE

2025-02-20 Thread Sergio Lopez
Introduce VIRTIO_F_SHM_PAGE_SIZE, a feature bit which indicates that the transport provides the page size for SHM regions. Reviewed-by: Dmitry Osipenko Signed-off-by: Sergio Lopez --- drivers/virtio/virtio_pci_modern.c | 3 +++ drivers/virtio/virtio_ring.c | 2 ++ include/uapi/linux

[RFC PATCH v3 0/4] virtio: obtain SHM page size from device

2025-02-20 Thread Sergio Lopez
ons. This patch series will be used as a reference to propose such changes. Signed-off-by: Sergio Lopez --- Changes in v3: - Merge patch 2 (virtio: introduce VIRTIO_F_SHM_PAGE_SIZE) into the changes for virtio-pci (thanks Dmitry Osipenko). - In virtio_gpu_getparam_ioctl(), return ENOENT instead of

Re: [PATCH RFC v2 4/5] virtio-mmio: read shm region page size

2025-02-20 Thread Sergio Lopez Pascual
Dmitry Osipenko writes: > On 2/14/25 18:16, Sergio Lopez wrote: >> Use the newly introduced SHM_PAGE_SHIFT register to read the page shift >> for the shared memory region, derive the page size from it and store the >> resulting value into virtio_shm_region. >> >

Re: [PATCH RFC v2 5/5] drm/virtio: add VIRTGPU_PARAM_HOST_SHM_PAGE_SIZE to params

2025-02-16 Thread Sergio Lopez Pascual
Dmitry Osipenko writes: > On 2/14/25 18:16, Sergio Lopez wrote: >> diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c >> b/drivers/gpu/drm/virtio/virtgpu_ioctl.c >> index >> c33c057365f85a2ace536f91655c903036827312..4b49635b4fe1d4256f219823341cef8e5fa8f029 >>

[PATCH RFC v2 5/5] drm/virtio: add VIRTGPU_PARAM_HOST_SHM_PAGE_SIZE to params

2025-02-14 Thread Sergio Lopez
Add VIRTGPU_PARAM_HOST_SHM_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 --- drivers/gpu/drm/v

[PATCH RFC v2 4/5] virtio-mmio: read shm region page size

2025-02-14 Thread Sergio Lopez
Use the newly introduced SHM_PAGE_SHIFT register to read the page shift for the shared memory region, derive the page size from it and store the resulting value into virtio_shm_region. Signed-off-by: Sergio Lopez --- drivers/virtio/virtio_mmio.c | 11 ++- include/uapi/linux

[PATCH RFC v2 3/5] virtio-pci: extend virtio_pci_cap with page_shift

2025-02-14 Thread Sergio Lopez
hold that field, and use it to feed virtio_shm_region with the corresponding page size. Signed-off-by: Sergio Lopez --- drivers/virtio/virtio_pci_modern.c | 22 +- include/uapi/linux/virtio_pci.h| 3 ++- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a

[RFC PATCH v2 0/5] virtio: obtain SHM page size from device

2025-02-14 Thread Sergio Lopez
ons. This patch series will be used as a reference to propose such changes. Signed-off-by: Sergio Lopez --- Changes in v2: - Use "page_shift" instead of "page_size" in the transport-related structures to clarify its contents (thanks Daniel Verkamp). - Update the command for

[PATCH RFC v2 2/5] virtio: introduce VIRTIO_F_SHM_PAGE_SIZE

2025-02-14 Thread Sergio Lopez
Introduce VIRTIO_F_SHM_PAGE_SIZE, a feature bit which indicates that the transport provides the page size for SHM regions. Signed-off-by: Sergio Lopez --- drivers/virtio/virtio_pci_modern.c | 3 +++ drivers/virtio/virtio_ring.c | 2 ++ include/uapi/linux/virtio_config.h | 7 ++- 3

[PATCH RFC v2 1/5] virtio_config: add page_size field to virtio_shm_region

2025-02-14 Thread Sergio Lopez
Add a page_size field to virtio_shm_region to store page size supported by the device. This is required to support running VMs with a page size smaller than the host, among other potential scenarios. Signed-off-by: Sergio Lopez --- drivers/virtio/virtio_mmio.c | 2 ++ drivers/virtio

Re: [RFC PATCH 0/5] virtio: obtain SHM page size from device

2025-02-14 Thread Sergio Lopez Pascual
"Michael S. Tsirkin" writes: > On Thu, Feb 13, 2025 at 04:49:14PM +0100, Sergio Lopez wrote: >> There's an incresing number of machines supporting multiple page sizes >> and, on these machines, the host and a guest can be running with >> different pages siz

Re: [PATCH RFC 3/5] virtio-pci: extend virtio_pci_cap to hold page_size

2025-02-14 Thread Sergio Lopez Pascual
Daniel Verkamp writes: > On Thu, Feb 13, 2025 at 11:22 AM Daniel Verkamp wrote: >> >> On Thu, Feb 13, 2025 at 7:54 AM Sergio Lopez wrote: >> > >> > Turn the 16 bit padding into a page_size field to allow the device to >> > pass its requ

Re: [PATCH RFC 3/5] virtio-pci: extend virtio_pci_cap to hold page_size

2025-02-14 Thread Sergio Lopez Pascual
Daniel Verkamp writes: > On Thu, Feb 13, 2025 at 7:54 AM Sergio Lopez wrote: >> >> Turn the 16 bit padding into a page_size field to allow the device to >> pass its required page size with format PAGE_SIZE >> 12. >> >> Signed-off-by: Sergio Lopez >&g

[PATCH RFC 5/5] drm/virtio: add VIRTGPU_PARAM_HOST_SHM_PAGE_SIZE to params

2025-02-13 Thread Sergio Lopez
Add VIRTGPU_PARAM_HOST_SHM_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 --- drivers/gpu/drm/v

[PATCH RFC 2/5] virtio: introduce VIRTIO_F_SHM_PAGE_SIZE

2025-02-13 Thread Sergio Lopez
Introduce VIRTIO_F_SHM_PAGE_SIZE, a feature bit which indicates that the transport provides the page size for SHM regions. Signed-off-by: Sergio Lopez --- drivers/virtio/virtio_pci_modern.c | 3 +++ drivers/virtio/virtio_ring.c | 2 ++ include/uapi/linux/virtio_config.h | 7 ++- 3

[PATCH RFC 4/5] virtio-mmio: read shm region page size

2025-02-13 Thread Sergio Lopez
Use the newly introduced SHM_PAGE_SIZE register to read the page size and store it into virtio_shm_region. Signed-off-by: Sergio Lopez --- drivers/virtio/virtio_mmio.c | 13 - include/uapi/linux/virtio_mmio.h | 3 +++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git

[PATCH RFC 3/5] virtio-pci: extend virtio_pci_cap to hold page_size

2025-02-13 Thread Sergio Lopez
Turn the 16 bit padding into a page_size field to allow the device to pass its required page size with format PAGE_SIZE >> 12. Signed-off-by: Sergio Lopez --- drivers/virtio/virtio_pci_modern.c | 29 + include/uapi/linux/virtio_pci.h| 2 +- 2 files chang

[RFC PATCH 0/5] virtio: obtain SHM page size from device

2025-02-13 Thread Sergio Lopez
changes to the VIRTIO specifications. This patch series will be used as a reference to propose such changes. Signed-off-by: Sergio Lopez --- Sergio Lopez (5): virtio_config: add page_size field to virtio_shm_region virtio: introduce VIRTIO_F_SHM_PAGE_SIZE virtio-pci: ext

[PATCH RFC 1/5] virtio_config: add page_size field to virtio_shm_region

2025-02-13 Thread Sergio Lopez
Add a page_size field to virtio_shm_region to store page size supported by the device. This is required to support running VMs with a page size smaller than the host, among other potential scenarios. Signed-off-by: Sergio Lopez --- drivers/virtio/virtio_mmio.c | 2 ++ drivers/virtio

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

2024-08-22 Thread Sergio Lopez Pascual
Gurchetan Singh writes: > On Thu, Aug 8, 2024 at 3:38 AM Sergio Lopez Pascual wrote: > >> Gurchetan Singh writes: >> >> > On Tue, Aug 6, 2024 at 1:15 PM Rob Clark wrote: >> > >> >> On Tue, Aug 6, 2024 at 9:15 AM Gurchetan Singh >> >>

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

2024-08-08 Thread Sergio Lopez Pascual
Gurchetan Singh writes: > On Tue, Aug 6, 2024 at 1:15 PM Rob Clark wrote: > >> On Tue, Aug 6, 2024 at 9:15 AM Gurchetan Singh >> wrote: >> > >> > >> > >> > On Mon, Aug 5, 2024 at 2:14 AM Sergio Lopez Pascual >> wrote: >> >&g

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

2024-08-05 Thread Sergio Lopez Pascual
Dmitry Osipenko writes: > On 7/23/24 14:49, Sergio Lopez wrote: >> 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

[PATCH 2/2] drm/virtio: add VIRTGPU_PARAM_HOST_PAGE_SIZE to params

2024-07-23 Thread Sergio Lopez
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 --- drivers/gpu/drm/v

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

2024-07-23 Thread Sergio Lopez
Introduce a new feature, HOST_PAGE_SIZE, that indicates the host provides its page size as a value in virtio_gpu_config. Signed-off-by: Sergio Lopez --- drivers/gpu/drm/virtio/virtgpu_drv.c | 1 + drivers/gpu/drm/virtio/virtgpu_drv.h | 2 ++ drivers/gpu/drm/virtio/virtgpu_kms.c | 13

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

2024-07-23 Thread Sergio Lopez
d. 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_PA