Blame SOURCES/0016-Add-ARM-support.patch

f83e65
From b87a2d79ce8c5eee3a2f945b8eb00d893104fd10 Mon Sep 17 00:00:00 2001
b6cf65
From: Andrew Jones <drjones@redhat.com>
b6cf65
Date: Fri, 27 Mar 2015 21:19:00 +0100
201bb7
Subject: [PATCH 16/27] Add ARM support
b6cf65
b6cf65
Currently only detects LKVM, QEMU/KVM, and Xen. Also only works if
b6cf65
the guest is booted with DT (which is the only way that currently
b6cf65
exists).
b6cf65
b6cf65
Signed-off-by: Andrew Jones <drjones@redhat.com>
b6cf65
---
b6cf65
 Makefile.am                                        | 21 ++++++++
b6cf65
 tests/lkvm-arm/proc/cpuinfo                        | 63 ++++++++++++++++++++++
b6cf65
 tests/lkvm-arm/proc/device-tree/compatible         |  1 +
b6cf65
 tests/lkvm-arm/proc/self/status                    | 41 ++++++++++++++
b6cf65
 tests/lkvm-arm/sbin/dmidecode                      |  2 +
b6cf65
 tests/lkvm-arm/sbin/uname                          |  2 +
b6cf65
 tests/lkvm-arm/sbin/virt-what-cpuid-helper         |  2 +
b6cf65
 tests/qemu-arm/proc/cpuinfo                        | 63 ++++++++++++++++++++++
b6cf65
 .../proc/device-tree/fw-cfg@9020000/compatible     |  1 +
b6cf65
 tests/qemu-arm/proc/self/status                    | 41 ++++++++++++++
b6cf65
 tests/qemu-arm/sbin/dmidecode                      |  2 +
b6cf65
 tests/qemu-arm/sbin/uname                          |  2 +
b6cf65
 tests/qemu-arm/sbin/virt-what-cpuid-helper         |  2 +
b6cf65
 tests/test-lkvm-arm.sh                             | 34 ++++++++++++
b6cf65
 tests/test-qemu-arm.sh                             | 34 ++++++++++++
b6cf65
 tests/test-xen-arm.sh                              | 34 ++++++++++++
b6cf65
 tests/xen-arm/proc/cpuinfo                         | 63 ++++++++++++++++++++++
b6cf65
 .../xen-arm/proc/device-tree/hypervisor/compatible |  1 +
b6cf65
 tests/xen-arm/proc/self/status                     | 41 ++++++++++++++
b6cf65
 tests/xen-arm/sbin/dmidecode                       |  2 +
b6cf65
 tests/xen-arm/sbin/uname                           |  2 +
b6cf65
 tests/xen-arm/sbin/virt-what-cpuid-helper          |  2 +
b6cf65
 virt-what.in                                       | 22 +++++++-
b6cf65
 23 files changed, 477 insertions(+), 1 deletion(-)
b6cf65
 create mode 100644 tests/lkvm-arm/proc/cpuinfo
b6cf65
 create mode 100644 tests/lkvm-arm/proc/device-tree/compatible
b6cf65
 create mode 100644 tests/lkvm-arm/proc/self/status
b6cf65
 create mode 100755 tests/lkvm-arm/sbin/dmidecode
b6cf65
 create mode 100755 tests/lkvm-arm/sbin/uname
b6cf65
 create mode 100755 tests/lkvm-arm/sbin/virt-what-cpuid-helper
b6cf65
 create mode 100644 tests/qemu-arm/proc/cpuinfo
b6cf65
 create mode 100644 tests/qemu-arm/proc/device-tree/fw-cfg@9020000/compatible
b6cf65
 create mode 100644 tests/qemu-arm/proc/self/status
b6cf65
 create mode 100755 tests/qemu-arm/sbin/dmidecode
b6cf65
 create mode 100755 tests/qemu-arm/sbin/uname
b6cf65
 create mode 100755 tests/qemu-arm/sbin/virt-what-cpuid-helper
b6cf65
 create mode 100755 tests/test-lkvm-arm.sh
b6cf65
 create mode 100755 tests/test-qemu-arm.sh
b6cf65
 create mode 100755 tests/test-xen-arm.sh
b6cf65
 create mode 100644 tests/xen-arm/proc/cpuinfo
b6cf65
 create mode 100644 tests/xen-arm/proc/device-tree/hypervisor/compatible
b6cf65
 create mode 100644 tests/xen-arm/proc/self/status
b6cf65
 create mode 100755 tests/xen-arm/sbin/dmidecode
b6cf65
 create mode 100755 tests/xen-arm/sbin/uname
b6cf65
 create mode 100755 tests/xen-arm/sbin/virt-what-cpuid-helper
b6cf65
b6cf65
diff --git a/Makefile.am b/Makefile.am
b6cf65
index 46ff548..514d229 100644
b6cf65
--- a/Makefile.am
b6cf65
+++ b/Makefile.am
b6cf65
@@ -47,14 +47,17 @@ TESTS = \
b6cf65
 	tests/test-kvm-explicit-cpu.sh \
