Thread (6 messages) 6 messages, 1 author, 6d ago

[PATCH v6 3/5] KVM: PPC: selftests: Add helper for checking if running nested

flat view
COOLING6d REVIEWED: 1 (0M)

From: "Ritesh Harjani (IBM)" <ritesh.list@gmail.com>
Date: 2026-10-05 03:47:58
Also in: kvm, lkml
Subsystem: kernel selftest framework, kernel virtual machine (kvm), the rest · Maintainers: Shuah Khan, Shuah Khan, Paolo Bonzini, Linus Torvalds

Revision v6 of 5 in this series; 1 review trailer.

Revisions (5)
  1. v3 [diff vs current]
  2. v4 [diff vs current]
  3. v5 [diff vs current]
  4. v6 current
  5. v7 [diff vs current]
access_tracking_perf_test needs detection if we are running nested guests.
This adds the needed helper.

Tested-by: Anushree Mathur <redacted>
Signed-off-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
---
 tools/testing/selftests/kvm/include/powerpc/processor.h | 7 +++++++
 1 file changed, 7 insertions(+)
diff --git a/tools/testing/selftests/kvm/include/powerpc/processor.h b/tools/testing/selftests/kvm/include/powerpc/processor.h
index f0ee21a8e2d4..a46f6828991c 100644
--- a/tools/testing/selftests/kvm/include/powerpc/processor.h
+++ b/tools/testing/selftests/kvm/include/powerpc/processor.h
@@ -6,6 +6,8 @@
 #define SELFTEST_KVM_PROCESSOR_H
 
 #include <linux/compiler.h>
+#include <unistd.h>
+
 #include "ppc_asm.h"
 #include "kvm_util_types.h"
 
@@ -36,4 +38,9 @@ static inline void cpu_relax(void)
 	asm volatile("" ::: "memory");
 }
 
+static inline bool is_pseries_lpar(void)
+{
+	return !access("/proc/device-tree/rtas/ibm,hypertas-functions", F_OK);
+}
+
 #endif
-- 
2.39.5

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help