]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
KVM: x86: Add kvm_msr_{read,write}() helpers
authorYang Weijiang <weijiang.yang@intel.com>
Tue, 12 Aug 2025 02:55:11 +0000 (19:55 -0700)
committerSean Christopherson <seanjc@google.com>
Tue, 19 Aug 2025 18:59:49 +0000 (11:59 -0700)
commitc2aa58b226abf5ac6d355fb1f3b7c4284a7b5cab
tree77305c09088ce3c96c35c8d8c205d7c3ba916c24
parentdb07f3d0eb19663d8fb61b40c19b26703c9a1b1a
KVM: x86: Add kvm_msr_{read,write}() helpers

Wrap __kvm_{get,set}_msr() into two new helpers for KVM usage and use the
helpers to replace existing usage of the raw functions.
kvm_msr_{read,write}() are KVM-internal helpers, i.e. used when KVM needs
to get/set a MSR value for emulating CPU behavior, i.e., host_initiated ==
%true in the helpers.

Suggested-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Yang Weijiang <weijiang.yang@intel.com>
Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>
Tested-by: Mathias Krause <minipli@grsecurity.net>
Tested-by: John Allen <john.allen@amd.com>
Signed-off-by: Chao Gao <chao.gao@intel.com>
Tested-by: Rick Edgecombe <rick.p.edgecombe@intel.com>
Link: https://lore.kernel.org/r/20250812025606.74625-4-chao.gao@intel.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/include/asm/kvm_host.h
arch/x86/kvm/cpuid.c
arch/x86/kvm/x86.c