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 BE0ADC27C53 for ; Wed, 12 Jun 2024 13:58:57 +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-Transfer-Encoding:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ExhTstdpB7DN78neYjOYsyFLbCXl77N5KOxA6kjCsPY=; b=D+hvutZVcQ+8Nyk66wyyHpDQ2I 6A7RelYENXPpcujs91XdrZ7WLgk6IV6h1wD9qkvb0yGB9+RUBqLkEgBnitUWBtTS5Gw2qpecx6o8D Djbrftofo49QxaYfIjZ3B7DqYvGtHI5+i9YBP96p8gsqzn56kQxRgutkvMxC02jxjJwfxrEijNWPn B/ik2YJmiRBOFPKWwLt6RkH69dBxN2YINbfn8Ale0+pslxbDDZnR/MXRozimQtMjOfMGGosCAzh0P NzzXw4Iq+4RakKgBGJ1XN8nmSi0RmMjPeMk1Z+MLw+VRtCSbQxsc9bv46T6smcHBmlQ8JesPD5dEZ DZfy4TyQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHOUr-0000000CrQT-46lL; Wed, 12 Jun 2024 13:58:41 +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 1sHOUo-0000000CrPG-0bVj for linux-arm-kernel@lists.infradead.org; Wed, 12 Jun 2024 13:58:39 +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 F14BB367; Wed, 12 Jun 2024 06:59:01 -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 4678F3F64C; Wed, 12 Jun 2024 06:58:35 -0700 (PDT) Date: Wed, 12 Jun 2024 14:58:31 +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 1/4] KVM: arm64: Trap FFA_VERSION host call in pKVM Message-ID: References: <20240515172258.1680881-1-sebastianene@google.com> <20240515172258.1680881-2-sebastianene@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20240515172258.1680881-2-sebastianene@google.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240612_065838_246600_5172270A X-CRM114-Status: GOOD ( 20.94 ) 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:55PM +0000, Sebastian Ene wrote: > The pKVM hypervisor initializes with FF-A version 1.0. The spec requires > that no other FF-A calls to be issued before the version negotiation > phase is complete. Split the hypervisor proxy initialization code in two > parts so that we can move the later one after the host negotiates its > version. Blank line here would be nice. > Without trapping the call, the host drivers can negotiate a higher > version number with TEE which can result in a different memory layout > described during the memory sharing calls. > LGTM(apart from minor nits), Reviewed-by: Sudeep Holla > Signed-off-by: Sebastian Ene > --- > arch/arm64/kvm/hyp/nvhe/ffa.c | 123 +++++++++++++++++++++++++--------- > 1 file changed, 92 insertions(+), 31 deletions(-) > > diff --git a/arch/arm64/kvm/hyp/nvhe/ffa.c b/arch/arm64/kvm/hyp/nvhe/ffa.c > index 320f2eaa14a9..72f1206c85fb 100644 > --- a/arch/arm64/kvm/hyp/nvhe/ffa.c > +++ b/arch/arm64/kvm/hyp/nvhe/ffa.c > @@ -1,4 +1,5 @@ > // SPDX-License-Identifier: GPL-2.0-only > +// It should be OK but still spurious for $subject 😉 [...] > @@ -700,7 +789,6 @@ bool kvm_host_ffa_handler(struct kvm_cpu_context *host_ctxt, u32 func_id) > int hyp_ffa_init(void *pages) > { > struct arm_smccc_res res; > - size_t min_rxtx_sz; > void *tx, *rx; > > if (kvm_host_psci_config.smccc_version < ARM_SMCCC_VERSION_1_2) > @@ -726,35 +814,7 @@ int hyp_ffa_init(void *pages) > if (FFA_MAJOR_VERSION(res.a0) != 1) > return -EOPNOTSUPP; > > - arm_smccc_1_1_smc(FFA_ID_GET, 0, 0, 0, 0, 0, 0, 0, &res); > - if (res.a0 != FFA_SUCCESS) > - return -EOPNOTSUPP; > - > - if (res.a2 != HOST_FFA_ID) > - return -EINVAL; > - > - arm_smccc_1_1_smc(FFA_FEATURES, FFA_FN64_RXTX_MAP, > - 0, 0, 0, 0, 0, 0, &res); > - if (res.a0 != FFA_SUCCESS) > - return -EOPNOTSUPP; > - > - switch (res.a2) { > - case FFA_FEAT_RXTX_MIN_SZ_4K: > - min_rxtx_sz = SZ_4K; > - break; > - case FFA_FEAT_RXTX_MIN_SZ_16K: > - min_rxtx_sz = SZ_16K; > - break; > - case FFA_FEAT_RXTX_MIN_SZ_64K: > - min_rxtx_sz = SZ_64K; > - break; > - default: > - return -EINVAL; > - } > - > - if (min_rxtx_sz > PAGE_SIZE) > - return -EOPNOTSUPP; > - > + hyp_ffa_version = FFA_VERSION_1_0; > tx = pages; > pages += KVM_FFA_MBOX_NR_PAGES * PAGE_SIZE; > rx = pages; > @@ -773,8 +833,9 @@ int hyp_ffa_init(void *pages) > }; > > host_buffers = (struct kvm_ffa_buffers) { > - .lock = __HYP_SPIN_LOCK_UNLOCKED, > + .lock = __HYP_SPIN_LOCK_UNLOCKED, Spurious or intentional whitespace change ? I can't make out from the mail. -- Regards, Sudeep