b6cf65
 	tests/test-linux-vserver.sh \
b6cf65
 	tests/test-lkvm.sh \
b6cf65
+	tests/test-lkvm-arm.sh \
b6cf65
 	tests/test-lxc.sh \
b6cf65
 	tests/test-lx86.sh \
b6cf65
 	tests/test-parallels-desktop.sh \
b6cf65
 	tests/test-qemu.sh \
b6cf65
+	tests/test-qemu-arm.sh \
b6cf65
 	tests/test-rhel5-xen-dom0.sh \
b6cf65
 	tests/test-rhel5-xen-domU-hvm.sh \
b6cf65
 	tests/test-rhel5-xen-domU-hvm-ia64.sh \
b6cf65
 	tests/test-rhel5-xen-domU-pv.sh \
b6cf65
+	tests/test-xen-arm.sh \
b6cf65
 	tests/test-zvm.sh
b6cf65
 
b6cf65
 EXTRA_DIST = \
b6cf65
@@ -101,6 +104,12 @@ EXTRA_DIST = \
b6cf65
 	tests/lkvm/sbin/dmidecode \
b6cf65
 	tests/lkvm/sbin/uname \
b6cf65
 	tests/lkvm/sbin/virt-what-cpuid-helper \
b6cf65
+	tests/lkvm-arm/proc/cpuinfo \
b6cf65
+	tests/lkvm-arm/proc/device-tree/compatible \
b6cf65
+	tests/lkvm-arm/proc/self/status \
b6cf65
+	tests/lkvm-arm/sbin/dmidecode \
b6cf65
+	tests/lkvm-arm/sbin/uname \
b6cf65
+	tests/lkvm-arm/sbin/virt-what-cpuid-helper \
b6cf65
 	tests/lxc/proc/1/environ \
b6cf65
 	tests/lxc/proc/cpuinfo \
b6cf65
 	tests/lxc/proc/self/status \
b6cf65
@@ -122,6 +131,12 @@ EXTRA_DIST = \
b6cf65
 	tests/qemu/sbin/dmidecode \
b6cf65
 	tests/qemu/sbin/uname \
b6cf65
 	tests/qemu/sbin/virt-what-cpuid-helper \
b6cf65
+	tests/qemu-arm/proc/cpuinfo \
b6cf65
+	tests/qemu-arm/proc/device-tree/fw-cfg@9020000/compatible \
b6cf65
+	tests/qemu-arm/proc/self/status \
b6cf65
+	tests/qemu-arm/sbin/dmidecode \
b6cf65
+	tests/qemu-arm/sbin/uname \
b6cf65
+	tests/qemu-arm/sbin/virt-what-cpuid-helper \
b6cf65
 	tests/rhel5-xen-dom0/proc/cpuinfo \
b6cf65
 	tests/rhel5-xen-dom0/proc/self/status \
b6cf65
 	tests/rhel5-xen-dom0/proc/xen/balloon \
b6cf65
@@ -185,6 +200,12 @@ EXTRA_DIST = \
b6cf65
 	tests/rhel5-xen-domU-pv/sys/hypervisor/compilation/compiled_by \
b6cf65
 	tests/rhel5-xen-domU-pv/sys/hypervisor/compilation/compile_date \
b6cf65
 	tests/rhel5-xen-domU-pv/sys/hypervisor/uuid \
b6cf65
+	tests/xen-arm/proc/cpuinfo \
b6cf65
+	tests/xen-arm/proc/device-tree/compatible \
b6cf65
+	tests/xen-arm/proc/self/status \
b6cf65
+	tests/xen-arm/sbin/dmidecode \
b6cf65
+	tests/xen-arm/sbin/uname \
b6cf65
+	tests/xen-arm/sbin/virt-what-cpuid-helper \
b6cf65
 	tests/zvm/proc/cpuinfo \
b6cf65
 	tests/zvm/proc/self/status \
b6cf65
 	tests/zvm/proc/sysinfo \
