From patchwork Thu Aug 3 19:02:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 13340784 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 DD857C41513 for ; Thu, 3 Aug 2023 19:03:04 +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:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Py8gKXDDBvGGg4TGD6aygc5UlQV2OpQk7OtV42isXhI=; b=nNWKi62yTpdfaX d+KMkAFv67QF8xzXyf2VInfytEATSAdJStPbb37mosaP2ilPwISxjLiGPC3DT+iZ6jEuQdUvhnZkc 9v1PBPMfBrCTKXEj0hJPPR8pxcusurHMhEwOhymReN8qT6KMVr1cMNxOwj29Cz1V/wpvo6m74p0k0 ZUHBf7wHer6Ch4zlSRkzf/oNszuu4719erGZhH1Ys7EphyVs3dXvBDYu3UvtUEa5JWmlRUEVssFTe aBWwmp4TOhQ+ji00Cm377Zs3m/bqMujRt1cFiwpK0FNEFosY8lP+xT5LBu8AMb3XR/tk7VwHVXutc WyDKaN0M95ZPFvcvHqkw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qRdaq-00Ah2q-0D; Thu, 03 Aug 2023 19:02:40 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qRdai-00AgwT-1L for linux-arm-kernel@lists.infradead.org; Thu, 03 Aug 2023 19:02:34 +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 88F7B14BF; Thu, 3 Aug 2023 12:03:11 -0700 (PDT) Received: from usa.arm.com (e103737-lin.cambridge.arm.com [10.1.197.49]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 6DB2C3F6C4; Thu, 3 Aug 2023 12:02:27 -0700 (PDT) From: Sudeep Holla To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Sudeep Holla , Jens Wiklander , Lucian Paul-Trifu , Marc Bonnici , Coboy Chen Subject: [PATCH RFT 05/12] firmware: arm_ffa: Implement the FFA_NOTIFICATION_SET interface Date: Thu, 3 Aug 2023 20:02:09 +0100 Message-ID: <20230803-ffa_v1-1_notif-v1-5-6613ff2b1f81@arm.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230803-ffa_v1-1_notif-v1-0-6613ff2b1f81@arm.com> References: <20230803-ffa_v1-1_notif-v1-0-6613ff2b1f81@arm.com> MIME-Version: 1.0 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=gIcrWaE8JjUgJBbBV1coOUsOSzQnr17FTAXR0ZVKxfU=; b=owEBbQKS/ZANAwAIAQBBurwxfuKYAcsmYgBky/iNKfnamF9bQ6t4TFfYJFZV5REuiS1Xy3AD1 vlZ5aBZZsGJAjMEAAEIAB0WIQS6ceUSBvMeskPdk+EAQbq8MX7imAUCZMv4jQAKCRAAQbq8MX7i mH0iEAC6zQT+zR4ZBTgQfPzkLYDo+kli3u41l6gxWq9DroxO21dHwyuoxTNebt9LONyflU9080T 3C8Esz2fATBbZepXXtLymI/w5eqABbzsqEyhNbkO5tvJEFuzlfpWjdI0pH7a87uqhDwNU+SfmGi ds4bySxPNCTe3VCYZtLKwXpHkys63ide10vyGav0i0PHiFVTa662IKduPD++3ilsRcsVauaQaSq 8zx2Eg+MbDxSizAnii878HgO68JWasJ16Oedm2sCdS5nBAZ9ngasItOSBduaDAc+Vl5VkQyiYE+ hMOHtvdsRLSQVc0GTDuus+MKboxaSwqxjvjUOyRNHne/MQshMCdg8nr3I9WmrWyXlhMDxC7HbEo 7EjHYevbXwvbZtb+HjyDreSBl7lCR0p1Vr5xL0NNMQY/UHHgz1mJSknxpTgTJnTemOUOORVWisv 6Zvcpg4zJt1ve7v4NnspCL/jdD7l2hfGQULukUBDAOm6lxOzfyX7gBp7cQFbafhheMTez/qTUqF cVuh0MlSTCisXkaOPA7vMeJlc+MiQWqRyWE5qBN4h2seBZQ26M1POhMtzpgxPKLwi8VWQE7ReN8 EARC93Fc/nWtWxn8fw72W5j2peB82WNDTyOSLgDT9y/7/Qi7KfWOde4AS0PEc8cXutdqfcL3Rim HxtYrY/f gkkqNLQ== 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-20230803_120232_500640_4A02B5BC X-CRM114-Status: GOOD ( 10.50 ) 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 41171ae7f63a..492f5bfa3751 100644 --- a/drivers/firmware/arm_ffa/driver.c +++ b/drivers/firmware/arm_ffa/driver.c @@ -604,6 +604,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;