lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 5 Apr 2022 17:36:52 +0200
From:   Paolo Bonzini <pbonzini@...hat.com>
To:     isaku.yamahata@...el.com, kvm@...r.kernel.org,
        linux-kernel@...r.kernel.org
Cc:     isaku.yamahata@...il.com, Jim Mattson <jmattson@...gle.com>,
        erdemaktas@...gle.com, Connor Kuehl <ckuehl@...hat.com>,
        Sean Christopherson <seanjc@...gle.com>
Subject: Re: [RFC PATCH v5 077/104] KVM: TDX: Use vcpu_to_pi_desc() uniformly
 in posted_intr.c

On 3/4/22 20:49, isaku.yamahata@...el.com wrote:
> From: Yuan Yao <yuan.yao@...el.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@...el.com>
> Signed-off-by: Isaku Yamahata <isaku.yamahata@...el.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

Powered by blists - more mailing lists