KVM: arm64: Support FF-A 1.2
From: | Per Larsen via B4 Relay <devnull+perlarsen.google.com-AT-kernel.org> | |
To: | Marc Zyngier <maz-AT-kernel.org>, Oliver Upton <oliver.upton-AT-linux.dev>, Joey Gouly <joey.gouly-AT-arm.com>, Suzuki K Poulose <suzuki.poulose-AT-arm.com>, Zenghui Yu <yuzenghui-AT-huawei.com>, Catalin Marinas <catalin.marinas-AT-arm.com>, Will Deacon <will-AT-kernel.org>, Sudeep Holla <sudeep.holla-AT-arm.com> | |
Subject: | [PATCH v9 0/6] KVM: arm64: Support FF-A 1.2 | |
Date: | Wed, 30 Jul 2025 21:15:03 +0000 | |
Message-ID: | <20250730-virtio-msg-ffa-v9-0-7f1b55c8d149@google.com> | |
Cc: | linux-arm-kernel-AT-lists.infradead.org, kvmarm-AT-lists.linux.dev, linux-kernel-AT-vger.kernel.org, ahomescu-AT-google.com, armellel-AT-google.com, arve-AT-android.com, ayrton-AT-google.com, qperret-AT-google.com, sebastianene-AT-google.com, qwandor-AT-google.com, Per Larsen <perlarsen-AT-google.com> | |
Archive-link: | Article |
Hi, The FF-A 1.2 specification introduces a new SEND_DIRECT2 ABI which allows registers x4-x17 to be used for the message payload. This patch set prevents the host from using a lower FF-A version than what has already been negotiated with the hypervisor. This is necessary because the hypervisor does not have the necessary compatibility paths to translate from the hypervisor FF-A version to a previous version. Support for FF-A 1.2 in the hypervisor is added as a precursor to the addition of the FFA_MSG_SEND_DIRECT_REQ2 messaging interface. Notably, this patch updates all smc calls to use SMCCC 1.2 as it makes it simpler to support interfaces that need to accept more than 8 arguments and/or return more than 4 values. The list of optional/unsupported interfaces was updated to reflect additions in FF-A 1.2. Tested by booting Android under QEMU and loading Trusty as the guest VM and observing the SEND_DIRECT2 ABI being used successfully during guest boot. Changes in v9: - 2/7 -> 2/6: Updated explanatory comment in ffa_set_retval - 4/7 -> 4/6: Restore to v7: Mark FFA_MSG_SEND_DIRECT_REQ2 unsupported - 5/7 -> 5/6: Added Acked-by: Will Deacon <will@kernel.org> - 6/7 -> 6/6: Added Acked-by: Will Deacon <will@kernel.org> - 7/7: Dropped - Link to v8: https://lore.kernel.org/r/20250719-virtio-msg-ffa-v8-0-03... Changes in v8: - 2/5 -> 2/7: Use func_id argument to distinguish SMC32/SMC64. Update rationale. - 4/5 -> 4/7: Split up 4/5: Add optional FF-A 1.2 interfaces - 4/5 -> 5/7: Split up 4/5: Mask FFA_RXTX_MAP minium buffer size in a2. Don't check MBZ bits. - 4/5 -> 6/7: Remainder of 4/5: Bump supported version to FF-A 1.2 - 5/5 -> 7/7: Don't check src id in do_ffa_direct_msg2 - Link to v7: https://lore.kernel.org/r/20250701-virtio-msg-ffa-v7-0-99... Changes in v7: - 0/6: Revised cover letter slightly - 4/6: ffa_call_supported: Clarify optional interfaces hyp_ffa_post_init: Sanitize MBZ bits in x2 and x3 address nit: use GENMASK - Link to v6: https://lore.kernel.org/r/20250627-virtio-msg-ffa-v6-0-8c... Changes since v5: - 3/6 -> 2/5: Merged with parent patch as they were closely related Don't rename variables from "res" to "regs" to avoid churn Update and clarify reasoning for condition added to ffa_set_retval Adopt style suggested by Marc when passing regs to arm_smccc_1_2_smc Fix inadvertent duplicate statements in ffa_{map,unmap}_hyp_buffers - Link to v5: https://lore.kernel.org/r/20250619-virtio-msg-ffa-v5-0-41... Changes since v4: - 1/5 -> 1/6: Added Acked-by: Will Deacon <will@kernel.org>y Reworded patch subject and description - 2/5: Dropped patch: zero x4-x7 in ffa_set_retval - 2/6: New: use SMCCC 1.2 during hyp init - 3/6: New: use SMCCC 1.2 in host FF-A handler - 3/5 -> 4/6: No change; can revisit denylist design in later patchset Added Acked-by: Will Deacon <will@kernel.org> - 4/5 -> 5/6: No change - 5/5 -> 6/6: No change - Link to v4: https://lore.kernel.org/r/20250516-virtio-msg-ffa-v4-0-58... Changes since v3: - all: Remove Signed-off-by: Per Larsen <perl@immunant.com> - 2/5: Split out from 2/3, zero x4-x7 in set_ffa_retval - 3/5: Split out from 2/3, Mark FFA_NOTIFICATION_* calls as unsupported - 2/3 -> 4/5: Drop ffa_get_hypervisor_version, access hyp_ffa_version directly when version negotiation is complete. - 3/3 -> 5/5: Call ffa_to_smccc_1_2_error directly in do_do_ffa_direct_msg2 Push call to ffa_call_needs_smccc_1_2 lower down by adding ffa_get_func_id and ffa_set_retval_smccc_1_x. Drop ffa_to_smccc_1_2_regs and ffa_to_smccc_1_2_regs_prop as they are no longer used. - Link to v3: https://lore.kernel.org/r/20250513-virtio-msg-ffa-v3-0-d6... Changes since v2: - 2/3: Removed files added by mistake. Add and use ffa_get_hypervisor_version to access hyp_ffa_version - 3/3: Use ffa_get_hypervisor_version to access hyp_ffa_version safely - Link to v2: https://lore.kernel.org/r/20250508-virtio-msg-ffa-v2-0-ed... Changes since v1: - 1/3: Simplify commit message; drop long comment in do_ffa_version - 2/3: Correct use of Co-developed-by: footer s/arm_smccc_1_2_smc_fallback/arm_smccc_1_x_smc/ Always access hyp_ffa_version w/lock held Remove superfluous comments in ffa_call_supported Add and use FFA_FEAT_RXTX_MIN_SZ_MASK instead of constant Add FFA_PARTITION_INFO_GET_REGS to calls that require SMCCC 1.2 - 3/3: Always access hyp_ffa_version w/lock held Correct formatting Thanks, Per Larsen -- 2.49.0 --- Per Larsen (6): KVM: arm64: Correct return value on host version downgrade attempt KVM: arm64: Use SMCCC 1.2 for FF-A initialization and in host handler KVM: arm64: Mark FFA_NOTIFICATION_* calls as unsupported KVM: arm64: Mark optional FF-A 1.2 interfaces as unsupported KVM: arm64: Mask response to FFA_FEATURE call KVM: arm64: Bump the supported version of FF-A to 1.2 arch/arm64/kvm/hyp/nvhe/Makefile | 1 + arch/arm64/kvm/hyp/nvhe/ffa.c | 215 ++++++++++++++++++++++++++------------- include/linux/arm_ffa.h | 1 + 3 files changed, 144 insertions(+), 73 deletions(-) --- base-commit: 4b290aae788e06561754b28c6842e4080957d3f7 change-id: 20250506-virtio-msg-ffa-22af72c92150 Best regards, -- Per Larsen <perlarsen@google.com>