x86-32 CPU configuration cleanups
Subsystems (17)
cover x86-32 CPU configuration cleanups
From: Arnd Bergmann <[email protected]>
Hi Ingo,
Here are some follow-ups to your x86-32 CPU level changes based on patches I did last year but rebased onto current linux-next.
The first four just drop code that is no longer relevant now that Élan is gone and all CPUs support both TSC and CX8.
The other four patches change the CPU configuration to be more like x86-64 and other architectures where all kernels are expected to be generic by default. I did keep the distinction between i586 and i686 class, but everything else is now just an optimization, building e.g. for CONFIG_MATOM will still run on all other i686 class CPUs, and picking any i586-class option will work on everything.
Arnd
Arnd Bergmann (8):
x86: remove ts5500 platforms support
x86: remove AMD Élan remnants
x86: make TSC usage unconditional
x86: make CX8 usage unconditional
x86: remove dependencies on CONFIG_M... CPU options
x86: require minimum 64 byte cache lines
x86: remove dependencies on per-CPU options
x86: simplify 32-bit instruction set selection
.../ABI/testing/sysfs-platform-ts5500 | 54 --- Documentation/virt/kvm/x86/timekeeping.rst | 1 - MAINTAINERS | 5 - arch/um/include/asm/asm-prototypes.h | 4 - arch/x86/Kconfig | 10 - arch/x86/Kconfig.cpu | 41 +-- arch/x86/Kconfig.cpufeatures | 15 +- arch/x86/Makefile_32.cpu | 16 +- arch/x86/events/msr.c | 5 - arch/x86/include/asm/asm-prototypes.h | 4 - arch/x86/include/asm/atomic64_32.h | 15 - arch/x86/include/asm/bitops.h | 4 +- arch/x86/include/asm/cmpxchg_32.h | 76 +--- arch/x86/include/asm/debugreg.h | 10 +- arch/x86/include/asm/percpu.h | 14 +- arch/x86/include/asm/ptrace.h | 6 +- arch/x86/include/asm/timex.h | 3 - arch/x86/include/asm/trace_clock.h | 8 - arch/x86/include/asm/tsc.h | 13 - arch/x86/include/asm/vermagic.h | 36 +- arch/x86/kernel/Makefile | 4 +- arch/x86/kernel/apic/apic.c | 23 +- arch/x86/kernel/apic/io_apic.c | 22 +- arch/x86/kernel/cpu/amd.c | 20 - arch/x86/kernel/cpu/centaur.c | 2 - arch/x86/kernel/cpu/common.c | 4 +- arch/x86/kernel/cpu/proc.c | 15 +- arch/x86/kernel/i8253.c | 3 - arch/x86/kernel/tsc.c | 30 +- arch/x86/lib/Makefile | 4 - arch/x86/lib/atomic64_386_32.S | 195 ---------- arch/x86/lib/cmpxchg8b_emu.S | 97 ----- arch/x86/lib/kaslr.c | 20 +- arch/x86/platform/Makefile | 1 - arch/x86/platform/ts5500/Makefile | 2 - arch/x86/platform/ts5500/ts5500.c | 341 ------------------ arch/x86/um/Kconfig | 2 +- arch/x86/um/Makefile | 3 +- arch/x86/xen/Kconfig | 3 +- arch/x86/xen/time.c | 2 - drivers/misc/mei/Kconfig | 2 +- drivers/net/ethernet/intel/igc/igc_ptp.c | 4 +- drivers/ptp/Kconfig | 2 +- lib/atomic64_test.c | 7 +- tools/power/cpupower/debug/kernel/Makefile | 5 +- 45 files changed, 75 insertions(+), 1078 deletions(-) delete mode 100644 Documentation/ABI/testing/sysfs-platform-ts5500 delete mode 100644 arch/x86/lib/atomic64_386_32.S delete mode 100644 arch/x86/lib/cmpxchg8b_emu.S delete mode 100644 arch/x86/platform/ts5500/Makefile delete mode 100644 arch/x86/platform/ts5500/ts5500.c
Signature · 23 lines
2.39.5 Cc: Richard Weinberger <[email protected]> Cc: Anton Ivanov <[email protected]> Cc: Johannes Berg <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Dave Hansen <[email protected]> Cc: "H. Peter Anvin" <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Will Deacon <[email protected]> Cc: Boqun Feng <[email protected]> Cc: Gary Guo <[email protected]> Cc: Yury Norov <[email protected]> Cc: Rasmus Villemoes <[email protected]> Cc: Boris Ostrovsky <[email protected]> Cc: Alexander Usyskin <[email protected]> Cc: Tony Nguyen <[email protected]> Cc: Przemek Kitszel <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected]
PATCH 1/8 x86: remove ts5500 platforms support
From: Arnd Bergmann <[email protected]>
Support for Élan was removed in 7.1, but the ts5500 platform still depends on it. Remove this one as well, not that it cannot be used any more.
--- .../ABI/testing/sysfs-platform-ts5500 | 54 --- MAINTAINERS | 5 - arch/x86/Kconfig | 9 - arch/x86/platform/Makefile | 1 - arch/x86/platform/ts5500/Makefile | 2 - arch/x86/platform/ts5500/ts5500.c | 341 ------------------ 6 files changed, 412 deletions(-) delete mode 100644 Documentation/ABI/testing/sysfs-platform-ts5500 delete mode 100644 arch/x86/platform/ts5500/Makefile delete mode 100644 arch/x86/platform/ts5500/ts5500.c
Documentation/ABI/testing/sysfs-platform-ts5500 deleted +0 -54
@@ -1,54 +0,0 @@ -What: /sys/devices/platform/ts5500/adc -Date: January 2013 -KernelVersion: 3.7 -Contact: "Savoir-faire Linux Inc." <[email protected]> -Description: - Indicates the presence of an A/D Converter. If it is present, - it will display "1", otherwise "0". - -What: /sys/devices/platform/ts5500/ereset -Date: January 2013 -KernelVersion: 3.7 -Contact: "Savoir-faire Linux Inc." <[email protected]> -Description: - Indicates the presence of an external reset. If it is present, - it will display "1", otherwise "0". - -What: /sys/devices/platform/ts5500/id -Date: January 2013 -KernelVersion: 3.7 -Contact: "Savoir-faire Linux Inc." <[email protected]> -Description: - Product ID of the TS board. TS-5500 ID is 0x60. - -What: /sys/devices/platform/ts5500/jumpers -Date: January 2013 -KernelVersion: 3.7 -Contact: "Savoir-faire Linux Inc." <[email protected]> -Description: - Bitfield showing the jumpers' state. If a jumper is present, - the corresponding bit is set. For instance, 0x0e means jumpers - 2, 3 and 4 are set. - -What: /sys/devices/platform/ts5500/name -Date: July 2014 -KernelVersion: 3.16 -Contact: "Savoir-faire Linux Inc." <[email protected]> -Description: - Model name of the TS board, e.g. "TS-5500". - -What: /sys/devices/platform/ts5500/rs485 -Date: January 2013 -KernelVersion: 3.7 -Contact: "Savoir-faire Linux Inc." <[email protected]> -Description: - Indicates the presence of the RS485 option. If it is present, - it will display "1", otherwise "0". - -What: /sys/devices/platform/ts5500/sram -Date: January 2013 -KernelVersion: 3.7 -Contact: "Savoir-faire Linux Inc." <[email protected]> -Description: - Indicates the presence of the SRAM option. If it is present, - it will display "1", otherwise "0".
MAINTAINERS +0 -5
@@ -26402,11 +26402,6 @@ S: Maintained F: Documentation/process/contribution-maturity-model.rst F: Documentation/process/researcher-guidelines.rst -TECHNOLOGIC SYSTEMS TS-5500 PLATFORM SUPPORT -M: "Savoir-faire Linux Inc." <[email protected]> -S: Maintained -F: arch/x86/platform/ts5500/ - TECHNOTREND USB IR RECEIVER M: Sean Young <[email protected]> L: [email protected]
arch/x86/Kconfig +0 -9
@@ -3056,15 +3056,6 @@ config GEOS help This option enables system support for the Traverse Technologies GEOS. -config TS5500 - bool "Technologic Systems TS-5500 platform support" - depends on MELAN - select CHECK_SIGNATURE - select NEW_LEDS - select LEDS_CLASS - help - This option enables system support for the Technologic Systems TS-5500. - endif # X86_32 config AMD_NB
arch/x86/platform/Makefile +0 -1
@@ -10,5 +10,4 @@ obj-y += intel-mid/ obj-y += intel-quark/ obj-y += olpc/ obj-y += scx200/ -obj-y += ts5500/ obj-y += uv/
arch/x86/platform/ts5500/Makefile deleted +0 -2
@@ -1,2 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-only -obj-$(CONFIG_TS5500) += ts5500.o
arch/x86/platform/ts5500/ts5500.c deleted +0 -341
341 lines not on this page · raw message
Signature · 1 line
2.39.5
PATCH 2/8 x86: remove AMD Élan remnants
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
There is one more leftover line in Kconfig and the detection for AMD Generation 4 CPUs (5k86 and Élan) that can now get removed following the increase of the minimum CPU level to 586TSC.
--- arch/x86/Kconfig.cpu | 1 - arch/x86/kernel/cpu/amd.c | 20 -------------------- 2 files changed, 21 deletions(-)
arch/x86/Kconfig.cpu +0 -1
@@ -32,7 +32,6 @@ choice - "Athlon" for the AMD K7 family (Athlon/Duron/Thunderbird). - "Crusoe" for the Transmeta Crusoe series. - "Efficeon" for the Transmeta Efficeon series. - - "AMD Elan" for the 32-bit AMD Elan embedded CPU. - "GeodeGX1" for Geode GX1 (Cyrix MediaGX). - "Geode GX/LX" For AMD Geode GX and LX processors. - "CyrixIII/VIA C3" for VIA Cyrix III or VIA C3.
arch/x86/kernel/cpu/amd.c +0 -20
@@ -91,25 +91,6 @@ __asm__(".text\n" "vide: ret\n");#endif -static void init_amd_k5 (struct cpuinfo_x86 *c) -{ -#ifdef CONFIG_X86_32 -/* -* General Systems BIOSen alias the cpu frequency registers -* of the Elan at 0x000df000. Unfortunately, one of the Linux -* drivers subsequently pokes it, and changes the CPU speed. -* Workaround : Remove the unneeded alias. -*/ -#define CBAR (0xfffc)/* Configuration Base Address (32-bit) */ -#define CBAR_ENB (0x80000000) -#define CBAR_KEY (0X000000CB) -if (c->x86_model ==9 || c->x86_model ==10 ) { -if (inl (CBAR ) &CBAR_ENB ) -outl (0 |CBAR_KEY ,CBAR ); - } -#endif -} -static void init_amd_k6 (struct cpuinfo_x86 *c) {#ifdef CONFIG_X86_32
@@ -1065,7 +1046,6 @@ static void init_amd(struct cpuinfo_x86 *c)clear_cpu_cap (c,X86_FEATURE_MCE );switch (c->x86) { -case 4 :init_amd_k5 (c);break ;case 5 :init_amd_k6 (c);break ;case 6 :init_amd_k7 (c);break ;case 0xf :init_amd_k8 (c);break ;
Signature · 1 line
2.39.5
PATCH 3/8 x86: make TSC usage unconditional
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
There are multiple levels of functionality of the TSC that are checked
for: built into the kernel, present in the CPU, reliable and probably more.
Since the TSC-less CPUs are no longer supported in the kernel, remove all checks for CONFIG_TSC and X86_FEATURE_TSC and assume it's always there. Unfortunately the tsc_clocksource_reliable checks are still required though.
--- Documentation/virt/kvm/x86/timekeeping.rst | 1 - arch/x86/Kconfig | 1 - arch/x86/Kconfig.cpu | 1 - arch/x86/events/msr.c | 5 ---- arch/x86/include/asm/timex.h | 3 --- arch/x86/include/asm/trace_clock.h | 8 ------- arch/x86/include/asm/tsc.h | 13 ---------- arch/x86/kernel/Makefile | 4 ++-- arch/x86/kernel/apic/apic.c | 23 +++++++----------- arch/x86/kernel/apic/io_apic.c | 22 +---------------- arch/x86/kernel/cpu/centaur.c | 2 -- arch/x86/kernel/cpu/common.c | 4 +--- arch/x86/kernel/cpu/proc.c | 15 +++++------- arch/x86/kernel/i8253.c | 3 --- arch/x86/kernel/tsc.c | 28 ++-------------------- arch/x86/lib/kaslr.c | 20 ++++------------ arch/x86/xen/time.c | 2 -- drivers/net/ethernet/intel/igc/igc_ptp.c | 4 ++-- drivers/ptp/Kconfig | 2 +- tools/power/cpupower/debug/kernel/Makefile | 5 +--- 20 files changed, 29 insertions(+), 137 deletions(-)
Documentation/virt/kvm/x86/timekeeping.rst +0 -1
@@ -471,7 +471,6 @@ The following feature bits are used by Linux to signal various TSC attributes, but they can only be taken to be meaningful for UP or single node systems. ========================= ======================================= -X86_FEATURE_TSC The TSC is available in hardware X86_FEATURE_RDTSCP The RDTSCP instruction is available X86_FEATURE_CONSTANT_TSC The TSC rate is unchanged with P-states X86_FEATURE_NONSTOP_TSC The TSC does not stop in C-states
arch/x86/Kconfig +0 -1
@@ -683,7 +683,6 @@ config X86_INTEL_QUARK depends on X86_32 depends on X86_EXTENDED_PLATFORM depends on X86_PLATFORM_DEVICES - depends on X86_TSC depends on PCI depends on PCI_GOANY depends on X86_IO_APIC
arch/x86/Kconfig.cpu +0 -1
@@ -261,7 +261,6 @@ config X86_USE_PPRO_CHECKSUM config X86_TSC def_bool y - depends on (MWINCHIP3D || MCRUSOE || MEFFICEON || MCYRIXIII || MK7 || MK6 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || MVIAC3_2 || MVIAC7 || MGEODEGX1 || MGEODE_LX || MATOM) || X86_64 config X86_HAVE_PAE def_bool y
arch/x86/events/msr.c +0 -5
@@ -229,11 +229,6 @@ static struct pmu pmu_msr = {static int __init msr_init (void ) { -if (!boot_cpu_has (X86_FEATURE_TSC )) { -pr_cont ("no MSR PMU driver.\n" ); -return 0 ; - } - msr_mask =perf_msr_probe (msr,PERF_MSR_EVENT_MAX , true,NULL );perf_pmu_register (&pmu_msr,"msr" ,-1 );
arch/x86/include/asm/timex.h +0 -3
@@ -7,9 +7,6 @@static inline unsigned long random_get_entropy (void ) { -if (!IS_ENABLED (CONFIG_X86_TSC ) && - !cpu_feature_enabled (X86_FEATURE_TSC )) -return random_get_entropy_fallback ();return rdtsc (); }#define random_get_entropy random_get_entropy
arch/x86/include/asm/trace_clock.h +0 -8
@@ -5,17 +5,9 @@#include <linux/compiler.h> #include <linux/types.h> -#ifdef CONFIG_X86_TSC - extern u64 notrace trace_clock_x86_tsc(void);# define ARCH_TRACE_CLOCKS \ { trace_clock_x86_tsc, "x86-tsc", .in_ns = 0 }, -#else /* !CONFIG_X86_TSC */ - -#define ARCH_TRACE_CLOCKS - -#endif -#endif /* _ASM_X86_TRACE_CLOCK_H */
arch/x86/include/asm/tsc.h +0 -13
@@ -76,9 +76,6 @@ extern void disable_TSC(void);static inline cycles_t get_cycles (void ) { -if (!IS_ENABLED (CONFIG_X86_TSC ) && - !cpu_feature_enabled (X86_FEATURE_TSC )) -return 0 ;return rdtsc (); }#define get_cycles get_cycles
@@ -94,25 +91,15 @@ extern unsigned long native_calibrate_tsc(void);extern unsigned long long native_sched_clock_from_tsc (u64 tsc);extern int tsc_clocksource_reliable; -#ifdef CONFIG_X86_TSC extern bool tsc_async_resets; -#else -# define tsc_async_resets false -#endif /* * Boot-time check whether the TSCs are synchronized across * all CPUs/cores: */ -#ifdef CONFIG_X86_TSC extern bool tsc_store_and_check_tsc_adjust (bool bootcpu);extern void tsc_verify_tsc_adjust (bool resume);extern void check_tsc_sync_target (void ); -#else -static inline bool tsc_store_and_check_tsc_adjust (bool bootcpu) {return false; } -static inline void tsc_verify_tsc_adjust (bool resume) { } -static inline void check_tsc_sync_target (void ) { } -#endif extern int notsc_setup (char *);extern void tsc_save_sched_clock_state (void );
arch/x86/kernel/Makefile +2 -2
@@ -108,7 +108,7 @@ apm-y := apm_32.o obj-$(CONFIG_APM) += apm.o obj-$(CONFIG_SMP) += smp.o obj-$(CONFIG_SMP) += smpboot.o -obj-$(CONFIG_X86_TSC) += tsc_sync.o +obj-y += tsc_sync.o obj-$(CONFIG_SMP) += setup_percpu.o obj-$(CONFIG_X86_MPPARSE) += mpparse.o obj-y += apic/
@@ -117,7 +117,7 @@ obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o obj-$(CONFIG_FUNCTION_TRACER) += ftrace_$(BITS).o obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += ftrace.o obj-$(CONFIG_FTRACE_SYSCALLS) += ftrace.o -obj-$(CONFIG_X86_TSC) += trace_clock.o +obj-y += trace_clock.o obj-$(CONFIG_TRACING) += trace.o obj-$(CONFIG_RETHOOK) += rethook.o obj-$(CONFIG_VMCORE_INFO) += vmcore_info_$(BITS).o
arch/x86/kernel/apic/apic.c +9 -14
@@ -666,8 +666,7 @@ static void __init lapic_cal_handler(struct clock_event_device *dev)long tapic =apic_read (APIC_TMCCT );u32 pm =acpi_pm_read_early (); -if (boot_cpu_has (X86_FEATURE_TSC )) - tsc =rdtsc (); + tsc =rdtsc ();switch (lapic_cal_loops++) {case 0 :
@@ -727,13 +726,11 @@ calibrate_by_pmtimer(u32 deltapm, long *delta, long *deltatsc) *delta = (long )res;/* Correct the tsc counter value */ -if (boot_cpu_has (X86_FEATURE_TSC )) { - res = (((u64)(*deltatsc)) * pm_100ms); -do_div (res, deltapm); -apic_pr_verbose ("TSC delta adjusted to PM-Timer: %lu (%ld)\n" , - (unsigned long )res, *deltatsc); - *deltatsc = (long )res; - } + res = (((u64)(*deltatsc)) * pm_100ms); +do_div (res, deltapm); +apic_pr_verbose ("TSC delta adjusted to PM-Timer: %lu (%ld)\n" , + (unsigned long )res, *deltatsc); + *deltatsc = (long )res;return 0 ; }
@@ -902,12 +899,10 @@ static int __init calibrate_APIC_clock(void)apic_pr_verbose ("..... mult: %u\n" , lapic_clockevent.mult);apic_pr_verbose ("..... calibration result: %u\n" , lapic_timer_period); -if (boot_cpu_has (X86_FEATURE_TSC )) { - delta_tsc_khz = (deltatsc *HZ ) / (1000 *LAPIC_CAL_LOOPS ); + delta_tsc_khz = (deltatsc *HZ ) / (1000 *LAPIC_CAL_LOOPS ); -apic_pr_verbose ("..... CPU clock speed is %ld.%03ld MHz.\n" , - delta_tsc_khz /1000 , delta_tsc_khz %1000 ); - } +apic_pr_verbose ("..... CPU clock speed is %ld.%03ld MHz.\n" , + delta_tsc_khz /1000 , delta_tsc_khz %1000 ); bus_khz = (long )lapic_timer_period *HZ /1000 ; apic_pr_verbose("..... host bus clock speed is %ld.%03ld MHz.\n",
arch/x86/kernel/apic/io_apic.c +1 -21
@@ -1491,23 +1491,6 @@ static void __init delay_with_tsc(void) }while ((now - start) <40000000000ULL /HZ &&time_before_eq (jiffies, end)); } -static void __init delay_without_tsc (void ) -{ -unsigned long end = jiffies +4 ; -int band =1 ; - -/* -* We don't know any frequency yet, but waiting for -* 40940000000/HZ cycles is safe: -* 4 GHz == 10 jiffies -* 1 GHz == 40 jiffies -* 1 << 1 + 1 << 2 +...+ 1 << 11 = 4094 -*/ -do { -__delay (((1U << band++) *10000000UL ) /HZ ); - }while (band <12 &&time_before_eq (jiffies, end)); -} -/* * There is a nasty bug in some older SMP boards, their mptable lies * about the timer IRQ. We do the following to work around the situation:
@@ -1524,10 +1507,7 @@ static int __init timer_irq_works(void)return 1 ;local_irq_enable (); -if (boot_cpu_has (X86_FEATURE_TSC )) -delay_with_tsc (); -else -delay_without_tsc (); +delay_with_tsc ();/* * Expect a few ticks at least, to be sure some possible
arch/x86/kernel/cpu/centaur.c +0 -2
@@ -140,8 +140,6 @@ static void init_centaur(struct cpuinfo_x86 *c) name ="C6" ; fcr_set =ECX8 |DSMC |EDCTLB |EMMX |ERETSTK ; fcr_clr =DPDC ; -pr_notice ("Disabling bugged TSC.\n" ); -clear_cpu_cap (c,X86_FEATURE_TSC );break ;case 8 :switch (c->x86_stepping) {
arch/x86/kernel/cpu/common.c +1 -3
@@ -2471,9 +2471,7 @@ void cpu_init(void)#endif pr_debug ("Initializing CPU#%d\n" , cpu); -if (IS_ENABLED (CONFIG_X86_64 ) ||cpu_feature_enabled (X86_FEATURE_VME ) || -boot_cpu_has (X86_FEATURE_TSC ) ||boot_cpu_has (X86_FEATURE_DE )) -cr4_clear_bits (X86_CR4_VME |X86_CR4_PVI |X86_CR4_TSD |X86_CR4_DE ); +cr4_clear_bits (X86_CR4_VME |X86_CR4_PVI |X86_CR4_TSD |X86_CR4_DE );if (IS_ENABLED (CONFIG_X86_64 )) {loadsegment (fs,0 );
arch/x86/kernel/cpu/proc.c +6 -9
@@ -64,7 +64,7 @@ static int show_cpuinfo(struct seq_file *m, void *v) {struct cpuinfo_x86 *c = v;unsigned int cpu; -int i; +int freq, i; cpu = c->cpu_index; seq_printf(m, "processor\t: %u\n"
@@ -85,14 +85,11 @@ static int show_cpuinfo(struct seq_file *m, void *v)if (c->microcode)seq_printf (m,"microcode\t: 0x%x\n" , c->microcode); -if (cpu_has (c,X86_FEATURE_TSC )) { -int freq =arch_freq_get_on_cpu (cpu); - -if (freq <0 ) -seq_puts (m,"cpu MHz\t\t: Unknown\n" ); -else -seq_printf (m,"cpu MHz\t\t: %u.%03u\n" , freq /1000 , (freq %1000 )); - } + freq =arch_freq_get_on_cpu (cpu); +if (freq <0 ) +seq_puts (m,"cpu MHz\t\t: Unknown\n" ); +else +seq_printf (m,"cpu MHz\t\t: %u.%03u\n" , freq /1000 , (freq %1000 ));/* Cache size */ if (c->x86_cache_size)
arch/x86/kernel/i8253.c +0 -3
@@ -31,9 +31,6 @@ struct clock_event_device *global_clock_event;*/ static bool __init use_pit (void ) { -if (!IS_ENABLED (CONFIG_X86_TSC ) || !boot_cpu_has (X86_FEATURE_TSC )) -return true; -/* This also returns true when APIC is disabled */ return apic_needs_pit (); }
arch/x86/kernel/tsc.c +2 -26
@@ -305,23 +305,11 @@ int check_tsc_unstable(void) }EXPORT_SYMBOL_GPL (check_tsc_unstable); -#ifdef CONFIG_X86_TSC int __init notsc_setup (char *str) {mark_tsc_unstable ("boot parameter notsc" );return 1 ; } -#else -/* -* disable flag for tsc. Takes effect by clearing the TSC cpu flag -* in cpu/common.c -*/ -int __init notsc_setup (char *str) -{ -setup_clear_cpu_cap (X86_FEATURE_TSC ); -return 1 ; -} -#endif __setup ("notsc" , notsc_setup);enum {
@@ -942,9 +930,6 @@ void recalibrate_cpu_khz(void)#ifndef CONFIG_SMP unsigned long cpu_khz_old = cpu_khz; -if (!boot_cpu_has (X86_FEATURE_TSC )) -return ; - cpu_khz = x86_platform.calibrate_cpu (); tsc_khz = x86_platform.calibrate_tsc ();if (tsc_khz ==0 )
@@ -1059,8 +1044,6 @@ static struct notifier_block time_cpufreq_notifier_block = {static int __init cpufreq_register_tsc_scaling (void ) { -if (!boot_cpu_has (X86_FEATURE_TSC )) -return 0 ;if (boot_cpu_has (X86_FEATURE_CONSTANT_TSC ))return 0 ; cpufreq_register_notifier(&time_cpufreq_notifier_block,
@@ -1266,7 +1249,7 @@ static void __init check_system_tsc_reliable(void)*/ int unsynchronized_tsc (void ) { -if (!boot_cpu_has (X86_FEATURE_TSC ) || tsc_unstable) +if (tsc_unstable)return 1 ;#ifdef CONFIG_SMP
@@ -1416,7 +1399,7 @@ static void tsc_refine_calibration_work(struct work_struct *work)static int __init init_tsc_clocksource (void ) { -if (!boot_cpu_has (X86_FEATURE_TSC ) || !tsc_khz) +if (!tsc_khz)return 0 ;if (tsc_unstable) {
@@ -1515,8 +1498,6 @@ static void __init tsc_enable_sched_clock(void)void __init tsc_early_init (void ) { -if (!boot_cpu_has (X86_FEATURE_TSC )) -return ;/* Don't change UV TSC multi-chassis synchronization */ if (is_early_uv_system ())return ;
@@ -1530,11 +1511,6 @@ void __init tsc_early_init(void)void __init tsc_init (void ) { -if (!cpu_feature_enabled (X86_FEATURE_TSC )) { -setup_clear_cpu_cap (X86_FEATURE_TSC_DEADLINE_TIMER ); -return ; - } -/* * native_calibrate_cpu_early can only calibrate using methods that are * available early in boot.
arch/x86/lib/kaslr.c +4 -16
@@ -54,7 +54,6 @@ unsigned long kaslr_get_random_long(const char *purpose)const unsigned long mix_const =0x3f39e593UL ;#endif unsigned long raw, random =get_boot_seed (); -bool use_i8254 = true;if (purpose) {debug_putstr (purpose);
@@ -66,24 +65,13 @@ unsigned long kaslr_get_random_long(const char *purpose)debug_putstr (" RDRAND" );if (rdrand_long (&raw)) { random ^= raw; - use_i8254 = false; } } -if (has_cpuflag (X86_FEATURE_TSC )) { -if (purpose) -debug_putstr (" RDTSC" ); - raw =rdtsc (); - - random ^= raw; - use_i8254 = false; - } - -if (use_i8254) { -if (purpose) -debug_putstr (" i8254" ); - random ^=i8254 (); - } +if (purpose) +debug_putstr (" RDTSC" ); + raw =rdtsc (); + random ^= raw;/* Circular multiply for better bit diffusion */ asm(_ASM_MUL "%3"
arch/x86/xen/time.c +0 -2
@@ -541,8 +541,6 @@ static void __init xen_time_init(void)xen_read_wallclock (&tp);do_settimeofday64 (&tp); -setup_force_cpu_cap (X86_FEATURE_TSC ); -/* * We check ahead on the primary time info if this * bit is supported hence speeding up Xen clocksource.
drivers/net/ethernet/intel/igc/igc_ptp.c +2 -2
@@ -947,7 +947,7 @@ int igc_ptp_hwtstamp_get(struct net_device *netdev,*/ static bool igc_is_crosststamp_supported (struct igc_adapter *adapter) { -if (!IS_ENABLED (CONFIG_X86_TSC )) +if (!IS_ENABLED (CONFIG_X86 ))return false;/* FIXME: it was noticed that enabling support for PCIe PTM in
@@ -965,7 +965,7 @@ static bool igc_is_crosststamp_supported(struct igc_adapter *adapter)static struct system_counterval_t igc_device_tstamp_to_system (u64 tstamp) { -#if IS_ENABLED (CONFIG_X86_TSC ) && !defined(CONFIG_UML ) +#if IS_ENABLED (CONFIG_X86 ) && !defined(CONFIG_UML )return (struct system_counterval_t ) { .cs_id =CSID_X86_ART , .cycles = tstamp,
drivers/ptp/Kconfig +1 -1
@@ -133,7 +133,7 @@ config PTP_1588_CLOCK_KVM config PTP_1588_CLOCK_VMCLOCK tristate "Virtual machine PTP clock" - depends on X86_TSC || ARM_ARCH_TIMER + depends on X86 || ARM_ARCH_TIMER depends on PTP_1588_CLOCK && ARCH_SUPPORTS_INT128 default PTP_1588_CLOCK_KVM help
tools/power/cpupower/debug/kernel/Makefile +1 -4
@@ -1,12 +1,9 @@ # SPDX-License-Identifier: GPL-2.0 -obj-m := +obj-m := cpufreq-test_tsc.o KDIR := /lib/modules/$(shell uname -r)/build KMISC := /lib/modules/$(shell uname -r)/cpufrequtils/ -ifeq ("$(CONFIG_X86_TSC)", "y") - obj-m += cpufreq-test_tsc.o -endif default: $(MAKE) -C $(KDIR) M=$(CURDIR)
Signature · 1 line
2.39.5
PATCH 4/8 x86: make CX8 usage unconditional
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
All supported CPUs now provide the cmpxchg8b instruction, so remove all compile-time and runtime checks for its presence and the fallback implementation, to assume it just works.
--- arch/um/include/asm/asm-prototypes.h | 4 - arch/x86/Kconfig.cpu | 4 - arch/x86/Kconfig.cpufeatures | 7 +- arch/x86/include/asm/asm-prototypes.h | 4 - arch/x86/include/asm/atomic64_32.h | 15 -- arch/x86/include/asm/cmpxchg_32.h | 76 +--------- arch/x86/include/asm/percpu.h | 14 +- arch/x86/lib/Makefile | 4 - arch/x86/lib/atomic64_386_32.S | 195 -------------------------- arch/x86/lib/cmpxchg8b_emu.S | 97 ------------- arch/x86/um/Kconfig | 2 +- arch/x86/um/Makefile | 3 +- lib/atomic64_test.c | 7 +- 13 files changed, 13 insertions(+), 419 deletions(-) delete mode 100644 arch/x86/lib/atomic64_386_32.S delete mode 100644 arch/x86/lib/cmpxchg8b_emu.S
arch/um/include/asm/asm-prototypes.h +0 -4
@@ -1,6 +1,2 @@#include <asm-generic/asm-prototypes.h> #include <asm/checksum.h> - -#ifdef CONFIG_UML_X86 -extern void cmpxchg8b_emu (void ); -#endif
arch/x86/Kconfig.cpu +0 -4
@@ -266,10 +266,6 @@ config X86_HAVE_PAE def_bool y depends on MCRUSOE || MEFFICEON || MCYRIXIII || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || MVIAC7 || MATOM || X86_64 -config X86_CX8 - def_bool y - depends on X86_HAVE_PAE || M586TSC || M586MMX || MK6 || MK7 || MGEODEGX1 || MGEODE_LX - # this should be set for all -march=.. options where the compiler # generates cmov. config X86_CMOV
arch/x86/Kconfig.cpufeatures +3 -4
@@ -40,10 +40,6 @@ config X86_REQUIRED_FEATURE_NOPL def_bool y depends on X86_64 -config X86_REQUIRED_FEATURE_CX8 - def_bool y - depends on X86_CX8 - # this should be set for all -march=.. options where the compiler # generates cmov. config X86_REQUIRED_FEATURE_CMOV
@@ -60,6 +56,9 @@ config X86_REQUIRED_FEATURE_SYSFAST32 def_bool y depends on X86_64 && !X86_FRED +config X86_REQUIRED_FEATURE_CX8 + def_bool y + config X86_REQUIRED_FEATURE_CPUID def_bool y depends on X86_64
arch/x86/include/asm/asm-prototypes.h +0 -4
@@ -16,10 +16,6 @@#include <asm/gsseg.h> #include <asm/nospec-branch.h> -#ifndef CONFIG_X86_CX8 -extern void cmpxchg8b_emu (void ); -#endif -#ifdef CONFIG_STACKPROTECTOR extern unsigned long __ref_stack_chk_guard;#endif
arch/x86/include/asm/atomic64_32.h +0 -15
@@ -48,7 +48,6 @@ static __always_inline s64 arch_atomic64_read_nonatomic(const atomic64_t *v) ATOMIC64_EXPORT(atomic64_##sym)#endif -#ifdef CONFIG_X86_CX8 #define __alternative_atomic64(f, g, out, in, clobbers...) \ asm volatile("call %c[func]" \ : ALT_OUTPUT_SP(out) \
@@ -57,20 +56,6 @@ static __always_inline s64 arch_atomic64_read_nonatomic(const atomic64_t *v) : clobbers)#define ATOMIC64_DECL (sym) ATOMIC64_DECL_ONE(sym##_cx8) -#else -#define __alternative_atomic64(f, g, out, in, clobbers...) \ - alternative_call(atomic64_##f##_386, atomic64_##g##_cx8, \ - X86_FEATURE_CX8, ASM_OUTPUT(out), \ - ASM_INPUT(in), clobbers) - -#define ATOMIC64_DECL (sym) ATOMIC64_DECL_ONE(sym##_cx8); \ - ATOMIC64_DECL_ONE(sym##_386) - -ATOMIC64_DECL_ONE (add_386); -ATOMIC64_DECL_ONE (sub_386); -ATOMIC64_DECL_ONE (inc_386); -ATOMIC64_DECL_ONE (dec_386); -#endif #define alternative_atomic64(f, out, in, clobbers...) \ __alternative_atomic64(f, f, ASM_OUTPUT(out), ASM_INPUT(in), clobbers)
arch/x86/include/asm/cmpxchg_32.h +1 -75
87 lines not on this page · raw message
arch/x86/include/asm/percpu.h +5 -9
@@ -335,11 +335,9 @@ do { \ old__.var = _oval; \ new__.var = _nval; \ \ - asm_inline qual ( \ - ALTERNATIVE("call this_cpu_cmpxchg8b_emu", \ - "cmpxchg8b " __percpu_arg([var]), X86_FEATURE_CX8) \ - : ALT_OUTPUT_SP([var] "+m" (__my_cpu_var(_var)), \ -" +a" (old__.low), " +d" (old__.high)) \ + asm_inline qual ("cmpxchg8b " __percpu_arg([var]) \ + : [var] "+m" (__my_cpu_var(_var)), \ +" +a" (old__.low), " +d" (old__.high) \ : " b" (new__.low), " c" (new__.high), \ " S " (&(_var)) \ : "memory"); \
@@ -364,10 +362,8 @@ do { \ old__.var = *_oval; \ new__.var = _nval; \ \ - asm_inline qual ( \ - ALTERNATIVE("call this_cpu_cmpxchg8b_emu", \ - "cmpxchg8b " __percpu_arg([var]), X86_FEATURE_CX8) \ - : ALT_OUTPUT_SP("=@ccz" (success), \ + asm_inline qual ("cmpxchg8b " __percpu_arg([var]) \ + : "=@ccz" (success), \ [var] "+m" (__my_cpu_var(_var)), \ "+a" (old__.low), "+d" (old__.high)) \ : "b" (new__.low), "c" (new__.high), \
arch/x86/lib/Makefile +0 -4
@@ -48,10 +48,6 @@ ifeq ($(CONFIG_X86_32),y) lib-y += strstr_32.o lib-y += string_32.o lib-y += memmove_32.o - lib-y += cmpxchg8b_emu.o -ifneq ($(CONFIG_X86_CX8),y) - lib-y += atomic64_386_32.o -endif else ifneq ($(CONFIG_GENERIC_CSUM),y) lib-y += csum-partial_64.o csum-copy_64.o csum-wrappers_64.o
arch/x86/lib/atomic64_386_32.S deleted +0 -195
195 lines not on this page · raw message
arch/x86/lib/cmpxchg8b_emu.S deleted +0 -97
97 lines not on this page · raw message
arch/x86/um/Kconfig +1 -1
@@ -13,7 +13,7 @@ config UML_X86 select ARCH_USE_QUEUED_SPINLOCKS select DCACHE_WORD_ACCESS select HAVE_EFFICIENT_UNALIGNED_ACCESS - select UML_SUBARCH_SUPPORTS_SMP if X86_CX8 + select UML_SUBARCH_SUPPORTS_SMP config 64BIT bool "64-bit kernel" if "$(SUBARCH)" = "x86"
arch/x86/um/Makefile +1 -2
@@ -19,8 +19,7 @@ ifeq ($(CONFIG_X86_32),y) obj-y += syscalls_32.o -subarch-y = ../lib/string_32.o ../lib/atomic64_32.o ../lib/atomic64_cx8_32.o -subarch-y += ../lib/cmpxchg8b_emu.o ../lib/atomic64_386_32.o +subarch-y = ../lib/string_32.o ../lib/atomic64_32.o subarch-y += ../lib/checksum_32.o subarch-y += ../kernel/sys_ia32.o
lib/atomic64_test.c +2 -5
@@ -251,15 +251,12 @@ static __init int test_atomics_init(void)test_atomic64 ();#ifdef CONFIG_X86 -pr_info ("passed for %s platform %s CX8 and %s SSE\n" , +pr_info ("passed for %s platform %s SSE\n" , #ifdef CONFIG_X86_64"x86-64" , -#elif defined(CONFIG_X86_CX8) -"i586+" , #else -"i386+" , +"i586+" , #endif -boot_cpu_has (X86_FEATURE_CX8 ) ?"with" :"without" ,boot_cpu_has (X86_FEATURE_XMM ) ?"with" :"without" );#else pr_info ("passed\n" );
Signature · 1 line
2.39.5
PATCH 5/8 x86: remove dependencies on CONFIG_M... CPU options
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
CPU specific features should generally be controlled by CPU_SUP_xxx options rather than CONFIG_Mxxx, to allow generic kernels to be built that work with all of them.
Replace the few options that don't follow this scheme with checks on either CPU_SUP_xxx or X86_PAE by itself.
--- arch/x86/kernel/tsc.c | 2 +- arch/x86/xen/Kconfig | 3 +-- drivers/misc/mei/Kconfig | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-)
arch/x86/kernel/tsc.c +1 -1
@@ -1213,7 +1213,7 @@ static void __init tsc_disable_clocksource_watchdog(void)static void __init check_system_tsc_reliable (void ) { -#if defined(CONFIG_MGEODEGX1 ) || defined(CONFIG_MGEODE_LX ) || defined(CONFIG_X86_GENERIC ) +#if defined(CONFIG_CPU_SUP_CYRIX_32 )if (is_geode_lx ()) {/* RTSC counts during suspend */ #define RTSC_SUSP 0x100
arch/x86/xen/Kconfig +1 -2
@@ -10,8 +10,7 @@ config XEN select X86_HV_CALLBACK_VECTOR select HIBERNATE_CALLBACKS depends on X86_64 || (X86_32 && X86_PAE) - depends on X86_64 || (X86_GENERIC || MPENTIUM4 || MATOM) - depends on X86_LOCAL_APIC && X86_TSC + depends on X86_LOCAL_APIC help This is the Linux Xen port. Enabling this will allow the kernel to boot in a paravirtualized environment under the
drivers/misc/mei/Kconfig +1 -1
@@ -4,7 +4,7 @@ config INTEL_MEI tristate "Intel Management Engine Interface" depends on PCI depends on X86 || DRM_XE!=n || COMPILE_TEST - default X86_64 || MATOM + default X86_64 || CPU_SUP_INTEL help The Intel Management Engine (Intel ME) provides Manageability, Security and Media services for system containing Intel chipsets.
Signature · 1 line
2.39.5
PATCH 6/8 x86: require minimum 64 byte cache lines
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
Later x86-32 CPUs like Pentium-M, K7 and Atom use 64 byte cache lines and are incompatible with kernels built for smaller values of X86_L1_CACHE_SHIFT.
Pentium-4 CPUs have 128 byte cache lines but are compatible with cache operations that expect the lines to be 64 bytes.
Older CPUs have smaller cache lines of 16 or 32 bytes but work correctly when X86_L1_CACHE_SHIFT is set to a larger value.
Remove the per-CPU tuning and always build for 64 or 128 byte cache lines that work correctly in any CPU.
--- arch/x86/Kconfig.cpu | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
arch/x86/Kconfig.cpu +3 -5
@@ -180,8 +180,8 @@ config MVIAC7 bool "VIA C7" depends on X86_32 help - Select this for a VIA C7. Selecting this uses the correct cache - shift and tells gcc to treat the CPU as a 686. + Select this for a VIA C7. Selecting this tells gcc to treat the + CPU as a 686. config MATOM bool "Intel Atom"
@@ -239,9 +239,7 @@ config X86_INTERNODE_CACHE_SHIFT config X86_L1_CACHE_SHIFT int default "7" if MPENTIUM4 - default "6" if MK7 || MPENTIUMM || MATOM || MVIAC7 || X86_GENERIC || X86_64 - default "4" if MGEODEGX1 - default "5" if MCRUSOE || MEFFICEON || MCYRIXIII || MK6 || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || MVIAC3_2 || MGEODE_LX + default "6" config X86_F00F_BUG def_bool y
Signature · 1 line
2.39.5
PATCH 7/8 x86: remove dependencies on per-CPU options
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
A few CPU feature options are defined in terms of CONFIG_Mxxx CPU selection options.
This conflicts with the idea of CONFIG_X86_GENERIC allowing one to build a kernel that works with multiple slightly incompatible CPUs.
As a simplification, change all of these to be enabled in terms of either 586-class or 686-class builds.
--- arch/x86/Kconfig.cpu | 14 ++++---------- arch/x86/Kconfig.cpufeatures | 8 +------- arch/x86/include/asm/bitops.h | 4 ++-- arch/x86/include/asm/debugreg.h | 10 ++++------ arch/x86/include/asm/ptrace.h | 6 +----- 5 files changed, 12 insertions(+), 30 deletions(-)
arch/x86/Kconfig.cpu +4 -10
@@ -242,8 +242,7 @@ config X86_L1_CACHE_SHIFT default "6" config X86_F00F_BUG - def_bool y - depends on M586MMX || M586TSC || M586 + def_bool X86_MINIMUM_CPU_FAMILY=5 && CPU_SUP_INTEL config X86_ALIGNMENT_16 def_bool y
@@ -264,12 +263,6 @@ config X86_HAVE_PAE def_bool y depends on MCRUSOE || MEFFICEON || MCYRIXIII || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || MVIAC7 || MATOM || X86_64 -# this should be set for all -march=.. options where the compiler -# generates cmov. -config X86_CMOV - def_bool y - depends on (MK7 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || MVIAC3_2 || MVIAC7 || MCRUSOE || MEFFICEON || MATOM || MGEODE_LX || X86_64) - config X86_MINIMUM_CPU_FAMILY int default "64" if X86_64
@@ -278,7 +271,8 @@ config X86_MINIMUM_CPU_FAMILY config X86_DEBUGCTLMSR def_bool y - depends on !(MK6 || MCYRIXIII || M586MMX || M586TSC || M586) && !UML + depends on !UML + depends on X86_MINIMUM_CPU_FAMILY=6 config IA32_FEAT_CTL def_bool y
@@ -314,7 +308,7 @@ config CPU_SUP_INTEL config CPU_SUP_CYRIX_32 default y bool "Support Cyrix processors" if PROCESSOR_SELECT - depends on M586 || M586TSC || M586MMX || (EXPERT && !64BIT) + depends on X86_MINIMUM_CPU_FAMILY=5 help This enables detection, tunings and quirks for Cyrix processors
arch/x86/Kconfig.cpufeatures +1 -7
@@ -44,13 +44,7 @@ config X86_REQUIRED_FEATURE_NOPL # generates cmov. config X86_REQUIRED_FEATURE_CMOV def_bool y - depends on X86_CMOV - -# this should be set for all -march= options where the compiler -# generates movbe. -config X86_REQUIRED_FEATURE_MOVBE - def_bool y - depends on MATOM + depends on X86_MINIMUM_CPU_FAMILY >= 6 config X86_REQUIRED_FEATURE_SYSFAST32 def_bool y
arch/x86/include/asm/bitops.h +2 -2
@@ -312,7 +312,7 @@ static __always_inline __attribute_const__ int variable_ffs(int x) asm("bsfl %1,%0" :"=r" (r) : ASM_INPUT_RM (x), "0" (-1)); -#elif defined(CONFIG_X86_CMOV ) +#elif CONFIG_X86_MINIMUM_CPU_FAMILY >=6 asm("bsfl %1,%0\n\t" "cmovzl %2,%0" :"=&r" (r) :"rm" (x),"r" (-1 ));
@@ -369,7 +369,7 @@ static __always_inline __attribute_const__ int fls(unsigned int x) asm("bsrl %1,%0" :"=r" (r) : ASM_INPUT_RM (x), "0" (-1)); -#elif defined(CONFIG_X86_CMOV ) +#elif CONFIG_X86_MINIMUM_CPU_FAMILY >=6 asm("bsrl %1,%0\n\t" "cmovzl %2,%0" :"=&r" (r) :"rm" (x),"rm" (-1 ));
arch/x86/include/asm/debugreg.h +4 -6
@@ -176,10 +176,9 @@ static inline unsigned long get_debugctlmsr(void) {unsigned long debugctlmsr =0 ; -#ifndef CONFIG_X86_DEBUGCTLMSR -if (boot_cpu_data.x86 <6 ) +if (CONFIG_X86_MINIMUM_CPU_FAMILY <6 || boot_cpu_data.x86 <6 )return 0 ; -#endif +rdmsrq (MSR_IA32_DEBUGCTLMSR , debugctlmsr);return debugctlmsr;
@@ -187,10 +186,9 @@ static inline unsigned long get_debugctlmsr(void)static inline void update_debugctlmsr (unsigned long debugctlmsr) { -#ifndef CONFIG_X86_DEBUGCTLMSR -if (boot_cpu_data.x86 <6 ) +if (CONFIG_X86_MINIMUM_CPU_FAMILY <6 || boot_cpu_data.x86 <6 )return ; -#endif +wrmsrq (MSR_IA32_DEBUGCTLMSR , debugctlmsr); }
arch/x86/include/asm/ptrace.h +1 -5
@@ -449,11 +449,7 @@ static inline unsigned long regs_get_kernel_argument(struct pt_regs *regs, }#define arch_has_single_step () (1) -#ifdef CONFIG_X86_DEBUGCTLMSR -#define arch_has_block_step () (1) -#else -#define arch_has_block_step () (boot_cpu_data.x86 >= 6) -#endif +#define arch_has_block_step () ((CONFIG_X86_MINIMUM_CPU_FAMILY >= 6) || (boot_cpu_data.x86 >= 6))#define ARCH_HAS_USER_SINGLE_STEP_REPORT
Signature · 1 line
2.39.5
PATCH 8/8 x86: simplify 32-bit instruction set selection
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
The -march= compiler flags select both instruction set and tuning for a particular CPU, which works well when building a kernel that can only run on this one type, but has some counterintuitive effects because it is not always clear which models are compatible.
E.g. building for Geode LX results in a kernel that can work on all on all 686-class CPUs but crashes on CPUs without the CMOV instructions. Building a kernel for 686 could work on Geode LX and Crusoe but fails because of the CPU generation check that detects these as 585-class. Similarly, building for Intel Atom produces a 32-bit kernel that uses the MOVBE instructions and does not work on any other 32-bit CPU or even 64-bit CPUs before Haswell/Excavator.
Change the CPU selection to build everything with either -march=i586 or -march=i686 and make the specific options only change the -mtune= parameter where this was previously handled by -march=. Note that the only -mtune= options that gcc or clang understand for x86-32 are i486, pentium, pentiumpro, pentium4, atom, geode, k6 and athlon, the other ten are just aliases for one of them.
Selecting any 586-class configuration option now produces a kernel that works on every supported CPU, while selecting a 686-class configuration works on all 686-class CPUs but no 586-class ones.
Consequently, the vermagic.h logic can be simplified to just these two cases.
--- arch/x86/Kconfig.cpu | 13 +++++------- arch/x86/Makefile_32.cpu | 16 +++++++-------- arch/x86/include/asm/vermagic.h | 36 ++------------------------------- 3 files changed, 15 insertions(+), 50 deletions(-)
arch/x86/Kconfig.cpu +5 -8
@@ -6,9 +6,9 @@ choice default M686 help This is the processor type of your CPU. This information is - used for optimizing purposes. In order to compile a kernel - that can run on all supported x86 CPU types (albeit not - optimally fast), you can specify "586" here. + used to pick between i586-class and i686-class processors, + as well as to optimize for a particular microarchitecture + within the two classes. Note that the 386 and 486 is no longer supported, this includes AMD/Cyrix/Intel 386DX/DXL/SL/SLC/SX, Cyrix/TI 486DLC/DLC2,
@@ -164,16 +164,13 @@ config MCYRIXIII treat this chip as a generic 586. Whilst the CPU is 686 class, it lacks the cmov extension which gcc assumes is present when generating 686 code. - Note that Nehemiah (Model 9) and above will not boot with this - kernel due to them lacking the 3DNow! instructions used in earlier - incarnations of the CPU. config MVIAC3_2 bool "VIA C3-2 (Nehemiah)" depends on X86_32 help - Select this for a VIA C3 "Nehemiah". Selecting this enables usage - of SSE and tells gcc to treat the CPU as a 686. + Select this for a VIA C3 "Nehemiah". Selecting tells gcc to treat + the CPU as a 686. Note, this kernel will not boot on older (pre model 9) C3s. config MVIAC7
arch/x86/Makefile_32.cpu +8 -8
@@ -11,26 +11,26 @@ align := -falign-functions=0 -falign-jumps=0 -falign-loops=0 endif cflags-$(CONFIG_M586TSC) += -march=i586 -cflags-$(CONFIG_M586MMX) += -march=pentium-mmx +cflags-$(CONFIG_M586MMX) += -march=i586 cflags-$(CONFIG_M686) += -march=i686 cflags-$(CONFIG_MPENTIUMII) += -march=i686 $(call tune,pentium2) cflags-$(CONFIG_MPENTIUMIII) += -march=i686 $(call tune,pentium3) cflags-$(CONFIG_MPENTIUMM) += -march=i686 $(call tune,pentium3) cflags-$(CONFIG_MPENTIUM4) += -march=i686 $(call tune,pentium4) -cflags-$(CONFIG_MK6) += -march=k6 +cflags-$(CONFIG_MK6) += -march=i586 $(call tune,k6) # Please note, that patches that add -march=athlon-xp and friends are pointless. # They make zero difference whatsosever to performance at this time. -cflags-$(CONFIG_MK7) += -march=athlon +cflags-$(CONFIG_MK7) += -march=i686 $(call tune,athlon) cflags-$(CONFIG_MCRUSOE) += -march=i686 $(align) cflags-$(CONFIG_MEFFICEON) += -march=i686 $(call tune,pentium3) $(align) -cflags-$(CONFIG_MCYRIXIII) += $(call cc-option,-march=c3,-march=i486) $(align) -cflags-$(CONFIG_MVIAC3_2) += $(call cc-option,-march=c3-2,-march=i686) +cflags-$(CONFIG_MCYRIXIII) += -march=i586 $(call tune,i486) $(align) +cflags-$(CONFIG_MVIAC3_2) += -march=i686 cflags-$(CONFIG_MVIAC7) += -march=i686 -cflags-$(CONFIG_MATOM) += -march=atom +cflags-$(CONFIG_MATOM) += -march=i686 $(call tune,atom) # Geode GX1 support -cflags-$(CONFIG_MGEODEGX1) += -march=pentium-mmx -cflags-$(CONFIG_MGEODE_LX) += $(call cc-option,-march=geode,-march=pentium-mmx) +cflags-$(CONFIG_MGEODEGX1) += -march=i586 $(call tune,geode) +cflags-$(CONFIG_MGEODE_LX) += -march=i586 $(call tune,geode) # add at the end to overwrite eventual tuning options from earlier # cpu entries cflags-$(CONFIG_X86_GENERIC) += $(call tune,generic,$(call tune,i686))
arch/x86/include/asm/vermagic.h +2 -34
@@ -5,42 +5,10 @@#ifdef CONFIG_X86_64 /* X86_64 does not define MODULE_PROC_FAMILY */ -#elif definedCONFIG_M586TSC -#define MODULE_PROC_FAMILY "586TSC " -#elif definedCONFIG_M586MMX -#define MODULE_PROC_FAMILY "586MMX " -#elif definedCONFIG_MATOM -#define MODULE_PROC_FAMILY "ATOM " -#elif definedCONFIG_M686 +#elif CONFIG_X86_MINIMUM_CPU_FAMILY ==6 #define MODULE_PROC_FAMILY "686 " -#elif definedCONFIG_MPENTIUMII -#define MODULE_PROC_FAMILY "PENTIUMII " -#elif definedCONFIG_MPENTIUMIII -#define MODULE_PROC_FAMILY "PENTIUMIII " -#elif definedCONFIG_MPENTIUMM -#define MODULE_PROC_FAMILY "PENTIUMM " -#elif definedCONFIG_MPENTIUM4 -#define MODULE_PROC_FAMILY "PENTIUM4 " -#elif definedCONFIG_MK6 -#define MODULE_PROC_FAMILY "K6 " -#elif definedCONFIG_MK7 -#define MODULE_PROC_FAMILY "K7 " -#elif definedCONFIG_MCRUSOE -#define MODULE_PROC_FAMILY "CRUSOE " -#elif definedCONFIG_MEFFICEON -#define MODULE_PROC_FAMILY "EFFICEON " -#elif definedCONFIG_MCYRIXIII -#define MODULE_PROC_FAMILY "CYRIXIII " -#elif definedCONFIG_MVIAC3_2 -#define MODULE_PROC_FAMILY "VIAC3-2 " -#elif definedCONFIG_MVIAC7 -#define MODULE_PROC_FAMILY "VIAC7 " -#elif definedCONFIG_MGEODEGX1 -#define MODULE_PROC_FAMILY "GEODEGX1 " -#elif definedCONFIG_MGEODE_LX -#define MODULE_PROC_FAMILY "GEODE "#else -#error unknown processor family +#define MODULE_PROC_FAMILY "586 "#endif #ifdef CONFIG_X86_32
Signature · 1 line
2.39.5
Juergen Gross
maintainerRe: [PATCH 5/8] x86: remove dependencies on CONFIG_M... CPU options
In reply to Arnd BergmannQuoted 34 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
CPU specific features should generally be controlled by
CPU_SUP_xxxoptions rather thanCONFIG_Mxxx, to allow generic kernels to be built that work with all of them.Replace the few options that don't follow this scheme with checks on either
CPU_SUP_xxxorX86_PAEby itself.Signed-off-by Arnd Bergmann <[email protected]>--- arch/x86/kernel/tsc.c | 2 +- arch/x86/xen/Kconfig | 3 +-- drivers/misc/mei/Kconfig | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-)arch/x86/kernel/tsc.c +1
-1@@ -1213,7 +1213,7 @@ static void __init tsc_disable_clocksource_watchdog(void)static void __init check_system_tsc_reliable (void ) { -#if defined(CONFIG_MGEODEGX1 ) || defined(CONFIG_MGEODE_LX ) || defined(CONFIG_X86_GENERIC ) +#if defined(CONFIG_CPU_SUP_CYRIX_32 )if (is_geode_lx ()) {/* RTSC counts during suspend */ #define RTSC_SUSP 0x100arch/x86/xen/Kconfig +0
-0
arch/x86/xen/Kconfig config XEN · line 13
Quoted 6 lines
arch/x86/xen/Kconfig +1
-2@@ -10,8 +10,7 @@ config XEN select X86_HV_CALLBACK_VECTOR select HIBERNATE_CALLBACKS depends on X86_64 || (X86_32 && X86_PAE) - depends on X86_64 || (X86_GENERIC || MPENTIUM4 || MATOM) - depends on X86_LOCAL_APIC && X86_TSC + depends on X86_LOCAL_APIC
This is problematic. See commit 93cd05976498.
Maybe use "depends on X86_LOCAL_APIC && X86_L1_CACHE_SHIFT >= 6" instead?
Juergen
Re: [PATCH 3/8] x86: make TSC usage unconditional
In reply to Arnd BergmannQuoted 65 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
There are multiple levels of functionality of the TSC that are checked
for: built into the kernel, present in the CPU, reliable and probably more.Since the TSC-less CPUs are no longer supported in the kernel, remove all checks for
CONFIG_TSCandX86_FEATURE_TSCand assume it's always there. Unfortunately thetsc_clocksource_reliablechecks are still required though.Signed-off-by Arnd Bergmann <[email protected]>--- Documentation/virt/kvm/x86/timekeeping.rst | 1 - arch/x86/Kconfig | 1 - arch/x86/Kconfig.cpu | 1 - arch/x86/events/msr.c | 5 ---- arch/x86/include/asm/timex.h | 3 --- arch/x86/include/asm/trace_clock.h | 8 ------- arch/x86/include/asm/tsc.h | 13 ---------- arch/x86/kernel/Makefile | 4 ++-- arch/x86/kernel/apic/apic.c | 23 +++++++----------- arch/x86/kernel/apic/io_apic.c | 22 +---------------- arch/x86/kernel/cpu/centaur.c | 2 -- arch/x86/kernel/cpu/common.c | 4 +--- arch/x86/kernel/cpu/proc.c | 15 +++++------- arch/x86/kernel/i8253.c | 3 --- arch/x86/kernel/tsc.c | 28 ++-------------------- arch/x86/lib/kaslr.c | 20 ++++------------ arch/x86/xen/time.c | 2 -- drivers/net/ethernet/intel/igc/igc_ptp.c | 4 ++-- drivers/ptp/Kconfig | 2 +- tools/power/cpupower/debug/kernel/Makefile | 5 +--- 20 files changed, 29 insertions(+), 137 deletions(-)Documentation/virt/kvm/x86/timekeeping.rst +0
-1@@ -471,7 +471,6 @@ The following feature bits are used by Linux to signal various TSC attributes, but they can only be taken to be meaningful for UP or single node systems. ========================= ======================================= -X86_FEATURE_TSC The TSC is available in hardware X86_FEATURE_RDTSCP The RDTSCP instruction is available X86_FEATURE_CONSTANT_TSC The TSC rate is unchanged with P-states X86_FEATURE_NONSTOP_TSC The TSC does not stop in C-statesarch/x86/Kconfig +0
-1@@ -683,7 +683,6 @@ config X86_INTEL_QUARK depends on X86_32 depends on X86_EXTENDED_PLATFORM depends on X86_PLATFORM_DEVICES - depends on X86_TSC depends on PCI depends on PCI_GOANY depends on X86_IO_APICarch/x86/Kconfig.cpu +0
-0
arch/x86/Kconfig.cpu config X86_USE_PPRO_CHECKSUM · line 264
Quoted 4 lines
arch/x86/Kconfig.cpu +0
-1@@ -261,7 +261,6 @@ config X86_USE_PPRO_CHECKSUM config X86_TSC def_bool y - depends on (MWINCHIP3D || MCRUSOE || MEFFICEON || MCYRIXIII || MK7 || MK6 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || MVIAC3_2 || MVIAC7 || MGEODEGX1 || MGEODE_LX || MATOM) || X86_64
Can't you just delete this config option since it's no longer relevant?
Arnd Bergmann
maintainerRe: [PATCH 5/8] x86: remove dependencies on CONFIG_M... CPU options
In reply to Juergen GrossQuoted 14 lines · Juergen Gross
arch/x86/xen/Kconfig config XEN · line 13
Quoted 10 lines · Arnd Bergmann
arch/x86/xen/Kconfig +1
-2@@ -10,8 +10,7 @@ config XEN select X86_HV_CALLBACK_VECTOR select HIBERNATE_CALLBACKS depends on X86_64 || (X86_32 && X86_PAE) - depends on X86_64 || (X86_GENERIC || MPENTIUM4 || MATOM) - depends on X86_LOCAL_APIC && X86_TSC + depends on X86_LOCAL_APICThis is problematic. See commit
93cd05976498.
Quoted 1 line
Maybe use "depends on
X86_LOCAL_APIC&&X86_L1_CACHE_SHIFT>= 6" instead?
After patch 6/8, this is always true, so I suppose it would if that came first, right?
On a related note, are there still remaining Xen users on new 32-bit guest kernels? I understand that one could still run modern kernels on 32-bit Xen-4.2 (EOL in 2015), and that 64-bit Xen still supports older 32-bit guest operating systems for compatibility, but I'm not sure if there is any reason to legitimately run a 32-bit linux-7.x kernel on a 64-bit Xen instead of running a better supported 64-bit guest kernel.
Arnd
Jürgen Groß
maintainerRe: [PATCH 5/8] x86: remove dependencies on CONFIG_M... CPU options
Quoted 15 lines · Arnd Bergmann
Quoted 14 lines · Juergen Gross
arch/x86/xen/Kconfig config XEN · line 13
Quoted 10 lines · Arnd Bergmann
arch/x86/xen/Kconfig +1
-2@@ -10,8 +10,7 @@ config XEN select X86_HV_CALLBACK_VECTOR select HIBERNATE_CALLBACKS depends on X86_64 || (X86_32 && X86_PAE) - depends on X86_64 || (X86_GENERIC || MPENTIUM4 || MATOM) - depends on X86_LOCAL_APIC && X86_TSC + depends on X86_LOCAL_APICThis is problematic. See commit
93cd05976498.
Quoted 4 lines
Quoted 1 line
Maybe use "depends on
X86_LOCAL_APIC&&X86_L1_CACHE_SHIFT>= 6" instead?After patch 6/8, this is always true, so I suppose it would if that came first, right?
Yes, agreed.
Quoted 8 lines
On a related note, are there still remaining Xen users on new 32-bit guest kernels? I understand that one could still run modern kernels on 32-bit Xen-4.2 (EOL in 2015), and that 64-bit Xen still supports older 32-bit guest operating systems for compatibility, but I'm not sure if there is any reason to legitimately run a 32-bit linux-7.x kernel on a 64-bit Xen instead of running a better supported 64-bit guest kernel.
From the logical point of view I totally agree. OTOH users are humans, so they might not agree with that. ;-)
Juergen
Re: [PATCH 5/8] x86: remove dependencies on CONFIG_M... CPU options
Quoted 32 lines · On Fri, 22 May 2026 21:00:00 +0200 Jürgen Groß <[email protected]> wrote:
Quoted 15 lines · Arnd Bergmann
Quoted 14 lines · Juergen Gross
arch/x86/xen/Kconfig config XEN · line 13
Quoted 10 lines · Arnd Bergmann
arch/x86/xen/Kconfig +1
-2@@ -10,8 +10,7 @@ config XEN select X86_HV_CALLBACK_VECTOR select HIBERNATE_CALLBACKS depends on X86_64 || (X86_32 && X86_PAE) - depends on X86_64 || (X86_GENERIC || MPENTIUM4 || MATOM) - depends on X86_LOCAL_APIC && X86_TSC + depends on X86_LOCAL_APICThis is problematic. See commit
93cd05976498.Quoted 4 lines
Quoted 1 line
Maybe use "depends on
X86_LOCAL_APIC&&X86_L1_CACHE_SHIFT>= 6" instead?After patch 6/8, this is always true, so I suppose it would if that came first, right?
Yes, agreed.
Quoted 8 lines
On a related note, are there still remaining Xen users on new 32-bit guest kernels? I understand that one could still run modern kernels on 32-bit Xen-4.2 (EOL in 2015), and that 64-bit Xen still supports older 32-bit guest operating systems for compatibility, but I'm not sure if there is any reason to legitimately run a 32-bit linux-7.x kernel on a 64-bit Xen instead of running a better supported 64-bit guest kernel.
Quoted 2 lines
From the logical point of view I totally agree. OTOH users are humans,
so they might not agree with that. ;-)
You might just want to test a 32bit kernel ?
-- David
Quoted 3 lines
Juergen
Re: [PATCH 8/8] x86: simplify 32-bit instruction set selection
In reply to Arnd BergmannQuoted 1 line · On Fri, 22 May 2026 16:19:59 +0200 Arnd Bergmann <[email protected]> wrote:
From: Arnd Bergmann <[email protected]>
...
Quoted 6 lines
Change the CPU selection to build everything with either -march=i586 or -march=i686 and make the specific options only change the -mtune= parameter where this was previously handled by -march=. Note that the only -mtune= options that gcc or clang understand for x86-32 are i486, pentium, pentiumpro, pentium4, atom, geode, k6 and athlon, the other ten are just aliases for one of them.
Hmmm... That rather implies there is nothing for anything designed in the last 20 years.
No wonder code generation choices look strange at times.
You don't want to pick p4, so I guess either p-pro or athlon? But neither is really anything like even Sandy bridge.
-- David
Arnd Bergmann
maintainerRe: [PATCH 8/8] x86: simplify 32-bit instruction set selection
Quoted 12 lines · David Laight
Quoted 1 line · On Fri, 22 May 2026 16:19:59 +0200 Arnd Bergmann <[email protected]> wrote:
From: Arnd Bergmann <[email protected]>
...
Quoted 6 lines
Change the CPU selection to build everything with either -march=i586 or -march=i686 and make the specific options only change the -mtune= parameter where this was previously handled by -march=. Note that the only -mtune= options that gcc or clang understand for x86-32 are i486, pentium, pentiumpro, pentium4, atom, geode, k6 and athlon, the other ten are just aliases for one of them.
Quoted 3 lines
Hmmm... That rather implies there is nothing for anything designed in the last 20 years.
No wonder code generation choices look strange at times.
I think this is correct: I can only think of two 32-bit x86 cores designed in the past 20 year: Quark is basically a i486 pipeline and rarely used with Linux these days. RDC Emkore is still used in low-end SoCs like Vortex86EX2 but never gained GCC support.
Quoted 1 line
You don't want to pick p4, so I guess either p-pro or athlon?
If you have a p4, why wouldn't you pick that option?
Most other 32-bit Intel cores (Pentium II, Pentium III, Pentium-M, Yonah/Core) are indeed iterations of Pentium Pro, picking the more specific Kconfig option has never had any effect on gcc tuning parameters.
If you want a kernel that can run more more than one CPU, CONFIG_X86_GENERIC will still do that, but that is likely measurably worse on the more sensitive cores like k6/nx686 or geode/cx5x86.
Quoted 1 line
But neither is really anything like even Sandy bridge.
Sandy Bridge was well into the 64-bit era. Even when that was new, you wouldn't have run a 32-bit kernel on it (or cared about CPU optimizations if you did). For x86-64 there is no CPU selection and we just always build with -mtune=generic. Thisi works well with any out-of-order microarchitecture.
Arnd
Re: [PATCH 8/8] x86: simplify 32-bit instruction set selection
Quoted 1 line · On Sat, 23 May 2026 10:51:41 +0200 "Arnd Bergmann" <[email protected]> wrote:
On Fri, May 22, 2026, at 23:33, David Laight wrote:
...
Quoted 7 lines
Quoted 1 line
But neither is really anything like even Sandy bridge.
Sandy Bridge was well into the 64-bit era. Even when that was new, you wouldn't have run a 32-bit kernel on it (or cared about CPU optimizations if you did). For x86-64 there is no CPU selection and we just always build with -mtune=generic. This works well with any out-of-order microarchitecture.
For some reason I was thinking the same mtune list would apply to 64bit (even though some would clearly be pointless).
I probably got fooled by you saying that the other ten are aliases.
-- David
Quoted 2 lines
Arnd
Re: [PATCH 1/8] x86: remove ts5500 platforms support
In reply to Arnd BergmannHi Arnd,
Quoted 5 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
Support for Élan was removed in 7.1, but the ts5500 platform still depends on it. Remove this one as well, not that it cannot be used any more.
https://www.embeddedts.com/products/TS-5500
"Retired. Last Time Buy. This product is being retired. We will
have a Last Time Buy until 01/07/26. Supplies are limited."
but
"Available with Linux 2.4 kernel"
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Arnd Bergmann
maintainerRe: [PATCH 1/8] x86: remove ts5500 platforms support
Quoted 9 lines · Geert Uytterhoeven
Hi Arnd,
Quoted 5 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
Support for Élan was removed in 7.1, but the ts5500 platform still depends on it. Remove this one as well, not that it cannot be used any more.
Quoted 8 lines
https://www.embeddedts.com/products/TS-5500
"Retired. Last Time Buy. This product is being retired. We will
have a Last Time Buy until 01/07/26. Supplies are limited."but
"Available with Linux 2.4 kernel"
Linux-2.4 and DOS are probably more commonly used on these than anything modern, given that this is a 486 with 32 MB.
There is a good chance it still would have worked with linux-7.0 if anyone had tried.
Arnd