Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Suchanek <msuchanek@suse.de>2018-01-12 16:16:22 +0100
committerMichal Suchanek <msuchanek@suse.de>2018-01-12 16:16:57 +0100
commite4f56773447d9bba1af92237f08c31163336349c (patch)
treea195277d0fea3f0ff567ea3e1d14acfc9328d7e1
parent7b8dd8ea6a3c5b47ec9ff84c6c78fdd4fe5c0d2a (diff)
powerpc/rfi-flush: Move the logic to avoid a redo into the
sysfs code (bsc#1068032).
-rw-r--r--patches.arch/powerpc-rfi-flush-Move-the-logic-to-avoid-a-redo-int.patch100
-rw-r--r--series.conf1
2 files changed, 101 insertions, 0 deletions
diff --git a/patches.arch/powerpc-rfi-flush-Move-the-logic-to-avoid-a-redo-int.patch b/patches.arch/powerpc-rfi-flush-Move-the-logic-to-avoid-a-redo-int.patch
new file mode 100644
index 0000000000..8467235e49
--- /dev/null
+++ b/patches.arch/powerpc-rfi-flush-Move-the-logic-to-avoid-a-redo-int.patch
@@ -0,0 +1,100 @@
+From 827349ae5c8021af12abc581d0d4c65547afc1ce Mon Sep 17 00:00:00 2001
+From: Michael Ellerman <mpe@ellerman.id.au>
+Date: Wed, 10 Jan 2018 22:47:40 +1100
+Subject: [PATCH 1/2] powerpc/rfi-flush: Move the logic to avoid a redo into
+ the sysfs code
+
+Patch-mainline: no, under development
+References: bsc#1068032
+
+Add /sys/devices/system/cpu/rfi_flush which can report and patch the rfi
+flushes at runtime.
+
+rfi_flush_enable() includes a check to see if we're already
+enabled (or disabled), and in that case does nothing.
+
+But that means calling setup_rfi_flush() a 2nd time doesn't actually
+work, which is a bit confusing.
+
+Move that check into the sysfs code, where it really belongs.
+
+Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
+[mauricfo: sysfs.c hunk 1: update context lines]
+Signed-off-by: Mauricio Faria de Oliveira <mauricfo@linux.vnet.ibm.com>
+Acked-by: Michal Suchanek <msuchanek@suse.de>
+---
+ arch/powerpc/kernel/setup_64.c | 3 ---
+ arch/powerpc/kernel/sysfs.c | 43 ++++++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 43 insertions(+), 3 deletions(-)
+
+diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
+index 7e34cbdd5080..525649400965 100644
+--- a/arch/powerpc/kernel/setup_64.c
++++ b/arch/powerpc/kernel/setup_64.c
+@@ -807,9 +807,6 @@ static void do_nothing(void *unused)
+
+ void rfi_flush_enable(bool enable)
+ {
+- if (rfi_flush == enable)
+- return;
+-
+ if (enable) {
+ do_rfi_flush_fixups(enabled_flush_types);
+ on_each_cpu(do_nothing, NULL, 1);
+diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c
+index 4437c70c7c2b..c6292d050a01 100644
+--- a/arch/powerpc/kernel/sysfs.c
++++ b/arch/powerpc/kernel/sysfs.c
+@@ -496,6 +496,49 @@ static DEVICE_ATTR(spurr, 0400, show_spurr, NULL);
+ static DEVICE_ATTR(purr, 0400, show_purr, store_purr);
+ static DEVICE_ATTR(pir, 0400, show_pir, NULL);
+
++#ifdef CONFIG_PPC_BOOK3S_64
++extern bool rfi_flush;
++static ssize_t show_rfi_flush(struct device *dev,
++ struct device_attribute *attr, char *buf)
++{
++ return sprintf(buf, "%d\n", rfi_flush ? 1 : 0);
++}
++
++static ssize_t __used store_rfi_flush(struct device *dev,
++ struct device_attribute *attr, const char *buf,
++ size_t count)
++{
++ bool enable;
++ int val;
++ int ret = 0;
++
++ ret = sscanf(buf, "%d", &val);
++ if (ret != 1)
++ return -EINVAL;
++
++ if (val == 1)
++ enable = true;
++ else if (val == 0)
++ enable = false;
++ else
++ return -EINVAL;
++
++ /* Only do anything if we're changing state */
++ if (enable != rfi_flush)
++ rfi_flush_enable(enable);
++
++ return count;
++}
++
++static DEVICE_ATTR(rfi_flush, 0600,
++ show_rfi_flush, store_rfi_flush);
++
++static void sysfs_create_rfi_flush(void)
++{
++ device_create_file(cpu_subsys.dev_root, &dev_attr_rfi_flush);
++}
++#endif /* CONFIG_PPC_BOOK3S_64 */
++
+ /*
+ * This is the system wide DSCR register default value. Any
+ * change to this default value through the sysfs interface
+--
+2.13.6
+
diff --git a/series.conf b/series.conf
index 565275699d..4575022441 100644
--- a/series.conf
+++ b/series.conf
@@ -1530,6 +1530,7 @@
patches.arch/powerpc-64s-Support-disabling-RFI-flush-with-no_rfi_.patch
patches.arch/powerpc-pseries-Query-hypervisor-for-RFI-flush-setti.patch
patches.arch/powerpc-powernv-Check-device-tree-for-RFI-flush-sett.patch
+ patches.arch/powerpc-rfi-flush-Move-the-logic-to-avoid-a-redo-int.patch
# bsc#1075746
patches.arch/powerpc-tm-Flush-TM-only-if-CPU-has-TM-feature.patch