File util-linux-lscpu-cleanup-ppc-virtualization.patch of Package util-linux.2662

From 79738105b1d31115b7e9f85351e074ef250f31b7 Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Fri, 6 Feb 2015 11:23:40 +0100
Subject: [PATCH] lscpu: cleanup ppc virtualization detection

References: https://bugzilla.redhat.com/show_bug.cgi?id=1151604
Signed-off-by: Karel Zak <kzak@redhat.com>
---
 sys-utils/lscpu.c | 33 +++++++++++++--------------------
 1 file changed, 13 insertions(+), 20 deletions(-)

diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c
index 2a616e2..aeec37c 100644
--- a/sys-utils/lscpu.c
+++ b/sys-utils/lscpu.c
@@ -623,22 +623,19 @@ read_hypervisor_powerpc(struct lscpu_desc *desc)
 {
 	assert(!desc->hyper);
 
-	/* powerpc:
-	 * IBM iSeries: legacy, if /proc/iSeries exists, its para-virtualized on top of OS/400
-	 * IBM pSeries: always has a hypervisor
-	 *              if partition-name is "full", its kind of "bare-metal": full-system-partition
-	 *              otherwise its some partition created by Hardware Management Console
-	 *              in any case, its always some sort of HVM
-	 *
-	 *              Note that pSeries could also be emulated by qemu and it's
-	 *              indicated by 'qemu,pseries" in /compatible
-	 *
-	 * KVM: "linux,kvm" in /hypervisor/compatible indicates a KVM guest
-	 * Xen: not in use, not detected
-	 */
+	 /* IBM iSeries: legacy, para-virtualized on top of OS/400 */
 	if (path_exist("/proc/iSeries")) {
 		desc->hyper = HYPER_OS400;
 		desc->virtype = VIRT_PARA;
+
+	/* PowerNV (POWER Non-Virtualized, bare-metal) */
+	} else if (path_exist(_PATH_PROC_DEVICETREE "/compatible")) {
+		if (is_compatible(_PATH_PROC_DEVICETREE "/compatible", "ibm,powernv")) {
+			desc->hyper = HYPER_KVM;
+			desc->virtype = VIRT_PARA;
+		}
+
+	/* PowerVM (IBM's proprietary hypervisor, aka pHyp */
 	} else if (path_exist(_PATH_PROC_DEVICETREE "/ibm,partition-name")
 		   && path_exist(_PATH_PROC_DEVICETREE "/hmc-managed?")
 		   && !path_exist(_PATH_PROC_DEVICETREE "/chosen/qemu,graphic-width")) {
@@ -652,16 +649,12 @@ read_hypervisor_powerpc(struct lscpu_desc *desc)
 				desc->virtype = VIRT_NONE;
 			fclose(fd);
 		}
-	} else if (path_exist(_PATH_PROC_DEVICETREE "/hypervisor/compatible")) {
-		if (is_compatible(_PATH_PROC_DEVICETREE "/hypervisor/compatible",
-				  "linux,kvm")) {
-			desc->hyper = HYPER_KVM;
-			desc->virtype = VIRT_FULL;
-		}
+
+	/* Qemu */
 	} else if (path_exist(_PATH_PROC_DEVICETREE "/compatible")) {
 		if (is_compatible(_PATH_PROC_DEVICETREE "/compatible", "qemu,pseries")) {
 			desc->hyper = HYPER_KVM;
-			desc->virtype = VIRT_FULL;
+			desc->virtype = VIRT_PARA;
 		}
 	}
 	return desc->hyper;
-- 
2.8.1

openSUSE Build Service is sponsored by