--- /dev/null
+From 236003e6b5443c45c18e613d2b0d776a9f87540e Mon Sep 17 00:00:00 2001
+From: Michael Ellerman <mpe@ellerman.id.au>
+Date: Tue, 16 Jan 2018 22:17:18 +1100
+Subject: powerpc/64s: Allow control of RFI flush via debugfs
+
+From: Michael Ellerman <mpe@ellerman.id.au>
+
+commit 236003e6b5443c45c18e613d2b0d776a9f87540e upstream.
+
+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>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/powerpc/kernel/setup_64.c | 30 ++++++++++++++++++++++++++++++
+ 1 file changed, 30 insertions(+)
+
+--- a/arch/powerpc/kernel/setup_64.c
++++ b/arch/powerpc/kernel/setup_64.c
+@@ -38,6 +38,7 @@
+ #include <linux/memory.h>
+ #include <linux/nmi.h>
+
++#include <asm/debugfs.h>
+ #include <asm/io.h>
+ #include <asm/kdump.h>
+ #include <asm/prom.h>
+@@ -885,6 +886,35 @@ void __init setup_rfi_flush(enum l1d_flu
+ rfi_flush_enable(enable);
+ }
+
++#ifdef CONFIG_DEBUG_FS
++static int rfi_flush_set(void *data, u64 val)
++{
++ if (val == 1)
++ rfi_flush_enable(true);
++ else if (val == 0)
++ rfi_flush_enable(false);
++ else
++ return -EINVAL;
++
++ return 0;
++}
++
++static int rfi_flush_get(void *data, u64 *val)
++{
++ *val = rfi_flush ? 1 : 0;
++ return 0;
++}
++
++DEFINE_SIMPLE_ATTRIBUTE(fops_rfi_flush, rfi_flush_get, rfi_flush_set, "%llu\n");
++
++static __init int rfi_flush_debugfs_init(void)
++{
++ debugfs_create_file("rfi_flush", 0600, powerpc_debugfs_root, NULL, &fops_rfi_flush);
++ return 0;
++}
++device_initcall(rfi_flush_debugfs_init);
++#endif
++
+ ssize_t cpu_show_meltdown(struct device *dev, struct device_attribute *attr, char *buf)
+ {
+ if (rfi_flush)
--- /dev/null
+From fd6e440f20b1a4304553775fc55938848ff617c9 Mon Sep 17 00:00:00 2001
+From: Michael Ellerman <mpe@ellerman.id.au>
+Date: Tue, 16 Jan 2018 21:20:05 +1100
+Subject: powerpc/64s: Wire up cpu_show_meltdown()
+
+From: Michael Ellerman <mpe@ellerman.id.au>
+
+commit fd6e440f20b1a4304553775fc55938848ff617c9 upstream.
+
+The recent commit 87590ce6e373 ("sysfs/cpu: Add vulnerability folder")
+added a generic folder and set of files for reporting information on
+CPU vulnerabilities. One of those was for meltdown:
+
+ /sys/devices/system/cpu/vulnerabilities/meltdown
+
+This commit wires up that file for 64-bit Book3S powerpc.
+
+For now we default to "Vulnerable" unless the RFI flush is enabled.
+That may not actually be true on all hardware, further patches will
+refine the reporting based on the CPU/platform etc. But for now we
+default to being pessimists.
+
+Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/powerpc/Kconfig | 1 +
+ arch/powerpc/kernel/setup_64.c | 8 ++++++++
+ 2 files changed, 9 insertions(+)
+
+--- a/arch/powerpc/Kconfig
++++ b/arch/powerpc/Kconfig
+@@ -164,6 +164,7 @@ config PPC
+ select GENERIC_CLOCKEVENTS_BROADCAST if SMP
+ select GENERIC_CMOS_UPDATE
+ select GENERIC_CPU_AUTOPROBE
++ select GENERIC_CPU_VULNERABILITIES if PPC_BOOK3S_64
+ select GENERIC_IRQ_SHOW
+ select GENERIC_IRQ_SHOW_LEVEL
+ select GENERIC_SMP_IDLE_THREAD
+--- a/arch/powerpc/kernel/setup_64.c
++++ b/arch/powerpc/kernel/setup_64.c
+@@ -884,4 +884,12 @@ void __init setup_rfi_flush(enum l1d_flu
+ if (!no_rfi_flush)
+ rfi_flush_enable(enable);
+ }
++
++ssize_t cpu_show_meltdown(struct device *dev, struct device_attribute *attr, char *buf)
++{
++ if (rfi_flush)
++ return sprintf(buf, "Mitigation: RFI Flush\n");
++
++ return sprintf(buf, "Vulnerable\n");
++}
+ #endif /* CONFIG_PPC_BOOK3S_64 */
--- /dev/null
+From 4cc90b4cc3d4955f79eae4f7f9d64e67e17b468e Mon Sep 17 00:00:00 2001
+From: "Liu, Changcheng" <changcheng.liu@intel.com>
+Date: Thu, 14 Dec 2017 15:32:48 -0800
+Subject: scripts/faddr2line: fix CROSS_COMPILE unset error
+
+From: Liu, Changcheng <changcheng.liu@intel.com>
+
+commit 4cc90b4cc3d4955f79eae4f7f9d64e67e17b468e upstream.
+
+faddr2line hit var unbound error when CROSS_COMPILE isn't set since
+nounset option is set in bash script.
+
+Link: http://lkml.kernel.org/r/20171206013022.GA83929@sofia
+Fixes: 95a879825419 ("scripts/faddr2line: extend usage on generic arch")
+Signed-off-by: Liu Changcheng <changcheng.liu@intel.com>
+Reported-by: Richard Weinberger <richard.weinberger@gmail.com>
+Reviewed-by: Richard Weinberger <richard@nod.at>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Cc: Philippe Ombredanne <pombredanne@nexb.com>
+Cc: NeilBrown <neilb@suse.com>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ scripts/faddr2line | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+--- a/scripts/faddr2line
++++ b/scripts/faddr2line
+@@ -44,10 +44,10 @@
+ set -o errexit
+ set -o nounset
+
+-READELF="${CROSS_COMPILE}readelf"
+-ADDR2LINE="${CROSS_COMPILE}addr2line"
+-SIZE="${CROSS_COMPILE}size"
+-NM="${CROSS_COMPILE}nm"
++READELF="${CROSS_COMPILE:-}readelf"
++ADDR2LINE="${CROSS_COMPILE:-}addr2line"
++SIZE="${CROSS_COMPILE:-}size"
++NM="${CROSS_COMPILE:-}nm"
+
+ command -v awk >/dev/null 2>&1 || die "awk isn't installed"
+ command -v ${READELF} >/dev/null 2>&1 || die "readelf isn't installed"
--- /dev/null
+scripts-faddr2line-fix-cross_compile-unset-error.patch
+powerpc-64s-wire-up-cpu_show_meltdown.patch
+powerpc-64s-allow-control-of-rfi-flush-via-debugfs.patch
--- /dev/null
+powerpc-bpf-jit-disable-classic-bpf-jit-on-ppc64le.patch
+powerpc-64-fix-flush_-d-i-cache_range-called-from-modules.patch
+powerpc-fix-vsx-enabling-flushing-to-also-test-msr_fp-and-msr_vec.patch
+powerpc-simplify-module-toc-handling.patch
+powerpc-pseries-add-h_get_cpu_characteristics-flags-wrapper.patch
+powerpc-64-add-macros-for-annotating-the-destination-of-rfid-hrfid.patch
+powerpc-64s-simple-rfi-macro-conversions.patch
+powerpc-64-convert-fast_exception_return-to-use-rfi_to_user-kernel.patch
+powerpc-64-convert-the-syscall-exit-path-to-use-rfi_to_user-kernel.patch
+powerpc-64s-convert-slb_miss_common-to-use-rfi_to_user-kernel.patch
+powerpc-64s-add-support-for-rfi-flush-of-l1-d-cache.patch
+powerpc-64s-support-disabling-rfi-flush-with-no_rfi_flush-and-nopti.patch
+powerpc-pseries-query-hypervisor-for-rfi-flush-settings.patch
+powerpc-powernv-check-device-tree-for-rfi-flush-settings.patch
+powerpc-64s-wire-up-cpu_show_meltdown.patch
+powerpc-64s-allow-control-of-rfi-flush-via-debugfs.patch
--- /dev/null
+powerpc-pseries-add-h_get_cpu_characteristics-flags-wrapper.patch
+powerpc-64-add-macros-for-annotating-the-destination-of-rfid-hrfid.patch
+powerpc-64-convert-fast_exception_return-to-use-rfi_to_user-kernel.patch
+powerpc-64-convert-the-syscall-exit-path-to-use-rfi_to_user-kernel.patch
+powerpc-64s-convert-slb_miss_common-to-use-rfi_to_user-kernel.patch
+powerpc-64s-add-support-for-rfi-flush-of-l1-d-cache.patch
+powerpc-64s-support-disabling-rfi-flush-with-no_rfi_flush-and-nopti.patch
+powerpc-pseries-query-hypervisor-for-rfi-flush-settings.patch
+powerpc-powernv-check-device-tree-for-rfi-flush-settings.patch
+powerpc-64s-wire-up-cpu_show_meltdown.patch
+powerpc-64s-allow-control-of-rfi-flush-via-debugfs.patch