···1801801) On i386, enable high memory support under "Processor type and181181 features"::182182183183- CONFIG_HIGHMEM64G=y184184-185185- or::186186-187183 CONFIG_HIGHMEM4G1881841891852) With CONFIG_SMP=y, usually nr_cpus=1 need specified on the kernel
-11
Documentation/admin-guide/kernel-parameters.txt
···416416 Format: { quiet (default) | verbose | debug }417417 Change the amount of debugging information output418418 when initialising the APIC and IO-APIC components.419419- For X86-32, this can also be used to specify an APIC420420- driver name.421421- Format: apic=driver_name422422- Examples: apic=bigsmp423419424420 apic_extnmi= [APIC,X86,EARLY] External NMI delivery setting425421 Format: { bsp (default) | all | none }···76677671 8 - SIGSEGV faults76687672 16 - SIGBUS faults76697673 Example: user_debug=3176707670-76717671- userpte=76727672- [X86,EARLY] Flags controlling user PTE allocations.76737673-76747674- nohigh = do not allocate PTE pages in76757675- HIGHMEM regardless of setting76767676- of CONFIG_HIGHPTE.7677767476787675 vdso= [X86,SH,SPARC]76797676 On X86_32, this is an alias for vdso32=. Otherwise:
+1-10
Documentation/arch/x86/usb-legacy-support.rst
···2020 features (wheel, extra buttons, touchpad mode) of the real PS/2 mouse may2121 not be available.22222323-2) If CONFIG_HIGHMEM64G is enabled, the PS/2 mouse emulation can cause2424- system crashes, because the SMM BIOS is not expecting to be in PAE mode.2525- The Intel E7505 is a typical machine where this happens.2626-2727-3) If AMD64 64-bit mode is enabled, again system crashes often happen,2323+2) If AMD64 64-bit mode is enabled, again system crashes often happen,2824 because the SMM BIOS isn't expecting the CPU to be in 64-bit mode. The2925 BIOS manufacturers only test with Windows, and Windows doesn't do 64-bit3026 yet.···3438 compiled-in, too.35393640Problem 2)3737- can currently only be solved by either disabling HIGHMEM64G3838- in the kernel config or USB Legacy support in the BIOS. A BIOS update3939- could help, but so far no such update exists.4040-4141-Problem 3)4241 is usually fixed by a BIOS update. Check the board4342 manufacturers web site. If an update is not available, disable USB4443 Legacy support in the BIOS. If this alone doesn't help, try also adding
···133133 select ARCH_SUPPORTS_AUTOFDO_CLANG134134 select ARCH_SUPPORTS_PROPELLER_CLANG if X86_64135135 select ARCH_USE_BUILTIN_BSWAP136136- select ARCH_USE_CMPXCHG_LOCKREF if X86_CMPXCHG64136136+ select ARCH_USE_CMPXCHG_LOCKREF if X86_CX8137137 select ARCH_USE_MEMTEST138138 select ARCH_USE_QUEUED_RWLOCKS139139 select ARCH_USE_QUEUED_SPINLOCKS···233233 select HAVE_SAMPLE_FTRACE_DIRECT_MULTI if X86_64234234 select HAVE_EBPF_JIT235235 select HAVE_EFFICIENT_UNALIGNED_ACCESS236236- select HAVE_EISA236236+ select HAVE_EISA if X86_32237237 select HAVE_EXIT_THREAD238238 select HAVE_GUP_FAST239239 select HAVE_FENTRY if X86_64 || DYNAMIC_FTRACE···278278 select HAVE_PCI279279 select HAVE_PERF_REGS280280 select HAVE_PERF_USER_STACK_DUMP281281- select MMU_GATHER_RCU_TABLE_FREE if PARAVIRT281281+ select MMU_GATHER_RCU_TABLE_FREE282282 select MMU_GATHER_MERGE_VMAS283283 select HAVE_POSIX_CPU_TIMERS_TASK_WORK284284 select HAVE_REGS_AND_STACK_ACCESS_API···286286 select HAVE_FUNCTION_ARG_ACCESS_API287287 select HAVE_SETUP_PER_CPU_AREA288288 select HAVE_SOFTIRQ_ON_OWN_STACK289289- select HAVE_STACKPROTECTOR if CC_HAS_SANE_STACKPROTECTOR289289+ select HAVE_STACKPROTECTOR290290 select HAVE_STACK_VALIDATION if HAVE_OBJTOOL291291 select HAVE_STATIC_CALL292292 select HAVE_STATIC_CALL_INLINE if HAVE_OBJTOOL···427427 default 3 if X86_PAE428428 default 2429429430430-config CC_HAS_SANE_STACKPROTECTOR431431- bool432432- default $(success,$(srctree)/scripts/gcc-x86_64-has-stack-protector.sh $(CC) $(CLANG_FLAGS)) if 64BIT433433- default $(success,$(srctree)/scripts/gcc-x86_32-has-stack-protector.sh $(CC) $(CLANG_FLAGS))434434- help435435- We have to make sure stack protector is unconditionally disabled if436436- the compiler produces broken code or if it does not let us control437437- the segment on 32-bit kernels.438438-439430menu "Processor type and features"440431441432config SMP···522531 ring transitions and exception/interrupt handling if the523532 system supports it.524533525525-config X86_BIGSMP526526- bool "Support for big SMP systems with more than 8 CPUs"527527- depends on SMP && X86_32528528- help529529- This option is needed for the systems that have more than 8 CPUs.530530-531534config X86_EXTENDED_PLATFORM532535 bool "Support for extended (non-PC) x86 platforms"533536 default y···539554 AMD Elan540555 RDC R-321x SoC541556 SGI 320/540 (Visual Workstation)542542- STA2X11-based (e.g. Northville)543543- Moorestown MID devices544557545558 64-bit platforms (CONFIG_64BIT=y):546559 Numascale NumaChip547560 ScaleMP vSMP548561 SGI Ultraviolet562562+ Merrifield/Moorefield MID devices549563550564 If you have one of these systems, or if you want to build a551565 generic distribution kernel, say Y here - otherwise say N.···589605 This option is needed in order to support SGI Ultraviolet systems.590606 If you don't have one of these, you should say N here.591607592592-# Following is an alphabetically sorted list of 32 bit extended platforms593593-# Please maintain the alphabetic order if and when there are additions608608+config X86_INTEL_MID609609+ bool "Intel Z34xx/Z35xx MID platform support"610610+ depends on X86_EXTENDED_PLATFORM611611+ depends on X86_PLATFORM_DEVICES612612+ depends on PCI613613+ depends on X86_64 || (EXPERT && PCI_GOANY)614614+ depends on X86_IO_APIC615615+ select I2C616616+ select DW_APB_TIMER617617+ select INTEL_SCU_PCI618618+ help619619+ Select to build a kernel capable of supporting 64-bit Intel MID620620+ (Mobile Internet Device) platform systems which do not have621621+ the PCI legacy interfaces.622622+623623+ The only supported devices are the 22nm Merrified (Z34xx)624624+ and Moorefield (Z35xx) SoC used in the Intel Edison board and625625+ a small number of Android devices such as the Asus Zenfone 2,626626+ Asus FonePad 8 and Dell Venue 7.627627+628628+ If you are building for a PC class system or non-MID tablet629629+ SoCs like Bay Trail (Z36xx/Z37xx), say N here.630630+631631+ Intel MID platforms are based on an Intel processor and chipset which632632+ consume less power than most of the x86 derivatives.594633595634config X86_GOLDFISH596635 bool "Goldfish (Virtual Platform)"···622615 Enable support for the Goldfish virtual platform used primarily623616 for Android development. Unless you are building for the Android624617 Goldfish emulator say N here.618618+619619+# Following is an alphabetically sorted list of 32 bit extended platforms620620+# Please maintain the alphabetic order if and when there are additions625621626622config X86_INTEL_CE627623 bool "CE4100 TV platform"···640630 Select for the Intel CE media processor (CE4100) SOC.641631 This option compiles in support for the CE4100 SOC for settop642632 boxes and media devices.643643-644644-config X86_INTEL_MID645645- bool "Intel MID platform support"646646- depends on X86_EXTENDED_PLATFORM647647- depends on X86_PLATFORM_DEVICES648648- depends on PCI649649- depends on X86_64 || (PCI_GOANY && X86_32)650650- depends on X86_IO_APIC651651- select I2C652652- select DW_APB_TIMER653653- select INTEL_SCU_PCI654654- help655655- Select to build a kernel capable of supporting Intel MID (Mobile656656- Internet Device) platform systems which do not have the PCI legacy657657- interfaces. If you are building for a PC class system say N here.658658-659659- Intel MID platforms are based on an Intel processor and chipset which660660- consume less power than most of the x86 derivatives.661633662634config X86_INTEL_QUARK663635 bool "Intel Quark platform support"···722730 as R-8610-(G).723731 If you don't have one of these chips, you should say N here.724732725725-config X86_32_NON_STANDARD726726- bool "Support non-standard 32-bit SMP architectures"727727- depends on X86_32 && SMP728728- depends on X86_EXTENDED_PLATFORM729729- help730730- This option compiles in the bigsmp and STA2X11 default731731- subarchitectures. It is intended for a generic binary732732- kernel. If you select them all, kernel will probe it one by733733- one and will fallback to default.734734-735735-# Alphabetically sorted list of Non standard 32 bit platforms736736-737733config X86_SUPPORTS_MEMORY_FAILURE738734 def_bool y739735 # MCE code calls memory_failure():···730750 # On 32-bit SPARSEMEM adds too big of SECTIONS_WIDTH:731751 depends on X86_64 || !SPARSEMEM732752 select ARCH_SUPPORTS_MEMORY_FAILURE733733-734734-config STA2X11735735- bool "STA2X11 Companion Chip Support"736736- depends on X86_32_NON_STANDARD && PCI737737- select SWIOTLB738738- select MFD_STA2X11739739- select GPIOLIB740740- help741741- This adds support for boards based on the STA2X11 IO-Hub,742742- a.k.a. "ConneXt". The chip is used in place of the standard743743- PC chipset, so all "standard" peripherals are missing. If this744744- option is selected the kernel will still be able to boot on745745- standard PC machines.746753747754config X86_32_IRIS748755 tristate "Eurobraille/Iris poweroff module"···9801013config NR_CPUS_RANGE_END9811014 int9821015 depends on X86_32983983- default 64 if SMP && X86_BIGSMP984984- default 8 if SMP && !X86_BIGSMP10161016+ default 8 if SMP9851017 default 1 if !SMP98610189871019config NR_CPUS_RANGE_END···9931027config NR_CPUS_DEFAULT9941028 int9951029 depends on X86_32996996- default 32 if X86_BIGSMP9971030 default 8 if SMP9981031 default 1 if !SMP9991032···10681103config X86_UP_APIC10691104 bool "Local APIC support on uniprocessors" if !PCI_MSI10701105 default PCI_MSI10711071- depends on X86_32 && !SMP && !X86_32_NON_STANDARD11061106+ depends on X86_32 && !SMP10721107 help10731108 A local APIC (Advanced Programmable Interrupt Controller) is an10741109 integrated interrupt controller in the CPU. If you have a single-CPU···1093112810941129config X86_LOCAL_APIC10951130 def_bool y10961096- depends on X86_64 || SMP || X86_32_NON_STANDARD || X86_UP_APIC || PCI_MSI11311131+ depends on X86_64 || SMP || X86_UP_APIC || PCI_MSI10971132 select IRQ_DOMAIN_HIERARCHY1098113310991134config ACPI_MADT_WAKEUP···13611396 with major 203 and minors 0 to 31 for /dev/cpu/0/cpuid to13621397 /dev/cpu/31/cpuid.1363139813641364-choice13651365- prompt "High Memory Support"13661366- default HIGHMEM4G13991399+config HIGHMEM4G14001400+ bool "High Memory Support"13671401 depends on X86_3213681368-13691369-config NOHIGHMEM13701370- bool "off"13711402 help13721372- Linux can use up to 64 Gigabytes of physical memory on x86 systems.14031403+ Linux can use up to 4 Gigabytes of physical memory on x86 systems.13731404 However, the address space of 32-bit x86 processors is only 413741405 Gigabytes large. That means that, if you have a large amount of13751406 physical memory, not all of it can be "permanently mapped" by the···13811420 possible.1382142113831422 If the machine has between 1 and 4 Gigabytes physical RAM, then13841384- answer "4GB" here.14231423+ answer "Y" here.1385142413861386- If more than 4 Gigabytes is used then answer "64GB" here. This13871387- selection turns Intel PAE (Physical Address Extension) mode on.13881388- PAE implements 3-level paging on IA32 processors. PAE is fully13891389- supported by Linux, PAE mode is implemented on all recent Intel13901390- processors (Pentium Pro and better). NOTE: If you say "64GB" here,13911391- then the kernel will not boot on CPUs that don't support PAE!13921392-13931393- The actual amount of total physical memory will either be13941394- auto detected or can be forced by using a kernel command line option13951395- such as "mem=256M". (Try "man bootparam" or see the documentation of13961396- your boot loader (lilo or loadlin) about how to pass options to the13971397- kernel at boot time.)13981398-13991399- If unsure, say "off".14001400-14011401-config HIGHMEM4G14021402- bool "4GB"14031403- help14041404- Select this if you have a 32-bit processor and between 1 and 414051405- gigabytes of physical RAM.14061406-14071407-config HIGHMEM64G14081408- bool "64GB"14091409- depends on X86_HAVE_PAE14101410- select X86_PAE14111411- help14121412- Select this if you have a 32-bit processor and more than 414131413- gigabytes of physical RAM.14141414-14151415-endchoice14251425+ If unsure, say N.1416142614171427choice14181428 prompt "Memory split" if EXPERT···14291497 depends on X86_321430149814311499config HIGHMEM14321432- def_bool y14331433- depends on X86_32 && (HIGHMEM64G || HIGHMEM4G)15001500+ def_bool HIGHMEM4G1434150114351502config X86_PAE14361503 bool "PAE (Physical Address Extension) Support"14371504 depends on X86_32 && X86_HAVE_PAE14381505 select PHYS_ADDR_T_64BIT14391439- select SWIOTLB14401506 help14411507 PAE is required for NX support, and furthermore enables14421508 larger swapspace support for non-overcommit purposes. It···15041574config NUMA15051575 bool "NUMA Memory Allocation and Scheduler Support"15061576 depends on SMP15071507- depends on X86_64 || (X86_32 && HIGHMEM64G && X86_BIGSMP)15081508- default y if X86_BIGSMP15771577+ depends on X86_6415091578 select USE_PERCPU_NUMA_NODE_ID15101579 select OF_NUMA if OF15111580 help···1516158715171588 For 64-bit this is recommended if the system is Intel Core i715181589 (or later), AMD Opteron, or EM64T NUMA.15191519-15201520- For 32-bit this is only needed if you boot a 32-bit15211521- kernel on a 64-bit NUMA platform.1522159015231591 Otherwise, you should say N.15241592···1555162915561630config ARCH_SPARSEMEM_ENABLE15571631 def_bool y15581558- depends on X86_64 || NUMA || X86_32 || X86_32_NON_STANDARD16321632+ depends on X86_64 || NUMA || X86_3215591633 select SPARSEMEM_STATIC if X86_3215601634 select SPARSEMEM_VMEMMAP_ENABLE if X86_6415611635···16001674 they can be used for persistent storage.1601167516021676 Say Y if unsure.16031603-16041604-config HIGHPTE16051605- bool "Allocate 3rd-level pagetables from highmem"16061606- depends on HIGHMEM16071607- help16081608- The VM uses one page table entry for each page of physical memory.16091609- For systems with a lot of RAM, this can be wasteful of precious16101610- low memory. Setting this option will put user-space page table16111611- entries in high memory.1612167716131678config X86_CHECK_BIOS_CORRUPTION16141679 bool "Check for low memory corruption"···23682451 def_bool $(success,echo 'int __seg_fs fs; int __seg_gs gs;' | $(CC) -x c - -S -o /dev/null)23692452 depends on CC_IS_GCC2370245324542454+#24552455+# -fsanitize=kernel-address (KASAN) and -fsanitize=thread (KCSAN)24562456+# are incompatible with named address spaces with GCC < 13.324572457+# (see GCC PR sanitizer/111736 and also PR sanitizer/115172).24582458+#24592459+23712460config CC_HAS_NAMED_AS_FIXED_SANITIZERS23722372- def_bool CC_IS_GCC && GCC_VERSION >= 13030024612461+ def_bool y24622462+ depends on !(KASAN || KCSAN) || GCC_VERSION >= 13030024632463+ depends on !(UBSAN_BOOL && KASAN) || GCC_VERSION >= 1402002373246423742465config USE_X86_SEG_SUPPORT23752375- def_bool y23762376- depends on CC_HAS_NAMED_AS23772377- #23782378- # -fsanitize=kernel-address (KASAN) and -fsanitize=thread23792379- # (KCSAN) are incompatible with named address spaces with23802380- # GCC < 13.3 - see GCC PR sanitizer/111736.23812381- #23822382- depends on !(KASAN || KCSAN) || CC_HAS_NAMED_AS_FIXED_SANITIZERS24662466+ def_bool CC_HAS_NAMED_AS24672467+ depends on CC_HAS_NAMED_AS_FIXED_SANITIZERS2383246823842469config CC_HAS_SLS23852470 def_bool $(cc-option,-mharden-sls=all)
+17-84
arch/x86/Kconfig.cpu
···11# SPDX-License-Identifier: GPL-2.022# Put here option for CPU selection and depending optimization33choice44- prompt "Processor family"55- default M686 if X86_3266- default GENERIC_CPU if X86_6444+ prompt "x86-32 Processor family"55+ depends on X86_3266+ default M68677 help88 This is the processor type of your CPU. This information is99 used for optimizing purposes. In order to compile a kernel···3131 - "Pentium-4" for the Intel Pentium 4 or P4-based Celeron.3232 - "K6" for the AMD K6, K6-II and K6-III (aka K6-3D).3333 - "Athlon" for the AMD K7 family (Athlon/Duron/Thunderbird).3434- - "Opteron/Athlon64/Hammer/K8" for all K8 and newer AMD CPUs.3534 - "Crusoe" for the Transmeta Crusoe series.3635 - "Efficeon" for the Transmeta Efficeon series.3736 - "Winchip-C6" for original IDT Winchip.···4142 - "CyrixIII/VIA C3" for VIA Cyrix III or VIA C3.4243 - "VIA C3-2" for VIA C3-2 "Nehemiah" (model 9 and above).4344 - "VIA C7" for VIA C7.4444- - "Intel P4" for the Pentium 4/Netburst microarchitecture.4545- - "Core 2/newer Xeon" for all core2 and newer Intel CPUs.4645 - "Intel Atom" for the Atom-microarchitecture CPUs.4747- - "Generic-x86-64" for a kernel which runs on any x86-64 CPU.48464947 See each option's help text for additional details. If you don't know5050- what to do, choose "486".4848+ what to do, choose "Pentium-Pro".51495250config M486SX5351 bool "486SX"···110114 extensions.111115112116config MPENTIUMM113113- bool "Pentium M"117117+ bool "Pentium M/Pentium Dual Core/Core Solo/Core Duo"114118 depends on X86_32115119 help116120 Select this for Intel Pentium M (not Pentium-4 M)117117- notebook chips.121121+ "Merom" Core Solo/Duo notebook chips118122119123config MPENTIUM4120124 bool "Pentium-4/Celeron(P4-based)/Pentium-4 M/older Xeon"···135139 -Mobile Pentium 4136140 -Mobile Pentium 4 M137141 -Extreme Edition (Gallatin)138138- -Prescott139139- -Prescott 2M140140- -Cedar Mill141141- -Presler142142- -Smithfiled143142 Xeons (Intel Xeon, Xeon MP, Xeon LV, Xeon MV) corename:144143 -Foster145144 -Prestonia146145 -Gallatin147147- -Nocona148148- -Irwindale149149- -Cranford150150- -Potomac151151- -Paxville152152- -Dempsey153153-154146155147config MK6156148 bool "K6/K6-II/K6-III"···155171 Select this for an AMD Athlon K7-family processor. Enables use of156172 some extended instructions, and passes appropriate optimization157173 flags to GCC.158158-159159-config MK8160160- bool "Opteron/Athlon64/Hammer/K8"161161- help162162- Select this for an AMD Opteron or Athlon64 Hammer-family processor.163163- Enables use of some extended instructions, and passes appropriate164164- optimization flags to GCC.165174166175config MCRUSOE167176 bool "Crusoe"···235258 Select this for a VIA C7. Selecting this uses the correct cache236259 shift and tells gcc to treat the CPU as a 686.237260238238-config MPSC239239- bool "Intel P4 / older Netburst based Xeon"240240- depends on X86_64241241- help242242- Optimize for Intel Pentium 4, Pentium D and older Nocona/Dempsey243243- Xeon CPUs with Intel 64bit which is compatible with x86-64.244244- Note that the latest Xeons (Xeon 51xx and 53xx) are not based on the245245- Netburst core and shouldn't use this option. You can distinguish them246246- using the cpu family field247247- in /proc/cpuinfo. Family 15 is an older Xeon, Family 6 a newer one.248248-249249-config MCORE2250250- bool "Core 2/newer Xeon"251251- help252252-253253- Select this for Intel Core 2 and newer Core 2 Xeons (Xeon 51xx and254254- 53xx) CPUs. You can distinguish newer from older Xeons by the CPU255255- family in /proc/cpuinfo. Newer ones have 6 and older ones 15256256- (not a typo)257257-258261config MATOM259262 bool "Intel Atom"260263 help261261-262264 Select this for the Intel Atom platform. Intel Atom CPUs have an263265 in-order pipelining architecture and thus can benefit from264266 accordingly optimized code. Use a recent GCC with specific Atom265267 support in order to fully benefit from selecting this option.266266-267267-config GENERIC_CPU268268- bool "Generic-x86-64"269269- depends on X86_64270270- help271271- Generic x86-64 CPU.272272- Run equally well on all x86-64 CPUs.273268274269endchoice275270···266317267318config X86_L1_CACHE_SHIFT268319 int269269- default "7" if MPENTIUM4 || MPSC270270- default "6" if MK7 || MK8 || MPENTIUMM || MCORE2 || MATOM || MVIAC7 || X86_GENERIC || GENERIC_CPU320320+ default "7" if MPENTIUM4321321+ default "6" if MK7 || MPENTIUMM || MATOM || MVIAC7 || X86_GENERIC || X86_64271322 default "4" if MELAN || M486SX || M486 || MGEODEGX1272323 default "5" if MWINCHIP3D || MWINCHIPC6 || MCRUSOE || MEFFICEON || MCYRIXIII || MK6 || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || M586 || MVIAC3_2 || MGEODE_LX273324···285336286337config X86_INTEL_USERCOPY287338 def_bool y288288- depends on MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M586MMX || X86_GENERIC || MK8 || MK7 || MEFFICEON || MCORE2339339+ depends on MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M586MMX || X86_GENERIC || MK7 || MEFFICEON289340290341config X86_USE_PPRO_CHECKSUM291342 def_bool y292292- depends on MWINCHIP3D || MWINCHIPC6 || MCYRIXIII || MK7 || MK6 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || MK8 || MVIAC3_2 || MVIAC7 || MEFFICEON || MGEODE_LX || MCORE2 || MATOM293293-294294-#295295-# P6_NOPs are a relatively minor optimization that require a family >=296296-# 6 processor, except that it is broken on certain VIA chips.297297-# Furthermore, AMD chips prefer a totally different sequence of NOPs298298-# (which work on all CPUs). In addition, it looks like Virtual PC299299-# does not understand them.300300-#301301-# As a result, disallow these if we're not compiling for X86_64 (these302302-# NOPs do work on all x86-64 capable chips); the list of processors in303303-# the right-hand clause are the cores that benefit from this optimization.304304-#305305-config X86_P6_NOP306306- def_bool y307307- depends on X86_64308308- depends on (MCORE2 || MPENTIUM4 || MPSC)343343+ depends on MWINCHIP3D || MWINCHIPC6 || MCYRIXIII || MK7 || MK6 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || MVIAC3_2 || MVIAC7 || MEFFICEON || MGEODE_LX || MATOM309344310345config X86_TSC311346 def_bool y312312- depends on (MWINCHIP3D || MCRUSOE || MEFFICEON || MCYRIXIII || MK7 || MK6 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || MK8 || MVIAC3_2 || MVIAC7 || MGEODEGX1 || MGEODE_LX || MCORE2 || MATOM) || X86_64347347+ depends on (MWINCHIP3D || MCRUSOE || MEFFICEON || MCYRIXIII || MK7 || MK6 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || MVIAC3_2 || MVIAC7 || MGEODEGX1 || MGEODE_LX || MATOM) || X86_64313348314349config X86_HAVE_PAE315350 def_bool y316316- depends on MCRUSOE || MEFFICEON || MCYRIXIII || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || MK8 || MVIAC7 || MCORE2 || MATOM || X86_64351351+ depends on MCRUSOE || MEFFICEON || MCYRIXIII || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || MVIAC7 || MATOM || X86_64317352318318-config X86_CMPXCHG64353353+config X86_CX8319354 def_bool y320320- depends on X86_HAVE_PAE || M586TSC || M586MMX || MK6 || MK7355355+ depends on X86_HAVE_PAE || M586TSC || M586MMX || MK6 || MK7 || MGEODEGX1 || MGEODE_LX321356322357# this should be set for all -march=.. options where the compiler323358# generates cmov.324359config X86_CMOV325360 def_bool y326326- depends on (MK8 || MK7 || MCORE2 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || MVIAC3_2 || MVIAC7 || MCRUSOE || MEFFICEON || X86_64 || MATOM || MGEODE_LX)361361+ depends on (MK7 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || MVIAC3_2 || MVIAC7 || MCRUSOE || MEFFICEON || MATOM || MGEODE_LX || X86_64)327362328363config X86_MINIMUM_CPU_FAMILY329364 int330365 default "64" if X86_64331331- default "6" if X86_32 && (MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || MVIAC3_2 || MVIAC7 || MEFFICEON || MATOM || MCORE2 || MK7 || MK8)332332- default "5" if X86_32 && X86_CMPXCHG64366366+ default "6" if X86_32 && (MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || MVIAC3_2 || MVIAC7 || MEFFICEON || MATOM || MK7)367367+ default "5" if X86_32 && X86_CX8333368 default "4"334369335370config X86_DEBUGCTLMSR
···2424# Please note, that patches that add -march=athlon-xp and friends are pointless.2525# They make zero difference whatsosever to performance at this time.2626cflags-$(CONFIG_MK7) += -march=athlon2727-cflags-$(CONFIG_MK8) += $(call cc-option,-march=k8,-march=athlon)2827cflags-$(CONFIG_MCRUSOE) += -march=i686 $(align)2928cflags-$(CONFIG_MEFFICEON) += -march=i686 $(call tune,pentium3) $(align)3029cflags-$(CONFIG_MWINCHIPC6) += $(call cc-option,-march=winchip-c6,-march=i586)···3132cflags-$(CONFIG_MCYRIXIII) += $(call cc-option,-march=c3,-march=i486) $(align)3233cflags-$(CONFIG_MVIAC3_2) += $(call cc-option,-march=c3-2,-march=i686)3334cflags-$(CONFIG_MVIAC7) += -march=i6863434-cflags-$(CONFIG_MCORE2) += -march=i686 $(call tune,core2)3535-cflags-$(CONFIG_MATOM) += $(call cc-option,-march=atom,$(call cc-option,-march=core2,-march=i686)) \3636- $(call cc-option,-mtune=atom,$(call cc-option,-mtune=generic))3535+cflags-$(CONFIG_MATOM) += -march=atom37363837# AMD Elan support3938cflags-$(CONFIG_MELAN) += -march=i486
+1-13
arch/x86/boot/compressed/misc.c
···235235236236 /*237237 * Process relocations: 32 bit relocations first then 64 bit after.238238- * Three sets of binary relocations are added to the end of the kernel238238+ * Two sets of binary relocations are added to the end of the kernel239239 * before compression. Each relocation table entry is the kernel240240 * address of the location which needs to be updated stored as a241241 * 32-bit value which is sign extended to 64 bits.···245245 * kernel bits...246246 * 0 - zero terminator for 64 bit relocations247247 * 64 bit relocation repeated248248- * 0 - zero terminator for inverse 32 bit relocations249249- * 32 bit inverse relocation repeated250248 * 0 - zero terminator for 32 bit relocations251249 * 32 bit relocation repeated252250 *···261263 *(uint32_t *)ptr += delta;262264 }263265#ifdef CONFIG_X86_64264264- while (*--reloc) {265265- long extended = *reloc;266266- extended += map;267267-268268- ptr = (unsigned long)extended;269269- if (ptr < min_addr || ptr > max_addr)270270- error("inverse 32-bit relocation outside of kernel!\n");271271-272272- *(int32_t *)ptr -= delta;273273- }274266 for (reloc--; *reloc; reloc--) {275267 long extended = *reloc;276268 extended += map;
-2
arch/x86/configs/xen.config
···11# global x86 required specific stuff22-# On 32-bit HIGHMEM4G is not allowed33-CONFIG_HIGHMEM64G=y42CONFIG_64BIT=y5364# These enable us to allow some of the
-2
arch/x86/entry/entry.S
···54545555THUNK warn_thunk_thunk, __warn_thunk56565757-#ifndef CONFIG_X86_645857/*5958 * Clang's implementation of TLS stack cookies requires the variable in6059 * question to be a TLS variable. If the variable happens to be defined as an···6667 */6768#ifdef CONFIG_STACKPROTECTOR6869EXPORT_SYMBOL(__ref_stack_chk_guard);6969-#endif7070#endif
···213213214214/* For C file, we already have NOKPROBE_SYMBOL macro */215215216216+/* Insert a comma if args are non-empty */217217+#define COMMA(x...) __COMMA(x)218218+#define __COMMA(...) , ##__VA_ARGS__219219+220220+/*221221+ * Combine multiple asm inline constraint args into a single arg for passing to222222+ * another macro.223223+ */224224+#define ASM_OUTPUT(x...) x225225+#define ASM_INPUT(x...) x226226+216227/*217228 * This output constraint should be used for any inline asm which has a "call"218229 * instruction. Otherwise the asm may be inserted before the frame pointer
···4646} __attribute__((aligned(PAGE_SIZE)));47474848DECLARE_PER_CPU_PAGE_ALIGNED(struct gdt_page, gdt_page);4949-DECLARE_INIT_PER_CPU(gdt_page);50495150/* Provide the original GDT */5251static inline struct desc_struct *get_cpu_gdt_rw(unsigned int cpu)
+3-2
arch/x86/include/asm/elf.h
···5454#define R_X86_64_GLOB_DAT 6 /* Create GOT entry */5555#define R_X86_64_JUMP_SLOT 7 /* Create PLT entry */5656#define R_X86_64_RELATIVE 8 /* Adjust by program base */5757-#define R_X86_64_GOTPCREL 9 /* 32 bit signed pc relative5858- offset to GOT */5757+#define R_X86_64_GOTPCREL 9 /* 32 bit signed pc relative offset to GOT */5858+#define R_X86_64_GOTPCRELX 415959+#define R_X86_64_REX_GOTPCRELX 425960#define R_X86_64_32 10 /* Direct 32 bit zero extended */6061#define R_X86_64_32S 11 /* Direct 32 bit sign extended */6162#define R_X86_64_16 12 /* Direct 16 bit zero extended */
+21-8
arch/x86/include/asm/intel-family.h
···110110111111#define INTEL_SAPPHIRERAPIDS_X IFM(6, 0x8F) /* Golden Cove */112112113113-#define INTEL_EMERALDRAPIDS_X IFM(6, 0xCF)113113+#define INTEL_EMERALDRAPIDS_X IFM(6, 0xCF) /* Raptor Cove */114114115115-#define INTEL_GRANITERAPIDS_X IFM(6, 0xAD)115115+#define INTEL_GRANITERAPIDS_X IFM(6, 0xAD) /* Redwood Cove */116116#define INTEL_GRANITERAPIDS_D IFM(6, 0xAE)117117118118/* "Hybrid" Processors (P-Core/E-Core) */···126126#define INTEL_RAPTORLAKE_P IFM(6, 0xBA)127127#define INTEL_RAPTORLAKE_S IFM(6, 0xBF)128128129129-#define INTEL_METEORLAKE IFM(6, 0xAC)129129+#define INTEL_METEORLAKE IFM(6, 0xAC) /* Redwood Cove / Crestmont */130130#define INTEL_METEORLAKE_L IFM(6, 0xAA)131131132132-#define INTEL_ARROWLAKE_H IFM(6, 0xC5)132132+#define INTEL_ARROWLAKE_H IFM(6, 0xC5) /* Lion Cove / Skymont */133133#define INTEL_ARROWLAKE IFM(6, 0xC6)134134#define INTEL_ARROWLAKE_U IFM(6, 0xB5)135135136136-#define INTEL_LUNARLAKE_M IFM(6, 0xBD)136136+#define INTEL_LUNARLAKE_M IFM(6, 0xBD) /* Lion Cove / Skymont */137137138138-#define INTEL_PANTHERLAKE_L IFM(6, 0xCC)138138+#define INTEL_PANTHERLAKE_L IFM(6, 0xCC) /* Cougar Cove / Crestmont */139139140140/* "Small Core" Processors (Atom/E-Core) */141141···149149#define INTEL_ATOM_SILVERMONT IFM(6, 0x37) /* Bay Trail, Valleyview */150150#define INTEL_ATOM_SILVERMONT_D IFM(6, 0x4D) /* Avaton, Rangely */151151#define INTEL_ATOM_SILVERMONT_MID IFM(6, 0x4A) /* Merriefield */152152+#define INTEL_ATOM_SILVERMONT_MID2 IFM(6, 0x5A) /* Anniedale */152153153154#define INTEL_ATOM_AIRMONT IFM(6, 0x4C) /* Cherry Trail, Braswell */154154-#define INTEL_ATOM_AIRMONT_MID IFM(6, 0x5A) /* Moorefield */155155#define INTEL_ATOM_AIRMONT_NP IFM(6, 0x75) /* Lightning Mountain */156156157157#define INTEL_ATOM_GOLDMONT IFM(6, 0x5C) /* Apollo Lake */···182182/* Family 19 */183183#define INTEL_PANTHERCOVE_X IFM(19, 0x01) /* Diamond Rapids */184184185185-/* CPU core types */185185+/*186186+ * Intel CPU core types187187+ *188188+ * CPUID.1AH.EAX[31:0] uniquely identifies the microarchitecture189189+ * of the core. Bits 31-24 indicates its core type (Core or Atom)190190+ * and Bits [23:0] indicates the native model ID of the core.191191+ * Core type and native model ID are defined in below enumerations.192192+ */186193enum intel_cpu_type {194194+ INTEL_CPU_TYPE_UNKNOWN,187195 INTEL_CPU_TYPE_ATOM = 0x20,188196 INTEL_CPU_TYPE_CORE = 0x40,197197+};198198+199199+enum intel_native_id {200200+ INTEL_ATOM_CMT_NATIVE_ID = 0x2, /* Crestmont */201201+ INTEL_ATOM_SKT_NATIVE_ID = 0x3, /* Skymont */189202};190203191204#endif /* _ASM_X86_INTEL_FAMILY_H */
+3
arch/x86/include/asm/io.h
···175175extern void __iomem *ioremap_encrypted(resource_size_t phys_addr, unsigned long size);176176#define ioremap_encrypted ioremap_encrypted177177178178+void *arch_memremap_wb(phys_addr_t phys_addr, size_t size, unsigned long flags);179179+#define arch_memremap_wb arch_memremap_wb180180+178181/**179182 * ioremap - map bus memory into CPU space180183 * @offset: bus address of the memory
···198198.endm199199200200/*201201- * Equivalent to -mindirect-branch-cs-prefix; emit the 5 byte jmp/call202202- * to the retpoline thunk with a CS prefix when the register requires203203- * a RAX prefix byte to encode. Also see apply_retpolines().201201+ * Emits a conditional CS prefix that is compatible with202202+ * -mindirect-branch-cs-prefix.204203 */205204.macro __CS_PREFIX reg:req206205 .irp rs,r8,r9,r10,r11,r12,r13,r14,r15···420421#ifdef CONFIG_X86_64421422422423/*424424+ * Emits a conditional CS prefix that is compatible with425425+ * -mindirect-branch-cs-prefix.426426+ */427427+#define __CS_PREFIX(reg) \428428+ ".irp rs,r8,r9,r10,r11,r12,r13,r14,r15\n" \429429+ ".ifc \\rs," reg "\n" \430430+ ".byte 0x2e\n" \431431+ ".endif\n" \432432+ ".endr\n"433433+434434+/*423435 * Inline asm uses the %V modifier which is only in newer GCC424436 * which is ensured when CONFIG_MITIGATION_RETPOLINE is defined.425437 */426426-# define CALL_NOSPEC \427427- ALTERNATIVE_2( \428428- ANNOTATE_RETPOLINE_SAFE \429429- "call *%[thunk_target]\n", \430430- "call __x86_indirect_thunk_%V[thunk_target]\n", \431431- X86_FEATURE_RETPOLINE, \432432- "lfence;\n" \433433- ANNOTATE_RETPOLINE_SAFE \434434- "call *%[thunk_target]\n", \435435- X86_FEATURE_RETPOLINE_LFENCE)438438+#ifdef CONFIG_MITIGATION_RETPOLINE439439+#define CALL_NOSPEC __CS_PREFIX("%V[thunk_target]") \440440+ "call __x86_indirect_thunk_%V[thunk_target]\n"441441+#else442442+#define CALL_NOSPEC "call *%[thunk_target]\n"443443+#endif436444437445# define THUNK_TARGET(addr) [thunk_target] "r" (addr)438446
+2-2
arch/x86/include/asm/page_32_types.h
···1111 * a virtual address space of one gigabyte, which limits the1212 * amount of physical memory you can use to about 950MB.1313 *1414- * If you want more physical memory than this then see the CONFIG_HIGHMEM4G1515- * and CONFIG_HIGHMEM64G options in the kernel configuration.1414+ * If you want more physical memory than this then see the CONFIG_VMSPLIT_2G1515+ * and CONFIG_HIGHMEM4G options in the kernel configuration.1616 */1717#define __PAGE_OFFSET_BASE _AC(CONFIG_PAGE_OFFSET, UL)1818#define __PAGE_OFFSET __PAGE_OFFSET_BASE
···2929static inline void paravirt_release_p4d(unsigned long pfn) {}3030#endif31313232-/*3333- * Flags to use when allocating a user page table page.3434- */3535-extern gfp_t __userpte_alloc_gfp;3636-3732#ifdef CONFIG_MITIGATION_PAGE_TABLE_ISOLATION3833/*3934 * Instead of one PGD, we acquire two PGDs. Being order-1, it is
+14-35
arch/x86/include/asm/processor.h
···6060# define ARCH_MIN_MMSTRUCT_ALIGN 06161#endif62626363-enum tlb_infos {6464- ENTRIES,6565- NR_INFO6666-};6767-6868-extern u16 __read_mostly tlb_lli_4k[NR_INFO];6969-extern u16 __read_mostly tlb_lli_2m[NR_INFO];7070-extern u16 __read_mostly tlb_lli_4m[NR_INFO];7171-extern u16 __read_mostly tlb_lld_4k[NR_INFO];7272-extern u16 __read_mostly tlb_lld_2m[NR_INFO];7373-extern u16 __read_mostly tlb_lld_4m[NR_INFO];7474-extern u16 __read_mostly tlb_lld_1g[NR_INFO];6363+extern u16 __read_mostly tlb_lli_4k;6464+extern u16 __read_mostly tlb_lli_2m;6565+extern u16 __read_mostly tlb_lli_4m;6666+extern u16 __read_mostly tlb_lld_4k;6767+extern u16 __read_mostly tlb_lld_2m;6868+extern u16 __read_mostly tlb_lld_4m;6969+extern u16 __read_mostly tlb_lld_1g;75707671/*7772 * CPU type and hardware bug flags. Kept separately for each CPU.···229234void init_cpu_devs(void);230235void get_cpu_vendor(struct cpuinfo_x86 *c);231236extern void early_cpu_init(void);232232-extern void identify_secondary_cpu(struct cpuinfo_x86 *);237237+extern void identify_secondary_cpu(unsigned int cpu);233238extern void print_cpu_info(struct cpuinfo_x86 *);234239void print_cpu_msr(struct cpuinfo_x86 *);235240···416421} __aligned(IRQ_STACK_SIZE);417422418423#ifdef CONFIG_X86_64419419-struct fixed_percpu_data {420420- /*421421- * GCC hardcodes the stack canary as %gs:40. Since the422422- * irq_stack is the object at %gs:0, we reserve the bottom423423- * 48 bytes of the irq stack for the canary.424424- *425425- * Once we are willing to require -mstack-protector-guard-symbol=426426- * support for x86_64 stackprotector, we can get rid of this.427427- */428428- char gs_base[40];429429- unsigned long stack_canary;430430-};431431-432432-DECLARE_PER_CPU_FIRST(struct fixed_percpu_data, fixed_percpu_data) __visible;433433-DECLARE_INIT_PER_CPU(fixed_percpu_data);434434-435424static inline unsigned long cpu_kernelmode_gs_base(int cpu)436425{437437- return (unsigned long)per_cpu(fixed_percpu_data.gs_base, cpu);426426+#ifdef CONFIG_SMP427427+ return per_cpu_offset(cpu);428428+#else429429+ return 0;430430+#endif438431}439432440433extern asmlinkage void entry_SYSCALL32_ignore(void);441434442435/* Save actual FS/GS selectors and bases to current->thread */443436void current_save_fsgs(void);444444-#else /* X86_64 */445445-#ifdef CONFIG_STACKPROTECTOR446446-DECLARE_PER_CPU(unsigned long, __stack_chk_guard);447447-#endif448448-#endif /* !X86_64 */437437+#endif /* X86_64 */449438450439struct perf_event;451440
···11-/* SPDX-License-Identifier: GPL-2.0 */22-/*33- * Header file for STMicroelectronics ConneXt (STA2X11) IOHub44- */55-#ifndef __ASM_STA2X11_H66-#define __ASM_STA2X11_H77-88-#include <linux/pci.h>99-1010-/* This needs to be called from the MFD to configure its sub-devices */1111-struct sta2x11_instance *sta2x11_get_instance(struct pci_dev *pdev);1212-1313-#endif /* __ASM_STA2X11_H */
+5-31
arch/x86/include/asm/stackprotector.h
···22/*33 * GCC stack protector support.44 *55- * Stack protector works by putting predefined pattern at the start of55+ * Stack protector works by putting a predefined pattern at the start of66 * the stack frame and verifying that it hasn't been overwritten when77- * returning from the function. The pattern is called stack canary88- * and unfortunately gcc historically required it to be at a fixed offset99- * from the percpu segment base. On x86_64, the offset is 40 bytes.1010- *1111- * The same segment is shared by percpu area and stack canary. On1212- * x86_64, percpu symbols are zero based and %gs (64-bit) points to the1313- * base of percpu area. The first occupant of the percpu area is always1414- * fixed_percpu_data which contains stack_canary at the appropriate1515- * offset. On x86_32, the stack canary is just a regular percpu1616- * variable.1717- *1818- * Putting percpu data in %fs on 32-bit is a minor optimization compared to1919- * using %gs. Since 32-bit userspace normally has %fs == 0, we are likely2020- * to load 0 into %fs on exit to usermode, whereas with percpu data in2121- * %gs, we are likely to load a non-null %gs on return to user mode.2222- *2323- * Once we are willing to require GCC 8.1 or better for 64-bit stackprotector2424- * support, we can remove some of this complexity.77+ * returning from the function. The pattern is called the stack canary88+ * and is a unique value for each task.259 */26102711#ifndef _ASM_STACKPROTECTOR_H···1935#include <asm/desc.h>20362137#include <linux/sched.h>3838+3939+DECLARE_PER_CPU(unsigned long, __stack_chk_guard);22402341/*2442 * Initialize the stackprotector canary value.···3751{3852 unsigned long canary = get_random_canary();39534040-#ifdef CONFIG_X86_644141- BUILD_BUG_ON(offsetof(struct fixed_percpu_data, stack_canary) != 40);4242-#endif4343-4454 current->stack_canary = canary;4545-#ifdef CONFIG_X86_644646- this_cpu_write(fixed_percpu_data.stack_canary, canary);4747-#else4855 this_cpu_write(__stack_chk_guard, canary);4949-#endif5056}51575258static inline void cpu_init_stack_canary(int cpu, struct task_struct *idle)5359{5454-#ifdef CONFIG_X86_645555- per_cpu(fixed_percpu_data.stack_canary, cpu) = idle->stack_canary;5656-#else5760 per_cpu(__stack_chk_guard, cpu) = idle->stack_canary;5858-#endif5961}60626163#else /* STACKPROTECTOR */
-4
arch/x86/include/asm/vermagic.h
···1515#define MODULE_PROC_FAMILY "586TSC "1616#elif defined CONFIG_M586MMX1717#define MODULE_PROC_FAMILY "586MMX "1818-#elif defined CONFIG_MCORE21919-#define MODULE_PROC_FAMILY "CORE2 "2018#elif defined CONFIG_MATOM2119#define MODULE_PROC_FAMILY "ATOM "2220#elif defined CONFIG_M686···3133#define MODULE_PROC_FAMILY "K6 "3234#elif defined CONFIG_MK73335#define MODULE_PROC_FAMILY "K7 "3434-#elif defined CONFIG_MK83535-#define MODULE_PROC_FAMILY "K8 "3636#elif defined CONFIG_MELAN3737#define MODULE_PROC_FAMILY "ELAN "3838#elif defined CONFIG_MCRUSOE
···1616#include <asm/cpuid.h>1717#include <asm/mwait.h>1818#include <asm/special_insns.h>1919+#include <asm/smp.h>19202021/*2122 * Initialize bm_flags based on the CPU cache properties···205204 return retval;206205}207206EXPORT_SYMBOL_GPL(acpi_processor_ffh_cstate_probe);207207+208208+void __noreturn acpi_processor_ffh_play_dead(struct acpi_processor_cx *cx)209209+{210210+ unsigned int cpu = smp_processor_id();211211+ struct cstate_entry *percpu_entry;212212+213213+ percpu_entry = per_cpu_ptr(cpu_cstate_entry, cpu);214214+ mwait_play_dead(percpu_entry->states[cx->index].eax);215215+}216216+EXPORT_SYMBOL_GPL(acpi_processor_ffh_play_dead);208217209218void __cpuidle acpi_processor_ffh_cstate_enter(struct acpi_processor_cx *cx)210219{
-3
arch/x86/kernel/apic/Makefile
···2323obj-y += apic_flat_64.o2424endif25252626-# APIC probe will depend on the listing order here2727-obj-$(CONFIG_X86_BIGSMP) += bigsmp_32.o2828-2926# For 32bit, probe_32 need to be listed last3027obj-$(CONFIG_X86_LOCAL_APIC) += probe_$(BITS).o
···9393}9494early_param("apic", parse_apic);95959696-void __init x86_32_probe_bigsmp_early(void)9797-{9898- if (nr_cpu_ids <= 8 || xen_pv_domain())9999- return;100100-101101- if (IS_ENABLED(CONFIG_X86_BIGSMP)) {102102- switch (boot_cpu_data.x86_vendor) {103103- case X86_VENDOR_INTEL:104104- if (!APIC_XAPIC(boot_cpu_apic_version))105105- break;106106- /* P4 and above */107107- fallthrough;108108- case X86_VENDOR_HYGON:109109- case X86_VENDOR_AMD:110110- if (apic_bigsmp_possible(cmdline_apic))111111- return;112112- break;113113- }114114- }115115- pr_info("Limiting to 8 possible CPUs\n");116116- set_nr_cpu_ids(8);117117-}118118-119119-void __init x86_32_install_bigsmp(void)120120-{121121- if (nr_cpu_ids > 8 && !xen_pv_domain())122122- apic_bigsmp_force();123123-}124124-12596void __init x86_32_probe_apic(void)12697{12798 if (!cmdline_apic) {
···6161 /* Set up the stack for verify_cpu() */6262 leaq __top_init_kernel_stack(%rip), %rsp63636464- /* Setup GSBASE to allow stack canary access for C code */6464+ /*6565+ * Set up GSBASE.6666+ * Note that on SMP the boot CPU uses the init data section until6767+ * the per-CPU areas are set up.6868+ */6569 movl $MSR_GS_BASE, %ecx6666- leaq INIT_PER_CPU_VAR(fixed_percpu_data)(%rip), %rdx6767- movl %edx, %eax6868- shrq $32, %rdx7070+ xorl %eax, %eax7171+ xorl %edx, %edx6972 wrmsr70737174 call startup_64_setup_gdt_idt···362359 movl %eax,%fs363360 movl %eax,%gs364361365365- /* Set up %gs.366366- *367367- * The base of %gs always points to fixed_percpu_data. If the368368- * stack protector canary is enabled, it is located at %gs:40.362362+ /*363363+ * Set up GSBASE.369364 * Note that, on SMP, the boot cpu uses init data section until370365 * the per cpu areas are set up.371366 */372367 movl $MSR_GS_BASE,%ecx373373-#ifndef CONFIG_SMP374374- leaq INIT_PER_CPU_VAR(fixed_percpu_data)(%rip), %rdx375375-#endif376368 movl %edx, %eax377369 shrq $32, %rdx378370 wrmsr
+1-1
arch/x86/kernel/ioport.c
···144144 * Update the sequence number to force a TSS update on return to145145 * user mode.146146 */147147- iobm->sequence = atomic64_add_return(1, &io_bitmap_sequence);147147+ iobm->sequence = atomic64_inc_return(&io_bitmap_sequence);148148149149 return 0;150150}
···3333#include <asm/smap.h>3434#include <asm/gsseg.h>35353636+/*3737+ * The first GDT descriptor is reserved as 'NULL descriptor'. As bits 03838+ * and 1 of a segment selector, i.e., the RPL bits, are NOT used to index3939+ * GDT, selector values 0~3 all point to the NULL descriptor, thus values4040+ * 0, 1, 2 and 3 are all valid NULL selector values.4141+ *4242+ * However IRET zeros ES, FS, GS, and DS segment registers if any of them4343+ * is found to have any nonzero NULL selector value, which can be used by4444+ * userspace in pre-FRED systems to spot any interrupt/exception by loading4545+ * a nonzero NULL selector and waiting for it to become zero. Before FRED4646+ * there was nothing software could do to prevent such an information leak.4747+ *4848+ * ERETU, the only legit instruction to return to userspace from kernel4949+ * under FRED, by design does NOT zero any segment register to avoid this5050+ * problem behavior.5151+ *5252+ * As such, leave NULL selector values 0~3 unchanged.5353+ */5454+static inline u16 fixup_rpl(u16 sel)5555+{5656+ return sel <= 3 ? sel : sel | 3;5757+}5858+3659#ifdef CONFIG_IA32_EMULATION3760#include <asm/unistd_32_ia32.h>38613962static inline void reload_segments(struct sigcontext_32 *sc)4063{4141- unsigned int cur;6464+ u16 cur;42656666+ /*6767+ * Reload fs and gs if they have changed in the signal6868+ * handler. This does not handle long fs/gs base changes in6969+ * the handler, but does not clobber them at least in the7070+ * normal case.7171+ */4372 savesegment(gs, cur);4444- if ((sc->gs | 0x03) != cur)4545- load_gs_index(sc->gs | 0x03);7373+ if (fixup_rpl(sc->gs) != cur)7474+ load_gs_index(fixup_rpl(sc->gs));4675 savesegment(fs, cur);4747- if ((sc->fs | 0x03) != cur)4848- loadsegment(fs, sc->fs | 0x03);7676+ if (fixup_rpl(sc->fs) != cur)7777+ loadsegment(fs, fixup_rpl(sc->fs));7878+4979 savesegment(ds, cur);5050- if ((sc->ds | 0x03) != cur)5151- loadsegment(ds, sc->ds | 0x03);8080+ if (fixup_rpl(sc->ds) != cur)8181+ loadsegment(ds, fixup_rpl(sc->ds));5282 savesegment(es, cur);5353- if ((sc->es | 0x03) != cur)5454- loadsegment(es, sc->es | 0x03);8383+ if (fixup_rpl(sc->es) != cur)8484+ loadsegment(es, fixup_rpl(sc->es));5585}56865787#define sigset32_t compat_sigset_t···135105 regs->orig_ax = -1;136106137107#ifdef CONFIG_IA32_EMULATION138138- /*139139- * Reload fs and gs if they have changed in the signal140140- * handler. This does not handle long fs/gs base changes in141141- * the handler, but does not clobber them at least in the142142- * normal case.143143- */144108 reload_segments(&sc);145109#else146146- loadsegment(gs, sc.gs);147147- regs->fs = sc.fs;148148- regs->es = sc.es;149149- regs->ds = sc.ds;110110+ loadsegment(gs, fixup_rpl(sc.gs));111111+ regs->fs = fixup_rpl(sc.fs);112112+ regs->es = fixup_rpl(sc.es);113113+ regs->ds = fixup_rpl(sc.ds);150114#endif151115152116 return fpu__restore_sig(compat_ptr(sc.fpstate), 1);
+7-61
arch/x86/kernel/smpboot.c
···190190 apic_ap_setup();191191192192 /* Save the processor parameters. */193193- smp_store_cpu_info(cpuid);193193+ identify_secondary_cpu(cpuid);194194195195 /*196196 * The topology information must be up to date before···215215{216216 /*217217 * Calibrate the delay loop and update loops_per_jiffy in cpu_data.218218- * smp_store_cpu_info() stored a value that is close but not as218218+ * identify_secondary_cpu() stored a value that is close but not as219219 * accurate as the value just calculated.220220 *221221 * As this is invoked after the TSC synchronization check,···315315 cpu_startup_entry(CPUHP_AP_ONLINE_IDLE);316316}317317ANNOTATE_NOENDBR_SYM(start_secondary);318318-319319-/*320320- * The bootstrap kernel entry code has set these up. Save them for321321- * a given CPU322322- */323323-void smp_store_cpu_info(int id)324324-{325325- struct cpuinfo_x86 *c = &cpu_data(id);326326-327327- /* Copy boot_cpu_data only on the first bringup */328328- if (!c->initialized)329329- *c = boot_cpu_data;330330- c->cpu_index = id;331331- /*332332- * During boot time, CPU0 has this setup already. Save the info when333333- * bringing up an AP.334334- */335335- identify_secondary_cpu(c);336336- c->initialized = true;337337-}338318339319static bool340320topology_same_node(struct cpuinfo_x86 *c, struct cpuinfo_x86 *o)···12431263 * We need to flush the caches before going to sleep, lest we have12441264 * dirty data in our caches when we come back up.12451265 */12461246-static inline void mwait_play_dead(void)12661266+void __noreturn mwait_play_dead(unsigned int eax_hint)12471267{12481268 struct mwait_cpu_dead *md = this_cpu_ptr(&mwait_cpu_dead);12491249- unsigned int eax, ebx, ecx, edx;12501250- unsigned int highest_cstate = 0;12511251- unsigned int highest_subcstate = 0;12521252- int i;12531253-12541254- if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD ||12551255- boot_cpu_data.x86_vendor == X86_VENDOR_HYGON)12561256- return;12571257- if (!this_cpu_has(X86_FEATURE_MWAIT))12581258- return;12591259- if (!this_cpu_has(X86_FEATURE_CLFLUSH))12601260- return;12611261-12621262- eax = CPUID_LEAF_MWAIT;12631263- ecx = 0;12641264- native_cpuid(&eax, &ebx, &ecx, &edx);12651265-12661266- /*12671267- * eax will be 0 if EDX enumeration is not valid.12681268- * Initialized below to cstate, sub_cstate value when EDX is valid.12691269- */12701270- if (!(ecx & CPUID5_ECX_EXTENSIONS_SUPPORTED)) {12711271- eax = 0;12721272- } else {12731273- edx >>= MWAIT_SUBSTATE_SIZE;12741274- for (i = 0; i < 7 && edx; i++, edx >>= MWAIT_SUBSTATE_SIZE) {12751275- if (edx & MWAIT_SUBSTATE_MASK) {12761276- highest_cstate = i;12771277- highest_subcstate = edx & MWAIT_SUBSTATE_MASK;12781278- }12791279- }12801280- eax = (highest_cstate << MWAIT_SUBSTATE_SIZE) |12811281- (highest_subcstate - 1);12821282- }1283126912841270 /* Set up state for the kexec() hack below */12851271 md->status = CPUDEAD_MWAIT_WAIT;···12661320 mb();12671321 __monitor(md, 0, 0);12681322 mb();12691269- __mwait(eax, 0);13231323+ __mwait(eax_hint, 0);1270132412711325 if (READ_ONCE(md->control) == CPUDEAD_MWAIT_KEXEC_HLT) {12721326 /*···13381392 play_dead_common();13391393 tboot_shutdown(TB_SHUTDOWN_WFS);1340139413411341- mwait_play_dead();13421342- if (cpuidle_play_dead())13431343- hlt_play_dead();13951395+ /* Below returns only on error. */13961396+ cpuidle_play_dead();13971397+ hlt_play_dead();13441398}1345139913461400#else /* ... !CONFIG_HOTPLUG_CPU */
···7788.text991010-#ifndef CONFIG_X86_CMPXCHG641010+#ifndef CONFIG_X86_CX811111212/*1313 * Emulate 'cmpxchg8b (%esi)' on UP
+2-7
arch/x86/mm/init_32.c
···582582 "only %luMB highmem pages available, ignoring highmem size of %luMB!\n"583583584584#define MSG_HIGHMEM_TRIMMED \585585- "Warning: only 4GB will be used. Use a HIGHMEM64G enabled kernel!\n"585585+ "Warning: only 4GB will be used. Support for for CONFIG_HIGHMEM64G was removed!\n"586586/*587587 * We have more RAM than fits into lowmem - we try to put it into588588 * highmem, also taking the highmem=x boot parameter into account:···606606#ifndef CONFIG_HIGHMEM607607 /* Maximum memory usable is what is directly addressable */608608 printk(KERN_WARNING "Warning only %ldMB will be used.\n", MAXMEM>>20);609609- if (max_pfn > MAX_NONPAE_PFN)610610- printk(KERN_WARNING "Use a HIGHMEM64G enabled kernel.\n");611611- else612612- printk(KERN_WARNING "Use a HIGHMEM enabled kernel.\n");609609+ printk(KERN_WARNING "Use a HIGHMEM enabled kernel.\n");613610 max_pfn = MAXMEM_PFN;614611#else /* !CONFIG_HIGHMEM */615615-#ifndef CONFIG_HIGHMEM64G616612 if (max_pfn > MAX_NONPAE_PFN) {617613 max_pfn = MAX_NONPAE_PFN;618614 printk(KERN_WARNING MSG_HIGHMEM_TRIMMED);619615 }620620-#endif /* !CONFIG_HIGHMEM64G */621616#endif /* !CONFIG_HIGHMEM */622617}623618
+8
arch/x86/mm/ioremap.c
···503503}504504EXPORT_SYMBOL(iounmap);505505506506+void *arch_memremap_wb(phys_addr_t phys_addr, size_t size, unsigned long flags)507507+{508508+ if ((flags & MEMREMAP_DEC) || cc_platform_has(CC_ATTR_HOST_MEM_ENCRYPT))509509+ return (void __force *)ioremap_cache(phys_addr, size);510510+511511+ return (void __force *)ioremap_encrypted(phys_addr, size);512512+}513513+506514/*507515 * Convert a physical pointer to a virtual kernel pointer for /dev/mem508516 * access
+8-2
arch/x86/mm/kaslr.c
···113113 memory_tb = DIV_ROUND_UP(max_pfn << PAGE_SHIFT, 1UL << TB_SHIFT) +114114 CONFIG_RANDOMIZE_MEMORY_PHYSICAL_PADDING;115115116116- /* Adapt physical memory region size based on available memory */117117- if (memory_tb < kaslr_regions[0].size_tb)116116+ /*117117+ * Adapt physical memory region size based on available memory,118118+ * except when CONFIG_PCI_P2PDMA is enabled. P2PDMA exposes the119119+ * device BAR space assuming the direct map space is large enough120120+ * for creating a ZONE_DEVICE mapping in the direct map corresponding121121+ * to the physical BAR address.122122+ */123123+ if (!IS_ENABLED(CONFIG_PCI_P2PDMA) && (memory_tb < kaslr_regions[0].size_tb))118124 kaslr_regions[0].size_tb = memory_tb;119125120126 /*
+1-8
arch/x86/mm/mmap.c
···8484{8585 unsigned long gap = rlim_stack->rlim_cur;8686 unsigned long pad = stack_maxrandom_size(task_size) + stack_guard_gap;8787- unsigned long gap_min, gap_max;88878988 /* Values close to RLIM_INFINITY can overflow. */9089 if (gap + pad > gap)···9394 * Top of mmap area (just below the process stack).9495 * Leave an at least ~128 MB hole with possible stack randomization.9596 */9696- gap_min = SIZE_128M;9797- gap_max = (task_size / 6) * 5;9898-9999- if (gap < gap_min)100100- gap = gap_min;101101- else if (gap > gap_max)102102- gap = gap_max;9797+ gap = clamp(gap, SIZE_128M, (task_size / 6) * 5);1039810499 return PAGE_ALIGN(task_size - gap - rnd);105100}
···11-// SPDX-License-Identifier: GPL-2.0-only22-/*33- * DMA translation between STA2x11 AMBA memory mapping and the x86 memory mapping44- *55- * ST Microelectronics ConneXt (STA2X11/STA2X10)66- *77- * Copyright (c) 2010-2011 Wind River Systems, Inc.88- */99-1010-#include <linux/pci.h>1111-#include <linux/pci_ids.h>1212-#include <linux/export.h>1313-#include <linux/list.h>1414-#include <linux/dma-map-ops.h>1515-#include <linux/swiotlb.h>1616-#include <asm/iommu.h>1717-#include <asm/sta2x11.h>1818-1919-#define STA2X11_SWIOTLB_SIZE (4*1024*1024)2020-2121-/*2222- * We build a list of bus numbers that are under the ConneXt. The2323- * main bridge hosts 4 busses, which are the 4 endpoints, in order.2424- */2525-#define STA2X11_NR_EP 4 /* 0..3 included */2626-#define STA2X11_NR_FUNCS 8 /* 0..7 included */2727-#define STA2X11_AMBA_SIZE (512 << 20)2828-2929-struct sta2x11_ahb_regs { /* saved during suspend */3030- u32 base, pexlbase, pexhbase, crw;3131-};3232-3333-struct sta2x11_mapping {3434- int is_suspended;3535- struct sta2x11_ahb_regs regs[STA2X11_NR_FUNCS];3636-};3737-3838-struct sta2x11_instance {3939- struct list_head list;4040- int bus0;4141- struct sta2x11_mapping map[STA2X11_NR_EP];4242-};4343-4444-static LIST_HEAD(sta2x11_instance_list);4545-4646-/* At probe time, record new instances of this bridge (likely one only) */4747-static void sta2x11_new_instance(struct pci_dev *pdev)4848-{4949- struct sta2x11_instance *instance;5050-5151- instance = kzalloc(sizeof(*instance), GFP_ATOMIC);5252- if (!instance)5353- return;5454- /* This has a subordinate bridge, with 4 more-subordinate ones */5555- instance->bus0 = pdev->subordinate->number + 1;5656-5757- if (list_empty(&sta2x11_instance_list)) {5858- int size = STA2X11_SWIOTLB_SIZE;5959- /* First instance: register your own swiotlb area */6060- dev_info(&pdev->dev, "Using SWIOTLB (size %i)\n", size);6161- if (swiotlb_init_late(size, GFP_DMA, NULL))6262- dev_emerg(&pdev->dev, "init swiotlb failed\n");6363- }6464- list_add(&instance->list, &sta2x11_instance_list);6565-}6666-DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_STMICRO, 0xcc17, sta2x11_new_instance);6767-6868-/*6969- * Utility functions used in this file from below7070- */7171-static struct sta2x11_instance *sta2x11_pdev_to_instance(struct pci_dev *pdev)7272-{7373- struct sta2x11_instance *instance;7474- int ep;7575-7676- list_for_each_entry(instance, &sta2x11_instance_list, list) {7777- ep = pdev->bus->number - instance->bus0;7878- if (ep >= 0 && ep < STA2X11_NR_EP)7979- return instance;8080- }8181- return NULL;8282-}8383-8484-static int sta2x11_pdev_to_ep(struct pci_dev *pdev)8585-{8686- struct sta2x11_instance *instance;8787-8888- instance = sta2x11_pdev_to_instance(pdev);8989- if (!instance)9090- return -1;9191-9292- return pdev->bus->number - instance->bus0;9393-}9494-9595-/* This is exported, as some devices need to access the MFD registers */9696-struct sta2x11_instance *sta2x11_get_instance(struct pci_dev *pdev)9797-{9898- return sta2x11_pdev_to_instance(pdev);9999-}100100-EXPORT_SYMBOL(sta2x11_get_instance);101101-102102-/* At setup time, we use our own ops if the device is a ConneXt one */103103-static void sta2x11_setup_pdev(struct pci_dev *pdev)104104-{105105- struct sta2x11_instance *instance = sta2x11_pdev_to_instance(pdev);106106-107107- if (!instance) /* either a sta2x11 bridge or another ST device */108108- return;109109-110110- /* We must enable all devices as master, for audio DMA to work */111111- pci_set_master(pdev);112112-}113113-DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_STMICRO, PCI_ANY_ID, sta2x11_setup_pdev);114114-115115-/*116116- * At boot we must set up the mappings for the pcie-to-amba bridge.117117- * It involves device access, and the same happens at suspend/resume time118118- */119119-120120-#define AHB_MAPB 0xCA4121121-#define AHB_CRW(i) (AHB_MAPB + 0 + (i) * 0x10)122122-#define AHB_CRW_SZMASK 0xfffffc00UL123123-#define AHB_CRW_ENABLE (1 << 0)124124-#define AHB_CRW_WTYPE_MEM (2 << 1)125125-#define AHB_CRW_ROE (1UL << 3) /* Relax Order Ena */126126-#define AHB_CRW_NSE (1UL << 4) /* No Snoop Enable */127127-#define AHB_BASE(i) (AHB_MAPB + 4 + (i) * 0x10)128128-#define AHB_PEXLBASE(i) (AHB_MAPB + 8 + (i) * 0x10)129129-#define AHB_PEXHBASE(i) (AHB_MAPB + 12 + (i) * 0x10)130130-131131-/* At probe time, enable mapping for each endpoint, using the pdev */132132-static void sta2x11_map_ep(struct pci_dev *pdev)133133-{134134- struct sta2x11_instance *instance = sta2x11_pdev_to_instance(pdev);135135- struct device *dev = &pdev->dev;136136- u32 amba_base, max_amba_addr;137137- int i, ret;138138-139139- if (!instance)140140- return;141141-142142- pci_read_config_dword(pdev, AHB_BASE(0), &amba_base);143143- max_amba_addr = amba_base + STA2X11_AMBA_SIZE - 1;144144-145145- ret = dma_direct_set_offset(dev, 0, amba_base, STA2X11_AMBA_SIZE);146146- if (ret)147147- dev_err(dev, "sta2x11: could not set DMA offset\n");148148-149149- dev->bus_dma_limit = max_amba_addr;150150- dma_set_mask_and_coherent(&pdev->dev, max_amba_addr);151151-152152- /* Configure AHB mapping */153153- pci_write_config_dword(pdev, AHB_PEXLBASE(0), 0);154154- pci_write_config_dword(pdev, AHB_PEXHBASE(0), 0);155155- pci_write_config_dword(pdev, AHB_CRW(0), STA2X11_AMBA_SIZE |156156- AHB_CRW_WTYPE_MEM | AHB_CRW_ENABLE);157157-158158- /* Disable all the other windows */159159- for (i = 1; i < STA2X11_NR_FUNCS; i++)160160- pci_write_config_dword(pdev, AHB_CRW(i), 0);161161-162162- dev_info(&pdev->dev,163163- "sta2x11: Map EP %i: AMBA address %#8x-%#8x\n",164164- sta2x11_pdev_to_ep(pdev), amba_base, max_amba_addr);165165-}166166-DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_STMICRO, PCI_ANY_ID, sta2x11_map_ep);167167-168168-#ifdef CONFIG_PM /* Some register values must be saved and restored */169169-170170-static struct sta2x11_mapping *sta2x11_pdev_to_mapping(struct pci_dev *pdev)171171-{172172- struct sta2x11_instance *instance;173173- int ep;174174-175175- instance = sta2x11_pdev_to_instance(pdev);176176- if (!instance)177177- return NULL;178178- ep = sta2x11_pdev_to_ep(pdev);179179- return instance->map + ep;180180-}181181-182182-static void suspend_mapping(struct pci_dev *pdev)183183-{184184- struct sta2x11_mapping *map = sta2x11_pdev_to_mapping(pdev);185185- int i;186186-187187- if (!map)188188- return;189189-190190- if (map->is_suspended)191191- return;192192- map->is_suspended = 1;193193-194194- /* Save all window configs */195195- for (i = 0; i < STA2X11_NR_FUNCS; i++) {196196- struct sta2x11_ahb_regs *regs = map->regs + i;197197-198198- pci_read_config_dword(pdev, AHB_BASE(i), ®s->base);199199- pci_read_config_dword(pdev, AHB_PEXLBASE(i), ®s->pexlbase);200200- pci_read_config_dword(pdev, AHB_PEXHBASE(i), ®s->pexhbase);201201- pci_read_config_dword(pdev, AHB_CRW(i), ®s->crw);202202- }203203-}204204-DECLARE_PCI_FIXUP_SUSPEND(PCI_VENDOR_ID_STMICRO, PCI_ANY_ID, suspend_mapping);205205-206206-static void resume_mapping(struct pci_dev *pdev)207207-{208208- struct sta2x11_mapping *map = sta2x11_pdev_to_mapping(pdev);209209- int i;210210-211211- if (!map)212212- return;213213-214214-215215- if (!map->is_suspended)216216- goto out;217217- map->is_suspended = 0;218218-219219- /* Restore all window configs */220220- for (i = 0; i < STA2X11_NR_FUNCS; i++) {221221- struct sta2x11_ahb_regs *regs = map->regs + i;222222-223223- pci_write_config_dword(pdev, AHB_BASE(i), regs->base);224224- pci_write_config_dword(pdev, AHB_PEXLBASE(i), regs->pexlbase);225225- pci_write_config_dword(pdev, AHB_PEXHBASE(i), regs->pexhbase);226226- pci_write_config_dword(pdev, AHB_CRW(i), regs->crw);227227- }228228-out:229229- pci_set_master(pdev); /* Like at boot, enable master on all devices */230230-}231231-DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_STMICRO, PCI_ANY_ID, resume_mapping);232232-233233-#endif /* CONFIG_PM */
+8-6
arch/x86/platform/pvh/head.S
···1731731:174174 UNWIND_HINT_END_OF_STACK175175176176- /* Set base address in stack canary descriptor. */177177- mov $MSR_GS_BASE,%ecx178178- leal canary(%rip), %eax179179- xor %edx, %edx176176+ /*177177+ * Set up GSBASE.178178+ * Note that on SMP the boot CPU uses the init data section until179179+ * the per-CPU areas are set up.180180+ */181181+ movl $MSR_GS_BASE,%ecx182182+ xorl %eax, %eax183183+ xorl %edx, %edx180184 wrmsr181185182186 /* Call xen_prepare_pvh() via the kernel virtual mapping */···242238SYM_DATA_END_LABEL(gdt_start, SYM_L_LOCAL, gdt_end)243239244240 .balign 16245245-SYM_DATA_LOCAL(canary, .fill 48, 1, 0)246246-247241SYM_DATA_START_LOCAL(early_stack)248242 .fill BOOT_STACK_SIZE, 1, 0249243SYM_DATA_END_LABEL(early_stack, SYM_L_LOCAL, early_stack_end)
+10-137
arch/x86/tools/relocs.c
···2929static struct relocs relocs32;30303131#if ELF_BITS == 643232-static struct relocs relocs32neg;3332static struct relocs relocs64;3433# define FMT PRIu643434+3535+#ifndef R_X86_64_REX_GOTPCRELX3636+# define R_X86_64_REX_GOTPCRELX 423737+#endif3838+3539#else3640# define FMT PRIu323741#endif···9086 "__initramfs_start|"9187 "(jiffies|jiffies_64)|"9288#if ELF_BITS == 649393- "__per_cpu_load|"9494- "init_per_cpu__.*|"9589 "__end_rodata_hpage_align|"9690#endif9791 "_end)$"···229227 REL_TYPE(R_X86_64_PC16),230228 REL_TYPE(R_X86_64_8),231229 REL_TYPE(R_X86_64_PC8),230230+ REL_TYPE(R_X86_64_REX_GOTPCRELX),232231#else233232 REL_TYPE(R_386_NONE),234233 REL_TYPE(R_386_32),···285282 name = sec_name(sym_index(sym));286283287284 return name;288288-}289289-290290-static Elf_Sym *sym_lookup(const char *symname)291291-{292292- int i;293293-294294- for (i = 0; i < shnum; i++) {295295- struct section *sec = &secs[i];296296- long nsyms;297297- char *strtab;298298- Elf_Sym *symtab;299299- Elf_Sym *sym;300300-301301- if (sec->shdr.sh_type != SHT_SYMTAB)302302- continue;303303-304304- nsyms = sec->shdr.sh_size/sizeof(Elf_Sym);305305- symtab = sec->symtab;306306- strtab = sec->link->strtab;307307-308308- for (sym = symtab; --nsyms >= 0; sym++) {309309- if (!sym->st_name)310310- continue;311311- if (strcmp(symname, strtab + sym->st_name) == 0)312312- return sym;313313- }314314- }315315- return 0;316285}317286318287#if BYTE_ORDER == LITTLE_ENDIAN···735760 }736761}737762738738-/*739739- * The .data..percpu section is a special case for x86_64 SMP kernels.740740- * It is used to initialize the actual per_cpu areas and to provide741741- * definitions for the per_cpu variables that correspond to their offsets742742- * within the percpu area. Since the values of all of the symbols need743743- * to be offsets from the start of the per_cpu area the virtual address744744- * (sh_addr) of .data..percpu is 0 in SMP kernels.745745- *746746- * This means that:747747- *748748- * Relocations that reference symbols in the per_cpu area do not749749- * need further relocation (since the value is an offset relative750750- * to the start of the per_cpu area that does not change).751751- *752752- * Relocations that apply to the per_cpu area need to have their753753- * offset adjusted by by the value of __per_cpu_load to make them754754- * point to the correct place in the loaded image (because the755755- * virtual address of .data..percpu is 0).756756- *757757- * For non SMP kernels .data..percpu is linked as part of the normal758758- * kernel data and does not require special treatment.759759- *760760- */761761-static int per_cpu_shndx = -1;762762-static Elf_Addr per_cpu_load_addr;763763-764764-static void percpu_init(void)765765-{766766- int i;767767-768768- for (i = 0; i < shnum; i++) {769769- ElfW(Sym) *sym;770770-771771- if (strcmp(sec_name(i), ".data..percpu"))772772- continue;773773-774774- if (secs[i].shdr.sh_addr != 0) /* non SMP kernel */775775- return;776776-777777- sym = sym_lookup("__per_cpu_load");778778- if (!sym)779779- die("can't find __per_cpu_load\n");780780-781781- per_cpu_shndx = i;782782- per_cpu_load_addr = sym->st_value;783783-784784- return;785785- }786786-}787787-788763#if ELF_BITS == 64789789-790790-/*791791- * Check to see if a symbol lies in the .data..percpu section.792792- *793793- * The linker incorrectly associates some symbols with the794794- * .data..percpu section so we also need to check the symbol795795- * name to make sure that we classify the symbol correctly.796796- *797797- * The GNU linker incorrectly associates:798798- * __init_begin799799- * __per_cpu_load800800- *801801- * The "gold" linker incorrectly associates:802802- * init_per_cpu__fixed_percpu_data803803- * init_per_cpu__gdt_page804804- */805805-static int is_percpu_sym(ElfW(Sym) *sym, const char *symname)806806-{807807- int shndx = sym_index(sym);808808-809809- return (shndx == per_cpu_shndx) &&810810- strcmp(symname, "__init_begin") &&811811- strcmp(symname, "__per_cpu_load") &&812812- strncmp(symname, "init_per_cpu_", 13);813813-}814814-815764816765static int do_reloc64(struct section *sec, Elf_Rel *rel, ElfW(Sym) *sym,817766 const char *symname)···747848 if (sym->st_shndx == SHN_UNDEF)748849 return 0;749850750750- /*751751- * Adjust the offset if this reloc applies to the percpu section.752752- */753753- if (sec->shdr.sh_info == per_cpu_shndx)754754- offset += per_cpu_load_addr;755755-756851 switch (r_type) {757852 case R_X86_64_NONE:758853 /* NONE can be ignored. */···754861755862 case R_X86_64_PC32:756863 case R_X86_64_PLT32:864864+ case R_X86_64_REX_GOTPCRELX:757865 /*758758- * PC relative relocations don't need to be adjusted unless759759- * referencing a percpu symbol.866866+ * PC relative relocations don't need to be adjusted.760867 *761868 * NB: R_X86_64_PLT32 can be treated as R_X86_64_PC32.762869 */763763- if (is_percpu_sym(sym, symname))764764- add_reloc(&relocs32neg, offset);765870 break;766871767872 case R_X86_64_PC64:768873 /*769874 * Only used by jump labels770875 */771771- if (is_percpu_sym(sym, symname))772772- die("Invalid R_X86_64_PC64 relocation against per-CPU symbol %s\n", symname);773876 break;774877775878 case R_X86_64_32:776879 case R_X86_64_32S:777880 case R_X86_64_64:778778- /*779779- * References to the percpu area don't need to be adjusted.780780- */781781- if (is_percpu_sym(sym, symname))782782- break;783783-784881 if (shn_abs) {785882 /*786883 * Whitelisted absolute symbols do not require···93810559391056static void sort_relocs(struct relocs *r)9401057{941941- qsort(r->offset, r->count, sizeof(r->offset[0]), cmp_relocs);10581058+ if (r->count)10591059+ qsort(r->offset, r->count, sizeof(r->offset[0]), cmp_relocs);9421060}94310619441062static int write32(uint32_t v, FILE *f)···9831099 /* Order the relocations for more efficient processing */9841100 sort_relocs(&relocs32);9851101#if ELF_BITS == 64986986- sort_relocs(&relocs32neg);9871102 sort_relocs(&relocs64);9881103#else9891104 sort_relocs(&relocs16);···10141131 /* Now print each relocation */10151132 for (i = 0; i < relocs64.count; i++)10161133 write_reloc(relocs64.offset[i], stdout);10171017-10181018- /* Print a stop */10191019- write_reloc(0, stdout);10201020-10211021- /* Now print each inverse 32-bit relocation */10221022- for (i = 0; i < relocs32neg.count; i++)10231023- write_reloc(relocs32neg.offset[i], stdout);10241134#endif1025113510261136 /* Print a stop */···10651189 read_strtabs(fp);10661190 read_symtabs(fp);10671191 read_relocs(fp);10681068-10691069- if (ELF_BITS == 64)10701070- percpu_init();1071119210721193 if (show_absolute_syms) {10731194 print_absolute_symbols();
+1-1
arch/x86/xen/Kconfig
···99 select PARAVIRT_CLOCK1010 select X86_HV_CALLBACK_VECTOR1111 depends on X86_64 || (X86_32 && X86_PAE)1212- depends on X86_64 || (X86_GENERIC || MPENTIUM4 || MCORE2 || MATOM || MK8)1212+ depends on X86_64 || (X86_GENERIC || MPENTIUM4 || MATOM)1313 depends on X86_LOCAL_APIC && X86_TSC1414 help1515 This is the Linux Xen port. Enabling this will allow the
···7070 xen_enable_syscall();7171 }7272 cpu = smp_processor_id();7373- smp_store_cpu_info(cpu);7373+ identify_secondary_cpu(cpu);7474 set_cpu_sibling_map(cpu);75757676 speculative_store_bypass_ht_init();
+4-6
arch/x86/xen/xen-head.S
···31313232 leaq __top_init_kernel_stack(%rip), %rsp33333434- /* Set up %gs.3535- *3636- * The base of %gs always points to fixed_percpu_data. If the3737- * stack protector canary is enabled, it is located at %gs:40.3434+ /*3535+ * Set up GSBASE.3836 * Note that, on SMP, the boot cpu uses init data section until3937 * the per cpu areas are set up.4038 */4139 movl $MSR_GS_BASE,%ecx4242- movq $INIT_PER_CPU_VAR(fixed_percpu_data),%rax4343- cdq4040+ xorl %eax, %eax4141+ xorl %edx, %edx4442 wrmsr45434644 mov %rsi, %rdi
···22002200 return ret;22012201}2202220222032203-static void hybrid_get_type(void *data)22042204-{22052205- u8 *cpu_type = data;22062206-22072207- *cpu_type = get_this_hybrid_cpu_type();22082208-}22092209-22102203static int hwp_get_cpu_scaling(int cpu)22112204{22122205 if (hybrid_scaling_factor) {22132213- u8 cpu_type = 0;22142214-22152215- smp_call_function_single(cpu, hybrid_get_type, &cpu_type, 1);22062206+ struct cpuinfo_x86 *c = &cpu_data(smp_processor_id());22072207+ u8 cpu_type = c->topo.intel_type;2216220822172209 /*22182210 * Return the hybrid scaling factor for P-cores and use the22192211 * default core scaling for E-cores.22202212 */22212221- if (cpu_type == 0x40)22132213+ if (cpu_type == INTEL_CPU_TYPE_CORE)22222214 return hybrid_scaling_factor;2223221522242224- if (cpu_type == 0x20)22162216+ if (cpu_type == INTEL_CPU_TYPE_ATOM)22252217 return core_get_scaling();22262218 }22272219
+14
drivers/idle/intel_idle.c
···5858#include <asm/spec-ctrl.h>5959#include <asm/tsc.h>6060#include <asm/fpu/api.h>6161+#include <asm/smp.h>61626263#define INTEL_IDLE_VERSION "0.5.1"6364···228227 mwait_idle_with_hints(eax, ecx);229228230229 return 0;230230+}231231+232232+static void intel_idle_enter_dead(struct cpuidle_device *dev, int index)233233+{234234+ struct cpuidle_driver *drv = cpuidle_get_cpu_driver(dev);235235+ struct cpuidle_state *state = &drv->states[index];236236+ unsigned long eax = flg2MWAIT(state->flags);237237+238238+ mwait_play_dead(eax);231239}232240233241/*···18141804 mark_tsc_unstable("TSC halts in idle");1815180518161806 state->enter = intel_idle;18071807+ state->enter_dead = intel_idle_enter_dead;18171808 state->enter_s2idle = intel_idle_s2idle;18181809 }18191810}···21632152 if (!cpuidle_state_table[cstate].enter &&21642153 !cpuidle_state_table[cstate].enter_s2idle)21652154 break;21552155+21562156+ if (!cpuidle_state_table[cstate].enter_dead)21572157+ cpuidle_state_table[cstate].enter_dead = intel_idle_enter_dead;2166215821672159 /* If marked as unusable, skip this state. */21682160 if (cpuidle_state_table[cstate].flags & CPUIDLE_FLAG_UNUSABLE) {
+1-1
drivers/misc/mei/Kconfig
···33config INTEL_MEI44 tristate "Intel Management Engine Interface"55 depends on X86 && PCI66- default GENERIC_CPU || MCORE2 || MATOM || X86_GENERIC66+ default X86_64 || MATOM77 help88 The Intel Management Engine (Intel ME) provides Manageability,99 Security and Media services for system containing Intel chipsets.
+6
drivers/pci/Kconfig
···203203 P2P DMA transactions must be between devices behind the same root204204 port.205205206206+ Enabling this option will reduce the entropy of x86 KASLR memory207207+ regions. For example - on a 46 bit system, the entropy goes down208208+ from 16 bits to 15 bits. The actual reduction in entropy depends209209+ on the physical address bits, on processor features, kernel config210210+ (5 level page table) and physical memory present on the system.211211+206212 If unsure, say N.207213208214config PCI_LABEL
···10621062 */10631063#define PERCPU_INPUT(cacheline) \10641064 __per_cpu_start = .; \10651065- *(.data..percpu..first) \10661065 . = ALIGN(PAGE_SIZE); \10671066 *(.data..percpu..page_aligned) \10681067 . = ALIGN(cacheline); \···10731074 __per_cpu_end = .;1074107510751076/**10761076- * PERCPU_VADDR - define output section for percpu area10771077+ * PERCPU_SECTION - define output section for percpu area10771078 * @cacheline: cacheline size10781078- * @vaddr: explicit base address (optional)10791079- * @phdr: destination PHDR (optional)10801079 *10811080 * Macro which expands to output section for percpu area.10821081 *10831082 * @cacheline is used to align subsections to avoid false cacheline10841083 * sharing between subsections for different purposes.10851085- *10861086- * If @vaddr is not blank, it specifies explicit base address and all10871087- * percpu symbols will be offset from the given address. If blank,10881088- * @vaddr always equals @laddr + LOAD_OFFSET.10891089- *10901090- * @phdr defines the output PHDR to use if not blank. Be warned that10911091- * output PHDR is sticky. If @phdr is specified, the next output10921092- * section in the linker script will go there too. @phdr should have10931093- * a leading colon.10941094- *10951095- * Note that this macros defines __per_cpu_load as an absolute symbol.10961096- * If there is no need to put the percpu section at a predetermined10971097- * address, use PERCPU_SECTION.10981098- */10991099-#define PERCPU_VADDR(cacheline, vaddr, phdr) \11001100- __per_cpu_load = .; \11011101- .data..percpu vaddr : AT(__per_cpu_load - LOAD_OFFSET) { \11021102- PERCPU_INPUT(cacheline) \11031103- } phdr \11041104- . = __per_cpu_load + SIZEOF(.data..percpu);11051105-11061106-/**11071107- * PERCPU_SECTION - define output section for percpu area, simple version11081108- * @cacheline: cacheline size11091109- *11101110- * Align to PAGE_SIZE and outputs output section for percpu area. This11111111- * macro doesn't manipulate @vaddr or @phdr and __per_cpu_load and11121112- * __per_cpu_start will be identical.11131113- *11141114- * This macro is equivalent to ALIGN(PAGE_SIZE); PERCPU_VADDR(@cacheline,,)11151115- * except that __per_cpu_load is defined as a relative symbol against11161116- * .data..percpu which is required for relocatable x86_32 configuration.11171084 */11181085#define PERCPU_SECTION(cacheline) \11191086 . = ALIGN(PAGE_SIZE); \11201087 .data..percpu : AT(ADDR(.data..percpu) - LOAD_OFFSET) { \11211121- __per_cpu_load = .; \11221088 PERCPU_INPUT(cacheline) \11231089 }11241090
-12
include/linux/percpu-defs.h
···2626#define PER_CPU_SHARED_ALIGNED_SECTION "..shared_aligned"2727#define PER_CPU_ALIGNED_SECTION "..shared_aligned"2828#endif2929-#define PER_CPU_FIRST_SECTION "..first"30293130#else32313332#define PER_CPU_SHARED_ALIGNED_SECTION ""3433#define PER_CPU_ALIGNED_SECTION "..shared_aligned"3535-#define PER_CPU_FIRST_SECTION ""36343735#endif3836···111113112114#define DEFINE_PER_CPU(type, name) \113115 DEFINE_PER_CPU_SECTION(type, name, "")114114-115115-/*116116- * Declaration/definition used for per-CPU variables that must come first in117117- * the set of variables.118118- */119119-#define DECLARE_PER_CPU_FIRST(type, name) \120120- DECLARE_PER_CPU_SECTION(type, name, PER_CPU_FIRST_SECTION)121121-122122-#define DEFINE_PER_CPU_FIRST(type, name) \123123- DEFINE_PER_CPU_SECTION(type, name, PER_CPU_FIRST_SECTION)124116125117/*126118 * Declaration/definition used for per-CPU variables that must be cacheline
···1869186918701870 Say N unless you really need all symbols, or kernel live patching.1871187118721872-config KALLSYMS_ABSOLUTE_PERCPU18731873- bool18741874- depends on KALLSYMS18751875- default X86_64 && SMP18761876-18771872# end of the "standard kernel features (expert users)" menu1878187318791874config ARCH_HAS_MEMBARRIER_CALLBACKS
+1-1
kernel/bpf/verifier.c
···2170721707 * way, it's fine to back out this inlining logic2170821708 */2170921709#ifdef CONFIG_SMP2171021710- insn_buf[0] = BPF_MOV32_IMM(BPF_REG_0, (u32)(unsigned long)&pcpu_hot.cpu_number);2171021710+ insn_buf[0] = BPF_MOV64_IMM(BPF_REG_0, (u32)(unsigned long)&pcpu_hot.cpu_number);2171121711 insn_buf[1] = BPF_MOV64_PERCPU_REG(BPF_REG_0, BPF_REG_0);2171221712 insn_buf[2] = BPF_LDX_MEM(BPF_W, BPF_REG_0, BPF_REG_0, 0);2171321713 cnt = 3;
+3-2
kernel/iomem.c
···66#include <linux/ioremap.h>7788#ifndef arch_memremap_wb99-static void *arch_memremap_wb(resource_size_t offset, unsigned long size)99+static void *arch_memremap_wb(resource_size_t offset, unsigned long size,1010+ unsigned long flags)1011{1112#ifdef ioremap_cache1213 return (__force void *)ioremap_cache(offset, size);···9291 if (is_ram == REGION_INTERSECTS)9392 addr = try_ram_remap(offset, size, flags);9493 if (!addr)9595- addr = arch_memremap_wb(offset, size);9494+ addr = arch_memremap_wb(offset, size, flags);9695 }97969897 /*
+2-10
kernel/kallsyms.c
···148148149149unsigned long kallsyms_sym_address(int idx)150150{151151- /* values are unsigned offsets if --absolute-percpu is not in effect */152152- if (!IS_ENABLED(CONFIG_KALLSYMS_ABSOLUTE_PERCPU))153153- return kallsyms_relative_base + (u32)kallsyms_offsets[idx];154154-155155- /* ...otherwise, positive offsets are absolute values */156156- if (kallsyms_offsets[idx] >= 0)157157- return kallsyms_offsets[idx];158158-159159- /* ...and negative offsets are relative to kallsyms_relative_base - 1 */160160- return kallsyms_relative_base - 1 - kallsyms_offsets[idx];151151+ /* values are unsigned offsets */152152+ return kallsyms_relative_base + (u32)kallsyms_offsets[idx];161153}162154163155static unsigned int get_symbol_seq(int index)
+1-1
lib/atomic64_test.c
···254254 pr_info("passed for %s platform %s CX8 and %s SSE\n",255255#ifdef CONFIG_X86_64256256 "x86-64",257257-#elif defined(CONFIG_X86_CMPXCHG64)257257+#elif defined(CONFIG_X86_CX8)258258 "i586+",259259#else260260 "i386+",
···55 * This software may be used and distributed according to the terms66 * of the GNU General Public License, incorporated herein by reference.77 *88- * Usage: kallsyms [--all-symbols] [--absolute-percpu] in.map > out.S88+ * Usage: kallsyms [--all-symbols] in.map > out.S99 *1010 * Table compression uses all the unused char codes on the symbols and1111 * maps these to the most used substrings (tokens). For instance, it might···3737 unsigned long long addr;3838 unsigned int len;3939 unsigned int seq;4040- bool percpu_absolute;4140 unsigned char sym[];4241};4342···5455#define text_range_text (&text_ranges[0])5556#define text_range_inittext (&text_ranges[1])56575757-static struct addr_range percpu_range = {5858- "__per_cpu_start", "__per_cpu_end", -1ULL, 05959-};6060-6158static struct sym_entry **table;6259static unsigned int table_size, table_cnt;6360static int all_symbols;6464-static int absolute_percpu;65616662static int token_profit[0x10000];6763···67736874static void usage(void)6975{7070- fprintf(stderr, "Usage: kallsyms [--all-symbols] [--absolute-percpu] in.map > out.S\n");7676+ fprintf(stderr, "Usage: kallsyms [--all-symbols] in.map > out.S\n");7177 exit(1);7278}7379···158164 return NULL;159165160166 check_symbol_range(name, addr, text_ranges, ARRAY_SIZE(text_ranges));161161- check_symbol_range(name, addr, &percpu_range, 1);162167163168 /* include the type field in the symbol name, so that it gets164169 * compressed together */···168175 sym->len = len;169176 sym->sym[0] = type;170177 strcpy(sym_name(sym), name);171171- sym->percpu_absolute = false;172178173179 return sym;174180}···311319 return total;312320}313321314314-static bool symbol_absolute(const struct sym_entry *s)315315-{316316- return s->percpu_absolute;317317-}318318-319322static int compare_names(const void *a, const void *b)320323{321324 int ret;···442455 */443456444457 long long offset;445445- bool overflow;446458447447- if (!absolute_percpu) {448448- offset = table[i]->addr - relative_base;449449- overflow = offset < 0 || offset > UINT_MAX;450450- } else if (symbol_absolute(table[i])) {451451- offset = table[i]->addr;452452- overflow = offset < 0 || offset > INT_MAX;453453- } else {454454- offset = relative_base - table[i]->addr - 1;455455- overflow = offset < INT_MIN || offset >= 0;456456- }457457- if (overflow) {459459+ offset = table[i]->addr - relative_base;460460+ if (offset < 0 || offset > UINT_MAX) {458461 fprintf(stderr, "kallsyms failure: "459459- "%s symbol value %#llx out of range in relative mode\n",460460- symbol_absolute(table[i]) ? "absolute" : "relative",462462+ "relative symbol value %#llx out of range\n",461463 table[i]->addr);462464 exit(EXIT_FAILURE);463465 }···701725 qsort(table, table_cnt, sizeof(table[0]), compare_symbols);702726}703727704704-static void make_percpus_absolute(void)705705-{706706- unsigned int i;707707-708708- for (i = 0; i < table_cnt; i++)709709- if (symbol_in_range(table[i], &percpu_range, 1)) {710710- /*711711- * Keep the 'A' override for percpu symbols to712712- * ensure consistent behavior compared to older713713- * versions of this tool.714714- */715715- table[i]->sym[0] = 'A';716716- table[i]->percpu_absolute = true;717717- }718718-}719719-720728/* find the minimum non-absolute symbol address */721729static void record_relative_base(void)722730{723723- unsigned int i;724724-725725- for (i = 0; i < table_cnt; i++)726726- if (!symbol_absolute(table[i])) {727727- /*728728- * The table is sorted by address.729729- * Take the first non-absolute symbol value.730730- */731731- relative_base = table[i]->addr;732732- return;733733- }731731+ /*732732+ * The table is sorted by address.733733+ * Take the first symbol value.734734+ */735735+ if (table_cnt)736736+ relative_base = table[0]->addr;734737}735738736739int main(int argc, char **argv)···717762 while (1) {718763 static const struct option long_options[] = {719764 {"all-symbols", no_argument, &all_symbols, 1},720720- {"absolute-percpu", no_argument, &absolute_percpu, 1},721765 {},722766 };723767···733779734780 read_map(argv[optind]);735781 shrink_table();736736- if (absolute_percpu)737737- make_percpus_absolute();738782 sort_symbols();739783 record_relative_base();740784 optimize_token_table();
-4
scripts/link-vmlinux.sh
···144144 kallsymopt="${kallsymopt} --all-symbols"145145 fi146146147147- if is_enabled CONFIG_KALLSYMS_ABSOLUTE_PERCPU; then148148- kallsymopt="${kallsymopt} --absolute-percpu"149149- fi150150-151147 info KSYMS "${2}.S"152148 scripts/kallsyms ${kallsymopt} "${1}" > "${2}.S"153149