lkml.org 
[lkml]   [2022]   [Apr]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    SubjectRe: [RFC PATCH v5 077/104] KVM: TDX: Use vcpu_to_pi_desc() uniformly in posted_intr.c
    From
    On 3/4/22 20:49, isaku.yamahata@intel.com wrote:
    > From: Yuan Yao <yuan.yao@intel.com>
    >
    > The helper function, vcpu_to_pi_desc(), is defined to get the posted
    > interrupt descriptor from vcpu. There is one place that doesn't use it,
    > but direct reference to vmx_vcpu->pi_desc. It's inconsistent.
    >
    > For TDX, TDX vcpu structure will be defined and the helper function,
    > vcpu_to_pi_desc(), will return tdx_vcpu->pi_desc for TDX case instead of
    > vmx_vcpu->pi_desc. The direct reference to vmx_vcpu->pi_desc doesn't work
    > for TDX.
    >
    > Replace vmx_vcpu->pi_desc with the helper function, vcpu_pi_desc() for
    > consistency and TDX.
    >
    > Signed-off-by: Yuan Yao <yuan.yao@intel.com>
    > Signed-off-by: Isaku Yamahata <isaku.yamahata@intel.com>
    > ---
    > arch/x86/kvm/vmx/posted_intr.c | 2 +-
    > arch/x86/kvm/vmx/x86_ops.h | 3 +++
    > 2 files changed, 4 insertions(+), 1 deletion(-)
    >
    > diff --git a/arch/x86/kvm/vmx/posted_intr.c b/arch/x86/kvm/vmx/posted_intr.c
    > index aa1fe9085d77..c8a81c916eed 100644
    > --- a/arch/x86/kvm/vmx/posted_intr.c
    > +++ b/arch/x86/kvm/vmx/posted_intr.c
    > @@ -311,7 +311,7 @@ int pi_update_irte(struct kvm *kvm, unsigned int host_irq, uint32_t guest_irq,
    > continue;
    > }
    >
    > - vcpu_info.pi_desc_addr = __pa(&to_vmx(vcpu)->pi_desc);
    > + vcpu_info.pi_desc_addr = __pa(vcpu_to_pi_desc(vcpu));
    > vcpu_info.vector = irq.vector;
    >
    > trace_kvm_pi_irte_update(host_irq, vcpu->vcpu_id, e->gsi,
    > diff --git a/arch/x86/kvm/vmx/x86_ops.h b/arch/x86/kvm/vmx/x86_ops.h
    > index aae0f4449ec5..0f1a28f67e60 100644
    > --- a/arch/x86/kvm/vmx/x86_ops.h
    > +++ b/arch/x86/kvm/vmx/x86_ops.h
    > @@ -147,6 +147,9 @@ void tdx_prepare_switch_to_guest(struct kvm_vcpu *vcpu);
    > void tdx_vcpu_put(struct kvm_vcpu *vcpu);
    > void tdx_vcpu_load(struct kvm_vcpu *vcpu, int cpu);
    >
    > +void tdx_apicv_post_state_restore(struct kvm_vcpu *vcpu);
    > +int tdx_deliver_posted_interrupt(struct kvm_vcpu *vcpu, int vector);
    > +
    > int tdx_vm_ioctl(struct kvm *kvm, void __user *argp);
    > int tdx_vcpu_ioctl(struct kvm_vcpu *vcpu, void __user *argp);
    >

    Applied the first hunk, the second should be squashed somewhere else.

    Paolo

    \
     
     \ /
      Last update: 2022-04-06 02:59    [W:2.282 / U:0.160 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site