KVM: VMX: Use cached vcpu_vmx pointer in MSR and segment helpers

vmx_get_msr() and vmx_set_msr() already cache to_vmx(vcpu) in a local
'vmx' pointer, but a few cases still open-code to_vmx(vcpu).  Use the
cached pointer for consistency.

Likewise, cache to_vmx(vcpu) in vmx_get_segment_base() instead of
open-coding it in both the real-mode check and the VMCS read path.

No functional change intended.

Signed-off-by: Hao Zhang <zhanghao1@kylinos.cn>
Link: https://patch.msgid.link/tencent_A78DC401911634111A3391650CB00FCD0409@qq.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
This commit is contained in:
Hao Zhang 2026-06-29 14:10:41 +08:00 • committed by Sean Christopherson
commit 6978adcc3e