[libvirt] [PATCH 1/1] qemu: avoid users specifying CPU features for non-x86 plaftorm.

Li Zhang zhlcindy at gmail.com
Fri Sep 6 06:52:43 UTC 2013


From: Li Zhang <zhlcindy at linux.vnet.ibm.com>

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 at linux.vnet.ibm.com>
---
 src/qemu/qemu_command.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 91ca86a..1a158e4 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -10644,6 +10644,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;
-- 
1.8.1.4




More information about the libvir-list mailing list