[PATCH v6 3/5] KVM: PPC: selftests: Add helper for checking if running nested
From: Ritesh Harjani (IBM)
Date: Sun Oct 04 2026 - 23:48:58 EST
access_tracking_perf_test needs detection if we are running nested guests.
This adds the needed helper.
Tested-by: Anushree Mathur <anushree.mathur@xxxxxxxxxxxxx>
Signed-off-by: Ritesh Harjani (IBM) <ritesh.list@xxxxxxxxx>
---
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