Kernel KVM virtualization development
 help / color / mirror / Atom feed
* Re: [PATCH v3 3/4] KVM: x86: Virtualize AMD CPUID faulting
@ 2026-05-28 22:01 Christian Ludloff
  2026-05-29  0:00 ` Sean Christopherson
  0 siblings, 1 reply; 13+ messages in thread
From: Christian Ludloff @ 2026-05-28 22:01 UTC (permalink / raw)
  To: Jim Mattson, Kaplan, David
  Cc: Sean Christopherson, pbonzini@redhat.com, tglx@kernel.org,
	mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com,
	x86@kernel.org, hpa@zytor.com, shuah@kernel.org,
	kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-kselftest, ctpence@google.com

> It appears it was a deliberate decision, due in part to the fact that the traditional flow of checking CPL exceptions before intercepts typically applies to using instructions in an illegal way, but the user is not doing anything illegal here by executing CPUID which is normally a legal instruction at CPL3.
>
> That said, clearly the behavior is different now between the vendors, however at this point the feedback I got is that our architects want to stick with the existing behavior unless there is a strong reason that it is a problem for SW.

What is a HV expected to do for such a CPUID guest exit?

--
C.

^ permalink raw reply	[flat|nested] 13+ messages in thread
* [PATCH v3 0/4] KVM: x86: Virtualize AMD's "disable CPUID in usermode"
@ 2026-05-13 22:46 Jim Mattson
  2026-05-13 22:46 ` [PATCH v3 3/4] KVM: x86: Virtualize AMD CPUID faulting Jim Mattson
  0 siblings, 1 reply; 13+ messages in thread
From: Jim Mattson @ 2026-05-13 22:46 UTC (permalink / raw)
  To: seanjc, pbonzini, tglx, mingo, bp, dave.hansen, x86, hpa, shuah,
	kvm, linux-kernel, linux-kselftest, ctpence
  Cc: Jim Mattson

AMD's "disable CPUID in usermode" feature is analogous to Intel's "CPUID
faulting" feature, but it is advertised and activated differently.  The AMD
feature is advertised via CPUID.80000021H:EAX.CpuidUserDis[bit 17] and
activated by setting HWCR.CpuidUserDis[bit 35].

Add virtualization support for the AMD feature.

v2 -> v3:
* Logic consolidation between emulator and CPUID VM-exit handler [Sean]
* Define MSR_K7_HWCR_CPUID_USER_DIS
* Keep u64 in the selftest (oops)
* Fixe the selftest failre on Intel hosts

v1: https://lore.kernel.org/kvm/20260402223108.650572-1-jmattson@google.com/
v2: https://lore.kernel.org/kvm/20260508170714.489136-1-jmattson@google.com/

Jim Mattson (3):
  KVM: x86: Remove supports_cpuid_fault() helper
  KVM: x86: Virtualize AMD CPUID faulting
  KVM: selftests: Update hwcr_msr_test for CPUID faulting bit

Sean Christopherson (1):
  KVM: x86: Consolidate CPUID fault handling for emulator and
    interception logic

 arch/x86/include/asm/kvm_host.h               |  1 -
 arch/x86/include/asm/msr-index.h              |  1 +
 arch/x86/kvm/cpuid.c                          |  7 ++--
 arch/x86/kvm/cpuid.h                          | 14 ++++---
 arch/x86/kvm/emulate.c                        |  6 +--
 arch/x86/kvm/kvm_emulate.h                    |  1 +
 arch/x86/kvm/x86.c                            | 38 +++++++++----------
 .../selftests/kvm/include/x86/processor.h     |  1 +
 .../testing/selftests/kvm/x86/hwcr_msr_test.c |  9 ++++-
 9 files changed, 43 insertions(+), 35 deletions(-)


base-commit: 85f871f6ba46f20d7fbc0b016b4db648c33220dd
-- 
2.54.0.631.ge1b05301d1-goog


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

end of thread, other threads:[~2026-05-29  0:00 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-28 22:01 [PATCH v3 3/4] KVM: x86: Virtualize AMD CPUID faulting Christian Ludloff
2026-05-29  0:00 ` Sean Christopherson
  -- strict thread matches above, loose matches on Subject: below --
2026-05-13 22:46 [PATCH v3 0/4] KVM: x86: Virtualize AMD's "disable CPUID in usermode" Jim Mattson
2026-05-13 22:46 ` [PATCH v3 3/4] KVM: x86: Virtualize AMD CPUID faulting Jim Mattson
2026-05-14 13:19   ` Jim Mattson
2026-05-14 14:28     ` Sean Christopherson
2026-05-14 14:45       ` Jim Mattson
2026-05-14 16:20         ` Sean Christopherson
2026-05-14 16:22           ` Jim Mattson
2026-05-14 16:35             ` Sean Christopherson
2026-05-14 18:01               ` Jim Mattson
2026-05-14 18:17                 ` Kaplan, David
2026-05-26 18:38                   ` Jim Mattson
     [not found]                     ` <DS7PR12MB82011943131DF5415365E19E940B2@DS7PR12MB8201.namprd12.prod.outlook.com>
2026-05-27 13:25                       ` Jim Mattson

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