The only version that's supported in QEMU is version 2, currently.
Fortunately, it is enabled by aarch64 automatically, so there's
nothing for us that needs to be put onto command line.

Signed-off-by: Michal Privoznik <mpriv...@redhat.com>
---
 src/qemu/qemu_command.c                            | 13 +++++++++++
 .../qemuxml2argvdata/qemuxml2argv-aarch64-gic.args |  6 +++++
 .../qemuxml2argvdata/qemuxml2argv-aarch64-gic.xml  | 26 ++++++++++++++++++++++
 tests/qemuxml2argvtest.c                           |  2 ++
 4 files changed, 47 insertions(+)
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic.xml

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index a54f3a3..0341300 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -7199,6 +7199,19 @@ qemuBuildCpuArgStr(virQEMUDriverPtr driver,
         have_cpu = true;
     }
 
+    if (def->features[VIR_DOMAIN_FEATURE_GIC] == VIR_TRISTATE_SWITCH_ON) {
+        if (def->gic_version != 2) {
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                           _("gic version '%u' is not supported"),
+                           def->gic_version);
+            goto cleanup;
+        }
+
+        /* There's no command line argument currently to turn on/off GIC. It's
+         * done automatically by qemu-system-aarch64. But if this changes, lets
+         * put the code here. */
+    }
+
     if (virBufferCheckError(&buf) < 0)
         goto cleanup;
 
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic.args 
b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic.args
new file mode 100644
index 0000000..e61cd1e
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic.args
@@ -0,0 +1,6 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-aarch64 -S -M virt -no-kvm -cpu cortex-a53 -m 1024 -smp 1 
\
+-nographic -nodefaults -monitor unix:/tmp/test-monitor,server,nowait -boot c \
+-kernel /aarch64.kernel -initrd /aarch64.initrd -append console=ttyAMA0 -usb \
+-net nic,macaddr=52:54:00:09:a4:37,vlan=0,model=virtio,name=net0 \
+-net user,vlan=0,name=hostnet0
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic.xml 
b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic.xml
new file mode 100644
index 0000000..08d3d71
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic.xml
@@ -0,0 +1,26 @@
+<domain type="qemu">
+  <name>aarch64test</name>
+  <uuid>6ba410c5-1e5c-4d57-bee7-2228e7ffa32f</uuid>
+  <memory>1048576</memory>
+  <currentMemory>1048576</currentMemory>
+  <vcpu>1</vcpu>
+  <features>
+    <acpi/>
+    <gic version='2'/>
+  </features>
+  <cpu match='exact'>
+    <model>cortex-a53</model>
+  </cpu>
+  <os>
+    <type arch="aarch64" machine="virt">hvm</type>
+    <kernel>/aarch64.kernel</kernel>
+    <initrd>/aarch64.initrd</initrd>
+    <cmdline>console=ttyAMA0</cmdline>
+  </os>
+  <devices>
+    <emulator>/usr/bin/qemu-system-aarch64</emulator>
+    <interface type='user'>
+      <mac address='52:54:00:09:a4:37'/>
+    </interface>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 055ceee..ce5a7e8 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1531,6 +1531,8 @@ mymain(void)
     DO_TEST("aarch64-cpu-model-host", QEMU_CAPS_DEVICE, QEMU_CAPS_DRIVE,
             QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DEVICE_VIRTIO_MMIO,
             QEMU_CAPS_CPU_HOST, QEMU_CAPS_KVM);
+    DO_TEST("aarch64-gic", QEMU_CAPS_DEVICE, QEMU_CAPS_DRIVE,
+            QEMU_CAPS_KVM);
 
     DO_TEST("kvm-pit-device", QEMU_CAPS_KVM_PIT_TICK_POLICY);
     DO_TEST("kvm-pit-delay", QEMU_CAPS_NO_KVM_PIT);
-- 
2.0.5

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to