]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
KVM: x86: Drop non-raw kvm_<reg>_write() helpers
authorSean Christopherson <seanjc@google.com>
Fri, 29 May 2026 22:21:52 +0000 (15:21 -0700)
committerSean Christopherson <seanjc@google.com>
Wed, 3 Jun 2026 12:35:21 +0000 (05:35 -0700)
Drop the non-raw, mode-aware kvm_<reg>_write() helpers as there is no
usage in KVM, and in all likelihood there will never be usage in KVM as
use of hardcoded registers in instructions is uncommon, and *modifying*
hardcoded registers is practically unheard of.  While there are a few
instructions that modify registers in mode-aware ways, e.g. REP string
and some ENCLS varieties, the odds of KVM needing to emulate such
instructions (outside of the fully emulator) are vanishingly small.

Drop kvm_<reg>_write() to prevent incorrect usage; _if_ a new instruction
comes along that needs to modify a hardcoded register, this can be
reverted.

No functional change intended.

Reviewed-by: Binbin Wu <binbin.wu@linux.intel.com>
Link: https://patch.msgid.link/20260529222223.870923-10-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/kvm/regs.h

index 12db5039aace6d7c262941af513684e0dd379b51..f22b3a8cd483d05e3ae7be002067625d20764d4a 100644 (file)
@@ -61,11 +61,6 @@ static __always_inline unsigned long kvm_##lname##_read(struct kvm_vcpu *vcpu)
 {                                                                                      \
        return vcpu->arch.regs[VCPU_REGS_##uname] & kvm_reg_mode_mask(vcpu);            \
 }                                                                                      \
-static __always_inline void kvm_##lname##_write(struct kvm_vcpu *vcpu,                 \
-                                               unsigned long val)                      \
-{                                                                                      \
-       vcpu->arch.regs[VCPU_REGS_##uname] = val & kvm_reg_mode_mask(vcpu);             \
-}                                                                                      \
 static __always_inline unsigned long kvm_##lname##_read_raw(struct kvm_vcpu *vcpu)     \
 {                                                                                      \
        return vcpu->arch.regs[VCPU_REGS_##uname];                                      \