Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'x86_urgent_for_v6.9_rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull x86 fixes from Borislav Petkov:

- Make sure single object builds in arch/x86/virt/ ala
make ... arch/x86/virt/vmx/tdx/seamcall.o
work again

- Do not do ROM range scans and memory validation when the kernel is
running as a SEV-SNP guest as those can get problematic and, before
that, are not really needed in such a guest

- Exclude the build-time generated vdso-image-x32.o object from objtool
validation and in particular the return sites in there due to a
warning which fires when an unpatched return thunk is being used

- Improve the NMI CPUs stall message to show additional information
about the state of each CPU wrt the NMI handler

- Enable gcc named address spaces support only on !KCSAN configs due to
compiler options incompatibility

- Revert a change which was trying to use GB pages for mapping regions
only when the regions would be large enough but that change lead to
kexec failing

- A documentation fixlet

* tag 'x86_urgent_for_v6.9_rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
x86/build: Use obj-y to descend into arch/x86/virt/
x86/sev: Skip ROM range scans and validation for SEV-SNP guests
x86/vdso: Fix rethunk patching for vdso-image-x32.o too
x86/nmi: Upgrade NMI backtrace stall checks & messages
x86/percpu: Disable named address spaces for KCSAN
Revert "x86/mm/ident_map: Use gbpages only where full GB page should be mapped."
Documentation/x86: Fix title underline length

