From 18ad5d17618b0b109a5942e9ce88e2d3dffa100b Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 7 Jan 2014 12:37:30 +0000 Subject: [PATCH 01/16] Version 1.14. --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 4008571..da2ebb3 100644 --- a/configure.ac +++ b/configure.ac @@ -15,7 +15,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -AC_INIT([virt-what],[1.13]) +AC_INIT([virt-what],[1.14]) AM_INIT_AUTOMAKE([foreign]) dnl Check for basic C environment. -- 1.8.3.1 From 1efaa88391668a73d3c2c0cd96dfb5103ecf3975 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 20 May 2014 10:50:39 +0100 Subject: [PATCH 02/16] Fix spelling mistake in the man page (RHBZ#1099289). --- virt-what.pod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/virt-what.pod b/virt-what.pod index bff2998..bcafd26 100644 --- a/virt-what.pod +++ b/virt-what.pod @@ -113,7 +113,7 @@ Status: contributed by Justin Clift The guest is running inside IBM PowerVM Lx86 Linux/x86 emulator. -Status: data originally supplied by Jeffrey Scheel, confimed by +Status: data originally supplied by Jeffrey Scheel, confirmed by Yufang Zhang and RWMJ =item B -- 1.8.3.1 From abd067c4760640e232203689b4d32eacafdbbdde Mon Sep 17 00:00:00 2001 From: Charles Nguyen Date: Sat, 21 Jun 2014 22:27:51 -0500 Subject: [PATCH 03/16] Added check and test routines for Docker --- Makefile.am | 7 +++++++ tests/docker/.dockerinit | 0 tests/docker/proc/cpuinfo | 0 tests/docker/proc/self/status | 0 tests/docker/sbin/dmidecode | 6 ++++++ tests/docker/sbin/uname | 2 ++ tests/docker/sbin/virt-what-cpuid-helper | 2 ++ tests/test-docker.sh | 34 ++++++++++++++++++++++++++++++++ virt-what.in | 5 +++++ 9 files changed, 56 insertions(+) create mode 100644 tests/docker/.dockerinit create mode 100644 tests/docker/proc/cpuinfo create mode 100644 tests/docker/proc/self/status create mode 100755 tests/docker/sbin/dmidecode create mode 100755 tests/docker/sbin/uname create mode 100755 tests/docker/sbin/virt-what-cpuid-helper create mode 100755 tests/test-docker.sh diff --git a/Makefile.am b/Makefile.am index 784d6db..24d1730 100644 --- a/Makefile.am +++ b/Makefile.am @@ -40,6 +40,7 @@ endif TESTS = \ tests/test-baremetal.sh \ + tests/test-docker.sh \ tests/test-esx4.1.sh \ tests/test-hyperv.sh \ tests/test-kvm.sh \ @@ -63,6 +64,12 @@ EXTRA_DIST = \ tests/baremetal/sbin/dmidecode \ tests/baremetal/sbin/uname \ tests/baremetal/sbin/virt-what-cpuid-helper \ + tests/docker/.dockerinit \ + tests/docker/proc/cpuinfo \ + tests/docker/proc/self/status \ + tests/docker/sbin/dmidecode \ + tests/docker/sbin/uname \ + tests/docker/sbin/virt-what-cpuid-helper \ tests/esx4.1/proc/cpuinfo \ tests/esx4.1/proc/self/status \ tests/esx4.1/sbin/dmidecode \ diff --git a/tests/docker/.dockerinit b/tests/docker/.dockerinit new file mode 100644 index 0000000..e69de29 diff --git a/tests/docker/proc/cpuinfo b/tests/docker/proc/cpuinfo new file mode 100644 index 0000000..e69de29 diff --git a/tests/docker/proc/self/status b/tests/docker/proc/self/status new file mode 100644 index 0000000..e69de29 diff --git a/tests/docker/sbin/dmidecode b/tests/docker/sbin/dmidecode new file mode 100755 index 0000000..d9992ad --- /dev/null +++ b/tests/docker/sbin/dmidecode @@ -0,0 +1,6 @@ +#!/bin/sh - +cat <<'EOF' +# dmidecode 2.11 +/dev/mem: Operation not permitted +EOF +exit 1 diff --git a/tests/docker/sbin/uname b/tests/docker/sbin/uname new file mode 100755 index 0000000..ab0ec89 --- /dev/null +++ b/tests/docker/sbin/uname @@ -0,0 +1,2 @@ +#!/bin/sh - +echo x86_64 diff --git a/tests/docker/sbin/virt-what-cpuid-helper b/tests/docker/sbin/virt-what-cpuid-helper new file mode 100755 index 0000000..ad82504 --- /dev/null +++ b/tests/docker/sbin/virt-what-cpuid-helper @@ -0,0 +1,2 @@ +#!/bin/sh - +echo @ diff --git a/tests/test-docker.sh b/tests/test-docker.sh new file mode 100755 index 0000000..4187f61 --- /dev/null +++ b/tests/test-docker.sh @@ -0,0 +1,34 @@ +# Test for Docker +# Copyright (C) 2008-2011 Red Hat Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +root=tests/docker + +output="$(./virt-what --test-root=$root 2>&1)" +expected="docker" + +if [ "$output" != "$expected" ]; then + echo "$0: test failed because output did not match expected" + echo "Expected output was:" + echo "----------------------------------------" + echo "$expected" + echo "----------------------------------------" + echo "But the actual output of the program was:" + echo "----------------------------------------" + echo "$output" + echo "----------------------------------------" + exit 1 +fi diff --git a/virt-what.in b/virt-what.in index fb399be..c04203e 100644 --- a/virt-what.in +++ b/virt-what.in @@ -248,3 +248,8 @@ if ! "$skip_qemu_kvm"; then fi fi fi + +# Check for Docker. +if [ -f "${root}/.dockerinit" ]; then + echo docker +fi -- 1.8.3.1 From 902276acb3c0f92fc08c618cbbba18e9bee5a38f Mon Sep 17 00:00:00 2001 From: Charles Nguyen Date: Sat, 21 Jun 2014 23:43:05 -0500 Subject: [PATCH 04/16] Added documentation for Docker tests --- virt-what.pod | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/virt-what.pod b/virt-what.pod index bcafd26..8fd9bc4 100644 --- a/virt-what.pod +++ b/virt-what.pod @@ -25,6 +25,12 @@ don't know about or cannot detect. =over 4 +=item B + +This is a Docker container. + +Status: confirmed by Charles Nguyen + =item B This is Microsoft Hyper-V hypervisor. -- 1.8.3.1 From 6382ef1cb5b8c146bfd35912730dccd68ab4b71a Mon Sep 17 00:00:00 2001 From: "A. Gordon" Date: Mon, 15 Sep 2014 14:48:23 -0400 Subject: [PATCH 05/16] virt-what.in: remove bash-ism Use '/bin/sh' instead of '/bin/bash', with POSIX-compatible function definitions. --- virt-what.in | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/virt-what.in b/virt-what.in index c04203e..1532b90 100644 --- a/virt-what.in +++ b/virt-what.in @@ -1,4 +1,4 @@ -#!/bin/bash - +#!/bin/sh - # @configure_input@ # Copyright (C) 2008-2011 Red Hat Inc. # @@ -33,12 +33,12 @@ skip_qemu_kvm=false VERSION="@VERSION@" -function fail { +fail() { echo "virt-what: $1" >&2 exit 1 } -function usage { +usage() { echo "virt-what [options]" echo "Options:" echo " --help Display this help" -- 1.8.3.1 From f82984fb84e9fed84aa71a50a1bfdfdc356771bd Mon Sep 17 00:00:00 2001 From: Assaf Gordon Date: Mon, 15 Sep 2014 18:58:19 +0000 Subject: [PATCH 06/16] virt-what.in: get effective uid in a portable way $EUID is bash-specific. Use the POSIX-compatible 'id -u' instead. --- virt-what.in | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/virt-what.in b/virt-what.in index 1532b90..3feeb60 100644 --- a/virt-what.in +++ b/virt-what.in @@ -74,8 +74,9 @@ exec_prefix=@exec_prefix@ PATH="${root}@libexecdir@:${root}/sbin:${root}/usr/sbin:${PATH}" # Check we're running as root. +EFFUID=$(id -u) || fail "failed to get current user id" -if [ "x$root" = "x" ] && [ "$EUID" -ne 0 ]; then +if [ "x$root" = "x" ] && [ "$EFFUID" -ne 0 ]; then fail "this script must be run as root" fi -- 1.8.3.1 From e3e88af8847a4269fb275fd054fc36c5066d5d49 Mon Sep 17 00:00:00 2001 From: Assaf Gordon Date: Mon, 15 Sep 2014 19:08:20 +0000 Subject: [PATCH 07/16] virt-what.in: warn about missing cpuid-virt helper program Try to find the binary program on the $PATH, and give informative error message if it wasn't found. --- virt-what.in | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/virt-what.in b/virt-what.in index 3feeb60..5ae1ccb 100644 --- a/virt-what.in +++ b/virt-what.in @@ -80,6 +80,12 @@ if [ "x$root" = "x" ] && [ "$EFFUID" -ne 0 ]; then fail "this script must be run as root" fi +# Try to locate the CPU-ID helper program +CPUID_HELPER=$(which virt-what-cpuid-helper 2>/dev/null) +if [ -z "$CPUID_HELPER" ] ; then + fail "virt-what-cpuid-helper program not found in \$PATH" +fi + # Many fullvirt hypervisors give an indication through CPUID. Use the # helper program to get this information. -- 1.8.3.1 From a68e9c005933a2d8d0f3264bdb68161263cd3933 Mon Sep 17 00:00:00 2001 From: Assaf Gordon Date: Mon, 15 Sep 2014 19:15:19 +0000 Subject: [PATCH 08/16] virt-what.in: verify files exists before grepping them Don't grep linux-specific files (e.g. /proc/cpuinfo) unless they exist. This avoids extraneous errors on BSD/Hurd systems which don't have these files. --- virt-what.in | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/virt-what.in b/virt-what.in index 5ae1ccb..6e9aef1 100644 --- a/virt-what.in +++ b/virt-what.in @@ -33,6 +33,10 @@ skip_qemu_kvm=false VERSION="@VERSION@" +have_cpuinfo() { + test -e "${root}/proc/cpuinfo" +} + fail() { echo "virt-what: $1" >&2 exit 1 @@ -152,7 +156,8 @@ if [ -e "${root}/proc/1/environ" ] && fi # Check for Linux-VServer -if cat "${root}/proc/self/status" | grep -q "VxID: [0-9]*"; then +if test -e "${root}/proc/self/status" \ + && cat "${root}/proc/self/status" | grep -q "VxID: [0-9]*"; then echo linux_vserver if grep -q "VxID: 0$" "${root}/proc/self/status"; then echo linux_vserver-host @@ -163,12 +168,13 @@ fi # Check for UML. # Added by Laurent Léonard. -if grep -q 'UML' "${root}/proc/cpuinfo"; then +if have_cpuinfo && grep -q 'UML' "${root}/proc/cpuinfo"; then echo uml fi # Check for IBM PowerVM Lx86 Linux/x86 emulator. -if grep -q '^vendor_id.*PowerVM Lx86' "${root}/proc/cpuinfo"; then +if have_cpuinfo && grep -q '^vendor_id.*PowerVM Lx86' "${root}/proc/cpuinfo" +then echo powervm_lx86 fi @@ -179,7 +185,7 @@ if echo "$dmi" | grep -q 'Manufacturer.*HITACHI' && fi # Check for IBM SystemZ. -if grep -q '^vendor_id.*IBM/S390' "${root}/proc/cpuinfo"; then +if have_cpuinfo && grep -q '^vendor_id.*IBM/S390' "${root}/proc/cpuinfo"; then echo ibm_systemz if [ -f "${root}/proc/sysinfo" ]; then if grep -q 'VM.*Control Program.*z/VM' "${root}/proc/sysinfo"; then -- 1.8.3.1 From aec669f7b9e4a172c57978597916f8bd97bf26de Mon Sep 17 00:00:00 2001 From: Assaf Gordon Date: Mon, 15 Sep 2014 19:34:06 +0000 Subject: [PATCH 09/16] virt-what.in: make option processing portable Replace linux-specific 'getopt' usage with manual option parsing. Because the used option are version simple (help/version) and the only additional option is undocumented (--test-root), it's easy remove the 'getopt' usage, and make this script portable to BSD systems. --- virt-what.in | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/virt-what.in b/virt-what.in index 6e9aef1..f2c0b90 100644 --- a/virt-what.in +++ b/virt-what.in @@ -51,24 +51,21 @@ usage() { } # Handle the command line arguments, if any. - -TEMP=$(getopt -o v --long help --long version --long test-root: -n 'virt-what' -- "$@") -if [ $? != 0 ]; then exit 1; fi -eval set -- "$TEMP" - -while true; do +while test $# -gt 0; do case "$1" in --help) usage ;; - --test-root) + --test-root=*) # Deliberately undocumented: used for 'make check'. - root="$2" - shift 2 + root=$(echo "$1" | sed 's/.*=//') + shift 1 + test -z "$root" && fail "--test-root option requires a value" ;; -v|--version) echo "$VERSION"; exit 0 ;; --) shift; break ;; - *) fail "internal error ($1)" ;; + *) fail "unrecognized option '$1'";; esac done +test $# -gt 0 && fail "extra operand '$1'" # Add /sbin and /usr/sbin to the path so we can find system # binaries like dmidecode. -- 1.8.3.1 From 243928da395080d7895111d5e5c0f1ff5f9e95fb Mon Sep 17 00:00:00 2001 From: "A. Gordon" Date: Mon, 15 Sep 2014 15:51:50 -0400 Subject: [PATCH 10/16] build: use portable Makefile variables * Makefile.am: use '$?' instead of '$<' $< in a non-inference rule is a GNU-make extension, which fails with BSD make. --- Makefile.am | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index 24d1730..1c14948 100644 --- a/Makefile.am +++ b/Makefile.am @@ -32,9 +32,9 @@ man_MANS = virt-what.1 virt-what.1: virt-what.pod pod2man -c "Virtualization Support" --release "$(PACKAGE)-$(VERSION)" \ - $< > $@ + $? > $@ virt-what.txt: virt-what.pod - pod2text $< > $@ + pod2text $? > $@ endif -- 1.8.3.1 From bdb7404ca6221d6d18e1a4864aa2cd0698164a06 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 16 Sep 2014 19:02:18 +0100 Subject: [PATCH 11/16] Add space before parens in function defns for readability. --- virt-what.in | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/virt-what.in b/virt-what.in index f2c0b90..0770070 100644 --- a/virt-what.in +++ b/virt-what.in @@ -33,16 +33,16 @@ skip_qemu_kvm=false VERSION="@VERSION@" -have_cpuinfo() { +have_cpuinfo () { test -e "${root}/proc/cpuinfo" } -fail() { +fail () { echo "virt-what: $1" >&2 exit 1 } -usage() { +usage () { echo "virt-what [options]" echo "Options:" echo " --help Display this help" -- 1.8.3.1 From 18d21a55c9551b76f0cdb93cd8e7b127173f083b Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Fri, 27 Mar 2015 21:18:59 +0100 Subject: [PATCH 12/16] Add lkvm detection Signed-off-by: Andrew Jones --- Makefile.am | 6 ++++++ tests/lkvm/proc/cpuinfo | 19 +++++++++++++++++ tests/lkvm/proc/self/status | 39 ++++++++++++++++++++++++++++++++++ tests/lkvm/sbin/dmidecode | 2 ++ tests/lkvm/sbin/uname | 2 ++ tests/lkvm/sbin/virt-what-cpuid-helper | 2 ++ tests/test-lkvm.sh | 34 +++++++++++++++++++++++++++++ virt-what.in | 8 +++++++ virt-what.pod | 8 +++++++ 9 files changed, 120 insertions(+) create mode 100644 tests/lkvm/proc/cpuinfo create mode 100644 tests/lkvm/proc/self/status create mode 100755 tests/lkvm/sbin/dmidecode create mode 100755 tests/lkvm/sbin/uname create mode 100755 tests/lkvm/sbin/virt-what-cpuid-helper create mode 100755 tests/test-lkvm.sh diff --git a/Makefile.am b/Makefile.am index 1c14948..46ff548 100644 --- a/Makefile.am +++ b/Makefile.am @@ -46,6 +46,7 @@ TESTS = \ tests/test-kvm.sh \ tests/test-kvm-explicit-cpu.sh \ tests/test-linux-vserver.sh \ + tests/test-lkvm.sh \ tests/test-lxc.sh \ tests/test-lx86.sh \ tests/test-parallels-desktop.sh \ @@ -95,6 +96,11 @@ EXTRA_DIST = \ tests/linux-vserver/sbin/dmidecode \ tests/linux-vserver/sbin/uname \ tests/linux-vserver/sbin/virt-what-cpuid-helper \ + tests/lkvm/proc/cpuinfo \ + tests/lkvm/proc/self/status \ + tests/lkvm/sbin/dmidecode \ + tests/lkvm/sbin/uname \ + tests/lkvm/sbin/virt-what-cpuid-helper \ tests/lxc/proc/1/environ \ tests/lxc/proc/cpuinfo \ tests/lxc/proc/self/status \ diff --git a/tests/lkvm/proc/cpuinfo b/tests/lkvm/proc/cpuinfo new file mode 100644 index 0000000..a53a4b9 --- /dev/null +++ b/tests/lkvm/proc/cpuinfo @@ -0,0 +1,19 @@ +processor : 0 +vendor_id : GenuineIntel +cpu family : 6 +model : 15 +model name : Intel(R) Core(TM)2 Duo CPU T7700 @ 2.40GHz +stepping : 11 +cpu MHz : 2659.998 +cache size : 4096 KB +fpu : yes +fpu_exception : yes +cpuid level : 10 +wp : yes +flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx lm constant_tsc up rep_good pni ssse3 cx16 hypervisor lahf_lm +bogomips : 5319.99 +clflush size : 64 +cache_alignment : 64 +address sizes : 40 bits physical, 48 bits virtual +power management: + diff --git a/tests/lkvm/proc/self/status b/tests/lkvm/proc/self/status new file mode 100644 index 0000000..264981d --- /dev/null +++ b/tests/lkvm/proc/self/status @@ -0,0 +1,39 @@ +Name: cat +State: R (running) +Tgid: 1618 +Pid: 1618 +PPid: 1609 +TracerPid: 0 +Uid: 0 0 0 0 +Gid: 0 0 0 0 +Utrace: 0 +FDSize: 256 +Groups: 0 1 2 3 4 6 10 +VmPeak: 101012 kB +VmSize: 101012 kB +VmLck: 0 kB +VmHWM: 472 kB +VmRSS: 472 kB +VmData: 184 kB +VmStk: 136 kB +VmExe: 44 kB +VmLib: 1728 kB +VmPTE: 44 kB +VmSwap: 0 kB +Threads: 1 +SigQ: 0/7858 +SigPnd: 0000000000000000 +ShdPnd: 0000000000000000 +SigBlk: 0000000000000000 +SigIgn: 0000000000000000 +SigCgt: 0000000000000000 +CapInh: 0000000000000000 +CapPrm: ffffffffffffffff +CapEff: ffffffffffffffff +CapBnd: ffffffffffffffff +Cpus_allowed: 1 +Cpus_allowed_list: 0 +Mems_allowed: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000001 +Mems_allowed_list: 0 +voluntary_ctxt_switches: 0 +nonvoluntary_ctxt_switches: 1 diff --git a/tests/lkvm/sbin/dmidecode b/tests/lkvm/sbin/dmidecode new file mode 100755 index 0000000..e53c12f --- /dev/null +++ b/tests/lkvm/sbin/dmidecode @@ -0,0 +1,2 @@ +#!/bin/sh - +exit 1 diff --git a/tests/lkvm/sbin/uname b/tests/lkvm/sbin/uname new file mode 100755 index 0000000..ab0ec89 --- /dev/null +++ b/tests/lkvm/sbin/uname @@ -0,0 +1,2 @@ +#!/bin/sh - +echo x86_64 diff --git a/tests/lkvm/sbin/virt-what-cpuid-helper b/tests/lkvm/sbin/virt-what-cpuid-helper new file mode 100755 index 0000000..2b068cd --- /dev/null +++ b/tests/lkvm/sbin/virt-what-cpuid-helper @@ -0,0 +1,2 @@ +#!/bin/sh - +echo LKVMLKVMLKVM diff --git a/tests/test-lkvm.sh b/tests/test-lkvm.sh new file mode 100755 index 0000000..6eb326c --- /dev/null +++ b/tests/test-lkvm.sh @@ -0,0 +1,34 @@ +# Test for LKVM +# Copyright (C) 2015 Red Hat Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +root=tests/lkvm + +output="$(./virt-what --test-root=$root 2>&1)" +expected="lkvm" + +if [ "$output" != "$expected" ]; then + echo "$0: test failed because output did not match expected" + echo "Expected output was:" + echo "----------------------------------------" + echo "$expected" + echo "----------------------------------------" + echo "But the actual output of the program was:" + echo "----------------------------------------" + echo "$output" + echo "----------------------------------------" + exit 1 +fi diff --git a/virt-what.in b/virt-what.in index 0770070..ed08dae 100644 --- a/virt-what.in +++ b/virt-what.in @@ -30,6 +30,7 @@ set -u root='' skip_qemu_kvm=false +skip_lkvm=false VERSION="@VERSION@" @@ -215,6 +216,7 @@ elif [ -d "${root}/proc/xen" ]; then echo xen-domU fi skip_qemu_kvm=true + skip_lkvm=true 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 @@ -259,6 +261,12 @@ if ! "$skip_qemu_kvm"; then fi fi +if ! "$skip_lkvm"; then + if [ "$cpuid" = "LKVMLKVMLKVM" ]; then + echo lkvm + fi +fi + # Check for Docker. if [ -f "${root}/.dockerinit" ]; then echo docker diff --git a/virt-what.pod b/virt-what.pod index 8fd9bc4..0e2e8a5 100644 --- a/virt-what.pod +++ b/virt-what.pod @@ -101,6 +101,14 @@ instead. Status: confirmed by RWMJ. +=item B + +This guest is running on the KVM hypervisor using hardware +acceleration, and the userspace component of the hypervisor +is lkvm (a.k.a kvmtool). + +Status: contributed by Andrew Jones + =item B The guest appears to be running inside an OpenVZ or Virtuozzo -- 1.8.3.1 From 87d670b4c8b4e4e0cc314736562a9a6612d555ef Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Fri, 27 Mar 2015 21:19:00 +0100 Subject: [PATCH 13/16] Add ARM support Currently only detects LKVM, QEMU/KVM, and Xen. Also only works if the guest is booted with DT (which is the only way that currently exists). Signed-off-by: Andrew Jones --- Makefile.am | 21 ++++++++ tests/lkvm-arm/proc/cpuinfo | 63 ++++++++++++++++++++++ tests/lkvm-arm/proc/device-tree/compatible | 1 + tests/lkvm-arm/proc/self/status | 41 ++++++++++++++ tests/lkvm-arm/sbin/dmidecode | 2 + tests/lkvm-arm/sbin/uname | 2 + tests/lkvm-arm/sbin/virt-what-cpuid-helper | 2 + tests/qemu-arm/proc/cpuinfo | 63 ++++++++++++++++++++++ .../proc/device-tree/fw-cfg@9020000/compatible | 1 + tests/qemu-arm/proc/self/status | 41 ++++++++++++++ tests/qemu-arm/sbin/dmidecode | 2 + tests/qemu-arm/sbin/uname | 2 + tests/qemu-arm/sbin/virt-what-cpuid-helper | 2 + tests/test-lkvm-arm.sh | 34 ++++++++++++ tests/test-qemu-arm.sh | 34 ++++++++++++ tests/test-xen-arm.sh | 34 ++++++++++++ tests/xen-arm/proc/cpuinfo | 63 ++++++++++++++++++++++ .../xen-arm/proc/device-tree/hypervisor/compatible | 1 + tests/xen-arm/proc/self/status | 41 ++++++++++++++ tests/xen-arm/sbin/dmidecode | 2 + tests/xen-arm/sbin/uname | 2 + tests/xen-arm/sbin/virt-what-cpuid-helper | 2 + virt-what.in | 22 +++++++- 23 files changed, 477 insertions(+), 1 deletion(-) create mode 100644 tests/lkvm-arm/proc/cpuinfo create mode 100644 tests/lkvm-arm/proc/device-tree/compatible create mode 100644 tests/lkvm-arm/proc/self/status create mode 100755 tests/lkvm-arm/sbin/dmidecode create mode 100755 tests/lkvm-arm/sbin/uname create mode 100755 tests/lkvm-arm/sbin/virt-what-cpuid-helper create mode 100644 tests/qemu-arm/proc/cpuinfo create mode 100644 tests/qemu-arm/proc/device-tree/fw-cfg@9020000/compatible create mode 100644 tests/qemu-arm/proc/self/status create mode 100755 tests/qemu-arm/sbin/dmidecode create mode 100755 tests/qemu-arm/sbin/uname create mode 100755 tests/qemu-arm/sbin/virt-what-cpuid-helper create mode 100755 tests/test-lkvm-arm.sh create mode 100755 tests/test-qemu-arm.sh create mode 100755 tests/test-xen-arm.sh create mode 100644 tests/xen-arm/proc/cpuinfo create mode 100644 tests/xen-arm/proc/device-tree/hypervisor/compatible create mode 100644 tests/xen-arm/proc/self/status create mode 100755 tests/xen-arm/sbin/dmidecode create mode 100755 tests/xen-arm/sbin/uname create mode 100755 tests/xen-arm/sbin/virt-what-cpuid-helper diff --git a/Makefile.am b/Makefile.am index 46ff548..514d229 100644 --- a/Makefile.am +++ b/Makefile.am @@ -47,14 +47,17 @@ TESTS = \ tests/test-kvm-explicit-cpu.sh \ tests/test-linux-vserver.sh \ tests/test-lkvm.sh \ + tests/test-lkvm-arm.sh \ tests/test-lxc.sh \ tests/test-lx86.sh \ tests/test-parallels-desktop.sh \ tests/test-qemu.sh \ + tests/test-qemu-arm.sh \ tests/test-rhel5-xen-dom0.sh \ tests/test-rhel5-xen-domU-hvm.sh \ tests/test-rhel5-xen-domU-hvm-ia64.sh \ tests/test-rhel5-xen-domU-pv.sh \ + tests/test-xen-arm.sh \ tests/test-zvm.sh EXTRA_DIST = \ @@ -101,6 +104,12 @@ EXTRA_DIST = \ tests/lkvm/sbin/dmidecode \ tests/lkvm/sbin/uname \ tests/lkvm/sbin/virt-what-cpuid-helper \ + tests/lkvm-arm/proc/cpuinfo \ + tests/lkvm-arm/proc/device-tree/compatible \ + tests/lkvm-arm/proc/self/status \ + tests/lkvm-arm/sbin/dmidecode \ + tests/lkvm-arm/sbin/uname \ + tests/lkvm-arm/sbin/virt-what-cpuid-helper \ tests/lxc/proc/1/environ \ tests/lxc/proc/cpuinfo \ tests/lxc/proc/self/status \ @@ -122,6 +131,12 @@ EXTRA_DIST = \ tests/qemu/sbin/dmidecode \ tests/qemu/sbin/uname \ tests/qemu/sbin/virt-what-cpuid-helper \ + tests/qemu-arm/proc/cpuinfo \ + tests/qemu-arm/proc/device-tree/fw-cfg@9020000/compatible \ + tests/qemu-arm/proc/self/status \ + tests/qemu-arm/sbin/dmidecode \ + tests/qemu-arm/sbin/uname \ + tests/qemu-arm/sbin/virt-what-cpuid-helper \ tests/rhel5-xen-dom0/proc/cpuinfo \ tests/rhel5-xen-dom0/proc/self/status \ tests/rhel5-xen-dom0/proc/xen/balloon \ @@ -185,6 +200,12 @@ EXTRA_DIST = \ tests/rhel5-xen-domU-pv/sys/hypervisor/compilation/compiled_by \ tests/rhel5-xen-domU-pv/sys/hypervisor/compilation/compile_date \ tests/rhel5-xen-domU-pv/sys/hypervisor/uuid \ + tests/xen-arm/proc/cpuinfo \ + tests/xen-arm/proc/device-tree/compatible \ + tests/xen-arm/proc/self/status \ + tests/xen-arm/sbin/dmidecode \ + tests/xen-arm/sbin/uname \ + tests/xen-arm/sbin/virt-what-cpuid-helper \ tests/zvm/proc/cpuinfo \ tests/zvm/proc/self/status \ tests/zvm/proc/sysinfo \ diff --git a/tests/lkvm-arm/proc/cpuinfo b/tests/lkvm-arm/proc/cpuinfo new file mode 100644 index 0000000..b83a182 --- /dev/null +++ b/tests/lkvm-arm/proc/cpuinfo @@ -0,0 +1,63 @@ +processor : 0 +Features : fp asimd evtstrm +CPU implementer : 0x50 +CPU architecture: 8 +CPU variant : 0x0 +CPU part : 0x000 +CPU revision : 0 + +processor : 1 +Features : fp asimd evtstrm +CPU implementer : 0x50 +CPU architecture: 8 +CPU variant : 0x0 +CPU part : 0x000 +CPU revision : 0 + +processor : 2 +Features : fp asimd evtstrm +CPU implementer : 0x50 +CPU architecture: 8 +CPU variant : 0x0 +CPU part : 0x000 +CPU revision : 0 + +processor : 3 +Features : fp asimd evtstrm +CPU implementer : 0x50 +CPU architecture: 8 +CPU variant : 0x0 +CPU part : 0x000 +CPU revision : 0 + +processor : 4 +Features : fp asimd evtstrm +CPU implementer : 0x50 +CPU architecture: 8 +CPU variant : 0x0 +CPU part : 0x000 +CPU revision : 0 + +processor : 5 +Features : fp asimd evtstrm +CPU implementer : 0x50 +CPU architecture: 8 +CPU variant : 0x0 +CPU part : 0x000 +CPU revision : 0 + +processor : 6 +Features : fp asimd evtstrm +CPU implementer : 0x50 +CPU architecture: 8 +CPU variant : 0x0 +CPU part : 0x000 +CPU revision : 0 + +processor : 7 +Features : fp asimd evtstrm +CPU implementer : 0x50 +CPU architecture: 8 +CPU variant : 0x0 +CPU part : 0x000 +CPU revision : 0 diff --git a/tests/lkvm-arm/proc/device-tree/compatible b/tests/lkvm-arm/proc/device-tree/compatible new file mode 100644 index 0000000..99642ed --- /dev/null +++ b/tests/lkvm-arm/proc/device-tree/compatible @@ -0,0 +1 @@ +linux,dummy-virt diff --git a/tests/lkvm-arm/proc/self/status b/tests/lkvm-arm/proc/self/status new file mode 100644 index 0000000..751f5e7 --- /dev/null +++ b/tests/lkvm-arm/proc/self/status @@ -0,0 +1,41 @@ +Name: cat +State: R (running) +Tgid: 8307 +Ngid: 0 +Pid: 8307 +PPid: 1415 +TracerPid: 0 +Uid: 0 0 0 0 +Gid: 0 0 0 0 +FDSize: 256 +Groups: +VmPeak: 109696 kB +VmSize: 109696 kB +VmLck: 0 kB +VmPin: 0 kB +VmHWM: 832 kB +VmRSS: 832 kB +VmData: 320 kB +VmStk: 256 kB +VmExe: 64 kB +VmLib: 1536 kB +VmPTE: 192 kB +VmSwap: 0 kB +Threads: 1 +SigQ: 0/5821 +SigPnd: 0000000000000000 +ShdPnd: 0000000000000000 +SigBlk: 0000000000000000 +SigIgn: 0000000000000000 +SigCgt: 0000000000000000 +CapInh: 0000000000000000 +CapPrm: 0000003fffffffff +CapEff: 0000003fffffffff +CapBnd: 0000003fffffffff +Seccomp: 0 +Cpus_allowed: ff +Cpus_allowed_list: 0-7 +Mems_allowed: 1 +Mems_allowed_list: 0 +voluntary_ctxt_switches: 1 +nonvoluntary_ctxt_switches: 1 diff --git a/tests/lkvm-arm/sbin/dmidecode b/tests/lkvm-arm/sbin/dmidecode new file mode 100755 index 0000000..e53c12f --- /dev/null +++ b/tests/lkvm-arm/sbin/dmidecode @@ -0,0 +1,2 @@ +#!/bin/sh - +exit 1 diff --git a/tests/lkvm-arm/sbin/uname b/tests/lkvm-arm/sbin/uname new file mode 100755 index 0000000..bd33a2d --- /dev/null +++ b/tests/lkvm-arm/sbin/uname @@ -0,0 +1,2 @@ +#!/bin/sh - +echo aarch64 diff --git a/tests/lkvm-arm/sbin/virt-what-cpuid-helper b/tests/lkvm-arm/sbin/virt-what-cpuid-helper new file mode 100755 index 0000000..77a6692 --- /dev/null +++ b/tests/lkvm-arm/sbin/virt-what-cpuid-helper @@ -0,0 +1,2 @@ +#!/bin/sh - +# nothing diff --git a/tests/qemu-arm/proc/cpuinfo b/tests/qemu-arm/proc/cpuinfo new file mode 100644 index 0000000..b83a182 --- /dev/null +++ b/tests/qemu-arm/proc/cpuinfo @@ -0,0 +1,63 @@ +processor : 0 +Features : fp asimd evtstrm +CPU implementer : 0x50 +CPU architecture: 8 +CPU variant : 0x0 +CPU part : 0x000 +CPU revision : 0 + +processor : 1 +Features : fp asimd evtstrm +CPU implementer : 0x50 +CPU architecture: 8 +CPU variant : 0x0 +CPU part : 0x000 +CPU revision : 0 + +processor : 2 +Features : fp asimd evtstrm +CPU implementer : 0x50 +CPU architecture: 8 +CPU variant : 0x0 +CPU part : 0x000 +CPU revision : 0 + +processor : 3 +Features : fp asimd evtstrm +CPU implementer : 0x50 +CPU architecture: 8 +CPU variant : 0x0 +CPU part : 0x000 +CPU revision : 0 + +processor : 4 +Features : fp asimd evtstrm +CPU implementer : 0x50 +CPU architecture: 8 +CPU variant : 0x0 +CPU part : 0x000 +CPU revision : 0 + +processor : 5 +Features : fp asimd evtstrm +CPU implementer : 0x50 +CPU architecture: 8 +CPU variant : 0x0 +CPU part : 0x000 +CPU revision : 0 + +processor : 6 +Features : fp asimd evtstrm +CPU implementer : 0x50 +CPU architecture: 8 +CPU variant : 0x0 +CPU part : 0x000 +CPU revision : 0 + +processor : 7 +Features : fp asimd evtstrm +CPU implementer : 0x50 +CPU architecture: 8 +CPU variant : 0x0 +CPU part : 0x000 +CPU revision : 0 diff --git a/tests/qemu-arm/proc/device-tree/fw-cfg@9020000/compatible b/tests/qemu-arm/proc/device-tree/fw-cfg@9020000/compatible new file mode 100644 index 0000000..3932ade --- /dev/null +++ b/tests/qemu-arm/proc/device-tree/fw-cfg@9020000/compatible @@ -0,0 +1 @@ +qemu,fw-cfg-mmio diff --git a/tests/qemu-arm/proc/self/status b/tests/qemu-arm/proc/self/status new file mode 100644 index 0000000..751f5e7 --- /dev/null +++ b/tests/qemu-arm/proc/self/status @@ -0,0 +1,41 @@ +Name: cat +State: R (running) +Tgid: 8307 +Ngid: 0 +Pid: 8307 +PPid: 1415 +TracerPid: 0 +Uid: 0 0 0 0 +Gid: 0 0 0 0 +FDSize: 256 +Groups: +VmPeak: 109696 kB +VmSize: 109696 kB +VmLck: 0 kB +VmPin: 0 kB +VmHWM: 832 kB +VmRSS: 832 kB +VmData: 320 kB +VmStk: 256 kB +VmExe: 64 kB +VmLib: 1536 kB +VmPTE: 192 kB +VmSwap: 0 kB +Threads: 1 +SigQ: 0/5821 +SigPnd: 0000000000000000 +ShdPnd: 0000000000000000 +SigBlk: 0000000000000000 +SigIgn: 0000000000000000 +SigCgt: 0000000000000000 +CapInh: 0000000000000000 +CapPrm: 0000003fffffffff +CapEff: 0000003fffffffff +CapBnd: 0000003fffffffff +Seccomp: 0 +Cpus_allowed: ff +Cpus_allowed_list: 0-7 +Mems_allowed: 1 +Mems_allowed_list: 0 +voluntary_ctxt_switches: 1 +nonvoluntary_ctxt_switches: 1 diff --git a/tests/qemu-arm/sbin/dmidecode b/tests/qemu-arm/sbin/dmidecode new file mode 100755 index 0000000..e53c12f --- /dev/null +++ b/tests/qemu-arm/sbin/dmidecode @@ -0,0 +1,2 @@ +#!/bin/sh - +exit 1 diff --git a/tests/qemu-arm/sbin/uname b/tests/qemu-arm/sbin/uname new file mode 100755 index 0000000..bd33a2d --- /dev/null +++ b/tests/qemu-arm/sbin/uname @@ -0,0 +1,2 @@ +#!/bin/sh - +echo aarch64 diff --git a/tests/qemu-arm/sbin/virt-what-cpuid-helper b/tests/qemu-arm/sbin/virt-what-cpuid-helper new file mode 100755 index 0000000..77a6692 --- /dev/null +++ b/tests/qemu-arm/sbin/virt-what-cpuid-helper @@ -0,0 +1,2 @@ +#!/bin/sh - +# nothing diff --git a/tests/test-lkvm-arm.sh b/tests/test-lkvm-arm.sh new file mode 100755 index 0000000..bed50ad --- /dev/null +++ b/tests/test-lkvm-arm.sh @@ -0,0 +1,34 @@ +# Test for LKVM on ARM +# Copyright (C) 2015 Red Hat Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +root=tests/lkvm-arm + +output="$(./virt-what --test-root=$root 2>&1)" +expected="lkvm" + +if [ "$output" != "$expected" ]; then + echo "$0: test failed because output did not match expected" + echo "Expected output was:" + echo "----------------------------------------" + echo "$expected" + echo "----------------------------------------" + echo "But the actual output of the program was:" + echo "----------------------------------------" + echo "$output" + echo "----------------------------------------" + exit 1 +fi diff --git a/tests/test-qemu-arm.sh b/tests/test-qemu-arm.sh new file mode 100755 index 0000000..58455c8 --- /dev/null +++ b/tests/test-qemu-arm.sh @@ -0,0 +1,34 @@ +# Test for qemu on ARM +# Copyright (C) 2015 Red Hat Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +root=tests/qemu-arm + +output="$(./virt-what --test-root=$root 2>&1)" +expected="qemu" + +if [ "$output" != "$expected" ]; then + echo "$0: test failed because output did not match expected" + echo "Expected output was:" + echo "----------------------------------------" + echo "$expected" + echo "----------------------------------------" + echo "But the actual output of the program was:" + echo "----------------------------------------" + echo "$output" + echo "----------------------------------------" + exit 1 +fi diff --git a/tests/test-xen-arm.sh b/tests/test-xen-arm.sh new file mode 100755 index 0000000..209712e --- /dev/null +++ b/tests/test-xen-arm.sh @@ -0,0 +1,34 @@ +# Test for Xen on ARM +# Copyright (C) 2015 Red Hat Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +root=tests/xen-arm + +output="$(./virt-what --test-root=$root 2>&1)" +expected="xen" + +if [ "$output" != "$expected" ]; then + echo "$0: test failed because output did not match expected" + echo "Expected output was:" + echo "----------------------------------------" + echo "$expected" + echo "----------------------------------------" + echo "But the actual output of the program was:" + echo "----------------------------------------" + echo "$output" + echo "----------------------------------------" + exit 1 +fi diff --git a/tests/xen-arm/proc/cpuinfo b/tests/xen-arm/proc/cpuinfo new file mode 100644 index 0000000..b83a182 --- /dev/null +++ b/tests/xen-arm/proc/cpuinfo @@ -0,0 +1,63 @@ +processor : 0 +Features : fp asimd evtstrm +CPU implementer : 0x50 +CPU architecture: 8 +CPU variant : 0x0 +CPU part : 0x000 +CPU revision : 0 + +processor : 1 +Features : fp asimd evtstrm +CPU implementer : 0x50 +CPU architecture: 8 +CPU variant : 0x0 +CPU part : 0x000 +CPU revision : 0 + +processor : 2 +Features : fp asimd evtstrm +CPU implementer : 0x50 +CPU architecture: 8 +CPU variant : 0x0 +CPU part : 0x000 +CPU revision : 0 + +processor : 3 +Features : fp asimd evtstrm +CPU implementer : 0x50 +CPU architecture: 8 +CPU variant : 0x0 +CPU part : 0x000 +CPU revision : 0 + +processor : 4 +Features : fp asimd evtstrm +CPU implementer : 0x50 +CPU architecture: 8 +CPU variant : 0x0 +CPU part : 0x000 +CPU revision : 0 + +processor : 5 +Features : fp asimd evtstrm +CPU implementer : 0x50 +CPU architecture: 8 +CPU variant : 0x0 +CPU part : 0x000 +CPU revision : 0 + +processor : 6 +Features : fp asimd evtstrm +CPU implementer : 0x50 +CPU architecture: 8 +CPU variant : 0x0 +CPU part : 0x000 +CPU revision : 0 + +processor : 7 +Features : fp asimd evtstrm +CPU implementer : 0x50 +CPU architecture: 8 +CPU variant : 0x0 +CPU part : 0x000 +CPU revision : 0 diff --git a/tests/xen-arm/proc/device-tree/hypervisor/compatible b/tests/xen-arm/proc/device-tree/hypervisor/compatible new file mode 100644 index 0000000..070f5e2 --- /dev/null +++ b/tests/xen-arm/proc/device-tree/hypervisor/compatible @@ -0,0 +1 @@ +xen,xen diff --git a/tests/xen-arm/proc/self/status b/tests/xen-arm/proc/self/status new file mode 100644 index 0000000..751f5e7 --- /dev/null +++ b/tests/xen-arm/proc/self/status @@ -0,0 +1,41 @@ +Name: cat +State: R (running) +Tgid: 8307 +Ngid: 0 +Pid: 8307 +PPid: 1415 +TracerPid: 0 +Uid: 0 0 0 0 +Gid: 0 0 0 0 +FDSize: 256 +Groups: +VmPeak: 109696 kB +VmSize: 109696 kB +VmLck: 0 kB +VmPin: 0 kB +VmHWM: 832 kB +VmRSS: 832 kB +VmData: 320 kB +VmStk: 256 kB +VmExe: 64 kB +VmLib: 1536 kB +VmPTE: 192 kB +VmSwap: 0 kB +Threads: 1 +SigQ: 0/5821 +SigPnd: 0000000000000000 +ShdPnd: 0000000000000000 +SigBlk: 0000000000000000 +SigIgn: 0000000000000000 +SigCgt: 0000000000000000 +CapInh: 0000000000000000 +CapPrm: 0000003fffffffff +CapEff: 0000003fffffffff +CapBnd: 0000003fffffffff +Seccomp: 0 +Cpus_allowed: ff +Cpus_allowed_list: 0-7 +Mems_allowed: 1 +Mems_allowed_list: 0 +voluntary_ctxt_switches: 1 +nonvoluntary_ctxt_switches: 1 diff --git a/tests/xen-arm/sbin/dmidecode b/tests/xen-arm/sbin/dmidecode new file mode 100755 index 0000000..e53c12f --- /dev/null +++ b/tests/xen-arm/sbin/dmidecode @@ -0,0 +1,2 @@ +#!/bin/sh - +exit 1 diff --git a/tests/xen-arm/sbin/uname b/tests/xen-arm/sbin/uname new file mode 100755 index 0000000..bd33a2d --- /dev/null +++ b/tests/xen-arm/sbin/uname @@ -0,0 +1,2 @@ +#!/bin/sh - +echo aarch64 diff --git a/tests/xen-arm/sbin/virt-what-cpuid-helper b/tests/xen-arm/sbin/virt-what-cpuid-helper new file mode 100755 index 0000000..77a6692 --- /dev/null +++ b/tests/xen-arm/sbin/virt-what-cpuid-helper @@ -0,0 +1,2 @@ +#!/bin/sh - +# nothing diff --git a/virt-what.in b/virt-what.in index ed08dae..a5ed33e 100644 --- a/virt-what.in +++ b/virt-what.in @@ -103,7 +103,7 @@ dmi=$(LANG=C dmidecode 2>&1) # Architecture. # Note for the purpose of testing, we only call uname with -p option. -arch=$(uname -p) +arch=$(uname -p | sed -e 's/i.86/i386/' | sed -e 's/arm.*/arm/') # Check for VMware. # cpuid check added by Chetan Loke. @@ -223,6 +223,13 @@ elif [ -f "${root}/sys/hypervisor/type" ] && # enough information at present to tell whether this is dom0 # or domU. XXX echo xen +elif [ "$arch" = "arm" ] || [ "$arch" = "aarch64" ]; then + if [ -d "${root}/proc/device-tree/hypervisor" ] && + grep -q "xen" "${root}/proc/device-tree/hypervisor/compatible"; then + echo xen + skip_qemu_kvm=true + skip_lkvm=true + fi elif [ "$arch" = "ia64" ]; then if [ -d "${root}/sys/bus/xen" -a ! -d "${root}/sys/bus/xen-backend" ]; then # PV-on-HVM drivers installed in a Xen guest. @@ -250,6 +257,14 @@ fi if ! "$skip_qemu_kvm"; then if [ "$cpuid" = "KVMKVMKVM" ]; then echo kvm + elif [ "$arch" = "arm" ] || [ "$arch" = "aarch64" ]; then + if [ -d "${root}/proc/device-tree" ] && + ls "${root}/proc/device-tree" | grep -q "fw-cfg"; then + # We don't have enough information to determine if we're + # using KVM acceleration or not. + echo qemu + skip_lkvm=true + fi else # XXX This is known to fail for qemu with the explicit -cpu # option, since /proc/cpuinfo will not contain the QEMU @@ -264,6 +279,11 @@ fi if ! "$skip_lkvm"; then if [ "$cpuid" = "LKVMLKVMLKVM" ]; then echo lkvm + elif [ "$arch" = "arm" ] || [ "$arch" = "aarch64" ]; then + if [ -d "${root}/proc/device-tree" ] && + grep -q "dummy-virt" "${root}/proc/device-tree/compatible"; then + echo lkvm + fi fi fi -- 1.8.3.1 From 5c4bdcf6abe012dbc4965e5bede00c8a9d31a8f6 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 21 Apr 2015 12:12:45 +0100 Subject: [PATCH 14/16] xen-arm: Fix path in EXTRA_DIST. --- Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 514d229..8a47e96 100644 --- a/Makefile.am +++ b/Makefile.am @@ -201,7 +201,7 @@ EXTRA_DIST = \ tests/rhel5-xen-domU-pv/sys/hypervisor/compilation/compile_date \ tests/rhel5-xen-domU-pv/sys/hypervisor/uuid \ tests/xen-arm/proc/cpuinfo \ - tests/xen-arm/proc/device-tree/compatible \ + tests/xen-arm/proc/device-tree/hypervisor/compatible \ tests/xen-arm/proc/self/status \ tests/xen-arm/sbin/dmidecode \ tests/xen-arm/sbin/uname \ -- 1.8.3.1 From 2afd403fe88e4896ca34898394c9b30e6137e938 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 21 Apr 2015 12:10:44 +0100 Subject: [PATCH 15/16] Version 1.15 --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index da2ebb3..faa8635 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ # virt-what -# Copyright (C) 2008-2011 Red Hat Inc. +# Copyright (C) 2008-2015 Red Hat Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -15,7 +15,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -AC_INIT([virt-what],[1.14]) +AC_INIT([virt-what],[1.15]) AM_INIT_AUTOMAKE([foreign]) dnl Check for basic C environment. -- 1.8.3.1 From 8dd2e213404ff4cc9c6d74e4afb534e25be78a11 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Mon, 3 Aug 2015 12:23:05 +0100 Subject: [PATCH 16/16] Update copyright years. --- virt-what.in | 2 +- virt-what.pod | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/virt-what.in b/virt-what.in index a5ed33e..6daba34 100644 --- a/virt-what.in +++ b/virt-what.in @@ -1,6 +1,6 @@ #!/bin/sh - # @configure_input@ -# Copyright (C) 2008-2011 Red Hat Inc. +# Copyright (C) 2008-2015 Red Hat Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/virt-what.pod b/virt-what.pod index 0e2e8a5..d936e4a 100644 --- a/virt-what.pod +++ b/virt-what.pod @@ -286,7 +286,7 @@ Richard W.M. Jones =head1 COPYRIGHT -(C) Copyright 2008-2011 Red Hat Inc., +(C) Copyright 2008-2015 Red Hat Inc., L This program is free software; you can redistribute it and/or modify -- 1.8.3.1