On Thu, Jan 31, 2019 at 03:34:20PM +0100, Andrea Bolognani wrote:
This shows users can now use PCI for RISC-V guests, as long
as they opt into it by manually assigning addresses.
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
tests/qemuxml2argvdata/riscv64-virt-pci.args | 27 ++++++++++++++++++
tests/qemuxml2argvdata/riscv64-virt-pci.xml | 24 ++++++++++++++++
tests/qemuxml2argvtest.c | 2 ++
tests/qemuxml2xmloutdata/riscv64-virt-pci.xml | 28 +++++++++++++++++++
tests/qemuxml2xmltest.c | 2 ++
5 files changed, 83 insertions(+)
create mode 100644 tests/qemuxml2argvdata/riscv64-virt-pci.args
create mode 100644 tests/qemuxml2argvdata/riscv64-virt-pci.xml
create mode 100644 tests/qemuxml2xmloutdata/riscv64-virt-pci.xml
diff --git a/tests/qemuxml2argvdata/riscv64-virt-pci.args
b/tests/qemuxml2argvdata/riscv64-virt-pci.args
new file mode 100644
index 0000000000..6fc3316125
--- /dev/null
+++ b/tests/qemuxml2argvdata/riscv64-virt-pci.args
@@ -0,0 +1,27 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/home/test \
+USER=test \
+LOGNAME=test \
+QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-riscv64 \
+-name riscv64 \
+-S \
+-machine virt,accel=tcg,usb=off,dump-guest-core=off \
+-m 2048 \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid fd65fc03-8838-4c4d-9d8d-395802488790 \
+-display none \
+-no-user-config \
+-nodefaults \
+-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-riscv64/monitor.sock,\
+server,nowait \
+-mon chardev=charmonitor,id=monitor,mode=control \
+-rtc base=utc \
+-no-shutdown \
+-kernel /var/lib/libvirt/images/riscv64.bbl \
+-append root=/dev/vda \
+-drive file=/var/lib/libvirt/images/riscv64.qcow2,format=qcow2,if=none,\
+id=drive-virtio-disk0 \
+-device virtio-blk-pci,bus=pcie.0,addr=0x1,drive=drive-virtio-disk0,\
+id=virtio-disk0,bootindex=1
diff --git a/tests/qemuxml2argvdata/riscv64-virt-pci.xml
b/tests/qemuxml2argvdata/riscv64-virt-pci.xml
new file mode 100644
index 0000000000..c72cd58086
--- /dev/null
+++ b/tests/qemuxml2argvdata/riscv64-virt-pci.xml
@@ -0,0 +1,24 @@
+<domain type='qemu'>
+ <name>riscv64</name>
+ <uuid>fd65fc03-8838-4c4d-9d8d-395802488790</uuid>
+ <memory unit='KiB'>2097152</memory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='riscv64' machine='virt'>hvm</type>
+ <kernel>/var/lib/libvirt/images/riscv64.bbl</kernel>
+ <cmdline>root=/dev/vda</cmdline>
+ </os>
+ <devices>
+ <emulator>/usr/bin/qemu-system-riscv64</emulator>
+ <disk type='file'>
+ <driver name='qemu' type='qcow2'/>
+ <source file='/var/lib/libvirt/images/riscv64.qcow2'/>
+ <target dev='vda' bus='virtio'/>
+ <!-- We need to manually pick an address on pcie.0 because otherwise
+ libvirt would try to add pcie-root-ports, and QEMU doesn't support
+ PCIe controllers for RISC-V guests yet -->
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x01' function='0x0'/>
+ </disk>
+ <memballoon model='none'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index ba6fd4db35..6dc05c347f 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -3072,6 +3072,8 @@ mymain(void)
DO_TEST("riscv64-virt",
QEMU_CAPS_DEVICE_VIRTIO_MMIO);
+ DO_TEST("riscv64-virt-pci",
+ QEMU_CAPS_OBJECT_GPEX);
Consider giving DO_TEST_CAPS_ARCH_LATEST a chance, for more faithful
viewer experience.
Reviewed-by: Ján Tomko <jtomko(a)redhat.com>
Jano