b6cf65
diff --git a/tests/lkvm-arm/proc/cpuinfo b/tests/lkvm-arm/proc/cpuinfo
b6cf65
new file mode 100644
b6cf65
index 0000000..b83a182
b6cf65
--- /dev/null
b6cf65
+++ b/tests/lkvm-arm/proc/cpuinfo
b6cf65
@@ -0,0 +1,63 @@
b6cf65
+processor	: 0
b6cf65
+Features	: fp asimd evtstrm
b6cf65
+CPU implementer	: 0x50
b6cf65
+CPU architecture: 8
b6cf65
+CPU variant	: 0x0
b6cf65
+CPU part	: 0x000
b6cf65
+CPU revision	: 0
b6cf65
+
b6cf65
+processor	: 1
b6cf65
+Features	: fp asimd evtstrm
b6cf65
+CPU implementer	: 0x50
b6cf65
+CPU architecture: 8
b6cf65
+CPU variant	: 0x0
b6cf65
+CPU part	: 0x000
b6cf65
+CPU revision	: 0
b6cf65
+
b6cf65
+processor	: 2
b6cf65
+Features	: fp asimd evtstrm
b6cf65
+CPU implementer	: 0x50
b6cf65
+CPU architecture: 8
b6cf65
+CPU variant	: 0x0
b6cf65
+CPU part	: 0x000
b6cf65
+CPU revision	: 0
b6cf65
+
b6cf65
+processor	: 3
b6cf65
+Features	: fp asimd evtstrm
b6cf65
+CPU implementer	: 0x50
b6cf65
+CPU architecture: 8
b6cf65
+CPU variant	: 0x0
b6cf65
+CPU part	: 0x000
b6cf65
+CPU revision	: 0
b6cf65
+
b6cf65
+processor	: 4
b6cf65
+Features	: fp asimd evtstrm
b6cf65
+CPU implementer	: 0x50
b6cf65
+CPU architecture: 8
b6cf65
+CPU variant	: 0x0
b6cf65
+CPU part	: 0x000
b6cf65
+CPU revision	: 0
b6cf65
+
b6cf65
+processor	: 5
b6cf65
+Features	: fp asimd evtstrm
b6cf65
+CPU implementer	: 0x50
b6cf65
+CPU architecture: 8
b6cf65
+CPU variant	: 0x0
b6cf65
+CPU part	: 0x000
b6cf65
+CPU revision	: 0
b6cf65
+
b6cf65
+processor	: 6
b6cf65
+Features	: fp asimd evtstrm
b6cf65
+CPU implementer	: 0x50
b6cf65
+CPU architecture: 8
b6cf65
+CPU variant	: 0x0
b6cf65
+CPU part	: 0x000
b6cf65
+CPU revision	: 0
b6cf65
+
b6cf65
+processor	: 7
b6cf65
+Features	: fp asimd evtstrm
b6cf65
+CPU implementer	: 0x50
b6cf65
+CPU architecture: 8
b6cf65
+CPU variant	: 0x0
b6cf65
+CPU part	: 0x000
b6cf65
+CPU revision	: 0
b6cf65
diff --git a/tests/lkvm-arm/proc/device-tree/compatible b/tests/lkvm-arm/proc/device-tree/compatible
b6cf65
new file mode 100644
b6cf65
index 0000000..99642ed
b6cf65
--- /dev/null
b6cf65
+++ b/tests/lkvm-arm/proc/device-tree/compatible
b6cf65
@@ -0,0 +1 @@
b6cf65
+linux,dummy-virt
b6cf65
diff --git a/tests/lkvm-arm/proc/self/status b/tests/lkvm-arm/proc/self/status
b6cf65
new file mode 100644
b6cf65
index 0000000..751f5e7
b6cf65
--- /dev/null
b6cf65
+++ b/tests/lkvm-arm/proc/self/status
b6cf65
@@ -0,0 +1,41 @@
b6cf65
+Name:	cat
b6cf65
+State:	R (running)
b6cf65
+Tgid:	8307
b6cf65
+Ngid:	0
b6cf65
+Pid:	8307
b6cf65
+PPid:	1415
b6cf65
+TracerPid:	0
b6cf65
+Uid:	0	0	0	0
b6cf65
+Gid:	0	0	0	0
b6cf65
+FDSize:	256
b6cf65
+Groups:	
b6cf65
+VmPeak:	  109696 kB
b6cf65
+VmSize:	  109696 kB
b6cf65
+VmLck:	       0 kB
b6cf65
+VmPin:	       0 kB
b6cf65
+VmHWM:	     832 kB
b6cf65
+VmRSS:	     832 kB
b6cf65
+VmData:	     320 kB
b6cf65
+VmStk:	     256 kB
b6cf65
+VmExe:	      64 kB
b6cf65
+VmLib:	    1536 kB
b6cf65
+VmPTE:	     192 kB
b6cf65
+VmSwap:	       0 kB
b6cf65
+Threads:	1
b6cf65
+SigQ:	0/5821
b6cf65
+SigPnd:	0000000000000000
b6cf65
+ShdPnd:	0000000000000000
b6cf65
+SigBlk:	0000000000000000
b6cf65
+SigIgn:	0000000000000000
b6cf65
+SigCgt:	0000000000000000
b6cf65
+CapInh:	0000000000000000
b6cf65
+CapPrm:	0000003fffffffff
b6cf65
+CapEff:	0000003fffffffff
b6cf65
+CapBnd:	0000003fffffffff
b6cf65
+Seccomp:	0
b6cf65
+Cpus_allowed:	ff
b6cf65
+Cpus_allowed_list:	0-7
b6cf65
+Mems_allowed:	1
b6cf65
+Mems_allowed_list:	0
b6cf65
+voluntary_ctxt_switches:	1
b6cf65
+nonvoluntary_ctxt_switches:	1
b6cf65
diff --git a/tests/lkvm-arm/sbin/dmidecode b/tests/lkvm-arm/sbin/dmidecode
b6cf65
new file mode 100755
b6cf65
index 0000000..e53c12f
b6cf65
--- /dev/null
b6cf65
+++ b/tests/lkvm-arm/sbin/dmidecode
b6cf65
@@ -0,0 +1,2 @@
b6cf65
+#!/bin/sh -
b6cf65
+exit 1
b6cf65
diff --git a/tests/lkvm-arm/sbin/uname b/tests/lkvm-arm/sbin/uname
b6cf65
new file mode 100755
b6cf65
index 0000000..bd33a2d
b6cf65
--- /dev/null
b6cf65
+++ b/tests/lkvm-arm/sbin/uname
b6cf65
@@ -0,0 +1,2 @@
b6cf65
+#!/bin/sh -
b6cf65
+echo aarch64
b6cf65
diff --git a/tests/lkvm-arm/sbin/virt-what-cpuid-helper b/tests/lkvm-arm/sbin/virt-what-cpuid-helper
b6cf65
new file mode 100755
b6cf65
index 0000000..77a6692
b6cf65
--- /dev/null
b6cf65
+++ b/tests/lkvm-arm/sbin/virt-what-cpuid-helper
b6cf65
@@ -0,0 +1,2 @@
b6cf65
+#!/bin/sh -
b6cf65
+# nothing
b6cf65
diff --git a/tests/qemu-arm/proc/cpuinfo b/tests/qemu-arm/proc/cpuinfo
b6cf65
new file mode 100644
b6cf65
index 0000000..b83a182
b6cf65
--- /dev/null
b6cf65
+++ b/tests/qemu-arm/proc/cpuinfo
b6cf65
@@ -0,0 +1,63 @@
b6cf65
+processor	: 0
b6cf65
+Features	: fp asimd evtstrm
b6cf65
+CPU implementer	: 0x50
b6cf65
+CPU architecture: 8
b6cf65
+CPU variant	: 0x0
b6cf65
+CPU part	: 0x000
b6cf65
+CPU revision	: 0
b6cf65
+
b6cf65
+processor	: 1
b6cf65
+Features	: fp asimd evtstrm
b6cf65
+CPU implementer	: 0x50
b6cf65
+CPU architecture: 8
b6cf65
+CPU variant	: 0x0
b6cf65
+CPU part	: 0x000
b6cf65
+CPU revision	: 0
b6cf65
+
b6cf65
+processor	: 2
b6cf65
+Features	: fp asimd evtstrm
b6cf65
+CPU implementer	: 0x50
b6cf65
+CPU architecture: 8
b6cf65
+CPU variant	: 0x0
b6cf65
+CPU part	: 0x000
b6cf65
+CPU revision	: 0
b6cf65
+
b6cf65
+processor	: 3
b6cf65
+Features	: fp asimd evtstrm
b6cf65
+CPU implementer	: 0x50
b6cf65
+CPU architecture: 8
b6cf65
+CPU variant	: 0x0
b6cf65
+CPU part	: 0x000
b6cf65
+CPU revision	: 0
b6cf65
+
b6cf65
+processor	: 4
b6cf65
+Features	: fp asimd evtstrm
b6cf65
+CPU implementer	: 0x50
b6cf65
+CPU architecture: 8
b6cf65
+CPU variant	: 0x0
b6cf65
+CPU part	: 0x000
b6cf65
+CPU revision	: 0
b6cf65
+
b6cf65
+processor	: 5
b6cf65
+Features	: fp asimd evtstrm
b6cf65
+CPU implementer	: 0x50
b6cf65
+CPU architecture: 8
b6cf65
+CPU variant	: 0x0
b6cf65
+CPU part	: 0x000
b6cf65
+CPU revision	: 0
b6cf65
+
b6cf65
+processor	: 6
b6cf65
+Features	: fp asimd evtstrm
b6cf65
+CPU implementer	: 0x50
b6cf65
+CPU architecture: 8
b6cf65
+CPU variant	: 0x0
b6cf65
+CPU part	: 0x000
b6cf65
+CPU revision	: 0
b6cf65
+
b6cf65
+processor	: 7
b6cf65
+Features	: fp asimd evtstrm
b6cf65
+CPU implementer	: 0x50
b6cf65
+CPU architecture: 8
b6cf65
+CPU variant	: 0x0
b6cf65
+CPU part	: 0x000
b6cf65
+CPU revision	: 0
b6cf65
diff --git a/tests/qemu-arm/proc/device-tree/fw-cfg@9020000/compatible b/tests/qemu-arm/proc/device-tree/fw-cfg@9020000/compatible
b6cf65
new file mode 100644
b6cf65
index 0000000..3932ade
b6cf65
--- /dev/null
b6cf65
+++ b/tests/qemu-arm/proc/device-tree/fw-cfg@9020000/compatible
b6cf65
@@ -0,0 +1 @@
b6cf65
+qemu,fw-cfg-mmio
b6cf65
diff --git a/tests/qemu-arm/proc/self/status b/tests/qemu-arm/proc/self/status
b6cf65
new file mode 100644
b6cf65
index 0000000..751f5e7
b6cf65
--- /dev/null
b6cf65
+++ b/tests/qemu-arm/proc/self/status
b6cf65
@@ -0,0 +1,41 @@
b6cf65
+Name:	cat
b6cf65
+State:	R (running)
b6cf65
+Tgid:	8307
b6cf65
+Ngid:	0
b6cf65
+Pid:	8307
b6cf65
+PPid:	1415
b6cf65
+TracerPid:	0
b6cf65
+Uid:	0	0	0	0
b6cf65
+Gid:	0	0	0	0
b6cf65
+FDSize:	256
b6cf65
+Groups:	
b6cf65
+VmPeak:	  109696 kB
b6cf65
+VmSize:	  109696 kB
b6cf65
+VmLck:	       0 kB
b6cf65
+VmPin:	       0 kB
b6cf65
+VmHWM:	     832 kB
b6cf65
+VmRSS:	     832 kB
b6cf65
+VmData:	     320 kB
b6cf65
+VmStk:	     256 kB
b6cf65
+VmExe:	      64 kB
b6cf65
+VmLib:	    1536 kB
b6cf65
+VmPTE:	     192 kB
b6cf65
+VmSwap:	       0 kB
b6cf65
+Threads:	1
b6cf65
+SigQ:	0/5821
b6cf65
+SigPnd:	0000000000000000
b6cf65
+ShdPnd:	0000000000000000
b6cf65
+SigBlk:	0000000000000000
b6cf65
+SigIgn:	0000000000000000
b6cf65
+SigCgt:	0000000000000000
b6cf65
+CapInh:	0000000000000000
b6cf65
+CapPrm:	0000003fffffffff
b6cf65
+CapEff:	0000003fffffffff
b6cf65
+CapBnd:	0000003fffffffff
b6cf65
+Seccomp:	0
b6cf65
+Cpus_allowed:	ff
b6cf65
+Cpus_allowed_list:	0-7
b6cf65
+Mems_allowed:	1
b6cf65
+Mems_allowed_list:	0
b6cf65
+voluntary_ctxt_switches:	1
b6cf65
+nonvoluntary_ctxt_switches:	1
b6cf65
diff --git a/tests/qemu-arm/sbin/dmidecode b/tests/qemu-arm/sbin/dmidecode
b6cf65
new file mode 100755
b6cf65
index 0000000..e53c12f
b6cf65
--- /dev/null
b6cf65
+++ b/tests/qemu-arm/sbin/dmidecode
b6cf65
@@ -0,0 +1,2 @@
b6cf65
+#!/bin/sh -
b6cf65
+exit 1
b6cf65
diff --git a/tests/qemu-arm/sbin/uname b/tests/qemu-arm/sbin/uname
b6cf65
new file mode 100755
b6cf65
index 0000000..bd33a2d
b6cf65
--- /dev/null
b6cf65
+++ b/tests/qemu-arm/sbin/uname
b6cf65
@@ -0,0 +1,2 @@
b6cf65
+#!/bin/sh -
b6cf65
+echo aarch64
b6cf65
diff --git a/tests/qemu-arm/sbin/virt-what-cpuid-helper b/tests/qemu-arm/sbin/virt-what-cpuid-helper
b6cf65
new file mode 100755
b6cf65
index 0000000..77a6692
b6cf65
--- /dev/null
b6cf65
+++ b/tests/qemu-arm/sbin/virt-what-cpuid-helper
b6cf65
@@ -0,0 +1,2 @@
b6cf65
+#!/bin/sh -
b6cf65
+# nothing
b6cf65
diff --git a/tests/test-lkvm-arm.sh b/tests/test-lkvm-arm.sh
b6cf65
new file mode 100755
b6cf65
index 0000000..bed50ad
b6cf65
--- /dev/null
b6cf65
+++ b/tests/test-lkvm-arm.sh
b6cf65
@@ -0,0 +1,34 @@
b6cf65
+# Test for LKVM on ARM
b6cf65
+# Copyright (C) 2015 Red Hat Inc.
b6cf65
+#
b6cf65
+# This program is free software; you can redistribute it and/or modify
b6cf65
+# it under the terms of the GNU General Public License as published by
b6cf65
+# the Free Software Foundation; either version 2 of the License, or
b6cf65
+# (at your option) any later version.
b6cf65
+#
b6cf65
+# This program is distributed in the hope that it will be useful,
b6cf65
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
b6cf65
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
b6cf65
+# GNU General Public License for more details.
b6cf65
+#
b6cf65
+# You should have received a copy of the GNU General Public License
b6cf65
+# along with this program; if not, write to the Free Software
b6cf65
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
b6cf65
+
b6cf65
+root=tests/lkvm-arm
b6cf65
+
b6cf65
+output="$(./virt-what --test-root=$root 2>&1)"
b6cf65
+expected="lkvm"
b6cf65
+
b6cf65
+if [ "$output" != "$expected" ]; then
b6cf65
+    echo "$0: test failed because output did not match expected"
b6cf65
+    echo "Expected output was:"
b6cf65
+    echo "----------------------------------------"
b6cf65
+    echo "$expected"
b6cf65
+    echo "----------------------------------------"
b6cf65
+    echo "But the actual output of the program was:"
b6cf65
+    echo "----------------------------------------"
b6cf65
+    echo "$output"
b6cf65
+    echo "----------------------------------------"
b6cf65
+    exit 1
b6cf65
+fi
b6cf65
diff --git a/tests/test-qemu-arm.sh b/tests/test-qemu-arm.sh
b6cf65
new file mode 100755
b6cf65
index 0000000..58455c8
b6cf65
--- /dev/null
b6cf65
+++ b/tests/test-qemu-arm.sh
b6cf65
@@ -0,0 +1,34 @@
b6cf65
+# Test for qemu on ARM
b6cf65
+# Copyright (C) 2015 Red Hat Inc.
b6cf65
+#
b6cf65
+# This program is free software; you can redistribute it and/or modify
b6cf65
+# it under the terms of the GNU General Public License as published by
b6cf65
+# the Free Software Foundation; either version 2 of the License, or
b6cf65
+# (at your option) any later version.
b6cf65
+#
b6cf65
+# This program is distributed in the hope that it will be useful,
b6cf65
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
b6cf65
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
b6cf65
+# GNU General Public License for more details.
b6cf65
+#
b6cf65
+# You should have received a copy of the GNU General Public License
b6cf65
+# along with this program; if not, write to the Free Software
b6cf65
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
b6cf65
+
b6cf65
+root=tests/qemu-arm
b6cf65
+
b6cf65
+output="$(./virt-what --test-root=$root 2>&1)"
b6cf65
+expected="qemu"
b6cf65
+
b6cf65
+if [ "$output" != "$expected" ]; then
b6cf65
+    echo "$0: test failed because output did not match expected"
b6cf65
+    echo "Expected output was:"
b6cf65
+    echo "----------------------------------------"
b6cf65
+    echo "$expected"
b6cf65
+    echo "----------------------------------------"
b6cf65
+    echo "But the actual output of the program was:"
b6cf65
+    echo "----------------------------------------"
b6cf65
+    echo "$output"
b6cf65
+    echo "----------------------------------------"
b6cf65
+    exit 1
b6cf65
+fi
b6cf65
diff --git a/tests/test-xen-arm.sh b/tests/test-xen-arm.sh
b6cf65
new file mode 100755
b6cf65
index 0000000..209712e
b6cf65
--- /dev/null
b6cf65
+++ b/tests/test-xen-arm.sh
b6cf65
@@ -0,0 +1,34 @@
b6cf65
+# Test for Xen on ARM
b6cf65
+# Copyright (C) 2015 Red Hat Inc.
b6cf65
+#
b6cf65
+# This program is free software; you can redistribute it and/or modify
b6cf65
+# it under the terms of the GNU General Public License as published by
b6cf65
+# the Free Software Foundation; either version 2 of the License, or
b6cf65
+# (at your option) any later version.
b6cf65
+#
b6cf65
+# This program is distributed in the hope that it will be useful,
b6cf65
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
b6cf65
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
b6cf65
+# GNU General Public License for more details.
b6cf65
+#
b6cf65
+# You should have received a copy of the GNU General Public License
b6cf65
+# along with this program; if not, write to the Free Software
b6cf65
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
b6cf65
+
b6cf65
+root=tests/xen-arm
b6cf65
+
b6cf65
+output="$(./virt-what --test-root=$root 2>&1)"
b6cf65
+expected="xen"
b6cf65
+
b6cf65
+if [ "$output" != "$expected" ]; then
b6cf65
+    echo "$0: test failed because output did not match expected"
b6cf65
+    echo "Expected output was:"
b6cf65
+    echo "----------------------------------------"
b6cf65
+    echo "$expected"
b6cf65
+    echo "----------------------------------------"
b6cf65
+    echo "But the actual output of the program was:"
b6cf65
+    echo "----------------------------------------"
b6cf65
+    echo "$output"
b6cf65
+    echo "----------------------------------------"
b6cf65
+    exit 1
b6cf65
+fi
b6cf65
diff --git a/tests/xen-arm/proc/cpuinfo b/tests/xen-arm/proc/cpuinfo
b6cf65
new file mode 100644
b6cf65
index 0000000..b83a182
b6cf65
--- /dev/null
b6cf65
+++ b/tests/xen-arm/proc/cpuinfo
b6cf65
@@ -0,0 +1,63 @@
b6cf65
+processor	: 0
b6cf65
+Features	: fp asimd evtstrm
b6cf65
+CPU implementer	: 0x50
b6cf65
+CPU architecture: 8
b6cf65
+CPU variant	: 0x0
b6cf65
+CPU part	: 0x000
b6cf65
+CPU revision	: 0
b6cf65
+
b6cf65
+processor	: 1
b6cf65
+Features	: fp asimd evtstrm
b6cf65
+CPU implementer	: 0x50
b6cf65
+CPU architecture: 8
b6cf65
+CPU variant	: 0x0
b6cf65
+CPU part	: 0x000
b6cf65
+CPU revision	: 0
b6cf65
+
b6cf65
+processor	: 2
b6cf65
+Features	: fp asimd evtstrm
b6cf65
+CPU implementer	: 0x50
b6cf65
+CPU architecture: 8
b6cf65
+CPU variant	: 0x0
b6cf65
+CPU part	: 0x000
b6cf65
+CPU revision	: 0
b6cf65
+
b6cf65
+processor	: 3
b6cf65
+Features	: fp asimd evtstrm
b6cf65
+CPU implementer	: 0x50
b6cf65
+CPU architecture: 8
b6cf65
+CPU variant	: 0x0
b6cf65
+CPU part	: 0x000
b6cf65
+CPU revision	: 0
b6cf65
+
b6cf65
+processor	: 4
b6cf65
+Features	: fp asimd evtstrm
b6cf65
+CPU implementer	: 0x50
b6cf65
+CPU architecture: 8
b6cf65
+CPU variant	: 0x0
b6cf65
+CPU part	: 0x000
b6cf65
+CPU revision	: 0
b6cf65
+
b6cf65
+processor	: 5
b6cf65
+Features	: fp asimd evtstrm
b6cf65
+CPU implementer	: 0x50
b6cf65
+CPU architecture: 8
b6cf65
+CPU variant	: 0x0
b6cf65
+CPU part	: 0x000
b6cf65
+CPU revision	: 0
b6cf65
+
b6cf65
+processor	: 6
b6cf65
+Features	: fp asimd evtstrm
b6cf65
+CPU implementer	: 0x50
b6cf65
+CPU architecture: 8
b6cf65
+CPU variant	: 0x0
b6cf65
+CPU part	: 0x000
b6cf65
+CPU revision	: 0
b6cf65
+
b6cf65
+processor	: 7
b6cf65
+Features	: fp asimd evtstrm
b6cf65
+CPU implementer	: 0x50
b6cf65
+CPU architecture: 8
b6cf65
+CPU variant	: 0x0
b6cf65
+CPU part	: 0x000
b6cf65
+CPU revision	: 0
b6cf65
diff --git a/tests/xen-arm/proc/device-tree/hypervisor/compatible b/tests/xen-arm/proc/device-tree/hypervisor/compatible
b6cf65
new file mode 100644
b6cf65
index 0000000..070f5e2
b6cf65
--- /dev/null
b6cf65
+++ b/tests/xen-arm/proc/device-tree/hypervisor/compatible
b6cf65
@@ -0,0 +1 @@
b6cf65
+xen,xen
b6cf65
diff --git a/tests/xen-arm/proc/self/status b/tests/xen-arm/proc/self/status
b6cf65
new file mode 100644
b6cf65
index 0000000..751f5e7
b6cf65
--- /dev/null
b6cf65
+++ b/tests/xen-arm/proc/self/status
b6cf65
@@ -0,0 +1,41 @@
b6cf65
+Name:	cat
b6cf65
+State:	R (running)
b6cf65
+Tgid:	8307
b6cf65
+Ngid:	0
b6cf65
+Pid:	8307
b6cf65
+PPid:	1415
b6cf65
+TracerPid:	0
b6cf65
+Uid:	0	0	0	0
b6cf65
+Gid:	0	0	0	0
b6cf65
+FDSize:	256
b6cf65
+Groups:	
b6cf65
+VmPeak:	  109696 kB
b6cf65
+VmSize:	  109696 kB
b6cf65
+VmLck:	       0 kB
b6cf65
+VmPin:	       0 kB
b6cf65
+VmHWM:	     832 kB
b6cf65
+VmRSS:	     832 kB
b6cf65
+VmData:	     320 kB
b6cf65
+VmStk:	     256 kB
b6cf65
+VmExe:	      64 kB
b6cf65
+VmLib:	    1536 kB
b6cf65
+VmPTE:	     192 kB
b6cf65
+VmSwap:	       0 kB
b6cf65
+Threads:	1
b6cf65
+SigQ:	0/5821
b6cf65
+SigPnd:	0000000000000000
b6cf65
+ShdPnd:	0000000000000000
b6cf65
+SigBlk:	0000000000000000
b6cf65
+SigIgn:	0000000000000000
b6cf65
+SigCgt:	0000000000000000
b6cf65
+CapInh:	0000000000000000
b6cf65
+CapPrm:	0000003fffffffff
b6cf65
+CapEff:	0000003fffffffff
b6cf65
+CapBnd:	0000003fffffffff
b6cf65
+Seccomp:	0
b6cf65
+Cpus_allowed:	ff
b6cf65
+Cpus_allowed_list:	0-7
b6cf65
+Mems_allowed:	1
b6cf65
+Mems_allowed_list:	0
b6cf65
+voluntary_ctxt_switches:	1
b6cf65
+nonvoluntary_ctxt_switches:	1
b6cf65
diff --git a/tests/xen-arm/sbin/dmidecode b/tests/xen-arm/sbin/dmidecode
b6cf65
new file mode 100755
b6cf65
index 0000000..e53c12f
b6cf65
--- /dev/null
b6cf65
+++ b/tests/xen-arm/sbin/dmidecode
b6cf65
@@ -0,0 +1,2 @@
b6cf65
+#!/bin/sh -
b6cf65
+exit 1
b6cf65
diff --git a/tests/xen-arm/sbin/uname b/tests/xen-arm/sbin/uname
b6cf65
new file mode 100755
b6cf65
index 0000000..bd33a2d
b6cf65
--- /dev/null
b6cf65
+++ b/tests/xen-arm/sbin/uname
b6cf65
@@ -0,0 +1,2 @@
b6cf65
+#!/bin/sh -
b6cf65
+echo aarch64
b6cf65
diff --git a/tests/xen-arm/sbin/virt-what-cpuid-helper b/tests/xen-arm/sbin/virt-what-cpuid-helper
b6cf65
new file mode 100755
b6cf65
index 0000000..77a6692
b6cf65
--- /dev/null
b6cf65
+++ b/tests/xen-arm/sbin/virt-what-cpuid-helper
b6cf65
@@ -0,0 +1,2 @@
b6cf65
+#!/bin/sh -
b6cf65
+# nothing
b6cf65
diff --git a/virt-what.in b/virt-what.in
b6cf65
index ed08dae..a5ed33e 100644
b6cf65
--- a/virt-what.in
b6cf65
+++ b/virt-what.in
b6cf65
@@ -103,7 +103,7 @@ dmi=$(LANG=C dmidecode 2>&1)
b6cf65
 # Architecture.
