hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/arch/powerpc/include/asm/mman.h
....@@ -1,8 +1,5 @@
1
+/* SPDX-License-Identifier: GPL-2.0-or-later */
12 /*
2
- * This program is free software; you can redistribute it and/or
3
- * modify it under the terms of the GNU General Public License
4
- * as published by the Free Software Foundation; either version
5
- * 2 of the License, or (at your option) any later version.
63 */
74 #ifndef _ASM_POWERPC_MMAN_H
85 #define _ASM_POWERPC_MMAN_H
....@@ -16,10 +13,6 @@
1613 #include <linux/pkeys.h>
1714 #include <asm/cpu_has_feature.h>
1815
19
-/*
20
- * This file is included by linux/mman.h, so we can't use cacl_vm_prot_bits()
21
- * here. How important is the optimization?
22
- */
2316 static inline unsigned long arch_calc_vm_prot_bits(unsigned long prot,
2417 unsigned long pkey)
2518 {
....@@ -47,8 +40,13 @@
4740 {
4841 if (prot & ~(PROT_READ | PROT_WRITE | PROT_EXEC | PROT_SEM | PROT_SAO))
4942 return false;
50
- if ((prot & PROT_SAO) && !cpu_has_feature(CPU_FTR_SAO))
51
- return false;
43
+ if (prot & PROT_SAO) {
44
+ if (!cpu_has_feature(CPU_FTR_SAO))
45
+ return false;
46
+ if (firmware_has_feature(FW_FEATURE_LPAR) &&
47
+ !IS_ENABLED(CONFIG_PPC_PROT_SAO_LPAR))
48
+ return false;
49
+ }
5250 return true;
5351 }
5452 #define arch_validate_prot arch_validate_prot