--- /dev/null
+From 9a04dbcfb33b4012d0ce8c0282f1e3ca694675b1 Mon Sep 17 00:00:00 2001
+From: David Rientjes <rientjes@google.com>
+Date: Thu, 6 Jul 2017 15:35:24 -0700
+Subject: compiler, clang: always inline when CONFIG_OPTIMIZE_INLINING is disabled
+
+From: David Rientjes <rientjes@google.com>
+
+commit 9a04dbcfb33b4012d0ce8c0282f1e3ca694675b1 upstream.
+
+The motivation for commit abb2ea7dfd82 ("compiler, clang: suppress
+warning for unused static inline functions") was to suppress clang's
+warnings about unused static inline functions.
+
+For configs without CONFIG_OPTIMIZE_INLINING enabled, such as any non-x86
+architecture, `inline' in the kernel implies that
+__attribute__((always_inline)) is used.
+
+Some code depends on that behavior, see
+ https://lkml.org/lkml/2017/6/13/918:
+
+ net/built-in.o: In function `__xchg_mb':
+ arch/arm64/include/asm/cmpxchg.h:99: undefined reference to `__compiletime_assert_99'
+ arch/arm64/include/asm/cmpxchg.h:99: undefined reference to `__compiletime_assert_99
+
+The full fix would be to identify these breakages and annotate the
+functions with __always_inline instead of `inline'. But since we are
+late in the 4.12-rc cycle, simply carry forward the forced inlining
+behavior and work toward moving arm64, and other architectures, toward
+CONFIG_OPTIMIZE_INLINING behavior.
+
+Link: http://lkml.kernel.org/r/alpine.DEB.2.10.1706261552200.1075@chino.kir.corp.google.com
+Signed-off-by: David Rientjes <rientjes@google.com>
+Reported-by: Sodagudi Prasad <psodagud@codeaurora.org>
+Tested-by: Sodagudi Prasad <psodagud@codeaurora.org>
+Tested-by: Matthias Kaehlcke <mka@chromium.org>
+Cc: Mark Rutland <mark.rutland@arm.com>
+Cc: Will Deacon <will.deacon@arm.com>
+Cc: Catalin Marinas <catalin.marinas@arm.com>
+Cc: Ingo Molnar <mingo@kernel.org>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: <stable@vger.kernel.org>
+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>
+
+---
+ include/linux/compiler-clang.h | 8 --------
+ include/linux/compiler-gcc.h | 18 +++++++++++-------
+ 2 files changed, 11 insertions(+), 15 deletions(-)
+
+--- a/include/linux/compiler-clang.h
++++ b/include/linux/compiler-clang.h
+@@ -15,11 +15,3 @@
+ * with any version that can compile the kernel
+ */
+ #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
+-
+-/*
+- * GCC does not warn about unused static inline functions for
+- * -Wunused-function. This turns out to avoid the need for complex #ifdef
+- * directives. Suppress the warning in clang as well.
+- */
+-#undef inline
+-#define inline inline __attribute__((unused)) notrace
+--- a/include/linux/compiler-gcc.h
++++ b/include/linux/compiler-gcc.h
+@@ -66,18 +66,22 @@
+
+ /*
+ * Force always-inline if the user requests it so via the .config,
+- * or if gcc is too old:
++ * or if gcc is too old.
++ * GCC does not warn about unused static inline functions for
++ * -Wunused-function. This turns out to avoid the need for complex #ifdef
++ * directives. Suppress the warning in clang as well by using "unused"
++ * function attribute, which is redundant but not harmful for gcc.
+ */
+ #if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \
+ !defined(CONFIG_OPTIMIZE_INLINING) || (__GNUC__ < 4)
+-#define inline inline __attribute__((always_inline)) notrace
+-#define __inline__ __inline__ __attribute__((always_inline)) notrace
+-#define __inline __inline __attribute__((always_inline)) notrace
++#define inline inline __attribute__((always_inline,unused)) notrace
++#define __inline__ __inline__ __attribute__((always_inline,unused)) notrace
++#define __inline __inline __attribute__((always_inline,unused)) notrace
+ #else
+ /* A lot of inline functions can cause havoc with function tracing */
+-#define inline inline notrace
+-#define __inline__ __inline__ notrace
+-#define __inline __inline notrace
++#define inline inline __attribute__((unused)) notrace
++#define __inline__ __inline__ __attribute__((unused)) notrace
++#define __inline __inline __attribute__((unused)) notrace
+ #endif
+
+ #define __always_inline inline __attribute__((always_inline))
--- /dev/null
+From 6d53cefb18e4646fb4bf62ccb6098fb3808486df Mon Sep 17 00:00:00 2001
+From: Linus Torvalds <torvalds@linux-foundation.org>
+Date: Sun, 11 Jun 2017 15:51:56 -0700
+Subject: compiler, clang: properly override 'inline' for clang
+
+From: Linus Torvalds <torvalds@linux-foundation.org>
+
+commit 6d53cefb18e4646fb4bf62ccb6098fb3808486df upstream.
+
+Commit abb2ea7dfd82 ("compiler, clang: suppress warning for unused
+static inline functions") just caused more warnings due to re-defining
+the 'inline' macro.
+
+So undef it before re-defining it, and also add the 'notrace' attribute
+like the gcc version that this is overriding does.
+
+Maybe this makes clang happier.
+
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ include/linux/compiler-clang.h | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/include/linux/compiler-clang.h
++++ b/include/linux/compiler-clang.h
+@@ -21,4 +21,5 @@
+ * -Wunused-function. This turns out to avoid the need for complex #ifdef
+ * directives. Suppress the warning in clang as well.
+ */
+-#define inline inline __attribute__((unused))
++#undef inline
++#define inline inline __attribute__((unused)) notrace
--- /dev/null
+From abb2ea7dfd82451d85ce669b811310c05ab5ca46 Mon Sep 17 00:00:00 2001
+From: David Rientjes <rientjes@google.com>
+Date: Tue, 6 Jun 2017 13:36:24 -0700
+Subject: compiler, clang: suppress warning for unused static inline functions
+
+From: David Rientjes <rientjes@google.com>
+
+commit abb2ea7dfd82451d85ce669b811310c05ab5ca46 upstream.
+
+GCC explicitly does not warn for unused static inline functions for
+-Wunused-function. The manual states:
+
+ Warn whenever a static function is declared but not defined or
+ a non-inline static function is unused.
+
+Clang does warn for static inline functions that are unused.
+
+It turns out that suppressing the warnings avoids potentially complex
+#ifdef directives, which also reduces LOC.
+
+Suppress the warning for clang.
+
+Signed-off-by: David Rientjes <rientjes@google.com>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ include/linux/compiler-clang.h | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+--- a/include/linux/compiler-clang.h
++++ b/include/linux/compiler-clang.h
+@@ -15,3 +15,10 @@
+ * with any version that can compile the kernel
+ */
+ #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
++
++/*
++ * GCC does not warn about unused static inline functions for
++ * -Wunused-function. This turns out to avoid the need for complex #ifdef
++ * directives. Suppress the warning in clang as well.
++ */
++#define inline inline __attribute__((unused))
--- /dev/null
+From d03db2bc26f0e4a6849ad649a09c9c73fccdc656 Mon Sep 17 00:00:00 2001
+From: Nick Desaulniers <ndesaulniers@google.com>
+Date: Thu, 21 Jun 2018 09:23:22 -0700
+Subject: compiler-gcc.h: Add __attribute__((gnu_inline)) to all inline declarations
+
+From: Nick Desaulniers <ndesaulniers@google.com>
+
+commit d03db2bc26f0e4a6849ad649a09c9c73fccdc656 upstream.
+
+Functions marked extern inline do not emit an externally visible
+function when the gnu89 C standard is used. Some KBUILD Makefiles
+overwrite KBUILD_CFLAGS. This is an issue for GCC 5.1+ users as without
+an explicit C standard specified, the default is gnu11. Since c99, the
+semantics of extern inline have changed such that an externally visible
+function is always emitted. This can lead to multiple definition errors
+of extern inline functions at link time of compilation units whose build
+files have removed an explicit C standard compiler flag for users of GCC
+5.1+ or Clang.
+
+Suggested-by: Arnd Bergmann <arnd@arndb.de>
+Suggested-by: H. Peter Anvin <hpa@zytor.com>
+Suggested-by: Joe Perches <joe@perches.com>
+Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
+Acked-by: Juergen Gross <jgross@suse.com>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Cc: acme@redhat.com
+Cc: akataria@vmware.com
+Cc: akpm@linux-foundation.org
+Cc: andrea.parri@amarulasolutions.com
+Cc: ard.biesheuvel@linaro.org
+Cc: aryabinin@virtuozzo.com
+Cc: astrachan@google.com
+Cc: boris.ostrovsky@oracle.com
+Cc: brijesh.singh@amd.com
+Cc: caoj.fnst@cn.fujitsu.com
+Cc: geert@linux-m68k.org
+Cc: ghackmann@google.com
+Cc: gregkh@linuxfoundation.org
+Cc: jan.kiszka@siemens.com
+Cc: jarkko.sakkinen@linux.intel.com
+Cc: jpoimboe@redhat.com
+Cc: keescook@google.com
+Cc: kirill.shutemov@linux.intel.com
+Cc: kstewart@linuxfoundation.org
+Cc: linux-efi@vger.kernel.org
+Cc: linux-kbuild@vger.kernel.org
+Cc: manojgupta@google.com
+Cc: mawilcox@microsoft.com
+Cc: michal.lkml@markovi.net
+Cc: mjg59@google.com
+Cc: mka@chromium.org
+Cc: pombredanne@nexb.com
+Cc: rientjes@google.com
+Cc: rostedt@goodmis.org
+Cc: sedat.dilek@gmail.com
+Cc: thomas.lendacky@amd.com
+Cc: tstellar@redhat.com
+Cc: tweek@google.com
+Cc: virtualization@lists.linux-foundation.org
+Cc: will.deacon@arm.com
+Cc: yamada.masahiro@socionext.com
+Link: http://lkml.kernel.org/r/20180621162324.36656-2-ndesaulniers@google.com
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ include/linux/compiler-gcc.h | 29 ++++++++++++++++++++++-------
+ 1 file changed, 22 insertions(+), 7 deletions(-)
+
+--- a/include/linux/compiler-gcc.h
++++ b/include/linux/compiler-gcc.h
+@@ -65,25 +65,40 @@
+ #endif
+
+ /*
++ * Feature detection for gnu_inline (gnu89 extern inline semantics). Either
++ * __GNUC_STDC_INLINE__ is defined (not using gnu89 extern inline semantics,
++ * and we opt in to the gnu89 semantics), or __GNUC_STDC_INLINE__ is not
++ * defined so the gnu89 semantics are the default.
++ */
++#ifdef __GNUC_STDC_INLINE__
++# define __gnu_inline __attribute__((gnu_inline))
++#else
++# define __gnu_inline
++#endif
++
++/*
+ * Force always-inline if the user requests it so via the .config,
+ * or if gcc is too old.
+ * GCC does not warn about unused static inline functions for
+ * -Wunused-function. This turns out to avoid the need for complex #ifdef
+ * directives. Suppress the warning in clang as well by using "unused"
+ * function attribute, which is redundant but not harmful for gcc.
++ * Prefer gnu_inline, so that extern inline functions do not emit an
++ * externally visible function. This makes extern inline behave as per gnu89
++ * semantics rather than c99. This prevents multiple symbol definition errors
++ * of extern inline functions at link time.
++ * A lot of inline functions can cause havoc with function tracing.
+ */
+ #if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \
+ !defined(CONFIG_OPTIMIZE_INLINING) || (__GNUC__ < 4)
+-#define inline inline __attribute__((always_inline,unused)) notrace
+-#define __inline__ __inline__ __attribute__((always_inline,unused)) notrace
+-#define __inline __inline __attribute__((always_inline,unused)) notrace
++#define inline \
++ inline __attribute__((always_inline, unused)) notrace __gnu_inline
+ #else
+-/* A lot of inline functions can cause havoc with function tracing */
+-#define inline inline __attribute__((unused)) notrace
+-#define __inline__ __inline__ __attribute__((unused)) notrace
+-#define __inline __inline __attribute__((unused)) notrace
++#define inline inline __attribute__((unused)) notrace __gnu_inline
+ #endif
+
++#define __inline__ inline
++#define __inline inline
+ #define __always_inline inline __attribute__((always_inline))
+ #define noinline __attribute__((noinline))
+
kbuild-fix-escaping-in-.cmd-files-for-future-make.patch
x86-cpu-probe-cpuid-leaf-6-even-when-cpuid_level-6.patch
perf-tools-move-syscall-number-fallbacks-from-perf-sys.h-to-tools-arch-x86-include-asm.patch
+compiler-clang-suppress-warning-for-unused-static-inline-functions.patch
+compiler-clang-properly-override-inline-for-clang.patch
+compiler-clang-always-inline-when-config_optimize_inlining-is-disabled.patch
+compiler-gcc.h-add-__attribute__-gnu_inline-to-all-inline-declarations.patch
+x86-asm-add-_asm_arg-constants-for-argument-registers-to-asm-asm.h.patch
--- /dev/null
+From 0e2e160033283e20f688d8bad5b89460cc5bfcc4 Mon Sep 17 00:00:00 2001
+From: "H. Peter Anvin" <hpa@linux.intel.com>
+Date: Thu, 21 Jun 2018 09:23:23 -0700
+Subject: x86/asm: Add _ASM_ARG* constants for argument registers to <asm/asm.h>
+
+From: H. Peter Anvin <hpa@linux.intel.com>
+
+commit 0e2e160033283e20f688d8bad5b89460cc5bfcc4 upstream.
+
+i386 and x86-64 uses different registers for arguments; make them
+available so we don't have to #ifdef in the actual code.
+
+Native size and specified size (q, l, w, b) versions are provided.
+
+Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
+Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
+Reviewed-by: Sedat Dilek <sedat.dilek@gmail.com>
+Acked-by: Juergen Gross <jgross@suse.com>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Cc: acme@redhat.com
+Cc: akataria@vmware.com
+Cc: akpm@linux-foundation.org
+Cc: andrea.parri@amarulasolutions.com
+Cc: ard.biesheuvel@linaro.org
+Cc: arnd@arndb.de
+Cc: aryabinin@virtuozzo.com
+Cc: astrachan@google.com
+Cc: boris.ostrovsky@oracle.com
+Cc: brijesh.singh@amd.com
+Cc: caoj.fnst@cn.fujitsu.com
+Cc: geert@linux-m68k.org
+Cc: ghackmann@google.com
+Cc: gregkh@linuxfoundation.org
+Cc: jan.kiszka@siemens.com
+Cc: jarkko.sakkinen@linux.intel.com
+Cc: joe@perches.com
+Cc: jpoimboe@redhat.com
+Cc: keescook@google.com
+Cc: kirill.shutemov@linux.intel.com
+Cc: kstewart@linuxfoundation.org
+Cc: linux-efi@vger.kernel.org
+Cc: linux-kbuild@vger.kernel.org
+Cc: manojgupta@google.com
+Cc: mawilcox@microsoft.com
+Cc: michal.lkml@markovi.net
+Cc: mjg59@google.com
+Cc: mka@chromium.org
+Cc: pombredanne@nexb.com
+Cc: rientjes@google.com
+Cc: rostedt@goodmis.org
+Cc: thomas.lendacky@amd.com
+Cc: tstellar@redhat.com
+Cc: tweek@google.com
+Cc: virtualization@lists.linux-foundation.org
+Cc: will.deacon@arm.com
+Cc: yamada.masahiro@socionext.com
+Link: http://lkml.kernel.org/r/20180621162324.36656-3-ndesaulniers@google.com
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/x86/include/asm/asm.h | 59 +++++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 59 insertions(+)
+
+--- a/arch/x86/include/asm/asm.h
++++ b/arch/x86/include/asm/asm.h
+@@ -44,6 +44,65 @@
+ #define _ASM_SI __ASM_REG(si)
+ #define _ASM_DI __ASM_REG(di)
+
++#ifndef __x86_64__
++/* 32 bit */
++
++#define _ASM_ARG1 _ASM_AX
++#define _ASM_ARG2 _ASM_DX
++#define _ASM_ARG3 _ASM_CX
++
++#define _ASM_ARG1L eax
++#define _ASM_ARG2L edx
++#define _ASM_ARG3L ecx
++
++#define _ASM_ARG1W ax
++#define _ASM_ARG2W dx
++#define _ASM_ARG3W cx
++
++#define _ASM_ARG1B al
++#define _ASM_ARG2B dl
++#define _ASM_ARG3B cl
++
++#else
++/* 64 bit */
++
++#define _ASM_ARG1 _ASM_DI
++#define _ASM_ARG2 _ASM_SI
++#define _ASM_ARG3 _ASM_DX
++#define _ASM_ARG4 _ASM_CX
++#define _ASM_ARG5 r8
++#define _ASM_ARG6 r9
++
++#define _ASM_ARG1Q rdi
++#define _ASM_ARG2Q rsi
++#define _ASM_ARG3Q rdx
++#define _ASM_ARG4Q rcx
++#define _ASM_ARG5Q r8
++#define _ASM_ARG6Q r9
++
++#define _ASM_ARG1L edi
++#define _ASM_ARG2L esi
++#define _ASM_ARG3L edx
++#define _ASM_ARG4L ecx
++#define _ASM_ARG5L r8d
++#define _ASM_ARG6L r9d
++
++#define _ASM_ARG1W di
++#define _ASM_ARG2W si
++#define _ASM_ARG3W dx
++#define _ASM_ARG4W cx
++#define _ASM_ARG5W r8w
++#define _ASM_ARG6W r9w
++
++#define _ASM_ARG1B dil
++#define _ASM_ARG2B sil
++#define _ASM_ARG3B dl
++#define _ASM_ARG4B cl
++#define _ASM_ARG5B r8b
++#define _ASM_ARG6B r9b
++
++#endif
++
+ /* Exception table entry */
+ #ifdef __ASSEMBLY__
+ # define _ASM_EXTABLE(from,to) \