Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc/64s: Disallow PROT_SAO in LPARs by default

Since migration of guests using SAO to ISA 3.1 hosts may cause issues,
disable PROT_SAO in LPARs by default and introduce a new Kconfig option
PPC_PROT_SAO_LPAR to allow users to enable it if desired.

Signed-off-by: Shawn Anastasio <shawn@anastas.io>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20200821185558.35561-3-shawn@anastas.io

authored by

Shawn Anastasio and committed by
Michael Ellerman
9b725a90 12564485

+19 -2
+12
arch/powerpc/Kconfig
··· 860 860 861 861 If unsure, say N here. 862 862 863 + config PPC_PROT_SAO_LPAR 864 + bool "Support PROT_SAO mappings in LPARs" 865 + depends on PPC_BOOK3S_64 866 + help 867 + This option adds support for PROT_SAO mappings from userspace 868 + inside LPARs on supported CPUs. 869 + 870 + This may cause issues when performing guest migration from 871 + a CPU that supports SAO to one that does not. 872 + 873 + If unsure, say N here. 874 + 863 875 config PPC_COPRO_BASE 864 876 bool 865 877
+7 -2
arch/powerpc/include/asm/mman.h
··· 40 40 { 41 41 if (prot & ~(PROT_READ | PROT_WRITE | PROT_EXEC | PROT_SEM | PROT_SAO)) 42 42 return false; 43 - if ((prot & PROT_SAO) && !cpu_has_feature(CPU_FTR_SAO)) 44 - 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 + } 45 50 return true; 46 51 } 47 52 #define arch_validate_prot arch_validate_prot