Skip to content

Commit cc57834

Browse files
John Allenjallen-amd
authored andcommitted
x86/split_lock: Move Split and Bus lock code to a dedicated file
JIRA: https://issues.redhat.com/browse/RHEL-50321 commit 350afa8 Author: Ravi Bangoria <ravi.bangoria@amd.com> Date: Thu Aug 8 06:29:34 2024 +0000 x86/split_lock: Move Split and Bus lock code to a dedicated file 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 <ravi.bangoria@amd.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com> Link: https://lore.kernel.org/all/20240808062937.1149-2-ravi.bangoria@amd.com Signed-off-by: John Allen <johnalle@redhat.com> RHEL NOTES: Conflicts: arch/x86/include/asm/cpu.h: fcfa149 adds get_this_hybrid_cpu_native_id which hadn't introduced when this commit was merged and the declaration needs to be moved along with get_this_hybrid_cpu_type.
1 parent 234e7c1 commit cc57834

File tree

7 files changed

+428
-411
lines changed

7 files changed

+428
-411
lines changed

arch/x86/Kconfig

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

24332433
source "kernel/livepatch/Kconfig"
24342434

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

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