mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "tip-bot2 for Ravi Bangoria" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Ravi Bangoria <ravi.bangoria@amd.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Tom Lendacky <thomas.lendacky@amd.com>,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: x86/splitlock] x86/bus_lock: Add support for AMD
Date: Thu, 08 Aug 2024 16:07:20 -0000	[thread overview]
Message-ID: <172313324072.2215.14130290124087145806.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20240808062937.1149-3-ravi.bangoria@amd.com>

The following commit has been merged into the x86/splitlock branch of tip:

Commit-ID:     408eb7417a92c5354c7be34f7425b305dfe30ad9
Gitweb:        https://git.kernel.org/tip/408eb7417a92c5354c7be34f7425b305dfe30ad9
Author:        Ravi Bangoria <ravi.bangoria@amd.com>
AuthorDate:    Thu, 08 Aug 2024 06:29:35 
Committer:     Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Thu, 08 Aug 2024 18:02:15 +02:00

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

---
 Documentation/arch/x86/buslock.rst | 3 ++-
 arch/x86/Kconfig                   | 2 +-
 arch/x86/kernel/cpu/common.c       | 2 ++
 arch/x86/kernel/cpu/intel.c        | 1 -
 4 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/Documentation/arch/x86/buslock.rst b/Documentation/arch/x86/buslock.rst
index 4c5a482..31f1bfd 100644
--- a/Documentation/arch/x86/buslock.rst
+++ b/Documentation/arch/x86/buslock.rst
@@ -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
 --------------------------------------
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 9c4e69a..e3d53fc 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -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.
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index d4e539d..a37670e 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -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);
 
diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
index 8a483f4..799f185 100644
--- a/arch/x86/kernel/cpu/intel.c
+++ b/arch/x86/kernel/cpu/intel.c
@@ -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);
 }

  reply	other threads:[~2024-08-08 16:07 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-08  6:29 [PATCH v4 0/4] x86/cpu: Add Bus Lock Detect " Ravi Bangoria
2024-08-08  6:29 ` [PATCH v4 1/4] x86/split_lock: Move Split and Bus lock code to a dedicated file Ravi Bangoria
2024-08-08 16:07   ` [tip: x86/splitlock] " tip-bot2 for Ravi Bangoria
2024-08-08  6:29 ` [PATCH v4 2/4] x86/bus_lock: Add support for AMD Ravi Bangoria
2024-08-08 16:07   ` tip-bot2 for Ravi Bangoria [this message]
2024-08-08  6:29 ` [PATCH v4 3/4] KVM: SVM: Don't advertise Bus Lock Detect to guest if SVM support is missing Ravi Bangoria
2024-08-08  6:29 ` [PATCH v4 4/4] KVM: SVM: Add Bus Lock Detect support Ravi Bangoria
2024-08-17  0:13   ` Sean Christopherson
2024-08-20 16:38     ` Ravi Bangoria
2024-09-05 11:40       ` Ravi Bangoria
2024-08-21  5:36     ` Ravi Bangoria
2024-08-21 10:40       ` Ravi Bangoria
2024-08-26 18:31         ` Sean Christopherson
2025-11-11 10:03     ` Shivansh Dhiman
2025-11-11 15:15       ` Sean Christopherson
2025-11-14  8:50         ` Shivansh Dhiman
2024-08-23 23:47 ` [PATCH v4 0/4] x86/cpu: Add Bus Lock Detect support for AMD Sean Christopherson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=172313324072.2215.14130290124087145806.tip-bot2@tip-bot2 \
    --to=tip-bot2@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=ravi.bangoria@amd.com \
    --cc=tglx@linutronix.de \
    --cc=thomas.lendacky@amd.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®