[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20250619-virtio-msg-ffa-v5-5-412c98558807@google.com>
Date: Thu, 19 Jun 2025 09:02:58 +0000
From: Per Larsen via B4 Relay <devnull+perlarsen.google.com@...nel.org>
To: Marc Zyngier <maz@...nel.org>, Oliver Upton <oliver.upton@...ux.dev>,
Joey Gouly <joey.gouly@....com>, Suzuki K Poulose <suzuki.poulose@....com>,
Zenghui Yu <yuzenghui@...wei.com>,
Catalin Marinas <catalin.marinas@....com>, Will Deacon <will@...nel.org>,
Sudeep Holla <sudeep.holla@....com>
Cc: linux-arm-kernel@...ts.infradead.org, kvmarm@...ts.linux.dev,
linux-kernel@...r.kernel.org, Ayrton Munoz <ayrton@...gle.com>,
Per Larsen <perlarsen@...gle.com>
Subject: [PATCH v5 5/6] KVM: arm64: Bump the supported version of FF-A to
1.2
From: Per Larsen <perlarsen@...gle.com>
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 <ayrton@...gle.com>
Signed-off-by: Ayrton Munoz <ayrton@...gle.com>
Signed-off-by: Per Larsen <perlarsen@...gle.com>
---
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 6965aa947fb4529c35872ee3976ab8d0b02becca..7b43279aded7d7ef4cce2c294d208c5a66b684e3 100644
--- a/arch/arm64/kvm/hyp/nvhe/ffa.c
+++ b/arch/arm64/kvm/hyp/nvhe/ffa.c
@@ -677,6 +677,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:
+ 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 (regs.a0 != FFA_SUCCESS)
return -EOPNOTSUPP;
- switch (regs.a2) {
+ switch (regs.a2 & FFA_FEAT_RXTX_MIN_SZ_MASK) {
case FFA_FEAT_RXTX_MIN_SZ_4K:
min_rxtx_sz = SZ_4K;
break;
@@ -933,7 +939,7 @@ int hyp_ffa_init(void *pages)
regs = (struct arm_smccc_1_2_regs) {
.a0 = FFA_VERSION,
- .a1 = FFA_VERSION_1_1,
+ .a1 = FFA_VERSION_1_2,
};
arm_smccc_1_2_smc(®s, ®s);
if (regs.a0 == FFA_RET_NOT_SUPPORTED)
@@ -955,10 +961,10 @@ int hyp_ffa_init(void *pages)
if (FFA_MAJOR_VERSION(regs.a0) != 1)
return -EOPNOTSUPP;
- if (FFA_MINOR_VERSION(regs.a0) < FFA_MINOR_VERSION(FFA_VERSION_1_1))
+ if (FFA_MINOR_VERSION(regs.a0) < FFA_MINOR_VERSION(FFA_VERSION_1_2))
hyp_ffa_version = regs.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
/* FFA Bus/Device/Driver related */
struct ffa_device {
--
2.50.0.rc2.701.gf1e915cc24-goog
Powered by blists - more mailing lists