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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id ED0C9C27C53 for ; Wed, 12 Jun 2024 14:41:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=kaBmPudk580EP9xyXZfNlsN09D/T17wf589qrjvYBW4=; b=F0TVoCPCmHq821O6VzWAMMpPf3 CAypRHjh1Z2ZimvrubgtUfZ7OYbYH/G3NJkkpWbGtm5a2cLxs7VNcHHTr/zuSl02GMdEQGhXY6yn+ eE199i6FYtZ7ez8MrESb0wxukm1dKPnI371RzO4xkozRt1kkeTnNyxyP+yQPljQdcpLWLGJ65qmdw y/iUAY4Dx/S3AywI2/MD8YmjPo3oQfsGTnl8BFF4e0m3keQqeLIFVOOhHl67qKeMXtPdWJGMSUCg4 o9pPDrC5LsTWlrn1Pkt0hHVXsCPogzZ4WFZFLdrSlXVBYSxyBOzJD0d6/sTXoKVA+ijfN5MlkRpIV IdvyX+8Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHPAW-0000000CzHz-1xul; Wed, 12 Jun 2024 14:41:44 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHPAT-0000000CzGF-2x7Q for linux-arm-kernel@lists.infradead.org; Wed, 12 Jun 2024 14:41:43 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id CB28F1042; Wed, 12 Jun 2024 07:42:02 -0700 (PDT) Received: from bogus (e103737-lin.cambridge.arm.com [10.1.197.49]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id CEDD13F64C; Wed, 12 Jun 2024 07:41:35 -0700 (PDT) Date: Wed, 12 Jun 2024 15:41:32 +0100 From: Sudeep Holla To: Sebastian Ene Cc: catalin.marinas@arm.com, james.morse@arm.com, jean-philippe@linaro.org, Sudeep Holla , maz@kernel.org, oliver.upton@linux.dev, qperret@google.com, qwandor@google.com, suzuki.poulose@arm.com, tabba@google.com, will@kernel.org, yuzenghui@huawei.com, lpieralisi@kernel.org, kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kernel-team@android.com Subject: Re: [PATCH v2 4/4] KVM: arm64: Use FF-A 1.1 with pKVM Message-ID: References: <20240515172258.1680881-1-sebastianene@google.com> <20240515172258.1680881-5-sebastianene@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240515172258.1680881-5-sebastianene@google.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240612_074141_821047_802FB270 X-CRM114-Status: GOOD ( 19.58 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, May 15, 2024 at 05:22:58PM +0000, Sebastian Ene wrote: > Now that the layout of the structures is compatible with 1.1 it is time > to probe the 1.1 version of the FF-A protocol inside the hypervisor. If > the TEE doesn't support it, it should return the minimum supported > version. > LGTM, Reviewed-by: Sudeep Holla > Signed-off-by: Sebastian Ene > --- > arch/arm64/kvm/hyp/nvhe/ffa.c | 12 ++++++++---- > 1 file changed, 8 insertions(+), 4 deletions(-) > > diff --git a/arch/arm64/kvm/hyp/nvhe/ffa.c b/arch/arm64/kvm/hyp/nvhe/ffa.c > index f9664c4a348e..bdd70eb4114e 100644 > --- a/arch/arm64/kvm/hyp/nvhe/ffa.c > +++ b/arch/arm64/kvm/hyp/nvhe/ffa.c > @@ -458,7 +458,7 @@ static __always_inline void do_ffa_mem_xfer(const u64 func_id, > memcpy(buf, host_buffers.tx, fraglen); > > ep_mem_access = (void *)buf + > - ffa_mem_desc_offset(buf, 0, FFA_VERSION_1_0); > + ffa_mem_desc_offset(buf, 0, hyp_ffa_version); > offset = ep_mem_access->composite_off; > if (!offset || buf->ep_count != 1 || buf->sender_id != HOST_FFA_ID) { > ret = FFA_RET_INVALID_PARAMETERS; > @@ -537,7 +537,7 @@ static void do_ffa_mem_reclaim(struct arm_smccc_res *res, > fraglen = res->a2; > > ep_mem_access = (void *)buf + > - ffa_mem_desc_offset(buf, 0, FFA_VERSION_1_0); > + ffa_mem_desc_offset(buf, 0, hyp_ffa_version); > offset = ep_mem_access->composite_off; > /* > * We can trust the SPMD to get this right, but let's at least > @@ -846,7 +846,7 @@ int hyp_ffa_init(void *pages) > if (kvm_host_psci_config.smccc_version < ARM_SMCCC_VERSION_1_2) > return 0; > > - arm_smccc_1_1_smc(FFA_VERSION, FFA_VERSION_1_0, 0, 0, 0, 0, 0, 0, &res); > + arm_smccc_1_1_smc(FFA_VERSION, FFA_VERSION_1_1, 0, 0, 0, 0, 0, 0, &res); > if (res.a0 == FFA_RET_NOT_SUPPORTED) > return 0; > > @@ -866,7 +866,11 @@ int hyp_ffa_init(void *pages) > if (FFA_MAJOR_VERSION(res.a0) != 1) > return -EOPNOTSUPP; > > - hyp_ffa_version = FFA_VERSION_1_0; > + if (FFA_MINOR_VERSION(res.a0) < FFA_MINOR_VERSION(FFA_VERSION_1_1)) It can be even <= instead of <, in that way else part is just handling downgrading part and will be explicit. But that's just my taste and not a must change as nothing changes with or without it. -- Regards, Sudeep