+64 -64
+1 -1
Documentation/arch/x86/resctrl.rst
··· 574 574 MB:<cache_id0>=bandwidth0;<cache_id1>=bandwidth1;... 575 575 576 576 Memory bandwidth Allocation specified in MiBps 577 - --------------------------------------------- 577 + ---------------------------------------------- 578 578 579 579 Memory bandwidth domain is L3 cache. 580 580 ::
+1 -1
arch/x86/Kbuild
··· 28 28 29 29 obj-$(CONFIG_KEXEC_FILE) += purgatory/ 30 30 31 - obj-y += virt/svm/ 31 + obj-y += virt/ 32 32 33 33 # for cleaning 34 34 subdir- += boot tools
+2
arch/x86/Kconfig
··· 2439 2439 # with named address spaces - see GCC PR sanitizer/111736. 2440 2440 # 2441 2441 depends on !KASAN 2442 + # -fsanitize=thread (KCSAN) is also incompatible. 2443 + depends on !KCSAN 2442 2444 2443 2445 config CC_HAS_SLS 2444 2446 def_bool $(cc-option,-mharden-sls=all)
-2
arch/x86/Makefile
··· 251 251 252 252 libs-y += arch/x86/lib/ 253 253 254 - core-y += arch/x86/virt/ 255 - 256 254 # drivers-y are linked after core-y 257 255 drivers-$(CONFIG_MATH_EMULATION) += arch/x86/math-emu/ 258 256 drivers-$(CONFIG_PCI) += arch/x86/pci/
+1
arch/x86/entry/vdso/Makefile
··· 41 41 obj-$(CONFIG_COMPAT_32) += vdso-image-32.o vdso32-setup.o 42 42 43 43 OBJECT_FILES_NON_STANDARD_vdso-image-32.o := n 44 + OBJECT_FILES_NON_STANDARD_vdso-image-x32.o := n 44 45 OBJECT_FILES_NON_STANDARD_vdso-image-64.o := n 45 46 OBJECT_FILES_NON_STANDARD_vdso32-setup.o := n 46 47
+2 -2
arch/x86/include/asm/sev.h
··· 218 218 unsigned long npages); 219 219 void early_snp_set_memory_shared(unsigned long vaddr, unsigned long paddr, 220 220 unsigned long npages); 221 - void __init snp_prep_memory(unsigned long paddr, unsigned int sz, enum psc_op op); 222 221 void snp_set_memory_shared(unsigned long vaddr, unsigned long npages); 223 222 void snp_set_memory_private(unsigned long vaddr, unsigned long npages); 224 223 void snp_set_wakeup_secondary_cpu(void); 225 224 bool snp_init(struct boot_params *bp); 226 225 void __noreturn snp_abort(void); 226 + void snp_dmi_setup(void); 227 227 int snp_issue_guest_request(u64 exit_code, struct snp_req_data *input, struct snp_guest_request_ioctl *rio); 228 228 void snp_accept_memory(phys_addr_t start, phys_addr_t end); 229 229 u64 snp_get_unsupported_features(u64 status); ··· 244 244 early_snp_set_memory_private(unsigned long vaddr, unsigned long paddr, unsigned long npages) { } 245 245 static inline void __init 246 246 early_snp_set_memory_shared(unsigned long vaddr, unsigned long paddr, unsigned long npages) { } 247 - static inline void __init snp_prep_memory(unsigned long paddr, unsigned int sz, enum psc_op op) { } 248 247 static inline void snp_set_memory_shared(unsigned long vaddr, unsigned long npages) { } 249 248 static inline void snp_set_memory_private(unsigned long vaddr, unsigned long npages) { } 250 249 static inline void snp_set_wakeup_secondary_cpu(void) { } 251 250 static inline bool snp_init(struct boot_params *bp) { return false; } 252 251 static inline void snp_abort(void) { } 252 + static inline void snp_dmi_setup(void) { } 253 253 static inline int snp_issue_guest_request(u64 exit_code, struct snp_req_data *input, struct snp_guest_request_ioctl *rio) 254 254 { 255 255 return -ENOTTY;
+2 -1
arch/x86/include/asm/x86_init.h
··· 30 30 * @reserve_resources: reserve the standard resources for the 31 31 * platform 32 32 * @memory_setup: platform specific memory setup 33 - * 33 + * @dmi_setup: platform specific DMI setup 34 34 */ 35 35 struct x86_init_resources { 36 36 void (*probe_roms)(void); 37 37 void (*reserve_resources)(void); 38 38 char *(*memory_setup)(void); 39 + void (*dmi_setup)(void); 39 40 }; 40 41 41 42 /**
+2 -1
arch/x86/kernel/eisa.c
··· 2 2 /* 3 3 * EISA specific code 4 4 */ 5 + #include <linux/cc_platform.h> 5 6 #include <linux/ioport.h> 6 7 #include <linux/eisa.h> 7 8 #include <linux/io.h> ··· 13 12 { 14 13 void __iomem *p; 15 14 16 - if (xen_pv_domain() && !xen_initial_domain()) 15 + if ((xen_pv_domain() && !xen_initial_domain()) || cc_platform_has(CC_ATTR_GUEST_SEV_SNP)) 17 16 return 0; 18 17 19 18 p = ioremap(0x0FFFD9, 4);
+14 -10
arch/x86/kernel/nmi.c
··· 580 580 581 581 static char *nmi_check_stall_msg[] = { 582 582 /* */ 583 - /* +--------- nsp->idt_seq_snap & 0x1: CPU is in NMI handler. */ 583 + /* +--------- nmi_seq & 0x1: CPU is currently in NMI handler. */ 584 584 /* | +------ cpu_is_offline(cpu) */ 585 585 /* | | +--- nsp->idt_calls_snap != atomic_long_read(&nsp->idt_calls): */ 586 586 /* | | | NMI handler has been invoked. */ ··· 628 628 nmi_seq = READ_ONCE(nsp->idt_nmi_seq); 629 629 if (nsp->idt_nmi_seq_snap + 1 == nmi_seq && (nmi_seq & 0x1)) { 630 630 msgp = "CPU entered NMI handler function, but has not exited"; 631 - } else if ((nsp->idt_nmi_seq_snap & 0x1) != (nmi_seq & 0x1)) { 632 - msgp = "CPU is handling NMIs"; 633 - } else { 634 - idx = ((nsp->idt_seq_snap & 0x1) << 2) | 631 + } else if (nsp->idt_nmi_seq_snap == nmi_seq || 632 + nsp->idt_nmi_seq_snap + 1 == nmi_seq) { 633 + idx = ((nmi_seq & 0x1) << 2) | 635 634 (cpu_is_offline(cpu) << 1) | 636 635 (nsp->idt_calls_snap != atomic_long_read(&nsp->idt_calls)); 637 636 msgp = nmi_check_stall_msg[idx]; 638 637 if (nsp->idt_ignored_snap != READ_ONCE(nsp->idt_ignored) && (idx & 0x1)) 639 638 modp = ", but OK because ignore_nmis was set"; 640 - if (nmi_seq & 0x1) 641 - msghp = " (CPU currently in NMI handler function)"; 642 - else if (nsp->idt_nmi_seq_snap + 1 == nmi_seq) 639 + if (nsp->idt_nmi_seq_snap + 1 == nmi_seq) 643 640 msghp = " (CPU exited one NMI handler function)"; 641 + else if (nmi_seq & 0x1) 642 + msghp = " (CPU currently in NMI handler function)"; 643 + else 644 + msghp = " (CPU was never in an NMI handler function)"; 645 + } else { 646 + msgp = "CPU is handling NMIs"; 644 647 } 645 - pr_alert("%s: CPU %d: %s%s%s, last activity: %lu jiffies ago.\n", 646 - __func__, cpu, msgp, modp, msghp, j - READ_ONCE(nsp->recv_jiffies)); 648 + pr_alert("%s: CPU %d: %s%s%s\n", __func__, cpu, msgp, modp, msghp); 649 + pr_alert("%s: last activity: %lu jiffies ago.\n", 650 + __func__, j - READ_ONCE(nsp->recv_jiffies)); 647 651 } 648 652 } 649 653
-10
arch/x86/kernel/probe_roms.c
··· 203 203 unsigned char c; 204 204 int i; 205 205 206 - /* 207 - * The ROM memory range is not part of the e820 table and is therefore not 208 - * pre-validated by BIOS. The kernel page table maps the ROM region as encrypted 209 - * memory, and SNP requires encrypted memory to be validated before access. 210 - * Do that here. 211 - */ 212 - snp_prep_memory(video_rom_resource.start, 213 - ((system_rom_resource.end + 1) - video_rom_resource.start), 214 - SNP_PAGE_STATE_PRIVATE); 215 - 216 206 /* video rom */ 217 207 upper = adapter_rom_resources[0].start; 218 208 for (start = video_rom_resource.start; start < upper; start += 2048) {
+1 -2
arch/x86/kernel/setup.c
··· 9 9 #include <linux/console.h> 10 10 #include <linux/crash_dump.h> 11 11 #include <linux/dma-map-ops.h> 12 - #include <linux/dmi.h> 13 12 #include <linux/efi.h> 14 13 #include <linux/ima.h> 15 14 #include <linux/init_ohci1394_dma.h> ··· 901 902 efi_init(); 902 903 903 904 reserve_ibft_region(); 904 - dmi_setup(); 905 + x86_init.resources.dmi_setup(); 905 906 906 907 /* 907 908 * VMware detection requires dmi to be available, so this
+12 -15
arch/x86/kernel/sev.c
··· 23 23 #include <linux/platform_device.h> 24 24 #include <linux/io.h> 25 25 #include <linux/psp-sev.h> 26 + #include <linux/dmi.h> 26 27 #include <uapi/linux/sev-guest.h> 27 28 28 29 #include <asm/init.h> ··· 794 793 795 794 /* Ask hypervisor to mark the memory pages shared in the RMP table. */ 796 795 early_set_pages_state(vaddr, paddr, npages, SNP_PAGE_STATE_SHARED); 797 - } 798 - 799 - void __init snp_prep_memory(unsigned long paddr, unsigned int sz, enum psc_op op) 800 - { 801 - unsigned long vaddr, npages; 802 - 803 - vaddr = (unsigned long)__va(paddr); 804 - npages = PAGE_ALIGN(sz) >> PAGE_SHIFT; 805 - 806 - if (op == SNP_PAGE_STATE_PRIVATE) 807 - early_snp_set_memory_private(vaddr, paddr, npages); 808 - else if (op == SNP_PAGE_STATE_SHARED) 809 - early_snp_set_memory_shared(vaddr, paddr, npages); 810 - else 811 - WARN(1, "invalid memory op %d\n", op); 812 796 } 813 797 814 798 static unsigned long __set_pages_state(struct snp_psc_desc *data, unsigned long vaddr, ··· 2120 2134 void __head __noreturn snp_abort(void) 2121 2135 { 2122 2136 sev_es_terminate(SEV_TERM_SET_GEN, GHCB_SNP_UNSUPPORTED); 2137 + } 2138 + 2139 + /* 2140 + * SEV-SNP guests should only execute dmi_setup() if EFI_CONFIG_TABLES are 2141 + * enabled, as the alternative (fallback) logic for DMI probing in the legacy 2142 + * ROM region can cause a crash since this region is not pre-validated. 2143 + */ 2144 + void __init snp_dmi_setup(void) 2145 + { 2146 + if (efi_enabled(EFI_CONFIG_TABLES)) 2147 + dmi_setup(); 2123 2148 } 2124 2149 2125 2150 static void dump_cpuid_table(void)
+2
arch/x86/kernel/x86_init.c
··· 3 3 * 4 4 * For licencing details see kernel-base/COPYING 5 5 */ 6 + #include <linux/dmi.h> 6 7 #include <linux/init.h> 7 8 #include <linux/ioport.h> 8 9 #include <linux/export.h> ··· 67 66 .probe_roms = probe_roms, 68 67 .reserve_resources = reserve_standard_io_resources, 69 68 .memory_setup = e820__memory_setup_default, 69 + .dmi_setup = dmi_setup, 70 70 }, 71 71 72 72 .mpparse = {
+5 -18
arch/x86/mm/ident_map.c
··· 26 26 for (; addr < end; addr = next) { 27 27 pud_t *pud = pud_page + pud_index(addr); 28 28 pmd_t *pmd; 29 - bool use_gbpage; 30 29 31 30 next = (addr & PUD_MASK) + PUD_SIZE; 32 31 if (next > end) 33 32 next = end; 34 33 35 - /* if this is already a gbpage, this portion is already mapped */ 36 - if (pud_leaf(*pud)) 37 - continue; 38 - 39 - /* Is using a gbpage allowed? */ 40 - use_gbpage = info->direct_gbpages; 41 - 42 - /* Don't use gbpage if it maps more than the requested region. */ 43 - /* at the begining: */ 44 - use_gbpage &= ((addr & ~PUD_MASK) == 0); 45 - /* ... or at the end: */ 46 - use_gbpage &= ((next & ~PUD_MASK) == 0); 47 - 48 - /* Never overwrite existing mappings */ 49 - use_gbpage &= !pud_present(*pud); 50 - 51 - if (use_gbpage) { 34 + if (info->direct_gbpages) { 52 35 pud_t pudval; 53 36 37 + if (pud_present(*pud)) 38 + continue; 39 + 40 + addr &= PUD_MASK; 54 41 pudval = __pud((addr - info->offset) | info->page_flag); 55 42 set_pud(pud, pudval); 56 43 continue;
+18
arch/x86/mm/mem_encrypt_amd.c
··· 492 492 */ 493 493 if (sev_status & MSR_AMD64_SEV_ENABLED) 494 494 ia32_disable(); 495 + 496 + /* 497 + * Override init functions that scan the ROM region in SEV-SNP guests, 498 + * as this memory is not pre-validated and would thus cause a crash. 499 + */ 500 + if (sev_status & MSR_AMD64_SEV_SNP_ENABLED) { 501 + x86_init.mpparse.find_mptable = x86_init_noop; 502 + x86_init.pci.init_irq = x86_init_noop; 503 + x86_init.resources.probe_roms = x86_init_noop; 504 + 505 + /* 506 + * DMI setup behavior for SEV-SNP guests depends on 507 + * efi_enabled(EFI_CONFIG_TABLES), which hasn't been 508 + * parsed yet. snp_dmi_setup() will run after that 509 + * parsing has happened. 510 + */ 511 + x86_init.resources.dmi_setup = snp_dmi_setup; 512 + } 495 513 } 496 514 497 515 void __init mem_encrypt_free_decrypted_mem(void)
+1 -1
arch/x86/virt/Makefile
··· 1 1 # SPDX-License-Identifier: GPL-2.0-only 2 - obj-y += vmx/ 2 + obj-y += svm/ vmx/