forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
kernel/tools/testing/selftests/powerpc/mm/prot_sao.c
....@@ -1,12 +1,13 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Copyright 2016, Michael Ellerman, IBM Corp.
3
- * Licensed under GPLv2.
44 */
55
66 #include <stdio.h>
77 #include <stdlib.h>
88 #include <string.h>
99 #include <sys/mman.h>
10
+#include <unistd.h>
1011
1112 #include <asm/cputable.h>
1213
....@@ -18,8 +19,13 @@
1819 {
1920 char *p;
2021
21
- /* 2.06 or later should support SAO */
22
- SKIP_IF(!have_hwcap(PPC_FEATURE_ARCH_2_06));
22
+ /*
23
+ * SAO was introduced in 2.06 and removed in 3.1. It's disabled in
24
+ * guests/LPARs by default, so also skip if we are running in a guest.
25
+ */
26
+ SKIP_IF(!have_hwcap(PPC_FEATURE_ARCH_2_06) ||
27
+ have_hwcap2(PPC_FEATURE2_ARCH_3_1) ||
28
+ access("/proc/device-tree/rtas/ibm,hypertas-functions", F_OK) == 0);
2329
2430 /*
2531 * Ensure we can ask for PROT_SAO.