Re: [PATCH v10 8/9] KVM: x86: Untag address for vmexit handlers when LAM applicable

From: Sean Christopherson
Date: Wed Aug 16 2023 - 17:50:48 EST


On Wed, Jul 19, 2023, Binbin Wu wrote:
> index abf6d42672cd..f18e610c4363 100644
> --- a/arch/x86/kvm/vmx/vmx.c
> +++ b/arch/x86/kvm/vmx/vmx.c
> @@ -8177,8 +8177,7 @@ static void vmx_vm_destroy(struct kvm *kvm)
> free_pages((unsigned long)kvm_vmx->pid_table, vmx_get_pid_table_order(kvm));
> }
>
> -static gva_t vmx_get_untagged_addr(struct kvm_vcpu *vcpu, gva_t gva,
> - unsigned int flags)
> +gva_t vmx_get_untagged_addr(struct kvm_vcpu *vcpu, gva_t gva, unsigned int flags)
> {
> unsigned long cr3_bits;
> int lam_bit;
> diff --git a/arch/x86/kvm/vmx/vmx.h b/arch/x86/kvm/vmx/vmx.h
> index 32384ba38499..6fb612355769 100644
> --- a/arch/x86/kvm/vmx/vmx.h
> +++ b/arch/x86/kvm/vmx/vmx.h
> @@ -421,6 +421,8 @@ void vmx_enable_intercept_for_msr(struct kvm_vcpu *vcpu, u32 msr, int type);
> u64 vmx_get_l2_tsc_offset(struct kvm_vcpu *vcpu);
> u64 vmx_get_l2_tsc_multiplier(struct kvm_vcpu *vcpu);
>
> +gva_t vmx_get_untagged_addr(struct kvm_vcpu *vcpu, gva_t gva, unsigned int flags);
> +

I think it makes sense to squash this with whatever patch first adds
vmx_get_untagged_addr(). It'll make that initial "virtual LAM_*" patch a fair
bit bigger, but overall I think the series/patches will be easier to review,
e.g. the rules for LAM_SUP will mostly be captured in a single patch.

One could even make an argument for squashing LAM_U* support with the LAM_SUP
patch, but my vote is to keep them separate.