From patchwork Thu Oct 5 14:45:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 13410169 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 DBDB2E92718 for ; Thu, 5 Oct 2023 14:46:06 +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=OIbFwPvzNg7TX8FD3RqIdPSipvqzyk5oBYieFWPPTAc=; b=CxpZ+ZeBHZ6wOd zshZedDN7U0cEHcDTOLmpoOrjfgqtRQyIIIRE6hgY+h7cBMLWzmnc33zIGWRrHDvxrCVax8XjZfsW IK00lRguFV8LAYlt7Quzjk42wujDC1uxGC1sZkgMOpljJ9689bgPVP9k+zBmNNbu4MpGWKOYifRTi CauPigUuMcdLbI2Jrfe1rf2LXo5klyAN0JidrXw9SF1k2zvQCNZacEvG8YKpN9CFgggDKPlXRlNaT 4ZvnkkwRg76h+MaY0VTsmDBLOAxmYFO1r0q/4wf1xhhDzfAugVDRlAJJATWtMoy68+Vri9TOnajmZ xe2WKhy5e3GH3euhlDKw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qoPbd-003ltn-23; Thu, 05 Oct 2023 14:45:37 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qoPbP-003leR-0g for linux-arm-kernel@lists.infradead.org; Thu, 05 Oct 2023 14:45:28 +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 BD3F515A1; Thu, 5 Oct 2023 07:46:00 -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 131023F641; Thu, 5 Oct 2023 07:45:20 -0700 (PDT) From: Sudeep Holla Date: Thu, 05 Oct 2023 15:45:04 +0100 Subject: [PATCH v4 11/17] firmware: arm_ffa: Add interface to send a notification to a given partition MIME-Version: 1.0 Message-Id: <20231005-ffa_v1-1_notif-v4-11-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=2181; i=sudeep.holla@arm.com; h=from:subject:message-id; bh=iR7xv4zWGKiCOfOTUrWKzr2y6gNM1XQTF7Jjqnppvvw=; b=owEBbQKS/ZANAwAIAQBBurwxfuKYAcsmYgBlHsvyUa0kf0qaS0e9Fg2dVQkQFVfR5hK3IAhDQ 3s8+Y7UIlyJAjMEAAEIAB0WIQS6ceUSBvMeskPdk+EAQbq8MX7imAUCZR7L8gAKCRAAQbq8MX7i mCgED/91RGR3wwqUHgbGtWvWw4cfovaRPFwuGja8Cj4hR3egB3+yLDr+TPgjf+wHVIK/ZEs5HFw 0R+5bItjUQwwU7Y80SQYiSM9FkybAD3kZB1FBRsTl6beRCGLrJ0CklF1pPVOdF5XsSnbRLWhKx0 jBnxfrKRfPVqjsfN5Yi5f6ULO440sAzg8cg7JtIJWr90zNlP73H+zJ6vXquz6TmeCyi77JF+FST yzN+4c8CE8gJf4IhWYCbkNp/nNnNCPjGngtU1+u5h7KLbgThhnTJ8FILeuE+4wIvQo5ZsJCgG63 bhvLgyIXKeDemXY8cE7Nyjkz2P+sx+1aE5WPUTY+mFTn/3ghi1A1bQj0Ve+k2H/QCzFFNHzxtya SLhDDj8FntmyY0B4LG3jPV2AXUXUduTzRZPXHGrylpLBphhEyfFDfzFZ+zvJNGsQdSOOPGEnZqH FaAjTBLfPr5z430rzOETAznr6tmCsDwG9i+19z9Tar98vh0XO4SwrMAxqy8VffZtydzvMIsVqPK 4gVugFVckzfTH7qK/TMMsOI3slkz/eVg/3pDovmx90tjBpkDd5E5nSHTQlD5oQ3GjGEcnDWYbCV W2Q6S68e32v6eQhNtRb7Ee5LN6Q4hANzyQg8lkVcWi+i0burck21d8HG7I7T+XIFwSDbCqD4QeZ EMS66X/ci5BMM5g== 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_074523_442529_9377D6F4 X-CRM114-Status: GOOD ( 12.16 ) 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 fc8b29648fb2..2a46052a280a 100644 --- a/drivers/firmware/arm_ffa/driver.c +++ b/drivers/firmware/arm_ffa/driver.c @@ -1038,6 +1038,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, @@ -1063,6 +1075,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 {