Skip to content

target/i386: Add AMD LBR Extension v2 support

Shivansh Dhiman kvm qemu-devel 2 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest4 patches 0 repliesNew
  2. v12 patches 0 repliesSuperseded

Changes in v2 from the cover letter

* 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.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4target/i386: Add MSR access interface for AMD LbrExtV2target/i386/cpu.h target/i386/kvm/kvm.c+43 -00 replies
2/4target/i386: Add AMD LbrExtV2 states to vmstatetarget/i386/machine.c+24 -00 replies
3/4target/i386: Add support for AMD LbrExtV2target/i386/cpu.c+15 -30 replies
4/4target/i386: Add support for AMD LBR/PMC freezetarget/i386/cpu.c target/i386/cpu.h+12 -30 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

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

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/[email protected]/

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

Signature · 1 line
2.43.0