b6cf65
 # Note for the purpose of testing, we only call uname with -p option.
b6cf65
 
b6cf65
-arch=$(uname -p)
b6cf65
+arch=$(uname -p | sed -e 's/i.86/i386/' | sed -e 's/arm.*/arm/')
b6cf65
 
b6cf65
 # Check for VMware.
b6cf65
 # cpuid check added by Chetan Loke.
b6cf65
@@ -223,6 +223,13 @@ elif [ -f "${root}/sys/hypervisor/type" ] &&
b6cf65
     # enough information at present to tell whether this is dom0
b6cf65
     # or domU.  XXX
b6cf65
     echo xen
b6cf65
+elif [ "$arch" = "arm" ] || [ "$arch" = "aarch64" ]; then
b6cf65
+    if [ -d "${root}/proc/device-tree/hypervisor" ] &&
b6cf65
+        grep -q "xen" "${root}/proc/device-tree/hypervisor/compatible"; then
b6cf65
+        echo xen
b6cf65
+        skip_qemu_kvm=true
b6cf65
+        skip_lkvm=true
b6cf65
+    fi
b6cf65
 elif [ "$arch" = "ia64" ]; then
b6cf65
     if [ -d "${root}/sys/bus/xen" -a ! -d "${root}/sys/bus/xen-backend" ]; then
