]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
x86/bus_lock: Add support for AMD
authorRavi Bangoria <ravi.bangoria@amd.com>
Thu, 8 Aug 2024 06:29:35 +0000 (06:29 +0000)
committerThomas Gleixner <tglx@linutronix.de>
Thu, 8 Aug 2024 16:02:15 +0000 (18:02 +0200)
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
Documentation/arch/x86/buslock.rst
arch/x86/Kconfig
arch/x86/kernel/cpu/common.c
arch/x86/kernel/cpu/intel.c

index 4c5a4822eeb70b850f2f543c73e06f8a612f4c96..31f1bfdff16f8881fef8e041cf63ae2da82fc94c 100644 (file)
@@ -26,7 +26,8 @@ Detection
 =========
 
 Intel processors may support either or both of the following hardware
-mechanisms to detect split locks and bus locks.
+mechanisms to detect split locks and bus locks. Some AMD processors also
+support bus lock detect.
 
 #AC exception for split lock detection
 --------------------------------------
index 9c4e69a1ae7aa289f3e30d803d3fe7627295c776..e3d53fc7419a1a1f5707c5019a60a74958741d53 100644 (file)
@@ -2428,7 +2428,7 @@ source "kernel/livepatch/Kconfig"
 
 config X86_BUS_LOCK_DETECT
        bool "Split Lock Detect and Bus Lock Detect support"
-       depends on CPU_SUP_INTEL
+       depends on CPU_SUP_INTEL || CPU_SUP_AMD
        default y
        help
          Enable Split Lock Detect and Bus Lock Detect functionalities.
index d4e539d4e158cc561e156c028336080a07478ac8..a37670e1ab4da1b86d684c4a8fa3a2d4ea7ee501 100644 (file)
@@ -1832,6 +1832,8 @@ static void identify_cpu(struct cpuinfo_x86 *c)
        if (this_cpu->c_init)
                this_cpu->c_init(c);
 
+       bus_lock_init();
+
        /* Disable the PN if appropriate */
        squash_the_stupid_serial_number(c);
 
index 8a483f4ad0260aac6345ae92162a7014646b9df8..799f18545c6e73d02fe3fc99e64ea51c7ccd04c9 100644 (file)
@@ -610,7 +610,6 @@ static void init_intel(struct cpuinfo_x86 *c)
        init_intel_misc_features(c);
 
        split_lock_init();
-       bus_lock_init();
 
        intel_init_thermal(c);
 }