]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: avoid users specifying CPU features for non-x86 plaftorm.
authorLi Zhang <zhlcindy@linux.vnet.ibm.com>
Fri, 6 Sep 2013 11:15:25 +0000 (12:15 +0100)
committerDaniel P. Berrange <berrange@redhat.com>
Mon, 9 Sep 2013 09:33:26 +0000 (10:33 +0100)
Currently, only X86 provides users CPU features with CPUID instruction.
If users specify the features for non-x86, it should tell users to
remove them.

This patch is to report one error if features are specified by
users for non-x86 platform.

Signed-off-by: Li Zhang <zhlcindy@linux.vnet.ibm.com>
src/qemu/qemu_command.c

index adb498397b3527b3b2e9538890d7776f80109177..152143158f77ab23fa3a0305bb1961f457ce3ae2 100644 (file)
@@ -10645,6 +10645,14 @@ qemuParseCommandLineCPU(virDomainDefPtr dom,
             if (*feature == '\0')
                 goto syntax;
 
+            if (dom->os.arch != VIR_ARCH_X86_64 &&
+                dom->os.arch != VIR_ARCH_I686) {
+                virReportError(VIR_ERR_INTERNAL_ERROR,
+                               _("%s platform doesn't support CPU features'"),
+                               virArchToString(dom->os.arch));
+                goto cleanup;
+             }
+
             if (STREQ(feature, "kvmclock")) {
                 bool present = (policy == VIR_CPU_FEATURE_REQUIRE);
                 size_t j;