b6cf65
         # PV-on-HVM drivers installed in a Xen guest.
b6cf65
@@ -250,6 +257,14 @@ fi
b6cf65
 if ! "$skip_qemu_kvm"; then
b6cf65
     if [ "$cpuid" = "KVMKVMKVM" ]; then
b6cf65
 	echo kvm
b6cf65
+    elif [ "$arch" = "arm" ] || [ "$arch" = "aarch64" ]; then
b6cf65
+        if [ -d "${root}/proc/device-tree" ] &&
b6cf65
+            ls "${root}/proc/device-tree" | grep -q "fw-cfg"; then
b6cf65
+            # We don't have enough information to determine if we're
b6cf65
+            # using KVM acceleration or not.
b6cf65
+            echo qemu
b6cf65
+            skip_lkvm=true
b6cf65
+        fi
b6cf65
     else
b6cf65
         # XXX This is known to fail for qemu with the explicit -cpu
b6cf65
         # option, since /proc/cpuinfo will not contain the QEMU
b6cf65
@@ -264,6 +279,11 @@ fi
b6cf65
 if ! "$skip_lkvm"; then
b6cf65
     if [ "$cpuid" = "LKVMLKVMLKVM" ]; then
b6cf65
         echo lkvm
b6cf65
+    elif [ "$arch" = "arm" ] || [ "$arch" = "aarch64" ]; then
b6cf65
+        if [ -d "${root}/proc/device-tree" ] &&
b6cf65
+            grep -q "dummy-virt" "${root}/proc/device-tree/compatible"; then
b6cf65
+            echo lkvm
b6cf65
+	fi
b6cf65
     fi
b6cf65
 fi
b6cf65
 
b6cf65
-- 
201bb7
2.10.2
b6cf65