aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Ellerman <mpe@ellerman.id.au>2018-01-16 06:17:18 -0500
committerMichael Ellerman <mpe@ellerman.id.au>2018-01-17 07:30:21 -0500
commit236003e6b5443c45c18e613d2b0d776a9f87540e (patch)
tree9bef6af7bd651cff92484097cbc43cebbeee253a
parentfd6e440f20b1a4304553775fc55938848ff617c9 (diff)
powerpc/64s: Allow control of RFI flush via debugfs
Expose the state of the RFI flush (enabled/disabled) via debugfs, and allow it to be enabled/disabled at runtime. eg: $ cat /sys/kernel/debug/powerpc/rfi_flush 1 $ echo 0 > /sys/kernel/debug/powerpc/rfi_flush $ cat /sys/kernel/debug/powerpc/rfi_flush 0 Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Reviewed-by: Nicholas Piggin <npiggin@gmail.com>
-rw-r--r--arch/powerpc/kernel/setup_64.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index 624d2a62d05d..e67413f4a8f0 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -38,6 +38,7 @@
38#include <linux/memory.h> 38#include <linux/memory.h>
39#include <linux/nmi.h> 39#include <linux/nmi.h>
40 40
41#include <asm/debugfs.h>
41#include <asm/io.h> 42#include <asm/io.h>
42#include <asm/kdump.h> 43#include <asm/kdump.h>
43#include <asm/prom.h> 44#include <asm/prom.h>
@@ -902,6 +903,35 @@ void __init setup_rfi_flush(enum l1d_flush_type types, bool enable)
902 rfi_flush_enable(enable); 903 rfi_flush_enable(enable);
903} 904}
904 905
906#ifdef CONFIG_DEBUG_FS
907static int rfi_flush_set(void *data, u64 val)
908{
909 if (val == 1)
910 rfi_flush_enable(true);
911 else if (val == 0)
912 rfi_flush_enable(false);
913 else
914 return -EINVAL;
915
916 return 0;
917}
918
919static int rfi_flush_get(void *data, u64 *val)
920{
921 *val = rfi_flush ? 1 : 0;
922 return 0;
923}
924
925DEFINE_SIMPLE_ATTRIBUTE(fops_rfi_flush, rfi_flush_get, rfi_flush_set, "%llu\n");
926
927static __init int rfi_flush_debugfs_init(void)
928{
929 debugfs_create_file("rfi_flush", 0600, powerpc_debugfs_root, NULL, &fops_rfi_flush);
930 return 0;
931}
932device_initcall(rfi_flush_debugfs_init);
933#endif
934
905ssize_t cpu_show_meltdown(struct device *dev, struct device_attribute *attr, char *buf) 935ssize_t cpu_show_meltdown(struct device *dev, struct device_attribute *attr, char *buf)
906{ 936{
907 if (rfi_flush) 937 if (rfi_flush)