--- /dev/null
+From 269777aa530f3438ec1781586cdac0b5fe47b061 Mon Sep 17 00:00:00 2001
+From: Abel Vesa <abelvesa@linux.com>
+Date: Wed, 15 Aug 2018 00:26:00 +0300
+Subject: cpu/hotplug: Non-SMP machines do not make use of booted_once
+
+From: Abel Vesa <abelvesa@linux.com>
+
+commit 269777aa530f3438ec1781586cdac0b5fe47b061 upstream.
+
+Commit 0cc3cd21657b ("cpu/hotplug: Boot HT siblings at least once")
+breaks non-SMP builds.
+
+[ I suspect the 'bool' fields should just be made to be bitfields and be
+ exposed regardless of configuration, but that's a separate cleanup
+ that I'll leave to the owners of this file for later. - Linus ]
+
+Fixes: 0cc3cd21657b ("cpu/hotplug: Boot HT siblings at least once")
+Cc: Dave Hansen <dave.hansen@intel.com>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Cc: Tony Luck <tony.luck@intel.com>
+Signed-off-by: Abel Vesa <abelvesa@linux.com>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ kernel/cpu.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/kernel/cpu.c
++++ b/kernel/cpu.c
+@@ -2279,6 +2279,8 @@ void __init boot_cpu_init(void)
+ */
+ void __init boot_cpu_hotplug_init(void)
+ {
++#ifdef CONFIG_SMP
+ this_cpu_write(cpuhp_state.booted_once, true);
++#endif
+ this_cpu_write(cpuhp_state.state, CPUHP_ONLINE);
+ }
x86-mm-kmmio-make-the-tracer-robust-against-l1tf.patch
tools-headers-synchronise-x86-cpufeatures.h-for-l1tf-additions.patch
x86-microcode-allow-late-microcode-loading-with-smt-disabled.patch
+x86-smp-fix-non-smp-broken-build-due-to-redefinition-of-apic_id_is_primary_thread.patch
+cpu-hotplug-non-smp-machines-do-not-make-use-of-booted_once.patch
+x86-init-fix-build-with-config_swap-n.patch
+x86-speculation-l1tf-unbreak-__have_arch_pfn_modify_allowed-architectures.patch
--- /dev/null
+From 792adb90fa724ce07c0171cbc96b9215af4b1045 Mon Sep 17 00:00:00 2001
+From: Vlastimil Babka <vbabka@suse.cz>
+Date: Tue, 14 Aug 2018 20:50:47 +0200
+Subject: x86/init: fix build with CONFIG_SWAP=n
+
+From: Vlastimil Babka <vbabka@suse.cz>
+
+commit 792adb90fa724ce07c0171cbc96b9215af4b1045 upstream.
+
+The introduction of generic_max_swapfile_size and arch-specific versions has
+broken linking on x86 with CONFIG_SWAP=n due to undefined reference to
+'generic_max_swapfile_size'. Fix it by compiling the x86-specific
+max_swapfile_size() only with CONFIG_SWAP=y.
+
+Reported-by: Tomas Pruzina <pruzinat@gmail.com>
+Fixes: 377eeaa8e11f ("x86/speculation/l1tf: Limit swap file size to MAX_PA/2")
+Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
+Cc: stable@vger.kernel.org
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/x86/mm/init.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/arch/x86/mm/init.c
++++ b/arch/x86/mm/init.c
+@@ -883,6 +883,7 @@ void update_cache_mode_entry(unsigned en
+ __pte2cachemode_tbl[entry] = cache;
+ }
+
++#ifdef CONFIG_SWAP
+ unsigned long max_swapfile_size(void)
+ {
+ unsigned long pages;
+@@ -903,3 +904,4 @@ unsigned long max_swapfile_size(void)
+ }
+ return pages;
+ }
++#endif
--- /dev/null
+From d0055f351e647f33f3b0329bff022213bf8aa085 Mon Sep 17 00:00:00 2001
+From: Vlastimil Babka <vbabka@suse.cz>
+Date: Tue, 14 Aug 2018 23:38:57 +0200
+Subject: x86/smp: fix non-SMP broken build due to redefinition of apic_id_is_primary_thread
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Vlastimil Babka <vbabka@suse.cz>
+
+commit d0055f351e647f33f3b0329bff022213bf8aa085 upstream.
+
+The function has an inline "return false;" definition with CONFIG_SMP=n
+but the "real" definition is also visible leading to "redefinition of
+‘apic_id_is_primary_thread’" compiler error.
+
+Guard it with #ifdef CONFIG_SMP
+
+Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
+Fixes: 6a4d2657e048 ("x86/smp: Provide topology_is_primary_thread()")
+Cc: stable@vger.kernel.org
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/x86/kernel/apic/apic.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/arch/x86/kernel/apic/apic.c
++++ b/arch/x86/kernel/apic/apic.c
+@@ -2094,6 +2094,7 @@ static int cpuid_to_apicid[] = {
+ [0 ... NR_CPUS - 1] = -1,
+ };
+
++#ifdef CONFIG_SMP
+ /**
+ * apic_id_is_primary_thread - Check whether APIC ID belongs to a primary thread
+ * @id: APIC ID to check
+@@ -2108,6 +2109,7 @@ bool apic_id_is_primary_thread(unsigned
+ mask = (1U << (fls(smp_num_siblings) - 1)) - 1;
+ return !(apicid & mask);
+ }
++#endif
+
+ /*
+ * Should use this API to allocate logical CPU IDs to keep nr_logical_cpuids
--- /dev/null
+From 6c26fcd2abfe0a56bbd95271fce02df2896cfd24 Mon Sep 17 00:00:00 2001
+From: Jiri Kosina <jkosina@suse.cz>
+Date: Sat, 14 Jul 2018 21:56:13 +0200
+Subject: x86/speculation/l1tf: Unbreak !__HAVE_ARCH_PFN_MODIFY_ALLOWED architectures
+
+From: Jiri Kosina <jkosina@suse.cz>
+
+commit 6c26fcd2abfe0a56bbd95271fce02df2896cfd24 upstream.
+
+pfn_modify_allowed() and arch_has_pfn_modify_check() are outside of the
+!__ASSEMBLY__ section in include/asm-generic/pgtable.h, which confuses
+assembler on archs that don't have __HAVE_ARCH_PFN_MODIFY_ALLOWED (e.g.
+ia64) and breaks build:
+
+ include/asm-generic/pgtable.h: Assembler messages:
+ include/asm-generic/pgtable.h:538: Error: Unknown opcode `static inline bool pfn_modify_allowed(unsigned long pfn,pgprot_t prot)'
+ include/asm-generic/pgtable.h:540: Error: Unknown opcode `return true'
+ include/asm-generic/pgtable.h:543: Error: Unknown opcode `static inline bool arch_has_pfn_modify_check(void)'
+ include/asm-generic/pgtable.h:545: Error: Unknown opcode `return false'
+ arch/ia64/kernel/entry.S:69: Error: `mov' does not fit into bundle
+
+Move those two static inlines into the !__ASSEMBLY__ section so that they
+don't confuse the asm build pass.
+
+Fixes: 42e4089c7890 ("x86/speculation/l1tf: Disallow non privileged high MMIO PROT_NONE mappings")
+Signed-off-by: Jiri Kosina <jkosina@suse.cz>
+Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
+Signed-off-by: Guenter Roeck <linux@roeck-us.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ include/asm-generic/pgtable.h | 24 ++++++++++++------------
+ 1 file changed, 12 insertions(+), 12 deletions(-)
+
+--- a/include/asm-generic/pgtable.h
++++ b/include/asm-generic/pgtable.h
+@@ -1055,6 +1055,18 @@ int phys_mem_access_prot_allowed(struct
+ static inline void init_espfix_bsp(void) { }
+ #endif
+
++#ifndef __HAVE_ARCH_PFN_MODIFY_ALLOWED
++static inline bool pfn_modify_allowed(unsigned long pfn, pgprot_t prot)
++{
++ return true;
++}
++
++static inline bool arch_has_pfn_modify_check(void)
++{
++ return false;
++}
++#endif /* !_HAVE_ARCH_PFN_MODIFY_ALLOWED */
++
+ #endif /* !__ASSEMBLY__ */
+
+ #ifndef io_remap_pfn_range
+@@ -1069,16 +1081,4 @@ static inline void init_espfix_bsp(void)
+ #endif
+ #endif
+
+-#ifndef __HAVE_ARCH_PFN_MODIFY_ALLOWED
+-static inline bool pfn_modify_allowed(unsigned long pfn, pgprot_t prot)
+-{
+- return true;
+-}
+-
+-static inline bool arch_has_pfn_modify_check(void)
+-{
+- return false;
+-}
+-#endif
+-
+ #endif /* _ASM_GENERIC_PGTABLE_H */