From patchwork Thu Oct 5 14:44:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 13410161 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 AD8F6E92705 for ; Thu, 5 Oct 2023 14:45:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:In-Reply-To:References:Message-Id: MIME-Version:Subject:Date:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=veC2vdQapp2/JEk0ay557Q9y69CECkkpJwOwnWTJdm8=; b=tDsP9QbnGnoHdm qBYdBjqCVZlysCwyrI9Qo2eReRLYorNFtT7eUdCdjlGNSquc7TB+QI6ar1Yv8pvnQOrEahIVLjGgp C4kOjpxsHJDczIa2hRnarP7d+GF+9Co+AEpjSP+RSKpxNT6/aeygQrYWAP5c4MBh0NA7I6zA2qji8 WrkXBvLOCFgAEYOFqac4jA1hsaJ/2Nl3vji4bzloYhaBb5bxFF+kjXTZCObA/xX6aVRrJx3DZ+kfe 5XCP+Ln++/9BvnACcAFuH9P5OTRIjt660MV1HUpeRwN71pLlpQCPR8aQOIqT3IUc1WkRw/a/IZRGc S1IsDU6lEbG+BgnIbqNw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qoPbO-003leX-2L; Thu, 05 Oct 2023 14:45:22 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qoPbJ-003lbX-0F for linux-arm-kernel@lists.infradead.org; Thu, 05 Oct 2023 14:45:20 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 86B101516; Thu, 5 Oct 2023 07:45:53 -0700 (PDT) Received: from e103737-lin.cambridge.arm.com (e103737-lin.cambridge.arm.com [10.1.197.49]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D0B8D3F641; Thu, 5 Oct 2023 07:45:13 -0700 (PDT) From: Sudeep Holla Date: Thu, 05 Oct 2023 15:44:58 +0100 Subject: [PATCH v4 05/17] firmware: arm_ffa: Implement the FFA_NOTIFICATION_SET interface MIME-Version: 1.0 Message-Id: <20231005-ffa_v1-1_notif-v4-5-cddd3237809c@arm.com> References: <20231005-ffa_v1-1_notif-v4-0-cddd3237809c@arm.com> In-Reply-To: <20231005-ffa_v1-1_notif-v4-0-cddd3237809c@arm.com> To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Sudeep Holla , Marc Bonnici , Jens Wiklander , Coboy Chen , Lorenzo Pieralisi , Olivier Deprez X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=1504; i=sudeep.holla@arm.com; h=from:subject:message-id; bh=4q7IiagFj1+jcbEerM+tVmHVjhNoYEy9g+TfTOniWJY=; b=owEBbQKS/ZANAwAIAQBBurwxfuKYAcsmYgBlHsvxU+OC43JQZl2rh/aQ5hxCbL/2rnY6mISRn pGTv/huwB2JAjMEAAEIAB0WIQS6ceUSBvMeskPdk+EAQbq8MX7imAUCZR7L8QAKCRAAQbq8MX7i mONFD/91SNwLzgvbqoev7AcemtwFwEIcUq5ymafJb0GYsSNhSIHyE2Fc0QDnD5JgTQvF8Ww7bCa MyrtPbAxmPj+VkfD75JZmgXC7v0nVPjZ69uR+7D2kP2PxNOFiz2q0HCYkpTe6MumZGA4a+xWlrW il9Rc3Ylp2GYlRp/k4nA+JIhTSoqlqo4p+2Mzr52ESdNQrMyqiPIXM+qjcL13Tlb922K0ZfoNJd ElfDaqGRnnn/6yMZGzItAbsp3BnOXpjZtv4s1ogVe9+P+5RCwTGSrx4J1LM2lD71mQKB2ibjp2R OmErG7UrdKtHSNkfII9fiAffYeIJ++KnBX/1KWzpoRS7ssxnSy42bsi1DxKYUrbuTKLHC3brOxw 1hU8XanUC/u+SxI4ciJ+xpVxxBfdGP0aQQ65qwfgyTAKFNka9IYXK2mDCHjVg51VqEV0Mr8IlK1 VoggYkLvIFjuDM4mdGSf3Hi40v2Jvw2vNmCc05bXgg8re0mkLkdb9QgPbnmtE7y1cQeMiz8PxgL iuvKwiuOc0AFBXYA/pJlKmV3mGH47ffFqhOvSxDGcdYqIG/uh41kL6g+S381gOSz7VPfG/S4ZXS W3YPGIu6toky30eaLCxxby8VqYvn2IRsTMMcrh/6BZmuSXm27BykzpyPoIA9iDds6LVrS+okCZK +vJMXWVolUaXsHw== X-Developer-Key: i=sudeep.holla@arm.com; a=openpgp; fpr=7360A21742ADF5A11767C1C139CFD4755FE2D5B4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231005_074517_162635_B7450193 X-CRM114-Status: UNSURE ( 9.61 ) X-CRM114-Notice: Please train this message. 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 The framework provides an interface to the sender to specify the notification to signal to the receiver. A sender signals a notification by requesting its partition manager to set the corresponding bit in the notifications bitmap of the receiver invoking FFA_NOTIFICATION_SET. Implement the FFA_NOTIFICATION_SET to enable the caller(sender) to send the notifications for any other partitions in the system. Signed-off-by: Sudeep Holla --- drivers/firmware/arm_ffa/driver.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/firmware/arm_ffa/driver.c b/drivers/firmware/arm_ffa/driver.c index 82e54d231074..4edb3cb48014 100644 --- a/drivers/firmware/arm_ffa/driver.c +++ b/drivers/firmware/arm_ffa/driver.c @@ -616,6 +616,26 @@ static int ffa_notification_bind_common(u16 dst_id, u64 bitmap, return 0; } +static +int ffa_notification_set(u16 src_id, u16 dst_id, u32 flags, u64 bitmap) +{ + ffa_value_t ret; + u32 src_dst_ids = PACK_TARGET_INFO(dst_id, src_id); + + invoke_ffa_fn((ffa_value_t) { + .a0 = FFA_NOTIFICATION_SET, .a1 = src_dst_ids, .a2 = flags, + .a3 = NOTIFICATION_BITMAP_LOW(bitmap), + .a4 = NOTIFICATION_BITMAP_HIGH(bitmap), + }, &ret); + + if (ret.a0 == FFA_ERROR) + return ffa_to_linux_errno((int)ret.a2); + else if (ret.a0 != FFA_SUCCESS) + return -EINVAL; + + return 0; +} + static int ffa_run(struct ffa_device *dev, u16 vcpu) { ffa_value_t ret;