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

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