[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YyuCpelHQa00qNNF@google.com>
Date: Wed, 21 Sep 2022 21:31:17 +0000
From: Sean Christopherson <seanjc@...gle.com>
To: Vitaly Kuznetsov <vkuznets@...hat.com>
Cc: kvm@...r.kernel.org, Paolo Bonzini <pbonzini@...hat.com>,
Wanpeng Li <wanpengli@...cent.com>,
Jim Mattson <jmattson@...gle.com>,
Michael Kelley <mikelley@...rosoft.com>,
Siddharth Chandrasekaran <sidcha@...zon.de>,
Yuan Yao <yuan.yao@...ux.intel.com>,
Maxim Levitsky <mlevitsk@...hat.com>,
linux-hyperv@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v10 21/39] KVM: nSVM: hyper-v: Enable L2 TLB flush
On Wed, Sep 21, 2022, Vitaly Kuznetsov wrote:
> diff --git a/arch/x86/kvm/svm/hyperv.h b/arch/x86/kvm/svm/hyperv.h
> index dd2e393f84a0..7b01722838bf 100644
> --- a/arch/x86/kvm/svm/hyperv.h
> +++ b/arch/x86/kvm/svm/hyperv.h
> @@ -33,6 +33,9 @@ struct hv_enlightenments {
> */
> #define VMCB_HV_NESTED_ENLIGHTENMENTS VMCB_SW
>
> +#define HV_SVM_EXITCODE_ENL 0xF0000000
> +#define HV_SVM_ENL_EXITCODE_TRAP_AFTER_FLUSH (1)
Same as the synthetic VMX exit reason, these should go in hyperv-tlfs.h. Keeping
these out of KVM also helps avoid the need for svm/hyperv.h.
https://learn.microsoft.com/en-us/virtualization/hyper-v-on-windows/tlfs/nested-virtualization#synthetic-vm-exit
> +
> static inline void nested_svm_hv_update_vm_vp_ids(struct kvm_vcpu *vcpu)
> {
> struct vcpu_svm *svm = to_svm(vcpu);
> @@ -48,6 +51,33 @@ static inline void nested_svm_hv_update_vm_vp_ids(struct kvm_vcpu *vcpu)
> hv_vcpu->nested.vp_id = hve->hv_vp_id;
> }
>
> +static inline bool
Strongly prefer 'int' with 0/-errno over a boolean. Hrm, maybe add a prep patch
to convert kvm_hv_get_assist_page() to return 0/-errno? That way this can still
return kvm_hv_get_assist_page() directly.
> nested_svm_hv_update_vp_assist(struct kvm_vcpu *vcpu)
Maybe s/update/verify since there isn't a true update anywhere?
> +{
> + if (!to_hv_vcpu(vcpu))
This check isn't necessary, it's covered by kvm_hv_assist_page_enabled().
> + return true;
> +
> + if (!kvm_hv_assist_page_enabled(vcpu))
> + return true;
> +
> + return kvm_hv_get_assist_page(vcpu);
As mentioned earlier, I think this belongs in arch/x86/kvm/hyperv.h.
Powered by blists - more mailing lists