Skip to content

Commit 9ff03bb

Browse files
committed
Merge: AMD Bus Lock Trap Support
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-10/-/merge_requests/807 JIRA: https://issues.redhat.com/browse/RHEL-50321 Buslock trap support is a new feature in Turin to detect split locks and bus locks. These patches add support. Signed-off-by: John Allen <johnalle@redhat.com> Approved-by: David Arcari <darcari@redhat.com> Approved-by: Steve Best <sbest@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: Scott Weaver <scweaver@redhat.com>
2 parents f743e5b + ce5a7d8 commit 9ff03bb

File tree

10 files changed

+433
-413
lines changed

10 files changed

+433
-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
@@ -2433,6 +2433,14 @@ config CFI_AUTO_DEFAULT
24332433

24342434
source "kernel/livepatch/Kconfig"
24352435

2436+
config X86_BUS_LOCK_DETECT
2437+
bool "Split Lock Detect and Bus Lock Detect support"
2438+
depends on CPU_SUP_INTEL || CPU_SUP_AMD
2439+
default y
2440+
help
2441+
Enable Split Lock Detect and Bus Lock Detect functionalities.
2442+
See <file:Documentation/arch/x86/buslock.rst> for more information.
2443+
24362444
endmenu
24372445

24382446
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)