Skip to content

Commit f234801

Browse files
leoliu-ocopsiff
authored andcommitted
x86/split_lock: Move Split and Bus lock code to a dedicated file
mainline inclusion from v6.11-rc2 commit 350afa8 category: feature ------------------- Bus Lock Detect functionality on AMD platforms works identical to Intel. Move split_lock and bus_lock specific code from intel.c to a dedicated file so that it can be compiled and supported on non-Intel platforms. Also, introduce CONFIG_X86_BUS_LOCK_DETECT, make it dependent on CONFIG_CPU_SUP_INTEL and add compilation dependency of the new bus_lock.c file on CONFIG_X86_BUS_LOCK_DETECT. Signed-off-by: Ravi Bangoria <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Reviewed-by: Tom Lendacky <[email protected]> Link: https://lore.kernel.org/all/[email protected] Signed-off-by: LeoLiu-oc <[email protected]>
1 parent c0ca6c8 commit f234801

File tree

7 files changed

+427
-411
lines changed

7 files changed

+427
-411
lines changed

arch/x86/Kconfig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2486,6 +2486,14 @@ config STRICT_SIGALTSTACK_SIZE
24862486

24872487
source "kernel/livepatch/Kconfig"
24882488

2489+
config X86_BUS_LOCK_DETECT
2490+
bool "Split Lock Detect and Bus Lock Detect support"
2491+
depends on CPU_SUP_INTEL
2492+
default y
2493+
help
2494+
Enable Split Lock Detect and Bus Lock Detect functionalities.
2495+
See <file:Documentation/arch/x86/buslock.rst> for more information.
2496+
24892497
endmenu
24902498

24912499
config CC_HAS_SLS

arch/x86/include/asm/cpu.h

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,13 @@ int mwait_usable(const struct cpuinfo_x86 *);
3838
unsigned int x86_family(unsigned int sig);
3939
unsigned int x86_model(unsigned int sig);
4040
unsigned int x86_stepping(unsigned int sig);
41-
#ifdef CONFIG_CPU_SUP_INTEL
41+
#ifdef CONFIG_X86_BUS_LOCK_DETECT
4242
extern void __init sld_setup(struct cpuinfo_x86 *c);
4343
extern bool handle_user_split_lock(struct pt_regs *regs, long error_code);
4444
extern bool handle_guest_split_lock(unsigned long ip);
4545
extern void handle_bus_lock(struct pt_regs *regs);
46-
u8 get_this_hybrid_cpu_type(void);
46+
void split_lock_init(void);
47+
void bus_lock_init(void);
4748
#else
4849
static inline void __init sld_setup(struct cpuinfo_x86 *c) {}
4950
static inline bool handle_user_split_lock(struct pt_regs *regs, long error_code)
@@ -57,7 +58,13 @@ static inline bool handle_guest_split_lock(unsigned long ip)
5758
}
5859

5960
static inline void handle_bus_lock(struct pt_regs *regs) {}
61+
static inline void split_lock_init(void) {}
62+
static inline void bus_lock_init(void) {}
63+
#endif
6064

65+
#ifdef CONFIG_CPU_SUP_INTEL
66+
u8 get_this_hybrid_cpu_type(void);
67+
#else
6168
static inline u8 get_this_hybrid_cpu_type(void)
6269
{
6370
return 0;

arch/x86/kernel/cpu/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ obj-$(CONFIG_X86_LOCAL_APIC) += perfctr-watchdog.o
5555
obj-$(CONFIG_HYPERVISOR_GUEST) += vmware.o hypervisor.o mshyperv.o
5656
obj-$(CONFIG_ACRN_GUEST) += acrn.o
5757

58+
obj-$(CONFIG_X86_BUS_LOCK_DETECT) += bus_lock.o
59+
5860
quiet_cmd_mkcapflags = MKCAP $@
5961
cmd_mkcapflags = $(CONFIG_SHELL) $(srctree)/$(src)/mkcapflags.sh $@ $^
6062

0 commit comments

Comments
 (0)