]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.14-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 21 Dec 2017 14:39:23 +0000 (15:39 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 21 Dec 2017 14:39:23 +0000 (15:39 +0100)
added patches:
acpi-apei-adjust-a-local-variable-type-in-ghes_ioremap_pfn_irq.patch
acpi-apei-remove-the-unused-dead-code-for-sea-nmi-notification-type.patch
bitops-add-clear-set_bit32-to-linux-bitops.h.patch
mm-sparsemem-allocate-mem_section-at-runtime-for-config_sparsemem_extreme-y.patch
objtool-print-top-level-commands-on-incorrect-usage.patch
ptrace-x86-make-user_64bit_mode-available-to-32-bit-builds.patch
x86-asm-don-t-use-the-confusing-.ifeq-directive.patch
x86-boot-annotate-verify_cpu-as-a-callable-function.patch
x86-boot-relocate-definition-of-the-initial-state-of-cr0.patch
x86-build-beautify-build-log-of-syscall-headers.patch
x86-fpu-debug-remove-unused-x86_fpu_state-and-x86_fpu_deactivate_state-tracepoints.patch
x86-fpu-make-xsave-check-the-base-cpuid-features-before-enabling.patch
x86-fpu-parse-clearcpuid-as-early-xsave-argument.patch
x86-fpu-remove-the-explicit-clearing-of-xsave-dependent-features.patch
x86-head-add-unwind-hint-annotations.patch
x86-head-fix-head-elf-function-annotations.patch
x86-head-remove-confusing-comment.patch
x86-head-remove-unused-bad_address-code.patch
x86-kasan-use-the-same-shadow-offset-for-4-and-5-level-paging.patch
x86-mm-64-rename-the-register_page_bootmem_memmap-size-parameter-to-nr_pages.patch
x86-mm-relocate-page-fault-error-codes-to-traps.h.patch
x86-platform-uv-convert-timers-to-use-timer_setup.patch
x86-unwind-make-config_unwinder_orc-y-the-default-in-kconfig-for-64-bit.patch
x86-unwind-rename-unwinder-config-options-to-config_unwinder_.patch
x86-unwinder-make-config_unwinder_orc-y-the-default-in-the-64-bit-defconfig.patch
x86-xen-add-unwind-hint-annotations.patch
x86-xen-drop-5-level-paging-support-code-from-the-xen_pv-code.patch
x86-xen-fix-xen-head-elf-annotations.patch
x86-xen-provide-pre-built-page-tables-only-for-config_xen_pv-y-and-config_xen_pvh-y.patch

32 files changed:
queue-4.14/acpi-apei-adjust-a-local-variable-type-in-ghes_ioremap_pfn_irq.patch [new file with mode: 0644]
queue-4.14/acpi-apei-remove-the-unused-dead-code-for-sea-nmi-notification-type.patch [new file with mode: 0644]
queue-4.14/bitops-add-clear-set_bit32-to-linux-bitops.h.patch [new file with mode: 0644]
queue-4.14/mm-sparsemem-allocate-mem_section-at-runtime-for-config_sparsemem_extreme-y.patch [new file with mode: 0644]
queue-4.14/objtool-print-top-level-commands-on-incorrect-usage.patch [new file with mode: 0644]
queue-4.14/ptrace-x86-make-user_64bit_mode-available-to-32-bit-builds.patch [new file with mode: 0644]
queue-4.14/series
queue-4.14/x86-asm-don-t-use-the-confusing-.ifeq-directive.patch [new file with mode: 0644]
queue-4.14/x86-boot-annotate-verify_cpu-as-a-callable-function.patch [new file with mode: 0644]
queue-4.14/x86-boot-relocate-definition-of-the-initial-state-of-cr0.patch [new file with mode: 0644]
queue-4.14/x86-build-beautify-build-log-of-syscall-headers.patch [new file with mode: 0644]
queue-4.14/x86-cpufeatures-re-tabulate-the-x86_feature-definitions.patch [deleted file]
queue-4.14/x86-cpuid-replace-set-clear_bit32.patch [deleted file]
queue-4.14/x86-fpu-debug-remove-unused-x86_fpu_state-and-x86_fpu_deactivate_state-tracepoints.patch [new file with mode: 0644]
queue-4.14/x86-fpu-make-xsave-check-the-base-cpuid-features-before-enabling.patch [new file with mode: 0644]
queue-4.14/x86-fpu-parse-clearcpuid-as-early-xsave-argument.patch [new file with mode: 0644]
queue-4.14/x86-fpu-remove-the-explicit-clearing-of-xsave-dependent-features.patch [new file with mode: 0644]
queue-4.14/x86-head-add-unwind-hint-annotations.patch [new file with mode: 0644]
queue-4.14/x86-head-fix-head-elf-function-annotations.patch [new file with mode: 0644]
queue-4.14/x86-head-remove-confusing-comment.patch [new file with mode: 0644]
queue-4.14/x86-head-remove-unused-bad_address-code.patch [new file with mode: 0644]
queue-4.14/x86-kasan-use-the-same-shadow-offset-for-4-and-5-level-paging.patch [new file with mode: 0644]
queue-4.14/x86-mm-64-rename-the-register_page_bootmem_memmap-size-parameter-to-nr_pages.patch [new file with mode: 0644]
queue-4.14/x86-mm-relocate-page-fault-error-codes-to-traps.h.patch [new file with mode: 0644]
queue-4.14/x86-platform-uv-convert-timers-to-use-timer_setup.patch [new file with mode: 0644]
queue-4.14/x86-unwind-make-config_unwinder_orc-y-the-default-in-kconfig-for-64-bit.patch [new file with mode: 0644]
queue-4.14/x86-unwind-rename-unwinder-config-options-to-config_unwinder_.patch [new file with mode: 0644]
queue-4.14/x86-unwinder-make-config_unwinder_orc-y-the-default-in-the-64-bit-defconfig.patch [new file with mode: 0644]
queue-4.14/x86-xen-add-unwind-hint-annotations.patch [new file with mode: 0644]
queue-4.14/x86-xen-drop-5-level-paging-support-code-from-the-xen_pv-code.patch [new file with mode: 0644]
queue-4.14/x86-xen-fix-xen-head-elf-annotations.patch [new file with mode: 0644]
queue-4.14/x86-xen-provide-pre-built-page-tables-only-for-config_xen_pv-y-and-config_xen_pvh-y.patch [new file with mode: 0644]

diff --git a/queue-4.14/acpi-apei-adjust-a-local-variable-type-in-ghes_ioremap_pfn_irq.patch b/queue-4.14/acpi-apei-adjust-a-local-variable-type-in-ghes_ioremap_pfn_irq.patch
new file mode 100644 (file)
index 0000000..3411b33
--- /dev/null
@@ -0,0 +1,33 @@
+From 095f613c6b386a1704b73a549e9ba66c1d5381ae Mon Sep 17 00:00:00 2001
+From: Jan Beulich <JBeulich@suse.com>
+Date: Mon, 25 Sep 2017 02:06:19 -0600
+Subject: ACPI / APEI: adjust a local variable type in ghes_ioremap_pfn_irq()
+
+From: Jan Beulich <JBeulich@suse.com>
+
+commit 095f613c6b386a1704b73a549e9ba66c1d5381ae upstream.
+
+Match up with what 7edda0886b ("acpi: apei: handle SEA notification
+type for ARMv8") did for ghes_ioremap_pfn_nmi().
+
+Signed-off-by: Jan Beulich <jbeulich@suse.com>
+Reviewed-by: Borislav Petkov <bp@suse.de>
+Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/acpi/apei/ghes.c |    3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/drivers/acpi/apei/ghes.c
++++ b/drivers/acpi/apei/ghes.c
+@@ -174,7 +174,8 @@ static void __iomem *ghes_ioremap_pfn_nm
+ static void __iomem *ghes_ioremap_pfn_irq(u64 pfn)
+ {
+-      unsigned long vaddr, paddr;
++      unsigned long vaddr;
++      phys_addr_t paddr;
+       pgprot_t prot;
+       vaddr = (unsigned long)GHES_IOREMAP_IRQ_PAGE(ghes_ioremap_area->addr);
diff --git a/queue-4.14/acpi-apei-remove-the-unused-dead-code-for-sea-nmi-notification-type.patch b/queue-4.14/acpi-apei-remove-the-unused-dead-code-for-sea-nmi-notification-type.patch
new file mode 100644 (file)
index 0000000..d3cdac4
--- /dev/null
@@ -0,0 +1,78 @@
+From c49870e89f4d2c21c76ebe90568246bb0f3572b7 Mon Sep 17 00:00:00 2001
+From: Dongjiu Geng <gengdongjiu@huawei.com>
+Date: Tue, 17 Oct 2017 16:02:20 +0800
+Subject: ACPI / APEI: remove the unused dead-code for SEA/NMI notification type
+
+From: Dongjiu Geng <gengdongjiu@huawei.com>
+
+commit c49870e89f4d2c21c76ebe90568246bb0f3572b7 upstream.
+
+For the SEA notification, the two functions ghes_sea_add() and
+ghes_sea_remove() are only called when CONFIG_ACPI_APEI_SEA
+is defined. If not, it will return errors in the ghes_probe()
+and not continue. If the probe is failed, the ghes_sea_remove()
+also has no chance to be called. Hence, remove the unnecessary
+handling when CONFIG_ACPI_APEI_SEA is not defined.
+
+For the NMI notification, it has the same issue as SEA notification,
+so also remove the unused dead-code for it.
+
+Signed-off-by: Dongjiu Geng <gengdongjiu@huawei.com>
+Tested-by: Tyler Baicar <tbaicar@codeaurora.org>
+Reviewed-by: Borislav Petkov <bp@suse.de>
+Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/acpi/apei/ghes.c |   33 +++++----------------------------
+ 1 file changed, 5 insertions(+), 28 deletions(-)
+
+--- a/drivers/acpi/apei/ghes.c
++++ b/drivers/acpi/apei/ghes.c
+@@ -852,17 +852,8 @@ static void ghes_sea_remove(struct ghes
+       synchronize_rcu();
+ }
+ #else /* CONFIG_ACPI_APEI_SEA */
+-static inline void ghes_sea_add(struct ghes *ghes)
+-{
+-      pr_err(GHES_PFX "ID: %d, trying to add SEA notification which is not supported\n",
+-             ghes->generic->header.source_id);
+-}
+-
+-static inline void ghes_sea_remove(struct ghes *ghes)
+-{
+-      pr_err(GHES_PFX "ID: %d, trying to remove SEA notification which is not supported\n",
+-             ghes->generic->header.source_id);
+-}
++static inline void ghes_sea_add(struct ghes *ghes) { }
++static inline void ghes_sea_remove(struct ghes *ghes) { }
+ #endif /* CONFIG_ACPI_APEI_SEA */
+ #ifdef CONFIG_HAVE_ACPI_APEI_NMI
+@@ -1064,23 +1055,9 @@ static void ghes_nmi_init_cxt(void)
+       init_irq_work(&ghes_proc_irq_work, ghes_proc_in_irq);
+ }
+ #else /* CONFIG_HAVE_ACPI_APEI_NMI */
+-static inline void ghes_nmi_add(struct ghes *ghes)
+-{
+-      pr_err(GHES_PFX "ID: %d, trying to add NMI notification which is not supported!\n",
+-             ghes->generic->header.source_id);
+-      BUG();
+-}
+-
+-static inline void ghes_nmi_remove(struct ghes *ghes)
+-{
+-      pr_err(GHES_PFX "ID: %d, trying to remove NMI notification which is not supported!\n",
+-             ghes->generic->header.source_id);
+-      BUG();
+-}
+-
+-static inline void ghes_nmi_init_cxt(void)
+-{
+-}
++static inline void ghes_nmi_add(struct ghes *ghes) { }
++static inline void ghes_nmi_remove(struct ghes *ghes) { }
++static inline void ghes_nmi_init_cxt(void) { }
+ #endif /* CONFIG_HAVE_ACPI_APEI_NMI */
+ static int ghes_probe(struct platform_device *ghes_dev)
diff --git a/queue-4.14/bitops-add-clear-set_bit32-to-linux-bitops.h.patch b/queue-4.14/bitops-add-clear-set_bit32-to-linux-bitops.h.patch
new file mode 100644 (file)
index 0000000..d9b26c8
--- /dev/null
@@ -0,0 +1,60 @@
+From cbe96375025e14fc76f9ed42ee5225120d7210f8 Mon Sep 17 00:00:00 2001
+From: Andi Kleen <ak@linux.intel.com>
+Date: Fri, 13 Oct 2017 14:56:41 -0700
+Subject: bitops: Add clear/set_bit32() to linux/bitops.h
+
+From: Andi Kleen <ak@linux.intel.com>
+
+commit cbe96375025e14fc76f9ed42ee5225120d7210f8 upstream.
+
+Add two simple wrappers around set_bit/clear_bit() that accept
+the common case of an u32 array. This avoids writing
+casts in all callers.
+
+Signed-off-by: Andi Kleen <ak@linux.intel.com>
+Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Link: http://lkml.kernel.org/r/20171013215645.23166-2-andi@firstfloor.org
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ include/linux/bitops.h |   26 ++++++++++++++++++++++++++
+ 1 file changed, 26 insertions(+)
+
+--- a/include/linux/bitops.h
++++ b/include/linux/bitops.h
+@@ -228,6 +228,32 @@ static inline unsigned long __ffs64(u64
+       return __ffs((unsigned long)word);
+ }
++/*
++ * clear_bit32 - Clear a bit in memory for u32 array
++ * @nr: Bit to clear
++ * @addr: u32 * address of bitmap
++ *
++ * Same as clear_bit, but avoids needing casts for u32 arrays.
++ */
++
++static __always_inline void clear_bit32(long nr, volatile u32 *addr)
++{
++      clear_bit(nr, (volatile unsigned long *)addr);
++}
++
++/*
++ * set_bit32 - Set a bit in memory for u32 array
++ * @nr: Bit to clear
++ * @addr: u32 * address of bitmap
++ *
++ * Same as set_bit, but avoids needing casts for u32 arrays.
++ */
++
++static __always_inline void set_bit32(long nr, volatile u32 *addr)
++{
++      set_bit(nr, (volatile unsigned long *)addr);
++}
++
+ #ifdef __KERNEL__
+ #ifndef set_mask_bits
diff --git a/queue-4.14/mm-sparsemem-allocate-mem_section-at-runtime-for-config_sparsemem_extreme-y.patch b/queue-4.14/mm-sparsemem-allocate-mem_section-at-runtime-for-config_sparsemem_extreme-y.patch
new file mode 100644 (file)
index 0000000..2890172
--- /dev/null
@@ -0,0 +1,127 @@
+From 83e3c48729d9ebb7af5a31a504f3fd6aff0348c4 Mon Sep 17 00:00:00 2001
+From: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
+Date: Fri, 29 Sep 2017 17:08:16 +0300
+Subject: mm/sparsemem: Allocate mem_section at runtime for CONFIG_SPARSEMEM_EXTREME=y
+
+From: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
+
+commit 83e3c48729d9ebb7af5a31a504f3fd6aff0348c4 upstream.
+
+Size of the mem_section[] array depends on the size of the physical address space.
+
+In preparation for boot-time switching between paging modes on x86-64
+we need to make the allocation of mem_section[] dynamic, because otherwise
+we waste a lot of RAM: with CONFIG_NODE_SHIFT=10, mem_section[] size is 32kB
+for 4-level paging and 2MB for 5-level paging mode.
+
+The patch allocates the array on the first call to sparse_memory_present_with_active_regions().
+
+Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
+Cc: Andrew Morton <akpm@linux-foundation.org>
+Cc: Andy Lutomirski <luto@amacapital.net>
+Cc: Borislav Petkov <bp@suse.de>
+Cc: Cyrill Gorcunov <gorcunov@openvz.org>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Cc: linux-mm@kvack.org
+Link: http://lkml.kernel.org/r/20170929140821.37654-2-kirill.shutemov@linux.intel.com
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ include/linux/mmzone.h |    6 +++++-
+ mm/page_alloc.c        |   10 ++++++++++
+ mm/sparse.c            |   17 +++++++++++------
+ 3 files changed, 26 insertions(+), 7 deletions(-)
+
+--- a/include/linux/mmzone.h
++++ b/include/linux/mmzone.h
+@@ -1152,13 +1152,17 @@ struct mem_section {
+ #define SECTION_ROOT_MASK     (SECTIONS_PER_ROOT - 1)
+ #ifdef CONFIG_SPARSEMEM_EXTREME
+-extern struct mem_section *mem_section[NR_SECTION_ROOTS];
++extern struct mem_section **mem_section;
+ #else
+ extern struct mem_section mem_section[NR_SECTION_ROOTS][SECTIONS_PER_ROOT];
+ #endif
+ static inline struct mem_section *__nr_to_section(unsigned long nr)
+ {
++#ifdef CONFIG_SPARSEMEM_EXTREME
++      if (!mem_section)
++              return NULL;
++#endif
+       if (!mem_section[SECTION_NR_TO_ROOT(nr)])
+               return NULL;
+       return &mem_section[SECTION_NR_TO_ROOT(nr)][nr & SECTION_ROOT_MASK];
+--- a/mm/page_alloc.c
++++ b/mm/page_alloc.c
+@@ -5651,6 +5651,16 @@ void __init sparse_memory_present_with_a
+       unsigned long start_pfn, end_pfn;
+       int i, this_nid;
++#ifdef CONFIG_SPARSEMEM_EXTREME
++      if (!mem_section) {
++              unsigned long size, align;
++
++              size = sizeof(struct mem_section) * NR_SECTION_ROOTS;
++              align = 1 << (INTERNODE_CACHE_SHIFT);
++              mem_section = memblock_virt_alloc(size, align);
++      }
++#endif
++
+       for_each_mem_pfn_range(i, nid, &start_pfn, &end_pfn, &this_nid)
+               memory_present(this_nid, start_pfn, end_pfn);
+ }
+--- a/mm/sparse.c
++++ b/mm/sparse.c
+@@ -23,8 +23,7 @@
+  * 1) mem_section     - memory sections, mem_map's for valid memory
+  */
+ #ifdef CONFIG_SPARSEMEM_EXTREME
+-struct mem_section *mem_section[NR_SECTION_ROOTS]
+-      ____cacheline_internodealigned_in_smp;
++struct mem_section **mem_section;
+ #else
+ struct mem_section mem_section[NR_SECTION_ROOTS][SECTIONS_PER_ROOT]
+       ____cacheline_internodealigned_in_smp;
+@@ -101,7 +100,7 @@ static inline int sparse_index_init(unsi
+ int __section_nr(struct mem_section* ms)
+ {
+       unsigned long root_nr;
+-      struct mem_section* root;
++      struct mem_section *root = NULL;
+       for (root_nr = 0; root_nr < NR_SECTION_ROOTS; root_nr++) {
+               root = __nr_to_section(root_nr * SECTIONS_PER_ROOT);
+@@ -112,7 +111,7 @@ int __section_nr(struct mem_section* ms)
+                    break;
+       }
+-      VM_BUG_ON(root_nr == NR_SECTION_ROOTS);
++      VM_BUG_ON(!root);
+       return (root_nr * SECTIONS_PER_ROOT) + (ms - root);
+ }
+@@ -330,11 +329,17 @@ again:
+ static void __init check_usemap_section_nr(int nid, unsigned long *usemap)
+ {
+       unsigned long usemap_snr, pgdat_snr;
+-      static unsigned long old_usemap_snr = NR_MEM_SECTIONS;
+-      static unsigned long old_pgdat_snr = NR_MEM_SECTIONS;
++      static unsigned long old_usemap_snr;
++      static unsigned long old_pgdat_snr;
+       struct pglist_data *pgdat = NODE_DATA(nid);
+       int usemap_nid;
++      /* First call */
++      if (!old_usemap_snr) {
++              old_usemap_snr = NR_MEM_SECTIONS;
++              old_pgdat_snr = NR_MEM_SECTIONS;
++      }
++
+       usemap_snr = pfn_to_section_nr(__pa(usemap) >> PAGE_SHIFT);
+       pgdat_snr = pfn_to_section_nr(__pa(pgdat) >> PAGE_SHIFT);
+       if (usemap_snr == pgdat_snr)
diff --git a/queue-4.14/objtool-print-top-level-commands-on-incorrect-usage.patch b/queue-4.14/objtool-print-top-level-commands-on-incorrect-usage.patch
new file mode 100644 (file)
index 0000000..a2fe8af
--- /dev/null
@@ -0,0 +1,64 @@
+From 6a93bb7e4a7d6670677d5b0eb980936eb9cc5d2e Mon Sep 17 00:00:00 2001
+From: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>
+Date: Sat, 14 Oct 2017 20:17:54 +0530
+Subject: objtool: Print top level commands on incorrect usage
+
+From: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>
+
+commit 6a93bb7e4a7d6670677d5b0eb980936eb9cc5d2e upstream.
+
+Print top-level objtool commands, along with the error on incorrect
+command line usage. Objtool command line parser exit's with code 129,
+for incorrect usage. Convert the cmd_usage() exit code also, to maintain
+consistency across objtool.
+
+After the patch:
+
+  $ ./objtool -j
+
+  Unknown option: -j
+
+  usage: objtool COMMAND [ARGS]
+
+  Commands:
+     check   Perform stack metadata validation on an object file
+     orc     Generate in-place ORC unwind tables for an object file
+
+  $ echo $?
+  129
+
+Signed-off-by: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>
+Acked-by: Josh Poimboeuf <jpoimboe@redhat.com>
+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/1507992474-16142-1-git-send-email-kamalesh@linux.vnet.ibm.com
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ tools/objtool/objtool.c |    6 ++----
+ 1 file changed, 2 insertions(+), 4 deletions(-)
+
+--- a/tools/objtool/objtool.c
++++ b/tools/objtool/objtool.c
+@@ -70,7 +70,7 @@ static void cmd_usage(void)
+       printf("\n");
+-      exit(1);
++      exit(129);
+ }
+ static void handle_options(int *argc, const char ***argv)
+@@ -86,9 +86,7 @@ static void handle_options(int *argc, co
+                       break;
+               } else {
+                       fprintf(stderr, "Unknown option: %s\n", cmd);
+-                      fprintf(stderr, "\n Usage: %s\n",
+-                              objtool_usage_string);
+-                      exit(1);
++                      cmd_usage();
+               }
+               (*argv)++;
diff --git a/queue-4.14/ptrace-x86-make-user_64bit_mode-available-to-32-bit-builds.patch b/queue-4.14/ptrace-x86-make-user_64bit_mode-available-to-32-bit-builds.patch
new file mode 100644 (file)
index 0000000..cd9d50d
--- /dev/null
@@ -0,0 +1,82 @@
+From e27c310af5c05cf876d9cad006928076c27f54d4 Mon Sep 17 00:00:00 2001
+From: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
+Date: Fri, 27 Oct 2017 13:25:30 -0700
+Subject: ptrace,x86: Make user_64bit_mode() available to 32-bit builds
+
+From: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
+
+commit e27c310af5c05cf876d9cad006928076c27f54d4 upstream.
+
+In its current form, user_64bit_mode() can only be used when CONFIG_X86_64
+is selected. This implies that code built with CONFIG_X86_64=n cannot use
+it. If a piece of code needs to be built for both CONFIG_X86_64=y and
+CONFIG_X86_64=n and wants to use this function, it needs to wrap it in
+an #ifdef/#endif; potentially, in multiple places.
+
+This can be easily avoided with a single #ifdef/#endif pair within
+user_64bit_mode() itself.
+
+Suggested-by: Borislav Petkov <bp@suse.de>
+Signed-off-by: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
+Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
+Reviewed-by: Borislav Petkov <bp@suse.de>
+Cc: "Michael S. Tsirkin" <mst@redhat.com>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Dave Hansen <dave.hansen@linux.intel.com>
+Cc: ricardo.neri@intel.com
+Cc: Adrian Hunter <adrian.hunter@intel.com>
+Cc: Paul Gortmaker <paul.gortmaker@windriver.com>
+Cc: Huang Rui <ray.huang@amd.com>
+Cc: Qiaowei Ren <qiaowei.ren@intel.com>
+Cc: Shuah Khan <shuah@kernel.org>
+Cc: Kees Cook <keescook@chromium.org>
+Cc: Jonathan Corbet <corbet@lwn.net>
+Cc: Jiri Slaby <jslaby@suse.cz>
+Cc: Dmitry Vyukov <dvyukov@google.com>
+Cc: "Ravi V. Shankar" <ravi.v.shankar@intel.com>
+Cc: Chris Metcalf <cmetcalf@mellanox.com>
+Cc: Brian Gerst <brgerst@gmail.com>
+Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
+Cc: Andy Lutomirski <luto@kernel.org>
+Cc: Colin Ian King <colin.king@canonical.com>
+Cc: Chen Yucong <slaoub@gmail.com>
+Cc: Adam Buchbinder <adam.buchbinder@gmail.com>
+Cc: Vlastimil Babka <vbabka@suse.cz>
+Cc: Lorenzo Stoakes <lstoakes@gmail.com>
+Cc: Masami Hiramatsu <mhiramat@kernel.org>
+Cc: Paolo Bonzini <pbonzini@redhat.com>
+Cc: Andrew Morton <akpm@linux-foundation.org>
+Cc: Thomas Garnier <thgarnie@google.com>
+Link: https://lkml.kernel.org/r/1509135945-13762-4-git-send-email-ricardo.neri-calderon@linux.intel.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/x86/include/asm/ptrace.h |    6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+--- a/arch/x86/include/asm/ptrace.h
++++ b/arch/x86/include/asm/ptrace.h
+@@ -136,9 +136,9 @@ static inline int v8086_mode(struct pt_r
+ #endif
+ }
+-#ifdef CONFIG_X86_64
+ static inline bool user_64bit_mode(struct pt_regs *regs)
+ {
++#ifdef CONFIG_X86_64
+ #ifndef CONFIG_PARAVIRT
+       /*
+        * On non-paravirt systems, this is the only long mode CPL 3
+@@ -149,8 +149,12 @@ static inline bool user_64bit_mode(struc
+       /* Headers are too twisted for this to go in paravirt.h. */
+       return regs->cs == __USER_CS || regs->cs == pv_info.extra_user_64bit_cs;
+ #endif
++#else /* !CONFIG_X86_64 */
++      return false;
++#endif
+ }
++#ifdef CONFIG_X86_64
+ #define current_user_stack_pointer()  current_pt_regs()->sp
+ #define compat_user_stack_pointer()   current_pt_regs()->sp
+ #endif
index 938c2fa41ebb63966b4ec163a263378479d19b8f..2d0c808f8db347907f8b7287fb4d2283f5560f2d 100644 (file)
@@ -1,10 +1,37 @@
 x86-asm-remove-unnecessary-n-t-in-front-of-cc_set-from-asm-templates.patch
 objtool-don-t-report-end-of-section-error-after-an-empty-unwind-hint.patch
+x86-head-remove-confusing-comment.patch
+x86-head-remove-unused-bad_address-code.patch
+x86-head-fix-head-elf-function-annotations.patch
+x86-boot-annotate-verify_cpu-as-a-callable-function.patch
+x86-xen-fix-xen-head-elf-annotations.patch
+x86-xen-add-unwind-hint-annotations.patch
+x86-head-add-unwind-hint-annotations.patch
+acpi-apei-adjust-a-local-variable-type-in-ghes_ioremap_pfn_irq.patch
+x86-unwinder-make-config_unwinder_orc-y-the-default-in-the-64-bit-defconfig.patch
+x86-fpu-debug-remove-unused-x86_fpu_state-and-x86_fpu_deactivate_state-tracepoints.patch
+x86-unwind-rename-unwinder-config-options-to-config_unwinder_.patch
+x86-unwind-make-config_unwinder_orc-y-the-default-in-kconfig-for-64-bit.patch
+bitops-add-clear-set_bit32-to-linux-bitops.h.patch
 x86-cpuid-add-generic-table-for-cpuid-dependencies.patch
+x86-fpu-parse-clearcpuid-as-early-xsave-argument.patch
+x86-fpu-make-xsave-check-the-base-cpuid-features-before-enabling.patch
+x86-fpu-remove-the-explicit-clearing-of-xsave-dependent-features.patch
+x86-platform-uv-convert-timers-to-use-timer_setup.patch
+objtool-print-top-level-commands-on-incorrect-usage.patch
 x86-cpuid-prevent-out-of-bound-access-in-do_clear_cpu_cap.patch
+mm-sparsemem-allocate-mem_section-at-runtime-for-config_sparsemem_extreme-y.patch
+x86-kasan-use-the-same-shadow-offset-for-4-and-5-level-paging.patch
+x86-xen-provide-pre-built-page-tables-only-for-config_xen_pv-y-and-config_xen_pvh-y.patch
+x86-xen-drop-5-level-paging-support-code-from-the-xen_pv-code.patch
+acpi-apei-remove-the-unused-dead-code-for-sea-nmi-notification-type.patch
+x86-asm-don-t-use-the-confusing-.ifeq-directive.patch
+x86-build-beautify-build-log-of-syscall-headers.patch
+x86-mm-64-rename-the-register_page_bootmem_memmap-size-parameter-to-nr_pages.patch
 x86-cpufeatures-enable-new-sse-avx-avx512-cpu-features.patch
-x86-cpuid-replace-set-clear_bit32.patch
-x86-cpufeatures-re-tabulate-the-x86_feature-definitions.patch
+x86-mm-relocate-page-fault-error-codes-to-traps.h.patch
+x86-boot-relocate-definition-of-the-initial-state-of-cr0.patch
+ptrace-x86-make-user_64bit_mode-available-to-32-bit-builds.patch
 optee-fix-invalid-of_node_put-in-optee_driver_init.patch
 backlight-pwm_bl-fix-overflow-condition.patch
 drm-add-retries-for-lspcon-mode-detection.patch
diff --git a/queue-4.14/x86-asm-don-t-use-the-confusing-.ifeq-directive.patch b/queue-4.14/x86-asm-don-t-use-the-confusing-.ifeq-directive.patch
new file mode 100644 (file)
index 0000000..8b4f2ac
--- /dev/null
@@ -0,0 +1,65 @@
+From 82c62fa0c49aa305104013cee4468772799bb391 Mon Sep 17 00:00:00 2001
+From: Josh Poimboeuf <jpoimboe@redhat.com>
+Date: Fri, 20 Oct 2017 11:21:35 -0500
+Subject: x86/asm: Don't use the confusing '.ifeq' directive
+
+From: Josh Poimboeuf <jpoimboe@redhat.com>
+
+commit 82c62fa0c49aa305104013cee4468772799bb391 upstream.
+
+I find the '.ifeq <expression>' directive to be confusing.  Reading it
+quickly seems to suggest its opposite meaning, or that it's missing an
+argument.
+
+Improve readability by replacing all of its x86 uses with
+'.if <expression> == 0'.
+
+Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
+Cc: Andrei Vagin <avagin@virtuozzo.com>
+Cc: Andy Lutomirski <luto@kernel.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/757da028e802c7e98d23fbab8d234b1063e161cf.1508516398.git.jpoimboe@redhat.com
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/x86/entry/entry_64.S |    2 +-
+ arch/x86/kernel/head_32.S |    2 +-
+ arch/x86/kernel/head_64.S |    2 +-
+ 3 files changed, 3 insertions(+), 3 deletions(-)
+
+--- a/arch/x86/entry/entry_64.S
++++ b/arch/x86/entry/entry_64.S
+@@ -818,7 +818,7 @@ ENTRY(\sym)
+       ASM_CLAC
+-      .ifeq \has_error_code
++      .if \has_error_code == 0
+       pushq   $-1                             /* ORIG_RAX: no syscall to restart */
+       .endif
+--- a/arch/x86/kernel/head_32.S
++++ b/arch/x86/kernel/head_32.S
+@@ -402,7 +402,7 @@ ENTRY(early_idt_handler_array)
+       # 24(%rsp) error code
+       i = 0
+       .rept NUM_EXCEPTION_VECTORS
+-      .ifeq (EXCEPTION_ERRCODE_MASK >> i) & 1
++      .if ((EXCEPTION_ERRCODE_MASK >> i) & 1) == 0
+       pushl $0                # Dummy error code, to make stack frame uniform
+       .endif
+       pushl $i                # 20(%esp) Vector number
+--- a/arch/x86/kernel/head_64.S
++++ b/arch/x86/kernel/head_64.S
+@@ -275,7 +275,7 @@ ENDPROC(start_cpu0)
+ ENTRY(early_idt_handler_array)
+       i = 0
+       .rept NUM_EXCEPTION_VECTORS
+-      .ifeq (EXCEPTION_ERRCODE_MASK >> i) & 1
++      .if ((EXCEPTION_ERRCODE_MASK >> i) & 1) == 0
+               UNWIND_HINT_IRET_REGS
+               pushq $0        # Dummy error code, to make stack frame uniform
+       .else
diff --git a/queue-4.14/x86-boot-annotate-verify_cpu-as-a-callable-function.patch b/queue-4.14/x86-boot-annotate-verify_cpu-as-a-callable-function.patch
new file mode 100644 (file)
index 0000000..6816e29
--- /dev/null
@@ -0,0 +1,43 @@
+From e93db75a0054b23a874a12c63376753544f3fe9e Mon Sep 17 00:00:00 2001
+From: Josh Poimboeuf <jpoimboe@redhat.com>
+Date: Mon, 18 Sep 2017 21:43:34 -0500
+Subject: x86/boot: Annotate verify_cpu() as a callable function
+
+From: Josh Poimboeuf <jpoimboe@redhat.com>
+
+commit e93db75a0054b23a874a12c63376753544f3fe9e upstream.
+
+verify_cpu() is a callable function.  Annotate it as such.
+
+Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
+Cc: Andy Lutomirski <luto@kernel.org>
+Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
+Cc: Jiri Slaby <jslaby@suse.cz>
+Cc: Juergen Gross <jgross@suse.com>
+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/293024b8a080832075312f38c07ccc970fc70292.1505764066.git.jpoimboe@redhat.com
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/x86/kernel/verify_cpu.S |    3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/arch/x86/kernel/verify_cpu.S
++++ b/arch/x86/kernel/verify_cpu.S
+@@ -33,7 +33,7 @@
+ #include <asm/cpufeatures.h>
+ #include <asm/msr-index.h>
+-verify_cpu:
++ENTRY(verify_cpu)
+       pushf                           # Save caller passed flags
+       push    $0                      # Kill any dangerous flags
+       popf
+@@ -139,3 +139,4 @@ verify_cpu:
+       popf                            # Restore caller passed flags
+       xorl %eax, %eax
+       ret
++ENDPROC(verify_cpu)
diff --git a/queue-4.14/x86-boot-relocate-definition-of-the-initial-state-of-cr0.patch b/queue-4.14/x86-boot-relocate-definition-of-the-initial-state-of-cr0.patch
new file mode 100644 (file)
index 0000000..011afda
--- /dev/null
@@ -0,0 +1,89 @@
+From b0ce5b8c95c83a7b98c679b117e3d6ae6f97154b Mon Sep 17 00:00:00 2001
+From: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
+Date: Fri, 27 Oct 2017 13:25:29 -0700
+Subject: x86/boot: Relocate definition of the initial state of CR0
+
+From: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
+
+commit b0ce5b8c95c83a7b98c679b117e3d6ae6f97154b upstream.
+
+Both head_32.S and head_64.S utilize the same value to initialize the
+control register CR0. Also, other parts of the kernel might want to access
+this initial definition (e.g., emulation code for User-Mode Instruction
+Prevention uses this state to provide a sane dummy value for CR0 when
+emulating the smsw instruction). Thus, relocate this definition to a
+header file from which it can be conveniently accessed.
+
+Suggested-by: Borislav Petkov <bp@alien8.de>
+Signed-off-by: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
+Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
+Reviewed-by: Borislav Petkov <bp@suse.de>
+Reviewed-by: Andy Lutomirski <luto@kernel.org>
+Cc: "Michael S. Tsirkin" <mst@redhat.com>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Dave Hansen <dave.hansen@linux.intel.com>
+Cc: ricardo.neri@intel.com
+Cc: linux-mm@kvack.org
+Cc: Paul Gortmaker <paul.gortmaker@windriver.com>
+Cc: Huang Rui <ray.huang@amd.com>
+Cc: Shuah Khan <shuah@kernel.org>
+Cc: linux-arch@vger.kernel.org
+Cc: Jonathan Corbet <corbet@lwn.net>
+Cc: Jiri Slaby <jslaby@suse.cz>
+Cc: "Ravi V. Shankar" <ravi.v.shankar@intel.com>
+Cc: Denys Vlasenko <dvlasenk@redhat.com>
+Cc: Chris Metcalf <cmetcalf@mellanox.com>
+Cc: Brian Gerst <brgerst@gmail.com>
+Cc: Josh Poimboeuf <jpoimboe@redhat.com>
+Cc: Chen Yucong <slaoub@gmail.com>
+Cc: Vlastimil Babka <vbabka@suse.cz>
+Cc: Dave Hansen <dave.hansen@intel.com>
+Cc: Andy Lutomirski <luto@amacapital.net>
+Cc: Masami Hiramatsu <mhiramat@kernel.org>
+Cc: Paolo Bonzini <pbonzini@redhat.com>
+Cc: Andrew Morton <akpm@linux-foundation.org>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Link: https://lkml.kernel.org/r/1509135945-13762-3-git-send-email-ricardo.neri-calderon@linux.intel.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/x86/include/uapi/asm/processor-flags.h |    3 +++
+ arch/x86/kernel/head_32.S                   |    3 ---
+ arch/x86/kernel/head_64.S                   |    3 ---
+ 3 files changed, 3 insertions(+), 6 deletions(-)
+
+--- a/arch/x86/include/uapi/asm/processor-flags.h
++++ b/arch/x86/include/uapi/asm/processor-flags.h
+@@ -152,5 +152,8 @@
+ #define CX86_ARR_BASE 0xc4
+ #define CX86_RCR_BASE 0xdc
++#define CR0_STATE     (X86_CR0_PE | X86_CR0_MP | X86_CR0_ET | \
++                       X86_CR0_NE | X86_CR0_WP | X86_CR0_AM | \
++                       X86_CR0_PG)
+ #endif /* _UAPI_ASM_X86_PROCESSOR_FLAGS_H */
+--- a/arch/x86/kernel/head_32.S
++++ b/arch/x86/kernel/head_32.S
+@@ -212,9 +212,6 @@ ENTRY(startup_32_smp)
+ #endif
+ .Ldefault_entry:
+-#define CR0_STATE     (X86_CR0_PE | X86_CR0_MP | X86_CR0_ET | \
+-                       X86_CR0_NE | X86_CR0_WP | X86_CR0_AM | \
+-                       X86_CR0_PG)
+       movl $(CR0_STATE & ~X86_CR0_PG),%eax
+       movl %eax,%cr0
+--- a/arch/x86/kernel/head_64.S
++++ b/arch/x86/kernel/head_64.S
+@@ -154,9 +154,6 @@ ENTRY(secondary_startup_64)
+ 1:    wrmsr                           /* Make changes effective */
+       /* Setup cr0 */
+-#define CR0_STATE     (X86_CR0_PE | X86_CR0_MP | X86_CR0_ET | \
+-                       X86_CR0_NE | X86_CR0_WP | X86_CR0_AM | \
+-                       X86_CR0_PG)
+       movl    $CR0_STATE, %eax
+       /* Make changes effective */
+       movq    %rax, %cr0
diff --git a/queue-4.14/x86-build-beautify-build-log-of-syscall-headers.patch b/queue-4.14/x86-build-beautify-build-log-of-syscall-headers.patch
new file mode 100644 (file)
index 0000000..6b6a01d
--- /dev/null
@@ -0,0 +1,54 @@
+From af8e947079a7dab0480b5d6db6b093fd04b86fc9 Mon Sep 17 00:00:00 2001
+From: Masahiro Yamada <yamada.masahiro@socionext.com>
+Date: Fri, 27 Oct 2017 13:11:10 +0900
+Subject: x86/build: Beautify build log of syscall headers
+
+From: Masahiro Yamada <yamada.masahiro@socionext.com>
+
+commit af8e947079a7dab0480b5d6db6b093fd04b86fc9 upstream.
+
+This makes the build log look nicer.
+
+Before:
+  SYSTBL  arch/x86/entry/syscalls/../../include/generated/asm/syscalls_32.h
+  SYSHDR  arch/x86/entry/syscalls/../../include/generated/asm/unistd_32_ia32.h
+  SYSHDR  arch/x86/entry/syscalls/../../include/generated/asm/unistd_64_x32.h
+  SYSTBL  arch/x86/entry/syscalls/../../include/generated/asm/syscalls_64.h
+  SYSHDR  arch/x86/entry/syscalls/../../include/generated/uapi/asm/unistd_32.h
+  SYSHDR  arch/x86/entry/syscalls/../../include/generated/uapi/asm/unistd_64.h
+  SYSHDR  arch/x86/entry/syscalls/../../include/generated/uapi/asm/unistd_x32.h
+
+After:
+  SYSTBL  arch/x86/include/generated/asm/syscalls_32.h
+  SYSHDR  arch/x86/include/generated/asm/unistd_32_ia32.h
+  SYSHDR  arch/x86/include/generated/asm/unistd_64_x32.h
+  SYSTBL  arch/x86/include/generated/asm/syscalls_64.h
+  SYSHDR  arch/x86/include/generated/uapi/asm/unistd_32.h
+  SYSHDR  arch/x86/include/generated/uapi/asm/unistd_64.h
+  SYSHDR  arch/x86/include/generated/uapi/asm/unistd_x32.h
+
+Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
+Acked-by: Thomas Gleixner <tglx@linutronix.de>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: "H. Peter Anvin" <hpa@zytor.com>
+Cc: linux-kbuild@vger.kernel.org
+Link: http://lkml.kernel.org/r/1509077470-2735-1-git-send-email-yamada.masahiro@socionext.com
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/x86/entry/syscalls/Makefile |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/arch/x86/entry/syscalls/Makefile
++++ b/arch/x86/entry/syscalls/Makefile
+@@ -1,6 +1,6 @@
+ # SPDX-License-Identifier: GPL-2.0
+-out := $(obj)/../../include/generated/asm
+-uapi := $(obj)/../../include/generated/uapi/asm
++out := arch/$(SRCARCH)/include/generated/asm
++uapi := arch/$(SRCARCH)/include/generated/uapi/asm
+ # Create output directory if not already present
+ _dummy := $(shell [ -d '$(out)' ] || mkdir -p '$(out)') \
diff --git a/queue-4.14/x86-cpufeatures-re-tabulate-the-x86_feature-definitions.patch b/queue-4.14/x86-cpufeatures-re-tabulate-the-x86_feature-definitions.patch
deleted file mode 100644 (file)
index e6da543..0000000
+++ /dev/null
@@ -1,618 +0,0 @@
-From acbc845ffefd9fb70466182cd8555a26189462b2 Mon Sep 17 00:00:00 2001
-From: Ingo Molnar <mingo@kernel.org>
-Date: Tue, 31 Oct 2017 13:17:22 +0100
-Subject: x86/cpufeatures: Re-tabulate the X86_FEATURE definitions
-
-From: Ingo Molnar <mingo@kernel.org>
-
-commit acbc845ffefd9fb70466182cd8555a26189462b2 upstream.
-
-Over the years asm/cpufeatures.h has become somewhat of a mess: the original
-tabulation style was too narrow, while x86 feature names also kept growing
-in length, creating frequent field width overflows.
-
-Re-tabulate it to make it wider and easier to read/modify. Also harmonize
-the tabulation of the other defines in this file to match it.
-
-Cc: Andrew Morton <akpm@linux-foundation.org>
-Cc: Andy Lutomirski <luto@amacapital.net>
-Cc: Andy Lutomirski <luto@kernel.org>
-Cc: Borislav Petkov <bp@alien8.de>
-Cc: Brian Gerst <brgerst@gmail.com>
-Cc: Denys Vlasenko <dvlasenk@redhat.com>
-Cc: Josh Poimboeuf <jpoimboe@redhat.com>
-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/20171031121723.28524-3-mingo@kernel.org
-Signed-off-by: Ingo Molnar <mingo@kernel.org>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
----
- arch/x86/include/asm/cpufeatures.h |  512 ++++++++++++++++++-------------------
- 1 file changed, 256 insertions(+), 256 deletions(-)
-
---- a/arch/x86/include/asm/cpufeatures.h
-+++ b/arch/x86/include/asm/cpufeatures.h
-@@ -13,8 +13,8 @@
- /*
-  * Defines x86 CPU feature bits
-  */
--#define NCAPINTS      18      /* N 32-bit words worth of info */
--#define NBUGINTS      1       /* N 32-bit bug flags */
-+#define NCAPINTS                      18         /* N 32-bit words worth of info */
-+#define NBUGINTS                      1          /* N 32-bit bug flags */
- /*
-  * Note: If the comment begins with a quoted string, that string is used
-@@ -28,163 +28,163 @@
-  */
- /* Intel-defined CPU features, CPUID level 0x00000001 (edx), word 0 */
--#define X86_FEATURE_FPU               ( 0*32+ 0) /* Onboard FPU */
--#define X86_FEATURE_VME               ( 0*32+ 1) /* Virtual Mode Extensions */
--#define X86_FEATURE_DE                ( 0*32+ 2) /* Debugging Extensions */
--#define X86_FEATURE_PSE               ( 0*32+ 3) /* Page Size Extensions */
--#define X86_FEATURE_TSC               ( 0*32+ 4) /* Time Stamp Counter */
--#define X86_FEATURE_MSR               ( 0*32+ 5) /* Model-Specific Registers */
--#define X86_FEATURE_PAE               ( 0*32+ 6) /* Physical Address Extensions */
--#define X86_FEATURE_MCE               ( 0*32+ 7) /* Machine Check Exception */
--#define X86_FEATURE_CX8               ( 0*32+ 8) /* CMPXCHG8 instruction */
--#define X86_FEATURE_APIC      ( 0*32+ 9) /* Onboard APIC */
--#define X86_FEATURE_SEP               ( 0*32+11) /* SYSENTER/SYSEXIT */
--#define X86_FEATURE_MTRR      ( 0*32+12) /* Memory Type Range Registers */
--#define X86_FEATURE_PGE               ( 0*32+13) /* Page Global Enable */
--#define X86_FEATURE_MCA               ( 0*32+14) /* Machine Check Architecture */
--#define X86_FEATURE_CMOV      ( 0*32+15) /* CMOV instructions */
-+#define X86_FEATURE_FPU                       ( 0*32+ 0) /* Onboard FPU */
-+#define X86_FEATURE_VME                       ( 0*32+ 1) /* Virtual Mode Extensions */
-+#define X86_FEATURE_DE                        ( 0*32+ 2) /* Debugging Extensions */
-+#define X86_FEATURE_PSE                       ( 0*32+ 3) /* Page Size Extensions */
-+#define X86_FEATURE_TSC                       ( 0*32+ 4) /* Time Stamp Counter */
-+#define X86_FEATURE_MSR                       ( 0*32+ 5) /* Model-Specific Registers */
-+#define X86_FEATURE_PAE                       ( 0*32+ 6) /* Physical Address Extensions */
-+#define X86_FEATURE_MCE                       ( 0*32+ 7) /* Machine Check Exception */
-+#define X86_FEATURE_CX8                       ( 0*32+ 8) /* CMPXCHG8 instruction */
-+#define X86_FEATURE_APIC              ( 0*32+ 9) /* Onboard APIC */
-+#define X86_FEATURE_SEP                       ( 0*32+11) /* SYSENTER/SYSEXIT */
-+#define X86_FEATURE_MTRR              ( 0*32+12) /* Memory Type Range Registers */
-+#define X86_FEATURE_PGE                       ( 0*32+13) /* Page Global Enable */
-+#define X86_FEATURE_MCA                       ( 0*32+14) /* Machine Check Architecture */
-+#define X86_FEATURE_CMOV              ( 0*32+15) /* CMOV instructions */
-                                         /* (plus FCMOVcc, FCOMI with FPU) */
--#define X86_FEATURE_PAT               ( 0*32+16) /* Page Attribute Table */
--#define X86_FEATURE_PSE36     ( 0*32+17) /* 36-bit PSEs */
--#define X86_FEATURE_PN                ( 0*32+18) /* Processor serial number */
--#define X86_FEATURE_CLFLUSH   ( 0*32+19) /* CLFLUSH instruction */
--#define X86_FEATURE_DS                ( 0*32+21) /* "dts" Debug Store */
--#define X86_FEATURE_ACPI      ( 0*32+22) /* ACPI via MSR */
--#define X86_FEATURE_MMX               ( 0*32+23) /* Multimedia Extensions */
--#define X86_FEATURE_FXSR      ( 0*32+24) /* FXSAVE/FXRSTOR, CR4.OSFXSR */
--#define X86_FEATURE_XMM               ( 0*32+25) /* "sse" */
--#define X86_FEATURE_XMM2      ( 0*32+26) /* "sse2" */
--#define X86_FEATURE_SELFSNOOP ( 0*32+27) /* "ss" CPU self snoop */
--#define X86_FEATURE_HT                ( 0*32+28) /* Hyper-Threading */
--#define X86_FEATURE_ACC               ( 0*32+29) /* "tm" Automatic clock control */
--#define X86_FEATURE_IA64      ( 0*32+30) /* IA-64 processor */
--#define X86_FEATURE_PBE               ( 0*32+31) /* Pending Break Enable */
-+#define X86_FEATURE_PAT                       ( 0*32+16) /* Page Attribute Table */
-+#define X86_FEATURE_PSE36             ( 0*32+17) /* 36-bit PSEs */
-+#define X86_FEATURE_PN                        ( 0*32+18) /* Processor serial number */
-+#define X86_FEATURE_CLFLUSH           ( 0*32+19) /* CLFLUSH instruction */
-+#define X86_FEATURE_DS                        ( 0*32+21) /* "dts" Debug Store */
-+#define X86_FEATURE_ACPI              ( 0*32+22) /* ACPI via MSR */
-+#define X86_FEATURE_MMX                       ( 0*32+23) /* Multimedia Extensions */
-+#define X86_FEATURE_FXSR              ( 0*32+24) /* FXSAVE/FXRSTOR, CR4.OSFXSR */
-+#define X86_FEATURE_XMM                       ( 0*32+25) /* "sse" */
-+#define X86_FEATURE_XMM2              ( 0*32+26) /* "sse2" */
-+#define X86_FEATURE_SELFSNOOP         ( 0*32+27) /* "ss" CPU self snoop */
-+#define X86_FEATURE_HT                        ( 0*32+28) /* Hyper-Threading */
-+#define X86_FEATURE_ACC                       ( 0*32+29) /* "tm" Automatic clock control */
-+#define X86_FEATURE_IA64              ( 0*32+30) /* IA-64 processor */
-+#define X86_FEATURE_PBE                       ( 0*32+31) /* Pending Break Enable */
- /* AMD-defined CPU features, CPUID level 0x80000001, word 1 */
- /* Don't duplicate feature flags which are redundant with Intel! */
--#define X86_FEATURE_SYSCALL   ( 1*32+11) /* SYSCALL/SYSRET */
--#define X86_FEATURE_MP                ( 1*32+19) /* MP Capable. */
--#define X86_FEATURE_NX                ( 1*32+20) /* Execute Disable */
--#define X86_FEATURE_MMXEXT    ( 1*32+22) /* AMD MMX extensions */
--#define X86_FEATURE_FXSR_OPT  ( 1*32+25) /* FXSAVE/FXRSTOR optimizations */
--#define X86_FEATURE_GBPAGES   ( 1*32+26) /* "pdpe1gb" GB pages */
--#define X86_FEATURE_RDTSCP    ( 1*32+27) /* RDTSCP */
--#define X86_FEATURE_LM                ( 1*32+29) /* Long Mode (x86-64) */
--#define X86_FEATURE_3DNOWEXT  ( 1*32+30) /* AMD 3DNow! extensions */
--#define X86_FEATURE_3DNOW     ( 1*32+31) /* 3DNow! */
-+#define X86_FEATURE_SYSCALL           ( 1*32+11) /* SYSCALL/SYSRET */
-+#define X86_FEATURE_MP                        ( 1*32+19) /* MP Capable. */
-+#define X86_FEATURE_NX                        ( 1*32+20) /* Execute Disable */
-+#define X86_FEATURE_MMXEXT            ( 1*32+22) /* AMD MMX extensions */
-+#define X86_FEATURE_FXSR_OPT          ( 1*32+25) /* FXSAVE/FXRSTOR optimizations */
-+#define X86_FEATURE_GBPAGES           ( 1*32+26) /* "pdpe1gb" GB pages */
-+#define X86_FEATURE_RDTSCP            ( 1*32+27) /* RDTSCP */
-+#define X86_FEATURE_LM                        ( 1*32+29) /* Long Mode (x86-64) */
-+#define X86_FEATURE_3DNOWEXT          ( 1*32+30) /* AMD 3DNow! extensions */
-+#define X86_FEATURE_3DNOW             ( 1*32+31) /* 3DNow! */
- /* Transmeta-defined CPU features, CPUID level 0x80860001, word 2 */
--#define X86_FEATURE_RECOVERY  ( 2*32+ 0) /* CPU in recovery mode */
--#define X86_FEATURE_LONGRUN   ( 2*32+ 1) /* Longrun power control */
--#define X86_FEATURE_LRTI      ( 2*32+ 3) /* LongRun table interface */
-+#define X86_FEATURE_RECOVERY          ( 2*32+ 0) /* CPU in recovery mode */
-+#define X86_FEATURE_LONGRUN           ( 2*32+ 1) /* Longrun power control */
-+#define X86_FEATURE_LRTI              ( 2*32+ 3) /* LongRun table interface */
- /* Other features, Linux-defined mapping, word 3 */
- /* This range is used for feature bits which conflict or are synthesized */
--#define X86_FEATURE_CXMMX     ( 3*32+ 0) /* Cyrix MMX extensions */
--#define X86_FEATURE_K6_MTRR   ( 3*32+ 1) /* AMD K6 nonstandard MTRRs */
--#define X86_FEATURE_CYRIX_ARR ( 3*32+ 2) /* Cyrix ARRs (= MTRRs) */
--#define X86_FEATURE_CENTAUR_MCR       ( 3*32+ 3) /* Centaur MCRs (= MTRRs) */
-+#define X86_FEATURE_CXMMX             ( 3*32+ 0) /* Cyrix MMX extensions */
-+#define X86_FEATURE_K6_MTRR           ( 3*32+ 1) /* AMD K6 nonstandard MTRRs */
-+#define X86_FEATURE_CYRIX_ARR         ( 3*32+ 2) /* Cyrix ARRs (= MTRRs) */
-+#define X86_FEATURE_CENTAUR_MCR               ( 3*32+ 3) /* Centaur MCRs (= MTRRs) */
- /* cpu types for specific tunings: */
--#define X86_FEATURE_K8                ( 3*32+ 4) /* "" Opteron, Athlon64 */
--#define X86_FEATURE_K7                ( 3*32+ 5) /* "" Athlon */
--#define X86_FEATURE_P3                ( 3*32+ 6) /* "" P3 */
--#define X86_FEATURE_P4                ( 3*32+ 7) /* "" P4 */
--#define X86_FEATURE_CONSTANT_TSC ( 3*32+ 8) /* TSC ticks at a constant rate */
--#define X86_FEATURE_UP                ( 3*32+ 9) /* smp kernel running on up */
--#define X86_FEATURE_ART               ( 3*32+10) /* Platform has always running timer (ART) */
--#define X86_FEATURE_ARCH_PERFMON ( 3*32+11) /* Intel Architectural PerfMon */
--#define X86_FEATURE_PEBS      ( 3*32+12) /* Precise-Event Based Sampling */
--#define X86_FEATURE_BTS               ( 3*32+13) /* Branch Trace Store */
--#define X86_FEATURE_SYSCALL32 ( 3*32+14) /* "" syscall in ia32 userspace */
--#define X86_FEATURE_SYSENTER32        ( 3*32+15) /* "" sysenter in ia32 userspace */
--#define X86_FEATURE_REP_GOOD  ( 3*32+16) /* rep microcode works well */
--#define X86_FEATURE_MFENCE_RDTSC ( 3*32+17) /* "" Mfence synchronizes RDTSC */
--#define X86_FEATURE_LFENCE_RDTSC ( 3*32+18) /* "" Lfence synchronizes RDTSC */
--#define X86_FEATURE_ACC_POWER ( 3*32+19) /* AMD Accumulated Power Mechanism */
--#define X86_FEATURE_NOPL      ( 3*32+20) /* The NOPL (0F 1F) instructions */
--#define X86_FEATURE_ALWAYS    ( 3*32+21) /* "" Always-present feature */
--#define X86_FEATURE_XTOPOLOGY ( 3*32+22) /* cpu topology enum extensions */
--#define X86_FEATURE_TSC_RELIABLE ( 3*32+23) /* TSC is known to be reliable */
--#define X86_FEATURE_NONSTOP_TSC       ( 3*32+24) /* TSC does not stop in C states */
--#define X86_FEATURE_CPUID     ( 3*32+25) /* CPU has CPUID instruction itself */
--#define X86_FEATURE_EXTD_APICID       ( 3*32+26) /* has extended APICID (8 bits) */
--#define X86_FEATURE_AMD_DCM     ( 3*32+27) /* multi-node processor */
--#define X86_FEATURE_APERFMPERF        ( 3*32+28) /* APERFMPERF */
--#define X86_FEATURE_NONSTOP_TSC_S3 ( 3*32+30) /* TSC doesn't stop in S3 state */
--#define X86_FEATURE_TSC_KNOWN_FREQ ( 3*32+31) /* TSC has known frequency */
-+#define X86_FEATURE_K8                        ( 3*32+ 4) /* "" Opteron, Athlon64 */
-+#define X86_FEATURE_K7                        ( 3*32+ 5) /* "" Athlon */
-+#define X86_FEATURE_P3                        ( 3*32+ 6) /* "" P3 */
-+#define X86_FEATURE_P4                        ( 3*32+ 7) /* "" P4 */
-+#define X86_FEATURE_CONSTANT_TSC      ( 3*32+ 8) /* TSC ticks at a constant rate */
-+#define X86_FEATURE_UP                        ( 3*32+ 9) /* smp kernel running on up */
-+#define X86_FEATURE_ART                       ( 3*32+10) /* Platform has always running timer (ART) */
-+#define X86_FEATURE_ARCH_PERFMON      ( 3*32+11) /* Intel Architectural PerfMon */
-+#define X86_FEATURE_PEBS              ( 3*32+12) /* Precise-Event Based Sampling */
-+#define X86_FEATURE_BTS                       ( 3*32+13) /* Branch Trace Store */
-+#define X86_FEATURE_SYSCALL32         ( 3*32+14) /* "" syscall in ia32 userspace */
-+#define X86_FEATURE_SYSENTER32                ( 3*32+15) /* "" sysenter in ia32 userspace */
-+#define X86_FEATURE_REP_GOOD          ( 3*32+16) /* rep microcode works well */
-+#define X86_FEATURE_MFENCE_RDTSC      ( 3*32+17) /* "" Mfence synchronizes RDTSC */
-+#define X86_FEATURE_LFENCE_RDTSC      ( 3*32+18) /* "" Lfence synchronizes RDTSC */
-+#define X86_FEATURE_ACC_POWER         ( 3*32+19) /* AMD Accumulated Power Mechanism */
-+#define X86_FEATURE_NOPL              ( 3*32+20) /* The NOPL (0F 1F) instructions */
-+#define X86_FEATURE_ALWAYS            ( 3*32+21) /* "" Always-present feature */
-+#define X86_FEATURE_XTOPOLOGY         ( 3*32+22) /* cpu topology enum extensions */
-+#define X86_FEATURE_TSC_RELIABLE      ( 3*32+23) /* TSC is known to be reliable */
-+#define X86_FEATURE_NONSTOP_TSC               ( 3*32+24) /* TSC does not stop in C states */
-+#define X86_FEATURE_CPUID             ( 3*32+25) /* CPU has CPUID instruction itself */
-+#define X86_FEATURE_EXTD_APICID               ( 3*32+26) /* has extended APICID (8 bits) */
-+#define X86_FEATURE_AMD_DCM           ( 3*32+27) /* multi-node processor */
-+#define X86_FEATURE_APERFMPERF                ( 3*32+28) /* APERFMPERF */
-+#define X86_FEATURE_NONSTOP_TSC_S3    ( 3*32+30) /* TSC doesn't stop in S3 state */
-+#define X86_FEATURE_TSC_KNOWN_FREQ    ( 3*32+31) /* TSC has known frequency */
- /* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */
--#define X86_FEATURE_XMM3      ( 4*32+ 0) /* "pni" SSE-3 */
--#define X86_FEATURE_PCLMULQDQ ( 4*32+ 1) /* PCLMULQDQ instruction */
--#define X86_FEATURE_DTES64    ( 4*32+ 2) /* 64-bit Debug Store */
--#define X86_FEATURE_MWAIT     ( 4*32+ 3) /* "monitor" Monitor/Mwait support */
--#define X86_FEATURE_DSCPL     ( 4*32+ 4) /* "ds_cpl" CPL Qual. Debug Store */
--#define X86_FEATURE_VMX               ( 4*32+ 5) /* Hardware virtualization */
--#define X86_FEATURE_SMX               ( 4*32+ 6) /* Safer mode */
--#define X86_FEATURE_EST               ( 4*32+ 7) /* Enhanced SpeedStep */
--#define X86_FEATURE_TM2               ( 4*32+ 8) /* Thermal Monitor 2 */
--#define X86_FEATURE_SSSE3     ( 4*32+ 9) /* Supplemental SSE-3 */
--#define X86_FEATURE_CID               ( 4*32+10) /* Context ID */
--#define X86_FEATURE_SDBG      ( 4*32+11) /* Silicon Debug */
--#define X86_FEATURE_FMA               ( 4*32+12) /* Fused multiply-add */
--#define X86_FEATURE_CX16      ( 4*32+13) /* CMPXCHG16B */
--#define X86_FEATURE_XTPR      ( 4*32+14) /* Send Task Priority Messages */
--#define X86_FEATURE_PDCM      ( 4*32+15) /* Performance Capabilities */
--#define X86_FEATURE_PCID      ( 4*32+17) /* Process Context Identifiers */
--#define X86_FEATURE_DCA               ( 4*32+18) /* Direct Cache Access */
--#define X86_FEATURE_XMM4_1    ( 4*32+19) /* "sse4_1" SSE-4.1 */
--#define X86_FEATURE_XMM4_2    ( 4*32+20) /* "sse4_2" SSE-4.2 */
--#define X86_FEATURE_X2APIC    ( 4*32+21) /* x2APIC */
--#define X86_FEATURE_MOVBE     ( 4*32+22) /* MOVBE instruction */
--#define X86_FEATURE_POPCNT      ( 4*32+23) /* POPCNT instruction */
-+#define X86_FEATURE_XMM3              ( 4*32+ 0) /* "pni" SSE-3 */
-+#define X86_FEATURE_PCLMULQDQ         ( 4*32+ 1) /* PCLMULQDQ instruction */
-+#define X86_FEATURE_DTES64            ( 4*32+ 2) /* 64-bit Debug Store */
-+#define X86_FEATURE_MWAIT             ( 4*32+ 3) /* "monitor" Monitor/Mwait support */
-+#define X86_FEATURE_DSCPL             ( 4*32+ 4) /* "ds_cpl" CPL Qual. Debug Store */
-+#define X86_FEATURE_VMX                       ( 4*32+ 5) /* Hardware virtualization */
-+#define X86_FEATURE_SMX                       ( 4*32+ 6) /* Safer mode */
-+#define X86_FEATURE_EST                       ( 4*32+ 7) /* Enhanced SpeedStep */
-+#define X86_FEATURE_TM2                       ( 4*32+ 8) /* Thermal Monitor 2 */
-+#define X86_FEATURE_SSSE3             ( 4*32+ 9) /* Supplemental SSE-3 */
-+#define X86_FEATURE_CID                       ( 4*32+10) /* Context ID */
-+#define X86_FEATURE_SDBG              ( 4*32+11) /* Silicon Debug */
-+#define X86_FEATURE_FMA                       ( 4*32+12) /* Fused multiply-add */
-+#define X86_FEATURE_CX16              ( 4*32+13) /* CMPXCHG16B */
-+#define X86_FEATURE_XTPR              ( 4*32+14) /* Send Task Priority Messages */
-+#define X86_FEATURE_PDCM              ( 4*32+15) /* Performance Capabilities */
-+#define X86_FEATURE_PCID              ( 4*32+17) /* Process Context Identifiers */
-+#define X86_FEATURE_DCA                       ( 4*32+18) /* Direct Cache Access */
-+#define X86_FEATURE_XMM4_1            ( 4*32+19) /* "sse4_1" SSE-4.1 */
-+#define X86_FEATURE_XMM4_2            ( 4*32+20) /* "sse4_2" SSE-4.2 */
-+#define X86_FEATURE_X2APIC            ( 4*32+21) /* x2APIC */
-+#define X86_FEATURE_MOVBE             ( 4*32+22) /* MOVBE instruction */
-+#define X86_FEATURE_POPCNT            ( 4*32+23) /* POPCNT instruction */
- #define X86_FEATURE_TSC_DEADLINE_TIMER        ( 4*32+24) /* Tsc deadline timer */
--#define X86_FEATURE_AES               ( 4*32+25) /* AES instructions */
--#define X86_FEATURE_XSAVE     ( 4*32+26) /* XSAVE/XRSTOR/XSETBV/XGETBV */
--#define X86_FEATURE_OSXSAVE   ( 4*32+27) /* "" XSAVE enabled in the OS */
--#define X86_FEATURE_AVX               ( 4*32+28) /* Advanced Vector Extensions */
--#define X86_FEATURE_F16C      ( 4*32+29) /* 16-bit fp conversions */
--#define X86_FEATURE_RDRAND    ( 4*32+30) /* The RDRAND instruction */
--#define X86_FEATURE_HYPERVISOR        ( 4*32+31) /* Running on a hypervisor */
-+#define X86_FEATURE_AES                       ( 4*32+25) /* AES instructions */
-+#define X86_FEATURE_XSAVE             ( 4*32+26) /* XSAVE/XRSTOR/XSETBV/XGETBV */
-+#define X86_FEATURE_OSXSAVE           ( 4*32+27) /* "" XSAVE enabled in the OS */
-+#define X86_FEATURE_AVX                       ( 4*32+28) /* Advanced Vector Extensions */
-+#define X86_FEATURE_F16C              ( 4*32+29) /* 16-bit fp conversions */
-+#define X86_FEATURE_RDRAND            ( 4*32+30) /* The RDRAND instruction */
-+#define X86_FEATURE_HYPERVISOR                ( 4*32+31) /* Running on a hypervisor */
- /* VIA/Cyrix/Centaur-defined CPU features, CPUID level 0xC0000001, word 5 */
--#define X86_FEATURE_XSTORE    ( 5*32+ 2) /* "rng" RNG present (xstore) */
--#define X86_FEATURE_XSTORE_EN ( 5*32+ 3) /* "rng_en" RNG enabled */
--#define X86_FEATURE_XCRYPT    ( 5*32+ 6) /* "ace" on-CPU crypto (xcrypt) */
--#define X86_FEATURE_XCRYPT_EN ( 5*32+ 7) /* "ace_en" on-CPU crypto enabled */
--#define X86_FEATURE_ACE2      ( 5*32+ 8) /* Advanced Cryptography Engine v2 */
--#define X86_FEATURE_ACE2_EN   ( 5*32+ 9) /* ACE v2 enabled */
--#define X86_FEATURE_PHE               ( 5*32+10) /* PadLock Hash Engine */
--#define X86_FEATURE_PHE_EN    ( 5*32+11) /* PHE enabled */
--#define X86_FEATURE_PMM               ( 5*32+12) /* PadLock Montgomery Multiplier */
--#define X86_FEATURE_PMM_EN    ( 5*32+13) /* PMM enabled */
-+#define X86_FEATURE_XSTORE            ( 5*32+ 2) /* "rng" RNG present (xstore) */
-+#define X86_FEATURE_XSTORE_EN         ( 5*32+ 3) /* "rng_en" RNG enabled */
-+#define X86_FEATURE_XCRYPT            ( 5*32+ 6) /* "ace" on-CPU crypto (xcrypt) */
-+#define X86_FEATURE_XCRYPT_EN         ( 5*32+ 7) /* "ace_en" on-CPU crypto enabled */
-+#define X86_FEATURE_ACE2              ( 5*32+ 8) /* Advanced Cryptography Engine v2 */
-+#define X86_FEATURE_ACE2_EN           ( 5*32+ 9) /* ACE v2 enabled */
-+#define X86_FEATURE_PHE                       ( 5*32+10) /* PadLock Hash Engine */
-+#define X86_FEATURE_PHE_EN            ( 5*32+11) /* PHE enabled */
-+#define X86_FEATURE_PMM                       ( 5*32+12) /* PadLock Montgomery Multiplier */
-+#define X86_FEATURE_PMM_EN            ( 5*32+13) /* PMM enabled */
- /* More extended AMD flags: CPUID level 0x80000001, ecx, word 6 */
--#define X86_FEATURE_LAHF_LM   ( 6*32+ 0) /* LAHF/SAHF in long mode */
--#define X86_FEATURE_CMP_LEGACY        ( 6*32+ 1) /* If yes HyperThreading not valid */
--#define X86_FEATURE_SVM               ( 6*32+ 2) /* Secure virtual machine */
--#define X86_FEATURE_EXTAPIC   ( 6*32+ 3) /* Extended APIC space */
--#define X86_FEATURE_CR8_LEGACY        ( 6*32+ 4) /* CR8 in 32-bit mode */
--#define X86_FEATURE_ABM               ( 6*32+ 5) /* Advanced bit manipulation */
--#define X86_FEATURE_SSE4A     ( 6*32+ 6) /* SSE-4A */
--#define X86_FEATURE_MISALIGNSSE ( 6*32+ 7) /* Misaligned SSE mode */
--#define X86_FEATURE_3DNOWPREFETCH ( 6*32+ 8) /* 3DNow prefetch instructions */
--#define X86_FEATURE_OSVW      ( 6*32+ 9) /* OS Visible Workaround */
--#define X86_FEATURE_IBS               ( 6*32+10) /* Instruction Based Sampling */
--#define X86_FEATURE_XOP               ( 6*32+11) /* extended AVX instructions */
--#define X86_FEATURE_SKINIT    ( 6*32+12) /* SKINIT/STGI instructions */
--#define X86_FEATURE_WDT               ( 6*32+13) /* Watchdog timer */
--#define X86_FEATURE_LWP               ( 6*32+15) /* Light Weight Profiling */
--#define X86_FEATURE_FMA4      ( 6*32+16) /* 4 operands MAC instructions */
--#define X86_FEATURE_TCE               ( 6*32+17) /* translation cache extension */
--#define X86_FEATURE_NODEID_MSR        ( 6*32+19) /* NodeId MSR */
--#define X86_FEATURE_TBM               ( 6*32+21) /* trailing bit manipulations */
--#define X86_FEATURE_TOPOEXT   ( 6*32+22) /* topology extensions CPUID leafs */
--#define X86_FEATURE_PERFCTR_CORE ( 6*32+23) /* core performance counter extensions */
--#define X86_FEATURE_PERFCTR_NB  ( 6*32+24) /* NB performance counter extensions */
--#define X86_FEATURE_BPEXT     (6*32+26) /* data breakpoint extension */
--#define X86_FEATURE_PTSC      ( 6*32+27) /* performance time-stamp counter */
--#define X86_FEATURE_PERFCTR_LLC       ( 6*32+28) /* Last Level Cache performance counter extensions */
--#define X86_FEATURE_MWAITX    ( 6*32+29) /* MWAIT extension (MONITORX/MWAITX) */
-+#define X86_FEATURE_LAHF_LM           ( 6*32+ 0) /* LAHF/SAHF in long mode */
-+#define X86_FEATURE_CMP_LEGACY                ( 6*32+ 1) /* If yes HyperThreading not valid */
-+#define X86_FEATURE_SVM                       ( 6*32+ 2) /* Secure virtual machine */
-+#define X86_FEATURE_EXTAPIC           ( 6*32+ 3) /* Extended APIC space */
-+#define X86_FEATURE_CR8_LEGACY                ( 6*32+ 4) /* CR8 in 32-bit mode */
-+#define X86_FEATURE_ABM                       ( 6*32+ 5) /* Advanced bit manipulation */
-+#define X86_FEATURE_SSE4A             ( 6*32+ 6) /* SSE-4A */
-+#define X86_FEATURE_MISALIGNSSE               ( 6*32+ 7) /* Misaligned SSE mode */
-+#define X86_FEATURE_3DNOWPREFETCH     ( 6*32+ 8) /* 3DNow prefetch instructions */
-+#define X86_FEATURE_OSVW              ( 6*32+ 9) /* OS Visible Workaround */
-+#define X86_FEATURE_IBS                       ( 6*32+10) /* Instruction Based Sampling */
-+#define X86_FEATURE_XOP                       ( 6*32+11) /* extended AVX instructions */
-+#define X86_FEATURE_SKINIT            ( 6*32+12) /* SKINIT/STGI instructions */
-+#define X86_FEATURE_WDT                       ( 6*32+13) /* Watchdog timer */
-+#define X86_FEATURE_LWP                       ( 6*32+15) /* Light Weight Profiling */
-+#define X86_FEATURE_FMA4              ( 6*32+16) /* 4 operands MAC instructions */
-+#define X86_FEATURE_TCE                       ( 6*32+17) /* translation cache extension */
-+#define X86_FEATURE_NODEID_MSR                ( 6*32+19) /* NodeId MSR */
-+#define X86_FEATURE_TBM                       ( 6*32+21) /* trailing bit manipulations */
-+#define X86_FEATURE_TOPOEXT           ( 6*32+22) /* topology extensions CPUID leafs */
-+#define X86_FEATURE_PERFCTR_CORE      ( 6*32+23) /* core performance counter extensions */
-+#define X86_FEATURE_PERFCTR_NB                ( 6*32+24) /* NB performance counter extensions */
-+#define X86_FEATURE_BPEXT             (6*32+26) /* data breakpoint extension */
-+#define X86_FEATURE_PTSC              ( 6*32+27) /* performance time-stamp counter */
-+#define X86_FEATURE_PERFCTR_LLC               ( 6*32+28) /* Last Level Cache performance counter extensions */
-+#define X86_FEATURE_MWAITX            ( 6*32+29) /* MWAIT extension (MONITORX/MWAITX) */
- /*
-  * Auxiliary flags: Linux defined - For features scattered in various
-@@ -192,152 +192,152 @@
-  *
-  * Reuse free bits when adding new feature flags!
-  */
--#define X86_FEATURE_RING3MWAIT        ( 7*32+ 0) /* Ring 3 MONITOR/MWAIT */
--#define X86_FEATURE_CPUID_FAULT ( 7*32+ 1) /* Intel CPUID faulting */
--#define X86_FEATURE_CPB               ( 7*32+ 2) /* AMD Core Performance Boost */
--#define X86_FEATURE_EPB               ( 7*32+ 3) /* IA32_ENERGY_PERF_BIAS support */
--#define X86_FEATURE_CAT_L3    ( 7*32+ 4) /* Cache Allocation Technology L3 */
--#define X86_FEATURE_CAT_L2    ( 7*32+ 5) /* Cache Allocation Technology L2 */
--#define X86_FEATURE_CDP_L3    ( 7*32+ 6) /* Code and Data Prioritization L3 */
--
--#define X86_FEATURE_HW_PSTATE ( 7*32+ 8) /* AMD HW-PState */
--#define X86_FEATURE_PROC_FEEDBACK ( 7*32+ 9) /* AMD ProcFeedbackInterface */
--#define X86_FEATURE_SME               ( 7*32+10) /* AMD Secure Memory Encryption */
--
--#define X86_FEATURE_INTEL_PPIN        ( 7*32+14) /* Intel Processor Inventory Number */
--#define X86_FEATURE_INTEL_PT  ( 7*32+15) /* Intel Processor Trace */
--#define X86_FEATURE_AVX512_4VNNIW (7*32+16) /* AVX-512 Neural Network Instructions */
--#define X86_FEATURE_AVX512_4FMAPS (7*32+17) /* AVX-512 Multiply Accumulation Single precision */
-+#define X86_FEATURE_RING3MWAIT                ( 7*32+ 0) /* Ring 3 MONITOR/MWAIT */
-+#define X86_FEATURE_CPUID_FAULT               ( 7*32+ 1) /* Intel CPUID faulting */
-+#define X86_FEATURE_CPB                       ( 7*32+ 2) /* AMD Core Performance Boost */
-+#define X86_FEATURE_EPB                       ( 7*32+ 3) /* IA32_ENERGY_PERF_BIAS support */
-+#define X86_FEATURE_CAT_L3            ( 7*32+ 4) /* Cache Allocation Technology L3 */
-+#define X86_FEATURE_CAT_L2            ( 7*32+ 5) /* Cache Allocation Technology L2 */
-+#define X86_FEATURE_CDP_L3            ( 7*32+ 6) /* Code and Data Prioritization L3 */
-+
-+#define X86_FEATURE_HW_PSTATE         ( 7*32+ 8) /* AMD HW-PState */
-+#define X86_FEATURE_PROC_FEEDBACK     ( 7*32+ 9) /* AMD ProcFeedbackInterface */
-+#define X86_FEATURE_SME                       ( 7*32+10) /* AMD Secure Memory Encryption */
-+
-+#define X86_FEATURE_INTEL_PPIN                ( 7*32+14) /* Intel Processor Inventory Number */
-+#define X86_FEATURE_INTEL_PT          ( 7*32+15) /* Intel Processor Trace */
-+#define X86_FEATURE_AVX512_4VNNIW     (7*32+16) /* AVX-512 Neural Network Instructions */
-+#define X86_FEATURE_AVX512_4FMAPS     (7*32+17) /* AVX-512 Multiply Accumulation Single precision */
--#define X86_FEATURE_MBA         ( 7*32+18) /* Memory Bandwidth Allocation */
-+#define X86_FEATURE_MBA                       ( 7*32+18) /* Memory Bandwidth Allocation */
- /* Virtualization flags: Linux defined, word 8 */
--#define X86_FEATURE_TPR_SHADOW  ( 8*32+ 0) /* Intel TPR Shadow */
--#define X86_FEATURE_VNMI        ( 8*32+ 1) /* Intel Virtual NMI */
--#define X86_FEATURE_FLEXPRIORITY ( 8*32+ 2) /* Intel FlexPriority */
--#define X86_FEATURE_EPT         ( 8*32+ 3) /* Intel Extended Page Table */
--#define X86_FEATURE_VPID        ( 8*32+ 4) /* Intel Virtual Processor ID */
-+#define X86_FEATURE_TPR_SHADOW                ( 8*32+ 0) /* Intel TPR Shadow */
-+#define X86_FEATURE_VNMI              ( 8*32+ 1) /* Intel Virtual NMI */
-+#define X86_FEATURE_FLEXPRIORITY      ( 8*32+ 2) /* Intel FlexPriority */
-+#define X86_FEATURE_EPT                       ( 8*32+ 3) /* Intel Extended Page Table */
-+#define X86_FEATURE_VPID              ( 8*32+ 4) /* Intel Virtual Processor ID */
--#define X86_FEATURE_VMMCALL     ( 8*32+15) /* Prefer vmmcall to vmcall */
--#define X86_FEATURE_XENPV       ( 8*32+16) /* "" Xen paravirtual guest */
-+#define X86_FEATURE_VMMCALL           ( 8*32+15) /* Prefer vmmcall to vmcall */
-+#define X86_FEATURE_XENPV             ( 8*32+16) /* "" Xen paravirtual guest */
- /* Intel-defined CPU features, CPUID level 0x00000007:0 (ebx), word 9 */
--#define X86_FEATURE_FSGSBASE  ( 9*32+ 0) /* {RD/WR}{FS/GS}BASE instructions*/
--#define X86_FEATURE_TSC_ADJUST        ( 9*32+ 1) /* TSC adjustment MSR 0x3b */
--#define X86_FEATURE_BMI1      ( 9*32+ 3) /* 1st group bit manipulation extensions */
--#define X86_FEATURE_HLE               ( 9*32+ 4) /* Hardware Lock Elision */
--#define X86_FEATURE_AVX2      ( 9*32+ 5) /* AVX2 instructions */
--#define X86_FEATURE_SMEP      ( 9*32+ 7) /* Supervisor Mode Execution Protection */
--#define X86_FEATURE_BMI2      ( 9*32+ 8) /* 2nd group bit manipulation extensions */
--#define X86_FEATURE_ERMS      ( 9*32+ 9) /* Enhanced REP MOVSB/STOSB */
--#define X86_FEATURE_INVPCID   ( 9*32+10) /* Invalidate Processor Context ID */
--#define X86_FEATURE_RTM               ( 9*32+11) /* Restricted Transactional Memory */
--#define X86_FEATURE_CQM               ( 9*32+12) /* Cache QoS Monitoring */
--#define X86_FEATURE_MPX               ( 9*32+14) /* Memory Protection Extension */
--#define X86_FEATURE_RDT_A     ( 9*32+15) /* Resource Director Technology Allocation */
--#define X86_FEATURE_AVX512F   ( 9*32+16) /* AVX-512 Foundation */
--#define X86_FEATURE_AVX512DQ  ( 9*32+17) /* AVX-512 DQ (Double/Quad granular) Instructions */
--#define X86_FEATURE_RDSEED    ( 9*32+18) /* The RDSEED instruction */
--#define X86_FEATURE_ADX               ( 9*32+19) /* The ADCX and ADOX instructions */
--#define X86_FEATURE_SMAP      ( 9*32+20) /* Supervisor Mode Access Prevention */
--#define X86_FEATURE_AVX512IFMA  ( 9*32+21) /* AVX-512 Integer Fused Multiply-Add instructions */
--#define X86_FEATURE_CLFLUSHOPT        ( 9*32+23) /* CLFLUSHOPT instruction */
--#define X86_FEATURE_CLWB      ( 9*32+24) /* CLWB instruction */
--#define X86_FEATURE_AVX512PF  ( 9*32+26) /* AVX-512 Prefetch */
--#define X86_FEATURE_AVX512ER  ( 9*32+27) /* AVX-512 Exponential and Reciprocal */
--#define X86_FEATURE_AVX512CD  ( 9*32+28) /* AVX-512 Conflict Detection */
--#define X86_FEATURE_SHA_NI    ( 9*32+29) /* SHA1/SHA256 Instruction Extensions */
--#define X86_FEATURE_AVX512BW  ( 9*32+30) /* AVX-512 BW (Byte/Word granular) Instructions */
--#define X86_FEATURE_AVX512VL  ( 9*32+31) /* AVX-512 VL (128/256 Vector Length) Extensions */
-+#define X86_FEATURE_FSGSBASE          ( 9*32+ 0) /* {RD/WR}{FS/GS}BASE instructions*/
-+#define X86_FEATURE_TSC_ADJUST                ( 9*32+ 1) /* TSC adjustment MSR 0x3b */
-+#define X86_FEATURE_BMI1              ( 9*32+ 3) /* 1st group bit manipulation extensions */
-+#define X86_FEATURE_HLE                       ( 9*32+ 4) /* Hardware Lock Elision */
-+#define X86_FEATURE_AVX2              ( 9*32+ 5) /* AVX2 instructions */
-+#define X86_FEATURE_SMEP              ( 9*32+ 7) /* Supervisor Mode Execution Protection */
-+#define X86_FEATURE_BMI2              ( 9*32+ 8) /* 2nd group bit manipulation extensions */
-+#define X86_FEATURE_ERMS              ( 9*32+ 9) /* Enhanced REP MOVSB/STOSB */
-+#define X86_FEATURE_INVPCID           ( 9*32+10) /* Invalidate Processor Context ID */
-+#define X86_FEATURE_RTM                       ( 9*32+11) /* Restricted Transactional Memory */
-+#define X86_FEATURE_CQM                       ( 9*32+12) /* Cache QoS Monitoring */
-+#define X86_FEATURE_MPX                       ( 9*32+14) /* Memory Protection Extension */
-+#define X86_FEATURE_RDT_A             ( 9*32+15) /* Resource Director Technology Allocation */
-+#define X86_FEATURE_AVX512F           ( 9*32+16) /* AVX-512 Foundation */
-+#define X86_FEATURE_AVX512DQ          ( 9*32+17) /* AVX-512 DQ (Double/Quad granular) Instructions */
-+#define X86_FEATURE_RDSEED            ( 9*32+18) /* The RDSEED instruction */
-+#define X86_FEATURE_ADX                       ( 9*32+19) /* The ADCX and ADOX instructions */
-+#define X86_FEATURE_SMAP              ( 9*32+20) /* Supervisor Mode Access Prevention */
-+#define X86_FEATURE_AVX512IFMA                ( 9*32+21) /* AVX-512 Integer Fused Multiply-Add instructions */
-+#define X86_FEATURE_CLFLUSHOPT                ( 9*32+23) /* CLFLUSHOPT instruction */
-+#define X86_FEATURE_CLWB              ( 9*32+24) /* CLWB instruction */
-+#define X86_FEATURE_AVX512PF          ( 9*32+26) /* AVX-512 Prefetch */
-+#define X86_FEATURE_AVX512ER          ( 9*32+27) /* AVX-512 Exponential and Reciprocal */
-+#define X86_FEATURE_AVX512CD          ( 9*32+28) /* AVX-512 Conflict Detection */
-+#define X86_FEATURE_SHA_NI            ( 9*32+29) /* SHA1/SHA256 Instruction Extensions */
-+#define X86_FEATURE_AVX512BW          ( 9*32+30) /* AVX-512 BW (Byte/Word granular) Instructions */
-+#define X86_FEATURE_AVX512VL          ( 9*32+31) /* AVX-512 VL (128/256 Vector Length) Extensions */
- /* Extended state features, CPUID level 0x0000000d:1 (eax), word 10 */
--#define X86_FEATURE_XSAVEOPT  (10*32+ 0) /* XSAVEOPT */
--#define X86_FEATURE_XSAVEC    (10*32+ 1) /* XSAVEC */
--#define X86_FEATURE_XGETBV1   (10*32+ 2) /* XGETBV with ECX = 1 */
--#define X86_FEATURE_XSAVES    (10*32+ 3) /* XSAVES/XRSTORS */
-+#define X86_FEATURE_XSAVEOPT          (10*32+ 0) /* XSAVEOPT */
-+#define X86_FEATURE_XSAVEC            (10*32+ 1) /* XSAVEC */
-+#define X86_FEATURE_XGETBV1           (10*32+ 2) /* XGETBV with ECX = 1 */
-+#define X86_FEATURE_XSAVES            (10*32+ 3) /* XSAVES/XRSTORS */
- /* Intel-defined CPU QoS Sub-leaf, CPUID level 0x0000000F:0 (edx), word 11 */
--#define X86_FEATURE_CQM_LLC   (11*32+ 1) /* LLC QoS if 1 */
-+#define X86_FEATURE_CQM_LLC           (11*32+ 1) /* LLC QoS if 1 */
- /* Intel-defined CPU QoS Sub-leaf, CPUID level 0x0000000F:1 (edx), word 12 */
--#define X86_FEATURE_CQM_OCCUP_LLC (12*32+ 0) /* LLC occupancy monitoring if 1 */
--#define X86_FEATURE_CQM_MBM_TOTAL (12*32+ 1) /* LLC Total MBM monitoring */
--#define X86_FEATURE_CQM_MBM_LOCAL (12*32+ 2) /* LLC Local MBM monitoring */
-+#define X86_FEATURE_CQM_OCCUP_LLC     (12*32+ 0) /* LLC occupancy monitoring if 1 */
-+#define X86_FEATURE_CQM_MBM_TOTAL     (12*32+ 1) /* LLC Total MBM monitoring */
-+#define X86_FEATURE_CQM_MBM_LOCAL     (12*32+ 2) /* LLC Local MBM monitoring */
- /* AMD-defined CPU features, CPUID level 0x80000008 (ebx), word 13 */
--#define X86_FEATURE_CLZERO    (13*32+0) /* CLZERO instruction */
--#define X86_FEATURE_IRPERF    (13*32+1) /* Instructions Retired Count */
-+#define X86_FEATURE_CLZERO            (13*32+0) /* CLZERO instruction */
-+#define X86_FEATURE_IRPERF            (13*32+1) /* Instructions Retired Count */
- /* Thermal and Power Management Leaf, CPUID level 0x00000006 (eax), word 14 */
--#define X86_FEATURE_DTHERM    (14*32+ 0) /* Digital Thermal Sensor */
--#define X86_FEATURE_IDA               (14*32+ 1) /* Intel Dynamic Acceleration */
--#define X86_FEATURE_ARAT      (14*32+ 2) /* Always Running APIC Timer */
--#define X86_FEATURE_PLN               (14*32+ 4) /* Intel Power Limit Notification */
--#define X86_FEATURE_PTS               (14*32+ 6) /* Intel Package Thermal Status */
--#define X86_FEATURE_HWP               (14*32+ 7) /* Intel Hardware P-states */
--#define X86_FEATURE_HWP_NOTIFY        (14*32+ 8) /* HWP Notification */
--#define X86_FEATURE_HWP_ACT_WINDOW (14*32+ 9) /* HWP Activity Window */
--#define X86_FEATURE_HWP_EPP   (14*32+10) /* HWP Energy Perf. Preference */
--#define X86_FEATURE_HWP_PKG_REQ (14*32+11) /* HWP Package Level Request */
-+#define X86_FEATURE_DTHERM            (14*32+ 0) /* Digital Thermal Sensor */
-+#define X86_FEATURE_IDA                       (14*32+ 1) /* Intel Dynamic Acceleration */
-+#define X86_FEATURE_ARAT              (14*32+ 2) /* Always Running APIC Timer */
-+#define X86_FEATURE_PLN                       (14*32+ 4) /* Intel Power Limit Notification */
-+#define X86_FEATURE_PTS                       (14*32+ 6) /* Intel Package Thermal Status */
-+#define X86_FEATURE_HWP                       (14*32+ 7) /* Intel Hardware P-states */
-+#define X86_FEATURE_HWP_NOTIFY                (14*32+ 8) /* HWP Notification */
-+#define X86_FEATURE_HWP_ACT_WINDOW    (14*32+ 9) /* HWP Activity Window */
-+#define X86_FEATURE_HWP_EPP           (14*32+10) /* HWP Energy Perf. Preference */
-+#define X86_FEATURE_HWP_PKG_REQ               (14*32+11) /* HWP Package Level Request */
- /* AMD SVM Feature Identification, CPUID level 0x8000000a (edx), word 15 */
--#define X86_FEATURE_NPT               (15*32+ 0) /* Nested Page Table support */
--#define X86_FEATURE_LBRV      (15*32+ 1) /* LBR Virtualization support */
--#define X86_FEATURE_SVML      (15*32+ 2) /* "svm_lock" SVM locking MSR */
--#define X86_FEATURE_NRIPS     (15*32+ 3) /* "nrip_save" SVM next_rip save */
--#define X86_FEATURE_TSCRATEMSR  (15*32+ 4) /* "tsc_scale" TSC scaling support */
--#define X86_FEATURE_VMCBCLEAN   (15*32+ 5) /* "vmcb_clean" VMCB clean bits support */
--#define X86_FEATURE_FLUSHBYASID (15*32+ 6) /* flush-by-ASID support */
--#define X86_FEATURE_DECODEASSISTS (15*32+ 7) /* Decode Assists support */
--#define X86_FEATURE_PAUSEFILTER (15*32+10) /* filtered pause intercept */
--#define X86_FEATURE_PFTHRESHOLD (15*32+12) /* pause filter threshold */
--#define X86_FEATURE_AVIC      (15*32+13) /* Virtual Interrupt Controller */
--#define X86_FEATURE_V_VMSAVE_VMLOAD (15*32+15) /* Virtual VMSAVE VMLOAD */
--#define X86_FEATURE_VGIF      (15*32+16) /* Virtual GIF */
-+#define X86_FEATURE_NPT                       (15*32+ 0) /* Nested Page Table support */
-+#define X86_FEATURE_LBRV              (15*32+ 1) /* LBR Virtualization support */
-+#define X86_FEATURE_SVML              (15*32+ 2) /* "svm_lock" SVM locking MSR */
-+#define X86_FEATURE_NRIPS             (15*32+ 3) /* "nrip_save" SVM next_rip save */
-+#define X86_FEATURE_TSCRATEMSR                (15*32+ 4) /* "tsc_scale" TSC scaling support */
-+#define X86_FEATURE_VMCBCLEAN         (15*32+ 5) /* "vmcb_clean" VMCB clean bits support */
-+#define X86_FEATURE_FLUSHBYASID               (15*32+ 6) /* flush-by-ASID support */
-+#define X86_FEATURE_DECODEASSISTS     (15*32+ 7) /* Decode Assists support */
-+#define X86_FEATURE_PAUSEFILTER               (15*32+10) /* filtered pause intercept */
-+#define X86_FEATURE_PFTHRESHOLD               (15*32+12) /* pause filter threshold */
-+#define X86_FEATURE_AVIC              (15*32+13) /* Virtual Interrupt Controller */
-+#define X86_FEATURE_V_VMSAVE_VMLOAD   (15*32+15) /* Virtual VMSAVE VMLOAD */
-+#define X86_FEATURE_VGIF              (15*32+16) /* Virtual GIF */
- /* Intel-defined CPU features, CPUID level 0x00000007:0 (ecx), word 16 */
--#define X86_FEATURE_AVX512VBMI  (16*32+ 1) /* AVX512 Vector Bit Manipulation instructions*/
--#define X86_FEATURE_PKU               (16*32+ 3) /* Protection Keys for Userspace */
--#define X86_FEATURE_OSPKE     (16*32+ 4) /* OS Protection Keys Enable */
--#define X86_FEATURE_AVX512_VBMI2 (16*32+ 6) /* Additional AVX512 Vector Bit Manipulation Instructions */
--#define X86_FEATURE_GFNI      (16*32+ 8) /* Galois Field New Instructions */
--#define X86_FEATURE_VAES      (16*32+ 9) /* Vector AES */
--#define X86_FEATURE_VPCLMULQDQ        (16*32+ 10) /* Carry-Less Multiplication Double Quadword */
--#define X86_FEATURE_AVX512_VNNI (16*32+ 11) /* Vector Neural Network Instructions */
--#define X86_FEATURE_AVX512_BITALG (16*32+12) /* Support for VPOPCNT[B,W] and VPSHUF-BITQMB */
--#define X86_FEATURE_AVX512_VPOPCNTDQ (16*32+14) /* POPCNT for vectors of DW/QW */
--#define X86_FEATURE_LA57      (16*32+16) /* 5-level page tables */
--#define X86_FEATURE_RDPID     (16*32+22) /* RDPID instruction */
-+#define X86_FEATURE_AVX512VBMI                (16*32+ 1) /* AVX512 Vector Bit Manipulation instructions*/
-+#define X86_FEATURE_PKU                       (16*32+ 3) /* Protection Keys for Userspace */
-+#define X86_FEATURE_OSPKE             (16*32+ 4) /* OS Protection Keys Enable */
-+#define X86_FEATURE_AVX512_VBMI2      (16*32+ 6) /* Additional AVX512 Vector Bit Manipulation Instructions */
-+#define X86_FEATURE_GFNI              (16*32+ 8) /* Galois Field New Instructions */
-+#define X86_FEATURE_VAES              (16*32+ 9) /* Vector AES */
-+#define X86_FEATURE_VPCLMULQDQ                (16*32+ 10) /* Carry-Less Multiplication Double Quadword */
-+#define X86_FEATURE_AVX512_VNNI               (16*32+ 11) /* Vector Neural Network Instructions */
-+#define X86_FEATURE_AVX512_BITALG     (16*32+12) /* Support for VPOPCNT[B,W] and VPSHUF-BITQMB */
-+#define X86_FEATURE_AVX512_VPOPCNTDQ  (16*32+14) /* POPCNT for vectors of DW/QW */
-+#define X86_FEATURE_LA57              (16*32+16) /* 5-level page tables */
-+#define X86_FEATURE_RDPID             (16*32+22) /* RDPID instruction */
- /* AMD-defined CPU features, CPUID level 0x80000007 (ebx), word 17 */
--#define X86_FEATURE_OVERFLOW_RECOV (17*32+0) /* MCA overflow recovery support */
--#define X86_FEATURE_SUCCOR    (17*32+1) /* Uncorrectable error containment and recovery */
--#define X86_FEATURE_SMCA      (17*32+3) /* Scalable MCA */
-+#define X86_FEATURE_OVERFLOW_RECOV    (17*32+0) /* MCA overflow recovery support */
-+#define X86_FEATURE_SUCCOR            (17*32+1) /* Uncorrectable error containment and recovery */
-+#define X86_FEATURE_SMCA              (17*32+3) /* Scalable MCA */
- /*
-  * BUG word(s)
-  */
--#define X86_BUG(x)            (NCAPINTS*32 + (x))
-+#define X86_BUG(x)                    (NCAPINTS*32 + (x))
--#define X86_BUG_F00F          X86_BUG(0) /* Intel F00F */
--#define X86_BUG_FDIV          X86_BUG(1) /* FPU FDIV */
--#define X86_BUG_COMA          X86_BUG(2) /* Cyrix 6x86 coma */
--#define X86_BUG_AMD_TLB_MMATCH        X86_BUG(3) /* "tlb_mmatch" AMD Erratum 383 */
--#define X86_BUG_AMD_APIC_C1E  X86_BUG(4) /* "apic_c1e" AMD Erratum 400 */
--#define X86_BUG_11AP          X86_BUG(5) /* Bad local APIC aka 11AP */
--#define X86_BUG_FXSAVE_LEAK   X86_BUG(6) /* FXSAVE leaks FOP/FIP/FOP */
--#define X86_BUG_CLFLUSH_MONITOR       X86_BUG(7) /* AAI65, CLFLUSH required before MONITOR */
--#define X86_BUG_SYSRET_SS_ATTRS       X86_BUG(8) /* SYSRET doesn't fix up SS attrs */
-+#define X86_BUG_F00F                  X86_BUG(0) /* Intel F00F */
-+#define X86_BUG_FDIV                  X86_BUG(1) /* FPU FDIV */
-+#define X86_BUG_COMA                  X86_BUG(2) /* Cyrix 6x86 coma */
-+#define X86_BUG_AMD_TLB_MMATCH                X86_BUG(3) /* "tlb_mmatch" AMD Erratum 383 */
-+#define X86_BUG_AMD_APIC_C1E          X86_BUG(4) /* "apic_c1e" AMD Erratum 400 */
-+#define X86_BUG_11AP                  X86_BUG(5) /* Bad local APIC aka 11AP */
-+#define X86_BUG_FXSAVE_LEAK           X86_BUG(6) /* FXSAVE leaks FOP/FIP/FOP */
-+#define X86_BUG_CLFLUSH_MONITOR               X86_BUG(7) /* AAI65, CLFLUSH required before MONITOR */
-+#define X86_BUG_SYSRET_SS_ATTRS               X86_BUG(8) /* SYSRET doesn't fix up SS attrs */
- #ifdef CONFIG_X86_32
- /*
-  * 64-bit kernels don't use X86_BUG_ESPFIX.  Make the define conditional
-  * to avoid confusion.
-  */
--#define X86_BUG_ESPFIX                X86_BUG(9) /* "" IRET to 16-bit SS corrupts ESP/RSP high bits */
-+#define X86_BUG_ESPFIX                        X86_BUG(9) /* "" IRET to 16-bit SS corrupts ESP/RSP high bits */
- #endif
--#define X86_BUG_NULL_SEG      X86_BUG(10) /* Nulling a selector preserves the base */
--#define X86_BUG_SWAPGS_FENCE  X86_BUG(11) /* SWAPGS without input dep on GS */
--#define X86_BUG_MONITOR               X86_BUG(12) /* IPI required to wake up remote CPU */
--#define X86_BUG_AMD_E400      X86_BUG(13) /* CPU is among the affected by Erratum 400 */
-+#define X86_BUG_NULL_SEG              X86_BUG(10) /* Nulling a selector preserves the base */
-+#define X86_BUG_SWAPGS_FENCE          X86_BUG(11) /* SWAPGS without input dep on GS */
-+#define X86_BUG_MONITOR                       X86_BUG(12) /* IPI required to wake up remote CPU */
-+#define X86_BUG_AMD_E400              X86_BUG(13) /* CPU is among the affected by Erratum 400 */
- #endif /* _ASM_X86_CPUFEATURES_H */
diff --git a/queue-4.14/x86-cpuid-replace-set-clear_bit32.patch b/queue-4.14/x86-cpuid-replace-set-clear_bit32.patch
deleted file mode 100644 (file)
index 8e39fa5..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-From 06dd688ddda5819025e014b79aea9af6ab475fa2 Mon Sep 17 00:00:00 2001
-From: Thomas Gleixner <tglx@linutronix.de>
-Date: Thu, 2 Nov 2017 13:22:35 +0100
-Subject: x86/cpuid: Replace set/clear_bit32()
-
-From: Thomas Gleixner <tglx@linutronix.de>
-
-commit 06dd688ddda5819025e014b79aea9af6ab475fa2 upstream.
-
-Peter pointed out that the set/clear_bit32() variants are broken in various
-aspects.
-
-Replace them with open coded set/clear_bit() and type cast
-cpu_info::x86_capability as it's done in all other places throughout x86.
-
-Fixes: 0b00de857a64 ("x86/cpuid: Add generic table for CPUID dependencies")
-Reported-by: Peter Ziljstra <peterz@infradead.org>
-Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-Cc: Andi Kleen <ak@linux.intel.com>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
----
- arch/x86/kernel/cpu/cpuid-deps.c |   26 +++++++++++---------------
- 1 file changed, 11 insertions(+), 15 deletions(-)
-
---- a/arch/x86/kernel/cpu/cpuid-deps.c
-+++ b/arch/x86/kernel/cpu/cpuid-deps.c
-@@ -62,23 +62,19 @@ const static struct cpuid_dep cpuid_deps
-       {}
- };
--static inline void __clear_cpu_cap(struct cpuinfo_x86 *c, unsigned int bit)
--{
--      clear_bit32(bit, c->x86_capability);
--}
--
--static inline void __setup_clear_cpu_cap(unsigned int bit)
--{
--      clear_cpu_cap(&boot_cpu_data, bit);
--      set_bit32(bit, cpu_caps_cleared);
--}
--
- static inline void clear_feature(struct cpuinfo_x86 *c, unsigned int feature)
- {
--      if (!c)
--              __setup_clear_cpu_cap(feature);
--      else
--              __clear_cpu_cap(c, feature);
-+      /*
-+       * Note: This could use the non atomic __*_bit() variants, but the
-+       * rest of the cpufeature code uses atomics as well, so keep it for
-+       * consistency. Cleanup all of it separately.
-+       */
-+      if (!c) {
-+              clear_cpu_cap(&boot_cpu_data, feature);
-+              set_bit(feature, (unsigned long *)cpu_caps_cleared);
-+      } else {
-+              clear_bit(feature, (unsigned long *)c->x86_capability);
-+      }
- }
- /* Take the capabilities and the BUG bits into account */
diff --git a/queue-4.14/x86-fpu-debug-remove-unused-x86_fpu_state-and-x86_fpu_deactivate_state-tracepoints.patch b/queue-4.14/x86-fpu-debug-remove-unused-x86_fpu_state-and-x86_fpu_deactivate_state-tracepoints.patch
new file mode 100644 (file)
index 0000000..995498f
--- /dev/null
@@ -0,0 +1,56 @@
+From 127a1bea40f7f2a36bc7207ea4d51bb6b4e936fa Mon Sep 17 00:00:00 2001
+From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
+Date: Thu, 12 Oct 2017 18:06:19 -0400
+Subject: x86/fpu/debug: Remove unused 'x86_fpu_state' and 'x86_fpu_deactivate_state' tracepoints
+
+From: Steven Rostedt (VMware) <rostedt@goodmis.org>
+
+commit 127a1bea40f7f2a36bc7207ea4d51bb6b4e936fa upstream.
+
+Commit:
+
+  d1898b733619 ("x86/fpu: Add tracepoints to dump FPU state at key points")
+
+... added the 'x86_fpu_state' and 'x86_fpu_deactivate_state' trace points,
+but never used them. Today they are still not used. As they take up
+and waste memory, remove them.
+
+Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
+Cc: Dave Hansen <dave.hansen@linux.intel.com>
+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/20171012180619.670b68b6@gandalf.local.home
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/x86/include/asm/trace/fpu.h |   10 ----------
+ 1 file changed, 10 deletions(-)
+
+--- a/arch/x86/include/asm/trace/fpu.h
++++ b/arch/x86/include/asm/trace/fpu.h
+@@ -34,11 +34,6 @@ DECLARE_EVENT_CLASS(x86_fpu,
+       )
+ );
+-DEFINE_EVENT(x86_fpu, x86_fpu_state,
+-      TP_PROTO(struct fpu *fpu),
+-      TP_ARGS(fpu)
+-);
+-
+ DEFINE_EVENT(x86_fpu, x86_fpu_before_save,
+       TP_PROTO(struct fpu *fpu),
+       TP_ARGS(fpu)
+@@ -73,11 +68,6 @@ DEFINE_EVENT(x86_fpu, x86_fpu_activate_s
+       TP_PROTO(struct fpu *fpu),
+       TP_ARGS(fpu)
+ );
+-
+-DEFINE_EVENT(x86_fpu, x86_fpu_deactivate_state,
+-      TP_PROTO(struct fpu *fpu),
+-      TP_ARGS(fpu)
+-);
+ DEFINE_EVENT(x86_fpu, x86_fpu_init_state,
+       TP_PROTO(struct fpu *fpu),
diff --git a/queue-4.14/x86-fpu-make-xsave-check-the-base-cpuid-features-before-enabling.patch b/queue-4.14/x86-fpu-make-xsave-check-the-base-cpuid-features-before-enabling.patch
new file mode 100644 (file)
index 0000000..2cef53f
--- /dev/null
@@ -0,0 +1,80 @@
+From ccb18db2ab9d923df07e7495123fe5fb02329713 Mon Sep 17 00:00:00 2001
+From: Andi Kleen <ak@linux.intel.com>
+Date: Fri, 13 Oct 2017 14:56:44 -0700
+Subject: x86/fpu: Make XSAVE check the base CPUID features before enabling
+
+From: Andi Kleen <ak@linux.intel.com>
+
+commit ccb18db2ab9d923df07e7495123fe5fb02329713 upstream.
+
+Before enabling XSAVE, not only check the XSAVE specific CPUID bits,
+but also the base CPUID features of the respective XSAVE feature.
+This allows to disable individual XSAVE states using the existing
+clearcpuid= option, which can be useful for performance testing
+and debugging, and also in general avoids inconsistencies.
+
+Signed-off-by: Andi Kleen <ak@linux.intel.com>
+Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Link: http://lkml.kernel.org/r/20171013215645.23166-5-andi@firstfloor.org
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/x86/kernel/fpu/xstate.c |   23 +++++++++++++++++++++++
+ 1 file changed, 23 insertions(+)
+
+--- a/arch/x86/kernel/fpu/xstate.c
++++ b/arch/x86/kernel/fpu/xstate.c
+@@ -15,6 +15,7 @@
+ #include <asm/fpu/xstate.h>
+ #include <asm/tlbflush.h>
++#include <asm/cpufeature.h>
+ /*
+  * Although we spell it out in here, the Processor Trace
+@@ -36,6 +37,19 @@ static const char *xfeature_names[] =
+       "unknown xstate feature"        ,
+ };
++static short xsave_cpuid_features[] __initdata = {
++      X86_FEATURE_FPU,
++      X86_FEATURE_XMM,
++      X86_FEATURE_AVX,
++      X86_FEATURE_MPX,
++      X86_FEATURE_MPX,
++      X86_FEATURE_AVX512F,
++      X86_FEATURE_AVX512F,
++      X86_FEATURE_AVX512F,
++      X86_FEATURE_INTEL_PT,
++      X86_FEATURE_PKU,
++};
++
+ /*
+  * Mask of xstate features supported by the CPU and the kernel:
+  */
+@@ -726,6 +740,7 @@ void __init fpu__init_system_xstate(void
+       unsigned int eax, ebx, ecx, edx;
+       static int on_boot_cpu __initdata = 1;
+       int err;
++      int i;
+       WARN_ON_FPU(!on_boot_cpu);
+       on_boot_cpu = 0;
+@@ -759,6 +774,14 @@ void __init fpu__init_system_xstate(void
+               goto out_disable;
+       }
++      /*
++       * Clear XSAVE features that are disabled in the normal CPUID.
++       */
++      for (i = 0; i < ARRAY_SIZE(xsave_cpuid_features); i++) {
++              if (!boot_cpu_has(xsave_cpuid_features[i]))
++                      xfeatures_mask &= ~BIT(i);
++      }
++
+       xfeatures_mask &= fpu__get_supported_xfeatures_mask();
+       /* Enable xstate instructions to be able to continue with initialization: */
diff --git a/queue-4.14/x86-fpu-parse-clearcpuid-as-early-xsave-argument.patch b/queue-4.14/x86-fpu-parse-clearcpuid-as-early-xsave-argument.patch
new file mode 100644 (file)
index 0000000..f3958d9
--- /dev/null
@@ -0,0 +1,86 @@
+From 0c2a3913d6f50503f7c59d83a6219e39508cc898 Mon Sep 17 00:00:00 2001
+From: Andi Kleen <ak@linux.intel.com>
+Date: Fri, 13 Oct 2017 14:56:43 -0700
+Subject: x86/fpu: Parse clearcpuid= as early XSAVE argument
+
+From: Andi Kleen <ak@linux.intel.com>
+
+commit 0c2a3913d6f50503f7c59d83a6219e39508cc898 upstream.
+
+With a followon patch we want to make clearcpuid affect the XSAVE
+configuration. But xsave is currently initialized before arguments
+are parsed. Move the clearcpuid= parsing into the special
+early xsave argument parsing code.
+
+Since clearcpuid= contains a = we need to keep the old __setup
+around as a dummy, otherwise it would end up as a environment
+variable in init's environment.
+
+Signed-off-by: Andi Kleen <ak@linux.intel.com>
+Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Link: http://lkml.kernel.org/r/20171013215645.23166-4-andi@firstfloor.org
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/x86/kernel/cpu/common.c |   16 +++++++---------
+ arch/x86/kernel/fpu/init.c   |   11 +++++++++++
+ 2 files changed, 18 insertions(+), 9 deletions(-)
+
+--- a/arch/x86/kernel/cpu/common.c
++++ b/arch/x86/kernel/cpu/common.c
+@@ -1301,18 +1301,16 @@ void print_cpu_info(struct cpuinfo_x86 *
+               pr_cont(")\n");
+ }
+-static __init int setup_disablecpuid(char *arg)
++/*
++ * clearcpuid= was already parsed in fpu__init_parse_early_param.
++ * But we need to keep a dummy __setup around otherwise it would
++ * show up as an environment variable for init.
++ */
++static __init int setup_clearcpuid(char *arg)
+ {
+-      int bit;
+-
+-      if (get_option(&arg, &bit) && bit >= 0 && bit < NCAPINTS * 32)
+-              setup_clear_cpu_cap(bit);
+-      else
+-              return 0;
+-
+       return 1;
+ }
+-__setup("clearcpuid=", setup_disablecpuid);
++__setup("clearcpuid=", setup_clearcpuid);
+ #ifdef CONFIG_X86_64
+ DEFINE_PER_CPU_FIRST(union irq_stack_union,
+--- a/arch/x86/kernel/fpu/init.c
++++ b/arch/x86/kernel/fpu/init.c
+@@ -249,6 +249,10 @@ static void __init fpu__init_system_ctx_
+  */
+ static void __init fpu__init_parse_early_param(void)
+ {
++      char arg[32];
++      char *argptr = arg;
++      int bit;
++
+       if (cmdline_find_option_bool(boot_command_line, "no387"))
+               setup_clear_cpu_cap(X86_FEATURE_FPU);
+@@ -266,6 +270,13 @@ static void __init fpu__init_parse_early
+       if (cmdline_find_option_bool(boot_command_line, "noxsaves"))
+               setup_clear_cpu_cap(X86_FEATURE_XSAVES);
++
++      if (cmdline_find_option(boot_command_line, "clearcpuid", arg,
++                              sizeof(arg)) &&
++          get_option(&argptr, &bit) &&
++          bit >= 0 &&
++          bit < NCAPINTS * 32)
++              setup_clear_cpu_cap(bit);
+ }
+ /*
diff --git a/queue-4.14/x86-fpu-remove-the-explicit-clearing-of-xsave-dependent-features.patch b/queue-4.14/x86-fpu-remove-the-explicit-clearing-of-xsave-dependent-features.patch
new file mode 100644 (file)
index 0000000..7ba14a5
--- /dev/null
@@ -0,0 +1,60 @@
+From 73e3a7d2a7c3be29a5a22b85026f6cfa5664267f Mon Sep 17 00:00:00 2001
+From: Andi Kleen <ak@linux.intel.com>
+Date: Fri, 13 Oct 2017 14:56:45 -0700
+Subject: x86/fpu: Remove the explicit clearing of XSAVE dependent features
+
+From: Andi Kleen <ak@linux.intel.com>
+
+commit 73e3a7d2a7c3be29a5a22b85026f6cfa5664267f upstream.
+
+Clearing a CPU feature with setup_clear_cpu_cap() clears all features
+which depend on it. Expressing feature dependencies in one place is
+easier to maintain than keeping functions like
+fpu__xstate_clear_all_cpu_caps() up to date.
+
+The features which depend on XSAVE have their dependency expressed in the
+dependency table, so its sufficient to clear X86_FEATURE_XSAVE.
+
+Remove the explicit clearing of XSAVE dependent features.
+
+Signed-off-by: Andi Kleen <ak@linux.intel.com>
+Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Link: http://lkml.kernel.org/r/20171013215645.23166-6-andi@firstfloor.org
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/x86/kernel/fpu/xstate.c |   20 --------------------
+ 1 file changed, 20 deletions(-)
+
+--- a/arch/x86/kernel/fpu/xstate.c
++++ b/arch/x86/kernel/fpu/xstate.c
+@@ -73,26 +73,6 @@ unsigned int fpu_user_xstate_size;
+ void fpu__xstate_clear_all_cpu_caps(void)
+ {
+       setup_clear_cpu_cap(X86_FEATURE_XSAVE);
+-      setup_clear_cpu_cap(X86_FEATURE_XSAVEOPT);
+-      setup_clear_cpu_cap(X86_FEATURE_XSAVEC);
+-      setup_clear_cpu_cap(X86_FEATURE_XSAVES);
+-      setup_clear_cpu_cap(X86_FEATURE_AVX);
+-      setup_clear_cpu_cap(X86_FEATURE_AVX2);
+-      setup_clear_cpu_cap(X86_FEATURE_AVX512F);
+-      setup_clear_cpu_cap(X86_FEATURE_AVX512IFMA);
+-      setup_clear_cpu_cap(X86_FEATURE_AVX512PF);
+-      setup_clear_cpu_cap(X86_FEATURE_AVX512ER);
+-      setup_clear_cpu_cap(X86_FEATURE_AVX512CD);
+-      setup_clear_cpu_cap(X86_FEATURE_AVX512DQ);
+-      setup_clear_cpu_cap(X86_FEATURE_AVX512BW);
+-      setup_clear_cpu_cap(X86_FEATURE_AVX512VL);
+-      setup_clear_cpu_cap(X86_FEATURE_MPX);
+-      setup_clear_cpu_cap(X86_FEATURE_XGETBV1);
+-      setup_clear_cpu_cap(X86_FEATURE_AVX512VBMI);
+-      setup_clear_cpu_cap(X86_FEATURE_PKU);
+-      setup_clear_cpu_cap(X86_FEATURE_AVX512_4VNNIW);
+-      setup_clear_cpu_cap(X86_FEATURE_AVX512_4FMAPS);
+-      setup_clear_cpu_cap(X86_FEATURE_AVX512_VPOPCNTDQ);
+ }
+ /*
diff --git a/queue-4.14/x86-head-add-unwind-hint-annotations.patch b/queue-4.14/x86-head-add-unwind-hint-annotations.patch
new file mode 100644 (file)
index 0000000..0cd8e4a
--- /dev/null
@@ -0,0 +1,123 @@
+From 2704fbb672d0d9a19414907fda7949283dcef6a1 Mon Sep 17 00:00:00 2001
+From: Josh Poimboeuf <jpoimboe@redhat.com>
+Date: Mon, 18 Sep 2017 21:43:37 -0500
+Subject: x86/head: Add unwind hint annotations
+
+From: Josh Poimboeuf <jpoimboe@redhat.com>
+
+commit 2704fbb672d0d9a19414907fda7949283dcef6a1 upstream.
+
+Jiri Slaby reported an ORC issue when unwinding from an idle task.  The
+stack was:
+
+    ffffffff811083c2 do_idle+0x142/0x1e0
+    ffffffff8110861d cpu_startup_entry+0x5d/0x60
+    ffffffff82715f58 start_kernel+0x3ff/0x407
+    ffffffff827153e8 x86_64_start_kernel+0x14e/0x15d
+    ffffffff810001bf secondary_startup_64+0x9f/0xa0
+
+The ORC unwinder errored out at secondary_startup_64 because the head
+code isn't annotated yet so there wasn't a corresponding ORC entry.
+
+Fix that and any other head-related unwinding issues by adding unwind
+hints to the head code.
+
+Reported-by: Jiri Slaby <jslaby@suse.cz>
+Tested-by: Jiri Slaby <jslaby@suse.cz>
+Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
+Cc: Andy Lutomirski <luto@kernel.org>
+Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
+Cc: Juergen Gross <jgross@suse.com>
+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/78ef000a2f68f545d6eef44ee912edceaad82ccf.1505764066.git.jpoimboe@redhat.com
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/x86/kernel/Makefile  |    1 -
+ arch/x86/kernel/head_64.S |   14 ++++++++++++--
+ 2 files changed, 12 insertions(+), 3 deletions(-)
+
+--- a/arch/x86/kernel/Makefile
++++ b/arch/x86/kernel/Makefile
+@@ -27,7 +27,6 @@ KASAN_SANITIZE_dumpstack.o                           := n
+ KASAN_SANITIZE_dumpstack_$(BITS).o                    := n
+ KASAN_SANITIZE_stacktrace.o := n
+-OBJECT_FILES_NON_STANDARD_head_$(BITS).o              := y
+ OBJECT_FILES_NON_STANDARD_relocate_kernel_$(BITS).o   := y
+ OBJECT_FILES_NON_STANDARD_ftrace_$(BITS).o            := y
+ OBJECT_FILES_NON_STANDARD_test_nx.o                   := y
+--- a/arch/x86/kernel/head_64.S
++++ b/arch/x86/kernel/head_64.S
+@@ -50,6 +50,7 @@ L3_START_KERNEL = pud_index(__START_KERN
+       .code64
+       .globl startup_64
+ startup_64:
++      UNWIND_HINT_EMPTY
+       /*
+        * At this point the CPU runs in 64bit mode CS.L = 1 CS.D = 0,
+        * and someone has loaded an identity mapped page table
+@@ -89,6 +90,7 @@ startup_64:
+       addq    $(early_top_pgt - __START_KERNEL_map), %rax
+       jmp 1f
+ ENTRY(secondary_startup_64)
++      UNWIND_HINT_EMPTY
+       /*
+        * At this point the CPU runs in 64bit mode CS.L = 1 CS.D = 0,
+        * and someone has loaded a mapped page table.
+@@ -133,6 +135,7 @@ ENTRY(secondary_startup_64)
+       movq    $1f, %rax
+       jmp     *%rax
+ 1:
++      UNWIND_HINT_EMPTY
+       /* Check if nx is implemented */
+       movl    $0x80000001, %eax
+@@ -247,6 +250,7 @@ END(secondary_startup_64)
+  */
+ ENTRY(start_cpu0)
+       movq    initial_stack(%rip), %rsp
++      UNWIND_HINT_EMPTY
+       jmp     .Ljump_to_C_code
+ ENDPROC(start_cpu0)
+ #endif
+@@ -271,13 +275,18 @@ ENTRY(early_idt_handler_array)
+       i = 0
+       .rept NUM_EXCEPTION_VECTORS
+       .ifeq (EXCEPTION_ERRCODE_MASK >> i) & 1
+-      pushq $0                # Dummy error code, to make stack frame uniform
++              UNWIND_HINT_IRET_REGS
++              pushq $0        # Dummy error code, to make stack frame uniform
++      .else
++              UNWIND_HINT_IRET_REGS offset=8
+       .endif
+       pushq $i                # 72(%rsp) Vector number
+       jmp early_idt_handler_common
++      UNWIND_HINT_IRET_REGS
+       i = i + 1
+       .fill early_idt_handler_array + i*EARLY_IDT_HANDLER_SIZE - ., 1, 0xcc
+       .endr
++      UNWIND_HINT_IRET_REGS offset=16
+ END(early_idt_handler_array)
+ early_idt_handler_common:
+@@ -306,6 +315,7 @@ early_idt_handler_common:
+       pushq %r13                              /* pt_regs->r13 */
+       pushq %r14                              /* pt_regs->r14 */
+       pushq %r15                              /* pt_regs->r15 */
++      UNWIND_HINT_REGS
+       cmpq $14,%rsi           /* Page fault? */
+       jnz 10f
+@@ -428,7 +438,7 @@ ENTRY(phys_base)
+ EXPORT_SYMBOL(phys_base)
+ #include "../../x86/xen/xen-head.S"
+-      
++
+       __PAGE_ALIGNED_BSS
+ NEXT_PAGE(empty_zero_page)
+       .skip PAGE_SIZE
diff --git a/queue-4.14/x86-head-fix-head-elf-function-annotations.patch b/queue-4.14/x86-head-fix-head-elf-function-annotations.patch
new file mode 100644 (file)
index 0000000..7b0d97c
--- /dev/null
@@ -0,0 +1,57 @@
+From 015a2ea5478680fc5216d56b7ff306f2a74efaf9 Mon Sep 17 00:00:00 2001
+From: Josh Poimboeuf <jpoimboe@redhat.com>
+Date: Mon, 18 Sep 2017 21:43:33 -0500
+Subject: x86/head: Fix head ELF function annotations
+
+From: Josh Poimboeuf <jpoimboe@redhat.com>
+
+commit 015a2ea5478680fc5216d56b7ff306f2a74efaf9 upstream.
+
+These functions aren't callable C-type functions, so don't annotate them
+as such.
+
+Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
+Cc: Andy Lutomirski <luto@kernel.org>
+Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
+Cc: Jiri Slaby <jslaby@suse.cz>
+Cc: Juergen Gross <jgross@suse.com>
+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/36eb182738c28514f8bf95e403d89b6413a88883.1505764066.git.jpoimboe@redhat.com
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/x86/kernel/head_64.S |    6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+--- a/arch/x86/kernel/head_64.S
++++ b/arch/x86/kernel/head_64.S
+@@ -235,7 +235,7 @@ ENTRY(secondary_startup_64)
+       pushq   %rax            # target address in negative space
+       lretq
+ .Lafter_lret:
+-ENDPROC(secondary_startup_64)
++END(secondary_startup_64)
+ #include "verify_cpu.S"
+@@ -278,7 +278,7 @@ ENTRY(early_idt_handler_array)
+       i = i + 1
+       .fill early_idt_handler_array + i*EARLY_IDT_HANDLER_SIZE - ., 1, 0xcc
+       .endr
+-ENDPROC(early_idt_handler_array)
++END(early_idt_handler_array)
+ early_idt_handler_common:
+       /*
+@@ -321,7 +321,7 @@ early_idt_handler_common:
+ 20:
+       decl early_recursion_flag(%rip)
+       jmp restore_regs_and_iret
+-ENDPROC(early_idt_handler_common)
++END(early_idt_handler_common)
+       __INITDATA
diff --git a/queue-4.14/x86-head-remove-confusing-comment.patch b/queue-4.14/x86-head-remove-confusing-comment.patch
new file mode 100644 (file)
index 0000000..4ad32e3
--- /dev/null
@@ -0,0 +1,45 @@
+From 17270717e80de33a884ad328fea5f407d87f6d6a Mon Sep 17 00:00:00 2001
+From: Josh Poimboeuf <jpoimboe@redhat.com>
+Date: Mon, 18 Sep 2017 21:43:31 -0500
+Subject: x86/head: Remove confusing comment
+
+From: Josh Poimboeuf <jpoimboe@redhat.com>
+
+commit 17270717e80de33a884ad328fea5f407d87f6d6a upstream.
+
+This comment is actively wrong and confusing.  It refers to the
+registers' stack offsets after the pt_regs has been constructed on the
+stack, but this code is *before* that.
+
+At this point the stack just has the standard iret frame, for which no
+comment should be needed.
+
+Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
+Cc: Andy Lutomirski <luto@kernel.org>
+Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
+Cc: Jiri Slaby <jslaby@suse.cz>
+Cc: Juergen Gross <jgross@suse.com>
+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/a3c267b770fc56c9b86df9c11c552848248aace2.1505764066.git.jpoimboe@redhat.com
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/x86/kernel/head_64.S |    4 ----
+ 1 file changed, 4 deletions(-)
+
+--- a/arch/x86/kernel/head_64.S
++++ b/arch/x86/kernel/head_64.S
+@@ -271,10 +271,6 @@ bad_address:
+       __INIT
+ ENTRY(early_idt_handler_array)
+-      # 104(%rsp) %rflags
+-      #  96(%rsp) %cs
+-      #  88(%rsp) %rip
+-      #  80(%rsp) error code
+       i = 0
+       .rept NUM_EXCEPTION_VECTORS
+       .ifeq (EXCEPTION_ERRCODE_MASK >> i) & 1
diff --git a/queue-4.14/x86-head-remove-unused-bad_address-code.patch b/queue-4.14/x86-head-remove-unused-bad_address-code.patch
new file mode 100644 (file)
index 0000000..0520977
--- /dev/null
@@ -0,0 +1,39 @@
+From a8b88e84d124bc92c4808e72b8b8c0e0bb538630 Mon Sep 17 00:00:00 2001
+From: Josh Poimboeuf <jpoimboe@redhat.com>
+Date: Mon, 18 Sep 2017 21:43:32 -0500
+Subject: x86/head: Remove unused 'bad_address' code
+
+From: Josh Poimboeuf <jpoimboe@redhat.com>
+
+commit a8b88e84d124bc92c4808e72b8b8c0e0bb538630 upstream.
+
+It's no longer possible for this code to be executed, so remove it.
+
+Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
+Cc: Andy Lutomirski <luto@kernel.org>
+Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
+Cc: Jiri Slaby <jslaby@suse.cz>
+Cc: Juergen Gross <jgross@suse.com>
+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/32a46fe92d2083700599b36872b26e7dfd7b7965.1505764066.git.jpoimboe@redhat.com
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/x86/kernel/head_64.S |    3 ---
+ 1 file changed, 3 deletions(-)
+
+--- a/arch/x86/kernel/head_64.S
++++ b/arch/x86/kernel/head_64.S
+@@ -266,9 +266,6 @@ ENDPROC(start_cpu0)
+       .quad  init_thread_union + THREAD_SIZE - SIZEOF_PTREGS
+       __FINITDATA
+-bad_address:
+-      jmp bad_address
+-
+       __INIT
+ ENTRY(early_idt_handler_array)
+       i = 0
diff --git a/queue-4.14/x86-kasan-use-the-same-shadow-offset-for-4-and-5-level-paging.patch b/queue-4.14/x86-kasan-use-the-same-shadow-offset-for-4-and-5-level-paging.patch
new file mode 100644 (file)
index 0000000..9bebe19
--- /dev/null
@@ -0,0 +1,228 @@
+From 12a8cc7fcf54a8575f094be1e99032ec38aa045c Mon Sep 17 00:00:00 2001
+From: Andrey Ryabinin <aryabinin@virtuozzo.com>
+Date: Fri, 29 Sep 2017 17:08:18 +0300
+Subject: x86/kasan: Use the same shadow offset for 4- and 5-level paging
+
+From: Andrey Ryabinin <aryabinin@virtuozzo.com>
+
+commit 12a8cc7fcf54a8575f094be1e99032ec38aa045c upstream.
+
+We are going to support boot-time switching between 4- and 5-level
+paging. For KASAN it means we cannot have different KASAN_SHADOW_OFFSET
+for different paging modes: the constant is passed to gcc to generate
+code and cannot be changed at runtime.
+
+This patch changes KASAN code to use 0xdffffc0000000000 as shadow offset
+for both 4- and 5-level paging.
+
+For 5-level paging it means that shadow memory region is not aligned to
+PGD boundary anymore and we have to handle unaligned parts of the region
+properly.
+
+In addition, we have to exclude paravirt code from KASAN instrumentation
+as we now use set_pgd() before KASAN is fully ready.
+
+[kirill.shutemov@linux.intel.com: clenaup, changelog message]
+Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
+Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
+Cc: Andrew Morton <akpm@linux-foundation.org>
+Cc: Andy Lutomirski <luto@amacapital.net>
+Cc: Borislav Petkov <bp@suse.de>
+Cc: Cyrill Gorcunov <gorcunov@openvz.org>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Cc: linux-mm@kvack.org
+Link: http://lkml.kernel.org/r/20170929140821.37654-4-kirill.shutemov@linux.intel.com
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ Documentation/x86/x86_64/mm.txt |    2 
+ arch/x86/Kconfig                |    1 
+ arch/x86/kernel/Makefile        |    3 -
+ arch/x86/mm/kasan_init_64.c     |  101 +++++++++++++++++++++++++++++++---------
+ 4 files changed, 83 insertions(+), 24 deletions(-)
+
+--- a/Documentation/x86/x86_64/mm.txt
++++ b/Documentation/x86/x86_64/mm.txt
+@@ -34,7 +34,7 @@ ff92000000000000 - ffd1ffffffffffff (=54
+ ffd2000000000000 - ffd3ffffffffffff (=49 bits) hole
+ ffd4000000000000 - ffd5ffffffffffff (=49 bits) virtual memory map (512TB)
+ ... unused hole ...
+-ffd8000000000000 - fff7ffffffffffff (=53 bits) kasan shadow memory (8PB)
++ffdf000000000000 - fffffc0000000000 (=53 bits) kasan shadow memory (8PB)
+ ... unused hole ...
+ ffffff0000000000 - ffffff7fffffffff (=39 bits) %esp fixup stacks
+ ... unused hole ...
+--- a/arch/x86/Kconfig
++++ b/arch/x86/Kconfig
+@@ -303,7 +303,6 @@ config ARCH_SUPPORTS_DEBUG_PAGEALLOC
+ config KASAN_SHADOW_OFFSET
+       hex
+       depends on KASAN
+-      default 0xdff8000000000000 if X86_5LEVEL
+       default 0xdffffc0000000000
+ config HAVE_INTEL_TXT
+--- a/arch/x86/kernel/Makefile
++++ b/arch/x86/kernel/Makefile
+@@ -25,7 +25,8 @@ endif
+ KASAN_SANITIZE_head$(BITS).o                          := n
+ KASAN_SANITIZE_dumpstack.o                            := n
+ KASAN_SANITIZE_dumpstack_$(BITS).o                    := n
+-KASAN_SANITIZE_stacktrace.o := n
++KASAN_SANITIZE_stacktrace.o                           := n
++KASAN_SANITIZE_paravirt.o                             := n
+ OBJECT_FILES_NON_STANDARD_relocate_kernel_$(BITS).o   := y
+ OBJECT_FILES_NON_STANDARD_ftrace_$(BITS).o            := y
+--- a/arch/x86/mm/kasan_init_64.c
++++ b/arch/x86/mm/kasan_init_64.c
+@@ -16,6 +16,8 @@
+ extern struct range pfn_mapped[E820_MAX_ENTRIES];
++static p4d_t tmp_p4d_table[PTRS_PER_P4D] __initdata __aligned(PAGE_SIZE);
++
+ static int __init map_range(struct range *range)
+ {
+       unsigned long start;
+@@ -31,8 +33,10 @@ static void __init clear_pgds(unsigned l
+                       unsigned long end)
+ {
+       pgd_t *pgd;
++      /* See comment in kasan_init() */
++      unsigned long pgd_end = end & PGDIR_MASK;
+-      for (; start < end; start += PGDIR_SIZE) {
++      for (; start < pgd_end; start += PGDIR_SIZE) {
+               pgd = pgd_offset_k(start);
+               /*
+                * With folded p4d, pgd_clear() is nop, use p4d_clear()
+@@ -43,29 +47,61 @@ static void __init clear_pgds(unsigned l
+               else
+                       pgd_clear(pgd);
+       }
++
++      pgd = pgd_offset_k(start);
++      for (; start < end; start += P4D_SIZE)
++              p4d_clear(p4d_offset(pgd, start));
++}
++
++static inline p4d_t *early_p4d_offset(pgd_t *pgd, unsigned long addr)
++{
++      unsigned long p4d;
++
++      if (!IS_ENABLED(CONFIG_X86_5LEVEL))
++              return (p4d_t *)pgd;
++
++      p4d = __pa_nodebug(pgd_val(*pgd)) & PTE_PFN_MASK;
++      p4d += __START_KERNEL_map - phys_base;
++      return (p4d_t *)p4d + p4d_index(addr);
++}
++
++static void __init kasan_early_p4d_populate(pgd_t *pgd,
++              unsigned long addr,
++              unsigned long end)
++{
++      pgd_t pgd_entry;
++      p4d_t *p4d, p4d_entry;
++      unsigned long next;
++
++      if (pgd_none(*pgd)) {
++              pgd_entry = __pgd(_KERNPG_TABLE | __pa_nodebug(kasan_zero_p4d));
++              set_pgd(pgd, pgd_entry);
++      }
++
++      p4d = early_p4d_offset(pgd, addr);
++      do {
++              next = p4d_addr_end(addr, end);
++
++              if (!p4d_none(*p4d))
++                      continue;
++
++              p4d_entry = __p4d(_KERNPG_TABLE | __pa_nodebug(kasan_zero_pud));
++              set_p4d(p4d, p4d_entry);
++      } while (p4d++, addr = next, addr != end && p4d_none(*p4d));
+ }
+ static void __init kasan_map_early_shadow(pgd_t *pgd)
+ {
+-      int i;
+-      unsigned long start = KASAN_SHADOW_START;
++      /* See comment in kasan_init() */
++      unsigned long addr = KASAN_SHADOW_START & PGDIR_MASK;
+       unsigned long end = KASAN_SHADOW_END;
++      unsigned long next;
+-      for (i = pgd_index(start); start < end; i++) {
+-              switch (CONFIG_PGTABLE_LEVELS) {
+-              case 4:
+-                      pgd[i] = __pgd(__pa_nodebug(kasan_zero_pud) |
+-                                      _KERNPG_TABLE);
+-                      break;
+-              case 5:
+-                      pgd[i] = __pgd(__pa_nodebug(kasan_zero_p4d) |
+-                                      _KERNPG_TABLE);
+-                      break;
+-              default:
+-                      BUILD_BUG();
+-              }
+-              start += PGDIR_SIZE;
+-      }
++      pgd += pgd_index(addr);
++      do {
++              next = pgd_addr_end(addr, end);
++              kasan_early_p4d_populate(pgd, addr, next);
++      } while (pgd++, addr = next, addr != end);
+ }
+ #ifdef CONFIG_KASAN_INLINE
+@@ -102,7 +138,7 @@ void __init kasan_early_init(void)
+       for (i = 0; i < PTRS_PER_PUD; i++)
+               kasan_zero_pud[i] = __pud(pud_val);
+-      for (i = 0; CONFIG_PGTABLE_LEVELS >= 5 && i < PTRS_PER_P4D; i++)
++      for (i = 0; IS_ENABLED(CONFIG_X86_5LEVEL) && i < PTRS_PER_P4D; i++)
+               kasan_zero_p4d[i] = __p4d(p4d_val);
+       kasan_map_early_shadow(early_top_pgt);
+@@ -118,12 +154,35 @@ void __init kasan_init(void)
+ #endif
+       memcpy(early_top_pgt, init_top_pgt, sizeof(early_top_pgt));
++
++      /*
++       * We use the same shadow offset for 4- and 5-level paging to
++       * facilitate boot-time switching between paging modes.
++       * As result in 5-level paging mode KASAN_SHADOW_START and
++       * KASAN_SHADOW_END are not aligned to PGD boundary.
++       *
++       * KASAN_SHADOW_START doesn't share PGD with anything else.
++       * We claim whole PGD entry to make things easier.
++       *
++       * KASAN_SHADOW_END lands in the last PGD entry and it collides with
++       * bunch of things like kernel code, modules, EFI mapping, etc.
++       * We need to take extra steps to not overwrite them.
++       */
++      if (IS_ENABLED(CONFIG_X86_5LEVEL)) {
++              void *ptr;
++
++              ptr = (void *)pgd_page_vaddr(*pgd_offset_k(KASAN_SHADOW_END));
++              memcpy(tmp_p4d_table, (void *)ptr, sizeof(tmp_p4d_table));
++              set_pgd(&early_top_pgt[pgd_index(KASAN_SHADOW_END)],
++                              __pgd(__pa(tmp_p4d_table) | _KERNPG_TABLE));
++      }
++
+       load_cr3(early_top_pgt);
+       __flush_tlb_all();
+-      clear_pgds(KASAN_SHADOW_START, KASAN_SHADOW_END);
++      clear_pgds(KASAN_SHADOW_START & PGDIR_MASK, KASAN_SHADOW_END);
+-      kasan_populate_zero_shadow((void *)KASAN_SHADOW_START,
++      kasan_populate_zero_shadow((void *)(KASAN_SHADOW_START & PGDIR_MASK),
+                       kasan_mem_to_shadow((void *)PAGE_OFFSET));
+       for (i = 0; i < E820_MAX_ENTRIES; i++) {
diff --git a/queue-4.14/x86-mm-64-rename-the-register_page_bootmem_memmap-size-parameter-to-nr_pages.patch b/queue-4.14/x86-mm-64-rename-the-register_page_bootmem_memmap-size-parameter-to-nr_pages.patch
new file mode 100644 (file)
index 0000000..e4b583a
--- /dev/null
@@ -0,0 +1,78 @@
+From 15670bfe19905b1dcbb63137f40d718b59d84479 Mon Sep 17 00:00:00 2001
+From: Baoquan He <bhe@redhat.com>
+Date: Sat, 28 Oct 2017 09:30:38 +0800
+Subject: x86/mm/64: Rename the register_page_bootmem_memmap() 'size' parameter to 'nr_pages'
+
+From: Baoquan He <bhe@redhat.com>
+
+commit 15670bfe19905b1dcbb63137f40d718b59d84479 upstream.
+
+register_page_bootmem_memmap()'s 3rd 'size' parameter is named
+in a somewhat misleading fashion - rename it to 'nr_pages' which
+makes the units of it much clearer.
+
+Meanwhile rename the existing local variable 'nr_pages' to
+'nr_pmd_pages', a more expressive name, to avoid conflict with
+new function parameter 'nr_pages'.
+
+(Also clean up the unnecessary parentheses in which get_order() is called.)
+
+Signed-off-by: Baoquan He <bhe@redhat.com>
+Acked-by: Thomas Gleixner <tglx@linutronix.de>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: akpm@linux-foundation.org
+Link: http://lkml.kernel.org/r/1509154238-23250-1-git-send-email-bhe@redhat.com
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/x86/mm/init_64.c |   10 +++++-----
+ include/linux/mm.h    |    2 +-
+ 2 files changed, 6 insertions(+), 6 deletions(-)
+
+--- a/arch/x86/mm/init_64.c
++++ b/arch/x86/mm/init_64.c
+@@ -1426,16 +1426,16 @@ int __meminit vmemmap_populate(unsigned
+ #if defined(CONFIG_MEMORY_HOTPLUG_SPARSE) && defined(CONFIG_HAVE_BOOTMEM_INFO_NODE)
+ void register_page_bootmem_memmap(unsigned long section_nr,
+-                                struct page *start_page, unsigned long size)
++                                struct page *start_page, unsigned long nr_pages)
+ {
+       unsigned long addr = (unsigned long)start_page;
+-      unsigned long end = (unsigned long)(start_page + size);
++      unsigned long end = (unsigned long)(start_page + nr_pages);
+       unsigned long next;
+       pgd_t *pgd;
+       p4d_t *p4d;
+       pud_t *pud;
+       pmd_t *pmd;
+-      unsigned int nr_pages;
++      unsigned int nr_pmd_pages;
+       struct page *page;
+       for (; addr < end; addr = next) {
+@@ -1482,9 +1482,9 @@ void register_page_bootmem_memmap(unsign
+                       if (pmd_none(*pmd))
+                               continue;
+-                      nr_pages = 1 << (get_order(PMD_SIZE));
++                      nr_pmd_pages = 1 << get_order(PMD_SIZE);
+                       page = pmd_page(*pmd);
+-                      while (nr_pages--)
++                      while (nr_pmd_pages--)
+                               get_page_bootmem(section_nr, page++,
+                                                SECTION_INFO);
+               }
+--- a/include/linux/mm.h
++++ b/include/linux/mm.h
+@@ -2510,7 +2510,7 @@ void vmemmap_populate_print_last(void);
+ void vmemmap_free(unsigned long start, unsigned long end);
+ #endif
+ void register_page_bootmem_memmap(unsigned long section_nr, struct page *map,
+-                                unsigned long size);
++                                unsigned long nr_pages);
+ enum mf_flags {
+       MF_COUNT_INCREASED = 1 << 0,
diff --git a/queue-4.14/x86-mm-relocate-page-fault-error-codes-to-traps.h.patch b/queue-4.14/x86-mm-relocate-page-fault-error-codes-to-traps.h.patch
new file mode 100644 (file)
index 0000000..50b99e6
--- /dev/null
@@ -0,0 +1,351 @@
+From 1067f030994c69ca1fba8c607437c8895dcf8509 Mon Sep 17 00:00:00 2001
+From: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
+Date: Fri, 27 Oct 2017 13:25:28 -0700
+Subject: x86/mm: Relocate page fault error codes to traps.h
+
+From: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
+
+commit 1067f030994c69ca1fba8c607437c8895dcf8509 upstream.
+
+Up to this point, only fault.c used the definitions of the page fault error
+codes. Thus, it made sense to keep them within such file. Other portions of
+code might be interested in those definitions too. For instance, the User-
+Mode Instruction Prevention emulation code will use such definitions to
+emulate a page fault when it is unable to successfully copy the results
+of the emulated instructions to user space.
+
+While relocating the error code enumeration, the prefix X86_ is used to
+make it consistent with the rest of the definitions in traps.h. Of course,
+code using the enumeration had to be updated as well. No functional changes
+were performed.
+
+Signed-off-by: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
+Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
+Reviewed-by: Borislav Petkov <bp@suse.de>
+Reviewed-by: Andy Lutomirski <luto@kernel.org>
+Cc: "Michael S. Tsirkin" <mst@redhat.com>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Dave Hansen <dave.hansen@linux.intel.com>
+Cc: ricardo.neri@intel.com
+Cc: Paul Gortmaker <paul.gortmaker@windriver.com>
+Cc: Huang Rui <ray.huang@amd.com>
+Cc: Shuah Khan <shuah@kernel.org>
+Cc: Jonathan Corbet <corbet@lwn.net>
+Cc: Jiri Slaby <jslaby@suse.cz>
+Cc: "Ravi V. Shankar" <ravi.v.shankar@intel.com>
+Cc: Chris Metcalf <cmetcalf@mellanox.com>
+Cc: Brian Gerst <brgerst@gmail.com>
+Cc: Josh Poimboeuf <jpoimboe@redhat.com>
+Cc: Chen Yucong <slaoub@gmail.com>
+Cc: Vlastimil Babka <vbabka@suse.cz>
+Cc: Masami Hiramatsu <mhiramat@kernel.org>
+Cc: Paolo Bonzini <pbonzini@redhat.com>
+Cc: Andrew Morton <akpm@linux-foundation.org>
+Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
+Link: https://lkml.kernel.org/r/1509135945-13762-2-git-send-email-ricardo.neri-calderon@linux.intel.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/x86/include/asm/traps.h |   18 ++++++++
+ arch/x86/mm/fault.c          |   88 ++++++++++++++++---------------------------
+ 2 files changed, 52 insertions(+), 54 deletions(-)
+
+--- a/arch/x86/include/asm/traps.h
++++ b/arch/x86/include/asm/traps.h
+@@ -145,4 +145,22 @@ enum {
+       X86_TRAP_IRET = 32,     /* 32, IRET Exception */
+ };
++/*
++ * Page fault error code bits:
++ *
++ *   bit 0 ==  0: no page found       1: protection fault
++ *   bit 1 ==  0: read access         1: write access
++ *   bit 2 ==  0: kernel-mode access  1: user-mode access
++ *   bit 3 ==                         1: use of reserved bit detected
++ *   bit 4 ==                         1: fault was an instruction fetch
++ *   bit 5 ==                         1: protection keys block access
++ */
++enum x86_pf_error_code {
++      X86_PF_PROT     =               1 << 0,
++      X86_PF_WRITE    =               1 << 1,
++      X86_PF_USER     =               1 << 2,
++      X86_PF_RSVD     =               1 << 3,
++      X86_PF_INSTR    =               1 << 4,
++      X86_PF_PK       =               1 << 5,
++};
+ #endif /* _ASM_X86_TRAPS_H */
+--- a/arch/x86/mm/fault.c
++++ b/arch/x86/mm/fault.c
+@@ -30,26 +30,6 @@
+ #include <asm/trace/exceptions.h>
+ /*
+- * Page fault error code bits:
+- *
+- *   bit 0 ==  0: no page found       1: protection fault
+- *   bit 1 ==  0: read access         1: write access
+- *   bit 2 ==  0: kernel-mode access  1: user-mode access
+- *   bit 3 ==                         1: use of reserved bit detected
+- *   bit 4 ==                         1: fault was an instruction fetch
+- *   bit 5 ==                         1: protection keys block access
+- */
+-enum x86_pf_error_code {
+-
+-      PF_PROT         =               1 << 0,
+-      PF_WRITE        =               1 << 1,
+-      PF_USER         =               1 << 2,
+-      PF_RSVD         =               1 << 3,
+-      PF_INSTR        =               1 << 4,
+-      PF_PK           =               1 << 5,
+-};
+-
+-/*
+  * Returns 0 if mmiotrace is disabled, or if the fault is not
+  * handled by mmiotrace:
+  */
+@@ -150,7 +130,7 @@ is_prefetch(struct pt_regs *regs, unsign
+        * If it was a exec (instruction fetch) fault on NX page, then
+        * do not ignore the fault:
+        */
+-      if (error_code & PF_INSTR)
++      if (error_code & X86_PF_INSTR)
+               return 0;
+       instr = (void *)convert_ip_to_linear(current, regs);
+@@ -180,7 +160,7 @@ is_prefetch(struct pt_regs *regs, unsign
+  * siginfo so userspace can discover which protection key was set
+  * on the PTE.
+  *
+- * If we get here, we know that the hardware signaled a PF_PK
++ * If we get here, we know that the hardware signaled a X86_PF_PK
+  * fault and that there was a VMA once we got in the fault
+  * handler.  It does *not* guarantee that the VMA we find here
+  * was the one that we faulted on.
+@@ -205,7 +185,7 @@ static void fill_sig_info_pkey(int si_co
+       /*
+        * force_sig_info_fault() is called from a number of
+        * contexts, some of which have a VMA and some of which
+-       * do not.  The PF_PK handing happens after we have a
++       * do not.  The X86_PF_PK handing happens after we have a
+        * valid VMA, so we should never reach this without a
+        * valid VMA.
+        */
+@@ -698,7 +678,7 @@ show_fault_oops(struct pt_regs *regs, un
+       if (!oops_may_print())
+               return;
+-      if (error_code & PF_INSTR) {
++      if (error_code & X86_PF_INSTR) {
+               unsigned int level;
+               pgd_t *pgd;
+               pte_t *pte;
+@@ -780,7 +760,7 @@ no_context(struct pt_regs *regs, unsigne
+                */
+               if (current->thread.sig_on_uaccess_err && signal) {
+                       tsk->thread.trap_nr = X86_TRAP_PF;
+-                      tsk->thread.error_code = error_code | PF_USER;
++                      tsk->thread.error_code = error_code | X86_PF_USER;
+                       tsk->thread.cr2 = address;
+                       /* XXX: hwpoison faults will set the wrong code. */
+@@ -898,7 +878,7 @@ __bad_area_nosemaphore(struct pt_regs *r
+       struct task_struct *tsk = current;
+       /* User mode accesses just cause a SIGSEGV */
+-      if (error_code & PF_USER) {
++      if (error_code & X86_PF_USER) {
+               /*
+                * It's possible to have interrupts off here:
+                */
+@@ -919,7 +899,7 @@ __bad_area_nosemaphore(struct pt_regs *r
+                * Instruction fetch faults in the vsyscall page might need
+                * emulation.
+                */
+-              if (unlikely((error_code & PF_INSTR) &&
++              if (unlikely((error_code & X86_PF_INSTR) &&
+                            ((address & ~0xfff) == VSYSCALL_ADDR))) {
+                       if (emulate_vsyscall(regs, address))
+                               return;
+@@ -932,7 +912,7 @@ __bad_area_nosemaphore(struct pt_regs *r
+                * are always protection faults.
+                */
+               if (address >= TASK_SIZE_MAX)
+-                      error_code |= PF_PROT;
++                      error_code |= X86_PF_PROT;
+               if (likely(show_unhandled_signals))
+                       show_signal_msg(regs, error_code, address, tsk);
+@@ -993,11 +973,11 @@ static inline bool bad_area_access_from_
+       if (!boot_cpu_has(X86_FEATURE_OSPKE))
+               return false;
+-      if (error_code & PF_PK)
++      if (error_code & X86_PF_PK)
+               return true;
+       /* this checks permission keys on the VMA: */
+-      if (!arch_vma_access_permitted(vma, (error_code & PF_WRITE),
+-                              (error_code & PF_INSTR), foreign))
++      if (!arch_vma_access_permitted(vma, (error_code & X86_PF_WRITE),
++                                     (error_code & X86_PF_INSTR), foreign))
+               return true;
+       return false;
+ }
+@@ -1025,7 +1005,7 @@ do_sigbus(struct pt_regs *regs, unsigned
+       int code = BUS_ADRERR;
+       /* Kernel mode? Handle exceptions or die: */
+-      if (!(error_code & PF_USER)) {
++      if (!(error_code & X86_PF_USER)) {
+               no_context(regs, error_code, address, SIGBUS, BUS_ADRERR);
+               return;
+       }
+@@ -1053,14 +1033,14 @@ static noinline void
+ mm_fault_error(struct pt_regs *regs, unsigned long error_code,
+              unsigned long address, u32 *pkey, unsigned int fault)
+ {
+-      if (fatal_signal_pending(current) && !(error_code & PF_USER)) {
++      if (fatal_signal_pending(current) && !(error_code & X86_PF_USER)) {
+               no_context(regs, error_code, address, 0, 0);
+               return;
+       }
+       if (fault & VM_FAULT_OOM) {
+               /* Kernel mode? Handle exceptions or die: */
+-              if (!(error_code & PF_USER)) {
++              if (!(error_code & X86_PF_USER)) {
+                       no_context(regs, error_code, address,
+                                  SIGSEGV, SEGV_MAPERR);
+                       return;
+@@ -1085,16 +1065,16 @@ mm_fault_error(struct pt_regs *regs, uns
+ static int spurious_fault_check(unsigned long error_code, pte_t *pte)
+ {
+-      if ((error_code & PF_WRITE) && !pte_write(*pte))
++      if ((error_code & X86_PF_WRITE) && !pte_write(*pte))
+               return 0;
+-      if ((error_code & PF_INSTR) && !pte_exec(*pte))
++      if ((error_code & X86_PF_INSTR) && !pte_exec(*pte))
+               return 0;
+       /*
+        * Note: We do not do lazy flushing on protection key
+-       * changes, so no spurious fault will ever set PF_PK.
++       * changes, so no spurious fault will ever set X86_PF_PK.
+        */
+-      if ((error_code & PF_PK))
++      if ((error_code & X86_PF_PK))
+               return 1;
+       return 1;
+@@ -1140,8 +1120,8 @@ spurious_fault(unsigned long error_code,
+        * change, so user accesses are not expected to cause spurious
+        * faults.
+        */
+-      if (error_code != (PF_WRITE | PF_PROT)
+-          && error_code != (PF_INSTR | PF_PROT))
++      if (error_code != (X86_PF_WRITE | X86_PF_PROT) &&
++          error_code != (X86_PF_INSTR | X86_PF_PROT))
+               return 0;
+       pgd = init_mm.pgd + pgd_index(address);
+@@ -1201,19 +1181,19 @@ access_error(unsigned long error_code, s
+        * always an unconditional error and can never result in
+        * a follow-up action to resolve the fault, like a COW.
+        */
+-      if (error_code & PF_PK)
++      if (error_code & X86_PF_PK)
+               return 1;
+       /*
+        * Make sure to check the VMA so that we do not perform
+-       * faults just to hit a PF_PK as soon as we fill in a
++       * faults just to hit a X86_PF_PK as soon as we fill in a
+        * page.
+        */
+-      if (!arch_vma_access_permitted(vma, (error_code & PF_WRITE),
+-                              (error_code & PF_INSTR), foreign))
++      if (!arch_vma_access_permitted(vma, (error_code & X86_PF_WRITE),
++                                     (error_code & X86_PF_INSTR), foreign))
+               return 1;
+-      if (error_code & PF_WRITE) {
++      if (error_code & X86_PF_WRITE) {
+               /* write, present and write, not present: */
+               if (unlikely(!(vma->vm_flags & VM_WRITE)))
+                       return 1;
+@@ -1221,7 +1201,7 @@ access_error(unsigned long error_code, s
+       }
+       /* read, present: */
+-      if (unlikely(error_code & PF_PROT))
++      if (unlikely(error_code & X86_PF_PROT))
+               return 1;
+       /* read, not present: */
+@@ -1244,7 +1224,7 @@ static inline bool smap_violation(int er
+       if (!static_cpu_has(X86_FEATURE_SMAP))
+               return false;
+-      if (error_code & PF_USER)
++      if (error_code & X86_PF_USER)
+               return false;
+       if (!user_mode(regs) && (regs->flags & X86_EFLAGS_AC))
+@@ -1297,7 +1277,7 @@ __do_page_fault(struct pt_regs *regs, un
+        * protection error (error_code & 9) == 0.
+        */
+       if (unlikely(fault_in_kernel_space(address))) {
+-              if (!(error_code & (PF_RSVD | PF_USER | PF_PROT))) {
++              if (!(error_code & (X86_PF_RSVD | X86_PF_USER | X86_PF_PROT))) {
+                       if (vmalloc_fault(address) >= 0)
+                               return;
+@@ -1325,7 +1305,7 @@ __do_page_fault(struct pt_regs *regs, un
+       if (unlikely(kprobes_fault(regs)))
+               return;
+-      if (unlikely(error_code & PF_RSVD))
++      if (unlikely(error_code & X86_PF_RSVD))
+               pgtable_bad(regs, error_code, address);
+       if (unlikely(smap_violation(error_code, regs))) {
+@@ -1351,7 +1331,7 @@ __do_page_fault(struct pt_regs *regs, un
+        */
+       if (user_mode(regs)) {
+               local_irq_enable();
+-              error_code |= PF_USER;
++              error_code |= X86_PF_USER;
+               flags |= FAULT_FLAG_USER;
+       } else {
+               if (regs->flags & X86_EFLAGS_IF)
+@@ -1360,9 +1340,9 @@ __do_page_fault(struct pt_regs *regs, un
+       perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, address);
+-      if (error_code & PF_WRITE)
++      if (error_code & X86_PF_WRITE)
+               flags |= FAULT_FLAG_WRITE;
+-      if (error_code & PF_INSTR)
++      if (error_code & X86_PF_INSTR)
+               flags |= FAULT_FLAG_INSTRUCTION;
+       /*
+@@ -1382,7 +1362,7 @@ __do_page_fault(struct pt_regs *regs, un
+        * space check, thus avoiding the deadlock:
+        */
+       if (unlikely(!down_read_trylock(&mm->mmap_sem))) {
+-              if ((error_code & PF_USER) == 0 &&
++              if (!(error_code & X86_PF_USER) &&
+                   !search_exception_tables(regs->ip)) {
+                       bad_area_nosemaphore(regs, error_code, address, NULL);
+                       return;
+@@ -1409,7 +1389,7 @@ retry:
+               bad_area(regs, error_code, address);
+               return;
+       }
+-      if (error_code & PF_USER) {
++      if (error_code & X86_PF_USER) {
+               /*
+                * Accessing the stack below %sp is always a bug.
+                * The large cushion allows instructions like enter
diff --git a/queue-4.14/x86-platform-uv-convert-timers-to-use-timer_setup.patch b/queue-4.14/x86-platform-uv-convert-timers-to-use-timer_setup.patch
new file mode 100644 (file)
index 0000000..e8432e3
--- /dev/null
@@ -0,0 +1,47 @@
+From 376f3bcebdc999cc737d9052109cc33b573b3a8b Mon Sep 17 00:00:00 2001
+From: Kees Cook <keescook@chromium.org>
+Date: Mon, 16 Oct 2017 16:22:31 -0700
+Subject: x86/platform/UV: Convert timers to use timer_setup()
+
+From: Kees Cook <keescook@chromium.org>
+
+commit 376f3bcebdc999cc737d9052109cc33b573b3a8b upstream.
+
+In preparation for unconditionally passing the struct timer_list pointer to
+all timer callbacks, switch to using the new timer_setup() and from_timer()
+to pass the timer pointer explicitly.
+
+Signed-off-by: Kees Cook <keescook@chromium.org>
+Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
+Cc: Dimitri Sivanich <sivanich@hpe.com>
+Cc: Russ Anderson <rja@hpe.com>
+Cc: Mike Travis <mike.travis@hpe.com>
+Link: https://lkml.kernel.org/r/20171016232231.GA100493@beast
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/x86/kernel/apic/x2apic_uv_x.c |    5 ++---
+ 1 file changed, 2 insertions(+), 3 deletions(-)
+
+--- a/arch/x86/kernel/apic/x2apic_uv_x.c
++++ b/arch/x86/kernel/apic/x2apic_uv_x.c
+@@ -920,9 +920,8 @@ static __init void uv_rtc_init(void)
+ /*
+  * percpu heartbeat timer
+  */
+-static void uv_heartbeat(unsigned long ignored)
++static void uv_heartbeat(struct timer_list *timer)
+ {
+-      struct timer_list *timer = &uv_scir_info->timer;
+       unsigned char bits = uv_scir_info->state;
+       /* Flip heartbeat bit: */
+@@ -947,7 +946,7 @@ static int uv_heartbeat_enable(unsigned
+               struct timer_list *timer = &uv_cpu_scir_info(cpu)->timer;
+               uv_set_cpu_scir_bits(cpu, SCIR_CPU_HEARTBEAT|SCIR_CPU_ACTIVITY);
+-              setup_pinned_timer(timer, uv_heartbeat, cpu);
++              timer_setup(timer, uv_heartbeat, TIMER_PINNED);
+               timer->expires = jiffies + SCIR_CPU_HB_INTERVAL;
+               add_timer_on(timer, cpu);
+               uv_cpu_scir_info(cpu)->enabled = 1;
diff --git a/queue-4.14/x86-unwind-make-config_unwinder_orc-y-the-default-in-kconfig-for-64-bit.patch b/queue-4.14/x86-unwind-make-config_unwinder_orc-y-the-default-in-kconfig-for-64-bit.patch
new file mode 100644 (file)
index 0000000..6a5dbc6
--- /dev/null
@@ -0,0 +1,80 @@
+From fc72ae40e30327aa24eb88a24b9c7058f938bd36 Mon Sep 17 00:00:00 2001
+From: Josh Poimboeuf <jpoimboe@redhat.com>
+Date: Fri, 13 Oct 2017 15:02:01 -0500
+Subject: x86/unwind: Make CONFIG_UNWINDER_ORC=y the default in kconfig for 64-bit
+
+From: Josh Poimboeuf <jpoimboe@redhat.com>
+
+commit fc72ae40e30327aa24eb88a24b9c7058f938bd36 upstream.
+
+The ORC unwinder has been stable in testing so far.  Give it much wider
+testing by making it the default in kconfig for x86_64.  It's not yet
+supported for 32-bit, so leave frame pointers as the default there.
+
+Suggested-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
+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/9b1237bbe7244ed9cdf8db2dcb1253e37e1c341e.1507924831.git.jpoimboe@redhat.com
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/x86/Kconfig.debug |   33 +++++++++++++++++----------------
+ 1 file changed, 17 insertions(+), 16 deletions(-)
+
+--- a/arch/x86/Kconfig.debug
++++ b/arch/x86/Kconfig.debug
+@@ -359,27 +359,13 @@ config PUNIT_ATOM_DEBUG
+ choice
+       prompt "Choose kernel unwinder"
+-      default UNWINDER_FRAME_POINTER
++      default UNWINDER_ORC if X86_64
++      default UNWINDER_FRAME_POINTER if X86_32
+       ---help---
+         This determines which method will be used for unwinding kernel stack
+         traces for panics, oopses, bugs, warnings, perf, /proc/<pid>/stack,
+         livepatch, lockdep, and more.
+-config UNWINDER_FRAME_POINTER
+-      bool "Frame pointer unwinder"
+-      select FRAME_POINTER
+-      ---help---
+-        This option enables the frame pointer unwinder for unwinding kernel
+-        stack traces.
+-
+-        The unwinder itself is fast and it uses less RAM than the ORC
+-        unwinder, but the kernel text size will grow by ~3% and the kernel's
+-        overall performance will degrade by roughly 5-10%.
+-
+-        This option is recommended if you want to use the livepatch
+-        consistency model, as this is currently the only way to get a
+-        reliable stack trace (CONFIG_HAVE_RELIABLE_STACKTRACE).
+-
+ config UNWINDER_ORC
+       bool "ORC unwinder"
+       depends on X86_64
+@@ -396,6 +382,21 @@ config UNWINDER_ORC
+         Enabling this option will increase the kernel's runtime memory usage
+         by roughly 2-4MB, depending on your kernel config.
++config UNWINDER_FRAME_POINTER
++      bool "Frame pointer unwinder"
++      select FRAME_POINTER
++      ---help---
++        This option enables the frame pointer unwinder for unwinding kernel
++        stack traces.
++
++        The unwinder itself is fast and it uses less RAM than the ORC
++        unwinder, but the kernel text size will grow by ~3% and the kernel's
++        overall performance will degrade by roughly 5-10%.
++
++        This option is recommended if you want to use the livepatch
++        consistency model, as this is currently the only way to get a
++        reliable stack trace (CONFIG_HAVE_RELIABLE_STACKTRACE).
++
+ config UNWINDER_GUESS
+       bool "Guess unwinder"
+       depends on EXPERT
diff --git a/queue-4.14/x86-unwind-rename-unwinder-config-options-to-config_unwinder_.patch b/queue-4.14/x86-unwind-rename-unwinder-config-options-to-config_unwinder_.patch
new file mode 100644 (file)
index 0000000..d670ddd
--- /dev/null
@@ -0,0 +1,241 @@
+From 11af847446ed0d131cf24d16a7ef3d5ea7a49554 Mon Sep 17 00:00:00 2001
+From: Josh Poimboeuf <jpoimboe@redhat.com>
+Date: Fri, 13 Oct 2017 15:02:00 -0500
+Subject: x86/unwind: Rename unwinder config options to 'CONFIG_UNWINDER_*'
+
+From: Josh Poimboeuf <jpoimboe@redhat.com>
+
+commit 11af847446ed0d131cf24d16a7ef3d5ea7a49554 upstream.
+
+Rename the unwinder config options from:
+
+  CONFIG_ORC_UNWINDER
+  CONFIG_FRAME_POINTER_UNWINDER
+  CONFIG_GUESS_UNWINDER
+
+to:
+
+  CONFIG_UNWINDER_ORC
+  CONFIG_UNWINDER_FRAME_POINTER
+  CONFIG_UNWINDER_GUESS
+
+... in order to give them a more logical config namespace.
+
+Suggested-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
+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/73972fc7e2762e91912c6b9584582703d6f1b8cc.1507924831.git.jpoimboe@redhat.com
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ Documentation/x86/orc-unwinder.txt |    2 +-
+ Makefile                           |    4 ++--
+ arch/x86/Kconfig                   |    2 +-
+ arch/x86/Kconfig.debug             |   10 +++++-----
+ arch/x86/configs/tiny.config       |    4 ++--
+ arch/x86/configs/x86_64_defconfig  |    2 +-
+ arch/x86/include/asm/module.h      |    2 +-
+ arch/x86/include/asm/unwind.h      |    8 ++++----
+ arch/x86/kernel/Makefile           |    6 +++---
+ include/asm-generic/vmlinux.lds.h  |    2 +-
+ lib/Kconfig.debug                  |    2 +-
+ scripts/Makefile.build             |    2 +-
+ 12 files changed, 23 insertions(+), 23 deletions(-)
+
+--- a/Documentation/x86/orc-unwinder.txt
++++ b/Documentation/x86/orc-unwinder.txt
+@@ -4,7 +4,7 @@ ORC unwinder
+ Overview
+ --------
+-The kernel CONFIG_ORC_UNWINDER option enables the ORC unwinder, which is
++The kernel CONFIG_UNWINDER_ORC option enables the ORC unwinder, which is
+ similar in concept to a DWARF unwinder.  The difference is that the
+ format of the ORC data is much simpler than DWARF, which in turn allows
+ the ORC unwinder to be much simpler and faster.
+--- a/Makefile
++++ b/Makefile
+@@ -935,8 +935,8 @@ ifdef CONFIG_STACK_VALIDATION
+   ifeq ($(has_libelf),1)
+     objtool_target := tools/objtool FORCE
+   else
+-    ifdef CONFIG_ORC_UNWINDER
+-      $(error "Cannot generate ORC metadata for CONFIG_ORC_UNWINDER=y, please install libelf-dev, libelf-devel or elfutils-libelf-devel")
++    ifdef CONFIG_UNWINDER_ORC
++      $(error "Cannot generate ORC metadata for CONFIG_UNWINDER_ORC=y, please install libelf-dev, libelf-devel or elfutils-libelf-devel")
+     else
+       $(warning "Cannot use CONFIG_STACK_VALIDATION=y, please install libelf-dev, libelf-devel or elfutils-libelf-devel")
+     endif
+--- a/arch/x86/Kconfig
++++ b/arch/x86/Kconfig
+@@ -171,7 +171,7 @@ config X86
+       select HAVE_PERF_USER_STACK_DUMP
+       select HAVE_RCU_TABLE_FREE
+       select HAVE_REGS_AND_STACK_ACCESS_API
+-      select HAVE_RELIABLE_STACKTRACE         if X86_64 && FRAME_POINTER_UNWINDER && STACK_VALIDATION
++      select HAVE_RELIABLE_STACKTRACE         if X86_64 && UNWINDER_FRAME_POINTER && STACK_VALIDATION
+       select HAVE_STACK_VALIDATION            if X86_64
+       select HAVE_SYSCALL_TRACEPOINTS
+       select HAVE_UNSTABLE_SCHED_CLOCK
+--- a/arch/x86/Kconfig.debug
++++ b/arch/x86/Kconfig.debug
+@@ -359,13 +359,13 @@ config PUNIT_ATOM_DEBUG
+ choice
+       prompt "Choose kernel unwinder"
+-      default FRAME_POINTER_UNWINDER
++      default UNWINDER_FRAME_POINTER
+       ---help---
+         This determines which method will be used for unwinding kernel stack
+         traces for panics, oopses, bugs, warnings, perf, /proc/<pid>/stack,
+         livepatch, lockdep, and more.
+-config FRAME_POINTER_UNWINDER
++config UNWINDER_FRAME_POINTER
+       bool "Frame pointer unwinder"
+       select FRAME_POINTER
+       ---help---
+@@ -380,7 +380,7 @@ config FRAME_POINTER_UNWINDER
+         consistency model, as this is currently the only way to get a
+         reliable stack trace (CONFIG_HAVE_RELIABLE_STACKTRACE).
+-config ORC_UNWINDER
++config UNWINDER_ORC
+       bool "ORC unwinder"
+       depends on X86_64
+       select STACK_VALIDATION
+@@ -396,7 +396,7 @@ config ORC_UNWINDER
+         Enabling this option will increase the kernel's runtime memory usage
+         by roughly 2-4MB, depending on your kernel config.
+-config GUESS_UNWINDER
++config UNWINDER_GUESS
+       bool "Guess unwinder"
+       depends on EXPERT
+       ---help---
+@@ -411,7 +411,7 @@ config GUESS_UNWINDER
+ endchoice
+ config FRAME_POINTER
+-      depends on !ORC_UNWINDER && !GUESS_UNWINDER
++      depends on !UNWINDER_ORC && !UNWINDER_GUESS
+       bool
+ endmenu
+--- a/arch/x86/configs/tiny.config
++++ b/arch/x86/configs/tiny.config
+@@ -1,5 +1,5 @@
+ CONFIG_NOHIGHMEM=y
+ # CONFIG_HIGHMEM4G is not set
+ # CONFIG_HIGHMEM64G is not set
+-CONFIG_GUESS_UNWINDER=y
+-# CONFIG_FRAME_POINTER_UNWINDER is not set
++CONFIG_UNWINDER_GUESS=y
++# CONFIG_UNWINDER_FRAME_POINTER is not set
+--- a/arch/x86/configs/x86_64_defconfig
++++ b/arch/x86/configs/x86_64_defconfig
+@@ -299,7 +299,7 @@ CONFIG_DEBUG_STACKOVERFLOW=y
+ # CONFIG_DEBUG_RODATA_TEST is not set
+ CONFIG_DEBUG_BOOT_PARAMS=y
+ CONFIG_OPTIMIZE_INLINING=y
+-CONFIG_ORC_UNWINDER=y
++CONFIG_UNWINDER_ORC=y
+ CONFIG_SECURITY=y
+ CONFIG_SECURITY_NETWORK=y
+ CONFIG_SECURITY_SELINUX=y
+--- a/arch/x86/include/asm/module.h
++++ b/arch/x86/include/asm/module.h
+@@ -6,7 +6,7 @@
+ #include <asm/orc_types.h>
+ struct mod_arch_specific {
+-#ifdef CONFIG_ORC_UNWINDER
++#ifdef CONFIG_UNWINDER_ORC
+       unsigned int num_orcs;
+       int *orc_unwind_ip;
+       struct orc_entry *orc_unwind;
+--- a/arch/x86/include/asm/unwind.h
++++ b/arch/x86/include/asm/unwind.h
+@@ -13,11 +13,11 @@ struct unwind_state {
+       struct task_struct *task;
+       int graph_idx;
+       bool error;
+-#if defined(CONFIG_ORC_UNWINDER)
++#if defined(CONFIG_UNWINDER_ORC)
+       bool signal, full_regs;
+       unsigned long sp, bp, ip;
+       struct pt_regs *regs;
+-#elif defined(CONFIG_FRAME_POINTER_UNWINDER)
++#elif defined(CONFIG_UNWINDER_FRAME_POINTER)
+       bool got_irq;
+       unsigned long *bp, *orig_sp, ip;
+       struct pt_regs *regs;
+@@ -51,7 +51,7 @@ void unwind_start(struct unwind_state *s
+       __unwind_start(state, task, regs, first_frame);
+ }
+-#if defined(CONFIG_ORC_UNWINDER) || defined(CONFIG_FRAME_POINTER_UNWINDER)
++#if defined(CONFIG_UNWINDER_ORC) || defined(CONFIG_UNWINDER_FRAME_POINTER)
+ static inline struct pt_regs *unwind_get_entry_regs(struct unwind_state *state)
+ {
+       if (unwind_done(state))
+@@ -66,7 +66,7 @@ static inline struct pt_regs *unwind_get
+ }
+ #endif
+-#ifdef CONFIG_ORC_UNWINDER
++#ifdef CONFIG_UNWINDER_ORC
+ void unwind_init(void);
+ void unwind_module_init(struct module *mod, void *orc_ip, size_t orc_ip_size,
+                       void *orc, size_t orc_size);
+--- a/arch/x86/kernel/Makefile
++++ b/arch/x86/kernel/Makefile
+@@ -127,9 +127,9 @@ obj-$(CONFIG_PERF_EVENTS)          += perf_regs.
+ obj-$(CONFIG_TRACING)                 += tracepoint.o
+ obj-$(CONFIG_SCHED_MC_PRIO)           += itmt.o
+-obj-$(CONFIG_ORC_UNWINDER)            += unwind_orc.o
+-obj-$(CONFIG_FRAME_POINTER_UNWINDER)  += unwind_frame.o
+-obj-$(CONFIG_GUESS_UNWINDER)          += unwind_guess.o
++obj-$(CONFIG_UNWINDER_ORC)            += unwind_orc.o
++obj-$(CONFIG_UNWINDER_FRAME_POINTER)  += unwind_frame.o
++obj-$(CONFIG_UNWINDER_GUESS)          += unwind_guess.o
+ ###
+ # 64 bit specific files
+--- a/include/asm-generic/vmlinux.lds.h
++++ b/include/asm-generic/vmlinux.lds.h
+@@ -688,7 +688,7 @@
+ #define BUG_TABLE
+ #endif
+-#ifdef CONFIG_ORC_UNWINDER
++#ifdef CONFIG_UNWINDER_ORC
+ #define ORC_UNWIND_TABLE                                              \
+       . = ALIGN(4);                                                   \
+       .orc_unwind_ip : AT(ADDR(.orc_unwind_ip) - LOAD_OFFSET) {       \
+--- a/lib/Kconfig.debug
++++ b/lib/Kconfig.debug
+@@ -376,7 +376,7 @@ config STACK_VALIDATION
+         that runtime stack traces are more reliable.
+         This is also a prerequisite for generation of ORC unwind data, which
+-        is needed for CONFIG_ORC_UNWINDER.
++        is needed for CONFIG_UNWINDER_ORC.
+         For more information, see
+         tools/objtool/Documentation/stack-validation.txt.
+--- a/scripts/Makefile.build
++++ b/scripts/Makefile.build
+@@ -259,7 +259,7 @@ ifneq ($(SKIP_STACK_VALIDATION),1)
+ __objtool_obj := $(objtree)/tools/objtool/objtool
+-objtool_args = $(if $(CONFIG_ORC_UNWINDER),orc generate,check)
++objtool_args = $(if $(CONFIG_UNWINDER_ORC),orc generate,check)
+ ifndef CONFIG_FRAME_POINTER
+ objtool_args += --no-fp
diff --git a/queue-4.14/x86-unwinder-make-config_unwinder_orc-y-the-default-in-the-64-bit-defconfig.patch b/queue-4.14/x86-unwinder-make-config_unwinder_orc-y-the-default-in-the-64-bit-defconfig.patch
new file mode 100644 (file)
index 0000000..d6aae5a
--- /dev/null
@@ -0,0 +1,34 @@
+From 1e4078f0bba46ad61b69548abe6a6faf63b89380 Mon Sep 17 00:00:00 2001
+From: Ingo Molnar <mingo@kernel.org>
+Date: Thu, 12 Oct 2017 09:24:30 +0200
+Subject: x86/unwinder: Make CONFIG_UNWINDER_ORC=y the default in the 64-bit defconfig
+
+From: Ingo Molnar <mingo@kernel.org>
+
+commit 1e4078f0bba46ad61b69548abe6a6faf63b89380 upstream.
+
+Increase testing coverage by turning on the primary x86 unwinder for
+the 64-bit defconfig.
+
+Cc: Josh Poimboeuf <jpoimboe@redhat.com>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Cc: linux-kernel@vger.kernel.org
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/x86/configs/x86_64_defconfig |    1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/arch/x86/configs/x86_64_defconfig
++++ b/arch/x86/configs/x86_64_defconfig
+@@ -299,6 +299,7 @@ CONFIG_DEBUG_STACKOVERFLOW=y
+ # CONFIG_DEBUG_RODATA_TEST is not set
+ CONFIG_DEBUG_BOOT_PARAMS=y
+ CONFIG_OPTIMIZE_INLINING=y
++CONFIG_ORC_UNWINDER=y
+ CONFIG_SECURITY=y
+ CONFIG_SECURITY_NETWORK=y
+ CONFIG_SECURITY_SELINUX=y
diff --git a/queue-4.14/x86-xen-add-unwind-hint-annotations.patch b/queue-4.14/x86-xen-add-unwind-hint-annotations.patch
new file mode 100644 (file)
index 0000000..559d66a
--- /dev/null
@@ -0,0 +1,61 @@
+From abbe1cac6214d81d2f4e149aba64a8760703144e Mon Sep 17 00:00:00 2001
+From: Josh Poimboeuf <jpoimboe@redhat.com>
+Date: Mon, 18 Sep 2017 21:43:36 -0500
+Subject: x86/xen: Add unwind hint annotations
+
+From: Josh Poimboeuf <jpoimboe@redhat.com>
+
+commit abbe1cac6214d81d2f4e149aba64a8760703144e upstream.
+
+Add unwind hint annotations to the xen head code so the ORC unwinder can
+read head_64.o.
+
+hypercall_page needs empty annotations at 32-byte intervals to match the
+'xen_hypercall_*' ELF functions at those locations.
+
+Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
+Cc: Andy Lutomirski <luto@kernel.org>
+Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
+Cc: Jiri Slaby <jslaby@suse.cz>
+Cc: Juergen Gross <jgross@suse.com>
+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/70ed2eb516fe9266be766d953f93c2571bca88cc.1505764066.git.jpoimboe@redhat.com
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/x86/xen/xen-head.S |    7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+--- a/arch/x86/xen/xen-head.S
++++ b/arch/x86/xen/xen-head.S
+@@ -10,6 +10,7 @@
+ #include <asm/boot.h>
+ #include <asm/asm.h>
+ #include <asm/page_types.h>
++#include <asm/unwind_hints.h>
+ #include <xen/interface/elfnote.h>
+ #include <xen/interface/features.h>
+@@ -20,6 +21,7 @@
+ #ifdef CONFIG_XEN_PV
+       __INIT
+ ENTRY(startup_xen)
++      UNWIND_HINT_EMPTY
+       cld
+       /* Clear .bss */
+@@ -41,7 +43,10 @@ END(startup_xen)
+ .pushsection .text
+       .balign PAGE_SIZE
+ ENTRY(hypercall_page)
+-      .skip PAGE_SIZE
++      .rept (PAGE_SIZE / 32)
++              UNWIND_HINT_EMPTY
++              .skip 32
++      .endr
+ #define HYPERCALL(n) \
+       .equ xen_hypercall_##n, hypercall_page + __HYPERVISOR_##n * 32; \
diff --git a/queue-4.14/x86-xen-drop-5-level-paging-support-code-from-the-xen_pv-code.patch b/queue-4.14/x86-xen-drop-5-level-paging-support-code-from-the-xen_pv-code.patch
new file mode 100644 (file)
index 0000000..cff5cda
--- /dev/null
@@ -0,0 +1,306 @@
+From 773dd2fca581b0a80e5a33332cc8ee67e5a79cba Mon Sep 17 00:00:00 2001
+From: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
+Date: Fri, 29 Sep 2017 17:08:20 +0300
+Subject: x86/xen: Drop 5-level paging support code from the XEN_PV code
+
+From: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
+
+commit 773dd2fca581b0a80e5a33332cc8ee67e5a79cba upstream.
+
+It was decided 5-level paging is not going to be supported in XEN_PV.
+
+Let's drop the dead code from the XEN_PV code.
+
+Tested-by: Juergen Gross <jgross@suse.com>
+Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
+Reviewed-by: Juergen Gross <jgross@suse.com>
+Cc: Andrew Morton <akpm@linux-foundation.org>
+Cc: Andy Lutomirski <luto@amacapital.net>
+Cc: Borislav Petkov <bp@suse.de>
+Cc: Cyrill Gorcunov <gorcunov@openvz.org>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Cc: linux-mm@kvack.org
+Link: http://lkml.kernel.org/r/20170929140821.37654-6-kirill.shutemov@linux.intel.com
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/x86/xen/mmu_pv.c |  159 ++++++++++++++++++--------------------------------
+ 1 file changed, 60 insertions(+), 99 deletions(-)
+
+--- a/arch/x86/xen/mmu_pv.c
++++ b/arch/x86/xen/mmu_pv.c
+@@ -449,7 +449,7 @@ __visible pmd_t xen_make_pmd(pmdval_t pm
+ }
+ PV_CALLEE_SAVE_REGS_THUNK(xen_make_pmd);
+-#if CONFIG_PGTABLE_LEVELS == 4
++#ifdef CONFIG_X86_64
+ __visible pudval_t xen_pud_val(pud_t pud)
+ {
+       return pte_mfn_to_pfn(pud.pud);
+@@ -538,7 +538,7 @@ static void xen_set_p4d(p4d_t *ptr, p4d_
+       xen_mc_issue(PARAVIRT_LAZY_MMU);
+ }
+-#endif        /* CONFIG_PGTABLE_LEVELS == 4 */
++#endif        /* CONFIG_X86_64 */
+ static int xen_pmd_walk(struct mm_struct *mm, pmd_t *pmd,
+               int (*func)(struct mm_struct *mm, struct page *, enum pt_level),
+@@ -580,21 +580,17 @@ static int xen_p4d_walk(struct mm_struct
+               int (*func)(struct mm_struct *mm, struct page *, enum pt_level),
+               bool last, unsigned long limit)
+ {
+-      int i, nr, flush = 0;
++      int flush = 0;
++      pud_t *pud;
+-      nr = last ? p4d_index(limit) + 1 : PTRS_PER_P4D;
+-      for (i = 0; i < nr; i++) {
+-              pud_t *pud;
+-              if (p4d_none(p4d[i]))
+-                      continue;
++      if (p4d_none(*p4d))
++              return flush;
+-              pud = pud_offset(&p4d[i], 0);
+-              if (PTRS_PER_PUD > 1)
+-                      flush |= (*func)(mm, virt_to_page(pud), PT_PUD);
+-              flush |= xen_pud_walk(mm, pud, func,
+-                              last && i == nr - 1, limit);
+-      }
++      pud = pud_offset(p4d, 0);
++      if (PTRS_PER_PUD > 1)
++              flush |= (*func)(mm, virt_to_page(pud), PT_PUD);
++      flush |= xen_pud_walk(mm, pud, func, last, limit);
+       return flush;
+ }
+@@ -644,8 +640,6 @@ static int __xen_pgd_walk(struct mm_stru
+                       continue;
+               p4d = p4d_offset(&pgd[i], 0);
+-              if (PTRS_PER_P4D > 1)
+-                      flush |= (*func)(mm, virt_to_page(p4d), PT_P4D);
+               flush |= xen_p4d_walk(mm, p4d, func, i == nr - 1, limit);
+       }
+@@ -1176,22 +1170,14 @@ static void __init xen_cleanmfnmap(unsig
+ {
+       pgd_t *pgd;
+       p4d_t *p4d;
+-      unsigned int i;
+       bool unpin;
+       unpin = (vaddr == 2 * PGDIR_SIZE);
+       vaddr &= PMD_MASK;
+       pgd = pgd_offset_k(vaddr);
+       p4d = p4d_offset(pgd, 0);
+-      for (i = 0; i < PTRS_PER_P4D; i++) {
+-              if (p4d_none(p4d[i]))
+-                      continue;
+-              xen_cleanmfnmap_p4d(p4d + i, unpin);
+-      }
+-      if (IS_ENABLED(CONFIG_X86_5LEVEL)) {
+-              set_pgd(pgd, __pgd(0));
+-              xen_cleanmfnmap_free_pgtbl(p4d, unpin);
+-      }
++      if (!p4d_none(*p4d))
++              xen_cleanmfnmap_p4d(p4d, unpin);
+ }
+ static void __init xen_pagetable_p2m_free(void)
+@@ -1692,7 +1678,7 @@ static void xen_release_pmd(unsigned lon
+       xen_release_ptpage(pfn, PT_PMD);
+ }
+-#if CONFIG_PGTABLE_LEVELS >= 4
++#ifdef CONFIG_X86_64
+ static void xen_alloc_pud(struct mm_struct *mm, unsigned long pfn)
+ {
+       xen_alloc_ptpage(mm, pfn, PT_PUD);
+@@ -2029,13 +2015,12 @@ static phys_addr_t __init xen_early_virt
+  */
+ void __init xen_relocate_p2m(void)
+ {
+-      phys_addr_t size, new_area, pt_phys, pmd_phys, pud_phys, p4d_phys;
++      phys_addr_t size, new_area, pt_phys, pmd_phys, pud_phys;
+       unsigned long p2m_pfn, p2m_pfn_end, n_frames, pfn, pfn_end;
+-      int n_pte, n_pt, n_pmd, n_pud, n_p4d, idx_pte, idx_pt, idx_pmd, idx_pud, idx_p4d;
++      int n_pte, n_pt, n_pmd, n_pud, idx_pte, idx_pt, idx_pmd, idx_pud;
+       pte_t *pt;
+       pmd_t *pmd;
+       pud_t *pud;
+-      p4d_t *p4d = NULL;
+       pgd_t *pgd;
+       unsigned long *new_p2m;
+       int save_pud;
+@@ -2045,11 +2030,7 @@ void __init xen_relocate_p2m(void)
+       n_pt = roundup(size, PMD_SIZE) >> PMD_SHIFT;
+       n_pmd = roundup(size, PUD_SIZE) >> PUD_SHIFT;
+       n_pud = roundup(size, P4D_SIZE) >> P4D_SHIFT;
+-      if (PTRS_PER_P4D > 1)
+-              n_p4d = roundup(size, PGDIR_SIZE) >> PGDIR_SHIFT;
+-      else
+-              n_p4d = 0;
+-      n_frames = n_pte + n_pt + n_pmd + n_pud + n_p4d;
++      n_frames = n_pte + n_pt + n_pmd + n_pud;
+       new_area = xen_find_free_area(PFN_PHYS(n_frames));
+       if (!new_area) {
+@@ -2065,76 +2046,56 @@ void __init xen_relocate_p2m(void)
+        * To avoid any possible virtual address collision, just use
+        * 2 * PUD_SIZE for the new area.
+        */
+-      p4d_phys = new_area;
+-      pud_phys = p4d_phys + PFN_PHYS(n_p4d);
++      pud_phys = new_area;
+       pmd_phys = pud_phys + PFN_PHYS(n_pud);
+       pt_phys = pmd_phys + PFN_PHYS(n_pmd);
+       p2m_pfn = PFN_DOWN(pt_phys) + n_pt;
+       pgd = __va(read_cr3_pa());
+       new_p2m = (unsigned long *)(2 * PGDIR_SIZE);
+-      idx_p4d = 0;
+       save_pud = n_pud;
+-      do {
+-              if (n_p4d > 0) {
+-                      p4d = early_memremap(p4d_phys, PAGE_SIZE);
+-                      clear_page(p4d);
+-                      n_pud = min(save_pud, PTRS_PER_P4D);
+-              }
+-              for (idx_pud = 0; idx_pud < n_pud; idx_pud++) {
+-                      pud = early_memremap(pud_phys, PAGE_SIZE);
+-                      clear_page(pud);
+-                      for (idx_pmd = 0; idx_pmd < min(n_pmd, PTRS_PER_PUD);
+-                               idx_pmd++) {
+-                              pmd = early_memremap(pmd_phys, PAGE_SIZE);
+-                              clear_page(pmd);
+-                              for (idx_pt = 0; idx_pt < min(n_pt, PTRS_PER_PMD);
+-                                       idx_pt++) {
+-                                      pt = early_memremap(pt_phys, PAGE_SIZE);
+-                                      clear_page(pt);
+-                                      for (idx_pte = 0;
+-                                               idx_pte < min(n_pte, PTRS_PER_PTE);
+-                                               idx_pte++) {
+-                                              set_pte(pt + idx_pte,
+-                                                              pfn_pte(p2m_pfn, PAGE_KERNEL));
+-                                              p2m_pfn++;
+-                                      }
+-                                      n_pte -= PTRS_PER_PTE;
+-                                      early_memunmap(pt, PAGE_SIZE);
+-                                      make_lowmem_page_readonly(__va(pt_phys));
+-                                      pin_pagetable_pfn(MMUEXT_PIN_L1_TABLE,
+-                                                      PFN_DOWN(pt_phys));
+-                                      set_pmd(pmd + idx_pt,
+-                                                      __pmd(_PAGE_TABLE | pt_phys));
+-                                      pt_phys += PAGE_SIZE;
++      for (idx_pud = 0; idx_pud < n_pud; idx_pud++) {
++              pud = early_memremap(pud_phys, PAGE_SIZE);
++              clear_page(pud);
++              for (idx_pmd = 0; idx_pmd < min(n_pmd, PTRS_PER_PUD);
++                              idx_pmd++) {
++                      pmd = early_memremap(pmd_phys, PAGE_SIZE);
++                      clear_page(pmd);
++                      for (idx_pt = 0; idx_pt < min(n_pt, PTRS_PER_PMD);
++                                      idx_pt++) {
++                              pt = early_memremap(pt_phys, PAGE_SIZE);
++                              clear_page(pt);
++                              for (idx_pte = 0;
++                                              idx_pte < min(n_pte, PTRS_PER_PTE);
++                                              idx_pte++) {
++                                      set_pte(pt + idx_pte,
++                                                      pfn_pte(p2m_pfn, PAGE_KERNEL));
++                                      p2m_pfn++;
+                               }
+-                              n_pt -= PTRS_PER_PMD;
+-                              early_memunmap(pmd, PAGE_SIZE);
+-                              make_lowmem_page_readonly(__va(pmd_phys));
+-                              pin_pagetable_pfn(MMUEXT_PIN_L2_TABLE,
+-                                              PFN_DOWN(pmd_phys));
+-                              set_pud(pud + idx_pmd, __pud(_PAGE_TABLE | pmd_phys));
+-                              pmd_phys += PAGE_SIZE;
++                              n_pte -= PTRS_PER_PTE;
++                              early_memunmap(pt, PAGE_SIZE);
++                              make_lowmem_page_readonly(__va(pt_phys));
++                              pin_pagetable_pfn(MMUEXT_PIN_L1_TABLE,
++                                              PFN_DOWN(pt_phys));
++                              set_pmd(pmd + idx_pt,
++                                              __pmd(_PAGE_TABLE | pt_phys));
++                              pt_phys += PAGE_SIZE;
+                       }
+-                      n_pmd -= PTRS_PER_PUD;
+-                      early_memunmap(pud, PAGE_SIZE);
+-                      make_lowmem_page_readonly(__va(pud_phys));
+-                      pin_pagetable_pfn(MMUEXT_PIN_L3_TABLE, PFN_DOWN(pud_phys));
+-                      if (n_p4d > 0)
+-                              set_p4d(p4d + idx_pud, __p4d(_PAGE_TABLE | pud_phys));
+-                      else
+-                              set_pgd(pgd + 2 + idx_pud, __pgd(_PAGE_TABLE | pud_phys));
+-                      pud_phys += PAGE_SIZE;
+-              }
+-              if (n_p4d > 0) {
+-                      save_pud -= PTRS_PER_P4D;
+-                      early_memunmap(p4d, PAGE_SIZE);
+-                      make_lowmem_page_readonly(__va(p4d_phys));
+-                      pin_pagetable_pfn(MMUEXT_PIN_L4_TABLE, PFN_DOWN(p4d_phys));
+-                      set_pgd(pgd + 2 + idx_p4d, __pgd(_PAGE_TABLE | p4d_phys));
+-                      p4d_phys += PAGE_SIZE;
++                      n_pt -= PTRS_PER_PMD;
++                      early_memunmap(pmd, PAGE_SIZE);
++                      make_lowmem_page_readonly(__va(pmd_phys));
++                      pin_pagetable_pfn(MMUEXT_PIN_L2_TABLE,
++                                      PFN_DOWN(pmd_phys));
++                      set_pud(pud + idx_pmd, __pud(_PAGE_TABLE | pmd_phys));
++                      pmd_phys += PAGE_SIZE;
+               }
+-      } while (++idx_p4d < n_p4d);
++              n_pmd -= PTRS_PER_PUD;
++              early_memunmap(pud, PAGE_SIZE);
++              make_lowmem_page_readonly(__va(pud_phys));
++              pin_pagetable_pfn(MMUEXT_PIN_L3_TABLE, PFN_DOWN(pud_phys));
++              set_pgd(pgd + 2 + idx_pud, __pgd(_PAGE_TABLE | pud_phys));
++              pud_phys += PAGE_SIZE;
++      }
+       /* Now copy the old p2m info to the new area. */
+       memcpy(new_p2m, xen_p2m_addr, size);
+@@ -2361,7 +2322,7 @@ static void __init xen_post_allocator_in
+       pv_mmu_ops.set_pte = xen_set_pte;
+       pv_mmu_ops.set_pmd = xen_set_pmd;
+       pv_mmu_ops.set_pud = xen_set_pud;
+-#if CONFIG_PGTABLE_LEVELS >= 4
++#ifdef CONFIG_X86_64
+       pv_mmu_ops.set_p4d = xen_set_p4d;
+ #endif
+@@ -2371,7 +2332,7 @@ static void __init xen_post_allocator_in
+       pv_mmu_ops.alloc_pmd = xen_alloc_pmd;
+       pv_mmu_ops.release_pte = xen_release_pte;
+       pv_mmu_ops.release_pmd = xen_release_pmd;
+-#if CONFIG_PGTABLE_LEVELS >= 4
++#ifdef CONFIG_X86_64
+       pv_mmu_ops.alloc_pud = xen_alloc_pud;
+       pv_mmu_ops.release_pud = xen_release_pud;
+ #endif
+@@ -2435,14 +2396,14 @@ static const struct pv_mmu_ops xen_mmu_o
+       .make_pmd = PV_CALLEE_SAVE(xen_make_pmd),
+       .pmd_val = PV_CALLEE_SAVE(xen_pmd_val),
+-#if CONFIG_PGTABLE_LEVELS >= 4
++#ifdef CONFIG_X86_64
+       .pud_val = PV_CALLEE_SAVE(xen_pud_val),
+       .make_pud = PV_CALLEE_SAVE(xen_make_pud),
+       .set_p4d = xen_set_p4d_hyper,
+       .alloc_pud = xen_alloc_pmd_init,
+       .release_pud = xen_release_pmd_init,
+-#endif        /* CONFIG_PGTABLE_LEVELS == 4 */
++#endif        /* CONFIG_X86_64 */
+       .activate_mm = xen_activate_mm,
+       .dup_mmap = xen_dup_mmap,
diff --git a/queue-4.14/x86-xen-fix-xen-head-elf-annotations.patch b/queue-4.14/x86-xen-fix-xen-head-elf-annotations.patch
new file mode 100644 (file)
index 0000000..e9e5797
--- /dev/null
@@ -0,0 +1,47 @@
+From 2582d3df95c76d3b686453baf90b64d57e87d1e8 Mon Sep 17 00:00:00 2001
+From: Josh Poimboeuf <jpoimboe@redhat.com>
+Date: Mon, 18 Sep 2017 21:43:35 -0500
+Subject: x86/xen: Fix xen head ELF annotations
+
+From: Josh Poimboeuf <jpoimboe@redhat.com>
+
+commit 2582d3df95c76d3b686453baf90b64d57e87d1e8 upstream.
+
+Mark the ends of the startup_xen and hypercall_page code sections.
+
+Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
+Cc: Andy Lutomirski <luto@kernel.org>
+Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
+Cc: Jiri Slaby <jslaby@suse.cz>
+Cc: Juergen Gross <jgross@suse.com>
+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/3a80a394d30af43d9cefa1a29628c45ed8420c97.1505764066.git.jpoimboe@redhat.com
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/x86/xen/xen-head.S |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/arch/x86/xen/xen-head.S
++++ b/arch/x86/xen/xen-head.S
+@@ -34,7 +34,7 @@ ENTRY(startup_xen)
+       mov $init_thread_union+THREAD_SIZE, %_ASM_SP
+       jmp xen_start_kernel
+-
++END(startup_xen)
+       __FINIT
+ #endif
+@@ -48,7 +48,7 @@ ENTRY(hypercall_page)
+       .type xen_hypercall_##n, @function; .size xen_hypercall_##n, 32
+ #include <asm/xen-hypercalls.h>
+ #undef HYPERCALL
+-
++END(hypercall_page)
+ .popsection
+       ELFNOTE(Xen, XEN_ELFNOTE_GUEST_OS,       .asciz "linux")
diff --git a/queue-4.14/x86-xen-provide-pre-built-page-tables-only-for-config_xen_pv-y-and-config_xen_pvh-y.patch b/queue-4.14/x86-xen-provide-pre-built-page-tables-only-for-config_xen_pv-y-and-config_xen_pvh-y.patch
new file mode 100644 (file)
index 0000000..67ad47e
--- /dev/null
@@ -0,0 +1,70 @@
+From 4375c29985f155d7eb2346615d84e62d1b673682 Mon Sep 17 00:00:00 2001
+From: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
+Date: Fri, 29 Sep 2017 17:08:19 +0300
+Subject: x86/xen: Provide pre-built page tables only for CONFIG_XEN_PV=y and CONFIG_XEN_PVH=y
+
+From: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
+
+commit 4375c29985f155d7eb2346615d84e62d1b673682 upstream.
+
+Looks like we only need pre-built page tables in the CONFIG_XEN_PV=y and
+CONFIG_XEN_PVH=y cases.
+
+Let's not provide them for other configurations.
+
+Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
+Reviewed-by: Juergen Gross <jgross@suse.com>
+Cc: Andrew Morton <akpm@linux-foundation.org>
+Cc: Andy Lutomirski <luto@amacapital.net>
+Cc: Borislav Petkov <bp@suse.de>
+Cc: Cyrill Gorcunov <gorcunov@openvz.org>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Cc: linux-mm@kvack.org
+Link: http://lkml.kernel.org/r/20170929140821.37654-5-kirill.shutemov@linux.intel.com
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/x86/kernel/head_64.S |   11 ++++++-----
+ 1 file changed, 6 insertions(+), 5 deletions(-)
+
+--- a/arch/x86/kernel/head_64.S
++++ b/arch/x86/kernel/head_64.S
+@@ -38,11 +38,12 @@
+  *
+  */
+-#define p4d_index(x)  (((x) >> P4D_SHIFT) & (PTRS_PER_P4D-1))
+ #define pud_index(x)  (((x) >> PUD_SHIFT) & (PTRS_PER_PUD-1))
++#if defined(CONFIG_XEN_PV) || defined(CONFIG_XEN_PVH)
+ PGD_PAGE_OFFSET = pgd_index(__PAGE_OFFSET_BASE)
+ PGD_START_KERNEL = pgd_index(__START_KERNEL_map)
++#endif
+ L3_START_KERNEL = pud_index(__START_KERNEL_map)
+       .text
+@@ -365,10 +366,7 @@ NEXT_PAGE(early_dynamic_pgts)
+       .data
+-#ifndef CONFIG_XEN
+-NEXT_PAGE(init_top_pgt)
+-      .fill   512,8,0
+-#else
++#if defined(CONFIG_XEN_PV) || defined(CONFIG_XEN_PVH)
+ NEXT_PAGE(init_top_pgt)
+       .quad   level3_ident_pgt - __START_KERNEL_map + _KERNPG_TABLE_NOENC
+       .org    init_top_pgt + PGD_PAGE_OFFSET*8, 0
+@@ -385,6 +383,9 @@ NEXT_PAGE(level2_ident_pgt)
+        * Don't set NX because code runs from these pages.
+        */
+       PMDS(0, __PAGE_KERNEL_IDENT_LARGE_EXEC, PTRS_PER_PMD)
++#else
++NEXT_PAGE(init_top_pgt)
++      .fill   512,8,0
+ #endif
+ #ifdef CONFIG_X86_5LEVEL