--- /dev/null
+From 46a049dae771b95e77ac6c823330f4a60f600236 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Wed, 11 Jan 2017 14:39:44 +0100
+Subject: ALSA: hda/ca0132 - fix possible NULL pointer use
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit 46a049dae771b95e77ac6c823330f4a60f600236 upstream.
+
+gcc-7 caught what it considers a NULL pointer dereference:
+
+sound/pci/hda/patch_ca0132.c: In function 'dspio_scp.constprop':
+sound/pci/hda/patch_ca0132.c:1487:4: error: argument 1 null where non-null expected [-Werror=nonnull]
+
+This is plausible from looking at the function, as we compare 'reply'
+to NULL earlier in it. I have not tried to analyze if there are constraints
+that make it impossible to hit the bug, but adding another NULL check in
+the end kills the warning and makes the function more robust.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/pci/hda/patch_ca0132.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/sound/pci/hda/patch_ca0132.c
++++ b/sound/pci/hda/patch_ca0132.c
+@@ -1482,6 +1482,9 @@ static int dspio_scp(struct hda_codec *c
+ } else if (ret_size != reply_data_size) {
+ codec_dbg(codec, "RetLen and HdrLen .NE.\n");
+ return -EINVAL;
++ } else if (!reply) {
++ codec_dbg(codec, "NULL reply\n");
++ return -EINVAL;
+ } else {
+ *reply_len = ret_size*sizeof(unsigned int);
+ memcpy(reply, scp_reply.data, *reply_len);
--- /dev/null
+From f13d52cb3fad03c237572be2ee691e1fe2d1d7bb Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Tue, 14 Mar 2017 22:39:21 +0100
+Subject: arm64: define BUG() instruction without CONFIG_BUG
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit f13d52cb3fad03c237572be2ee691e1fe2d1d7bb upstream.
+
+This mirrors commit e9c38ceba8d9 ("ARM: 8455/1: define __BUG as
+asm(BUG_INSTR) without CONFIG_BUG") to make the behavior of
+arm64 consistent with arm and x86, and avoids lots of warnings in
+randconfig builds, such as:
+
+kernel/seccomp.c: In function '__seccomp_filter':
+kernel/seccomp.c:666:1: error: no return statement in function returning non-void [-Werror=return-type]
+
+Acked-by: Will Deacon <will.deacon@arm.com>
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/arm64/include/asm/bug.h | 35 ++++++++++++++++++++---------------
+ 1 file changed, 20 insertions(+), 15 deletions(-)
+
+--- a/arch/arm64/include/asm/bug.h
++++ b/arch/arm64/include/asm/bug.h
+@@ -20,9 +20,6 @@
+
+ #include <asm/brk-imm.h>
+
+-#ifdef CONFIG_GENERIC_BUG
+-#define HAVE_ARCH_BUG
+-
+ #ifdef CONFIG_DEBUG_BUGVERBOSE
+ #define _BUGVERBOSE_LOCATION(file, line) __BUGVERBOSE_LOCATION(file, line)
+ #define __BUGVERBOSE_LOCATION(file, line) \
+@@ -36,28 +33,36 @@
+ #define _BUGVERBOSE_LOCATION(file, line)
+ #endif
+
+-#define _BUG_FLAGS(flags) __BUG_FLAGS(flags)
++#ifdef CONFIG_GENERIC_BUG
+
+-#define __BUG_FLAGS(flags) asm volatile ( \
++#define __BUG_ENTRY(flags) \
+ ".pushsection __bug_table,\"a\"\n\t" \
+ ".align 2\n\t" \
+ "0: .long 1f - 0b\n\t" \
+ _BUGVERBOSE_LOCATION(__FILE__, __LINE__) \
+ ".short " #flags "\n\t" \
+ ".popsection\n" \
+- \
+- "1: brk %[imm]" \
+- :: [imm] "i" (BUG_BRK_IMM) \
+-)
+-
+-#define BUG() do { \
+- _BUG_FLAGS(0); \
+- unreachable(); \
++ "1: "
++#else
++#define __BUG_ENTRY(flags) ""
++#endif
++
++#define __BUG_FLAGS(flags) \
++ asm volatile ( \
++ __BUG_ENTRY(flags) \
++ "brk %[imm]" :: [imm] "i" (BUG_BRK_IMM) \
++ );
++
++
++#define BUG() do { \
++ __BUG_FLAGS(0); \
++ unreachable(); \
+ } while (0)
+
+-#define __WARN_TAINT(taint) _BUG_FLAGS(BUGFLAG_TAINT(taint))
++#define __WARN_TAINT(taint) \
++ __BUG_FLAGS(BUGFLAG_TAINT(taint))
+
+-#endif /* ! CONFIG_GENERIC_BUG */
++#define HAVE_ARCH_BUG
+
+ #include <asm-generic/bug.h>
+
--- /dev/null
+From foo@baz Fri Feb 23 16:40:21 CET 2018
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Mon, 19 Feb 2018 11:13:26 +0100
+Subject: arm64: fix warning about swapper_pg_dir overflow
+To: stable@vger.kernel.org
+Cc: Greg KH <gregkh@linuxfoundation.org>, linux-kernel@vger.kernel.org, Arnd Bergmann <arnd@arndb.de>, Will Deacon <will.deacon@arm.com>, Catalin Marinas <catalin.marinas@arm.com>, Ard Biesheuvel <ard.biesheuvel@linaro.org>, Mark Rutland <mark.rutland@arm.com>, linux-arm-kernel@lists.infradead.org
+Message-ID: <20180219101343.2922561-8-arnd@arndb.de>
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit 12f043ff2b28fa64c9123b454cbe30a8a9e1967e upstream.
+
+With 4 levels of 16KB pages, we get this warning about the fact that we are
+copying a whole page into an array that is declared as having only two pointers
+for the top level of the page table:
+
+arch/arm64/mm/mmu.c: In function 'paging_init':
+arch/arm64/mm/mmu.c:528:2: error: 'memcpy' writing 16384 bytes into a region of size 16 overflows the destination [-Werror=stringop-overflow=]
+
+This is harmless since we actually reserve a whole page in the definition of the
+array that comes from, and just the extern declaration is short. The pgdir
+is initialized to zero either way, so copying the actual entries here seems
+like the best solution.
+
+Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
+Acked-by: Mark Rutland <mark.rutland@arm.com>
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Will Deacon <will.deacon@arm.com>
+[slightly adapted to apply on 4.9]
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/arm64/mm/mmu.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/arch/arm64/mm/mmu.c
++++ b/arch/arm64/mm/mmu.c
+@@ -479,7 +479,7 @@ void __init paging_init(void)
+ * To do this we need to go via a temporary pgd.
+ */
+ cpu_replace_ttbr1(__va(pgd_phys));
+- memcpy(swapper_pg_dir, pgd, PAGE_SIZE);
++ memcpy(swapper_pg_dir, pgd, PGD_SIZE);
+ cpu_replace_ttbr1(swapper_pg_dir);
+
+ pgd_clear_fixmap();
--- /dev/null
+From 2e449048a25eb75d48dff12882b93f26d130a1c6 Mon Sep 17 00:00:00 2001
+From: Kefeng Wang <wangkefeng.wang@huawei.com>
+Date: Thu, 26 Jan 2017 11:19:55 +0800
+Subject: arm64: Kconfig: select COMPAT_BINFMT_ELF only when BINFMT_ELF is set
+
+From: Kefeng Wang <wangkefeng.wang@huawei.com>
+
+commit 2e449048a25eb75d48dff12882b93f26d130a1c6 upstream.
+
+Fix warning:
+"(COMPAT) selects COMPAT_BINFMT_ELF which has unmet direct dependencies
+(COMPAT && BINFMT_ELF)"
+
+Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
+Signed-off-by: Will Deacon <will.deacon@arm.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/arm64/Kconfig | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/arch/arm64/Kconfig
++++ b/arch/arm64/Kconfig
+@@ -1007,7 +1007,7 @@ source "fs/Kconfig.binfmt"
+ config COMPAT
+ bool "Kernel support for 32-bit EL0"
+ depends on ARM64_4K_PAGES || EXPERT
+- select COMPAT_BINFMT_ELF
++ select COMPAT_BINFMT_ELF if BINFMT_ELF
+ select HAVE_UID16
+ select OLD_SIGSUSPEND3
+ select COMPAT_OLD_SIGACTION
--- /dev/null
+From foo@baz Fri Feb 23 16:40:21 CET 2018
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Mon, 19 Feb 2018 11:13:22 +0100
+Subject: arm64: sunxi: always enable reset controller
+To: stable@vger.kernel.org
+Cc: Greg KH <gregkh@linuxfoundation.org>, linux-kernel@vger.kernel.org, Arnd Bergmann <arnd@arndb.de>, Catalin Marinas <catalin.marinas@arm.com>, Will Deacon <will.deacon@arm.com>, Maxime Ripard <maxime.ripard@free-electrons.com>, linux-arm-kernel@lists.infradead.org
+Message-ID: <20180219101343.2922561-4-arnd@arndb.de>
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit 900a9020af7a023f9b64c919fddf8a7486108962 upstream.
+
+The sunxi clk driver causes a link error when the reset controller
+subsystem is disabled:
+
+drivers/clk/built-in.o: In function `sun4i_ve_clk_setup':
+:(.init.text+0xd040): undefined reference to `reset_controller_register'
+drivers/clk/built-in.o: In function `sun4i_a10_display_init':
+:(.init.text+0xe5e0): undefined reference to `reset_controller_register'
+drivers/clk/built-in.o: In function `sunxi_usb_clk_setup':
+:(.init.text+0x10074): undefined reference to `reset_controller_register'
+
+We already force it to be enabled on arm32 and some other arm64 platforms,
+but not on arm64/sunxi. This adds the respective Kconfig statements to
+also select it here.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
+[arnd: manually rebased to 4.9]
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/arm64/Kconfig.platforms | 2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/arch/arm64/Kconfig.platforms
++++ b/arch/arm64/Kconfig.platforms
+@@ -2,9 +2,11 @@ menu "Platform selection"
+
+ config ARCH_SUNXI
+ bool "Allwinner sunxi 64-bit SoC Family"
++ select ARCH_HAS_RESET_CONTROLLER
+ select GENERIC_IRQ_CHIP
+ select PINCTRL
+ select PINCTRL_SUN50I_A64
++ select RESET_CONTROLLER
+ help
+ This enables support for Allwinner sunxi based SoCs like the A64.
+
--- /dev/null
+From foo@baz Fri Feb 23 16:40:21 CET 2018
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Mon, 19 Feb 2018 11:13:23 +0100
+Subject: binfmt_elf: compat: avoid unused function warning
+To: stable@vger.kernel.org
+Cc: Greg KH <gregkh@linuxfoundation.org>, linux-kernel@vger.kernel.org, Arnd Bergmann <arnd@arndb.de>, Alexander Viro <viro@zeniv.linux.org.uk>, linux-fsdevel@vger.kernel.org
+Message-ID: <20180219101343.2922561-5-arnd@arndb.de>
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+When CONFIG_ELF_CORE is disabled, we get a harmless warning in the compat
+version of binfmt_elf:
+
+fs/compat_binfmt_elf.c:58:13: error: 'cputime_to_compat_timeval' defined but not used [-Werror=unused-function]
+
+This was addressed in mainline Linux as part of a larger rework with commit
+cd19c364b313 ("fs/binfmt: Convert obsolete cputime type to nsecs").
+
+For 4.9 and earlier, this just shuts up the warning by adding an #ifdef
+around the function definition.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/compat_binfmt_elf.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/fs/compat_binfmt_elf.c
++++ b/fs/compat_binfmt_elf.c
+@@ -51,6 +51,7 @@
+ #define elf_prstatus compat_elf_prstatus
+ #define elf_prpsinfo compat_elf_prpsinfo
+
++#ifdef CONFIG_ELF_CORE
+ /*
+ * Compat version of cputime_to_compat_timeval, perhaps this
+ * should be an inline in <linux/compat.h>.
+@@ -63,6 +64,7 @@ static void cputime_to_compat_timeval(co
+ value->tv_sec = tv.tv_sec;
+ value->tv_usec = tv.tv_usec;
+ }
++#endif
+
+ #undef cputime_to_timeval
+ #define cputime_to_timeval cputime_to_compat_timeval
--- /dev/null
+From dbed87a9d3a857a86f602775b5845f5f6d9652b5 Mon Sep 17 00:00:00 2001
+From: Tobias Regnery <tobias.regnery@gmail.com>
+Date: Mon, 24 Apr 2017 12:05:42 +0200
+Subject: clk: meson: gxbb: fix build error without RESET_CONTROLLER
+
+From: Tobias Regnery <tobias.regnery@gmail.com>
+
+commit dbed87a9d3a857a86f602775b5845f5f6d9652b5 upstream.
+
+With CONFIG_RESET_CONTROLLER=n we see the following link error in the
+meson gxbb clk driver:
+
+drivers/built-in.o: In function 'gxbb_aoclkc_probe':
+drivers/clk/meson/gxbb-aoclk.c:161: undefined reference to 'devm_reset_controller_register'
+
+Fix this by selecting the reset controller subsystem.
+
+Fixes: f8c11f79912d ("clk: meson: Add GXBB AO Clock and Reset controller driver")
+Signed-off-by: Tobias Regnery <tobias.regnery@gmail.com>
+Acked-by: Neil Armstrong <narmstrong@baylibre.com>
+[narmstrong: Added fixes-by tag]
+Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/clk/meson/Kconfig | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/clk/meson/Kconfig
++++ b/drivers/clk/meson/Kconfig
+@@ -14,6 +14,7 @@ config COMMON_CLK_MESON8B
+ config COMMON_CLK_GXBB
+ bool
+ depends on COMMON_CLK_AMLOGIC
++ select RESET_CONTROLLER
+ help
+ Support for the clock controller on AmLogic S905 devices, aka gxbb.
+ Say Y if you want peripherals and CPU frequency scaling to work.
--- /dev/null
+From aa01338c018469274848a973bcbd287ef341937c Mon Sep 17 00:00:00 2001
+From: Tobias Regnery <tobias.regnery@gmail.com>
+Date: Mon, 27 Mar 2017 11:57:53 +0200
+Subject: clk: sunxi-ng: fix build error without CONFIG_RESET_CONTROLLER
+
+From: Tobias Regnery <tobias.regnery@gmail.com>
+
+commit aa01338c018469274848a973bcbd287ef341937c upstream.
+
+With CONFIG_RESET_CONTROLLER=n we get the following link error in the
+sunxi-ng clk driver:
+
+drivers/built-in.o: In function `sunxi_ccu_probe':
+mux-core.c:(.text+0x12fe68): undefined reference to 'reset_controller_register'
+mux-core.c:(.text+0x12fe68): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol 'reset_controller_register'
+
+Fix this by adding the appropriate select statement.
+
+Signed-off-by: Tobias Regnery <tobias.regnery@gmail.com>
+Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/clk/sunxi-ng/Kconfig | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/clk/sunxi-ng/Kconfig
++++ b/drivers/clk/sunxi-ng/Kconfig
+@@ -1,6 +1,7 @@
+ config SUNXI_CCU
+ bool "Clock support for Allwinner SoCs"
+ depends on ARCH_SUNXI || COMPILE_TEST
++ select RESET_CONTROLLER
+ default ARCH_SUNXI
+
+ if SUNXI_CCU
--- /dev/null
+From 87a81dce53b1ea61acaeefa5191a0376a2d1d721 Mon Sep 17 00:00:00 2001
+From: LEROY Christophe <christophe.leroy@c-s.fr>
+Date: Fri, 26 Jan 2018 17:09:59 +0100
+Subject: crypto: talitos - fix Kernel Oops on hashing an empty file
+
+From: LEROY Christophe <christophe.leroy@c-s.fr>
+
+commit 87a81dce53b1ea61acaeefa5191a0376a2d1d721 upstream.
+
+Performing the hash of an empty file leads to a kernel Oops
+
+[ 44.504600] Unable to handle kernel paging request for data at address 0x0000000c
+[ 44.512819] Faulting instruction address: 0xc02d2be8
+[ 44.524088] Oops: Kernel access of bad area, sig: 11 [#1]
+[ 44.529171] BE PREEMPT CMPC885
+[ 44.532232] CPU: 0 PID: 491 Comm: md5sum Not tainted 4.15.0-rc8-00211-g3a968610b6ea #81
+[ 44.540814] NIP: c02d2be8 LR: c02d2984 CTR: 00000000
+[ 44.545812] REGS: c6813c90 TRAP: 0300 Not tainted (4.15.0-rc8-00211-g3a968610b6ea)
+[ 44.554223] MSR: 00009032 <EE,ME,IR,DR,RI> CR: 48222822 XER: 20000000
+[ 44.560855] DAR: 0000000c DSISR: c0000000
+[ 44.560855] GPR00: c02d28fc c6813d40 c6828000 c646fa40 00000001 00000001 00000001 00000000
+[ 44.560855] GPR08: 0000004c 00000000 c000bfcc 00000000 28222822 100280d4 00000000 10020008
+[ 44.560855] GPR16: 00000000 00000020 00000000 00000000 10024008 00000000 c646f9f0 c6179a10
+[ 44.560855] GPR24: 00000000 00000001 c62f0018 c6179a10 00000000 c6367a30 c62f0000 c646f9c0
+[ 44.598542] NIP [c02d2be8] ahash_process_req+0x448/0x700
+[ 44.603751] LR [c02d2984] ahash_process_req+0x1e4/0x700
+[ 44.608868] Call Trace:
+[ 44.611329] [c6813d40] [c02d28fc] ahash_process_req+0x15c/0x700 (unreliable)
+[ 44.618302] [c6813d90] [c02060c4] hash_recvmsg+0x11c/0x210
+[ 44.623716] [c6813db0] [c0331354] ___sys_recvmsg+0x98/0x138
+[ 44.629226] [c6813eb0] [c03332c0] __sys_recvmsg+0x40/0x84
+[ 44.634562] [c6813f10] [c03336c0] SyS_socketcall+0xb8/0x1d4
+[ 44.640073] [c6813f40] [c000d1ac] ret_from_syscall+0x0/0x38
+[ 44.645530] Instruction dump:
+[ 44.648465] 38c00001 7f63db78 4e800421 7c791b78 54690ffe 0f090000 80ff0190 2f870000
+[ 44.656122] 40befe50 2f990001 409e0210 813f01bc <8129000c> b39e003a 7d29c214 913e003c
+
+This patch fixes that Oops by checking if src is NULL.
+
+Fixes: 6a1e8d14156d4 ("crypto: talitos - making mapping helpers more generic")
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
+Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+
+---
+ drivers/crypto/talitos.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+--- a/drivers/crypto/talitos.c
++++ b/drivers/crypto/talitos.c
+@@ -1124,6 +1124,11 @@ int talitos_sg_map(struct device *dev, s
+ struct talitos_private *priv = dev_get_drvdata(dev);
+ bool is_sec1 = has_ftr_sec1(priv);
+
++ if (!src) {
++ *ptr = zero_entry;
++ return 1;
++ }
++
+ to_talitos_ptr_len(ptr, len, is_sec1);
+ to_talitos_ptr_ext_set(ptr, 0, is_sec1);
+
--- /dev/null
+From 7fc1503c906f0fac62d3506a6e993e49fb996248 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Tue, 25 Oct 2016 22:21:04 +0200
+Subject: cw1200: fix bogus maybe-uninitialized warning
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit 7fc1503c906f0fac62d3506a6e993e49fb996248 upstream.
+
+On x86, the cw1200 driver produces a rather silly warning about the
+possible use of the 'ret' variable without an initialization
+presumably after being confused by the architecture specific definition
+of WARN_ON:
+
+drivers/net/wireless/st/cw1200/wsm.c: In function ‘wsm_handle_rx’:
+drivers/net/wireless/st/cw1200/wsm.c:1457:9: error: ‘ret’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
+
+We have already checked that 'count' is larger than 0 here, so
+we know that 'ret' is initialized. Changing the 'for' loop
+into do/while also makes this clear to the compiler.
+
+Suggested-by: David Laight <David.Laight@ACULAB.COM>
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/net/wireless/st/cw1200/wsm.c | 8 +++-----
+ 1 file changed, 3 insertions(+), 5 deletions(-)
+
+--- a/drivers/net/wireless/st/cw1200/wsm.c
++++ b/drivers/net/wireless/st/cw1200/wsm.c
+@@ -379,7 +379,6 @@ static int wsm_multi_tx_confirm(struct c
+ {
+ int ret;
+ int count;
+- int i;
+
+ count = WSM_GET32(buf);
+ if (WARN_ON(count <= 0))
+@@ -395,11 +394,10 @@ static int wsm_multi_tx_confirm(struct c
+ }
+
+ cw1200_debug_txed_multi(priv, count);
+- for (i = 0; i < count; ++i) {
++ do {
+ ret = wsm_tx_confirm(priv, buf, link_id);
+- if (ret)
+- return ret;
+- }
++ } while (!ret && --count);
++
+ return ret;
+
+ underflow:
--- /dev/null
+From 067fdeb2f391bfa071f741a2b3eb74b8ff3785cd Mon Sep 17 00:00:00 2001
+From: Jun Nie <jun.nie@linaro.org>
+Date: Tue, 10 Jan 2017 17:23:40 +0800
+Subject: dmaengine: zx: fix build warning
+
+From: Jun Nie <jun.nie@linaro.org>
+
+commit 067fdeb2f391bfa071f741a2b3eb74b8ff3785cd upstream.
+
+Fix build warning that related to PAGE_SIZE. The maximum DMA
+length has nothing to do with PAGE_SIZE, just use a fix number
+for the definition.
+
+drivers/dma/zx_dma.c: In function 'zx_dma_prep_memcpy':
+drivers/dma/zx_dma.c:523:8: warning: division by zero [-Wdiv-by-zero]
+drivers/dma/zx_dma.c: In function 'zx_dma_prep_slave_sg':
+drivers/dma/zx_dma.c:567:11: warning: division by zero [-Wdiv-by-zero]
+
+Signed-off-by: Jun Nie <jun.nie@linaro.org>
+Tested-by: Shawn Guo <shawn.guo@linaro.org>
+Signed-off-by: Vinod Koul <vinod.koul@intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/dma/zx296702_dma.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/dma/zx296702_dma.c
++++ b/drivers/dma/zx296702_dma.c
+@@ -26,7 +26,7 @@
+
+ #define DRIVER_NAME "zx-dma"
+ #define DMA_ALIGN 4
+-#define DMA_MAX_SIZE (0x10000 - PAGE_SIZE)
++#define DMA_MAX_SIZE (0x10000 - 512)
+ #define LLI_BLOCK_SIZE (4 * PAGE_SIZE)
+
+ #define REG_ZX_SRC_ADDR 0x00
--- /dev/null
+From 7e1751001818209b214b8c3df0b3c91fae250ea2 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Fri, 21 Jul 2017 22:47:18 +0200
+Subject: drm: exynos: mark pm functions as __maybe_unused
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit 7e1751001818209b214b8c3df0b3c91fae250ea2 upstream.
+
+The rework of the exynos DRM clock handling introduced
+warnings for configurations that have CONFIG_PM disabled:
+
+drivers/gpu/drm/exynos/exynos_hdmi.c:736:13: error: 'hdmi_clk_disable_gates' defined but not used [-Werror=unused-function]
+ static void hdmi_clk_disable_gates(struct hdmi_context *hdata)
+ ^~~~~~~~~~~~~~~~~~~~~~
+drivers/gpu/drm/exynos/exynos_hdmi.c:717:12: error: 'hdmi_clk_enable_gates' defined but not used [-Werror=unused-function]
+ static int hdmi_clk_enable_gates(struct hdmi_context *hdata)
+
+The problem is that the PM functions themselves are inside of
+an #ifdef, but some functions they call are not.
+
+This patch removes the #ifdef and instead marks the PM functions
+as __maybe_unused, which is a more reliable way to get it right.
+
+Link: https://patchwork.kernel.org/patch/8436281/
+Fixes: 9be7e9898444 ("drm/exynos/hdmi: clock code re-factoring")
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Inki Dae <inki.dae@samsung.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/gpu/drm/exynos/exynos_hdmi.c | 6 ++----
+ 1 file changed, 2 insertions(+), 4 deletions(-)
+
+--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
++++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
+@@ -1939,8 +1939,7 @@ static int hdmi_remove(struct platform_d
+ return 0;
+ }
+
+-#ifdef CONFIG_PM
+-static int exynos_hdmi_suspend(struct device *dev)
++static int __maybe_unused exynos_hdmi_suspend(struct device *dev)
+ {
+ struct hdmi_context *hdata = dev_get_drvdata(dev);
+
+@@ -1949,7 +1948,7 @@ static int exynos_hdmi_suspend(struct de
+ return 0;
+ }
+
+-static int exynos_hdmi_resume(struct device *dev)
++static int __maybe_unused exynos_hdmi_resume(struct device *dev)
+ {
+ struct hdmi_context *hdata = dev_get_drvdata(dev);
+ int ret;
+@@ -1960,7 +1959,6 @@ static int exynos_hdmi_resume(struct dev
+
+ return 0;
+ }
+-#endif
+
+ static const struct dev_pm_ops exynos_hdmi_pm_ops = {
+ SET_RUNTIME_PM_OPS(exynos_hdmi_suspend, exynos_hdmi_resume, NULL)
--- /dev/null
+From ac29fc66855b79c2960c63a4a66952d5b721d698 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Mon, 27 Nov 2017 16:10:27 +0100
+Subject: drm/i915: fix intel_backlight_device_register declaration
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit ac29fc66855b79c2960c63a4a66952d5b721d698 upstream.
+
+The alternative intel_backlight_device_register() definition apparently
+never got used, but I have now run into a case of i915 being compiled
+without CONFIG_BACKLIGHT_CLASS_DEVICE, resulting in a number of
+identical warnings:
+
+drivers/gpu/drm/i915/intel_drv.h:1739:12: error: 'intel_backlight_device_register' defined but not used [-Werror=unused-function]
+
+This marks the function as 'inline', which was surely the original
+intention here.
+
+Fixes: 1ebaa0b9c2d4 ("drm/i915: Move backlight registration to connector registration")
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
+Link: https://patchwork.freedesktop.org/patch/msgid/20171127151239.1813673-1-arnd@arndb.de
+(cherry picked from commit 2de2d0b063b08becb2c67a2c338c44e37bdcffee)
+Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/gpu/drm/i915/intel_drv.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/gpu/drm/i915/intel_drv.h
++++ b/drivers/gpu/drm/i915/intel_drv.h
+@@ -1581,7 +1581,7 @@ extern struct drm_display_mode *intel_fi
+ int intel_backlight_device_register(struct intel_connector *connector);
+ void intel_backlight_device_unregister(struct intel_connector *connector);
+ #else /* CONFIG_BACKLIGHT_CLASS_DEVICE */
+-static int intel_backlight_device_register(struct intel_connector *connector)
++static inline int intel_backlight_device_register(struct intel_connector *connector)
+ {
+ return 0;
+ }
--- /dev/null
+From foo@baz Fri Feb 23 16:40:21 CET 2018
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Mon, 19 Feb 2018 11:13:21 +0100
+Subject: drm/i915: hide unused intel_panel_set_backlight function
+To: stable@vger.kernel.org
+Cc: Greg KH <gregkh@linuxfoundation.org>, linux-kernel@vger.kernel.org, Arnd Bergmann <arnd@arndb.de>, Daniel Vetter <daniel.vetter@ffwll.ch>, Daniel Vetter <daniel.vetter@intel.com>, Jani Nikula <jani.nikula@linux.intel.com>, David Airlie <airlied@linux.ie>, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
+Message-ID: <20180219101343.2922561-3-arnd@arndb.de>
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit fd94d53e55bd487368dfee9f1af24da78b2bb582 upstream.
+
+Building i915 without backlight support results in a harmless warning
+for intel_panel_set_backlight:
+
+drivers/gpu/drm/i915/intel_panel.c:653:13: error: 'intel_panel_set_backlight' defined but not used [-Werror=unused-function]
+
+This moves it into the CONFIG_BACKLIGHT_CLASS_DEVICE section that
+its caller is in.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
+Link: https://patchwork.freedesktop.org/patch/msgid/20171127151239.1813673-2-arnd@arndb.de
+[arnd: manually rebased to 4.9]
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/gpu/drm/i915/intel_panel.c | 86 ++++++++++++++++++-------------------
+ 1 file changed, 43 insertions(+), 43 deletions(-)
+
+--- a/drivers/gpu/drm/i915/intel_panel.c
++++ b/drivers/gpu/drm/i915/intel_panel.c
+@@ -544,25 +544,6 @@ static u32 pwm_get_backlight(struct inte
+ return DIV_ROUND_UP(duty_ns * 100, CRC_PMIC_PWM_PERIOD_NS);
+ }
+
+-static u32 intel_panel_get_backlight(struct intel_connector *connector)
+-{
+- struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
+- struct intel_panel *panel = &connector->panel;
+- u32 val = 0;
+-
+- mutex_lock(&dev_priv->backlight_lock);
+-
+- if (panel->backlight.enabled) {
+- val = panel->backlight.get(connector);
+- val = intel_panel_compute_brightness(connector, val);
+- }
+-
+- mutex_unlock(&dev_priv->backlight_lock);
+-
+- DRM_DEBUG_DRIVER("get backlight PWM = %d\n", val);
+- return val;
+-}
+-
+ static void lpt_set_backlight(struct intel_connector *connector, u32 level)
+ {
+ struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
+@@ -646,30 +627,6 @@ intel_panel_actually_set_backlight(struc
+ panel->backlight.set(connector, level);
+ }
+
+-/* set backlight brightness to level in range [0..max], scaling wrt hw min */
+-static void intel_panel_set_backlight(struct intel_connector *connector,
+- u32 user_level, u32 user_max)
+-{
+- struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
+- struct intel_panel *panel = &connector->panel;
+- u32 hw_level;
+-
+- if (!panel->backlight.present)
+- return;
+-
+- mutex_lock(&dev_priv->backlight_lock);
+-
+- WARN_ON(panel->backlight.max == 0);
+-
+- hw_level = scale_user_to_hw(connector, user_level, user_max);
+- panel->backlight.level = hw_level;
+-
+- if (panel->backlight.enabled)
+- intel_panel_actually_set_backlight(connector, hw_level);
+-
+- mutex_unlock(&dev_priv->backlight_lock);
+-}
+-
+ /* set backlight brightness to level in range [0..max], assuming hw min is
+ * respected.
+ */
+@@ -1122,6 +1079,49 @@ void intel_panel_enable_backlight(struct
+ }
+
+ #if IS_ENABLED(CONFIG_BACKLIGHT_CLASS_DEVICE)
++static u32 intel_panel_get_backlight(struct intel_connector *connector)
++{
++ struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
++ struct intel_panel *panel = &connector->panel;
++ u32 val = 0;
++
++ mutex_lock(&dev_priv->backlight_lock);
++
++ if (panel->backlight.enabled) {
++ val = panel->backlight.get(connector);
++ val = intel_panel_compute_brightness(connector, val);
++ }
++
++ mutex_unlock(&dev_priv->backlight_lock);
++
++ DRM_DEBUG_DRIVER("get backlight PWM = %d\n", val);
++ return val;
++}
++
++/* set backlight brightness to level in range [0..max], scaling wrt hw min */
++static void intel_panel_set_backlight(struct intel_connector *connector,
++ u32 user_level, u32 user_max)
++{
++ struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
++ struct intel_panel *panel = &connector->panel;
++ u32 hw_level;
++
++ if (!panel->backlight.present)
++ return;
++
++ mutex_lock(&dev_priv->backlight_lock);
++
++ WARN_ON(panel->backlight.max == 0);
++
++ hw_level = scale_user_to_hw(connector, user_level, user_max);
++ panel->backlight.level = hw_level;
++
++ if (panel->backlight.enabled)
++ intel_panel_actually_set_backlight(connector, hw_level);
++
++ mutex_unlock(&dev_priv->backlight_lock);
++}
++
+ static int intel_backlight_device_update_status(struct backlight_device *bd)
+ {
+ struct intel_connector *connector = bl_get_data(bd);
--- /dev/null
+From b74c0a9969f25217a5e5bbcac56a11bee16718d3 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Mon, 24 Oct 2016 17:30:38 +0200
+Subject: drm/nouveau: hide gcc-4.9 -Wmaybe-uninitialized
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit b74c0a9969f25217a5e5bbcac56a11bee16718d3 upstream.
+
+gcc-4.9 notices that the validate_init() function returns unintialized
+data when called with a zero 'nr_buffers' argument, when called with the
+-Wmaybe-uninitialized flag:
+
+drivers/gpu/drm/nouveau/nouveau_gem.c: In function ‘validate_init.isra.6’:
+drivers/gpu/drm/nouveau/nouveau_gem.c:457:5: error: ‘ret’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
+
+However, the only caller of this function always passes a nonzero
+argument, and gcc-6 is clever enough to take this into account and
+not warn about it any more.
+
+Adding an explicit initialization to -EINVAL here is correct even if
+the caller changed, and it avoids the warning on gcc-4.9 as well.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Reviewed-By: Karol Herbst <karolherbst@gmail.com>
+Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/gpu/drm/nouveau/nouveau_gem.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/gpu/drm/nouveau/nouveau_gem.c
++++ b/drivers/gpu/drm/nouveau/nouveau_gem.c
+@@ -369,7 +369,7 @@ validate_init(struct nouveau_channel *ch
+ {
+ struct nouveau_cli *cli = nouveau_cli(file_priv);
+ int trycnt = 0;
+- int ret, i;
++ int ret = -EINVAL, i;
+ struct nouveau_bo *res_bo = NULL;
+ LIST_HEAD(gart_list);
+ LIST_HEAD(vram_list);
--- /dev/null
+From 190b23b4eb997767afad186bd8c96badceabf39e Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Tue, 26 Jan 2016 12:09:59 -0200
+Subject: [media] em28xx: only use mt9v011 if camera support is enabled
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit 190b23b4eb997767afad186bd8c96badceabf39e upstream.
+
+In randconfig builds that select VIDEO_EM28XX_V4L2 and
+MEDIA_SUBDRV_AUTOSELECT, but not MEDIA_CAMERA_SUPPORT, we get
+a Kconfig warning:
+
+ warning: (VIDEO_EM28XX_V4L2) selects VIDEO_MT9V011 which has unmet direct dependencies (MEDIA_SUPPORT && I2C && VIDEO_V4L2 && MEDIA_CAMERA_SUPPORT)
+
+This avoids the warning by making that 'select' conditional on
+MEDIA_CAMERA_SUPPORT. Alternatively we could mark EM28XX as
+'depends on MEDIA_CAMERA_SUPPORT', but it does not seem to
+have any real dependency on that itself.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/media/usb/em28xx/Kconfig | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/media/usb/em28xx/Kconfig
++++ b/drivers/media/usb/em28xx/Kconfig
+@@ -11,7 +11,7 @@ config VIDEO_EM28XX_V4L2
+ select VIDEO_SAA711X if MEDIA_SUBDRV_AUTOSELECT
+ select VIDEO_TVP5150 if MEDIA_SUBDRV_AUTOSELECT
+ select VIDEO_MSP3400 if MEDIA_SUBDRV_AUTOSELECT
+- select VIDEO_MT9V011 if MEDIA_SUBDRV_AUTOSELECT
++ select VIDEO_MT9V011 if MEDIA_SUBDRV_AUTOSELECT && MEDIA_CAMERA_SUPPORT
+
+ ---help---
+ This is a video4linux driver for Empia 28xx based TV cards.
--- /dev/null
+From fa6317eedd6341f2144ed1097706d8c34f18b6e4 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Tue, 26 Jan 2016 12:10:01 -0200
+Subject: [media] go7007: add MEDIA_CAMERA_SUPPORT dependency
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit fa6317eedd6341f2144ed1097706d8c34f18b6e4 upstream.
+
+If MEDIA_SUBDRV_AUTOSELECT and VIDEO_GO7007 are both set, we
+automatically select VIDEO_OV7640, but that depends on MEDIA_CAMERA_SUPPORT,
+so we get a Kconfig warning if that is disabled:
+
+warning: (VIDEO_GO7007) selects VIDEO_OV7640 which has unmet direct dependencies (MEDIA_SUPPORT && I2C && VIDEO_V4L2 && MEDIA_CAMERA_SUPPORT)
+
+This adds another dependency so we don't accidentally select
+it when it is unavailable.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/media/usb/go7007/Kconfig | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/media/usb/go7007/Kconfig
++++ b/drivers/media/usb/go7007/Kconfig
+@@ -11,7 +11,7 @@ config VIDEO_GO7007
+ select VIDEO_TW2804 if MEDIA_SUBDRV_AUTOSELECT
+ select VIDEO_TW9903 if MEDIA_SUBDRV_AUTOSELECT
+ select VIDEO_TW9906 if MEDIA_SUBDRV_AUTOSELECT
+- select VIDEO_OV7640 if MEDIA_SUBDRV_AUTOSELECT
++ select VIDEO_OV7640 if MEDIA_SUBDRV_AUTOSELECT && MEDIA_CAMERA_SUPPORT
+ select VIDEO_UDA1342 if MEDIA_SUBDRV_AUTOSELECT
+ ---help---
+ This is a video4linux driver for the WIS GO7007 MPEG
--- /dev/null
+From fbc2a294f29e726787a0f5238b27137904f26b81 Mon Sep 17 00:00:00 2001
+From: Augusto Mecking Caringi <augustocaringi@gmail.com>
+Date: Mon, 16 Jan 2017 14:30:41 +0000
+Subject: gpio: intel-mid: Fix build warning when !CONFIG_PM
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Augusto Mecking Caringi <augustocaringi@gmail.com>
+
+commit fbc2a294f29e726787a0f5238b27137904f26b81 upstream.
+
+The only usage of function intel_gpio_runtime_idle() is here (in the
+same file):
+
+static const struct dev_pm_ops intel_gpio_pm_ops = {
+ SET_RUNTIME_PM_OPS(NULL, NULL, intel_gpio_runtime_idle)
+};
+
+And when CONFIG_PM is not set, the macro SET_RUNTIME_PM_OPS expands to
+nothing, causing the following compiler warning:
+
+drivers/gpio/gpio-intel-mid.c:324:12: warning: ‘intel_gpio_runtime_idle’
+defined but not used [-Wunused-function]
+static int intel_gpio_runtime_idle(struct device *dev)
+
+Fix it by annotating the function with __maybe_unused.
+
+Signed-off-by: Augusto Mecking Caringi <augustocaringi@gmail.com>
+Acked-by: Andy Shevchenko <andy.shevchenko@gmail.com>
+Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/gpio/gpio-intel-mid.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/gpio/gpio-intel-mid.c
++++ b/drivers/gpio/gpio-intel-mid.c
+@@ -321,7 +321,7 @@ static void intel_mid_irq_init_hw(struct
+ }
+ }
+
+-static int intel_gpio_runtime_idle(struct device *dev)
++static int __maybe_unused intel_gpio_runtime_idle(struct device *dev)
+ {
+ int err = pm_schedule_suspend(dev, 500);
+ return err ?: -EBUSY;
--- /dev/null
+From b115bebc07f282067eccc06fd5aa3060ab1426da Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Fri, 17 Feb 2017 16:13:44 +0100
+Subject: gpio: xgene: mark PM functions as __maybe_unused
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit b115bebc07f282067eccc06fd5aa3060ab1426da upstream.
+
+When CONFIG_PM_SLEEP is disabled, we get a warning about unused functions:
+
+drivers/gpio/gpio-xgene.c:155:12: warning: 'xgene_gpio_resume' defined but not used [-Wunused-function]
+ static int xgene_gpio_resume(struct device *dev)
+ ^~~~~~~~~~~~~~~~~
+drivers/gpio/gpio-xgene.c:142:12: warning: 'xgene_gpio_suspend' defined but not used [-Wunused-function]
+ static int xgene_gpio_suspend(struct device *dev)
+
+The warnings are harmless and can be avoided by simplifying the code and marking
+the functions as __maybe_unused.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/gpio/gpio-xgene.c | 13 +++----------
+ 1 file changed, 3 insertions(+), 10 deletions(-)
+
+--- a/drivers/gpio/gpio-xgene.c
++++ b/drivers/gpio/gpio-xgene.c
+@@ -42,9 +42,7 @@ struct xgene_gpio {
+ struct gpio_chip chip;
+ void __iomem *base;
+ spinlock_t lock;
+-#ifdef CONFIG_PM
+ u32 set_dr_val[XGENE_MAX_GPIO_BANKS];
+-#endif
+ };
+
+ static int xgene_gpio_get(struct gpio_chip *gc, unsigned int offset)
+@@ -138,8 +136,7 @@ static int xgene_gpio_dir_out(struct gpi
+ return 0;
+ }
+
+-#ifdef CONFIG_PM
+-static int xgene_gpio_suspend(struct device *dev)
++static __maybe_unused int xgene_gpio_suspend(struct device *dev)
+ {
+ struct xgene_gpio *gpio = dev_get_drvdata(dev);
+ unsigned long bank_offset;
+@@ -152,7 +149,7 @@ static int xgene_gpio_suspend(struct dev
+ return 0;
+ }
+
+-static int xgene_gpio_resume(struct device *dev)
++static __maybe_unused int xgene_gpio_resume(struct device *dev)
+ {
+ struct xgene_gpio *gpio = dev_get_drvdata(dev);
+ unsigned long bank_offset;
+@@ -166,10 +163,6 @@ static int xgene_gpio_resume(struct devi
+ }
+
+ static SIMPLE_DEV_PM_OPS(xgene_gpio_pm, xgene_gpio_suspend, xgene_gpio_resume);
+-#define XGENE_GPIO_PM_OPS (&xgene_gpio_pm)
+-#else
+-#define XGENE_GPIO_PM_OPS NULL
+-#endif
+
+ static int xgene_gpio_probe(struct platform_device *pdev)
+ {
+@@ -241,7 +234,7 @@ static struct platform_driver xgene_gpio
+ .name = "xgene-gpio",
+ .of_match_table = xgene_gpio_of_match,
+ .acpi_match_table = ACPI_PTR(xgene_gpio_acpi_match),
+- .pm = XGENE_GPIO_PM_OPS,
++ .pm = &xgene_gpio_pm,
+ },
+ .probe = xgene_gpio_probe,
+ };
--- /dev/null
+From foo@baz Fri Feb 23 16:40:21 CET 2018
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Mon, 19 Feb 2018 11:13:25 +0100
+Subject: idle: i7300: add PCI dependency
+To: stable@vger.kernel.org
+Cc: Greg KH <gregkh@linuxfoundation.org>, linux-kernel@vger.kernel.org, Arnd Bergmann <arnd@arndb.de>
+Message-ID: <20180219101343.2922561-7-arnd@arndb.de>
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+GCC correctly points out an uninitialized variable use when CONFIG_PCI is disabled.
+
+drivers/idle/i7300_idle.c: In function 'i7300_idle_notifier':
+include/asm-generic/bug.h:119:5: error: 'got_ctl' may be used uninitialized in this function [-Werror=maybe-uninitialized]
+ if (unlikely(__ret_warn_once && !__warned)) { \
+ ^
+drivers/idle/i7300_idle.c:415:5: note: 'got_ctl' was declared here
+ u8 got_ctl;
+ ^~~~~~~
+
+The driver no longer exists in later kernels, so this patch only appplies to
+linux-4.9.y and earlier.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/idle/Kconfig | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/idle/Kconfig
++++ b/drivers/idle/Kconfig
+@@ -17,6 +17,7 @@ config I7300_IDLE_IOAT_CHANNEL
+
+ config I7300_IDLE
+ tristate "Intel chipset idle memory power saving driver"
++ depends on PCI
+ select I7300_IDLE_IOAT_CHANNEL
+ help
+ Enable memory power savings when idle with certain Intel server
--- /dev/null
+From ea4348c8462a20e8b1b6455a7145d2b86f8a49b6 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Wed, 26 Oct 2016 15:55:02 -0700
+Subject: Input: tca8418_keypad - hide gcc-4.9 -Wmaybe-uninitialized warning
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit ea4348c8462a20e8b1b6455a7145d2b86f8a49b6 upstream.
+
+Older versions of gcc warn about the tca8418_irq_handler function
+as they can't keep track of the variable assignment inside of the
+loop when using the -Wmaybe-unintialized flag:
+
+drivers/input/keyboard/tca8418_keypad.c: In function ‘tca8418_irq_handler’:
+drivers/input/keyboard/tca8418_keypad.c:172:9: error: ‘reg’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
+drivers/input/keyboard/tca8418_keypad.c:165:5: note: ‘reg’ was declared here
+
+This is fixed in gcc-6, but it's possible to rearrange the code
+in a way that avoids the warning on older compilers as well.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/input/keyboard/tca8418_keypad.c | 21 ++++++++++++---------
+ 1 file changed, 12 insertions(+), 9 deletions(-)
+
+--- a/drivers/input/keyboard/tca8418_keypad.c
++++ b/drivers/input/keyboard/tca8418_keypad.c
+@@ -164,11 +164,18 @@ static void tca8418_read_keypad(struct t
+ int error, col, row;
+ u8 reg, state, code;
+
+- /* Initial read of the key event FIFO */
+- error = tca8418_read_byte(keypad_data, REG_KEY_EVENT_A, ®);
++ do {
++ error = tca8418_read_byte(keypad_data, REG_KEY_EVENT_A, ®);
++ if (error < 0) {
++ dev_err(&keypad_data->client->dev,
++ "unable to read REG_KEY_EVENT_A\n");
++ break;
++ }
++
++ /* Assume that key code 0 signifies empty FIFO */
++ if (reg <= 0)
++ break;
+
+- /* Assume that key code 0 signifies empty FIFO */
+- while (error >= 0 && reg > 0) {
+ state = reg & KEY_EVENT_VALUE;
+ code = reg & KEY_EVENT_CODE;
+
+@@ -184,11 +191,7 @@ static void tca8418_read_keypad(struct t
+
+ /* Read for next loop */
+ error = tca8418_read_byte(keypad_data, REG_KEY_EVENT_A, ®);
+- }
+-
+- if (error < 0)
+- dev_err(&keypad_data->client->dev,
+- "unable to read REG_KEY_EVENT_A\n");
++ } while (1);
+
+ input_sync(input);
+ }
--- /dev/null
+From 27d807180ae0a9e50d90adf9b22573c21be904c2 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Wed, 25 Jan 2017 23:15:53 +0100
+Subject: ISDN: eicon: reduce stack size of sig_ind function
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit 27d807180ae0a9e50d90adf9b22573c21be904c2 upstream.
+
+I noticed that this function uses a lot of kernel stack when the
+"latent entropy" plugin is enabled:
+
+drivers/isdn/hardware/eicon/message.c: In function 'sig_ind':
+drivers/isdn/hardware/eicon/message.c:6113:1: error: the frame size of 1168 bytes is larger than 1152 bytes [-Werror=frame-larger-than=]
+
+We currently don't warn about this, as we raise the warning limit
+to 2048 bytes in mainline, but I'd like to lower that limit again
+in the future, and this function can easily be changed to be more
+efficient and avoid that warning, by making some of its local
+variables 'const'.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/isdn/hardware/eicon/message.c | 16 ++++++++--------
+ 1 file changed, 8 insertions(+), 8 deletions(-)
+
+--- a/drivers/isdn/hardware/eicon/message.c
++++ b/drivers/isdn/hardware/eicon/message.c
+@@ -147,7 +147,7 @@ static word plci_remove_check(PLCI *);
+ static void listen_check(DIVA_CAPI_ADAPTER *);
+ static byte AddInfo(byte **, byte **, byte *, byte *);
+ static byte getChannel(API_PARSE *);
+-static void IndParse(PLCI *, word *, byte **, byte);
++static void IndParse(PLCI *, const word *, byte **, byte);
+ static byte ie_compare(byte *, byte *);
+ static word find_cip(DIVA_CAPI_ADAPTER *, byte *, byte *);
+ static word CPN_filter_ok(byte *cpn, DIVA_CAPI_ADAPTER *, word);
+@@ -4858,7 +4858,7 @@ static void sig_ind(PLCI *plci)
+ /* included before the ESC_MSGTYPE and MAXPARMSIDS has to be incremented */
+ /* SMSG is situated at the end because its 0 (for compatibility reasons */
+ /* (see Info_Mask Bit 4, first IE. then the message type) */
+- word parms_id[] =
++ static const word parms_id[] =
+ {MAXPARMSIDS, CPN, 0xff, DSA, OSA, BC, LLC, HLC, ESC_CAUSE, DSP, DT, CHA,
+ UUI, CONG_RR, CONG_RNR, ESC_CHI, KEY, CHI, CAU, ESC_LAW,
+ RDN, RDX, CONN_NR, RIN, NI, CAI, ESC_CR,
+@@ -4866,12 +4866,12 @@ static void sig_ind(PLCI *plci)
+ /* 14 FTY repl by ESC_CHI */
+ /* 18 PI repl by ESC_LAW */
+ /* removed OAD changed to 0xff for future use, OAD is multiIE now */
+- word multi_fac_id[] = {1, FTY};
+- word multi_pi_id[] = {1, PI};
+- word multi_CiPN_id[] = {1, OAD};
+- word multi_ssext_id[] = {1, ESC_SSEXT};
++ static const word multi_fac_id[] = {1, FTY};
++ static const word multi_pi_id[] = {1, PI};
++ static const word multi_CiPN_id[] = {1, OAD};
++ static const word multi_ssext_id[] = {1, ESC_SSEXT};
+
+- word multi_vswitch_id[] = {1, ESC_VSWITCH};
++ static const word multi_vswitch_id[] = {1, ESC_VSWITCH};
+
+ byte *cau;
+ word ncci;
+@@ -8924,7 +8924,7 @@ static void listen_check(DIVA_CAPI_ADAPT
+ /* functions for all parameters sent in INDs */
+ /*------------------------------------------------------------------*/
+
+-static void IndParse(PLCI *plci, word *parms_id, byte **parms, byte multiIEsize)
++static void IndParse(PLCI *plci, const word *parms_id, byte **parms, byte multiIEsize)
+ {
+ word ploc; /* points to current location within packet */
+ byte w;
--- /dev/null
+From foo@baz Fri Feb 23 16:40:21 CET 2018
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Mon, 19 Feb 2018 11:13:20 +0100
+Subject: kasan: rework Kconfig settings
+To: stable@vger.kernel.org
+Cc: Greg KH <gregkh@linuxfoundation.org>, linux-kernel@vger.kernel.org, Arnd Bergmann <arnd@arndb.de>, Mauro Carvalho Chehab <mchehab@kernel.org>, Andrey Ryabinin <aryabinin@virtuozzo.com>, Alexander Potapenko <glider@google.com>, Dmitry Vyukov <dvyukov@google.com>, Andrey Konovalov <andreyknvl@google.com>, Andrew Morton <akpm@linux-foundation.org>, Linus Torvalds <torvalds@linux-foundation.org>, Sasha Levin <alexander.levin@verizon.com>, Sudip Mukherjee <sudipm.mukherjee@gmail.com>
+Message-ID: <20180219101343.2922561-2-arnd@arndb.de>
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit e7c52b84fb18f08ce49b6067ae6285aca79084a8 upstream.
+
+We get a lot of very large stack frames using gcc-7.0.1 with the default
+-fsanitize-address-use-after-scope --param asan-stack=1 options, which can
+easily cause an overflow of the kernel stack, e.g.
+
+ drivers/gpu/drm/i915/gvt/handlers.c:2434:1: warning: the frame size of 46176 bytes is larger than 3072 bytes
+ drivers/net/wireless/ralink/rt2x00/rt2800lib.c:5650:1: warning: the frame size of 23632 bytes is larger than 3072 bytes
+ lib/atomic64_test.c:250:1: warning: the frame size of 11200 bytes is larger than 3072 bytes
+ drivers/gpu/drm/i915/gvt/handlers.c:2621:1: warning: the frame size of 9208 bytes is larger than 3072 bytes
+ drivers/media/dvb-frontends/stv090x.c:3431:1: warning: the frame size of 6816 bytes is larger than 3072 bytes
+ fs/fscache/stats.c:287:1: warning: the frame size of 6536 bytes is larger than 3072 bytes
+
+To reduce this risk, -fsanitize-address-use-after-scope is now split out
+into a separate CONFIG_KASAN_EXTRA Kconfig option, leading to stack
+frames that are smaller than 2 kilobytes most of the time on x86_64. An
+earlier version of this patch also prevented combining KASAN_EXTRA with
+KASAN_INLINE, but that is no longer necessary with gcc-7.0.1.
+
+All patches to get the frame size below 2048 bytes with CONFIG_KASAN=y
+and CONFIG_KASAN_EXTRA=n have been merged by maintainers now, so we can
+bring back that default now. KASAN_EXTRA=y still causes lots of
+warnings but now defaults to !COMPILE_TEST to disable it in
+allmodconfig, and it remains disabled in all other defconfigs since it
+is a new option. I arbitrarily raise the warning limit for KASAN_EXTRA
+to 3072 to reduce the noise, but an allmodconfig kernel still has around
+50 warnings on gcc-7.
+
+I experimented a bit more with smaller stack frames and have another
+follow-up series that reduces the warning limit for 64-bit architectures
+to 1280 bytes (without CONFIG_KASAN).
+
+With earlier versions of this patch series, I also had patches to address
+the warnings we get with KASAN and/or KASAN_EXTRA, using a
+"noinline_if_stackbloat" annotation.
+
+That annotation now got replaced with a gcc-8 bugfix (see
+https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81715) and a workaround for
+older compilers, which means that KASAN_EXTRA is now just as bad as
+before and will lead to an instant stack overflow in a few extreme
+cases.
+
+This reverts parts of commit 3f181b4d8652 ("lib/Kconfig.debug: disable
+-Wframe-larger-than warnings with KASAN=y"). Two patches in linux-next
+should be merged first to avoid introducing warnings in an allmodconfig
+build:
+ 3cd890dbe2a4 ("media: dvb-frontends: fix i2c access helpers for KASAN")
+ 16c3ada89cff ("media: r820t: fix r820t_write_reg for KASAN")
+
+Do we really need to backport this?
+
+I think we do: without this patch, enabling KASAN will lead to
+unavoidable kernel stack overflow in certain device drivers when built
+with gcc-7 or higher on linux-4.10+ or any version that contains a
+backport of commit c5caf21ab0cf8. Most people are probably still on
+older compilers, but it will get worse over time as they upgrade their
+distros.
+
+The warnings we get on kernels older than this should all be for code
+that uses dangerously large stack frames, though most of them do not
+cause an actual stack overflow by themselves.The asan-stack option was
+added in linux-4.0, and commit 3f181b4d8652 ("lib/Kconfig.debug:
+disable -Wframe-larger-than warnings with KASAN=y") effectively turned
+off the warning for allmodconfig kernels, so I would like to see this
+fix backported to any kernels later than 4.0.
+
+I have done dozens of fixes for individual functions with stack frames
+larger than 2048 bytes with asan-stack, and I plan to make sure that
+all those fixes make it into the stable kernels as well (most are
+already there).
+
+Part of the complication here is that asan-stack (from 4.0) was
+originally assumed to always require much larger stacks, but that
+turned out to be a combination of multiple gcc bugs that we have now
+worked around and fixed, but sanitize-address-use-after-scope (from
+v4.10) has a much higher inherent stack usage and also suffers from at
+least three other problems that we have analyzed but not yet fixed
+upstream, each of them makes the stack usage more severe than it should
+be.
+
+Link: http://lkml.kernel.org/r/20171221134744.2295529-1-arnd@arndb.de
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Acked-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
+Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
+Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
+Cc: Alexander Potapenko <glider@google.com>
+Cc: Dmitry Vyukov <dvyukov@google.com>
+Cc: Andrey Konovalov <andreyknvl@google.com>
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+[arnd: rebase to v4.9; only re-enable warning]
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ lib/Kconfig.debug | 1 -
+ 1 file changed, 1 deletion(-)
+
+--- a/lib/Kconfig.debug
++++ b/lib/Kconfig.debug
+@@ -197,7 +197,6 @@ config ENABLE_MUST_CHECK
+ config FRAME_WARN
+ int "Warn for stack frames larger than (needs gcc 4.4)"
+ range 0 8192
+- default 0 if KASAN
+ default 2048 if GCC_PLUGIN_LATENT_ENTROPY
+ default 1024 if !64BIT
+ default 2048 if 64BIT
--- /dev/null
+From e42eef4ba38806b18c4a74f0c276fb2e0b548173 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Wed, 4 Oct 2017 12:28:18 +0200
+Subject: KVM: add X86_LOCAL_APIC dependency
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit e42eef4ba38806b18c4a74f0c276fb2e0b548173 upstream.
+
+The rework of the posted interrupt handling broke building without
+support for the local APIC:
+
+ERROR: "boot_cpu_physical_apicid" [arch/x86/kvm/kvm-intel.ko] undefined!
+
+That configuration is probably not particularly useful anyway, so
+we can avoid the randconfig failures by adding a Kconfig dependency.
+
+Fixes: 8b306e2f3c41 ("KVM: VMX: avoid double list add with VT-d posted interrupts")
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/x86/kvm/Kconfig | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/arch/x86/kvm/Kconfig
++++ b/arch/x86/kvm/Kconfig
+@@ -23,6 +23,7 @@ config KVM
+ depends on HIGH_RES_TIMERS
+ # for TASKSTATS/TASK_DELAY_ACCT:
+ depends on NET && MULTIUSER
++ depends on X86_LOCAL_APIC
+ select PREEMPT_NOTIFIERS
+ select MMU_NOTIFIER
+ select ANON_INODES
--- /dev/null
+From de5bbdd01cf9ee3cd4586b5a970d3ea015c6d7e3 Mon Sep 17 00:00:00 2001
+From: Marc Gonzalez <marc_gonzalez@sigmadesigns.com>
+Date: Tue, 18 Apr 2017 14:21:04 -0500
+Subject: PCI: Change pci_host_common_probe() visibility
+
+From: Marc Gonzalez <marc_gonzalez@sigmadesigns.com>
+
+commit de5bbdd01cf9ee3cd4586b5a970d3ea015c6d7e3 upstream.
+
+pci_host_common_probe() is defined when CONFIG_PCI_HOST_COMMON=y;
+therefore the function declaration should match that.
+
+ drivers/pci/host/pcie-tango.c:300:9: error:
+ implicit declaration of function 'pci_host_common_probe'
+
+Signed-off-by: Marc Gonzalez <marc_gonzalez@sigmadesigns.com>
+Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ include/linux/pci-ecam.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/include/linux/pci-ecam.h
++++ b/include/linux/pci-ecam.h
+@@ -59,7 +59,7 @@ void __iomem *pci_ecam_map_bus(struct pc
+ /* default ECAM ops */
+ extern struct pci_ecam_ops pci_generic_ecam_ops;
+
+-#ifdef CONFIG_PCI_HOST_GENERIC
++#ifdef CONFIG_PCI_HOST_COMMON
+ /* for DT-based PCI controllers that support ECAM */
+ int pci_host_common_probe(struct platform_device *pdev,
+ struct pci_ecam_ops *ops);
--- /dev/null
+From 42db500a551f97551a901e2258f84a60baf4edfc Mon Sep 17 00:00:00 2001
+From: Borislav Petkov <bp@suse.de>
+Date: Sat, 26 Nov 2016 19:29:57 +0100
+Subject: PCI: vmd: Fix suspend handlers defined-but-not-used warning
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Borislav Petkov <bp@suse.de>
+
+commit 42db500a551f97551a901e2258f84a60baf4edfc upstream.
+
+Fix the following warnings:
+
+ drivers/pci/host/vmd.c:731:12: warning: ‘vmd_suspend’ defined but not used [-Wunused-function]
+ static int vmd_suspend(struct device *dev)
+ ^
+ drivers/pci/host/vmd.c:739:12: warning: ‘vmd_resume’ defined but not used [-Wunused-function]
+ static int vmd_resume(struct device *dev)
+ ^
+
+Signed-off-by: Borislav Petkov <bp@suse.de>
+Signed-off-by: Bjorn Helgaas <helgaas@kernel.org>
+Reviewed-by: Keith Busch <keith.busch@intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/pci/host/vmd.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/pci/host/vmd.c
++++ b/drivers/pci/host/vmd.c
+@@ -727,7 +727,7 @@ static void vmd_remove(struct pci_dev *d
+ irq_domain_remove(vmd->irq_domain);
+ }
+
+-#ifdef CONFIG_PM
++#ifdef CONFIG_PM_SLEEP
+ static int vmd_suspend(struct device *dev)
+ {
+ struct pci_dev *pdev = to_pci_dev(dev);
--- /dev/null
+From 11d8b05855f3749bcb6c57e2c4052921b9605c77 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Wed, 19 Jul 2017 14:52:59 +0200
+Subject: perf/x86: Shut up false-positive -Wmaybe-uninitialized warning
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit 11d8b05855f3749bcb6c57e2c4052921b9605c77 upstream.
+
+The intialization function checks for various failure scenarios, but
+unfortunately the compiler gets a little confused about the possible
+combinations, leading to a false-positive build warning when
+-Wmaybe-uninitialized is set:
+
+ arch/x86/events/core.c: In function ‘init_hw_perf_events’:
+ arch/x86/events/core.c:264:3: warning: ‘reg_fail’ may be used uninitialized in this function [-Wmaybe-uninitialized]
+ arch/x86/events/core.c:264:3: warning: ‘val_fail’ may be used uninitialized in this function [-Wmaybe-uninitialized]
+ pr_err(FW_BUG "the BIOS has corrupted hw-PMU resources (MSR %x is %Lx)\n",
+
+We can't actually run into this case, so this shuts up the warning
+by initializing the variables to a known-invalid state.
+
+Suggested-by: Peter Zijlstra <peterz@infradead.org>
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
+Cc: Andy Lutomirski <luto@kernel.org>
+Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
+Cc: Josh Poimboeuf <jpoimboe@redhat.com>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Link: http://lkml.kernel.org/r/20170719125310.2487451-2-arnd@arndb.de
+Link: https://patchwork.kernel.org/patch/9392595/
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/x86/events/core.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/arch/x86/events/core.c
++++ b/arch/x86/events/core.c
+@@ -190,8 +190,8 @@ static void release_pmc_hardware(void) {
+
+ static bool check_hw_exists(void)
+ {
+- u64 val, val_fail, val_new= ~0;
+- int i, reg, reg_fail, ret = 0;
++ u64 val, val_fail = -1, val_new= ~0;
++ int i, reg, reg_fail = -1, ret = 0;
+ int bios_fail = 0;
+ int reg_safe = -1;
+
--- /dev/null
+From c0bfc549e96231e0ead4424de6e4933fde819d70 Mon Sep 17 00:00:00 2001
+From: Stephen Boyd <sboyd@codeaurora.org>
+Date: Wed, 25 Jan 2017 15:46:58 -0800
+Subject: perf: xgene: Include module.h
+
+From: Stephen Boyd <sboyd@codeaurora.org>
+
+commit c0bfc549e96231e0ead4424de6e4933fde819d70 upstream.
+
+I ran into a build error when I disabled CONFIG_ACPI and tried to
+compile this driver:
+
+drivers/perf/xgene_pmu.c:1242:1: warning: data definition has no type or storage class
+ MODULE_DEVICE_TABLE(of, xgene_pmu_of_match);
+ ^
+drivers/perf/xgene_pmu.c:1242:1: error: type defaults to 'int' in declaration of 'MODULE_DEVICE_TABLE' [-Werror=implicit-int]
+
+Include module.h for the MODULE_DEVICE_TABLE macro that's
+implicitly included through ACPI.
+
+Tested-by: Tai Nguyen <ttnguyen@apm.com>
+Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
+Signed-off-by: Will Deacon <will.deacon@arm.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/perf/xgene_pmu.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/perf/xgene_pmu.c
++++ b/drivers/perf/xgene_pmu.c
+@@ -25,6 +25,7 @@
+ #include <linux/interrupt.h>
+ #include <linux/io.h>
+ #include <linux/mfd/syscon.h>
++#include <linux/module.h>
+ #include <linux/of_address.h>
+ #include <linux/of_fdt.h>
+ #include <linux/of_irq.h>
--- /dev/null
+From b4aca383f9afb5f84b05de272656e6d4a919d995 Mon Sep 17 00:00:00 2001
+From: Borislav Petkov <bp@suse.de>
+Date: Sat, 26 Nov 2016 17:01:51 +0100
+Subject: platform/x86: intel_mid_thermal: Fix suspend handlers unused warning
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Borislav Petkov <bp@suse.de>
+
+commit b4aca383f9afb5f84b05de272656e6d4a919d995 upstream.
+
+Fix:
+
+ drivers/platform/x86/intel_mid_thermal.c:424:12: warning: ‘mid_thermal_resume’
+ defined but not used [-Wunused-function]
+ static int mid_thermal_resume(struct device *dev)
+ ^
+ drivers/platform/x86/intel_mid_thermal.c:436:12: warning: ‘mid_thermal_suspend’
+ defined but not used [-Wunused-function]
+ static int mid_thermal_suspend(struct device *dev)
+ ^
+
+which I see during randbuilds here.
+
+Signed-off-by: Borislav Petkov <bp@suse.de>
+Cc: Darren Hart <dvhart@infradead.org>
+Cc: platform-driver-x86@vger.kernel.org
+Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
+Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/platform/x86/intel_mid_thermal.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/drivers/platform/x86/intel_mid_thermal.c
++++ b/drivers/platform/x86/intel_mid_thermal.c
+@@ -415,6 +415,7 @@ static struct thermal_device_info *initi
+ return td_info;
+ }
+
++#ifdef CONFIG_PM_SLEEP
+ /**
+ * mid_thermal_resume - resume routine
+ * @dev: device structure
+@@ -442,6 +443,7 @@ static int mid_thermal_suspend(struct de
+ */
+ return configure_adc(0);
+ }
++#endif
+
+ static SIMPLE_DEV_PM_OPS(mid_thermal_pm,
+ mid_thermal_suspend, mid_thermal_resume);
--- /dev/null
+From mpe@ellerman.id.au Fri Feb 23 16:15:43 2018
+From: Michael Ellerman <mpe@ellerman.id.au>
+Date: Thu, 22 Feb 2018 23:35:45 +1100
+Subject: powerpc/64s: Improve RFI L1-D cache flush fallback
+To: stable@vger.kernel.org, greg@kroah.com
+Cc: npiggin@gmail.com, linuxppc-dev@ozlabs.org, linux@roeck-us.net, corsac@debian.org
+Message-ID: <20180222123545.8946-3-mpe@ellerman.id.au>
+
+
+From: Nicholas Piggin <npiggin@gmail.com>
+
+commit bdcb1aefc5b3f7d0f1dc8b02673602bca2ff7a4b upstream.
+
+The fallback RFI flush is used when firmware does not provide a way
+to flush the cache. It's a "displacement flush" that evicts useful
+data by displacing it with an uninteresting buffer.
+
+The flush has to take care to work with implementation specific cache
+replacment policies, so the recipe has been in flux. The initial
+slow but conservative approach is to touch all lines of a congruence
+class, with dependencies between each load. It has since been
+determined that a linear pattern of loads without dependencies is
+sufficient, and is significantly faster.
+
+Measuring the speed of a null syscall with RFI fallback flush enabled
+gives the relative improvement:
+
+P8 - 1.83x
+P9 - 1.75x
+
+The flush also becomes simpler and more adaptable to different cache
+geometries.
+
+Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
+[mpe: Backport to 4.9]
+Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/powerpc/include/asm/paca.h | 3 -
+ arch/powerpc/kernel/asm-offsets.c | 3 -
+ arch/powerpc/kernel/exceptions-64s.S | 76 ++++++++++++++++-------------------
+ arch/powerpc/kernel/setup_64.c | 13 -----
+ 4 files changed, 39 insertions(+), 56 deletions(-)
+
+--- a/arch/powerpc/include/asm/paca.h
++++ b/arch/powerpc/include/asm/paca.h
+@@ -212,8 +212,7 @@ struct paca_struct {
+ */
+ u64 exrfi[13] __aligned(0x80);
+ void *rfi_flush_fallback_area;
+- u64 l1d_flush_congruence;
+- u64 l1d_flush_sets;
++ u64 l1d_flush_size;
+ #endif
+ };
+
+--- a/arch/powerpc/kernel/asm-offsets.c
++++ b/arch/powerpc/kernel/asm-offsets.c
+@@ -242,8 +242,7 @@ int main(void)
+ DEFINE(PACA_IN_MCE, offsetof(struct paca_struct, in_mce));
+ DEFINE(PACA_RFI_FLUSH_FALLBACK_AREA, offsetof(struct paca_struct, rfi_flush_fallback_area));
+ DEFINE(PACA_EXRFI, offsetof(struct paca_struct, exrfi));
+- DEFINE(PACA_L1D_FLUSH_CONGRUENCE, offsetof(struct paca_struct, l1d_flush_congruence));
+- DEFINE(PACA_L1D_FLUSH_SETS, offsetof(struct paca_struct, l1d_flush_sets));
++ DEFINE(PACA_L1D_FLUSH_SIZE, offsetof(struct paca_struct, l1d_flush_size));
+ #endif
+ DEFINE(PACAHWCPUID, offsetof(struct paca_struct, hw_cpu_id));
+ DEFINE(PACAKEXECSTATE, offsetof(struct paca_struct, kexec_state));
+--- a/arch/powerpc/kernel/exceptions-64s.S
++++ b/arch/powerpc/kernel/exceptions-64s.S
+@@ -1602,39 +1602,37 @@ rfi_flush_fallback:
+ std r9,PACA_EXRFI+EX_R9(r13)
+ std r10,PACA_EXRFI+EX_R10(r13)
+ std r11,PACA_EXRFI+EX_R11(r13)
+- std r12,PACA_EXRFI+EX_R12(r13)
+- std r8,PACA_EXRFI+EX_R13(r13)
+ mfctr r9
+ ld r10,PACA_RFI_FLUSH_FALLBACK_AREA(r13)
+- ld r11,PACA_L1D_FLUSH_SETS(r13)
+- ld r12,PACA_L1D_FLUSH_CONGRUENCE(r13)
+- /*
+- * The load adresses are at staggered offsets within cachelines,
+- * which suits some pipelines better (on others it should not
+- * hurt).
+- */
+- addi r12,r12,8
++ ld r11,PACA_L1D_FLUSH_SIZE(r13)
++ srdi r11,r11,(7 + 3) /* 128 byte lines, unrolled 8x */
+ mtctr r11
+ DCBT_STOP_ALL_STREAM_IDS(r11) /* Stop prefetch streams */
+
+ /* order ld/st prior to dcbt stop all streams with flushing */
+ sync
+-1: li r8,0
+- .rept 8 /* 8-way set associative */
+- ldx r11,r10,r8
+- add r8,r8,r12
+- xor r11,r11,r11 // Ensure r11 is 0 even if fallback area is not
+- add r8,r8,r11 // Add 0, this creates a dependency on the ldx
+- .endr
+- addi r10,r10,128 /* 128 byte cache line */
++
++ /*
++ * The load adresses are at staggered offsets within cachelines,
++ * which suits some pipelines better (on others it should not
++ * hurt).
++ */
++1:
++ ld r11,(0x80 + 8)*0(r10)
++ ld r11,(0x80 + 8)*1(r10)
++ ld r11,(0x80 + 8)*2(r10)
++ ld r11,(0x80 + 8)*3(r10)
++ ld r11,(0x80 + 8)*4(r10)
++ ld r11,(0x80 + 8)*5(r10)
++ ld r11,(0x80 + 8)*6(r10)
++ ld r11,(0x80 + 8)*7(r10)
++ addi r10,r10,0x80*8
+ bdnz 1b
+
+ mtctr r9
+ ld r9,PACA_EXRFI+EX_R9(r13)
+ ld r10,PACA_EXRFI+EX_R10(r13)
+ ld r11,PACA_EXRFI+EX_R11(r13)
+- ld r12,PACA_EXRFI+EX_R12(r13)
+- ld r8,PACA_EXRFI+EX_R13(r13)
+ GET_SCRATCH0(r13);
+ rfid
+
+@@ -1645,39 +1643,37 @@ hrfi_flush_fallback:
+ std r9,PACA_EXRFI+EX_R9(r13)
+ std r10,PACA_EXRFI+EX_R10(r13)
+ std r11,PACA_EXRFI+EX_R11(r13)
+- std r12,PACA_EXRFI+EX_R12(r13)
+- std r8,PACA_EXRFI+EX_R13(r13)
+ mfctr r9
+ ld r10,PACA_RFI_FLUSH_FALLBACK_AREA(r13)
+- ld r11,PACA_L1D_FLUSH_SETS(r13)
+- ld r12,PACA_L1D_FLUSH_CONGRUENCE(r13)
+- /*
+- * The load adresses are at staggered offsets within cachelines,
+- * which suits some pipelines better (on others it should not
+- * hurt).
+- */
+- addi r12,r12,8
++ ld r11,PACA_L1D_FLUSH_SIZE(r13)
++ srdi r11,r11,(7 + 3) /* 128 byte lines, unrolled 8x */
+ mtctr r11
+ DCBT_STOP_ALL_STREAM_IDS(r11) /* Stop prefetch streams */
+
+ /* order ld/st prior to dcbt stop all streams with flushing */
+ sync
+-1: li r8,0
+- .rept 8 /* 8-way set associative */
+- ldx r11,r10,r8
+- add r8,r8,r12
+- xor r11,r11,r11 // Ensure r11 is 0 even if fallback area is not
+- add r8,r8,r11 // Add 0, this creates a dependency on the ldx
+- .endr
+- addi r10,r10,128 /* 128 byte cache line */
++
++ /*
++ * The load adresses are at staggered offsets within cachelines,
++ * which suits some pipelines better (on others it should not
++ * hurt).
++ */
++1:
++ ld r11,(0x80 + 8)*0(r10)
++ ld r11,(0x80 + 8)*1(r10)
++ ld r11,(0x80 + 8)*2(r10)
++ ld r11,(0x80 + 8)*3(r10)
++ ld r11,(0x80 + 8)*4(r10)
++ ld r11,(0x80 + 8)*5(r10)
++ ld r11,(0x80 + 8)*6(r10)
++ ld r11,(0x80 + 8)*7(r10)
++ addi r10,r10,0x80*8
+ bdnz 1b
+
+ mtctr r9
+ ld r9,PACA_EXRFI+EX_R9(r13)
+ ld r10,PACA_EXRFI+EX_R10(r13)
+ ld r11,PACA_EXRFI+EX_R11(r13)
+- ld r12,PACA_EXRFI+EX_R12(r13)
+- ld r8,PACA_EXRFI+EX_R13(r13)
+ GET_SCRATCH0(r13);
+ hrfid
+
+--- a/arch/powerpc/kernel/setup_64.c
++++ b/arch/powerpc/kernel/setup_64.c
+@@ -745,19 +745,8 @@ static void init_fallback_flush(void)
+ memset(l1d_flush_fallback_area, 0, l1d_size * 2);
+
+ for_each_possible_cpu(cpu) {
+- /*
+- * The fallback flush is currently coded for 8-way
+- * associativity. Different associativity is possible, but it
+- * will be treated as 8-way and may not evict the lines as
+- * effectively.
+- *
+- * 128 byte lines are mandatory.
+- */
+- u64 c = l1d_size / 8;
+-
+ paca[cpu].rfi_flush_fallback_area = l1d_flush_fallback_area;
+- paca[cpu].l1d_flush_congruence = c;
+- paca[cpu].l1d_flush_sets = c / 128;
++ paca[cpu].l1d_flush_size = l1d_size;
+ }
+ }
+
--- /dev/null
+From mpe@ellerman.id.au Fri Feb 23 16:14:29 2018
+From: Michael Ellerman <mpe@ellerman.id.au>
+Date: Thu, 22 Feb 2018 23:35:44 +1100
+Subject: powerpc/64s: Simple RFI macro conversions
+To: stable@vger.kernel.org, greg@kroah.com
+Cc: npiggin@gmail.com, linuxppc-dev@ozlabs.org, linux@roeck-us.net, corsac@debian.org
+Message-ID: <20180222123545.8946-2-mpe@ellerman.id.au>
+
+From: Nicholas Piggin <npiggin@gmail.com>
+
+commit 222f20f140623ef6033491d0103ee0875fe87d35 upstream.
+
+This commit does simple conversions of rfi/rfid to the new macros that
+include the expected destination context. By simple we mean cases
+where there is a single well known destination context, and it's
+simply a matter of substituting the instruction for the appropriate
+macro.
+
+Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
+[mpe: Backport to 4.9, use RFI_TO_KERNEL in idle_book3s.S]
+Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/powerpc/include/asm/exception-64s.h | 2 +-
+ arch/powerpc/kernel/entry_64.S | 9 ++++-----
+ arch/powerpc/kernel/exceptions-64s.S | 22 +++++++++++-----------
+ arch/powerpc/kernel/idle_book3s.S | 7 ++++---
+ arch/powerpc/kvm/book3s_hv_rmhandlers.S | 7 +++----
+ arch/powerpc/kvm/book3s_rmhandlers.S | 7 +++++--
+ arch/powerpc/kvm/book3s_segment.S | 4 ++--
+ 7 files changed, 30 insertions(+), 28 deletions(-)
+
+--- a/arch/powerpc/include/asm/exception-64s.h
++++ b/arch/powerpc/include/asm/exception-64s.h
+@@ -242,7 +242,7 @@ END_FTR_SECTION_NESTED(ftr,ftr,943)
+ mtspr SPRN_##h##SRR0,r12; \
+ mfspr r12,SPRN_##h##SRR1; /* and SRR1 */ \
+ mtspr SPRN_##h##SRR1,r10; \
+- h##rfid; \
++ h##RFI_TO_KERNEL; \
+ b . /* prevent speculative execution */
+ #define EXCEPTION_PROLOG_PSERIES_1(label, h) \
+ __EXCEPTION_PROLOG_PSERIES_1(label, h)
+--- a/arch/powerpc/kernel/entry_64.S
++++ b/arch/powerpc/kernel/entry_64.S
+@@ -401,8 +401,7 @@ tabort_syscall:
+ mtmsrd r10, 1
+ mtspr SPRN_SRR0, r11
+ mtspr SPRN_SRR1, r12
+-
+- rfid
++ RFI_TO_USER
+ b . /* prevent speculative execution */
+ #endif
+
+@@ -1078,7 +1077,7 @@ _GLOBAL(enter_rtas)
+
+ mtspr SPRN_SRR0,r5
+ mtspr SPRN_SRR1,r6
+- rfid
++ RFI_TO_KERNEL
+ b . /* prevent speculative execution */
+
+ rtas_return_loc:
+@@ -1103,7 +1102,7 @@ rtas_return_loc:
+
+ mtspr SPRN_SRR0,r3
+ mtspr SPRN_SRR1,r4
+- rfid
++ RFI_TO_KERNEL
+ b . /* prevent speculative execution */
+
+ .align 3
+@@ -1174,7 +1173,7 @@ _GLOBAL(enter_prom)
+ LOAD_REG_IMMEDIATE(r12, MSR_SF | MSR_ISF | MSR_LE)
+ andc r11,r11,r12
+ mtsrr1 r11
+- rfid
++ RFI_TO_KERNEL
+ #endif /* CONFIG_PPC_BOOK3E */
+
+ 1: /* Return from OF */
+--- a/arch/powerpc/kernel/exceptions-64s.S
++++ b/arch/powerpc/kernel/exceptions-64s.S
+@@ -244,7 +244,7 @@ BEGIN_FTR_SECTION
+ LOAD_HANDLER(r12, machine_check_handle_early)
+ 1: mtspr SPRN_SRR0,r12
+ mtspr SPRN_SRR1,r11
+- rfid
++ RFI_TO_KERNEL
+ b . /* prevent speculative execution */
+ 2:
+ /* Stack overflow. Stay on emergency stack and panic.
+@@ -280,7 +280,7 @@ machine_check_pSeries_0:
+ mtspr SPRN_SRR0,r12
+ mfspr r12,SPRN_SRR1
+ mtspr SPRN_SRR1,r10
+- rfid
++ RFI_TO_KERNEL
+ b . /* prevent speculative execution */
+
+ TRAMP_KVM_SKIP(PACA_EXMC, 0x200)
+@@ -446,7 +446,7 @@ EXC_COMMON_BEGIN(machine_check_handle_ea
+ li r3,MSR_ME
+ andc r10,r10,r3 /* Turn off MSR_ME */
+ mtspr SPRN_SRR1,r10
+- rfid
++ RFI_TO_KERNEL
+ b .
+ 2:
+ /*
+@@ -464,7 +464,7 @@ EXC_COMMON_BEGIN(machine_check_handle_ea
+ */
+ bl machine_check_queue_event
+ MACHINE_CHECK_HANDLER_WINDUP
+- rfid
++ RFI_TO_USER_OR_KERNEL
+ 9:
+ /* Deliver the machine check to host kernel in V mode. */
+ MACHINE_CHECK_HANDLER_WINDUP
+@@ -706,7 +706,7 @@ END_MMU_FTR_SECTION_IFCLR(MMU_FTR_TYPE_R
+ mtspr SPRN_SRR0,r10
+ ld r10,PACAKMSR(r13)
+ mtspr SPRN_SRR1,r10
+- rfid
++ RFI_TO_KERNEL
+ b .
+
+ EXC_COMMON_BEGIN(unrecov_slb)
+@@ -893,7 +893,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_REAL_LE)
+ mtspr SPRN_SRR0,r10 ; \
+ ld r10,PACAKMSR(r13) ; \
+ mtspr SPRN_SRR1,r10 ; \
+- rfid ; \
++ RFI_TO_KERNEL ; \
+ b . ; /* prevent speculative execution */
+
+ #define SYSCALL_PSERIES_3 \
+@@ -901,7 +901,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_REAL_LE)
+ 1: mfspr r12,SPRN_SRR1 ; \
+ xori r12,r12,MSR_LE ; \
+ mtspr SPRN_SRR1,r12 ; \
+- rfid ; /* return to userspace */ \
++ RFI_TO_USER ; /* return to userspace */ \
+ b . ; /* prevent speculative execution */
+
+ #if defined(CONFIG_RELOCATABLE)
+@@ -1276,7 +1276,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_CFAR)
+ ld r11,PACA_EXGEN+EX_R11(r13)
+ ld r12,PACA_EXGEN+EX_R12(r13)
+ ld r13,PACA_EXGEN+EX_R13(r13)
+- HRFID
++ HRFI_TO_UNKNOWN
+ b .
+ #endif
+
+@@ -1350,7 +1350,7 @@ masked_##_H##interrupt: \
+ ld r10,PACA_EXGEN+EX_R10(r13); \
+ ld r11,PACA_EXGEN+EX_R11(r13); \
+ GET_SCRATCH0(r13); \
+- ##_H##rfid; \
++ ##_H##RFI_TO_KERNEL; \
+ b .
+
+ /*
+@@ -1372,7 +1372,7 @@ TRAMP_REAL_BEGIN(kvmppc_skip_interrupt)
+ addi r13, r13, 4
+ mtspr SPRN_SRR0, r13
+ GET_SCRATCH0(r13)
+- rfid
++ RFI_TO_KERNEL
+ b .
+
+ TRAMP_REAL_BEGIN(kvmppc_skip_Hinterrupt)
+@@ -1384,7 +1384,7 @@ TRAMP_REAL_BEGIN(kvmppc_skip_Hinterrupt)
+ addi r13, r13, 4
+ mtspr SPRN_HSRR0, r13
+ GET_SCRATCH0(r13)
+- hrfid
++ HRFI_TO_KERNEL
+ b .
+ #endif
+
+--- a/arch/powerpc/kernel/idle_book3s.S
++++ b/arch/powerpc/kernel/idle_book3s.S
+@@ -9,6 +9,7 @@
+ */
+
+ #include <linux/threads.h>
++#include <asm/exception-64s.h>
+ #include <asm/processor.h>
+ #include <asm/page.h>
+ #include <asm/cputable.h>
+@@ -178,7 +179,7 @@ _GLOBAL(pnv_powersave_common)
+ mtmsrd r6, 1 /* clear RI before setting SRR0/1 */
+ mtspr SPRN_SRR0, r5
+ mtspr SPRN_SRR1, r7
+- rfid
++ RFI_TO_KERNEL
+
+ .globl pnv_enter_arch207_idle_mode
+ pnv_enter_arch207_idle_mode:
+@@ -668,7 +669,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_HVMODE)
+ mtcr r6
+ mtspr SPRN_SRR1,r4
+ mtspr SPRN_SRR0,r5
+- rfid
++ RFI_TO_KERNEL
+
+ /*
+ * R3 here contains the value that will be returned to the caller
+@@ -689,4 +690,4 @@ END_FTR_SECTION_IFSET(CPU_FTR_HVMODE)
+ mtcr r6
+ mtspr SPRN_SRR1,r4
+ mtspr SPRN_SRR0,r5
+- rfid
++ RFI_TO_KERNEL
+--- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S
++++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
+@@ -65,7 +65,7 @@ _GLOBAL_TOC(kvmppc_hv_entry_trampoline)
+ mtmsrd r0,1 /* clear RI in MSR */
+ mtsrr0 r5
+ mtsrr1 r6
+- RFI
++ RFI_TO_KERNEL
+
+ kvmppc_call_hv_entry:
+ ld r4, HSTATE_KVM_VCPU(r13)
+@@ -171,7 +171,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S)
+ mtsrr0 r8
+ mtsrr1 r7
+ beq cr1, 13f /* machine check */
+- RFI
++ RFI_TO_KERNEL
+
+ /* On POWER7, we have external interrupts set to use HSRR0/1 */
+ 11: mtspr SPRN_HSRR0, r8
+@@ -1018,8 +1018,7 @@ BEGIN_FTR_SECTION
+ END_FTR_SECTION_IFSET(CPU_FTR_HAS_PPR)
+ ld r0, VCPU_GPR(R0)(r4)
+ ld r4, VCPU_GPR(R4)(r4)
+-
+- hrfid
++ HRFI_TO_GUEST
+ b .
+
+ secondary_too_late:
+--- a/arch/powerpc/kvm/book3s_rmhandlers.S
++++ b/arch/powerpc/kvm/book3s_rmhandlers.S
+@@ -46,6 +46,9 @@
+
+ #define FUNC(name) name
+
++#define RFI_TO_KERNEL RFI
++#define RFI_TO_GUEST RFI
++
+ .macro INTERRUPT_TRAMPOLINE intno
+
+ .global kvmppc_trampoline_\intno
+@@ -141,7 +144,7 @@ kvmppc_handler_skip_ins:
+ GET_SCRATCH0(r13)
+
+ /* And get back into the code */
+- RFI
++ RFI_TO_KERNEL
+ #endif
+
+ /*
+@@ -164,6 +167,6 @@ _GLOBAL_TOC(kvmppc_entry_trampoline)
+ ori r5, r5, MSR_EE
+ mtsrr0 r7
+ mtsrr1 r6
+- RFI
++ RFI_TO_KERNEL
+
+ #include "book3s_segment.S"
+--- a/arch/powerpc/kvm/book3s_segment.S
++++ b/arch/powerpc/kvm/book3s_segment.S
+@@ -156,7 +156,7 @@ no_dcbz32_on:
+ PPC_LL r9, SVCPU_R9(r3)
+ PPC_LL r3, (SVCPU_R3)(r3)
+
+- RFI
++ RFI_TO_GUEST
+ kvmppc_handler_trampoline_enter_end:
+
+
+@@ -389,5 +389,5 @@ END_FTR_SECTION_IFSET(CPU_FTR_HVMODE)
+ cmpwi r12, BOOK3S_INTERRUPT_DOORBELL
+ beqa BOOK3S_INTERRUPT_DOORBELL
+
+- RFI
++ RFI_TO_KERNEL
+ kvmppc_handler_trampoline_exit_end:
--- /dev/null
+From d4c2269b3d5d06a8ea434b1841fbcaec336ed396 Mon Sep 17 00:00:00 2001
+From: Ilya Dryomov <idryomov@gmail.com>
+Date: Tue, 6 Sep 2016 11:15:48 +0200
+Subject: rbd: silence bogus -Wmaybe-uninitialized warning
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Ilya Dryomov <idryomov@gmail.com>
+
+commit d4c2269b3d5d06a8ea434b1841fbcaec336ed396 upstream.
+
+drivers/block/rbd.c: In function ‘rbd_watch_cb’:
+drivers/block/rbd.c:3690:5: error: ‘struct_v’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
+drivers/block/rbd.c:3759:5: note: ‘struct_v’ was declared here
+
+Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/block/rbd.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/block/rbd.c
++++ b/drivers/block/rbd.c
+@@ -3756,7 +3756,7 @@ static void rbd_watch_cb(void *arg, u64
+ struct rbd_device *rbd_dev = arg;
+ void *p = data;
+ void *const end = p + data_len;
+- u8 struct_v;
++ u8 struct_v = 0;
+ u32 len;
+ u32 notify_op;
+ int ret;
--- /dev/null
+From ab4949640d6674b617b314ad3c2c00353304bab9 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Thu, 23 Mar 2017 16:06:13 +0100
+Subject: reiserfs: avoid a -Wmaybe-uninitialized warning
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit ab4949640d6674b617b314ad3c2c00353304bab9 upstream.
+
+The latest gcc-7.0.1 snapshot warns about an unintialized variable use:
+
+In file included from fs/reiserfs/lbalance.c:8:0:
+fs/reiserfs/lbalance.c: In function 'leaf_item_bottle.isra.3':
+fs/reiserfs/reiserfs.h:1279:13: error: '*((void *)&n_ih+8).v' may be used uninitialized in this function [-Werror=maybe-uninitialized]
+ v2->v = (v2->v & cpu_to_le64(15ULL << 60)) | cpu_to_le64(offset);
+ ~~^~~
+fs/reiserfs/reiserfs.h:1279:13: error: '*((void *)&n_ih+8).v' may be used uninitialized in this function [-Werror=maybe-uninitialized]
+ v2->v = (v2->v & cpu_to_le64(15ULL << 60)) | cpu_to_le64(offset);
+
+This happens because the offset/type pair that is stored in
+ih.key.u.k_offset_v2 is actually uninitialized when we call
+set_le_ih_k_offset() and set_le_ih_k_type(). After we have called both,
+all data is correct, but the first of the two reads uninitialized data
+for the type field and writes it back before it gets overwritten.
+
+This works around the warning by initializing the k_offset_v2 through
+the slightly larger memcpy().
+
+[JK: Remove now unused define and make it obvious we initialize the key]
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Jan Kara <jack@suse.cz>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/reiserfs/lbalance.c | 2 +-
+ fs/reiserfs/reiserfs.h | 1 -
+ 2 files changed, 1 insertion(+), 2 deletions(-)
+
+--- a/fs/reiserfs/lbalance.c
++++ b/fs/reiserfs/lbalance.c
+@@ -475,7 +475,7 @@ static void leaf_item_bottle(struct buff
+ * 'cpy_bytes'; create new item header;
+ * n_ih = new item_header;
+ */
+- memcpy(&n_ih, ih, SHORT_KEY_SIZE);
++ memcpy(&n_ih.ih_key, &ih->ih_key, KEY_SIZE);
+
+ /* Endian safe, both le */
+ n_ih.ih_version = ih->ih_version;
+--- a/fs/reiserfs/reiserfs.h
++++ b/fs/reiserfs/reiserfs.h
+@@ -1326,7 +1326,6 @@ struct cpu_key {
+ #define KEY_NOT_FOUND 0
+
+ #define KEY_SIZE (sizeof(struct reiserfs_key))
+-#define SHORT_KEY_SIZE (sizeof (__u32) + sizeof (__u32))
+
+ /* return values for search_by_key and clones */
+ #define ITEM_FOUND 1
--- /dev/null
+From f46e7cd36b5f2ce2bfb567e278a10ca717f85b84 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Mon, 24 Oct 2016 17:51:55 +0200
+Subject: scsi: advansys: fix build warning for PCI=n
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit f46e7cd36b5f2ce2bfb567e278a10ca717f85b84 upstream.
+
+The advansys probe function tries to handle both ISA and PCI cases, each
+hidden in an #ifdef when unused. This leads to a warning indicating that
+when PCI is disabled we could be using uninitialized data:
+
+drivers/scsi/advansys.c: In function advansys_board_found :
+drivers/scsi/advansys.c:11036:5: error: ret may be used uninitialized in this function [-Werror=maybe-uninitialized]
+drivers/scsi/advansys.c:10928:28: note: ret was declared here
+drivers/scsi/advansys.c:11309:8: error: share_irq may be used uninitialized in this function [-Werror=maybe-uninitialized]
+drivers/scsi/advansys.c:10928:6: note: share_irq was declared here
+
+This cannot happen in practice because the hardware in question only
+exists for PCI, but changing the code to just error out here is better
+for consistency and avoids the warning.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Reviewed-by: Hannes Reinecke <hare@suse.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/scsi/advansys.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/drivers/scsi/advansys.c
++++ b/drivers/scsi/advansys.c
+@@ -11030,6 +11030,9 @@ static int advansys_board_found(struct S
+ ASC_DBG(2, "AdvInitGetConfig()\n");
+
+ ret = AdvInitGetConfig(pdev, shost) ? -ENODEV : 0;
++#else
++ share_irq = 0;
++ ret = -ENODEV;
+ #endif /* CONFIG_PCI */
+ }
+
--- /dev/null
+From 44a5b977128c0ffff0654392b40f4c2ce72a619b Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Thu, 23 Mar 2017 16:02:18 +0100
+Subject: scsi: advansys: fix uninitialized data access
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit 44a5b977128c0ffff0654392b40f4c2ce72a619b upstream.
+
+gcc-7.0.1 now warns about a previously unnoticed access of uninitialized
+struct members:
+
+drivers/scsi/advansys.c: In function 'AscMsgOutSDTR':
+drivers/scsi/advansys.c:3860:26: error: '*((void *)&sdtr_buf+5)' may be used uninitialized in this function [-Werror=maybe-uninitialized]
+ ((ushort)s_buffer[i + 1] << 8) | s_buffer[i]);
+ ^
+drivers/scsi/advansys.c:3860:26: error: '*((void *)&sdtr_buf+7)' may be used uninitialized in this function [-Werror=maybe-uninitialized]
+drivers/scsi/advansys.c:3860:26: error: '*((void *)&sdtr_buf+5)' may be used uninitialized in this function [-Werror=maybe-uninitialized]
+drivers/scsi/advansys.c:3860:26: error: '*((void *)&sdtr_buf+7)' may be used uninitialized in this function [-Werror=maybe-uninitialized]
+
+The code has existed in this exact form at least since v2.6.12, and the
+warning seems correct. This uses named initializers to ensure we
+initialize all members of the structure.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/scsi/advansys.c | 21 ++++++++++-----------
+ 1 file changed, 10 insertions(+), 11 deletions(-)
+
+--- a/drivers/scsi/advansys.c
++++ b/drivers/scsi/advansys.c
+@@ -6291,18 +6291,17 @@ static uchar AscGetSynPeriodIndex(ASC_DV
+ static uchar
+ AscMsgOutSDTR(ASC_DVC_VAR *asc_dvc, uchar sdtr_period, uchar sdtr_offset)
+ {
+- EXT_MSG sdtr_buf;
+- uchar sdtr_period_index;
+- PortAddr iop_base;
+-
+- iop_base = asc_dvc->iop_base;
+- sdtr_buf.msg_type = EXTENDED_MESSAGE;
+- sdtr_buf.msg_len = MS_SDTR_LEN;
+- sdtr_buf.msg_req = EXTENDED_SDTR;
+- sdtr_buf.xfer_period = sdtr_period;
++ PortAddr iop_base = asc_dvc->iop_base;
++ uchar sdtr_period_index = AscGetSynPeriodIndex(asc_dvc, sdtr_period);
++ EXT_MSG sdtr_buf = {
++ .msg_type = EXTENDED_MESSAGE,
++ .msg_len = MS_SDTR_LEN,
++ .msg_req = EXTENDED_SDTR,
++ .xfer_period = sdtr_period,
++ .req_ack_offset = sdtr_offset,
++ };
+ sdtr_offset &= ASC_SYN_MAX_OFFSET;
+- sdtr_buf.req_ack_offset = sdtr_offset;
+- sdtr_period_index = AscGetSynPeriodIndex(asc_dvc, sdtr_period);
++
+ if (sdtr_period_index <= asc_dvc->max_sdtr_index) {
+ AscMemWordCopyPtrToLram(iop_base, ASCV_MSGOUT_BEG,
+ (uchar *)&sdtr_buf,
--- /dev/null
+From 3cd18d1981731d5f74b8e437009124ac99905d14 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Wed, 4 Oct 2017 12:27:00 +0200
+Subject: security/keys: BIG_KEY requires CONFIG_CRYPTO
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit 3cd18d1981731d5f74b8e437009124ac99905d14 upstream.
+
+The recent rework introduced a possible randconfig build failure
+when CONFIG_CRYPTO configured to only allow modules:
+
+security/keys/big_key.o: In function `big_key_crypt':
+big_key.c:(.text+0x29f): undefined reference to `crypto_aead_setkey'
+security/keys/big_key.o: In function `big_key_init':
+big_key.c:(.init.text+0x1a): undefined reference to `crypto_alloc_aead'
+big_key.c:(.init.text+0x45): undefined reference to `crypto_aead_setauthsize'
+big_key.c:(.init.text+0x77): undefined reference to `crypto_destroy_tfm'
+crypto/gcm.o: In function `gcm_hash_crypt_remain_continue':
+gcm.c:(.text+0x167): undefined reference to `crypto_ahash_finup'
+crypto/gcm.o: In function `crypto_gcm_exit_tfm':
+gcm.c:(.text+0x847): undefined reference to `crypto_destroy_tfm'
+
+When we 'select CRYPTO' like the other users, we always get a
+configuration that builds.
+
+Fixes: 428490e38b2e ("security/keys: rewrite all of big_key crypto")
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: David Howells <dhowells@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ security/keys/Kconfig | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/security/keys/Kconfig
++++ b/security/keys/Kconfig
+@@ -45,6 +45,7 @@ config BIG_KEYS
+ bool "Large payload keys"
+ depends on KEYS
+ depends on TMPFS
++ select CRYPTO
+ select CRYPTO_AES
+ select CRYPTO_GCM
+ help
xen-xen_acpi_processor-is-dom0-only.patch
hippi-fix-a-fix-a-possible-sleep-in-atomic-bug-in-rr_close.patch
powerpc-64s-fix-conversion-of-slb_miss_common-to-use-rfi_to_user-kernel.patch
+powerpc-64s-simple-rfi-macro-conversions.patch
+powerpc-64s-improve-rfi-l1-d-cache-flush-fallback.patch
+crypto-talitos-fix-kernel-oops-on-hashing-an-empty-file.patch
+drm-i915-fix-intel_backlight_device_register-declaration.patch
+shmem-avoid-maybe-uninitialized-warning.patch
+clk-sunxi-ng-fix-build-error-without-config_reset_controller.patch
+vmxnet3-prevent-building-with-64k-pages.patch
+perf-x86-shut-up-false-positive-wmaybe-uninitialized-warning.patch
+pci-vmd-fix-suspend-handlers-defined-but-not-used-warning.patch
+gpio-intel-mid-fix-build-warning-when-config_pm.patch
+platform-x86-intel_mid_thermal-fix-suspend-handlers-unused-warning.patch
+usb-musb-fix-compilation-warning-on-unused-function.patch
+pci-change-pci_host_common_probe-visibility.patch
+perf-xgene-include-module.h.patch
+video-fbdev-via-remove-possibly-unused-variables.patch
+scsi-advansys-fix-build-warning-for-pci-n.patch
+x86-ras-inject-make-it-depend-on-x86_local_apic-y.patch
+gpio-xgene-mark-pm-functions-as-__maybe_unused.patch
+arm64-define-bug-instruction-without-config_bug.patch
+x86-fpu-math-emu-fix-possible-uninitialized-variable-use.patch
+tools-build-add-tools-tree-support-for-make-s.patch
+x86-build-silence-the-build-with-make-s.patch
+thermal-fix-intel_soc_dts_iosf_core-dependencies.patch
+x86-add-multiuser-dependency-for-kvm.patch
+dmaengine-zx-fix-build-warning.patch
+x86-platform-add-pci-dependency-for-punit_atom_debug.patch
+x86-vm86-fix-unused-variable-warning-if-thp-is-disabled.patch
+scsi-advansys-fix-uninitialized-data-access.patch
+arm64-kconfig-select-compat_binfmt_elf-only-when-binfmt_elf-is-set.patch
+alsa-hda-ca0132-fix-possible-null-pointer-use.patch
+reiserfs-avoid-a-wmaybe-uninitialized-warning.patch
+cw1200-fix-bogus-maybe-uninitialized-warning.patch
+security-keys-big_key-requires-config_crypto.patch
+drm-exynos-mark-pm-functions-as-__maybe_unused.patch
+rbd-silence-bogus-wmaybe-uninitialized-warning.patch
+drm-nouveau-hide-gcc-4.9-wmaybe-uninitialized.patch
+input-tca8418_keypad-hide-gcc-4.9-wmaybe-uninitialized-warning.patch
+kvm-add-x86_local_apic-dependency.patch
+shmem-fix-compilation-warnings-on-unused-functions.patch
+tc358743-fix-register-i2c_rd-wr-functions.patch
+go7007-add-media_camera_support-dependency.patch
+em28xx-only-use-mt9v011-if-camera-support-is-enabled.patch
+tw5864-use-dev_warn-instead-of-warn-to-shut-up-warning.patch
+isdn-eicon-reduce-stack-size-of-sig_ind-function.patch
+clk-meson-gxbb-fix-build-error-without-reset_controller.patch
+kasan-rework-kconfig-settings.patch
+drm-i915-hide-unused-intel_panel_set_backlight-function.patch
+arm64-sunxi-always-enable-reset-controller.patch
+binfmt_elf-compat-avoid-unused-function-warning.patch
+spi-bcm-qspi-shut-up-warning-about-cfi-header-inclusion.patch
+idle-i7300-add-pci-dependency.patch
+arm64-fix-warning-about-swapper_pg_dir-overflow.patch
+usb-phy-msm-add-regulator-dependency.patch
+x86-microcode-amd-change-load_microcode_amd-s-param-to-bool-to-fix-preemptibility-bug.patch
--- /dev/null
+From 23f919d4ad0eb325595f10f55be4301b2965d6d6 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Mon, 12 Dec 2016 16:42:28 -0800
+Subject: shmem: avoid maybe-uninitialized warning
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit 23f919d4ad0eb325595f10f55be4301b2965d6d6 upstream.
+
+After enabling -Wmaybe-uninitialized warnings, we get a false-postive
+warning for shmem:
+
+ mm/shmem.c: In function `shmem_getpage_gfp':
+ include/linux/spinlock.h:332:21: error: `info' may be used uninitialized in this function [-Werror=maybe-uninitialized]
+
+This can be easily avoided, since the correct 'info' pointer is known at
+the time we first enter the function, so we can simply move the
+initialization up. Moving it before the first label avoids the warning
+and lets us remove two later initializations.
+
+Note that the function is so hard to read that it not only confuses the
+compiler, but also most readers and without this patch it could\ easily
+break if one of the 'goto's changed.
+
+Link: https://www.spinics.net/lists/kernel/msg2368133.html
+Link: http://lkml.kernel.org/r/20161024205725.786455-1-arnd@arndb.de
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Acked-by: Michal Hocko <mhocko@suse.com>
+Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
+Acked-by: Vlastimil Babka <vbabka@suse.cz>
+Cc: Hugh Dickins <hughd@google.com>
+Cc: Andreas Gruenbacher <agruenba@redhat.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>
+
+---
+ mm/shmem.c | 4 +---
+ 1 file changed, 1 insertion(+), 3 deletions(-)
+
+--- a/mm/shmem.c
++++ b/mm/shmem.c
+@@ -1550,7 +1550,7 @@ static int shmem_getpage_gfp(struct inod
+ struct mm_struct *fault_mm, int *fault_type)
+ {
+ struct address_space *mapping = inode->i_mapping;
+- struct shmem_inode_info *info;
++ struct shmem_inode_info *info = SHMEM_I(inode);
+ struct shmem_sb_info *sbinfo;
+ struct mm_struct *charge_mm;
+ struct mem_cgroup *memcg;
+@@ -1600,7 +1600,6 @@ repeat:
+ * Fast cache lookup did not find it:
+ * bring it back from swap or allocate.
+ */
+- info = SHMEM_I(inode);
+ sbinfo = SHMEM_SB(inode->i_sb);
+ charge_mm = fault_mm ? : current->mm;
+
+@@ -1852,7 +1851,6 @@ unlock:
+ put_page(page);
+ }
+ if (error == -ENOSPC && !once++) {
+- info = SHMEM_I(inode);
+ spin_lock_irq(&info->lock);
+ shmem_recalc_inode(inode);
+ spin_unlock_irq(&info->lock);
--- /dev/null
+From f1f5929cd9715c1cdfe07a890f12ac7d2c5304ec Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Lefaure?= <jeremy.lefaure@lse.epita.fr>
+Date: Mon, 12 Dec 2016 16:43:23 -0800
+Subject: shmem: fix compilation warnings on unused functions
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Jérémy Lefaure <jeremy.lefaure@lse.epita.fr>
+
+commit f1f5929cd9715c1cdfe07a890f12ac7d2c5304ec upstream.
+
+Compiling shmem.c with SHMEM and TRANSAPRENT_HUGE_PAGECACHE enabled
+raises warnings on two unused functions when CONFIG_TMPFS and
+CONFIG_SYSFS are both disabled:
+
+ mm/shmem.c:390:20: warning: `shmem_format_huge' defined but not used [-Wunused-function]
+ static const char *shmem_format_huge(int huge)
+ ^~~~~~~~~~~~~~~~~
+ mm/shmem.c:373:12: warning: `shmem_parse_huge' defined but not used [-Wunused-function]
+ static int shmem_parse_huge(const char *str)
+ ^~~~~~~~~~~~~~~~
+
+A conditional compilation on tmpfs or sysfs removes the warnings.
+
+Link: http://lkml.kernel.org/r/20161118055749.11313-1-jeremy.lefaure@lse.epita.fr
+Signed-off-by: Jérémy Lefaure <jeremy.lefaure@lse.epita.fr>
+Acked-by: Hugh Dickins <hughd@google.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>
+
+---
+ mm/shmem.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/mm/shmem.c
++++ b/mm/shmem.c
+@@ -370,6 +370,7 @@ static bool shmem_confirm_swap(struct ad
+
+ int shmem_huge __read_mostly;
+
++#if defined(CONFIG_SYSFS) || defined(CONFIG_TMPFS)
+ static int shmem_parse_huge(const char *str)
+ {
+ if (!strcmp(str, "never"))
+@@ -407,6 +408,7 @@ static const char *shmem_format_huge(int
+ return "bad_val";
+ }
+ }
++#endif
+
+ static unsigned long shmem_unused_huge_shrink(struct shmem_sb_info *sbinfo,
+ struct shrink_control *sc, unsigned long nr_to_split)
--- /dev/null
+From foo@baz Fri Feb 23 16:40:21 CET 2018
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Mon, 19 Feb 2018 11:13:24 +0100
+Subject: spi: bcm-qspi: shut up warning about cfi header inclusion
+To: stable@vger.kernel.org
+Cc: Greg KH <gregkh@linuxfoundation.org>, linux-kernel@vger.kernel.org, Arnd Bergmann <arnd@arndb.de>, Mark Brown <broonie@kernel.org>, Sasha Levin <alexander.levin@verizon.com>, Geert Uytterhoeven <geert@linux-m68k.org>, linux-spi@vger.kernel.org
+Message-ID: <20180219101343.2922561-6-arnd@arndb.de>
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+When CONFIG_MTD_CFI is disabled, we get a warning for this spi driver:
+
+include/linux/mtd/cfi.h:76:2: #warning No CONFIG_MTD_CFI_Ix selected. No NOR chip support can work. [-Werror=cpp]
+
+The problem here is a layering violation that was fixed in mainline kernels with
+a larger rework in commit 054e532f8f90 ("spi: bcm-qspi: Remove hardcoded settings
+and spi-nor.h dependency"). We can't really backport that to stable kernels, so
+this just adds a Kconfig dependency to make it either build cleanly or force it
+to be disabled.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/spi/Kconfig | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/spi/Kconfig
++++ b/drivers/spi/Kconfig
+@@ -156,6 +156,7 @@ config SPI_BCM63XX_HSSPI
+ config SPI_BCM_QSPI
+ tristate "Broadcom BSPI and MSPI controller support"
+ depends on ARCH_BRCMSTB || ARCH_BCM || ARCH_BCM_IPROC || COMPILE_TEST
++ depends on MTD_NORFLASH
+ default ARCH_BCM_IPROC
+ help
+ Enables support for the Broadcom SPI flash and MSPI controller.
--- /dev/null
+From 3538aa6ecfb2dd727a40f9ebbbf25a0c2afe6226 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Wed, 8 Feb 2017 19:14:13 -0200
+Subject: [media] tc358743: fix register i2c_rd/wr functions
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit 3538aa6ecfb2dd727a40f9ebbbf25a0c2afe6226 upstream.
+
+While testing with CONFIG_UBSAN, I got this warning:
+
+drivers/media/i2c/tc358743.c: In function 'tc358743_probe':
+drivers/media/i2c/tc358743.c:1930:1: error: the frame size of 2480 bytes is larger than 2048 bytes [-Werror=frame-larger-than=]
+
+The problem is that the i2c_rd8/wr8/rd16/... functions in this driver pass
+a pointer to a local variable into a common function, and each call to one
+of them adds another variable plus redzone to the stack.
+
+I also noticed that the way this is done is broken on big-endian machines,
+as we copy the registers in CPU byte order.
+
+To address both those problems, I'm adding two helper functions for reading
+a register of up to 32 bits with correct endianess and change all other
+functions to use that instead. Just to be sure we don't get the problem
+back with changed optimizations in gcc, I'm also marking the new functions
+as 'noinline', although my tests with gcc-7 don't require that.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
+Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/media/i2c/tc358743.c | 46 +++++++++++++++++++++++--------------------
+ 1 file changed, 25 insertions(+), 21 deletions(-)
+
+--- a/drivers/media/i2c/tc358743.c
++++ b/drivers/media/i2c/tc358743.c
+@@ -193,57 +193,61 @@ static void i2c_wr(struct v4l2_subdev *s
+ }
+ }
+
+-static u8 i2c_rd8(struct v4l2_subdev *sd, u16 reg)
++static noinline u32 i2c_rdreg(struct v4l2_subdev *sd, u16 reg, u32 n)
+ {
+- u8 val;
++ __le32 val = 0;
+
+- i2c_rd(sd, reg, &val, 1);
++ i2c_rd(sd, reg, (u8 __force *)&val, n);
+
+- return val;
++ return le32_to_cpu(val);
++}
++
++static noinline void i2c_wrreg(struct v4l2_subdev *sd, u16 reg, u32 val, u32 n)
++{
++ __le32 raw = cpu_to_le32(val);
++
++ i2c_wr(sd, reg, (u8 __force *)&raw, n);
++}
++
++static u8 i2c_rd8(struct v4l2_subdev *sd, u16 reg)
++{
++ return i2c_rdreg(sd, reg, 1);
+ }
+
+ static void i2c_wr8(struct v4l2_subdev *sd, u16 reg, u8 val)
+ {
+- i2c_wr(sd, reg, &val, 1);
++ i2c_wrreg(sd, reg, val, 1);
+ }
+
+ static void i2c_wr8_and_or(struct v4l2_subdev *sd, u16 reg,
+ u8 mask, u8 val)
+ {
+- i2c_wr8(sd, reg, (i2c_rd8(sd, reg) & mask) | val);
++ i2c_wrreg(sd, reg, (i2c_rdreg(sd, reg, 2) & mask) | val, 2);
+ }
+
+ static u16 i2c_rd16(struct v4l2_subdev *sd, u16 reg)
+ {
+- u16 val;
+-
+- i2c_rd(sd, reg, (u8 *)&val, 2);
+-
+- return val;
++ return i2c_rdreg(sd, reg, 2);
+ }
+
+ static void i2c_wr16(struct v4l2_subdev *sd, u16 reg, u16 val)
+ {
+- i2c_wr(sd, reg, (u8 *)&val, 2);
++ i2c_wrreg(sd, reg, val, 2);
+ }
+
+ static void i2c_wr16_and_or(struct v4l2_subdev *sd, u16 reg, u16 mask, u16 val)
+ {
+- i2c_wr16(sd, reg, (i2c_rd16(sd, reg) & mask) | val);
++ i2c_wrreg(sd, reg, (i2c_rdreg(sd, reg, 2) & mask) | val, 2);
+ }
+
+ static u32 i2c_rd32(struct v4l2_subdev *sd, u16 reg)
+ {
+- u32 val;
+-
+- i2c_rd(sd, reg, (u8 *)&val, 4);
+-
+- return val;
++ return i2c_rdreg(sd, reg, 4);
+ }
+
+ static void i2c_wr32(struct v4l2_subdev *sd, u16 reg, u32 val)
+ {
+- i2c_wr(sd, reg, (u8 *)&val, 4);
++ i2c_wrreg(sd, reg, val, 4);
+ }
+
+ /* --------------- STATUS --------------- */
+@@ -1236,7 +1240,7 @@ static int tc358743_g_register(struct v4
+
+ reg->size = tc358743_get_reg_size(reg->reg);
+
+- i2c_rd(sd, reg->reg, (u8 *)®->val, reg->size);
++ reg->val = i2c_rdreg(sd, reg->reg, reg->size);
+
+ return 0;
+ }
+@@ -1262,7 +1266,7 @@ static int tc358743_s_register(struct v4
+ reg->reg == BCAPS)
+ return 0;
+
+- i2c_wr(sd, (u16)reg->reg, (u8 *)®->val,
++ i2c_wrreg(sd, (u16)reg->reg, reg->val,
+ tc358743_get_reg_size(reg->reg));
+
+ return 0;
--- /dev/null
+From 68fd77cf8a4b045594231f07e5fc92e1a34c0a9e Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Fri, 21 Jul 2017 18:16:28 +0200
+Subject: thermal: fix INTEL_SOC_DTS_IOSF_CORE dependencies
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit 68fd77cf8a4b045594231f07e5fc92e1a34c0a9e upstream.
+
+We get a Kconfig warning when selecting this without also enabling
+CONFIG_PCI:
+
+warning: (X86_INTEL_LPSS && INTEL_SOC_DTS_IOSF_CORE
+&& SND_SST_IPC_ACPI && MMC_SDHCI_ACPI && PUNIT_ATOM_DEBUG)
+selects IOSF_MBI which has unmet direct dependencies (PCI)
+
+This adds a new depedency.
+
+Fixes: 3a2419f865a6 ("Thermal: Intel SoC: DTS thermal use common APIs")
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Reviewed-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
+Signed-off-by: Zhang Rui <rui.zhang@intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/thermal/Kconfig | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/drivers/thermal/Kconfig
++++ b/drivers/thermal/Kconfig
+@@ -316,7 +316,7 @@ config X86_PKG_TEMP_THERMAL
+
+ config INTEL_SOC_DTS_IOSF_CORE
+ tristate
+- depends on X86
++ depends on X86 && PCI
+ select IOSF_MBI
+ help
+ This is becoming a common feature for Intel SoCs to expose the additional
+@@ -326,7 +326,7 @@ config INTEL_SOC_DTS_IOSF_CORE
+
+ config INTEL_SOC_DTS_THERMAL
+ tristate "Intel SoCs DTS thermal driver"
+- depends on X86
++ depends on X86 && PCI
+ select INTEL_SOC_DTS_IOSF_CORE
+ select THERMAL_WRITABLE_TRIPS
+ help
--- /dev/null
+From e572d0887137acfc53f18175522964ec19d88175 Mon Sep 17 00:00:00 2001
+From: Josh Poimboeuf <jpoimboe@redhat.com>
+Date: Wed, 18 Jan 2017 22:16:55 -0600
+Subject: tools build: Add tools tree support for 'make -s'
+
+From: Josh Poimboeuf <jpoimboe@redhat.com>
+
+commit e572d0887137acfc53f18175522964ec19d88175 upstream.
+
+When doing a kernel build with 'make -s', everything is silenced except
+the objtool build. That's because the tools tree support for silent
+builds is some combination of missing and broken.
+
+Three changes are needed to fix it:
+
+- Makefile: propagate '-s' to the sub-make's MAKEFLAGS variable so the
+ tools Makefiles can see it.
+
+- tools/scripts/Makefile.include: fix the tools Makefiles' ability to
+ recognize '-s'. The MAKE_VERSION and MAKEFLAGS checks are copied from
+ the top-level Makefile. This silences the "DESCEND objtool" message.
+
+- tools/build/Makefile.build: add support to the tools Build files for
+ recognizing '-s'. Again the MAKE_VERSION and MAKEFLAGS checks are
+ copied from the top-level Makefile. This silences all the object
+ compile/link messages.
+
+Reported-and-Tested-by: Peter Zijlstra <peterz@infradead.org>
+Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
+Cc: Jiri Olsa <jolsa@kernel.org>
+Cc: Michal Marek <mmarek@suse.com>
+Link: http://lkml.kernel.org/r/e8967562ef640c3ae9a76da4ae0f4e47df737c34.1484799200.git.jpoimboe@redhat.com
+Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ Makefile | 6 ++++--
+ tools/build/Makefile.build | 10 ++++++++++
+ tools/scripts/Makefile.include | 12 +++++++++++-
+ 3 files changed, 25 insertions(+), 3 deletions(-)
+
+--- a/Makefile
++++ b/Makefile
+@@ -87,10 +87,12 @@ endif
+ ifneq ($(filter 4.%,$(MAKE_VERSION)),) # make-4
+ ifneq ($(filter %s ,$(firstword x$(MAKEFLAGS))),)
+ quiet=silent_
++ tools_silent=s
+ endif
+ else # make-3.8x
+ ifneq ($(filter s% -s%,$(MAKEFLAGS)),)
+ quiet=silent_
++ tools_silent=-s
+ endif
+ endif
+
+@@ -1614,11 +1616,11 @@ image_name:
+ # Clear a bunch of variables before executing the submake
+ tools/: FORCE
+ $(Q)mkdir -p $(objtree)/tools
+- $(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(filter --j% -j,$(MAKEFLAGS))" O=$(shell cd $(objtree) && /bin/pwd) subdir=tools -C $(src)/tools/
++ $(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(tools_silent) $(filter --j% -j,$(MAKEFLAGS))" O=$(shell cd $(objtree) && /bin/pwd) subdir=tools -C $(src)/tools/
+
+ tools/%: FORCE
+ $(Q)mkdir -p $(objtree)/tools
+- $(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(filter --j% -j,$(MAKEFLAGS))" O=$(shell cd $(objtree) && /bin/pwd) subdir=tools -C $(src)/tools/ $*
++ $(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(tools_silent) $(filter --j% -j,$(MAKEFLAGS))" O=$(shell cd $(objtree) && /bin/pwd) subdir=tools -C $(src)/tools/ $*
+
+ # Single targets
+ # ---------------------------------------------------------------------------
+--- a/tools/build/Makefile.build
++++ b/tools/build/Makefile.build
+@@ -19,6 +19,16 @@ else
+ Q=@
+ endif
+
++ifneq ($(filter 4.%,$(MAKE_VERSION)),) # make-4
++ifneq ($(filter %s ,$(firstword x$(MAKEFLAGS))),)
++ quiet=silent_
++endif
++else # make-3.8x
++ifneq ($(filter s% -s%,$(MAKEFLAGS)),)
++ quiet=silent_
++endif
++endif
++
+ build-dir := $(srctree)/tools/build
+
+ # Define $(fixdep) for dep-cmd function
+--- a/tools/scripts/Makefile.include
++++ b/tools/scripts/Makefile.include
+@@ -46,6 +46,16 @@ else
+ NO_SUBDIR = :
+ endif
+
++ifneq ($(filter 4.%,$(MAKE_VERSION)),) # make-4
++ifneq ($(filter %s ,$(firstword x$(MAKEFLAGS))),)
++ silent=1
++endif
++else # make-3.8x
++ifneq ($(filter s% -s%,$(MAKEFLAGS)),)
++ silent=1
++endif
++endif
++
+ #
+ # Define a callable command for descending to a new directory
+ #
+@@ -58,7 +68,7 @@ descend = \
+ QUIET_SUBDIR0 = +$(MAKE) $(COMMAND_O) -C # space to separate -C and subdir
+ QUIET_SUBDIR1 =
+
+-ifneq ($(findstring $(MAKEFLAGS),s),s)
++ifneq ($(silent),1)
+ ifneq ($(V),1)
+ QUIET_CC = @echo ' CC '$@;
+ QUIET_CC_FPIC = @echo ' CC FPIC '$@;
--- /dev/null
+From 27430d19a91615245babaa9b216d0807636903a0 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Tue, 28 Feb 2017 18:14:37 -0300
+Subject: [media] tw5864: use dev_warn instead of WARN to shut up warning
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit 27430d19a91615245babaa9b216d0807636903a0 upstream.
+
+tw5864_frameinterval_get() only initializes its output when it successfully
+identifies the video standard in tw5864_input. We get a warning here because
+gcc can't always track the state if initialized warnings across a WARN()
+macro, and thinks it might get used incorrectly in tw5864_s_parm:
+
+media/pci/tw5864/tw5864-video.c: In function 'tw5864_s_parm':
+media/pci/tw5864/tw5864-video.c:816:38: error: 'time_base.numerator' may be used uninitialized in this function [-Werror=maybe-uninitialized]
+media/pci/tw5864/tw5864-video.c:819:31: error: 'time_base.denominator' may be used uninitialized in this function [-Werror=maybe-uninitialized]
+
+Using dev_warn() instead of WARN() avoids the __branch_check__() in
+unlikely and lets the compiler see that the initialization is correct.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Acked-by: Andrey Utkin <andrey.utkin@corp.bluecherry.net>
+Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
+Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/media/pci/tw5864/tw5864-video.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+--- a/drivers/media/pci/tw5864/tw5864-video.c
++++ b/drivers/media/pci/tw5864/tw5864-video.c
+@@ -708,6 +708,8 @@ static void tw5864_frame_interval_set(st
+ static int tw5864_frameinterval_get(struct tw5864_input *input,
+ struct v4l2_fract *frameinterval)
+ {
++ struct tw5864_dev *dev = input->root;
++
+ switch (input->std) {
+ case STD_NTSC:
+ frameinterval->numerator = 1001;
+@@ -719,8 +721,8 @@ static int tw5864_frameinterval_get(stru
+ frameinterval->denominator = 25;
+ break;
+ default:
+- WARN(1, "tw5864_frameinterval_get requested for unknown std %d\n",
+- input->std);
++ dev_warn(&dev->pci->dev, "tw5864_frameinterval_get requested for unknown std %d\n",
++ input->std);
+ return -EINVAL;
+ }
+
--- /dev/null
+From c8bd2ac3b4c6c84c4a7cdceaed626247db698ab2 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Lefaure?= <jeremy.lefaure@lse.epita.fr>
+Date: Tue, 3 Jan 2017 18:13:49 -0600
+Subject: usb: musb: fix compilation warning on unused function
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Jérémy Lefaure <jeremy.lefaure@lse.epita.fr>
+
+commit c8bd2ac3b4c6c84c4a7cdceaed626247db698ab2 upstream.
+
+The function musb_run_resume_work is called only when CONFIG_PM is
+enabled. So this function should not be defined when CONFIG_PM is
+disabled. Otherwise the compiler issues a warning:
+
+drivers/usb/musb/musb_core.c:2057:12: error: ‘musb_run_resume_work’ defined but
+not used [-Werror=unused-function]
+ static int musb_run_resume_work(struct musb *musb)
+ ^~~~~~~~~~~~~~~~~~~~
+
+Signed-off-by: Jérémy Lefaure <jeremy.lefaure@lse.epita.fr>
+Signed-off-by: Bin Liu <b-liu@ti.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/musb/musb_core.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/drivers/usb/musb/musb_core.c
++++ b/drivers/usb/musb/musb_core.c
+@@ -2043,6 +2043,7 @@ struct musb_pending_work {
+ struct list_head node;
+ };
+
++#ifdef CONFIG_PM
+ /*
+ * Called from musb_runtime_resume(), musb_resume(), and
+ * musb_queue_resume_work(). Callers must take musb->lock.
+@@ -2070,6 +2071,7 @@ static int musb_run_resume_work(struct m
+
+ return error;
+ }
++#endif
+
+ /*
+ * Called to run work if device is active or else queue the work to happen
--- /dev/null
+From foo@baz Fri Feb 23 16:40:21 CET 2018
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Mon, 19 Feb 2018 11:13:27 +0100
+Subject: usb: phy: msm add regulator dependency
+To: stable@vger.kernel.org
+Cc: Greg KH <gregkh@linuxfoundation.org>, linux-kernel@vger.kernel.org, Arnd Bergmann <arnd@arndb.de>, Felipe Balbi <balbi@kernel.org>, linux-usb@vger.kernel.org
+Message-ID: <20180219101343.2922561-9-arnd@arndb.de>
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+On linux-4.4 and linux-4.9 we get a warning about an array that is
+never initialized when CONFIG_REGULATOR is disabled:
+
+drivers/usb/phy/phy-msm-usb.c: In function 'msm_otg_probe':
+drivers/usb/phy/phy-msm-usb.c:1911:14: error: 'regs[0].consumer' may be used uninitialized in this function [-Werror=maybe-uninitialized]
+ motg->vddcx = regs[0].consumer;
+ ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
+drivers/usb/phy/phy-msm-usb.c:1912:14: error: 'regs[1].consumer' may be used uninitialized in this function [-Werror=maybe-uninitialized]
+ motg->v3p3 = regs[1].consumer;
+ ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
+drivers/usb/phy/phy-msm-usb.c:1913:14: error: 'regs[2].consumer' may be used uninitialized in this function [-Werror=maybe-uninitialized]
+ motg->v1p8 = regs[2].consumer;
+
+This adds a Kconfig dependency for it. In newer kernels, the driver no
+longer exists, so this is only needed for stable kernels.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/usb/phy/Kconfig | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/usb/phy/Kconfig
++++ b/drivers/usb/phy/Kconfig
+@@ -147,6 +147,7 @@ config USB_MSM_OTG
+ depends on (USB || USB_GADGET) && (ARCH_QCOM || COMPILE_TEST)
+ depends on USB_GADGET || !USB_GADGET # if USB_GADGET=m, this can't be 'y'
+ depends on RESET_CONTROLLER
++ depends on REGULATOR
+ depends on EXTCON
+ select USB_PHY
+ help
--- /dev/null
+From 484c7bbf2649831714da3a0fa30213977458e9b5 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Wed, 14 Jun 2017 12:40:36 +0200
+Subject: video: fbdev: via: remove possibly unused variables
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit 484c7bbf2649831714da3a0fa30213977458e9b5 upstream.
+
+When CONFIG_PROC_FS is disabled, we get warnings about unused variables
+as remove_proc_entry() evaluates to an empty macro.
+
+drivers/video/fbdev/via/viafbdev.c: In function 'viafb_remove_proc':
+drivers/video/fbdev/via/viafbdev.c:1635:4: error: unused variable 'iga2_entry' [-Werror=unused-variable]
+drivers/video/fbdev/via/viafbdev.c:1634:4: error: unused variable 'iga1_entry' [-Werror=unused-variable]
+
+These are easy to avoid by using the pointer from the structure.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Cc: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
+Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/video/fbdev/via/viafbdev.c | 8 +++-----
+ 1 file changed, 3 insertions(+), 5 deletions(-)
+
+--- a/drivers/video/fbdev/via/viafbdev.c
++++ b/drivers/video/fbdev/via/viafbdev.c
+@@ -1630,16 +1630,14 @@ static void viafb_init_proc(struct viafb
+ }
+ static void viafb_remove_proc(struct viafb_shared *shared)
+ {
+- struct proc_dir_entry *viafb_entry = shared->proc_entry,
+- *iga1_entry = shared->iga1_proc_entry,
+- *iga2_entry = shared->iga2_proc_entry;
++ struct proc_dir_entry *viafb_entry = shared->proc_entry;
+
+ if (!viafb_entry)
+ return;
+
+- remove_proc_entry("output_devices", iga2_entry);
++ remove_proc_entry("output_devices", shared->iga2_proc_entry);
+ remove_proc_entry("iga2", viafb_entry);
+- remove_proc_entry("output_devices", iga1_entry);
++ remove_proc_entry("output_devices", shared->iga1_proc_entry);
+ remove_proc_entry("iga1", viafb_entry);
+ remove_proc_entry("supported_output_devices", viafb_entry);
+
--- /dev/null
+From fbdf0e28d061708cf18ba0f8e0db5360dc9a15b9 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Fri, 17 Feb 2017 16:08:30 +0100
+Subject: vmxnet3: prevent building with 64K pages
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit fbdf0e28d061708cf18ba0f8e0db5360dc9a15b9 upstream.
+
+I got a warning about broken code on ARM64 with 64K pages:
+
+drivers/net/vmxnet3/vmxnet3_drv.c: In function 'vmxnet3_rq_init':
+drivers/net/vmxnet3/vmxnet3_drv.c:1679:29: error: large integer implicitly truncated to unsigned type [-Werror=overflow]
+ rq->buf_info[0][i].len = PAGE_SIZE;
+
+'len' here is a 16-bit integer, so this clearly won't work. I don't think
+this driver is used much on anything other than x86, so there is no need
+to fix this properly and we can work around it with a Kconfig dependency
+to forbid known-broken configurations. qemu in theory supports it on
+other architectures too, but presumably only for compatibility with x86
+guests that also run on vmware.
+
+CONFIG_PAGE_SIZE_64KB is used on hexagon, mips, sh and tile, the other
+symbols are architecture-specific names for the same thing.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/net/Kconfig | 3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/drivers/net/Kconfig
++++ b/drivers/net/Kconfig
+@@ -437,6 +437,9 @@ config XEN_NETDEV_BACKEND
+ config VMXNET3
+ tristate "VMware VMXNET3 ethernet driver"
+ depends on PCI && INET
++ depends on !(PAGE_SIZE_64KB || ARM64_64K_PAGES || \
++ IA64_PAGE_SIZE_64KB || MICROBLAZE_64K_PAGES || \
++ PARISC_PAGE_SIZE_64KB || PPC_64K_PAGES)
+ help
+ This driver supports VMware's vmxnet3 virtual ethernet NIC.
+ To compile this driver as a module, choose M here: the
--- /dev/null
+From c2ce3f5d89d57301e2756ac325fe2ebc33bfec30 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Wed, 19 Jul 2017 14:53:04 +0200
+Subject: x86: add MULTIUSER dependency for KVM
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit c2ce3f5d89d57301e2756ac325fe2ebc33bfec30 upstream.
+
+KVM tries to select 'TASKSTATS', which had additional dependencies:
+
+warning: (KVM) selects TASKSTATS which has unmet direct dependencies (NET && MULTIUSER)
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/x86/kvm/Kconfig | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/arch/x86/kvm/Kconfig
++++ b/arch/x86/kvm/Kconfig
+@@ -22,7 +22,7 @@ config KVM
+ depends on HAVE_KVM
+ depends on HIGH_RES_TIMERS
+ # for TASKSTATS/TASK_DELAY_ACCT:
+- depends on NET
++ depends on NET && MULTIUSER
+ select PREEMPT_NOTIFIERS
+ select MMU_NOTIFIER
+ select ANON_INODES
--- /dev/null
+From d460131dd50599e0e9405d5f4ae02c27d529a44a Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Wed, 19 Jul 2017 14:53:03 +0200
+Subject: x86/build: Silence the build with "make -s"
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit d460131dd50599e0e9405d5f4ae02c27d529a44a upstream.
+
+Every kernel build on x86 will result in some output:
+
+ Setup is 13084 bytes (padded to 13312 bytes).
+ System is 4833 kB
+ CRC 6d35fa35
+ Kernel: arch/x86/boot/bzImage is ready (#2)
+
+This shuts it up, so that 'make -s' is truely silent as long as
+everything works. Building without '-s' should produce unchanged
+output.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Matt Fleming <matt@codeblueprint.co.uk>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Link: http://lkml.kernel.org/r/20170719125310.2487451-6-arnd@arndb.de
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/x86/boot/Makefile | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+--- a/arch/x86/boot/Makefile
++++ b/arch/x86/boot/Makefile
+@@ -73,12 +73,13 @@ UBSAN_SANITIZE := n
+ $(obj)/bzImage: asflags-y := $(SVGA_MODE)
+
+ quiet_cmd_image = BUILD $@
++silent_redirect_image = >/dev/null
+ cmd_image = $(obj)/tools/build $(obj)/setup.bin $(obj)/vmlinux.bin \
+- $(obj)/zoffset.h $@
++ $(obj)/zoffset.h $@ $($(quiet)redirect_image)
+
+ $(obj)/bzImage: $(obj)/setup.bin $(obj)/vmlinux.bin $(obj)/tools/build FORCE
+ $(call if_changed,image)
+- @echo 'Kernel: $@ is ready' ' (#'`cat .version`')'
++ @$(kecho) 'Kernel: $@ is ready' ' (#'`cat .version`')'
+
+ OBJCOPYFLAGS_vmlinux.bin := -O binary -R .note -R .comment -S
+ $(obj)/vmlinux.bin: $(obj)/compressed/vmlinux FORCE
--- /dev/null
+From 75e2f0a6b16141cb347f442033ec907380d4d66e Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Wed, 19 Jul 2017 14:53:00 +0200
+Subject: x86/fpu/math-emu: Fix possible uninitialized variable use
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit 75e2f0a6b16141cb347f442033ec907380d4d66e upstream.
+
+When building the kernel with "make EXTRA_CFLAGS=...", this overrides
+the "PARANOID" preprocessor macro defined in arch/x86/math-emu/Makefile,
+and we run into a build warning:
+
+ arch/x86/math-emu/reg_compare.c: In function ‘compare_i_st_st’:
+ arch/x86/math-emu/reg_compare.c:254:6: error: ‘f’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
+
+This fixes the implementation to work correctly even without the PARANOID
+flag, and also fixes the Makefile to not use the EXTRA_CFLAGS variable
+but instead use the ccflags-y variable in the Makefile that is meant
+for this purpose.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Cc: Bill Metzenthen <billm@melbpc.org.au>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Link: http://lkml.kernel.org/r/20170719125310.2487451-3-arnd@arndb.de
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/x86/math-emu/Makefile | 4 ++--
+ arch/x86/math-emu/reg_compare.c | 16 ++++++++--------
+ 2 files changed, 10 insertions(+), 10 deletions(-)
+
+--- a/arch/x86/math-emu/Makefile
++++ b/arch/x86/math-emu/Makefile
+@@ -5,8 +5,8 @@
+ #DEBUG = -DDEBUGGING
+ DEBUG =
+ PARANOID = -DPARANOID
+-EXTRA_CFLAGS := $(PARANOID) $(DEBUG) -fno-builtin $(MATH_EMULATION)
+-EXTRA_AFLAGS := $(PARANOID)
++ccflags-y += $(PARANOID) $(DEBUG) -fno-builtin $(MATH_EMULATION)
++asflags-y += $(PARANOID)
+
+ # From 'C' language sources:
+ C_OBJS =fpu_entry.o errors.o \
+--- a/arch/x86/math-emu/reg_compare.c
++++ b/arch/x86/math-emu/reg_compare.c
+@@ -168,7 +168,7 @@ static int compare(FPU_REG const *b, int
+ /* This function requires that st(0) is not empty */
+ int FPU_compare_st_data(FPU_REG const *loaded_data, u_char loaded_tag)
+ {
+- int f = 0, c;
++ int f, c;
+
+ c = compare(loaded_data, loaded_tag);
+
+@@ -189,12 +189,12 @@ int FPU_compare_st_data(FPU_REG const *l
+ case COMP_No_Comp:
+ f = SW_C3 | SW_C2 | SW_C0;
+ break;
+-#ifdef PARANOID
+ default:
++#ifdef PARANOID
+ EXCEPTION(EX_INTERNAL | 0x121);
++#endif /* PARANOID */
+ f = SW_C3 | SW_C2 | SW_C0;
+ break;
+-#endif /* PARANOID */
+ }
+ setcc(f);
+ if (c & COMP_Denormal) {
+@@ -205,7 +205,7 @@ int FPU_compare_st_data(FPU_REG const *l
+
+ static int compare_st_st(int nr)
+ {
+- int f = 0, c;
++ int f, c;
+ FPU_REG *st_ptr;
+
+ if (!NOT_EMPTY(0) || !NOT_EMPTY(nr)) {
+@@ -235,12 +235,12 @@ static int compare_st_st(int nr)
+ case COMP_No_Comp:
+ f = SW_C3 | SW_C2 | SW_C0;
+ break;
+-#ifdef PARANOID
+ default:
++#ifdef PARANOID
+ EXCEPTION(EX_INTERNAL | 0x122);
++#endif /* PARANOID */
+ f = SW_C3 | SW_C2 | SW_C0;
+ break;
+-#endif /* PARANOID */
+ }
+ setcc(f);
+ if (c & COMP_Denormal) {
+@@ -283,12 +283,12 @@ static int compare_i_st_st(int nr)
+ case COMP_No_Comp:
+ f = X86_EFLAGS_ZF | X86_EFLAGS_PF | X86_EFLAGS_CF;
+ break;
+-#ifdef PARANOID
+ default:
++#ifdef PARANOID
+ EXCEPTION(EX_INTERNAL | 0x122);
++#endif /* PARANOID */
+ f = 0;
+ break;
+-#endif /* PARANOID */
+ }
+ FPU_EFLAGS = (FPU_EFLAGS & ~(X86_EFLAGS_ZF | X86_EFLAGS_PF | X86_EFLAGS_CF)) | f;
+ if (c & COMP_Denormal) {
--- /dev/null
+From foo@baz Fri Feb 23 16:40:21 CET 2018
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Mon, 19 Feb 2018 11:13:28 +0100
+Subject: x86/microcode/AMD: Change load_microcode_amd()'s param to bool to fix preemptibility bug
+To: stable@vger.kernel.org
+Cc: Greg KH <gregkh@linuxfoundation.org>, linux-kernel@vger.kernel.org, Borislav Petkov <bp@suse.de>, Linus Torvalds <torvalds@linux-foundation.org>, Peter Zijlstra <peterz@infradead.org>, Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@kernel.org>, Arnd Bergmann <arnd@arndb.de>, Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>, x86@kernel.org, Borislav Petkov <bp@alien8.de>, Tom Lendacky <thomas.lendacky@amd.com>
+Message-ID: <20180219101343.2922561-10-arnd@arndb.de>
+
+From: Borislav Petkov <bp@suse.de>
+
+commit dac6ca243c4c49a9ca7507d3d66140ebfac8b04b upstream.
+
+With CONFIG_DEBUG_PREEMPT enabled, I get:
+
+ BUG: using smp_processor_id() in preemptible [00000000] code: swapper/0/1
+ caller is debug_smp_processor_id
+ CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.12.0-rc2+ #2
+ Call Trace:
+ dump_stack
+ check_preemption_disabled
+ debug_smp_processor_id
+ save_microcode_in_initrd_amd
+ ? microcode_init
+ save_microcode_in_initrd
+ ...
+
+because, well, it says it above, we're using smp_processor_id() in
+preemptible code.
+
+But passing the CPU number is not really needed. It is only used to
+determine whether we're on the BSP, and, if so, to save the microcode
+patch for early loading.
+
+ [ We don't absolutely need to do it on the BSP but we do that
+ customarily there. ]
+
+Instead, convert that function parameter to a boolean which denotes
+whether the patch should be saved or not, thereby avoiding the use of
+smp_processor_id() in preemptible code.
+
+Signed-off-by: Borislav Petkov <bp@suse.de>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Link: http://lkml.kernel.org/r/20170528200414.31305-1-bp@alien8.de
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+[arnd: rebased to 4.9, after running into warning:
+ arch/x86/kernel/cpu/microcode/amd.c:881:30: self-comparison always evaluates to true]
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/x86/include/asm/microcode_amd.h | 1 -
+ arch/x86/kernel/cpu/microcode/amd.c | 17 +++++++++++------
+ 2 files changed, 11 insertions(+), 7 deletions(-)
+
+--- a/arch/x86/include/asm/microcode_amd.h
++++ b/arch/x86/include/asm/microcode_amd.h
+@@ -59,7 +59,6 @@ static inline u16 find_equiv_id(struct e
+
+ extern int __apply_microcode_amd(struct microcode_amd *mc_amd);
+ extern int apply_microcode_amd(int cpu);
+-extern enum ucode_state load_microcode_amd(int cpu, u8 family, const u8 *data, size_t size);
+
+ #define PATCH_MAX_SIZE PAGE_SIZE
+
+--- a/arch/x86/kernel/cpu/microcode/amd.c
++++ b/arch/x86/kernel/cpu/microcode/amd.c
+@@ -135,6 +135,9 @@ static size_t compute_container_size(u8
+ return size;
+ }
+
++static enum ucode_state
++load_microcode_amd(bool save, u8 family, const u8 *data, size_t size);
++
+ /*
+ * Early load occurs before we can vmalloc(). So we look for the microcode
+ * patch container file in initrd, traverse equivalent cpu table, look for a
+@@ -451,7 +454,7 @@ int __init save_microcode_in_initrd_amd(
+ eax = cpuid_eax(0x00000001);
+ eax = ((eax >> 8) & 0xf) + ((eax >> 20) & 0xff);
+
+- ret = load_microcode_amd(smp_processor_id(), eax, container, container_size);
++ ret = load_microcode_amd(true, eax, container, container_size);
+ if (ret != UCODE_OK)
+ retval = -EINVAL;
+
+@@ -864,7 +867,8 @@ static enum ucode_state __load_microcode
+ return UCODE_OK;
+ }
+
+-enum ucode_state load_microcode_amd(int cpu, u8 family, const u8 *data, size_t size)
++static enum ucode_state
++load_microcode_amd(bool save, u8 family, const u8 *data, size_t size)
+ {
+ enum ucode_state ret;
+
+@@ -878,8 +882,8 @@ enum ucode_state load_microcode_amd(int
+
+ #ifdef CONFIG_X86_32
+ /* save BSP's matching patch for early load */
+- if (cpu_data(cpu).cpu_index == boot_cpu_data.cpu_index) {
+- struct ucode_patch *p = find_patch(cpu);
++ if (save) {
++ struct ucode_patch *p = find_patch(0);
+ if (p) {
+ memset(amd_ucode_patch, 0, PATCH_MAX_SIZE);
+ memcpy(amd_ucode_patch, p->data, min_t(u32, ksize(p->data),
+@@ -911,11 +915,12 @@ static enum ucode_state request_microcod
+ {
+ char fw_name[36] = "amd-ucode/microcode_amd.bin";
+ struct cpuinfo_x86 *c = &cpu_data(cpu);
++ bool bsp = c->cpu_index == boot_cpu_data.cpu_index;
+ enum ucode_state ret = UCODE_NFOUND;
+ const struct firmware *fw;
+
+ /* reload ucode container only on the boot cpu */
+- if (!refresh_fw || c->cpu_index != boot_cpu_data.cpu_index)
++ if (!refresh_fw || !bsp)
+ return UCODE_OK;
+
+ if (c->x86 >= 0x15)
+@@ -932,7 +937,7 @@ static enum ucode_state request_microcod
+ goto fw_release;
+ }
+
+- ret = load_microcode_amd(cpu, c->x86, fw->data, fw->size);
++ ret = load_microcode_amd(bsp, c->x86, fw->data, fw->size);
+
+ fw_release:
+ release_firmware(fw);
--- /dev/null
+From d689c64d189e43d782fec5649fb0afe303c5b3f9 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Wed, 19 Jul 2017 14:53:05 +0200
+Subject: x86/platform: Add PCI dependency for PUNIT_ATOM_DEBUG
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit d689c64d189e43d782fec5649fb0afe303c5b3f9 upstream.
+
+The IOSF_MBI option requires PCI support, without it we get a harmless
+Kconfig warning when it gets selected by PUNIT_ATOM_DEBUG:
+
+ warning: (X86_INTEL_LPSS && SND_SST_IPC_ACPI && MMC_SDHCI_ACPI && PUNIT_ATOM_DEBUG) selects IOSF_MBI which has unmet direct dependencies (PCI)
+
+This adds another dependency to avoid the warning.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Cc: Andy Lutomirski <luto@kernel.org>
+Cc: Josh Poimboeuf <jpoimboe@redhat.com>
+Cc: Kees Cook <keescook@chromium.org>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Link: http://lkml.kernel.org/r/20170719125310.2487451-8-arnd@arndb.de
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/x86/Kconfig.debug | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/arch/x86/Kconfig.debug
++++ b/arch/x86/Kconfig.debug
+@@ -352,6 +352,7 @@ config X86_DEBUG_FPU
+
+ config PUNIT_ATOM_DEBUG
+ tristate "ATOM Punit debug driver"
++ depends on PCI
+ select DEBUG_FS
+ select IOSF_MBI
+ ---help---
--- /dev/null
+From d4b2ac63b0eae461fc10c9791084be24724ef57a Mon Sep 17 00:00:00 2001
+From: Borislav Petkov <bp@suse.de>
+Date: Mon, 23 Jan 2017 19:35:06 +0100
+Subject: x86/ras/inject: Make it depend on X86_LOCAL_APIC=y
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Borislav Petkov <bp@suse.de>
+
+commit d4b2ac63b0eae461fc10c9791084be24724ef57a upstream.
+
+... and get rid of the annoying:
+
+ arch/x86/kernel/cpu/mcheck/mce-inject.c:97:13: warning: ‘mce_irq_ipi’ defined but not used [-Wunused-function]
+
+when doing randconfig builds.
+
+Signed-off-by: Borislav Petkov <bp@suse.de>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Cc: Tony Luck <tony.luck@intel.com>
+Cc: Yazen Ghannam <Yazen.Ghannam@amd.com>
+Cc: linux-edac <linux-edac@vger.kernel.org>
+Link: http://lkml.kernel.org/r/20170123183514.13356-2-bp@alien8.de
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/x86/Kconfig | 2 +-
+ arch/x86/kernel/cpu/mcheck/mce-inject.c | 5 +----
+ 2 files changed, 2 insertions(+), 5 deletions(-)
+
+--- a/arch/x86/Kconfig
++++ b/arch/x86/Kconfig
+@@ -1057,7 +1057,7 @@ config X86_MCE_THRESHOLD
+ def_bool y
+
+ config X86_MCE_INJECT
+- depends on X86_MCE
++ depends on X86_MCE && X86_LOCAL_APIC
+ tristate "Machine check injector support"
+ ---help---
+ Provide support for injecting machine checks for testing purposes.
+--- a/arch/x86/kernel/cpu/mcheck/mce-inject.c
++++ b/arch/x86/kernel/cpu/mcheck/mce-inject.c
+@@ -152,7 +152,6 @@ static void raise_mce(struct mce *m)
+ if (context == MCJ_CTX_RANDOM)
+ return;
+
+-#ifdef CONFIG_X86_LOCAL_APIC
+ if (m->inject_flags & (MCJ_IRQ_BROADCAST | MCJ_NMI_BROADCAST)) {
+ unsigned long start;
+ int cpu;
+@@ -192,9 +191,7 @@ static void raise_mce(struct mce *m)
+ raise_local();
+ put_cpu();
+ put_online_cpus();
+- } else
+-#endif
+- {
++ } else {
+ preempt_disable();
+ raise_local();
+ preempt_enable();
--- /dev/null
+From 3ba5b5ea7dc3a10ef50819b43a9f8de2705f4eec Mon Sep 17 00:00:00 2001
+From: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
+Date: Mon, 13 Feb 2017 15:52:28 +0300
+Subject: x86/vm86: Fix unused variable warning if THP is disabled
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
+
+commit 3ba5b5ea7dc3a10ef50819b43a9f8de2705f4eec upstream.
+
+GCC complains about unused variable 'vma' in mark_screen_rdonly() if THP is
+disabled:
+
+arch/x86/kernel/vm86_32.c: In function ‘mark_screen_rdonly’:
+arch/x86/kernel/vm86_32.c:180:26: warning: unused variable ‘vma’
+[-Wunused-variable]
+ struct vm_area_struct *vma = find_vma(mm, 0xA0000);
+
+That's silly. pmd_trans_huge() resolves to 0 when THP is disabled, so the
+whole block should be eliminated.
+
+Moving the variable declaration outside the if() block shuts GCC up.
+
+Reported-by: Jérémy Lefaure <jeremy.lefaure@lse.epita.fr>
+Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
+Tested-by: Borislav Petkov <bp@suse.de>
+Cc: Carlos O'Donell <carlos@redhat.com>
+Link: http://lkml.kernel.org/r/20170213125228.63645-1-kirill.shutemov@linux.intel.com
+Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/x86/kernel/vm86_32.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+--- a/arch/x86/kernel/vm86_32.c
++++ b/arch/x86/kernel/vm86_32.c
+@@ -160,11 +160,12 @@ void save_v86_state(struct kernel_vm86_r
+
+ static void mark_screen_rdonly(struct mm_struct *mm)
+ {
++ struct vm_area_struct *vma;
++ spinlock_t *ptl;
+ pgd_t *pgd;
+ pud_t *pud;
+ pmd_t *pmd;
+ pte_t *pte;
+- spinlock_t *ptl;
+ int i;
+
+ down_write(&mm->mmap_sem);
+@@ -177,7 +178,7 @@ static void mark_screen_rdonly(struct mm
+ pmd = pmd_offset(pud, 0xA0000);
+
+ if (pmd_trans_huge(*pmd)) {
+- struct vm_area_struct *vma = find_vma(mm, 0xA0000);
++ vma = find_vma(mm, 0xA0000);
+ split_huge_pmd(vma, pmd, 0xA0000);
+ }
+ if (pmd_none_or_clear_bad(pmd))