powerpc: Expose TSCR via sysfs only on powernv

"Linux Kernel Mailing List" <[email protected]> Sat, 17 Feb 2018 17:49:15 +0000 (UTC)
Newsgroups gmane.linux.kernel.commits.head
Message-ID <[email protected]>
Web:        https://git.kernel.org/torvalds/c/c134f0d57a47b7f8704dee1cefc246f9471f3e80
Commit:     c134f0d57a47b7f8704dee1cefc246f9471f3e80
Parent:     694a20dae6efc3803740971fa9f7c86b8c8d4685
Refname:    refs/heads/master
Author:     Cyril Bur <[email protected]>
AuthorDate: Wed Feb 14 14:27:06 2018 +1100
Committer:  Michael Ellerman <[email protected]>
CommitDate: Thu Feb 15 09:54:42 2018 +1100

    powerpc: Expose TSCR via sysfs only on powernv
    
    The TSCR can only be accessed in hypervisor mode.
    
    Fixes: 88b5e12eeb11 ("powerpc: Expose TSCR via sysfs")
    Signed-off-by: Cyril Bur <[email protected]>
    Signed-off-by: Michael Ellerman <[email protected]>
---
 arch/powerpc/kernel/sysfs.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c
index 5a8bfee6e187..04d0bbd7a1dd 100644
--- a/arch/powerpc/kernel/sysfs.c
+++ b/arch/powerpc/kernel/sysfs.c
@@ -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 */
 
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html