<div dir="ltr"><div>Hi Kamil,</div><div><br></div><div>Thanks for the review.</div><div><br></div><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Please use <a href="http://checkpatch.pl" rel="noreferrer" target="_blank">checkpatch.pl</a> script from Linux kernel, for usefull<br>
options see CONTRIBUTING.md<br>
You could ignore MAINTAINER or CamelCase but please fix others.</blockquote>
</div><div>For this I believe I already formatted the v3 patch using this <a href="http://checkpatch.pl">checkpatch.pl</a> script. Is there something I'm missing?</div><div><span class="gmail-im"><br></span><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Same here, you could print number of opened devices (with drm_fd >=0)</blockquote></div><div>Ack</div><div><br></div><div>Br,</div><div>Dorinda.</div></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Fri, Jun 6, 2025 at 5:56 PM Kamil Konieczny <<a href="mailto:kamil.konieczny@linux.intel.com">kamil.konieczny@linux.intel.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Dorinda,<br>
On 2025-05-30 at 11:02:20 +0200, Dorinda Bassey wrote:<br>
> This test suite adds coverage for multiple DRM ioctls specific<br>
> to the VirtIO-GPU driver, verifying functionality such as<br>
> resource creation, memory mapping, 3D transfers, context<br>
> initialization, and parameter querying.<br>
> Each test validates a key ioctl to ensure correct behavior from<br>
> user space and backend implementations. Each subtest is<br>
> self-contained and can be executed independently.<br>
> <br>
> Included subtests:<br>
> - drm-virtgpu-map<br>
> - drm-virtgpu-execbuffer<br>
> - drm-virtgpu-resource-info<br>
> - drm-virtgpu-3d-transfer-to-host<br>
> - drm-virtgpu-3d-transfer-from-host<br>
> - drm-virtgpu-3d-wait<br>
> - drm-virtgpu-resource-create-blob<br>
> - drm-virtgpu-get-caps<br>
> - drm-virtgpu-context-init<br>
> - drm-virtgpu-getparam<br>
> <br>
> How to Test with QEMU virtio-vga-gl or rustvmm vhost-device-gpu<br>
> <br>
> 1. Launch a QEMU guest with virtio-vga-gl<br>
> ./build/qemu-system-x86_64 \<br>
> -enable-kvm \<br>
> -cpu host \<br>
> -m 4096 \<br>
> -machine q35 \<br>
> -display gtk,gl=on \<br>
> -vga none \<br>
> -device virtio-vga-gl \<br>
> -drive file=image.qcow2,format=qcow2 \<br>
> -netdev user,id=n0,hostfwd=tcp::2222-:22 \<br>
> -device virtio-net-pci,netdev=n0<br>
> <br>
> ssh into the guest and run the tests.<br>
> <br>
> 2. Start the vhost-device-gpu backend and Launch a QEMU<br>
> guest with vhost-user-gpu-pci or vhost-user-vga, see guide on:<br>
> <a href="https://crates.io/crates/vhost-device-gpu" rel="noreferrer" target="_blank">https://crates.io/crates/vhost-device-gpu</a><br>
> <br>
> Signed-off-by: Dorinda Bassey <<a href="mailto:dbassey@redhat.com" target="_blank">dbassey@redhat.com</a>><br>
<br>
Please use <a href="http://checkpatch.pl" rel="noreferrer" target="_blank">checkpatch.pl</a> script from Linux kernel, for usefull<br>
options see CONTRIBUTING.md<br>
You could ignore MAINTAINER or CamelCase but please fix others.<br>
<br>
With that fixed<br>
Acked-by: Kamil Konieczny <<a href="mailto:kamil.konieczny@linux.intel.com" target="_blank">kamil.konieczny@linux.intel.com</a>><br>
<br>
I will wait with merge for a review from someone in your Cc list.<br>
<br>
One more nit below.<br>
<br>
> ---<br>
> v3:<br>
> Fix resource format and clarify capset IDs<br>
> <br>
> tests/drm_virtgpu.c | 420 ++++++++++++++++++++++++++++++++++++++++++++<br>
> tests/meson.build | 1 +<br>
> 2 files changed, 421 insertions(+)<br>
> create mode 100644 tests/drm_virtgpu.c<br>
> <br>
> diff --git a/tests/drm_virtgpu.c b/tests/drm_virtgpu.c<br>
> new file mode 100644<br>
> index 000000000..4d7c9e8f5<br>
> --- /dev/null<br>
> +++ b/tests/drm_virtgpu.c<br>
> @@ -0,0 +1,420 @@<br>
> +// SPDX-License-Identifier: MIT<br>
> +/*<br>
> + * Copyright © 2025 Red Hat Inc.<br>
> + *<br>
> + * Authors: Dorinda Bassey <<a href="mailto:dbassey@redhat.com" target="_blank">dbassey@redhat.com</a>><br>
> + */<br>
> +<br>
> +/**<br>
> + * TEST: drm virtgpu ioctls<br>
> + * Description: Testing of the virtIO-GPU driver DRM ioctls<br>
> + * Category: Core<br>
> + * Mega feature: General Core features<br>
> + * Sub-category: virtIO-GPU DRM ioctls<br>
> + * Functionality: drm_ioctls<br>
> + * Feature: Virtualization graphics support<br>
> + * Test category: functionality test<br>
> + */<br>
> +<br>
> +#include <fcntl.h><br>
> +#include <errno.h><br>
> +#include <string.h><br>
> +#include <sys/ioctl.h><br>
> +<br>
> +#include "drm.h"<br>
> +#include "virtgpu_drm.h"<br>
> +#include "igt.h"<br>
> +<br>
> +/**<br>
> + * SUBTEST: drm-virtgpu-map<br>
> + *<br>
> + * SUBTEST: drm-virtgpu-execbuffer<br>
> + *<br>
> + * SUBTEST: drm-virtgpu-resource-info<br>
> + *<br>
> + * SUBTEST: drm-virtgpu-3d-transfer-to-host<br>
> + *<br>
> + * SUBTEST: drm-virtgpu-3d-transfer-from-host<br>
> + *<br>
> + * SUBTEST: drm-virtgpu-3d-wait<br>
> + *<br>
> + * SUBTEST: drm-virtgpu-resource-create<br>
> + *<br>
> + * SUBTEST: drm-virtgpu-resource-create-blob<br>
> + *<br>
> + * SUBTEST: drm-virtgpu-get-caps<br>
> +<br>
> + * SUBTEST: drm-virtgpu-context-init<br>
> + *<br>
> + * SUBTEST: drm-virtgpu-getparam<br>
> + */<br>
> +<br>
> +IGT_TEST_DESCRIPTION("Testing of the virtIO-GPU driver DRM ioctls");<br>
> +<br>
> +#define VIRTGPU_DEVICE "/dev/dri/card0"<br>
> +<br>
> +#define CAPS_BUFFER_SIZE 4096<br>
> +#define MAX_CARDS 16<br>
> +<br>
> +int drm_fd;<br>
> +struct drm_virtgpu_resource_create args;<br>
> +bool resource_created;<br>
> +<br>
> +static int open_virtgpu_device(void)<br>
> +{<br>
> + drmVersionPtr version;<br>
> +<br>
> + for (int i = 0; i < MAX_CARDS; i++) {<br>
> + char path[64];<br>
> +<br>
> + snprintf(path, sizeof(path), "/dev/dri/card%d", i);<br>
> + drm_fd = open(path, O_RDWR | O_CLOEXEC);<br>
> + if (drm_fd < 0)<br>
> + continue;<br>
> +<br>
> + version = drmGetVersion(drm_fd);<br>
> + if (version && strcmp(version->name, "virtio_gpu") == 0) {<br>
> + drmFreeVersion(version);<br>
<br>
You could print path here (with igt_info or igt_debug).<br>
<br>
> + return drm_fd;<br>
> + }<br>
> +<br>
> + drmFreeVersion(version);<br>
> + close(drm_fd);<br>
> + }<br>
<br>
Same here, you could print number of opened devices (with drm_fd >=0)<br>
<br>
Regards,<br>
Kamil<br>
<br>
> + return -1;<br>
> +}<br>
> +<br>
> +static const struct {<br>
> + const char *name;<br>
> + uint64_t id;<br>
> +} params[] = {<br>
> + {"3D_FEATURES", VIRTGPU_PARAM_3D_FEATURES},<br>
> + {"CAPSET_QUERY_FIX", VIRTGPU_PARAM_CAPSET_QUERY_FIX},<br>
> + {"RESOURCE_BLOB", VIRTGPU_PARAM_RESOURCE_BLOB},<br>
> + {"HOST_VISIBLE", VIRTGPU_PARAM_HOST_VISIBLE},<br>
> + {"CROSS_DEVICE", VIRTGPU_PARAM_CROSS_DEVICE},<br>
> + {"CONTEXT_INIT", VIRTGPU_PARAM_CONTEXT_INIT},<br>
> + {"SUPPORTED_CAPSET_IDs", VIRTGPU_PARAM_SUPPORTED_CAPSET_IDs},<br>
> + {"EXPLICIT_DEBUG_NAME", VIRTGPU_PARAM_EXPLICIT_DEBUG_NAME},<br>
> +};<br>
> +<br>
<br>
...cut...<br>
<br>
> +}<br>
> diff --git a/tests/meson.build b/tests/meson.build<br>
> index 20ddddb89..ac85cac30 100644<br>
> --- a/tests/meson.build<br>
> +++ b/tests/meson.build<br>
> @@ -13,6 +13,7 @@ test_progs = [<br>
> 'drm_buddy',<br>
> 'drm_mm',<br>
> 'drm_read',<br>
> + 'drm_virtgpu',<br>
> 'fbdev',<br>
> 'kms_3d',<br>
> 'kms_addfb_basic',<br>
> -- <br>
> 2.48.1<br>
> <br>
<br>
</blockquote></div>