mbox series

[v1,0/5] Add support for the Idle HLT intercept feature

Message ID 20240307054623.13632-1-manali.shukla@amd.com (mailing list archive)
Headers show
Series Add support for the Idle HLT intercept feature | expand

Message

Manali Shukla March 7, 2024, 5:46 a.m. UTC
The upcoming new Idle HLT Intercept feature allows for the HLT
instruction execution by a vCPU to be intercepted by the hypervisor
only if there are no pending V_INTR and V_NMI events for the vCPU.
When the vCPU is expected to service the pending V_INTR and V_NMI
events, the Idle HLT intercept won’t trigger. The feature allows the
hypervisor to determine if the vCPU is actually idle and reduces
wasteful VMEXITs.

Presence of the Idle HLT Intercept feature is indicated via CPUID
function Fn8000_000A_EDX[30].

Document for the Idle HLT intercept feature will be available in the
next version of "AMD64 Architecture Programmer’s Manual".

Testing Done: 
Added a selftest to test the Idle HLT intercept functionality.
Tested SEV and SEV-ES guest for the Idle HLT intercept functionality.

Manali Shukla (5):
  x86/cpufeatures: Add CPUID feature bit for Idle HLT intercept
  KVM: SVM: Add Idle HLT intercept support
  tools: Add KVM exit reason for the Idle HLT
  selftests: Add an interface to read the data of named vcpu stat
  selftests: KVM: SVM: Add Idle HLT intercept test

 arch/x86/include/asm/cpufeatures.h            |   1 +
 arch/x86/include/asm/svm.h                    |   1 +
 arch/x86/include/uapi/asm/svm.h               |   2 +
 arch/x86/kvm/svm/svm.c                        |  11 +-
 tools/arch/x86/include/uapi/asm/svm.h         |   2 +
 tools/testing/selftests/kvm/Makefile          |   1 +
 .../selftests/kvm/include/kvm_util_base.h     |  11 ++
 tools/testing/selftests/kvm/lib/kvm_util.c    |  41 ++++++
 .../selftests/kvm/x86_64/svm_idlehlt_test.c   | 119 ++++++++++++++++++
 9 files changed, 186 insertions(+), 3 deletions(-)
 create mode 100644 tools/testing/selftests/kvm/x86_64/svm_idlehlt_test.c


base-commit: fdd58834d132046149699b88a27a0db26829f4fb