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 84820C7EE39 for ; Mon, 30 Jun 2025 08:47:49 +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:Content-Type:MIME-Version: References:In-Reply-To:Subject:Cc:To:From:Message-ID: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=8tbwK0k6DJmR41K3v13GouVRXbWAQ4yLjni7AtbgcyM=; b=mcx5IcbZYE/k0J5amVdzbl97Co j6wvojktQaWudvTJAfIR9iJvGCR0gWaCmtBC5OREwDW88zCZ+8NgBAzjL2ORAqMeMPgmfmsD0y1AU 0g/ntppJemZDpQAEyHdTkG/I0I7YNjENpTsbI/kVdAzJPb5GoAbg8j8tBlyIchtzhrPM14fZe/dli sPdg38AogFM5zxryHkrx2eblgbpaosAVwl1CsV60Rgr1Ili6mQqy4a8Jajb3nhGBf0P0unx8DRt48 eYgirTS7T5bHvjYY7UYRm2uAt+ec/Wrud6g58pfx7o2ro7ybr8IJ/J0Ax/titcLPVqiew/olNT2bK EN0ZGUxg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1uWAAw-00000001ebs-2NSU; Mon, 30 Jun 2025 08:47:42 +0000 Received: from sea.source.kernel.org ([2600:3c0a:e001:78e:0:1991:8:25]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1uWA4f-00000001dru-3EFw for linux-arm-kernel@lists.infradead.org; Mon, 30 Jun 2025 08:41:14 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id 98271456EA; Mon, 30 Jun 2025 08:41:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 76628C4CEE3; Mon, 30 Jun 2025 08:41:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1751272872; bh=GFMcwvHqQu6q6QWAz3DVJhxBQG7XyQqTZN85s49tnbM=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=KL7Yk92jmI3hWHySdadSShj47zKUAdMNPSUGdu2mkgve36nntPf/tIItn35WCiToj mkxK8IlWKNdJ8MI6c2tiWDVH2xBLQ3Po/tavIuI9wrtRQhoKcX4jugguxQHQllTPCG Ud5a+t6f8vc/c6hEoz/Etsr1AjnSUIyI1ig9/YdGC9fXlPA6wd7WUZt0ubqwBCPgJv poiyTWz4ZUKSPc/KCCFPJpYI/isYOgzxeK0SXXd0iDUvzvF4ZCNS05pdVO413d4H48 IGIghQKT9rdsXBiyFonw6/xuJWAwVxftVCac0nerVfNNCoIY+msxttFbptSFSpSSv6 mYuSaupDO0ysQ== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1uWA4c-00B9a3-5l; Mon, 30 Jun 2025 09:41:10 +0100 Date: Mon, 30 Jun 2025 09:41:09 +0100 Message-ID: <86ldp9bp0a.wl-maz@kernel.org> From: Marc Zyngier To: perlarsen@google.com Cc: Oliver Upton , Joey Gouly , Suzuki K Poulose , Zenghui Yu , Catalin Marinas , Will Deacon , Sudeep Holla , linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org, ahomescu@google.com, armellel@google.com, arve@android.com, ayrton@google.com, qperret@google.com, sebastianene@google.com, qwandor@google.com Subject: Re: [PATCH v6 4/5] KVM: arm64: Bump the supported version of FF-A to 1.2 In-Reply-To: <20250627-virtio-msg-ffa-v6-4-8c02fd94edac@google.com> References: <20250627-virtio-msg-ffa-v6-0-8c02fd94edac@google.com> <20250627-virtio-msg-ffa-v6-4-8c02fd94edac@google.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/30.1 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: perlarsen@google.com, oliver.upton@linux.dev, joey.gouly@arm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, catalin.marinas@arm.com, will@kernel.org, sudeep.holla@arm.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org, ahomescu@google.com, armellel@google.com, arve@android.com, ayrton@google.com, qperret@google.com, sebastianene@google.com, qwandor@google.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250630_014113_845052_A384AA23 X-CRM114-Status: GOOD ( 26.55 ) 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 Fri, 27 Jun 2025 08:12:28 +0100, Per Larsen via B4 Relay wrote: > > From: Per Larsen > > FF-A version 1.2 introduces the DIRECT_REQ2 ABI. Bump the FF-A version > preferred by the hypervisor as a precursor to implementing the 1.2-only > FFA_MSG_SEND_DIRECT_REQ2 and FFA_MSG_SEND_RESP2 messaging interfaces. > > We must also use SMCCC 1.2 for 64-bit SMCs if hypervisor negotiated FF-A > 1.2, so ffa_set_retval is updated and a new function to call 64-bit smcs > using SMCCC 1.2 with fallback to SMCCC 1.1 is introduced. > > Update ffa_call_supported to mark FF-A 1.2 interfaces as unsupported > lest they get forwarded. > > Co-developed-by: Ayrton Munoz > Signed-off-by: Ayrton Munoz > Signed-off-by: Per Larsen > --- > arch/arm64/kvm/hyp/nvhe/ffa.c | 14 ++++++++++---- > include/linux/arm_ffa.h | 1 + > 2 files changed, 11 insertions(+), 4 deletions(-) > > diff --git a/arch/arm64/kvm/hyp/nvhe/ffa.c b/arch/arm64/kvm/hyp/nvhe/ffa.c > index 5fd6474d96ae4b90d99796ee81bb36373219afc4..d543d1f5ddd62fb15f8d39f4ff7d5bb0006da4a1 100644 > --- a/arch/arm64/kvm/hyp/nvhe/ffa.c > +++ b/arch/arm64/kvm/hyp/nvhe/ffa.c > @@ -678,6 +678,12 @@ static bool ffa_call_supported(u64 func_id) > case FFA_NOTIFICATION_SET: > case FFA_NOTIFICATION_GET: > case FFA_NOTIFICATION_INFO_GET: > + /* Unimplemented interfaces added in FF-A 1.2 */ > + case FFA_MSG_SEND_DIRECT_REQ2: > + case FFA_MSG_SEND_DIRECT_RESP2: Are those actually optional? > + case FFA_CONSOLE_LOG: > + case FFA_PARTITION_INFO_GET_REGS: > + case FFA_EL3_INTR_HANDLE: > return false; > } > > @@ -734,7 +740,7 @@ static int hyp_ffa_post_init(void) > if (res.a0 != FFA_SUCCESS) > return -EOPNOTSUPP; > > - switch (res.a2) { > + switch (res.a2 & FFA_FEAT_RXTX_MIN_SZ_MASK) { You should also check that the MBZ fields are still 0. Ideally, you'd also do that with x3. > case FFA_FEAT_RXTX_MIN_SZ_4K: > min_rxtx_sz = SZ_4K; > break; > @@ -931,7 +937,7 @@ int hyp_ffa_init(void *pages) > > arm_smccc_1_2_smc(&(struct arm_smccc_1_2_regs) { > .a0 = FFA_VERSION, > - .a1 = FFA_VERSION_1_1, > + .a1 = FFA_VERSION_1_2, > }, &res); > if (res.a0 == FFA_RET_NOT_SUPPORTED) > return 0; > @@ -952,10 +958,10 @@ int hyp_ffa_init(void *pages) > if (FFA_MAJOR_VERSION(res.a0) != 1) > return -EOPNOTSUPP; > > - if (FFA_MINOR_VERSION(res.a0) < FFA_MINOR_VERSION(FFA_VERSION_1_1)) > + if (FFA_MINOR_VERSION(res.a0) < FFA_MINOR_VERSION(FFA_VERSION_1_2)) > hyp_ffa_version = res.a0; > else > - hyp_ffa_version = FFA_VERSION_1_1; > + hyp_ffa_version = FFA_VERSION_1_2; > > tx = pages; > pages += KVM_FFA_MBOX_NR_PAGES * PAGE_SIZE; > diff --git a/include/linux/arm_ffa.h b/include/linux/arm_ffa.h > index 5bded24dc24fea8cdcbe42bf79c7c025c3fa5f4b..c0dd6183d956043192114a522b7eef465e7078ac 100644 > --- a/include/linux/arm_ffa.h > +++ b/include/linux/arm_ffa.h > @@ -128,6 +128,7 @@ > #define FFA_FEAT_RXTX_MIN_SZ_4K 0 > #define FFA_FEAT_RXTX_MIN_SZ_64K 1 > #define FFA_FEAT_RXTX_MIN_SZ_16K 2 > +#define FFA_FEAT_RXTX_MIN_SZ_MASK 3 nit: a mask is better expressed with GENMASK, making it obvious that this is not just another value. Thanks, M. -- Without deviation from the norm, progress is not possible.