Skip to contentSkip to conversation

tests/qtest: attempt to enable tests for virtio-gpio (!working)

RFC PATCH New Alex Bennée 1 participant 1 message Apr 8, 2022 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

RFC PATCH v2 1/1 tests/qtest: attempt to enable tests for virtio-gpio (!working)

We don't have a virtio-gpio implementation in QEMU and only support a vhost-user backend. The QEMU side of the code is minimal so it should be enough to instantiate the device and pass some vhost-user messages over the control socket. To do this we hook into the existing vhost-user-test code and just add the bits required for gpio.

Based-on: [email protected] [+ my fix]

Cc Viresh Kumar <[email protected]>
Cc Paolo Bonzini <[email protected]>
Cc Eric Auger <[email protected]>

Message-Id: <[email protected]>

---
v2
- made progress, now starts up cleanly
- fix application of extra arguments (causing dupe ids)
- added (partial) F_CONFIG support
- however seems to hang qos-test which never sees the get_config msg
- it should have failed the test in chr_read()

---
 tests/qtest/libqos/virtio-gpio.h | 34 +++++++++++
 tests/qtest/libqos/virtio-gpio.c | 98 ++++++++++++++++++++++++++++++++
 tests/qtest/vhost-user-test.c    | 60 +++++++++++++++++++
 tests/qtest/libqos/meson.build   |  1 +
 4 files changed, 193 insertions(+)
 create mode 100644 tests/qtest/libqos/virtio-gpio.h
 create mode 100644 tests/qtest/libqos/virtio-gpio.c
tests/qtest/libqos/virtio-gpio.h new file +34 -0
new file mode 100644
index 0000000000..abe6967ae9
@@ -0,0 +1,34 @@
+/*
+ * virtio-gpio structures
+ *
+ * Copyright (c) 2022 Linaro Ltd
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#ifndef TESTS_LIBQOS_VIRTIO_GPIO_H
+#define TESTS_LIBQOS_VIRTIO_GPIO_H
+
+#include "qgraph.h"
+#include "virtio.h"
+#include "virtio-pci.h"
+
+typedef struct QVhostUserGPIO QVhostUserGPIO;
+typedef struct QVhostUserGPIOPCI QVhostUserGPIOPCI;
+typedef struct QVhostUserGPIODevice QVhostUserGPIODevice;
+
+struct QVhostUserGPIO {
+    QVirtioDevice *vdev;
+};
+
+struct QVhostUserGPIOPCI {
+    QVirtioPCIDevice pci_vdev;
+    QVhostUserGPIO gpio;
+};
+
+struct QVhostUserGPIODevice {
+    QOSGraphObject obj;
+    QVhostUserGPIO gpio;
+};
+
+#endif
tests/qtest/libqos/virtio-gpio.c new file +98 -0

98 lines not on this page · raw message

tests/qtest/vhost-user-test.c +60 -0

93 lines not on this page · raw message

tests/qtest/libqos/meson.build +1 -0
index 8c8ee15553..f581330d8b 100644
@@ -42,6 +42,7 @@ libqos_srcs = files('../libqtest.c',
         'virtio-scsi.c',
         'virtio-serial.c',
         'virtio-iommu.c',
+        'virtio-gpio.c',
         'generic-pcihost.c',
 
         # qgraph machines:
Signature · 1 line
2.30.2