Skip to content

Commit 0892d74

Browse files
committed
Merge tag 'x86-splitlock-2024-11-18' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 splitlock updates from Ingo Molnar: - Move Split and Bus lock code to a dedicated file (Ravi Bangoria) - Add split/bus lock support for AMD (Ravi Bangoria) * tag 'x86-splitlock-2024-11-18' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/bus_lock: Add support for AMD x86/split_lock: Move Split and Bus lock code to a dedicated file
2 parents 3f02039 + 408eb74 commit 0892d74

File tree

9 files changed

+432
-413
lines changed

9 files changed

+432
-413
lines changed

Documentation/arch/x86/buslock.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ Detection
2626
=========
2727

2828
Intel processors may support either or both of the following hardware
29-
mechanisms to detect split locks and bus locks.
29+
mechanisms to detect split locks and bus locks. Some AMD processors also
30+
support bus lock detect.
3031

3132
#AC exception for split lock detection
3233
--------------------------------------

arch/x86/Kconfig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2429,6 +2429,14 @@ config CFI_AUTO_DEFAULT
24292429

24302430
source "kernel/livepatch/Kconfig"
24312431

2432+
config X86_BUS_LOCK_DETECT
2433+
bool "Split Lock Detect and Bus Lock Detect support"
2434+
depends on CPU_SUP_INTEL || CPU_SUP_AMD
2435+
default y
2436+
help
2437+
Enable Split Lock Detect and Bus Lock Detect functionalities.
2438+
See <file:Documentation/arch/x86/buslock.rst> for more information.
2439+
24322440
endmenu
24332441

24342442
config CC_HAS_NAMED_AS

arch/x86/include/asm/cpu.h

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ int mwait_usable(const struct cpuinfo_x86 *);
2626
unsigned int x86_family(unsigned int sig);
2727
unsigned int x86_model(unsigned int sig);
2828
unsigned int x86_stepping(unsigned int sig);
29-
#ifdef CONFIG_CPU_SUP_INTEL
29+
#ifdef CONFIG_X86_BUS_LOCK_DETECT
3030
extern void __init sld_setup(struct cpuinfo_x86 *c);
3131
extern bool handle_user_split_lock(struct pt_regs *regs, long error_code);
3232
extern bool handle_guest_split_lock(unsigned long ip);
3333
extern void handle_bus_lock(struct pt_regs *regs);
34-
u8 get_this_hybrid_cpu_type(void);
35-
u32 get_this_hybrid_cpu_native_id(void);
34+
void split_lock_init(void);
35+
void bus_lock_init(void);
3636
#else
3737
static inline void __init sld_setup(struct cpuinfo_x86 *c) {}
3838
static inline bool handle_user_split_lock(struct pt_regs *regs, long error_code)
@@ -46,7 +46,14 @@ static inline bool handle_guest_split_lock(unsigned long ip)
4646
}
4747

4848
static inline void handle_bus_lock(struct pt_regs *regs) {}
49+
static inline void split_lock_init(void) {}
50+
static inline void bus_lock_init(void) {}
51+
#endif
4952

53+
#ifdef CONFIG_CPU_SUP_INTEL
54+
u8 get_this_hybrid_cpu_type(void);
55+
u32 get_this_hybrid_cpu_native_id(void);
56+
#else
5057
static inline u8 get_this_hybrid_cpu_type(void)
5158
{
5259
return 0;

arch/x86/kernel/cpu/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ obj-$(CONFIG_ACRN_GUEST) += acrn.o
5959

6060
obj-$(CONFIG_DEBUG_FS) += debugfs.o
6161

62+
obj-$(CONFIG_X86_BUS_LOCK_DETECT) += bus_lock.o
63+
6264
quiet_cmd_mkcapflags = MKCAP $@
6365
cmd_mkcapflags = $(CONFIG_SHELL) $(src)/mkcapflags.sh $@ $^
6466

0 commit comments

Comments
 (0)