public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/6] KVM: x86/pmu: Add support for AMD HG_ONLY bits
@ 2026-01-21 22:53 Jim Mattson
  2026-01-21 22:53 ` [PATCH 1/6] KVM: x86/pmu: Introduce amd_pmu_set_eventsel_hw() Jim Mattson
                   ` (5 more replies)
  0 siblings, 6 replies; 21+ messages in thread
From: Jim Mattson @ 2026-01-21 22:53 UTC (permalink / raw)
  To: Sean Christopherson, Paolo Bonzini, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, Dave Hansen, x86, H. Peter Anvin, Peter Zijlstra,
	Arnaldo Carvalho de Melo, Namhyung Kim, Mark Rutland,
	Alexander Shishkin, Jiri Olsa, Ian Rogers, Adrian Hunter,
	James Clark, Shuah Khan, kvm, linux-kernel, linux-perf-users,
	linux-kselftest
  Cc: Jim Mattson

This series adds support for AMD's Host-Only (bit 41) and Guest-Only (bit
40) performance counter eventsel bits in KVM's mediated PMU passthrough
implementation.

These bits allow an nSVM-enabled guest to configure performance counters
that count only during L1 execution (Host-Only) or only during L2 execution
(Guest-Only).

KVM tracks which PMCs have Host-Only xor Guest-Only bits set, and updates
the hardware event selector ENABLE bit at the following state transitions:

  - EFER.SVME changes: Enable/disable Guest-Only counters
  - VMRUN: Disable Host-Only, enable Guest-Only counters
  - VMEXIT: Enable Host-Only, disable Guest-Only counters

Jim Mattson (6):
  KVM: x86/pmu: Introduce amd_pmu_set_eventsel_hw()
  KVM: x86/pmu: Disable HG_ONLY events as appropriate for current vCPU
    state
  KVM: x86/pmu: Track enabled AMD PMCs with Host-Only xor Guest-Only
    bits set
  KVM: x86/pmu: [De]activate HG_ONLY PMCs at SVME changes and nested
    transitions
  KVM: x86/pmu: Allow HG_ONLY bits with nSVM and mediated PMU
  KVM: selftests: x86: Add svm_pmu_hg_test for HG_ONLY bits

 arch/x86/include/asm/kvm-x86-pmu-ops.h        |   1 +
 arch/x86/include/asm/kvm_host.h               |   4 +
 arch/x86/include/asm/perf_event.h             |   2 +
 arch/x86/kvm/pmu.c                            |   9 +
 arch/x86/kvm/pmu.h                            |   4 +
 arch/x86/kvm/svm/nested.c                     |  10 +
 arch/x86/kvm/svm/pmu.c                        |  84 ++++-
 arch/x86/kvm/svm/svm.c                        |   3 +
 tools/testing/selftests/kvm/Makefile.kvm      |   1 +
 .../selftests/kvm/x86/svm_pmu_hg_test.c       | 297 ++++++++++++++++++
 10 files changed, 412 insertions(+), 3 deletions(-)
 create mode 100644 tools/testing/selftests/kvm/x86/svm_pmu_hg_test.c

-- 
2.52.0.457.g6b5491de43-goog


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

end of thread, other threads:[~2026-01-29 22:34 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-21 22:53 [PATCH 0/6] KVM: x86/pmu: Add support for AMD HG_ONLY bits Jim Mattson
2026-01-21 22:53 ` [PATCH 1/6] KVM: x86/pmu: Introduce amd_pmu_set_eventsel_hw() Jim Mattson
2026-01-22 16:04   ` Sean Christopherson
2026-01-22 21:57     ` Jim Mattson
2026-01-21 22:54 ` [PATCH 2/6] KVM: x86/pmu: Disable HG_ONLY events as appropriate for current vCPU state Jim Mattson
2026-01-22 16:33   ` Sean Christopherson
2026-01-22 22:47     ` Jim Mattson
2026-01-22 23:51       ` Sean Christopherson
2026-01-21 22:54 ` [PATCH 3/6] KVM: x86/pmu: Track enabled AMD PMCs with Host-Only xor Guest-Only bits set Jim Mattson
2026-01-22 16:49   ` Sean Christopherson
2026-01-24  1:09     ` Jim Mattson
2026-01-21 22:54 ` [PATCH 4/6] KVM: x86/pmu: [De]activate HG_ONLY PMCs at SVME changes and nested transitions Jim Mattson
2026-01-22 16:55   ` Sean Christopherson
2026-01-28 23:43     ` Jim Mattson
2026-01-29 22:34       ` Sean Christopherson
2026-01-21 22:54 ` [PATCH 5/6] KVM: x86/pmu: Allow HG_ONLY bits with nSVM and mediated PMU Jim Mattson
2026-01-22 16:56   ` Sean Christopherson
2026-01-21 22:54 ` [PATCH 6/6] KVM: selftests: x86: Add svm_pmu_hg_test for HG_ONLY bits Jim Mattson
2026-01-22 17:12   ` Sean Christopherson
2026-01-28 23:47     ` Jim Mattson
2026-01-22 18:56   ` kernel test robot

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