From patchwork Fri Sep 29 15:03:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 13404502 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 DD107E71D45 for ; Fri, 29 Sep 2023 15:04:07 +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=ntKcQPTJYsG3ektXcv4NjjM0hXzaZ1SR0JIxi0+w9kU=; b=aFTykaSkXPLY0e WXRuVM3j9Sgod6GzsBLO5sWAZMEgn2EpU2ZYlOumn+5UxIIxctoGz8OM814HurFpvKvvwGyS9ESSF AX9RZHkA0vVzpstVgU/wsjc68XvYpOgD1gns/wJQr16bt11VBmN8hKt29r6SaQ1o3ARyxmpJEyZlI giwE0w5ZblKxKBQZ5vnS+lBrNxstaNETtl38WlnYU3A8ak2DG5mu3dl+C5AgNRcyiNndf/UiNwt0I qqqstIjb65C3XpA9bpI0qcapsocx33pzXqq1LHtK+vEx6deC/4eJ24SD8xneDvaZ6q6klElxCOkyB NkJl6NVutsrwnHb86OoA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qmF1q-0088Rx-0f; Fri, 29 Sep 2023 15:03:42 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qmF1c-0088Gh-0C for linux-arm-kernel@lists.infradead.org; Fri, 29 Sep 2023 15:03: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 2845E1FB; Fri, 29 Sep 2023 08:04:06 -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 C59123F5A1; Fri, 29 Sep 2023 08:03:26 -0700 (PDT) From: Sudeep Holla Date: Fri, 29 Sep 2023 16:03:00 +0100 Subject: [PATCH v3 11/17] firmware: arm_ffa: Add interface to send a notification to a given partition MIME-Version: 1.0 Message-Id: <20230929-ffa_v1-1_notif-v3-11-c8e4f15190c8@arm.com> References: <20230929-ffa_v1-1_notif-v3-0-c8e4f15190c8@arm.com> In-Reply-To: <20230929-ffa_v1-1_notif-v3-0-c8e4f15190c8@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=f4Gw9qi5dW5Ef+rKySqOZWY9UgWqEziJ+T29fyYYAJQ=; b=owEBbQKS/ZANAwAIAQBBurwxfuKYAcsmYgBlFucw0qDNmU79mdBC/Sm4VFjwdP3A5KYk8XFDF lr0YD4RIgaJAjMEAAEIAB0WIQS6ceUSBvMeskPdk+EAQbq8MX7imAUCZRbnMAAKCRAAQbq8MX7i mEk5EADEAWUv/82JqDbfhVrIMI84gpGtF67+Q77nDFptg0Czw+joaWzzI78ZRTQFg3lkwfn6d82 N49R/38j+mg8mpP96clRyYmcnDs+jkCmMXEZPyrfs31rlMBMdFzILvcUZFOsHhke69LQJJHLFEb w/eqzS4FYuXiHmxsfopzHI8o9HSd7dUCrREGSegHBSd+Qub4UbjN29sQfUyUHUJOrcKkqvzCxnp 7O+D21eP//W2KUVkN7nvTf34yAl7VBVMRAf7S4W2TYn6XmFAeMnzV0T6xZcyy8p29zYqqtCUTef iLGunKeDB2sYEyUQTAuzg5TbH9faXqUd+o60UrjQPqjNE9yEfutyMlbY3IbIwVwbBgCgAtkFEDx ZGw4XTLAWKtoh3MisocU+yEFeGLAS9Luv1ANBivu5CjOzpCbbsIlIh0rG/kL0jWSwATPJ/OzIRD 7wQWzblYr6tT9f+EiswyTjVI5LbxDcuVOCWlKfo6jyMJ6pXDH89GkbPDXwfceI6sp8TJmXCV1DL dx7Hs9cLKXYKoOqNUr8nnklk/Le/GCfs+rv6QDGcHVGpSjBKosswxyMSb67+iAbGhEj0y0Ezzq+ a00K1Bvn1zDjWzRm/jrBLCki+vESjEOGUPlGsNZLJhoHAsG6oJqtK+JAkVZiSDYqmk/nJivdBTj VULpEsARIEChWwA== 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-20230929_080328_190284_8995904F X-CRM114-Status: GOOD ( 12.48 ) 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 55707a5d333d..94e39ee83278 100644 --- a/drivers/firmware/arm_ffa/driver.c +++ b/drivers/firmware/arm_ffa/driver.c @@ -1044,6 +1044,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, @@ -1069,6 +1081,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 {