Received: by 2002:ab2:6c55:0:b0:1fd:c486:4f03 with SMTP id v21csp474070lqp; Wed, 12 Jun 2024 07:15:19 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVr2eJpLySmJ2F71cWG8U2WmmdVLe1kkXlS2g9ZYOK1YHGyIpMwB4x4U/LDREtFDnRvJqWtRPy2KGgTSnJYMhsd5Mg+HxkUgeogg6a3xQ== X-Google-Smtp-Source: AGHT+IEO0+04pDhrtdFguOzdm0mqmY8Ac/4E0romxzYDhdFnLvyqTiuvGM8xHpUic0cwMDwIkO3R X-Received: by 2002:a17:90a:5296:b0:2c3:a73:bb68 with SMTP id 98e67ed59e1d1-2c4a761b3femr2205413a91.9.1718201718982; Wed, 12 Jun 2024 07:15:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718201718; cv=pass; d=google.com; s=arc-20160816; b=k14+4gI+pgrSqMOJB3B7b1Afpk0k6+qRTpmmjnYvE/45wLFTF9WHPxr8yus6CVeZ/m VetvP/JL56ssPOYmlZHmR12eZOFVYmdxG81tn851dxS6JObVeujasnY6zmnRy7BErC9v nAOUBCDLrKFnabAUWKFTfFkS9uybYaEq9KM9s9ygaO/LdaMxUNuZJwhfVWV3EvJN/3zu sgjG5snYr6OUpRnjfc97bXxrVIHFNuBySR+8VWpj1IwULODaOgaz/KAZZWisE3+pKfpQ cZ7YtHSHzwCtIelP1blTyqLn3ki6pe+du6qTsP+6wnEwq7NnVVsIR7NVjb6+l7L1gwxT xLfw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date; bh=ExhTstdpB7DN78neYjOYsyFLbCXl77N5KOxA6kjCsPY=; fh=mNLtlBUAQwbm8Ky0f3Fsz0NyaF6cE13XumtBJ4ed7iQ=; b=M9mH6vrhEXFD2dcTTl+WSyZbZ4PnmfG3/EK7UBL+2YklbZzxG6gZ4cx+LpBjEilhfz 73G9smVeuBYnb7vFJAE7lR3CxCpZN7hUlMluu3Rpz8awnMAUHMyNx1AHHI3uNkTls5zD cQac3e/dyVrHKviGo9Yrp0VqbYtR2gcSkAZw5+H8ZOc1w04+RXzzB/7SOvNfh4eYFNiE udHarw3HTL+btWpF1KsYXQlts5PEw+rpTFyqkCZNGUFDqw9AXdvilVq2XGV379IAplz4 NgIGCTXW01n8j60qO4k11WYiTYkCORshZtkjAU8Mx4InEC8QY9ZbCA1PNByh5KMHY/a/ lI3g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-211628-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-211628-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2c4a61b5a00si1462881a91.1.2024.06.12.07.15.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 07:15:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-211628-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-211628-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-211628-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 55CABB26895 for ; Wed, 12 Jun 2024 14:01:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0C24417F362; Wed, 12 Jun 2024 13:58:40 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F00B517E914 for ; Wed, 12 Jun 2024 13:58:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718200719; cv=none; b=pa/9q+GxRgod+it9kl3RdSbDacDZRlNr52N8OG5PK3SdPPX4sS6aPLyJgNTu7EtyZXt38ifhhyB3c67VPxPDfiw7gH3FfPOYR9Q0jUCUa13Oajcq+4spu/3zipfXC2EnoXNkqEEdsI3h3a/HJsTAt1+yEK+aG+w4brmnVJV1Rfk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718200719; c=relaxed/simple; bh=Gy/lm/jdUpZeiX3Bu0wEuYgsJ1o06Dcw4DdUBsQN11Y=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=NDGBgHCCtkCHVijEmDPKRffOyall1XniA/OqBfdHlZV9Vybf6PgmwFiGtbEWXKDrcX64IG24DW/Bitx0tjJmDaiUc0iKAUo7nMnEH2dE1M4JzA402lR36K3dPNlNxLLAOMRbJ8v36WNy596xgXQXfFl8Jm+6wJPkAaYo+6YULK0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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> 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