From patchwork Tue Sep 19 17:40:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 13391636 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 03496CE79AF for ; Tue, 19 Sep 2023 17:42:05 +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=u7Iq/4Vu3+soLtSG79lQe4KsPAojS9f3FEa9yQcgwWM=; b=Fz/X9S7ix5tV8e zeDDLJFPVV05Zt4N1+HiVHVSTEuAxvNVL5HbZhgHrwAGkehORa/N06UgFAConfmhEdSqBM6bcCb4O kZlqwByybHU51v+aNoMlcl1kEluvL8V7bCeW9FbqA6Ve1cOv5JEBWLOVhm3+lHH9XJck2HL9M4bEF ILLMhRgdZH2dYa+cwqw7ZjLSXyseoU40ewlpO964lo3sYSDA2c6aE62dRdLZShs34d3YxJClOExqp CjbhmSgz13HsFfd1HE0HbJVe08Ekydybxkk0Iug/49ZjjVxFgdsn6HLPIJ7oebPejnX0sJ4HhWir9 Ns0h+zcBc4wSJ/7+dwWw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qiejA-000xII-1r; Tue, 19 Sep 2023 17:41:36 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qiej1-000xDE-29 for linux-arm-kernel@lists.infradead.org; Tue, 19 Sep 2023 17:41:29 +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 E6D40143D; Tue, 19 Sep 2023 10:42:01 -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 9A08E3F5A1; Tue, 19 Sep 2023 10:41:23 -0700 (PDT) From: Sudeep Holla Date: Tue, 19 Sep 2023 18:40:53 +0100 Subject: [PATCH RFT v2 05/18] firmware: arm_ffa: Implement the FFA_NOTIFICATION_SET interface MIME-Version: 1.0 Message-Id: <20230919-ffa_v1-1_notif-v2-5-6f3a3ca3923c@arm.com> References: <20230919-ffa_v1-1_notif-v2-0-6f3a3ca3923c@arm.com> In-Reply-To: <20230919-ffa_v1-1_notif-v2-0-6f3a3ca3923c@arm.com> To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Sudeep Holla , Jens Wiklander , Marc Bonnici , 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=PMF7W8gP08NmJpWmNAG8MEfkwerfmt6TtimmzyfxT6Q=; b=owEBbQKS/ZANAwAIAQBBurwxfuKYAcsmYgBlCd062+rtFD+44yL0Ekw5PGXXJ+O+CH2hxDgPl oo7XyQZC7+JAjMEAAEIAB0WIQS6ceUSBvMeskPdk+EAQbq8MX7imAUCZQndOgAKCRAAQbq8MX7i mMz3D/978oazRdsQBQ1CfVAgN3UMUwEFY2s+U2EOyTnNCCkLb08bn2TmY2Ul4Q8yulS8Z/d1yEF ryXH87x53jlhDFOUOoVxQWBx1ZGsYXbWr9SS4uc17T8VTQPZ/Yj2Zs7m5ErtJn7kJ3vgOvYJUY2 mko5cDfNqAzdB9dHEXdTaO3FcKFaYlTFU+W003LnYIh8Yo29I16e1YgasLGcuvalBfGOcdVedRM 66m2ZXyT+gYg0Hj4mjPR08uYczTQJgSQWVPvL818HDQP6VRABdd3SS2NqKK4B/dajuzs2Ox05yI l92A8zoQSSgjnmj8DJ84mDGx0GdX+cOaDDrUfBsYKo0E84BeCoJOctELSMOWEpwt03n07/nBW6L /h9ttmhBiv4Nq73pxfn6MhR9PswwrFy5N7VYXb4Kn2DhqcQdcAn2DHcWBgfWGVA5l16L0VzNOrF ncBqYr9daRg8RsR0RYjMju005j/a1mKUKWUEiA94M/KfwPvs7PMKu6/GL2I08ZbO+ptfevIEVC3 j4a7B6ZQBSL657Jsi3TuCDcqH5kEO9zMVI3KqciVFyfvoChioz64DaksuJWS8YTN1i4mzG2yyYq bq3dMS2llQLJnJsMyS6kB4t6bRwZHST1A/iI05lAn9t/kk8RNFkPVsCYjnvVnTTcjJ7mfR37Zx/ MKPBzzt1GqU5hqw== 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-20230919_104127_750204_1C448E0D X-CRM114-Status: GOOD ( 10.20 ) 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 ebe1ecc57099..2aae838ba46a 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(src_id, dst_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;