Re: [PATCH] KVM: x86: Drop "cache" from user return MSR setter that skips WRMSR
From: Yan Zhao
Date: Tue Sep 30 2025 - 08:23:52 EST
On Fri, Sep 19, 2025 at 02:42:59PM -0700, Sean Christopherson wrote:
> Rename kvm_user_return_msr_update_cache() to __kvm_set_user_return_msr()
> and use the helper kvm_set_user_return_msr() to make it obvious that the
> double-underscores version is doing a subset of the work of the "full"
> setter.
>
> While the function does indeed update a cache, the nomenclature becomes
> slightly misleading when adding a getter[1], as the current value isn't
> _just_ the cached value, it's also the value that's currently loaded in
> hardware.
Nit:
For TDX, "it's also the value that's currently loaded in hardware" is not true.
> Opportunistically rename "index" to "slot" in the prototypes. The user-
> return APIs deliberately use "slot" to try and make it more obvious that
> they take the slot within the array, not the index of the MSR.
>
> No functional change intended.
Reviewed-by: Yan Zhao <yan.y.zhao@xxxxxxxxx>
> Cc: Yan Zhao <yan.y.zhao@xxxxxxxxx>
> Cc: Xiaoyao Li <xiaoyao.li@xxxxxxxxx>
> Cc: Rick Edgecombe <rick.p.edgecombe@xxxxxxxxx>
> Link: https://lore.kernel.org/all/aM2EvzLLmBi5-iQ5@xxxxxxxxxx [1]
> Signed-off-by: Sean Christopherson <seanjc@xxxxxxxxxx>