| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-or-later */ |
|---|
| 1 | 2 | /* |
|---|
| 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. |
|---|
| 6 | 3 | */ |
|---|
| 7 | 4 | #ifndef _ASM_POWERPC_MMAN_H |
|---|
| 8 | 5 | #define _ASM_POWERPC_MMAN_H |
|---|
| .. | .. |
|---|
| 16 | 13 | #include <linux/pkeys.h> |
|---|
| 17 | 14 | #include <asm/cpu_has_feature.h> |
|---|
| 18 | 15 | |
|---|
| 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 | | - */ |
|---|
| 23 | 16 | static inline unsigned long arch_calc_vm_prot_bits(unsigned long prot, |
|---|
| 24 | 17 | unsigned long pkey) |
|---|
| 25 | 18 | { |
|---|
| .. | .. |
|---|
| 47 | 40 | { |
|---|
| 48 | 41 | if (prot & ~(PROT_READ | PROT_WRITE | PROT_EXEC | PROT_SEM | PROT_SAO)) |
|---|
| 49 | 42 | 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 | + } |
|---|
| 52 | 50 | return true; |
|---|
| 53 | 51 | } |
|---|
| 54 | 52 | #define arch_validate_prot arch_validate_prot |
|---|