From patchwork Tue Sep 19 17:40:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 13391632 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 663D8CE79A9 for ; Tue, 19 Sep 2023 17:42:02 +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=Gr53OPexXfcwbmRgb7iuVS6ulpAm9HDm4WeUfe7LlGM=; b=S64Cxtlv8v2Qc5 90SEsojsTJODJxVH2XJG22fWlGHFBsI0cohWjTBW4u6HKBqOIjJmg8k1vLQ7zbBRXUsLvkbP8/Jf4 0Pmhs1Q3oEzDWytFYne7HMofNb2LDCAZWpYWi/4M6hwxklYJeEShnztpgW/3Lk8GWI/TEmNASDzZK jJhn5YJp2MxH4AG25NcMbfn5cbMzADcV3kIZD33JSB9uH1l0gINfK5ptr3CqMk/clTmghU6wj1S8A uR7bszNHgihT+6jaJGubYl8v01hMyBaQjHrm1vSyQ0cERbwIoMepwB6HSqtjAYaAyR/6Ao0sOytv8 RZOxN4pQ4KlOuQ+RFiaw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qiejD-000xLQ-1z; Tue, 19 Sep 2023 17:41:39 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qiej6-000xDs-0F for linux-arm-kernel@lists.infradead.org; Tue, 19 Sep 2023 17:41:33 +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 030D1C15; Tue, 19 Sep 2023 10:42:09 -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 AC2523F5A1; Tue, 19 Sep 2023 10:41:30 -0700 (PDT) From: Sudeep Holla Date: Tue, 19 Sep 2023 18:40:59 +0100 Subject: [PATCH RFT v2 11/18] firmware: arm_ffa: Add interface to send a notification to a given partition MIME-Version: 1.0 Message-Id: <20230919-ffa_v1-1_notif-v2-11-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=2181; i=sudeep.holla@arm.com; h=from:subject:message-id; bh=mf13geoyRUVq+k7QY/1WTY0HvW1S38+M9VoghctS2VY=; b=owEBbQKS/ZANAwAIAQBBurwxfuKYAcsmYgBlCd074rORL91R/e9bjGTHEFnHip8ToRIvg1XiG TM8fH769IaJAjMEAAEIAB0WIQS6ceUSBvMeskPdk+EAQbq8MX7imAUCZQndOwAKCRAAQbq8MX7i mIVVD/96c5oId3hsFXU8Px9FTT8Ln6/vK7dSNd8JamLQye/U43K2AT6Cyu8q3dFqyeqQhTdMUZg H41PCfQuwkozpqsWOvX2rWgFCzcIRe6eneuvEgkvu695mNghv7K8cDMqaUhWdUPGvdnFVSgeet9 DmrXWoeId4ZDCFgWWmqnteZx1nEPJrUP7tPEzFswidMazhVrE+omjgPWqy1SVJ7THtP2K1ir83s 4/WgdyLQT+nUw9vE2qhghORJpJJ7VRFWOo+WjIbC5NYaWBV6z/51r5vhdRCAqopYGP5KZhhhPYu OqfTtn5i47sWAcMANVjH8oAcz6BGp0iqkfPeB8bN6F9U4wkt9EOA76/3jCvWqruOaPoFralx3AL J0XjIFfcMc9xW76BRWz2eM2ArSgMEnvLPz0NJ7h6F2hlM8kTuHqfbyoE5OzNA2fJXGcwlVC3WWP A0QqGaTcAXGg9UiW8qUIx7HA8S8ALIVrwD8Wkjvj/WNPhAyFAkedB8WFh+82yUX5Zovgi7xeH0V +O783nfHNcxwzHVLvZ42kXIiSJCSScpXiezYEmhH3MjazXYttFh2eQV2M9xz7Es7vRLfmpc9zcj JoSb2+QvEwmlwePjXu5XWRGP1T5Q7vSCaNxIvrMlY7qErop94tvZtfTUAnYkm5Eom7ouR7OiB75 1Gu+7e5PfgN2GsQ== 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_104132_203947_E2A1210A X-CRM114-Status: GOOD ( 12.83 ) 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 endpoint to specify the notification to signal to the receiver endpoint. A sender signals a notification by requesting its partition manager to set the corresponding bit in the notifications bitmap of the receiver. Expose the ability to send a notification to another partition. Signed-off-by: Sudeep Holla --- drivers/firmware/arm_ffa/driver.c | 13 +++++++++++++ include/linux/arm_ffa.h | 2 ++ 2 files changed, 15 insertions(+) diff --git a/drivers/firmware/arm_ffa/driver.c b/drivers/firmware/arm_ffa/driver.c index 1d61442ca4fa..b95c7979da8d 100644 --- a/drivers/firmware/arm_ffa/driver.c +++ b/drivers/firmware/arm_ffa/driver.c @@ -1033,6 +1033,18 @@ static int ffa_notify_request(struct ffa_device *dev, bool is_per_vcpu, return rc; } +static int ffa_notify_send(struct ffa_device *dev, int notify_id, + bool is_per_vcpu, u16 vcpu) +{ + u32 flags = 0; + + if (is_per_vcpu) + flags |= (PER_VCPU_NOTIFICATION_FLAG | vcpu << 16); + + return ffa_notification_set(dev->vm_id, drv_info->vm_id, flags, + BIT(notify_id)); +} + static const struct ffa_info_ops ffa_drv_info_ops = { .api_version_get = ffa_api_version_get, .partition_info_get = ffa_partition_info_get, @@ -1058,6 +1070,7 @@ static const struct ffa_notifier_ops ffa_drv_notifier_ops = { .sched_recv_cb_unregister = ffa_sched_recv_cb_unregister, .notify_request = ffa_notify_request, .notify_relinquish = ffa_notify_relinquish, + .notify_send = ffa_notify_send, }; static const struct ffa_ops ffa_drv_ops = { diff --git a/include/linux/arm_ffa.h b/include/linux/arm_ffa.h index fb6f388a3737..f6df81f14b6d 100644 --- a/include/linux/arm_ffa.h +++ b/include/linux/arm_ffa.h @@ -401,6 +401,8 @@ struct ffa_notifier_ops { int (*notify_request)(struct ffa_device *dev, bool per_vcpu, ffa_notifier_cb cb, void *cb_data, int notify_id); int (*notify_relinquish)(struct ffa_device *dev, int notify_id); + int (*notify_send)(struct ffa_device *dev, int notify_id, bool per_vcpu, + u16 vcpu); }; struct ffa_ops {