]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
qemu: Implement GIC
authorMichal Privoznik <mprivozn@redhat.com>
Mon, 27 Apr 2015 12:54:19 +0000 (14:54 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 5 May 2015 07:45:52 +0000 (09:45 +0200)
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 <mprivozn@redhat.com>
src/qemu/qemu_command.c
tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic.args [new file with mode: 0644]
tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic.xml [new file with mode: 0644]
tests/qemuxml2argvtest.c

index 952a10efc8610a1dcb4be9156b5f4c85720a2cfb..c32d8c61d362294bd77f1515b44e3837c520412c 100644 (file)
@@ -7202,6 +7202,19 @@ qemuBuildCpuArgStr(virQEMUDriverPtr driver,
         have_cpu = true;
     }
 
+    if (def->features[VIR_DOMAIN_FEATURE_GIC] == VIR_TRISTATE_SWITCH_ON) {
+        if (def->gic_version && 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 (file)
index 0000000..e61cd1e
--- /dev/null
@@ -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 (file)
index 0000000..08d3d71
--- /dev/null
@@ -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>
index 4678261bce92f15d43a570d76f88e48ad814b812..97c7fba637d530b02de5d50e7fc74e1dd881168c 100644 (file)
@@ -1541,6 +1541,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);