aboutsummaryrefslogtreecommitdiff
path: root/tests/libqos/virtio.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/libqos/virtio.c')
-rw-r--r--tests/libqos/virtio.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/libqos/virtio.c b/tests/libqos/virtio.c
index 9880a6964e..0879a621c8 100644
--- a/tests/libqos/virtio.c
+++ b/tests/libqos/virtio.c
@@ -339,3 +339,20 @@ void qvirtqueue_set_used_event(QVirtQueue *vq, uint16_t idx)
/* vq->avail->used_event */
writew(vq->avail + 4 + (2 * vq->size), idx);
}
+
+/*
+ * qvirtio_get_dev_type:
+ * Returns: the preferred virtio bus/device type for the current architecture.
+ */
+const char *qvirtio_get_dev_type(void)
+{
+ const char *arch = qtest_get_arch();
+
+ if (g_str_equal(arch, "arm") || g_str_equal(arch, "aarch64")) {
+ return "device"; /* for virtio-mmio */
+ } else if (g_str_equal(arch, "s390x")) {
+ return "ccw";
+ } else {
+ return "pci";
+ }
+}