]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
KVM: x86: Add helpers to prepare kvm_run for userspace MMIO exit
authorSean Christopherson <seanjc@google.com>
Wed, 25 Feb 2026 01:20:49 +0000 (17:20 -0800)
committerSean Christopherson <seanjc@google.com>
Tue, 3 Mar 2026 00:06:49 +0000 (16:06 -0800)
commite2138c4a5be1e50d75281136bdc3e709cb07ec5e
tree3bbb0777a0250c90de08b6a6a6954e00003e2931
parent4f09e62afcd6c7a2c3428a3453ced7e56475dc70
KVM: x86: Add helpers to prepare kvm_run for userspace MMIO exit

Add helpers to fill kvm_run for userspace MMIO exits to deduplicate a
variety of code, and to allow for a cleaner return path in
emulator_read_write().

Opportunistically add a KVM_BUG_ON() to ensure the caller is limiting the
length of a single MMIO access to 8 bytes (the largest size userspace is
prepared to handled, as the ABI was baked before things like MOVDQ came
along).

No functional change intended.

Cc: Rick Edgecombe <rick.p.edgecombe@intel.com>
Cc: Binbin Wu <binbin.wu@linux.intel.com>
Cc: Xiaoyao Li <xiaoyao.li@intel.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Cc: Michael Roth <michael.roth@amd.com>
Tested-by: Tom Lendacky <thomas.lendacky@gmail.com>
Tested-by: Rick Edgecombe <rick.p.edgecombe@intel.com>
Link: https://patch.msgid.link/20260225012049.920665-15-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/kvm/vmx/tdx.c
arch/x86/kvm/x86.c
arch/x86/kvm/x86.h