Blame SOURCES/0019-Add-support-for-Nutanix-Acropolis-Hypervisor-AHV-RHB.patch

e10a2d
From 01ea13d9813df93e294b0d9776d4cefd54b1609b Mon Sep 17 00:00:00 2001
e10a2d
From: "Richard W.M. Jones" <rjones@redhat.com>
e10a2d
Date: Fri, 4 Oct 2019 16:25:55 +0300
cc91b2
Subject: [PATCH 19/36] Add support for Nutanix Acropolis Hypervisor (AHV)
e10a2d
 (RHBZ#1756381).
e10a2d
e10a2d
Thanks: Cristian Seres for providing access to a guest.
e10a2d
---
e10a2d
 configure.ac                                  |   2 +
e10a2d
 tests/nutanix-ahv/Makefile.am                 |  28 ++++
e10a2d
 tests/nutanix-ahv/proc/cpuinfo                |  27 ++++
e10a2d
 tests/nutanix-ahv/proc/self/status            |  55 ++++++++
e10a2d
 tests/nutanix-ahv/sbin/dmidecode              | 123 ++++++++++++++++++
e10a2d
 tests/nutanix-ahv/sbin/uname                  |   2 +
e10a2d
 tests/nutanix-ahv/sbin/virt-what-cpuid-helper |   2 +
e10a2d
 tests/nutanix-ahv/test.sh                     |  32 +++++
e10a2d
 virt-what.in                                  |  10 +-
e10a2d
 virt-what.pod                                 |   6 +
e10a2d
 10 files changed, 286 insertions(+), 1 deletion(-)
e10a2d
 create mode 100644 tests/nutanix-ahv/Makefile.am
e10a2d
 create mode 100644 tests/nutanix-ahv/proc/cpuinfo
e10a2d
 create mode 100644 tests/nutanix-ahv/proc/self/status
e10a2d
 create mode 100755 tests/nutanix-ahv/sbin/dmidecode
e10a2d
 create mode 100755 tests/nutanix-ahv/sbin/uname
e10a2d
 create mode 100755 tests/nutanix-ahv/sbin/virt-what-cpuid-helper
e10a2d
 create mode 100755 tests/nutanix-ahv/test.sh
e10a2d
e10a2d
diff --git a/configure.ac b/configure.ac
e10a2d
index 5e0d9c4..f246e34 100644
e10a2d
--- a/configure.ac
e10a2d
+++ b/configure.ac
e10a2d
@@ -51,6 +51,7 @@ tests="\
e10a2d
 	lkvm-arm \
e10a2d
 	lx86 \
e10a2d
 	lxc \
e10a2d
+	nutanix-ahv \
e10a2d
 	parallels-desktop \
e10a2d
 	ppc64-baremetal \
e10a2d
 	ppc64-kvm \
e10a2d
@@ -93,6 +94,7 @@ AC_CONFIG_FILES([Makefile
e10a2d
 	         tests/lkvm-arm/Makefile
e10a2d
 	         tests/lx86/Makefile
e10a2d
 	         tests/lxc/Makefile
e10a2d
+	         tests/nutanix-ahv/Makefile
e10a2d
 	         tests/parallels-desktop/Makefile
e10a2d
 	         tests/ppc64-baremetal/Makefile
e10a2d
 	         tests/ppc64-kvm/Makefile
e10a2d
diff --git a/tests/nutanix-ahv/Makefile.am b/tests/nutanix-ahv/Makefile.am
e10a2d
new file mode 100644
e10a2d
index 0000000..b748df8
e10a2d
--- /dev/null
e10a2d
+++ b/tests/nutanix-ahv/Makefile.am
e10a2d
@@ -0,0 +1,28 @@
e10a2d
+# Makefile for virt-what
e10a2d
+# Copyright (C) 2008-2011 Red Hat Inc.
e10a2d
+#
e10a2d
+# This program is free software; you can redistribute it and/or modify
e10a2d
+# it under the terms of the GNU General Public License as published by
e10a2d
+# the Free Software Foundation; either version 2 of the License, or
e10a2d
+# (at your option) any later version.
e10a2d
+#
e10a2d
+# This program is distributed in the hope that it will be useful,
e10a2d
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
e10a2d
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
e10a2d
+# GNU General Public License for more details.
e10a2d
+#
e10a2d
+# You should have received a copy of the GNU General Public License
e10a2d
+# along with this program; if not, write to the Free Software
e10a2d
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
e10a2d
+
e10a2d
+CLEANFILES = *~
e10a2d
+
e10a2d
+TESTS = test.sh
e10a2d
+
e10a2d
+EXTRA_DIST = \
e10a2d
+	test.sh \
e10a2d
+	proc/cpuinfo \
e10a2d
+	proc/self/status \
e10a2d
+	sbin/dmidecode \
e10a2d
+	sbin/uname \
e10a2d
+	sbin/virt-what-cpuid-helper
e10a2d
diff --git a/tests/nutanix-ahv/proc/cpuinfo b/tests/nutanix-ahv/proc/cpuinfo
e10a2d
new file mode 100644
e10a2d
index 0000000..d7a1f68
e10a2d
--- /dev/null
e10a2d
+++ b/tests/nutanix-ahv/proc/cpuinfo
e10a2d
@@ -0,0 +1,27 @@
e10a2d
+processor	: 0
e10a2d
+vendor_id	: GenuineIntel
e10a2d
+cpu family	: 15
e10a2d
+model		: 6
e10a2d
+model name	: Intel(R) Xeon(R) Silver 4114 CPU @ 2.20GHz
e10a2d
+stepping	: 1
e10a2d
+microcode	: 0x1
e10a2d
+cpu MHz		: 2199.998
e10a2d
+cache size	: 16384 KB
e10a2d
+physical id	: 0
e10a2d
+siblings	: 1
e10a2d
+core id		: 0
e10a2d
+cpu cores	: 1
e10a2d
+apicid		: 0
e10a2d
+initial apicid	: 0
e10a2d
+fpu		: yes
e10a2d
+fpu_exception	: yes
e10a2d
+cpuid level	: 13
e10a2d
+wp		: yes
e10a2d
+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 pdpe1gb rdtscp lm constant_tsc nopl cpuid tsc_known_freq pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single pti ssbd ibrs ibpb stibp fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx avx512f avx512dq rdseed adx smap clflushopt avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 arat md_clear
e10a2d
+bugs		: cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs
e10a2d
+bogomips	: 4399.99
e10a2d
+clflush size	: 64
e10a2d
+cache_alignment	: 128
e10a2d
+address sizes	: 46 bits physical, 48 bits virtual
e10a2d
+power management:
e10a2d
+
e10a2d
diff --git a/tests/nutanix-ahv/proc/self/status b/tests/nutanix-ahv/proc/self/status
e10a2d
new file mode 100644
e10a2d
index 0000000..7b4eed0
e10a2d
--- /dev/null
e10a2d
+++ b/tests/nutanix-ahv/proc/self/status
e10a2d
@@ -0,0 +1,55 @@
e10a2d
+Name:	cat
e10a2d
+Umask:	0022
e10a2d
+State:	R (running)
e10a2d
+Tgid:	18508
e10a2d
+Ngid:	0
e10a2d
+Pid:	18508
e10a2d
+PPid:	18506
e10a2d
+TracerPid:	0
e10a2d
+Uid:	0	0	0	0
e10a2d
+Gid:	0	0	0	0
e10a2d
+FDSize:	64
e10a2d
+Groups:	0 
e10a2d
+NStgid:	18508
e10a2d
+NSpid:	18508
e10a2d
+NSpgid:	18506
e10a2d
+NSsid:	1945
e10a2d
+VmPeak:	    5392 kB
e10a2d
+VmSize:	    5392 kB
e10a2d
+VmLck:	       0 kB
e10a2d
+VmPin:	       0 kB
e10a2d
+VmHWM:	     760 kB
e10a2d
+VmRSS:	     760 kB
e10a2d
+RssAnon:	      68 kB
e10a2d
+RssFile:	     692 kB
e10a2d
+RssShmem:	       0 kB
e10a2d
+VmData:	     312 kB
e10a2d
+VmStk:	     132 kB
e10a2d
+VmExe:	      28 kB
e10a2d
+VmLib:	    1456 kB
e10a2d
+VmPTE:	      48 kB
e10a2d
+VmSwap:	       0 kB
e10a2d
+HugetlbPages:	       0 kB
e10a2d
+CoreDumping:	0
e10a2d
+THP_enabled:	1
e10a2d
+Threads:	1
e10a2d
+SigQ:	3/7359
e10a2d
+SigPnd:	0000000000000000
e10a2d
+ShdPnd:	0000000000000000
e10a2d
+SigBlk:	0000000000000000
e10a2d
+SigIgn:	0000000000000000
e10a2d
+SigCgt:	0000000000000000
e10a2d
+CapInh:	0000000000000000
e10a2d
+CapPrm:	0000003fffffffff
e10a2d
+CapEff:	0000003fffffffff
e10a2d
+CapBnd:	0000003fffffffff
e10a2d
+CapAmb:	0000000000000000
e10a2d
+NoNewPrivs:	0
e10a2d
+Seccomp:	0
e10a2d
+Speculation_Store_Bypass:	thread vulnerable
e10a2d
+Cpus_allowed:	ffff,ffffffff,ffffffff,ffffffff,ffffffff,ffffffff,ffffffff,ffffffff
e10a2d
+Cpus_allowed_list:	0-239
e10a2d
+Mems_allowed:	00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000001
e10a2d
+Mems_allowed_list:	0
e10a2d
+voluntary_ctxt_switches:	0
e10a2d
+nonvoluntary_ctxt_switches:	2
e10a2d
diff --git a/tests/nutanix-ahv/sbin/dmidecode b/tests/nutanix-ahv/sbin/dmidecode
e10a2d
new file mode 100755
e10a2d
index 0000000..3774819
e10a2d
--- /dev/null
e10a2d
+++ b/tests/nutanix-ahv/sbin/dmidecode
e10a2d
@@ -0,0 +1,123 @@
e10a2d
+#!/bin/sh -
e10a2d
+cat <<'EOF'
e10a2d
+i# dmidecode 3.2
e10a2d
+Getting SMBIOS data from sysfs.
e10a2d
+SMBIOS 2.8 present.
e10a2d
+9 structures occupying 486 bytes.
e10a2d
+Table at 0x000F73C0.
e10a2d
+
e10a2d
+Handle 0x0000, DMI type 0, 24 bytes
e10a2d
+BIOS Information
e10a2d
+	Vendor: SeaBIOS
e10a2d
+	Version: 1.9.1-5.el6
e10a2d
+	Release Date: 04/01/2014
e10a2d
+	Address: 0xE8000
e10a2d
+	Runtime Size: 96 kB
e10a2d
+	ROM Size: 64 kB
e10a2d
+	Characteristics:
e10a2d
+		BIOS characteristics not supported
e10a2d
+		Targeted content distribution is supported
e10a2d
+	BIOS Revision: 0.0
e10a2d
+
e10a2d
+Handle 0x0100, DMI type 1, 27 bytes
e10a2d
+System Information
e10a2d
+	Manufacturer: Nutanix
e10a2d
+	Product Name: AHV
e10a2d
+	Version: RHEL 7.3.0 PC (i440FX + PIIX, 1996)
e10a2d
+	Serial Number: B913C223-EEDE-4DFC-BB43-BE1495F4388D
e10a2d
+	UUID: b913c223-eede-4dfc-bb43-be1495f4388d
e10a2d
+	Wake-up Type: Power Switch
e10a2d
+	SKU Number: Not Specified
e10a2d
+	Family: Red Hat Enterprise Linux
e10a2d
+
e10a2d
+Handle 0x0300, DMI type 3, 21 bytes
e10a2d
+Chassis Information
e10a2d
+	Manufacturer: Red Hat
e10a2d
+	Type: Other
e10a2d
+	Lock: Not Present
e10a2d
+	Version: RHEL 7.3.0 PC (i440FX + PIIX, 1996)
e10a2d
+	Serial Number: Not Specified
e10a2d
+	Asset Tag: Not Specified
e10a2d
+	Boot-up State: Safe
e10a2d
+	Power Supply State: Safe
e10a2d
+	Thermal State: Safe
e10a2d
+	Security Status: Unknown
e10a2d
+	OEM Information: 0x00000000
e10a2d
+	Height: Unspecified
e10a2d
+	Number Of Power Cords: Unspecified
e10a2d
+	Contained Elements: 0
e10a2d
+
e10a2d
+Handle 0x0400, DMI type 4, 42 bytes
e10a2d
+Processor Information
e10a2d
+	Socket Designation: CPU 0
e10a2d
+	Type: Central Processor
e10a2d
+	Family: Other
e10a2d
+	Manufacturer: Red Hat
e10a2d
+	ID: 61 0F 00 00 FF FB 8B 0F
e10a2d
+	Version: RHEL 7.3.0 PC (i440FX + PIIX, 1996)
e10a2d
+	Voltage: Unknown
e10a2d
+	External Clock: Unknown
e10a2d
+	Max Speed: 2000 MHz
e10a2d
+	Current Speed: 2000 MHz
e10a2d
+	Status: Populated, Enabled
e10a2d
+	Upgrade: Other
e10a2d
+	L1 Cache Handle: Not Provided
e10a2d
+	L2 Cache Handle: Not Provided
e10a2d
+	L3 Cache Handle: Not Provided
e10a2d
+	Serial Number: Not Specified
e10a2d
+	Asset Tag: Not Specified
e10a2d
+	Part Number: Not Specified
e10a2d
+	Core Count: 1
e10a2d
+	Core Enabled: 1
e10a2d
+	Thread Count: 1
e10a2d
+	Characteristics: None
e10a2d
+
e10a2d
+Handle 0x1000, DMI type 16, 23 bytes
e10a2d
+Physical Memory Array
e10a2d
+	Location: Other
e10a2d
+	Use: System Memory
e10a2d
+	Error Correction Type: Multi-bit ECC
e10a2d
+	Maximum Capacity: 2 GB
e10a2d
+	Error Information Handle: Not Provided
e10a2d
+	Number Of Devices: 1
e10a2d
+
e10a2d
+Handle 0x1100, DMI type 17, 40 bytes
e10a2d
+Memory Device
e10a2d
+	Array Handle: 0x1000
e10a2d
+	Error Information Handle: Not Provided
e10a2d
+	Total Width: Unknown
e10a2d
+	Data Width: Unknown
e10a2d
+	Size: 2048 MB
e10a2d
+	Form Factor: DIMM
e10a2d
+	Set: None
e10a2d
+	Locator: DIMM 0
e10a2d
+	Bank Locator: Not Specified
e10a2d
+	Type: RAM
e10a2d
+	Type Detail: Other
e10a2d
+	Speed: Unknown
e10a2d
+	Manufacturer: Red Hat
e10a2d
+	Serial Number: Not Specified
e10a2d
+	Asset Tag: Not Specified
e10a2d
+	Part Number: Not Specified
e10a2d
+	Rank: Unknown
e10a2d
+	Configured Memory Speed: Unknown
e10a2d
+	Minimum Voltage: Unknown
e10a2d
+	Maximum Voltage: Unknown
e10a2d
+	Configured Voltage: Unknown
e10a2d
+
e10a2d
+Handle 0x1300, DMI type 19, 31 bytes
e10a2d
+Memory Array Mapped Address
e10a2d
+	Starting Address: 0x00000000000
e10a2d
+	Ending Address: 0x0007FFFFFFF
e10a2d
+	Range Size: 2 GB
e10a2d
+	Physical Array Handle: 0x1000
e10a2d
+	Partition Width: 1
e10a2d
+
e10a2d
+Handle 0x2000, DMI type 32, 11 bytes
e10a2d
+System Boot Information
e10a2d
+	Status: No errors detected
e10a2d
+
e10a2d
+Handle 0x7F00, DMI type 127, 4 bytes
e10a2d
+End Of Table
e10a2d
+
e10a2d
+EOF
e10a2d
diff --git a/tests/nutanix-ahv/sbin/uname b/tests/nutanix-ahv/sbin/uname
e10a2d
new file mode 100755
e10a2d
index 0000000..ab0ec89
e10a2d
--- /dev/null
e10a2d
+++ b/tests/nutanix-ahv/sbin/uname
e10a2d
@@ -0,0 +1,2 @@
e10a2d
+#!/bin/sh -
e10a2d
+echo x86_64
e10a2d
diff --git a/tests/nutanix-ahv/sbin/virt-what-cpuid-helper b/tests/nutanix-ahv/sbin/virt-what-cpuid-helper
e10a2d
new file mode 100755
e10a2d
index 0000000..f52a9d7
e10a2d
--- /dev/null
e10a2d
+++ b/tests/nutanix-ahv/sbin/virt-what-cpuid-helper
e10a2d
@@ -0,0 +1,2 @@
e10a2d
+#!/bin/sh -
e10a2d
+echo KVMKVMKVM
e10a2d
diff --git a/tests/nutanix-ahv/test.sh b/tests/nutanix-ahv/test.sh
e10a2d
new file mode 100755
e10a2d
index 0000000..3d934b2
e10a2d
--- /dev/null
e10a2d
+++ b/tests/nutanix-ahv/test.sh
e10a2d
@@ -0,0 +1,32 @@
e10a2d
+# Test for Nutanix AHV
e10a2d
+# Copyright (C) 2019 Red Hat Inc.
e10a2d
+#
e10a2d
+# This program is free software; you can redistribute it and/or modify
e10a2d
+# it under the terms of the GNU General Public License as published by
e10a2d
+# the Free Software Foundation; either version 2 of the License, or
e10a2d
+# (at your option) any later version.
e10a2d
+#
e10a2d
+# This program is distributed in the hope that it will be useful,
e10a2d
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
e10a2d
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
e10a2d
+# GNU General Public License for more details.
e10a2d
+#
e10a2d
+# You should have received a copy of the GNU General Public License
e10a2d
+# along with this program; if not, write to the Free Software
e10a2d
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
e10a2d
+
e10a2d
+output="$(PATH=../..:$PATH virt-what --test-root=. 2>&1)"
e10a2d
+expected="nutanix_ahv"
e10a2d
+
e10a2d
+if [ "$output" != "$expected" ]; then
e10a2d
+    echo "$0: test failed because output did not match expected"
e10a2d
+    echo "Expected output was:"
e10a2d
+    echo "----------------------------------------"
e10a2d
+    echo "$expected"
e10a2d
+    echo "----------------------------------------"
e10a2d
+    echo "But the actual output of the program was:"
e10a2d
+    echo "----------------------------------------"
e10a2d
+    echo "$output"
e10a2d
+    echo "----------------------------------------"
e10a2d
+    exit 1
e10a2d
+fi
e10a2d
diff --git a/virt-what.in b/virt-what.in
e10a2d
index f685461..9eafa05 100644
e10a2d
--- a/virt-what.in
e10a2d
+++ b/virt-what.in
e10a2d
@@ -1,6 +1,6 @@
e10a2d
 #!/bin/sh -
e10a2d
 # @configure_input@
e10a2d
-# Copyright (C) 2008-2017 Red Hat Inc.
e10a2d
+# Copyright (C) 2008-2019 Red Hat Inc.
e10a2d
 #
e10a2d
 # This program is free software; you can redistribute it and/or modify
e10a2d
 # it under the terms of the GNU General Public License as published by
e10a2d
@@ -220,6 +220,14 @@ if echo "$dmi" | grep -q 'Vendor: Parallels'; then
e10a2d
     skip_qemu_kvm=true
e10a2d
 fi
e10a2d
 
e10a2d
+# Check for Nutanix AHV.
e10a2d
+# This is sufficiently different from KVM and has Viridian extensions,
e10a2d
+# so skip the KVM test.
e10a2d
+if echo "$dmi" | grep -q 'Manufacturer: Nutanix'; then
e10a2d
+    echo nutanix_ahv
e10a2d
+    skip_qemu_kvm=true
e10a2d
+fi
e10a2d
+
e10a2d
 # Check for oVirt/RHEV.
e10a2d
 if echo "$dmi" | grep -q 'Manufacturer: oVirt'; then
e10a2d
     echo ovirt
e10a2d
diff --git a/virt-what.pod b/virt-what.pod
e10a2d
index 5a0bdfc..ea5cb77 100644
e10a2d
--- a/virt-what.pod
e10a2d
+++ b/virt-what.pod
e10a2d
@@ -177,6 +177,12 @@ is lkvm (a.k.a kvmtool).
e10a2d
 
e10a2d
 Status: contributed by Andrew Jones
e10a2d
 
e10a2d
+=item B<nutanix_ahv>
e10a2d
+
e10a2d
+The guest is running inside Nutanix Acropolis Hypervisor (AHV).
e10a2d
+
e10a2d
+Status: confirmed by RWMJ.
e10a2d
+
e10a2d
 =item B<openvz>
e10a2d
 
e10a2d
 The guest appears to be running inside an OpenVZ or Virtuozzo
e10a2d
-- 
cc91b2
2.31.1
e10a2d