From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 67406C4332F for ; Wed, 6 Apr 2022 00:51:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1838470AbiDFAvp (ORCPT ); Tue, 5 Apr 2022 20:51:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1457272AbiDEQDC (ORCPT ); Tue, 5 Apr 2022 12:03:02 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 38FCF20BEF for ; Tue, 5 Apr 2022 08:36:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1649173017; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=w5pFr+rSLwvAAi2cZv8XUzE7S/JhtL0csx8uaJExo6E=; b=K5R6xQezlx1pJGBySI3Xs1whNba30+/p9ZOO9lx0XEkC2WRCeN0rytrr3sfxhesm/qCbeX qSM3uaR+A/VrJdoFYjRkWU8k3cZ8f4zK0i6PDcy2QLB1qULnxcCNQR1vha7I6yZJgNP0B3 2BW6q1YqSaQa4gZ244Lf5LEXxBDSGec= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-263-H6cTnmRzPWy8M7cRT4dMsg-1; Tue, 05 Apr 2022 11:36:56 -0400 X-MC-Unique: H6cTnmRzPWy8M7cRT4dMsg-1 Received: by mail-wm1-f69.google.com with SMTP id r19-20020a7bc093000000b0038e706da7c0so1405988wmh.1 for ; Tue, 05 Apr 2022 08:36:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=w5pFr+rSLwvAAi2cZv8XUzE7S/JhtL0csx8uaJExo6E=; b=1dMeagrGthyZMD9CPjhDLEzibvY73BmqedNMadxs9ont3nOEDzthyiI0pHlCrVSRyP uZFM/kgLhCMnZ/pcIJpEN9yG10BsW3c2h+cVB3pfoOIj26Scp57FFmmezgI93X3Lk6kC ZGrsoOT0RdcKYL5CovLqFHWlokshW8r6HW8DZ5iL1BX3kArE42n/U7qcxRipJgEshXOZ E1UzBMjRJpqn2CnVYnrfxjKPcGAU2Y+d3/1BbPOaQfwAHJeYbeHUBHliSw1Ipt76mKjP /7KGjqvB9aIeY1o15aEWoyJCPsaKnWMDiiShBfGpdsg9YvJmUiC5HEcsa8ONvFh8UaGz c4ig== X-Gm-Message-State: AOAM533czhg4TEDPKCWBf27oKl/uwbxyotydEeRaFJrc4k9AY5BZw3wi tOqut/6DB/l/9AW+WrJqNdqB/MZxg+/7GTkig7GOE05swPQ7TDpPJ9qsafz3ZgQAiFpS6iJ7ZZa 1vbLgomvxzAfEKj+SXE0lxeVC X-Received: by 2002:a05:600c:2213:b0:38e:7138:de13 with SMTP id z19-20020a05600c221300b0038e7138de13mr3610880wml.26.1649173014506; Tue, 05 Apr 2022 08:36:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyD2fMFuh8JuuHOsHRwnbywieUmyYbfuQQjPfttsinL3vtfw+ztig4KQrX2KML8XIXv9oeJ5Q== X-Received: by 2002:a05:600c:2213:b0:38e:7138:de13 with SMTP id z19-20020a05600c221300b0038e7138de13mr3610856wml.26.1649173014255; Tue, 05 Apr 2022 08:36:54 -0700 (PDT) Received: from [10.32.181.87] (nat-pool-mxp-t.redhat.com. [149.6.153.186]) by smtp.googlemail.com with ESMTPSA id c7-20020a5d4f07000000b00203db8f13c6sm12570791wru.75.2022.04.05.08.36.53 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 05 Apr 2022 08:36:53 -0700 (PDT) Message-ID: Date: Tue, 5 Apr 2022 17:36:52 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: [RFC PATCH v5 077/104] KVM: TDX: Use vcpu_to_pi_desc() uniformly in posted_intr.c Content-Language: en-US To: isaku.yamahata@intel.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: isaku.yamahata@gmail.com, Jim Mattson , erdemaktas@google.com, Connor Kuehl , Sean Christopherson References: From: Paolo Bonzini In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/4/22 20:49, isaku.yamahata@intel.com wrote: > From: Yuan Yao > > 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 > Signed-off-by: Isaku Yamahata > --- > 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