Received: by 2002:ab2:6c55:0:b0:1fd:c486:4f03 with SMTP id v21csp491668lqp; Wed, 12 Jun 2024 07:41:45 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUyGpJm7yyKc5T7Fhk2iSMChwBLiXRBR6rSKztJgttDCMxv/1OZmz3h9f8bIGj5r04aoNOPjrkvy7cwGoA7vRYaz/I0QtLx908kWLhCzQ== X-Google-Smtp-Source: AGHT+IFeRShagw4NIITN3qYXPrdiyWHjoEkXlbA5LQfInzo2rXpyA5NLRjIhgwVD4q6vcleu8X7N X-Received: by 2002:a9d:5611:0:b0:6f9:41f6:c7e with SMTP id 46e09a7af769-6fa1bf54ce3mr2067282a34.1.1718203304901; Wed, 12 Jun 2024 07:41:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718203304; cv=pass; d=google.com; s=arc-20160816; b=HFzXO/IxEDn1EWqBaFJRphvWOEPEGtTMBj+SPVmLkDtiQMYR/Bxn9E/TAzyLUSNPSa Lw/CT5g2x1m8RK48CqnPuy/2IaQqSfPvBiN3I0elS2seO2KBLRyDKXdEo4ooRo+QsneQ /tRXbmwC5Jdh6NmjRngorxMeNhcqbxgBB83hU/LRtKCuhuFQGaVszUfM0yyCZJGw6WE+ CGic3ZfCnNv5JVakF3s2FxTY2pfZHJKtG6ls6bNHhD3Ylntu4rt/bd9Aaf/3li0K1uY2 ja3U5i1EwhlhBX5i2kETu/zS5USYOiUmvYR9xXcGsQTDvUEYfQ4wpXV4L9xwLVr9PNXH 46vw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date; bh=kaBmPudk580EP9xyXZfNlsN09D/T17wf589qrjvYBW4=; fh=mNLtlBUAQwbm8Ky0f3Fsz0NyaF6cE13XumtBJ4ed7iQ=; b=UKuiFrCHT7nyWbGIErGpEbt46SguVSK4/g+a2F2En8ISk6AIeN1ORebfzNn7ufgvjJ DJ1RROF+t1ZrurFzRiIysmQWchkvCwOBoWNDuEFjaPrHwDGYixyp9HObAS6wyFYUlo4B lJdJ3+1XXEmDy42mudZ9Ia2OARtPGk/DtEWOpMYXKy3v+te36gCx/tutMTvqDGdi5fWF 6doHks3E8p5MX8Nf2fqxLJMxXShsqe9vdvqgYMa7Xkd5BNzjyI8/QbLyNzKV9GvN8TH3 A6f+pD8JhgR7/T2NiRdAz7N+7C6f1s5QSlw834QMiKQAUdiLE42IPA9Hhl17hR4hA8wJ 9ngA==; 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-211689-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-211689-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id af79cd13be357-797b55d1772si486261485a.525.2024.06.12.07.41.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 07:41:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-211689-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; 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-211689-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-211689-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 67E461C21263 for ; Wed, 12 Jun 2024 14:41:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CAC1317E8E9; Wed, 12 Jun 2024 14:41:40 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 015FD17DE39 for ; Wed, 12 Jun 2024 14:41:38 +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=1718203300; cv=none; b=Lc7A4yPjvK6/S7i4s0QR+z7EEevh45vBqb7VYQhnmB+4jQQC4flAaxeUwLVnSG75wfdKiPxkcZuzESnTYXUzG460QSvtwD261jXLoYlC837jCP+hKBVJK2tigQ75wLI5WqpOYJrGPE9PxV+FdS9RsnMea4qy1lOxEweoA9q46Pw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718203300; c=relaxed/simple; bh=0siUzEVkYXXUYW3iE3IsxxtbWBH7AuYEgUlIWET3Ocg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=L4jUL1C9gPJ1xgvbAsz6dGyQZVc1Ik09zjRf62Nbt1o2TZ2SuJTgNS/r5bHKMIfESAbGRI72Q9JNWBeUuTm9XkKtyalENidBy/Z+ctN2gcBwnn9fsizPfjnhFIZ+s8NpoX/Bum1+1Qwemi29Sk6fiLNAC/Jdoyi6ETttVDfIW8M= 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 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> 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=us-ascii Content-Disposition: inline In-Reply-To: <20240515172258.1680881-5-sebastianene@google.com> 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