Skip to contentSkip to conversation

powerpc: Expose TSCR via sysfs only on powernv

PATCH Applied Cyril Bur 2 participants 2 messages Feb 14, 2018 – Feb 18, 2018 PowerPC

lore
Share & tools
lore

Cyril Bur

author
#0 lore raw

PATCH 1/1 powerpc: Expose TSCR via sysfs only on powernv

The TSCR can only be accessed in hypervisor mode.

Fixes 88b5e12eeb11 ("powerpc: Expose TSCR via sysfs")
---
 arch/powerpc/kernel/sysfs.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
arch/powerpc/kernel/sysfs.c +4 -2
index 5a8bfee6e187..04d0bbd7a1dd 100644
@@ -788,7 +788,8 @@ static int register_cpu_online(unsigned int cpu)
 	if (cpu_has_feature(CPU_FTR_PPCAS_ARCH_V2))
 		device_create_file(s, &dev_attr_pir);
 
-	if (cpu_has_feature(CPU_FTR_ARCH_206))
+	if (cpu_has_feature(CPU_FTR_ARCH_206) &&
+		!firmware_has_feature(FW_FEATURE_LPAR))
 		device_create_file(s, &dev_attr_tscr);
 #endif /* CONFIG_PPC64 */
 
@@ -873,7 +874,8 @@ static int unregister_cpu_online(unsigned int cpu)
 	if (cpu_has_feature(CPU_FTR_PPCAS_ARCH_V2))
 		device_remove_file(s, &dev_attr_pir);
 
-	if (cpu_has_feature(CPU_FTR_ARCH_206))
+	if (cpu_has_feature(CPU_FTR_ARCH_206) &&
+		!firmware_has_feature(FW_FEATURE_LPAR))
 		device_remove_file(s, &dev_attr_tscr);
 #endif /* CONFIG_PPC64 */
 
Signature · 1 line
2.16.1