tools: virt-host-validate: HW virt support on s390

Extend the detection of hardware virtualization to the s390 platform.

Signed-off-by: Bjoern Walk <bwalk@linux.vnet.ibm.com>
This commit is contained in:
Bjoern Walk 2016-05-03 08:10:54 +02:00 committed by Michal Privoznik
parent efc23df251
commit 71714e8549
3 changed files with 22 additions and 3 deletions

View File

@ -40,7 +40,8 @@
VIR_ENUM_IMPL(virHostValidateCPUFlag, VIR_HOST_VALIDATE_CPU_FLAG_LAST,
"vmx",
"svm");
"svm",
"sie");
static bool quiet;

View File

@ -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;

View File

@ -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,