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

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