Skip to content

Commit 408eb74

Browse files
Ravi BangoriaKAGA-KOKO
authored andcommitted
x86/bus_lock: Add support for AMD
Add Bus Lock Detect (called Bus Lock Trap in AMD docs) support for AMD platforms. Bus Lock Detect is enumerated with CPUID Fn0000_0007_ECX_x0 bit [24 / BUSLOCKTRAP]. It can be enabled through MSR_IA32_DEBUGCTLMSR. When enabled, hardware clears DR6[11] and raises a #DB exception on occurrence of Bus Lock if CPL > 0. More detail about the feature can be found in AMD APM[1]. [1]: AMD64 Architecture Programmer's Manual Pub. 40332, Rev. 4.07 - June 2023, Vol 2, 13.1.3.6 Bus Lock Trap https://bugzilla.kernel.org/attachment.cgi?id=304653 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-3-ravi.bangoria@amd.com
1 parent 350afa8 commit 408eb74

File tree

4 files changed

+5
-3
lines changed

4 files changed

+5
-3
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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2428,7 +2428,7 @@ source "kernel/livepatch/Kconfig"
24282428

24292429
config X86_BUS_LOCK_DETECT
24302430
bool "Split Lock Detect and Bus Lock Detect support"
2431-
depends on CPU_SUP_INTEL
2431+
depends on CPU_SUP_INTEL || CPU_SUP_AMD
24322432
default y
24332433
help
24342434
Enable Split Lock Detect and Bus Lock Detect functionalities.

arch/x86/kernel/cpu/common.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1832,6 +1832,8 @@ static void identify_cpu(struct cpuinfo_x86 *c)
18321832
if (this_cpu->c_init)
18331833
this_cpu->c_init(c);
18341834

1835+
bus_lock_init();
1836+
18351837
/* Disable the PN if appropriate */
18361838
squash_the_stupid_serial_number(c);
18371839

arch/x86/kernel/cpu/intel.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,6 @@ static void init_intel(struct cpuinfo_x86 *c)
610610
init_intel_misc_features(c);
611611

612612
split_lock_init();
613-
bus_lock_init();
614613

615614
intel_init_thermal(c);
616615
}

0 commit comments

Comments
 (0)