[virt-tools-list] [virt-what PATCH 2/2] Add ARM support

Andrew Jones drjones at redhat.com
Fri Mar 27 20:19:00 UTC 2015


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 <drjones at redhat.com>
---
 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 at 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 at 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 46ff54879bbbd..514d22974a2b2 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 at 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 0000000000000..b83a18202aa5c
--- /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 0000000000000..99642ed71e87c
--- /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 0000000000000..751f5e7b4d05a
--- /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 0000000000000..e53c12f12b127
--- /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 0000000000000..bd33a2d736c7a
--- /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 0000000000000..77a6692359cd5
--- /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 0000000000000..b83a18202aa5c
--- /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 at 9020000/compatible b/tests/qemu-arm/proc/device-tree/fw-cfg at 9020000/compatible
new file mode 100644
index 0000000000000..3932ade9f6cb3
--- /dev/null
+++ b/tests/qemu-arm/proc/device-tree/fw-cfg at 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 0000000000000..751f5e7b4d05a
--- /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 0000000000000..e53c12f12b127
--- /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 0000000000000..bd33a2d736c7a
--- /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 0000000000000..77a6692359cd5
--- /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 0000000000000..bed50ad0f9236
--- /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 0000000000000..58455c8b116ae
--- /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 0000000000000..209712e6a9d2b
--- /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 0000000000000..b83a18202aa5c
--- /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 0000000000000..070f5e246771d
--- /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 0000000000000..751f5e7b4d05a
--- /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 0000000000000..e53c12f12b127
--- /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 0000000000000..bd33a2d736c7a
--- /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 0000000000000..77a6692359cd5
--- /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 ed08daefa291a..a5ed33ef3e4bf 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.9.3




More information about the virt-tools-list mailing list