From nobody Fri Dec 19 13:49:40 2025 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 66AEF226888 for ; Mon, 17 Feb 2025 15:39:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739806786; cv=none; b=rfaDWpdczVUw0cQ4T2LRsV96zZQI8hBmc8V0NZu6IPMbukI9vVbnVGo+8Ssmb1F3fdvDLhHGF7CDLr5XVsIaGxodHPrLfCY7A6A+EgWIr/NuFHd9lDXcLIfyZ1TDjAw/fPYIsN64uZff997aIePUgsmcxqbW9y28il8V9G6drdE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739806786; c=relaxed/simple; bh=a+m7Jcn3/5rOXkUlDE7zE4WFeovCOPzxO6ncEsdu46s=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To; b=VVnsZcUhWyKgqVdJKvbBCjvIarYm00h8S4f6Z4YdK3mCRe3Q6rhM6XCKQ6UpSiUHQDHR9Yvaial8MH15Za4HngF3JDlIX4RM2MK/KYJWyHXGdxJIAZq3mCflPUObEu4RS/mqo8mMnPu1QsPbUSQAAJhCZ7xGNnKwlUFzy8T62O0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com 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 6731D1063; Mon, 17 Feb 2025 07:40:03 -0800 (PST) Received: from e133711.arm.com (e133711.arm.com [10.1.196.55]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 832F23F6A8; Mon, 17 Feb 2025 07:39:43 -0800 (PST) From: Sudeep Holla Date: Mon, 17 Feb 2025 15:38:56 +0000 Subject: [PATCH v3 15/19] firmware: arm_ffa: Stash ffa_device instead of notify_type in notifier_cb_info Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250217-ffa_updates-v3-15-bd1d9de615e7@arm.com> References: <20250217-ffa_updates-v3-0-bd1d9de615e7@arm.com> In-Reply-To: <20250217-ffa_updates-v3-0-bd1d9de615e7@arm.com> To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Sudeep Holla , Viresh Kumar X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=3541; i=sudeep.holla@arm.com; h=from:subject:message-id; bh=a+m7Jcn3/5rOXkUlDE7zE4WFeovCOPzxO6ncEsdu46s=; b=owEBbQKS/ZANAwAIAQBBurwxfuKYAcsmYgBns1gvxHscpAJVylxg3E1rCxo/gAykEC9AxaQ4z GS5AInoSeWJAjMEAAEIAB0WIQS6ceUSBvMeskPdk+EAQbq8MX7imAUCZ7NYLwAKCRAAQbq8MX7i mMhtEACupYnhbABfRgAxOCIJthXbvk3V50VSPi3g8KQTIZwbypXqE5qWfBx+h9MM3j0AhJo1wzL e5Uw2G6k4bf+hh/X15ck5WKRLvsRALiDAhJo/PDd+g7/MD0zpFqcziJf9MLbA1zjXmydB0D9YKn AKFFDVh66J4BMHNKgJggC7xM+VjL3ipmixLruOX1UBENUkQY6rxwYl5bJ4/LAeFHXNWh85XYi5t BDyxdKci1QqmWhL9dq09vjytFTIsX/AvdmLe0BsrA8aytCfoqgZVICkcdKELQvYlJQuXogiYusO 0iPApcNZ21A37xIYxJbl6xnUhmREDtDYFhkqR5rD8Jjl2MkzyWdLYLs9GmrenFJBs7BGovb/WQu kYNYR86C/LL6ZKAbzzKrnmOiw0WKcf8460R4w+ZXEfVWHmecC0i2PZH/A9/2uoxZJF2vONc7Tbi pYLJl8HkqkFQk68aoTBqPsPbnhqQ0GTHKp6sGC4MILHZQaGhPF/LJWPbtqJ9R91NFXgB/5AWvoC jBnTao4tfQNep8mYTZhP6JJIH0yuj+FEXyJWYinL5WO/9NrVXI9uqLqJz3Rmqs/KwLK3aMPWerE LGvP7b5hQQQ/I4ofvKzn8c7SQnPfSOI/fE0170p35Pd22j2K0ZfuXjUEEeUo95D3UzcWrlPcGHb cQ8bhRJuIEgOZzg== X-Developer-Key: i=sudeep.holla@arm.com; a=openpgp; fpr=7360A21742ADF5A11767C1C139CFD4755FE2D5B4 Currently, we store the type of the notification in the notifier_cb_info structure that is put into the hast list to identify if the notification block is for the secure partition or the non secure VM. In order to support framework notifications to reuse the hash list and to avoid creating one for each time, we need store the ffa_device pointer itself as the same notification ID in framework notifications can be registered by multiple FF-A devices. Tested-by: Viresh Kumar Signed-off-by: Sudeep Holla --- drivers/firmware/arm_ffa/driver.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/drivers/firmware/arm_ffa/driver.c b/drivers/firmware/arm_ffa/d= river.c index 0abbf08bc8d39c701947366bdf9c8fac8e64cf64..5863272f45d9c075d8e86d45a90= ac6b1fb743c98 100644 --- a/drivers/firmware/arm_ffa/driver.c +++ b/drivers/firmware/arm_ffa/driver.c @@ -1116,9 +1116,9 @@ static int ffa_memory_lend(struct ffa_mem_ops_args *a= rgs) =20 struct notifier_cb_info { struct hlist_node hnode; + struct ffa_device *dev; ffa_notifier_cb cb; void *cb_data; - enum notify_type type; }; =20 static int ffa_sched_recv_cb_update(u16 part_id, ffa_sched_recv_cb callbac= k, @@ -1187,17 +1187,18 @@ notifier_hash_node_get(u16 notify_id, enum notify_t= ype type) struct notifier_cb_info *node; =20 hash_for_each_possible(drv_info->notifier_hash, node, hnode, notify_id) - if (type =3D=3D node->type) + if (type =3D=3D ffa_notify_type_get(node->dev->vm_id)) return node; =20 return NULL; } =20 static int -update_notifier_cb(int notify_id, enum notify_type type, ffa_notifier_cb c= b, +update_notifier_cb(struct ffa_device *dev, int notify_id, ffa_notifier_cb = cb, void *cb_data, bool is_registration) { struct notifier_cb_info *cb_info =3D NULL; + enum notify_type type =3D ffa_notify_type_get(dev->vm_id); bool cb_found; =20 cb_info =3D notifier_hash_node_get(notify_id, type); @@ -1211,7 +1212,7 @@ update_notifier_cb(int notify_id, enum notify_type ty= pe, ffa_notifier_cb cb, if (!cb_info) return -ENOMEM; =20 - cb_info->type =3D type; + cb_info->dev =3D dev; cb_info->cb =3D cb; cb_info->cb_data =3D cb_data; =20 @@ -1226,7 +1227,6 @@ update_notifier_cb(int notify_id, enum notify_type ty= pe, ffa_notifier_cb cb, static int ffa_notify_relinquish(struct ffa_device *dev, int notify_id) { int rc; - enum notify_type type =3D ffa_notify_type_get(dev->vm_id); =20 if (ffa_notifications_disabled()) return -EOPNOTSUPP; @@ -1236,7 +1236,7 @@ static int ffa_notify_relinquish(struct ffa_device *d= ev, int notify_id) =20 mutex_lock(&drv_info->notify_lock); =20 - rc =3D update_notifier_cb(notify_id, type, NULL, NULL, false); + rc =3D update_notifier_cb(dev, notify_id, NULL, NULL, false); if (rc) { pr_err("Could not unregister notification callback\n"); mutex_unlock(&drv_info->notify_lock); @@ -1255,7 +1255,6 @@ static int ffa_notify_request(struct ffa_device *dev,= bool is_per_vcpu, { int rc; u32 flags =3D 0; - enum notify_type type =3D ffa_notify_type_get(dev->vm_id); =20 if (ffa_notifications_disabled()) return -EOPNOTSUPP; @@ -1274,7 +1273,7 @@ static int ffa_notify_request(struct ffa_device *dev,= bool is_per_vcpu, return rc; } =20 - rc =3D update_notifier_cb(notify_id, type, cb, cb_data, true); + rc =3D update_notifier_cb(dev, notify_id, cb, cb_data, true); if (rc) { pr_err("Failed to register callback for %d - %d\n", notify_id, rc); --=20 2.34.1