public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 0/4] x86/cpu: Add Bus Lock Detect support for AMD
@ 2024-08-08  6:29 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
                   ` (4 more replies)
  0 siblings, 5 replies; 17+ messages in thread
From: Ravi Bangoria @ 2024-08-08  6:29 UTC (permalink / raw)
  To: tglx, mingo, bp, dave.hansen, seanjc, pbonzini, thomas.lendacky,
	jmattson
  Cc: ravi.bangoria, hpa, rmk+kernel, peterz, james.morse,
	lukas.bulwahn, arjan, j.granados, sibs, nik.borisov, michael.roth,
	nikunj.dadhania, babu.moger, x86, kvm, linux-kernel,
	santosh.shukla, ananth.narayan, sandipan.das, manali.shukla

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:

  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

Patches are prepared on tip/master (532361ba3a0e).

v3: https://lore.kernel.org/r/20240806125442.1603-1-ravi.bangoria@amd.com
v3->v4:
 - Introduce CONFIG_X86_BUS_LOCK_DETECT, make it dependent on
   (CONFIG_CPU_SUP_INTEL || CONFIG_CPU_SUP_AMD). And make Bus Lock Detect
   feature dependent on CONFIG_X86_BUS_LOCK_DETECT.
 - Update documentation about Bus Lock Detect support on AMD.

Note:
A Qemu fix is also require to handle a corner case where a hardware
instruction or data breakpoint is created by Qemu remote debugger (gdb)
on the same instruction which also causes a Bus Lock. Qemu patch to
handle it can be found at:
https://lore.kernel.org/r/20240712095208.1553-1-ravi.bangoria@amd.com

Ravi Bangoria (4):
  x86/split_lock: Move Split and Bus lock code to a dedicated file
  x86/bus_lock: Add support for AMD
  KVM: SVM: Don't advertise Bus Lock Detect to guest if SVM support is
    missing
  KVM: SVM: Add Bus Lock Detect support

 Documentation/arch/x86/buslock.rst |   3 +-
 arch/x86/Kconfig                   |   8 +
 arch/x86/include/asm/cpu.h         |  11 +-
 arch/x86/kernel/cpu/Makefile       |   2 +
 arch/x86/kernel/cpu/bus_lock.c     | 406 ++++++++++++++++++++++++++++
 arch/x86/kernel/cpu/common.c       |   2 +
 arch/x86/kernel/cpu/intel.c        | 407 -----------------------------
 arch/x86/kvm/svm/nested.c          |   3 +-
 arch/x86/kvm/svm/svm.c             |  16 +-
 include/linux/sched.h              |   2 +-
 kernel/fork.c                      |   2 +-
 11 files changed, 448 insertions(+), 414 deletions(-)
 create mode 100644 arch/x86/kernel/cpu/bus_lock.c

-- 
2.34.1


^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2025-11-14  8:50 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-08  6:29 [PATCH v4 0/4] x86/cpu: Add Bus Lock Detect support for AMD 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: x86/splitlock] " tip-bot2 for Ravi Bangoria
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox