From nobody Mon Dec 15 21:24:45 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 88AF81E9B28; Sat, 19 Jul 2025 02:11:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752891114; cv=none; b=Igs/zKLvM6jZOURLmsBcCNZD6EkjWCXPb6xem5fcev7784+b75U34jdB9B/07sDuxQdqKPs+9wBS4QwKt8dJUtQLhrMUk32sv7tNO8iaTMKed5xG51XvovdcMTJZR4tSIgDED8/KFQSCOAApps4BIyyOSCNOSMpr2BPfA8MZOW4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752891114; c=relaxed/simple; bh=pL2iiryt41F/60ONkgpcLd+A0vFpoBJsL1JAkyL26QQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=MF1JY+4x0PtQgnJZ2JbexYvqrTZ34Igv1K2Mta4nVWAkzbHPZEc4TMXZaMWERnhlwDjt7OdPx1ACZenviM3lW7IYJ2Xd2i4WVPnzgdgUvDlhRFI03h10T55WQSFtemhCjiMJdjuUiL/u4gxte4KTs0oqxA+fWEYF4ItkpWNrsrE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=jONw8ShQ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="jONw8ShQ" Received: by smtp.kernel.org (Postfix) with ESMTPS id ECDF7C113D0; Sat, 19 Jul 2025 02:11:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1752891114; bh=pL2iiryt41F/60ONkgpcLd+A0vFpoBJsL1JAkyL26QQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=jONw8ShQFNBkFOyuawi/6n4Bjna8VUgy5C+QgBOUvC0NH5PxU74lrT58uF1cUcU6P Per+e9Ujy6WCwjTvzzRaMK5/10cISSE78d9SJpJiGz2up7GDDaM01kW3JYVIGNN+GI K1FXKhgDFOlcGKSB6qdE2RRYSvwfpr+aeHCbyBElqdY1mRK0azf8DArvaQ3A75yqvu 5zmvMgGB3s3nJxCV77pIbjlaA5/IeSactV/xNvx3zp/4wLvAkxmT4+oOkjeYLbCs05 rA7tWrPP6DL9QsRRz3o5PVwW5UXQZ3BQ323bLviVrotMWCoiv2QIlZA0mFk12cRf74 P5DrPYscAhZaA== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id E4E0AC83F3E; Sat, 19 Jul 2025 02:11:53 +0000 (UTC) From: Per Larsen via B4 Relay Date: Sat, 19 Jul 2025 02:11:29 +0000 Subject: [PATCH v8 7/7] KVM: arm64: Support FFA_MSG_SEND_DIRECT_REQ2 in host handler 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-Transfer-Encoding: quoted-printable Message-Id: <20250719-virtio-msg-ffa-v8-7-03e8e8dbe856@google.com> References: <20250719-virtio-msg-ffa-v8-0-03e8e8dbe856@google.com> In-Reply-To: <20250719-virtio-msg-ffa-v8-0-03e8e8dbe856@google.com> To: Marc Zyngier , Oliver Upton , Joey Gouly , Suzuki K Poulose , Zenghui Yu , Catalin Marinas , Will Deacon , Sudeep Holla Cc: 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, Per Larsen X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1752891112; l=1826; i=perlarsen@google.com; s=20250508; h=from:subject:message-id; bh=XKLIrLx+xVZkKFUyrkWFNAg3jN3LAX8G3drs7Zg0LpU=; b=bAFm8MojrTV0HWjRNrhEW7+sivMya8UgN2MnWTQD8h9xbMw8WrO+9bYJ7E6lzG9tF2K5n+Xux wriZLkODV0ZDCFwoyKRat6h5JRoPq6c1NwRiFbJwu04nzWiREVYMTbv X-Developer-Key: i=perlarsen@google.com; a=ed25519; pk=jjc/Ta4VmrLRmMoahP6d1mBcKzvWU+nsmdtYe2oS2kQ= X-Endpoint-Received: by B4 Relay for perlarsen@google.com/20250508 with auth_id=402 X-Original-From: Per Larsen Reply-To: perlarsen@google.com From: Per Larsen FF-A 1.2 adds the DIRECT_REQ2 messaging interface which is similar to the existing FFA_MSG_SEND_DIRECT_{REQ,RESP} functions except that it uses the SMC calling convention v1.2 which allows calls to use x4-x17 as argument and return registers. Add support for FFA_MSG_SEND_DIRECT_REQ2 in the host ffa handler. Signed-off-by: Per Larsen --- arch/arm64/kvm/hyp/nvhe/ffa.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/arch/arm64/kvm/hyp/nvhe/ffa.c b/arch/arm64/kvm/hyp/nvhe/ffa.c index f6d964df53c3e21ba85984f35cc7b6859012d1b0..363374408b354a5d65861b9cf14= 0974d8914ff40 100644 --- a/arch/arm64/kvm/hyp/nvhe/ffa.c +++ b/arch/arm64/kvm/hyp/nvhe/ffa.c @@ -851,6 +851,15 @@ static void do_ffa_part_get(struct arm_smccc_1_2_regs = *res, hyp_spin_unlock(&host_buffers.lock); } =20 +static void do_ffa_direct_msg2(struct arm_smccc_1_2_regs *regs, + struct kvm_cpu_context *ctxt, + u64 vm_handle) +{ + struct arm_smccc_1_2_regs *args =3D (void *)&ctxt->regs.regs[0]; + + arm_smccc_1_2_smc(args, regs); +} + bool kvm_host_ffa_handler(struct kvm_cpu_context *host_ctxt, u32 func_id) { struct arm_smccc_1_2_regs res; @@ -909,11 +918,18 @@ bool kvm_host_ffa_handler(struct kvm_cpu_context *hos= t_ctxt, u32 func_id) case FFA_PARTITION_INFO_GET: do_ffa_part_get(&res, host_ctxt); goto out_handled; + case FFA_MSG_SEND_DIRECT_REQ2: + if (hyp_ffa_version >=3D FFA_VERSION_1_2) { + do_ffa_direct_msg2(&res, host_ctxt, HOST_FFA_ID); + goto out_handled; + } + goto out_not_supported; } =20 if (ffa_call_supported(func_id)) return false; /* Pass through */ =20 +out_not_supported: ffa_to_smccc_error(&res, FFA_RET_NOT_SUPPORTED); out_handled: ffa_set_retval(host_ctxt, &res); --=20 2.50.0.727.gbf7dc18ff4-goog