.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * Copyright 2016, Michael Ellerman, IBM Corp. |
---|
3 | | - * Licensed under GPLv2. |
---|
4 | 4 | */ |
---|
5 | 5 | |
---|
6 | 6 | #include <stdio.h> |
---|
7 | 7 | #include <stdlib.h> |
---|
8 | 8 | #include <string.h> |
---|
9 | 9 | #include <sys/mman.h> |
---|
| 10 | +#include <unistd.h> |
---|
10 | 11 | |
---|
11 | 12 | #include <asm/cputable.h> |
---|
12 | 13 | |
---|
.. | .. |
---|
18 | 19 | { |
---|
19 | 20 | char *p; |
---|
20 | 21 | |
---|
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); |
---|
23 | 29 | |
---|
24 | 30 | /* |
---|
25 | 31 | * Ensure we can ask for PROT_SAO. |
---|