From: Richard W.M. Jones Date: Wed, 25 May 2011 10:13:50 +0000 (+0100) Subject: Fix for KVM with explicit -cpu model parameter. X-Git-Tag: 1.10~2 X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=441ce9d9ecf9edf0f325c280451ba69dc160882e;p=virt-what.git Fix for KVM with explicit -cpu model parameter. --- diff --git a/virt-what.in b/virt-what.in index e0fdf5b..a27be10 100644 --- a/virt-what.in +++ b/virt-what.in @@ -166,13 +166,14 @@ fi # Check for Parallels. if echo "$dmi" | grep -q 'Vendor: Parallels'; then echo parallels + skip_qemu_kvm=1 fi # Check for Xen. if [ "$cpuid" = "XenVMMXenVMM" ]; then echo xen; echo xen-hvm - is_xen=1 + skip_qemu_kvm=1 elif [ -f $root/proc/xen/capabilities ]; then echo xen if grep -q "control_d" $root/proc/xen/capabilities; then @@ -180,7 +181,7 @@ elif [ -f $root/proc/xen/capabilities ]; then else echo xen-domU fi - is_xen=1 + skip_qemu_kvm=1 elif [ -f $root/sys/hypervisor/type ] && grep -q "xen" $root/sys/hypervisor/type; then # Ordinary kernel with pv_ops. There does not seem to be @@ -190,15 +191,20 @@ elif [ -f $root/sys/hypervisor/type ] && fi # Check for QEMU/KVM. +# +# Parallels exports KVMKVMKVM leaf, so skip this test if we've already +# seen that it's Parallels. Xen uses QEMU as the device model, so +# skip this test if we know it is Xen. -if [ ! "$is_xen" ]; then - # Disable this test if we know this is Xen already, because Xen - # uses QEMU for its device model. - - if grep -q 'QEMU' $root/proc/cpuinfo; then - if [ "$cpuid" = "KVMKVMKVM" ]; then - echo kvm - else +if [ ! "$skip_qemu_kvm" ]; then + if [ "$cpuid" = "KVMKVMKVM" ]; then + echo kvm + else + # XXX This is known to fail for qemu with the explicit -cpu + # option, since /proc/cpuinfo will not contain the QEMU + # string. The long term fix for this would be to export + # another CPUID leaf for non-accelerated qemu. + if grep -q 'QEMU' $root/proc/cpuinfo; then echo qemu fi fi