[PATCH v2 0/4] target/i386: Add AMD LBR Extension v2 support

Shivansh Dhiman posted 4 patches 1 month ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20261019201314.269798-1-shivansh.dhiman@amd.com
Maintainers: Paolo Bonzini <pbonzini@redhat.com>, Zhao Liu <zhao1.liu@intel.com>, Marcelo Tosatti <mtosatti@redhat.com>
target/i386/cpu.c     | 26 +++++++++++++++++++++++---
target/i386/cpu.h     | 15 ++++++++++++++-
target/i386/kvm/kvm.c | 31 +++++++++++++++++++++++++++++++
target/i386/machine.c | 24 ++++++++++++++++++++++++
4 files changed, 92 insertions(+), 4 deletions(-)
[PATCH v2 0/4] target/i386: Add AMD LBR Extension v2 support
Posted by Shivansh Dhiman 1 month ago
This QEMU series exposes AMD's Last Branch Record Extension Version 2
(LbrExtV2) and the dependent LBR/PMC freeze feature to guests, so that
they can use the LBRv2 virtualization provided by KVM.

LbrExtV2, introduced on Zen 4, is a branch sampling facility. It records
the last taken branches in a 16-entry stack of dedicated MSRs:
  * MSR 0xC000010E - Last Branch Stack Select  (LBR_SELECT)
  * MSR 0xC000010F - Debug Extension Control   (DBG_EXTN_CFG)
  * MSR 0xC0010300..0xC001031F - 16 LBR FROM/TO MSR pairs

v1: https://lore.kernel.org/qemu-devel/20260724201203.633799-1-shivansh.dhiman@amd.com/

Regards,
Shivansh

---
Changelog:

v1 -> v2:
 * Rebased on v11.1.2.
 * New patch to read and write the LbrExtV2 MSRs with KVM_GET_MSRS and
   KVM_SET_MSRS (patch 1).
 * New patch to migrate the LbrExtV2 MSRs in a new VMState subsection
   (patch 2).
 * Moved the CPUID_8000_0022_EAX_LBREXT_V2 definition to patch 1.

---
Shivansh Dhiman (4):
  target/i386: Add MSR access interface for AMD LbrExtV2
  target/i386: Add AMD LbrExtV2 states to vmstate
  target/i386: Add support for AMD LbrExtV2
  target/i386: Add support for AMD LBR/PMC freeze

 target/i386/cpu.c     | 26 +++++++++++++++++++++++---
 target/i386/cpu.h     | 15 ++++++++++++++-
 target/i386/kvm/kvm.c | 31 +++++++++++++++++++++++++++++++
 target/i386/machine.c | 24 ++++++++++++++++++++++++
 4 files changed, 92 insertions(+), 4 deletions(-)


base-commit: 4fc49f46dc95d4a27de2509e7fceb2931e91faeb
-- 
2.43.0