public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: Sudeep Holla <sudeep.holla@arm.com>
To: linux-arm-kernel@lists.infradead.org
Cc: Marc Bonnici <marc.bonnici@arm.com>,
	 Olivier Deprez <Olivier.Deprez@arm.com>,
	 Lorenzo Pieralisi <lpieralisi@kernel.org>,
	 Bertrand Marquis <Bertrand.Marquis@arm.com>,
	 Jens Wiklander <jens.wiklander@linaro.org>,
	 Sudeep Holla <sudeep.holla@arm.com>
Subject: [PATCH 3/4] firmware: arm_ffa: Check if receiving notifications are supported before sending
Date: Mon, 15 Apr 2024 17:05:24 +0100	[thread overview]
Message-ID: <20240415-ffa_msg2_support-v1-3-a28c964b1b3f@arm.com> (raw)
In-Reply-To: <20240415-ffa_msg2_support-v1-0-a28c964b1b3f@arm.com>

Add check to see if the target partition can receive the notifications
before sending any notifications to the partition.

Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
---
 drivers/firmware/arm_ffa/driver.c | 6 +++++-
 include/linux/arm_ffa.h           | 2 ++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/firmware/arm_ffa/driver.c b/drivers/firmware/arm_ffa/driver.c
index 52379885a403..d5087e4f6d35 100644
--- a/drivers/firmware/arm_ffa/driver.c
+++ b/drivers/firmware/arm_ffa/driver.c
@@ -1092,12 +1092,16 @@ static int ffa_notify_request(struct ffa_device *dev, bool is_per_vcpu,
 	return rc;
 }
 
+#define ffa_partition_supports_notify_recv(dev)	\
+	ffa_partition_check_property(dev, FFA_PARTITION_NOTIFICATION_RECV)
+
 static int ffa_notify_send(struct ffa_device *dev, int notify_id,
 			   bool is_per_vcpu, u16 vcpu)
 {
 	u32 flags = 0;
 
-	if (ffa_notifications_disabled())
+	if (ffa_notifications_disabled() ||
+	    !ffa_partition_supports_notify_recv(dev))
 		return -EOPNOTSUPP;
 
 	if (is_per_vcpu)
diff --git a/include/linux/arm_ffa.h b/include/linux/arm_ffa.h
index c906f666ff5d..13830be5851d 100644
--- a/include/linux/arm_ffa.h
+++ b/include/linux/arm_ffa.h
@@ -221,6 +221,8 @@ struct ffa_partition_info {
 #define FFA_PARTITION_DIRECT_SEND	BIT(1)
 /* partition can send and receive indirect messages. */
 #define FFA_PARTITION_INDIRECT_MSG	BIT(2)
+/* partition can receive notifications */
+#define FFA_PARTITION_NOTIFICATION_RECV	BIT(3)
 /* partition runs in the AArch64 execution state. */
 #define FFA_PARTITION_AARCH64_EXEC	BIT(8)
 	u32 properties;

-- 
2.43.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2024-04-15 16:06 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-15 16:05 [PATCH 0/4] firmware: arm_ffa: Support for MSG_SEND2 and minor harderning checks Sudeep Holla
2024-04-15 16:05 ` [PATCH 1/4] firmware: arm_ffa: Stash the partition properties for query purposes Sudeep Holla
2024-04-15 16:05 ` [PATCH 2/4] firmware: arm_ffa: Check if receiving direct requests are supported before sending Sudeep Holla
2024-04-16  7:18   ` Jens Wiklander
2024-04-15 16:05 ` Sudeep Holla [this message]
2024-04-16  7:31   ` [PATCH 3/4] firmware: arm_ffa: Check if receiving notifications " Jens Wiklander
2024-04-15 16:05 ` [PATCH 4/4] firmware: arm_ffa: Add support for FFA_MSG_SEND2 Sudeep Holla
2024-04-16  7:26   ` Bertrand Marquis
2024-04-16  9:47     ` Sudeep Holla
2024-04-16  7:41   ` Jens Wiklander
2024-04-16  8:48     ` Sudeep Holla
2024-04-16 10:53       ` Jens Wiklander

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240415-ffa_msg2_support-v1-3-a28c964b1b3f@arm.com \
    --to=sudeep.holla@arm.com \
    --cc=Bertrand.Marquis@arm.com \
    --cc=Olivier.Deprez@arm.com \
    --cc=jens.wiklander@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=lpieralisi@kernel.org \
    --cc=marc.bonnici@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox