From 71714e854955d4017d1d9de2cd776626d28edac6 Mon Sep 17 00:00:00 2001 From: Bjoern Walk Date: Tue, 3 May 2016 08:10:54 +0200 Subject: [PATCH] tools: virt-host-validate: HW virt support on s390 Extend the detection of hardware virtualization to the s390 platform. Signed-off-by: Bjoern Walk --- tools/virt-host-validate-common.c | 3 ++- tools/virt-host-validate-common.h | 1 + tools/virt-host-validate-qemu.c | 21 +++++++++++++++++++-- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/tools/virt-host-validate-common.c b/tools/virt-host-validate-common.c index 3c19249722..4bfc52af32 100644 --- a/tools/virt-host-validate-common.c +++ b/tools/virt-host-validate-common.c @@ -40,7 +40,8 @@ VIR_ENUM_IMPL(virHostValidateCPUFlag, VIR_HOST_VALIDATE_CPU_FLAG_LAST, "vmx", - "svm"); + "svm", + "sie"); static bool quiet; diff --git a/tools/virt-host-validate-common.h b/tools/virt-host-validate-common.h index 26e006b723..c14e92223f 100644 --- a/tools/virt-host-validate-common.h +++ b/tools/virt-host-validate-common.h @@ -37,6 +37,7 @@ typedef enum { typedef enum { VIR_HOST_VALIDATE_CPU_FLAG_VMX = 0, VIR_HOST_VALIDATE_CPU_FLAG_SVM, + VIR_HOST_VALIDATE_CPU_FLAG_SIE, VIR_HOST_VALIDATE_CPU_FLAG_LAST, } virHostValidateCPUFlag; diff --git a/tools/virt-host-validate-qemu.c b/tools/virt-host-validate-qemu.c index 47f2f98877..56ec3c7fbe 100644 --- a/tools/virt-host-validate-qemu.c +++ b/tools/virt-host-validate-qemu.c @@ -24,20 +24,37 @@ #include "virt-host-validate-qemu.h" #include "virt-host-validate-common.h" +#include "virarch.h" #include "virbitmap.h" int virHostValidateQEMU(void) { virBitmapPtr flags; int ret = 0; + bool hasHwVirt = false; virHostMsgCheck("QEMU", "%s", _("for hardware virtualization")); if (!(flags = virHostValidateGetCPUFlags())) return -1; - if ((virBitmapIsBitSet(flags, VIR_HOST_VALIDATE_CPU_FLAG_SVM) || - virBitmapIsBitSet(flags, VIR_HOST_VALIDATE_CPU_FLAG_VMX))) { + switch (virArchFromHost()) { + case VIR_ARCH_I686: + case VIR_ARCH_X86_64: + if (virBitmapIsBitSet(flags, VIR_HOST_VALIDATE_CPU_FLAG_SVM) || + virBitmapIsBitSet(flags, VIR_HOST_VALIDATE_CPU_FLAG_VMX)) + hasHwVirt = true; + break; + case VIR_ARCH_S390: + case VIR_ARCH_S390X: + if (virBitmapIsBitSet(flags, VIR_HOST_VALIDATE_CPU_FLAG_SIE)) + hasHwVirt = true; + break; + default: + hasHwVirt = false; + } + + if (hasHwVirt) { virHostMsgPass(); if (virHostValidateDeviceExists("QEMU", "/dev/kvm", VIR_HOST_VALIDATE_FAIL,