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 D8D2AC83F1A for ; Sat, 19 Jul 2025 02:24:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Reply-To:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To: References:Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version: Subject:Date:From:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=n8ulVJpBq5Jg1vGrNpSZ4hAtNhCAJkGLawvl3BSqxYk=; b=ZJFX6MfZRKcO+prS68dliuruwf nXuKIUGyGIqlKgLPWwheI28oDXpNxeFKfypVVMIQVR2b+FftRN61BTCcs7D1dOTT4s6bUUAs3sBhZ SwBk78Mdw63JLIbd0+nK1ruKXeWun3JPLygnaAOba0q0j1x+3DdbPZDovPuTCJbr6Salu3QECl6hn tTTm1stHdLl26syin2EoysVcqXwiwDRanfICDfKxX7iMowraOmgFIu7esEO81fJSl+iuJxRTQqVTW EXbt68k96DiX9XVb9ezoWlm07Xv5TJZD3ThW6WgxspbtscdODkOGEZWzHS7a1LFVQa2R3FeSKa1s7 g4T20F3Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1ucxFR-0000000DkIb-0PJL; Sat, 19 Jul 2025 02:24:25 +0000 Received: from sea.source.kernel.org ([172.234.252.31]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1ucx3L-0000000DjJS-11ya for linux-arm-kernel@lists.infradead.org; Sat, 19 Jul 2025 02:11:57 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id 40E7345F81; Sat, 19 Jul 2025 02:11:54 +0000 (UTC) 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 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250718_191155_332939_121F4F39 X-CRM114-Status: GOOD ( 11.72 ) 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: , Reply-To: perlarsen@google.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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..363374408b354a5d65861b9cf140974d8914ff40 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); } +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 = (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 *host_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 >= FFA_VERSION_1_2) { + do_ffa_direct_msg2(&res, host_ctxt, HOST_FFA_ID); + goto out_handled; + } + goto out_not_supported; } if (ffa_call_supported(func_id)) return false; /* Pass through */ +out_not_supported: ffa_to_smccc_error(&res, FFA_RET_NOT_SUPPORTED); out_handled: ffa_set_retval(host_ctxt, &res); -- 2.50.0.727.gbf7dc18ff4-goog