From patchwork Fri Jun 3 12:53:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 69246 Delivered-To: patch@linaro.org Received: by 10.140.106.246 with SMTP id e109csp250934qgf; Fri, 3 Jun 2016 05:59:40 -0700 (PDT) X-Received: by 10.194.105.34 with SMTP id gj2mr3892068wjb.154.1464958780167; Fri, 03 Jun 2016 05:59:40 -0700 (PDT) Return-Path: Received: from mx6-phx2.redhat.com (mx6-phx2.redhat.com. [209.132.183.39]) by mx.google.com with ESMTPS id wt5si7532267wjb.111.2016.06.03.05.59.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 Jun 2016 05:59:40 -0700 (PDT) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.39 as permitted sender) client-ip=209.132.183.39; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.39 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx6-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u53Cuhij019622; Fri, 3 Jun 2016 08:56:44 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id u53Cs6Ac017180 for ; Fri, 3 Jun 2016 08:54:06 -0400 Received: from mx1.redhat.com (ext-mx07.extmail.prod.ext.phx2.redhat.com [10.5.110.31]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u53Cs6p8004196 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Fri, 3 Jun 2016 08:54:06 -0400 Received: from mail-lf0-f53.google.com (mail-lf0-f53.google.com [209.85.215.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 674ADC04B31F for ; Fri, 3 Jun 2016 12:54:04 +0000 (UTC) Received: by mail-lf0-f53.google.com with SMTP id s64so53972689lfe.0 for ; Fri, 03 Jun 2016 05:54:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=iwwQhENRtbMswPi1L4zqJ+TzsFWQOE2PLwGvzkltoOg=; b=Z66XhrE3lMTbpayvPudOYYppUFp5SOtzmMM40PAWAyGBnbWdykGzPQqXoZa2oH4D2F /77CWf5tSAlN5U4KdErdjT9yes+hs1CdRp8s9hN+i1r6NauBxHLqWpmH+8yLmkEadt/s RtwnsksbdA0+igbvYvzNa+FFT6Sg5yFGrWKAo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=iwwQhENRtbMswPi1L4zqJ+TzsFWQOE2PLwGvzkltoOg=; b=JsQOujJ1q2Ubkah8yK+e1HB3F4spMhigWKvgROhCGHcwIu9zSnSKSeOwFpsC58DQgZ dF6xXcx8pGNTZgpkXKCAWsCKLOqDYQ8TLM5J1sbRPCO/i5Oseu5XveLUFsUOUK2yU+Dw PLeDCRnlfaYoIulzKA67vvLttbChCkmhrpinplVUbuf7tl6LPzx7jTr6SVP0Dodn9FKD G5k0On4Y8yKfFVlQELS0D7bykI8ocfk+sAeCpvcbFgN5teZA7PQORDh4PJQ8kAw6JnHQ wI/ZYLx05vyl4Cv2T3izLbSP7hagbhpc+tl1NyMSFlAyptFRW+YP1A3yBYy6L9TiV2xd spQw== X-Gm-Message-State: ALyK8tIYgQhCUm4nzOLIg/RwporLSZSbZUymBWv0LOKI1Th2pmDbGrpPyLG0X0iHg7kdqT8D X-Received: by 10.46.1.92 with SMTP id 89mr907344ljb.23.1464958442901; Fri, 03 Jun 2016 05:54:02 -0700 (PDT) Received: from beaming.home (91-157-168-132.elisa-laajakaista.fi. [91.157.168.132]) by smtp.gmail.com with ESMTPSA id 65sm353153lja.41.2016.06.03.05.54.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 03 Jun 2016 05:54:01 -0700 (PDT) From: Riku Voipio To: libvir-list@redhat.com Date: Fri, 3 Jun 2016 15:53:58 +0300 Message-Id: <1464958438-17768-1-git-send-email-riku.voipio@linaro.org> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Fri, 03 Jun 2016 12:54:04 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Fri, 03 Jun 2016 12:54:04 +0000 (UTC) for IP:'209.85.215.53' DOMAIN:'mail-lf0-f53.google.com' HELO:'mail-lf0-f53.google.com' FROM:'riku.voipio@linaro.org' RCPT:'' X-RedHat-Spam-Score: 0.579 (BAYES_50, DCC_REPUT_00_12, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FSL_HELO_HOME, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_PASS) 209.85.215.53 mail-lf0-f53.google.com 209.85.215.53 mail-lf0-f53.google.com X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Scanned-By: MIMEDefang 2.78 on 10.5.110.31 X-loop: libvir-list@redhat.com X-Mailman-Approved-At: Fri, 03 Jun 2016 08:56:42 -0400 Cc: Riku Voipio Subject: [libvirt] [PATCH] virt-host-validate: improve tests for arm/aarch64 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com ARM/Aarch64 /proc/cpuinfo has no virtualization related flags. Refactor the Qemu/KVM test a bit: 1) run the "for hardware virtualization" test only on plaforms with known cpuinfo flags (x86, s390) 2) test for /dev/kvm also on platforms where no cpu flags are set Finally Add a more generic error hint message for non-x86 plaforms when /dev/kvm is missing. Signed-off-by: Riku Voipio --- tools/virt-host-validate-qemu.c | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) -- 2.1.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list diff --git a/tools/virt-host-validate-qemu.c b/tools/virt-host-validate-qemu.c index 56ec3c7..520c8ed 100644 --- a/tools/virt-host-validate-qemu.c +++ b/tools/virt-host-validate-qemu.c @@ -32,8 +32,9 @@ int virHostValidateQEMU(void) virBitmapPtr flags; int ret = 0; bool hasHwVirt = false; - - virHostMsgCheck("QEMU", "%s", _("for hardware virtualization")); + bool hasVirtFlag = false; + char *kvmhint = _("Check that CPU and firmware supports virtualization " + "and kvm module is loaded"); if (!(flags = virHostValidateGetCPUFlags())) return -1; @@ -41,12 +42,16 @@ int virHostValidateQEMU(void) switch (virArchFromHost()) { case VIR_ARCH_I686: case VIR_ARCH_X86_64: + hasVirtFlag = true; + kvmhint =_("Check that the 'kvm-intel' or 'kvm-amd' modules are " + "loaded & the BIOS has enabled virtualization"); 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: + hasVirtFlag = true; if (virBitmapIsBitSet(flags, VIR_HOST_VALIDATE_CPU_FLAG_SIE)) hasHwVirt = true; break; @@ -54,21 +59,27 @@ int virHostValidateQEMU(void) hasHwVirt = false; } - if (hasHwVirt) { - virHostMsgPass(); + if (hasVirtFlag) { + virHostMsgCheck("QEMU", "%s", _("for hardware virtualization")); + if (hasHwVirt) + virHostMsgPass(); + else { + virHostMsgFail(VIR_HOST_VALIDATE_FAIL, + _("Only emulated CPUs are available, performance will be significantly limited")); + ret = -1; + } + } + + if (hasHwVirt || !hasVirtFlag) { if (virHostValidateDeviceExists("QEMU", "/dev/kvm", VIR_HOST_VALIDATE_FAIL, - _("Check that the 'kvm-intel' or 'kvm-amd' modules are " - "loaded & the BIOS has enabled virtualization")) < 0) + kvmhint) <0) ret = -1; else if (virHostValidateDeviceAccessible("QEMU", "/dev/kvm", VIR_HOST_VALIDATE_FAIL, _("Check /dev/kvm is world writable or you are in " "a group that is allowed to access it")) < 0) ret = -1; - } else { - virHostMsgFail(VIR_HOST_VALIDATE_WARN, - _("Only emulated CPUs are available, performance will be significantly limited")); } virBitmapFree(flags);