teknoraver / rpms / systemd

Forked from rpms/systemd 2 months ago
Clone
Blob Blame History Raw
From e48936b0be085f15a2e2ac88b2e50a91a66782ac Mon Sep 17 00:00:00 2001
From: Daniel Berrange <berrange@redhat.com>
Date: Wed, 19 Jul 2017 10:06:07 +0100
Subject: [PATCH] virt: enable detecting QEMU (TCG) via CPUID (#6399)

QEMU >= 2.10 will include a CPUID leaf with value "TCGTCGTCGTCG"
on x86 when running with the TCG CPU emulator:

  https://lists.gnu.org/archive/html/qemu-devel/2017-07/msg05231.html

Existing methods of detecting QEMU are left unchanged for sake of
backcompatibility.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
(cherry picked from commit 5588612e9e8828691f13141e3fcebe08a59201fe)
---
 src/basic/virt.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/basic/virt.c b/src/basic/virt.c
index 6011744523..5143ac6656 100644
--- a/src/basic/virt.c
+++ b/src/basic/virt.c
@@ -46,6 +46,7 @@ static int detect_vm_cpuid(void) {
         } cpuid_vendor_table[] = {
                 { "XenVMMXenVMM", VIRTUALIZATION_XEN       },
                 { "KVMKVMKVM",    VIRTUALIZATION_KVM       },
+                { "TCGTCGTCGTCG", VIRTUALIZATION_QEMU      },
                 /* http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1009458 */
                 { "VMwareVMware", VIRTUALIZATION_VMWARE    },
                 /* https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/reference/tlfs */