From nobody Sun Feb 8 23:06:57 2026 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 18D7B188A0C for ; Fri, 23 Aug 2024 15:14:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724426075; cv=none; b=OD8bbruBAXnbDJZM7EucR6OGk8BdfPrwLipQVIHkVha9KyQVUcHILkKUWK7O4FAJ43cHOXXFf/W21xIxqoPGlCjVsDokr1EVMy3wlxQH5aoToNkj+GS1w6hVb6XuwakqsdbKpeFpsvv8+ITPkVjCgqDHwDEEnrlOa2kCT9mo3Y8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724426075; c=relaxed/simple; bh=lURN2Re3Pjar6uAHMjExDR15wOW/qxPvOtr4hCvgpHY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=YI/Cu80tlNr7eT0XCgcxLSm+tRTDMk1hyWkeMHjFrVyQ9iZ767Z6tNw+WHaELH3TBhQY1D3Z5alTGUa4TLzHA4SVCba1aA+fi5/hE6ueOOdUPChE+UH+JK31q4GlMifXl1DNY84smNlTQ9D2jQAlSwYLMmSyVwdzwgvB1PTXoKM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=PNa/mNj4; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="PNa/mNj4" Received: from [192.168.29.25] (unknown [IPv6:2405:201:2015:f873:55f8:639e:8e9f:12ec]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id A8C0D497; Fri, 23 Aug 2024 17:13:23 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1724426005; bh=lURN2Re3Pjar6uAHMjExDR15wOW/qxPvOtr4hCvgpHY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=PNa/mNj4peNITg3P7LuLq6O1n4h5y68fAMSt/Ik92XPLPKC1VKo1CQ6cp5NhlhUZM Ng4Nma8J0Li0Ao7AcguHI9BAjcpEGWfgaNMHP/13V0y1qyuLtzdsm+UoV3LdhUrjQG 60tfrYtfasIkM3O2tTF6Lke1EICldwJcWex/yzTY= From: Umang Jain Date: Fri, 23 Aug 2024 20:44:21 +0530 Subject: [PATCH 1/7] staging: vchiq: Factor out bulk transfer for VCHIQ_BULK_MODE_WAITING 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: <20240823-to_sent2-v1-1-8bc182a0adaf@ideasonboard.com> References: <20240823-to_sent2-v1-0-8bc182a0adaf@ideasonboard.com> In-Reply-To: <20240823-to_sent2-v1-0-8bc182a0adaf@ideasonboard.com> To: Florian Fainelli , Broadcom internal kernel review list , Greg Kroah-Hartman Cc: linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Dan Carpenter , Laurent Pinchart , Kieran Bingham , Arnd Bergmann , Stefan Wahren , Dave Stevenson , Phil Elwell , Umang Jain X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724426064; l=5484; i=umang.jain@ideasonboard.com; s=20240731; h=from:subject:message-id; bh=lURN2Re3Pjar6uAHMjExDR15wOW/qxPvOtr4hCvgpHY=; b=PVc43o8YsWerRejIwWUGZrs1ub2HQy6TeG+vzSK4AK5+as4GCS+M+9+1M1EwHd+yhkTeSrG/r otaLN4epa5NAuNqzRmtckTlRtKoYMWugj1ZAnkJ+5X0TPerlDKE6+v3 X-Developer-Key: i=umang.jain@ideasonboard.com; a=ed25519; pk=7pvnIBNsDpFUMiph0Vlhrr01+rAn5fSIn/QtDeLeXL0= The bulk transfer is VCHIQ_BULK_MODE_WAITING is used by VCHIQ ioctl interface. It is factored out to a separate function from vchiq_bulk_transfer() to bulk_xfer_waiting_interruptible(). This is a part of vchiq_bulk_transfer refactoring. Each bulk mode will have their dedicated functions to execute bulk transfers. Each mode will be handled separately in subsequent patches. bulk_xfer_waiting_interruptible() is suffixed with "_interruptible" to denote that it can be interrupted when a signal is received. -EAGAIN maybe returned in those cases, similar to what vchiq_bulk_transfer() does. Adjust the vchiq_irq_queue_bulk_tx_rx() in the vchiq-dev.c to call bulk_xfer_waiting_interruptible() for waiting mode. A temporary goto label has been introduced to jump the call execution over vchiq_bulk_transfer() for waiting mode only. When all dedicated bulk transfer calls are introduced, this label shall be dropped. No function changes intended in this patch. Signed-off-by: Umang Jain --- .../vc04_services/interface/vchiq_arm/vchiq_core.c | 52 ++++++++++++++++++= +--- .../vc04_services/interface/vchiq_arm/vchiq_core.h | 4 ++ .../vc04_services/interface/vchiq_arm/vchiq_dev.c | 5 +++ 3 files changed, 56 insertions(+), 5 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c= b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c index 50af04b217f4..228a41ecf90c 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c @@ -3023,10 +3023,6 @@ int vchiq_bulk_transfer(struct vchiq_instance *insta= nce, unsigned int handle, bulk_waiter->actual =3D 0; bulk_waiter->bulk =3D NULL; break; - case VCHIQ_BULK_MODE_WAITING: - bulk_waiter =3D userdata; - bulk =3D bulk_waiter->bulk; - goto waiting; default: goto error_exit; } @@ -3115,7 +3111,6 @@ int vchiq_bulk_transfer(struct vchiq_instance *instan= ce, unsigned int handle, state->id, service->localport, dir_char, queue->local_insert, queue->remote_insert, queue->process); =20 -waiting: vchiq_service_put(service); =20 status =3D 0; @@ -3143,6 +3138,53 @@ int vchiq_bulk_transfer(struct vchiq_instance *insta= nce, unsigned int handle, return status; } =20 +/* + * This function is called by VCHIQ ioctl interface and is interruptible. + * It may receive -EAGAIN to indicate that a signal has been received + * and the call should be retried after being returned to user context. + */ +int +bulk_xfer_waiting_interruptible(struct vchiq_instance *instance, unsigned = int handle, + void *userdata) +{ + struct vchiq_service *service =3D find_service_by_handle(instance, handle= ); + struct bulk_waiter *bulk_waiter =3D NULL; + struct vchiq_bulk *bulk; + int status =3D -EINVAL; + + if (!service) + goto error_exit; + + if (!userdata) + goto error_exit; + + if (service->srvstate !=3D VCHIQ_SRVSTATE_OPEN) + goto error_exit; + + if (vchiq_check_service(service)) + goto error_exit; + + bulk_waiter =3D userdata; + bulk =3D bulk_waiter->bulk; + + vchiq_service_put(service); + + status =3D 0; + + bulk_waiter->bulk =3D bulk; + if (wait_for_completion_interruptible(&bulk_waiter->event)) + status =3D -EAGAIN; + else if (bulk_waiter->actual =3D=3D VCHIQ_BULK_ACTUAL_ABORTED) + status =3D -EINVAL; + + return status; + +error_exit: + if (service) + vchiq_service_put(service); + return status; +} + int vchiq_queue_message(struct vchiq_instance *instance, unsigned int handle, ssize_t (*copy_callback)(void *context, void *dest, diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h= b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h index 77cc4d7ac077..1fda8631d1b6 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h @@ -470,6 +470,10 @@ vchiq_shutdown_internal(struct vchiq_state *state, str= uct vchiq_instance *instan extern void remote_event_pollall(struct vchiq_state *state); =20 +extern int +bulk_xfer_waiting_interruptible(struct vchiq_instance *instance, unsigned = int handle, + void *userdata); + extern int vchiq_bulk_transfer(struct vchiq_instance *instance, unsigned int handle, = void *offset, void __user *uoffset, int size, void *userdata, enum vchiq_bulk_mode= mode, diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c = b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c index 9cd2a64dce5e..445b7938eea3 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c @@ -324,6 +324,10 @@ static int vchiq_irq_queue_bulk_tx_rx(struct vchiq_ins= tance *instance, dev_dbg(service->state->dev, "arm: found bulk_waiter %pK for pid %d\n", waiter, current->pid); userdata =3D &waiter->bulk_waiter; + + status =3D bulk_xfer_waiting_interruptible(instance, args->handle, userd= ata); + + goto bulk_transfer_handled; } else { userdata =3D args->userdata; } @@ -331,6 +335,7 @@ static int vchiq_irq_queue_bulk_tx_rx(struct vchiq_inst= ance *instance, status =3D vchiq_bulk_transfer(instance, args->handle, NULL, args->data, = args->size, userdata, args->mode, dir); =20 +bulk_transfer_handled: if (!waiter) { ret =3D 0; goto out; --=20 2.45.0 From nobody Sun Feb 8 23:06:57 2026 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CF3C6189911 for ; Fri, 23 Aug 2024 15:14:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724426076; cv=none; b=mYdPiYzgOQKgYQxaXTtWAOdLohAHHrhvyW+DMY4f8M5dkjibjHx5DGfUSh7MIIC4knz8TwaKgwU5pmKlaPo4P7dU45pGukXnmZMBPFlOoJc+4SUY7AWY4pb2OEaGh3VDXTLGZL5EsD9raGQha93I2VJRHcGl4MM03nYUi8G/DPw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724426076; c=relaxed/simple; bh=Qumo+mDDsZCyfEHj0eKeGypIwyiGxm0ZfLShYxZQslo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=T1kJW5xl6Sth/b9zzRvi7WljGegLelaCu1yxj7dvbDMyI/5mj2Gb7K1sl2zhtMW5NTyMcRzRdYPpOBU2rRLjhlg3W8kzCuQr0XDZLeAZFBjUVc2xPlt/AK/4GY45IXyZ9dCsfI7ZtEQLcczrlGmCCUaeJ3M3to4oF3PDyJzVie8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=QOOmO6vt; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="QOOmO6vt" Received: from [192.168.29.25] (unknown [IPv6:2405:201:2015:f873:55f8:639e:8e9f:12ec]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 41FADC8E; Fri, 23 Aug 2024 17:13:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1724426008; bh=Qumo+mDDsZCyfEHj0eKeGypIwyiGxm0ZfLShYxZQslo=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=QOOmO6vt6J2A3b/kYV6po2/cpSB3UqSoLcv8777gpxbGcPoIr2n6smkyUkbNrWUsR dTOr2J8pPU3/k2V8/kAZXraVQoqX/roApokHPLlB11Pg4mggyWToGU/E1htmXnDVeA oP15sgbZS7mBwnRsE3enFeUfjXjYczmqw+3FZ5Zg= From: Umang Jain Date: Fri, 23 Aug 2024 20:44:22 +0530 Subject: [PATCH 2/7] staging: vchiq_core: Simplify vchiq_bulk_transfer() 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: <20240823-to_sent2-v1-2-8bc182a0adaf@ideasonboard.com> References: <20240823-to_sent2-v1-0-8bc182a0adaf@ideasonboard.com> In-Reply-To: <20240823-to_sent2-v1-0-8bc182a0adaf@ideasonboard.com> To: Florian Fainelli , Broadcom internal kernel review list , Greg Kroah-Hartman Cc: linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Dan Carpenter , Laurent Pinchart , Kieran Bingham , Arnd Bergmann , Stefan Wahren , Dave Stevenson , Phil Elwell , Umang Jain X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724426064; l=8892; i=umang.jain@ideasonboard.com; s=20240731; h=from:subject:message-id; bh=Qumo+mDDsZCyfEHj0eKeGypIwyiGxm0ZfLShYxZQslo=; b=jwmAOJ5IcYFoclhYaZymKlxjYm+gnbMbWpFG4qsLb6fo3017BuBeFOnuEDB9OU4YXKt0PtXJH Lqsr4HcWpWMA+5vW1aOMQhBhYmweG9/ckYwL/lstRQJffNirT8y2iR5 X-Developer-Key: i=umang.jain@ideasonboard.com; a=ed25519; pk=7pvnIBNsDpFUMiph0Vlhrr01+rAn5fSIn/QtDeLeXL0= Factor out core logic for preparing bulk data transfer(mutex locking, waits on vchiq_bulk_queue wait-queue, initialising the bulk transfer) out of the vchiq_bulk_transfer(). This simplifies the existing vchiq_bulk_transfer() and makes it more readable since all the core logic is handled in vchiq_bulk_xfer_queue_msg_interruptible(). It will also help us to refactor vchiq_bulk_transfer() easily for different vchiq bulk transfer modes. No functional changes intended in this patch. Signed-off-by: Umang Jain --- .../vc04_services/interface/vchiq_arm/vchiq_core.c | 217 ++++++++++++-----= ---- 1 file changed, 121 insertions(+), 96 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c= b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c index 228a41ecf90c..c31f5d773fa5 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c @@ -189,6 +189,13 @@ static const char *const conn_state_names[] =3D { static void release_message_sync(struct vchiq_state *state, struct vchiq_header *heade= r); =20 +static int +vchiq_bulk_xfer_queue_msg_interruptible(struct vchiq_service *service, + void *offset, void __user *uoffset, + int size, void *userdata, + enum vchiq_bulk_mode mode, + enum vchiq_bulk_dir dir); + static const char *msg_type_str(unsigned int msg_type) { switch (msg_type) { @@ -2991,15 +2998,9 @@ int vchiq_bulk_transfer(struct vchiq_instance *insta= nce, unsigned int handle, enum vchiq_bulk_mode mode, enum vchiq_bulk_dir dir) { struct vchiq_service *service =3D find_service_by_handle(instance, handle= ); - struct vchiq_bulk_queue *queue; - struct vchiq_bulk *bulk; - struct vchiq_state *state; struct bulk_waiter *bulk_waiter =3D NULL; - const char dir_char =3D (dir =3D=3D VCHIQ_BULK_TRANSMIT) ? 't' : 'r'; - const int dir_msgtype =3D (dir =3D=3D VCHIQ_BULK_TRANSMIT) ? - VCHIQ_MSG_BULK_TX : VCHIQ_MSG_BULK_RX; + struct vchiq_bulk *bulk; int status =3D -EINVAL; - int payload[2]; =20 if (!service) goto error_exit; @@ -3027,89 +3028,10 @@ int vchiq_bulk_transfer(struct vchiq_instance *inst= ance, unsigned int handle, goto error_exit; } =20 - state =3D service->state; - - queue =3D (dir =3D=3D VCHIQ_BULK_TRANSMIT) ? - &service->bulk_tx : &service->bulk_rx; - - if (mutex_lock_killable(&service->bulk_mutex)) { - status =3D -EAGAIN; - goto error_exit; - } - - if (queue->local_insert =3D=3D queue->remove + VCHIQ_NUM_SERVICE_BULKS) { - VCHIQ_SERVICE_STATS_INC(service, bulk_stalls); - do { - mutex_unlock(&service->bulk_mutex); - if (wait_for_completion_interruptible(&service->bulk_remove_event)) { - status =3D -EAGAIN; - goto error_exit; - } - if (mutex_lock_killable(&service->bulk_mutex)) { - status =3D -EAGAIN; - goto error_exit; - } - } while (queue->local_insert =3D=3D queue->remove + - VCHIQ_NUM_SERVICE_BULKS); - } - - bulk =3D &queue->bulks[BULK_INDEX(queue->local_insert)]; - - bulk->mode =3D mode; - bulk->dir =3D dir; - bulk->userdata =3D userdata; - bulk->size =3D size; - bulk->actual =3D VCHIQ_BULK_ACTUAL_ABORTED; - - if (vchiq_prepare_bulk_data(instance, bulk, offset, uoffset, size, dir)) - goto unlock_error_exit; - - /* - * Ensure that the bulk data record is visible to the peer - * before proceeding. - */ - wmb(); - - dev_dbg(state->dev, "core: %d: bt (%d->%d) %cx %x@%pad %pK\n", - state->id, service->localport, service->remoteport, - dir_char, size, &bulk->data, userdata); - - /* - * The slot mutex must be held when the service is being closed, so - * claim it here to ensure that isn't happening - */ - if (mutex_lock_killable(&state->slot_mutex)) { - status =3D -EAGAIN; - goto cancel_bulk_error_exit; - } - - if (service->srvstate !=3D VCHIQ_SRVSTATE_OPEN) - goto unlock_both_error_exit; - - payload[0] =3D lower_32_bits(bulk->data); - payload[1] =3D bulk->size; - status =3D queue_message(state, - NULL, - VCHIQ_MAKE_MSG(dir_msgtype, - service->localport, - service->remoteport), - memcpy_copy_callback, - &payload, - sizeof(payload), - QMFLAGS_IS_BLOCKING | - QMFLAGS_NO_MUTEX_LOCK | - QMFLAGS_NO_MUTEX_UNLOCK); + status =3D vchiq_bulk_xfer_queue_msg_interruptible(service, offset, uoffs= et, + size, userdata, mode, dir); if (status) - goto unlock_both_error_exit; - - queue->local_insert++; - - mutex_unlock(&state->slot_mutex); - mutex_unlock(&service->bulk_mutex); - - dev_dbg(state->dev, "core: %d: bt:%d %cx li=3D%x ri=3D%x p=3D%x\n", - state->id, service->localport, dir_char, queue->local_insert, - queue->remote_insert, queue->process); + goto error_exit; =20 vchiq_service_put(service); =20 @@ -3125,13 +3047,6 @@ int vchiq_bulk_transfer(struct vchiq_instance *insta= nce, unsigned int handle, =20 return status; =20 -unlock_both_error_exit: - mutex_unlock(&state->slot_mutex); -cancel_bulk_error_exit: - vchiq_complete_bulk(service->instance, bulk); -unlock_error_exit: - mutex_unlock(&service->bulk_mutex); - error_exit: if (service) vchiq_service_put(service); @@ -3294,6 +3209,116 @@ vchiq_release_message(struct vchiq_instance *instan= ce, unsigned int handle, } EXPORT_SYMBOL(vchiq_release_message); =20 +/* + * Prepares a bulk transfer to be queued. The function is interruptible an= d is + * intended to be called from user threads. It may return -EAGAIN to indic= ate + * that a signal has been received and the call should be retried after be= ing + * returned to user context. + */ +static int +vchiq_bulk_xfer_queue_msg_interruptible(struct vchiq_service *service, + void *offset, void __user *uoffset, + int size, void *userdata, + enum vchiq_bulk_mode mode, + enum vchiq_bulk_dir dir) +{ + struct vchiq_bulk_queue *queue; + struct vchiq_bulk *bulk; + struct vchiq_state *state =3D service->state; + const char dir_char =3D (dir =3D=3D VCHIQ_BULK_TRANSMIT) ? 't' : 'r'; + const int dir_msgtype =3D (dir =3D=3D VCHIQ_BULK_TRANSMIT) ? + VCHIQ_MSG_BULK_TX : VCHIQ_MSG_BULK_RX; + int status =3D -EINVAL; + int payload[2]; + + queue =3D (dir =3D=3D VCHIQ_BULK_TRANSMIT) ? + &service->bulk_tx : &service->bulk_rx; + + if (mutex_lock_killable(&service->bulk_mutex)) + return -EAGAIN; + + if (queue->local_insert =3D=3D queue->remove + VCHIQ_NUM_SERVICE_BULKS) { + VCHIQ_SERVICE_STATS_INC(service, bulk_stalls); + do { + mutex_unlock(&service->bulk_mutex); + if (wait_for_completion_interruptible(&service->bulk_remove_event)) + return -EAGAIN; + if (mutex_lock_killable(&service->bulk_mutex)) + return -EAGAIN; + } while (queue->local_insert =3D=3D queue->remove + + VCHIQ_NUM_SERVICE_BULKS); + } + + bulk =3D &queue->bulks[BULK_INDEX(queue->local_insert)]; + + bulk->mode =3D mode; + bulk->dir =3D dir; + bulk->userdata =3D userdata; + bulk->size =3D size; + bulk->actual =3D VCHIQ_BULK_ACTUAL_ABORTED; + + if (vchiq_prepare_bulk_data(service->instance, bulk, offset, uoffset, siz= e, dir)) + goto unlock_error_exit; + + /* + * Ensure that the bulk data record is visible to the peer + * before proceeding. + */ + wmb(); + + dev_dbg(state->dev, "core: %d: bt (%d->%d) %cx %x@%pad %pK\n", + state->id, service->localport, service->remoteport, + dir_char, size, &bulk->data, userdata); + + /* + * The slot mutex must be held when the service is being closed, so + * claim it here to ensure that isn't happening + */ + if (mutex_lock_killable(&state->slot_mutex)) { + status =3D -EAGAIN; + goto cancel_bulk_error_exit; + } + + if (service->srvstate !=3D VCHIQ_SRVSTATE_OPEN) + goto unlock_both_error_exit; + + payload[0] =3D lower_32_bits(bulk->data); + payload[1] =3D bulk->size; + status =3D queue_message(state, + NULL, + VCHIQ_MAKE_MSG(dir_msgtype, + service->localport, + service->remoteport), + memcpy_copy_callback, + &payload, + sizeof(payload), + QMFLAGS_IS_BLOCKING | + QMFLAGS_NO_MUTEX_LOCK | + QMFLAGS_NO_MUTEX_UNLOCK); + if (status) + goto unlock_both_error_exit; + + queue->local_insert++; + + mutex_unlock(&state->slot_mutex); + mutex_unlock(&service->bulk_mutex); + + dev_dbg(state->dev, "core: %d: bt:%d %cx li=3D%x ri=3D%x p=3D%x\n", + state->id, service->localport, dir_char, queue->local_insert, + queue->remote_insert, queue->process); + + return status; + +unlock_both_error_exit: + mutex_unlock(&state->slot_mutex); +cancel_bulk_error_exit: + vchiq_complete_bulk(service->instance, bulk); +unlock_error_exit: + mutex_unlock(&service->bulk_mutex); + + return status; +} + static void release_message_sync(struct vchiq_state *state, struct vchiq_header *heade= r) { --=20 2.45.0 From nobody Sun Feb 8 23:06:57 2026 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6C468189BA9 for ; Fri, 23 Aug 2024 15:14:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724426078; cv=none; b=C0RCTpsB1BbUrRIDF/lLOjaFrnYRYVplWIawV3eIH8FV92oORJZGuN/cFpT44s05R1GoUQ5TJvJ4OEwxpsiqZoIT7MiJgVQgi/38NqL0na1zZZmsci1nPyZ1RlcznxpfW2AKrCcAyO1BF8eSa1FTrVvB8ajCeRh4352mZrWvUr4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724426078; c=relaxed/simple; bh=uczQTHc/hJKZFwcpphfWQ48EAdA8J/cRvXojkpCAitw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=M4R9rMrM2hF5k6F+Un4NGNzK+TwbG1vtrLxjrweY/1rZCvfH5Rz6xRRcLumndI4OSBlwRv4S0x9nNEmRY09g5p8X/g+OcGQkUmLGRNckCvIgyuyJYEW0R7Q5kKUMzLqkvBM48EyVQxxhDEqNCpfss/UMIRYRptWBNPuOcrWnSzQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=BKP4s+yN; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="BKP4s+yN" Received: from [192.168.29.25] (unknown [IPv6:2405:201:2015:f873:55f8:639e:8e9f:12ec]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id CF063E7C; Fri, 23 Aug 2024 17:13:28 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1724426011; bh=uczQTHc/hJKZFwcpphfWQ48EAdA8J/cRvXojkpCAitw=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=BKP4s+yNmARUq6QppbA6TIMDB57XvoieF0d54rOKuENxAGUf5dwE6hFgCzoIGFaTZ B89ucq8WrQGQsVROqvzWVz9MriG7TlZn90yIuK0ar7y14Oq8+PJVzAAECAlotMu6A/ Ii2v/M9C2MEvtUiOApnkpdu4gyYAzLyAoanbTpxc= From: Umang Jain Date: Fri, 23 Aug 2024 20:44:23 +0530 Subject: [PATCH 3/7] staging: vchiq_core: Factor out bulk transfer for blocking mode 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: <20240823-to_sent2-v1-3-8bc182a0adaf@ideasonboard.com> References: <20240823-to_sent2-v1-0-8bc182a0adaf@ideasonboard.com> In-Reply-To: <20240823-to_sent2-v1-0-8bc182a0adaf@ideasonboard.com> To: Florian Fainelli , Broadcom internal kernel review list , Greg Kroah-Hartman Cc: linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Dan Carpenter , Laurent Pinchart , Kieran Bingham , Arnd Bergmann , Stefan Wahren , Dave Stevenson , Phil Elwell , Umang Jain X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724426064; l=5364; i=umang.jain@ideasonboard.com; s=20240731; h=from:subject:message-id; bh=uczQTHc/hJKZFwcpphfWQ48EAdA8J/cRvXojkpCAitw=; b=HkrgIOoi3sFW3j4ZN1ZTzjTeRdIGA81r75Fl+wbVWWhuah28u+fwXQo0CWYNa4oQt91a0Qaqa D1tSByuXtfRBAvYqohx80Lm62D3VJoGEKoc0gNphMKqBbT9TsZ1YS2b X-Developer-Key: i=umang.jain@ideasonboard.com; a=ed25519; pk=7pvnIBNsDpFUMiph0Vlhrr01+rAn5fSIn/QtDeLeXL0= Factor out bulk transfer for blocking mode into a separate dedicated function bulk_xfer_blocking_interruptible(). It is suffixed by "_interruptible" to denote that it can be interrupted and -EAGAIN can be returned. It would be up to the users of the function to retry the call in those cases. Adjust the calls to vchiq-dev.c ioctl interface and vchiq_arm.c for blocking bulk transfers. Signed-off-by: Umang Jain --- .../vc04_services/interface/vchiq_arm/vchiq_arm.c | 5 +-- .../vc04_services/interface/vchiq_arm/vchiq_core.c | 48 ++++++++++++++++++= +--- .../vc04_services/interface/vchiq_arm/vchiq_core.h | 5 +++ .../vc04_services/interface/vchiq_arm/vchiq_dev.c | 6 +++ 4 files changed, 55 insertions(+), 9 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c = b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c index c4d97dbf6ba8..e9b9c76381dc 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c @@ -968,9 +968,8 @@ vchiq_blocking_bulk_transfer(struct vchiq_instance *ins= tance, unsigned int handl return -ENOMEM; } =20 - ret =3D vchiq_bulk_transfer(instance, handle, data, NULL, size, - &waiter->bulk_waiter, - VCHIQ_BULK_MODE_BLOCKING, dir); + ret =3D bulk_xfer_blocking_interruptible(instance, handle, data, NULL, si= ze, + &waiter->bulk_waiter, dir); if ((ret !=3D -EAGAIN) || fatal_signal_pending(current) || !waiter->bulk_= waiter.bulk) { struct vchiq_bulk *bulk =3D waiter->bulk_waiter.bulk; =20 diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c= b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c index c31f5d773fa5..341a06997848 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c @@ -2985,6 +2985,48 @@ vchiq_remove_service(struct vchiq_instance *instance= , unsigned int handle) return status; } =20 +int +bulk_xfer_blocking_interruptible(struct vchiq_instance *instance, unsigned= int handle, + void *offset, void __user *uoffset, int size, + void __user *userdata, enum vchiq_bulk_dir dir) +{ + struct vchiq_service *service =3D find_service_by_handle(instance, handle= ); + struct bulk_waiter *bulk_waiter =3D NULL; + enum vchiq_bulk_mode mode =3D VCHIQ_BULK_MODE_BLOCKING; + int status =3D -EINVAL; + + if (!service) + goto error_exit; + + if (service->srvstate !=3D VCHIQ_SRVSTATE_OPEN) + goto error_exit; + + if (!offset && !uoffset) + goto error_exit; + + if (vchiq_check_service(service)) + goto error_exit; + + bulk_waiter =3D userdata; + init_completion(&bulk_waiter->event); + bulk_waiter->actual =3D 0; + bulk_waiter->bulk =3D NULL; + + status =3D vchiq_bulk_xfer_queue_msg_interruptible(service, offset, uoffs= et, size, + userdata, mode, dir); + if (status) + goto error_exit; + + vchiq_service_put(service); + + return 0; + +error_exit: + if (service) + vchiq_service_put(service); + return status; +} + /* * This function may be called by kernel threads or user threads. * User threads may receive -EAGAIN to indicate that a signal has been @@ -3018,12 +3060,6 @@ int vchiq_bulk_transfer(struct vchiq_instance *insta= nce, unsigned int handle, case VCHIQ_BULK_MODE_NOCALLBACK: case VCHIQ_BULK_MODE_CALLBACK: break; - case VCHIQ_BULK_MODE_BLOCKING: - bulk_waiter =3D userdata; - init_completion(&bulk_waiter->event); - bulk_waiter->actual =3D 0; - bulk_waiter->bulk =3D NULL; - break; default: goto error_exit; } diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h= b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h index 1fda8631d1b6..ff3559c3d1ba 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h @@ -474,6 +474,11 @@ extern int bulk_xfer_waiting_interruptible(struct vchiq_instance *instance, unsigned = int handle, void *userdata); =20 +extern int +bulk_xfer_blocking_interruptible(struct vchiq_instance *instance, unsigned= int handle, + void *offset, void __user *uoffset, int size, + void __user *userdata, enum vchiq_bulk_dir dir); + extern int vchiq_bulk_transfer(struct vchiq_instance *instance, unsigned int handle, = void *offset, void __user *uoffset, int size, void *userdata, enum vchiq_bulk_mode= mode, diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c = b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c index 445b7938eea3..1bff97ad28fa 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c @@ -304,6 +304,12 @@ static int vchiq_irq_queue_bulk_tx_rx(struct vchiq_ins= tance *instance, } =20 userdata =3D &waiter->bulk_waiter; + + status =3D bulk_xfer_blocking_interruptible(instance, args->handle, + NULL, args->data, args->size, + userdata, dir); + + goto bulk_transfer_handled; } else if (args->mode =3D=3D VCHIQ_BULK_MODE_WAITING) { mutex_lock(&instance->bulk_waiter_list_mutex); list_for_each_entry(iter, &instance->bulk_waiter_list, --=20 2.45.0 From nobody Sun Feb 8 23:06:57 2026 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A8A9C18B466 for ; Fri, 23 Aug 2024 15:14:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724426080; cv=none; b=l4WezSgLI/qKvgI0eXRt6UhPSd1BMnPck2hJipPh9qvZMK7U5WWPasLmt3taw+mCrma3ih5KrX9vMoEeB56WXzJQNLpxwcMdBN1eiXee3vDTgG+3DBfESyHq5wHiCKferYgAjwSi/H23NL8pkcKPYcgT+86SLJVJXlhe43/XDM8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724426080; c=relaxed/simple; bh=LoPuo+reaO+XM9ZvWtpE+KdjZN48B6ryoWNNMPGVE2w=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=dRgldLNa1TPDPS3C40+s5dWNiJH39cIPUmOM7z/nXOHPOVUtsXGjpjQlp2SGCMhbHOSKUNSL45nckN/aKyWnTKmYIe5xWNrKl8LludAdwprFw+OgrXDzg0NSBpXa7IQsbYtn+QZsV95UgW7zZkKtbcv7Url2ndeutcpWJsD0EeM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=ooZbMPgB; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="ooZbMPgB" Received: from [192.168.29.25] (unknown [IPv6:2405:201:2015:f873:55f8:639e:8e9f:12ec]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 674182D5; Fri, 23 Aug 2024 17:13:31 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1724426013; bh=LoPuo+reaO+XM9ZvWtpE+KdjZN48B6ryoWNNMPGVE2w=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=ooZbMPgBBi6loLBV6mgo8ClDAAJtMMIeNeFSwh3w67Cwd6myHMLD5FCkO18KGHicM sGXU7OUK4do4LEoA2m4VVNgH/Hh5UTJuvv6Sy1ANwUqx+YtbSffdxebTwUXr9j4NDP FtE7CCYFwW6uRYbzSRRShu5mZQhwYnPniN5lBwXs= From: Umang Jain Date: Fri, 23 Aug 2024 20:44:24 +0530 Subject: [PATCH 4/7] staging: vchiq_core: Factor out bulk transfer for (no/)callback mode 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: <20240823-to_sent2-v1-4-8bc182a0adaf@ideasonboard.com> References: <20240823-to_sent2-v1-0-8bc182a0adaf@ideasonboard.com> In-Reply-To: <20240823-to_sent2-v1-0-8bc182a0adaf@ideasonboard.com> To: Florian Fainelli , Broadcom internal kernel review list , Greg Kroah-Hartman Cc: linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Dan Carpenter , Laurent Pinchart , Kieran Bingham , Arnd Bergmann , Stefan Wahren , Dave Stevenson , Phil Elwell , Umang Jain X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724426064; l=5975; i=umang.jain@ideasonboard.com; s=20240731; h=from:subject:message-id; bh=LoPuo+reaO+XM9ZvWtpE+KdjZN48B6ryoWNNMPGVE2w=; b=fzN8eQP5N69C8NWCb+6iYuOnvJ2fotCeYzNJkr4Jw7hzBJtWspPeS/A9tF+BYt8B98QZhSM6m dFIRS6wz1TCAEQ1SwQeV0yNjvpS80oLj1NewWpjHTyyRIfkIxeePpwN X-Developer-Key: i=umang.jain@ideasonboard.com; a=ed25519; pk=7pvnIBNsDpFUMiph0Vlhrr01+rAn5fSIn/QtDeLeXL0= Factor out bulk transfer for VCHIQ_BULK_MODE_NOCALLBACK and VCHIQ_BULK_MODE_CALLBACK mode into a separate dedicated function bulk_xfer_callback_interruptible(). It is suffixed by "_interruptible" to denote that it can be interrupted and -EAGAIN can be returned. It would be up to the users of the function to retry the call in those cases. bulk_xfer_callback_interruptible() also takes in 'mode' parameter to differentiate between VCHIQ_BULK_MODE_NOCALLBACK and VCHIQ_BULK_MODE_CALLBACK, which then is directly passed to vchiq_bulk_xfer_queue_msg_interruptible() inside the function. Adjust the calls to vchiq-dev.c ioctl interface and vchiq_arm.c for the respective bulk transfers. Signed-off-by: Umang Jain --- .../vc04_services/interface/vchiq_arm/vchiq_arm.c | 15 ++++---- .../vc04_services/interface/vchiq_arm/vchiq_core.c | 40 ++++++++++++++++++= ++++ .../vc04_services/interface/vchiq_arm/vchiq_core.h | 6 ++++ .../vc04_services/interface/vchiq_arm/vchiq_dev.c | 6 ++++ 4 files changed, 60 insertions(+), 7 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c = b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c index e9b9c76381dc..5210ce8d269e 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c @@ -857,10 +857,10 @@ vchiq_bulk_transmit(struct vchiq_instance *instance, = unsigned int handle, const switch (mode) { case VCHIQ_BULK_MODE_NOCALLBACK: case VCHIQ_BULK_MODE_CALLBACK: - ret =3D vchiq_bulk_transfer(instance, handle, - (void *)data, NULL, - size, userdata, mode, - VCHIQ_BULK_TRANSMIT); + ret =3D bulk_xfer_callback_interruptible(instance, handle, + (void *)data, NULL, + size, mode, userdata, + VCHIQ_BULK_TRANSMIT); break; case VCHIQ_BULK_MODE_BLOCKING: ret =3D vchiq_blocking_bulk_transfer(instance, handle, (void *)data, si= ze, @@ -895,9 +895,10 @@ int vchiq_bulk_receive(struct vchiq_instance *instance= , unsigned int handle, switch (mode) { case VCHIQ_BULK_MODE_NOCALLBACK: case VCHIQ_BULK_MODE_CALLBACK: - ret =3D vchiq_bulk_transfer(instance, handle, data, NULL, - size, userdata, - mode, VCHIQ_BULK_RECEIVE); + ret =3D bulk_xfer_callback_interruptible(instance, handle, + (void *)data, NULL, + size, mode, userdata, + VCHIQ_BULK_RECEIVE); break; case VCHIQ_BULK_MODE_BLOCKING: ret =3D vchiq_blocking_bulk_transfer(instance, handle, (void *)data, si= ze, diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c= b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c index 341a06997848..0606561fd3d0 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c @@ -3027,6 +3027,46 @@ bulk_xfer_blocking_interruptible(struct vchiq_instan= ce *instance, unsigned int h return status; } =20 +int +bulk_xfer_callback_interruptible(struct vchiq_instance *instance, unsigned= int handle, + void *offset, void __user *uoffset, int size, + enum vchiq_bulk_mode mode, void *userdata, + enum vchiq_bulk_dir dir) +{ + struct vchiq_service *service =3D find_service_by_handle(instance, handle= ); + int status =3D -EINVAL; + + if (!service) + goto error_exit; + + if (mode !=3D VCHIQ_BULK_MODE_CALLBACK && + mode !=3D VCHIQ_BULK_MODE_NOCALLBACK) + goto error_exit; + + if (service->srvstate !=3D VCHIQ_SRVSTATE_OPEN) + goto error_exit; + + if (!offset && !uoffset) + goto error_exit; + + if (vchiq_check_service(service)) + goto error_exit; + + status =3D vchiq_bulk_xfer_queue_msg_interruptible(service, offset, uoffs= et, + size, userdata, mode, dir); + if (status) + goto error_exit; + + vchiq_service_put(service); + + return 0; + +error_exit: + if (service) + vchiq_service_put(service); + return status; +} + /* * This function may be called by kernel threads or user threads. * User threads may receive -EAGAIN to indicate that a signal has been diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h= b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h index ff3559c3d1ba..8aaf3c9d3dbe 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h @@ -479,6 +479,12 @@ bulk_xfer_blocking_interruptible(struct vchiq_instance= *instance, unsigned int h void *offset, void __user *uoffset, int size, void __user *userdata, enum vchiq_bulk_dir dir); =20 +extern int +bulk_xfer_callback_interruptible(struct vchiq_instance *instance, unsigned= int handle, + void *offset, void __user *uoffset, int size, + enum vchiq_bulk_mode mode, void *userdata, + enum vchiq_bulk_dir dir); + extern int vchiq_bulk_transfer(struct vchiq_instance *instance, unsigned int handle, = void *offset, void __user *uoffset, int size, void *userdata, enum vchiq_bulk_mode= mode, diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c = b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c index 1bff97ad28fa..7ecfcaa85569 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c @@ -336,6 +336,12 @@ static int vchiq_irq_queue_bulk_tx_rx(struct vchiq_ins= tance *instance, goto bulk_transfer_handled; } else { userdata =3D args->userdata; + + status =3D bulk_xfer_callback_interruptible(instance, args->handle, + NULL, args->data, args->size, + args->mode, userdata, dir); + + goto bulk_transfer_handled; } =20 status =3D vchiq_bulk_transfer(instance, args->handle, NULL, args->data, = args->size, --=20 2.45.0 From nobody Sun Feb 8 23:06:57 2026 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 542F518BBAB for ; Fri, 23 Aug 2024 15:14:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724426082; cv=none; b=RnaC599UPts8RfRwMIWl+Vg4/kR198fdeLlxu5SHlJ+pqGuHsvgxt+ahGBOfdYy71yOzJkTj3Udhp/5b76Y7hOJW83gAoMIXtUTcfuOke3nsbPcfg6HRZEO3hnEUHOC9bVkgjYng8SHVy1AfEYlRbirGyl57V+PC4EMvZUKqqf4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724426082; c=relaxed/simple; bh=kkR6c42KOoPB7oIjiPbRTYTeAakudszPtaPz4h9QZMA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=mSqxTsrHnUzcznefcDe6GXJvdG1SbUEgfMWDlhirUN0HIv+4qrHTbjZnuGLVnII8zvTQ4sI/dqqH+wG3UCo0feYIxDgXWBg6V22MSoTwj/VyLxmFZzWGKOJGuN8awTqJtLQ6pPujlDdom4wyh7nIocyOZx5CaKnODyQ4QadU5Vs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=GkEVJanB; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="GkEVJanB" Received: from [192.168.29.25] (unknown [IPv6:2405:201:2015:f873:55f8:639e:8e9f:12ec]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id F3D95497; Fri, 23 Aug 2024 17:13:33 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1724426016; bh=kkR6c42KOoPB7oIjiPbRTYTeAakudszPtaPz4h9QZMA=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=GkEVJanBEtyoAqgH4lff8Li4e/4Iuf2G/cg/Oojcs7HGrbBxz1jCTLBBIjCBD2R+u YucN5DZ+Fx4ssVX9XgOPsMw6gJUO1qKNdZPz/3eohPx9c3/s3zQy3Flfgk0W9/BIFU STyGhLIx1ZlEwb7YjuGUU89EFL1+g1AVveND/+4o= From: Umang Jain Date: Fri, 23 Aug 2024 20:44:25 +0530 Subject: [PATCH 5/7] staging: vchiq_core: Drop vchiq_bulk_transfer() 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: <20240823-to_sent2-v1-5-8bc182a0adaf@ideasonboard.com> References: <20240823-to_sent2-v1-0-8bc182a0adaf@ideasonboard.com> In-Reply-To: <20240823-to_sent2-v1-0-8bc182a0adaf@ideasonboard.com> To: Florian Fainelli , Broadcom internal kernel review list , Greg Kroah-Hartman Cc: linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Dan Carpenter , Laurent Pinchart , Kieran Bingham , Arnd Bergmann , Stefan Wahren , Dave Stevenson , Phil Elwell , Umang Jain X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724426064; l=5111; i=umang.jain@ideasonboard.com; s=20240731; h=from:subject:message-id; bh=kkR6c42KOoPB7oIjiPbRTYTeAakudszPtaPz4h9QZMA=; b=m9rlD3OyL2xW+iDkMlADVprKCcUn1atnOBoc5HidcmlEYl9huJkAY6myRnLjcomWi0MqblWOW GEtte3Cq3tnDGQigl0UYSo/5u7o9rIIwadb564/N337gLSLaIQD5lDR X-Developer-Key: i=umang.jain@ideasonboard.com; a=ed25519; pk=7pvnIBNsDpFUMiph0Vlhrr01+rAn5fSIn/QtDeLeXL0= Drop vchiq_bulk_transfer() as every VCHIQ_BULK_MODE_* mode now have their own dedicated functions to execute bulk transfers. Also, drop the temporary label we introduced earlier in vchiq-dev.c to jump over the vchiq_bulk_transfer() call when each separate mode helper was being developed. Signed-off-by: Umang Jain --- .../vc04_services/interface/vchiq_arm/vchiq_core.c | 62 ------------------= ---- .../vc04_services/interface/vchiq_arm/vchiq_core.h | 5 -- .../vc04_services/interface/vchiq_arm/vchiq_dev.c | 10 ---- 3 files changed, 77 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c= b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c index 0606561fd3d0..43c6a214be86 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c @@ -3067,68 +3067,6 @@ bulk_xfer_callback_interruptible(struct vchiq_instan= ce *instance, unsigned int h return status; } =20 -/* - * This function may be called by kernel threads or user threads. - * User threads may receive -EAGAIN to indicate that a signal has been - * received and the call should be retried after being returned to user - * context. - * When called in blocking mode, the userdata field points to a bulk_waiter - * structure. - */ -int vchiq_bulk_transfer(struct vchiq_instance *instance, unsigned int hand= le, - void *offset, void __user *uoffset, int size, void *userdata, - enum vchiq_bulk_mode mode, enum vchiq_bulk_dir dir) -{ - struct vchiq_service *service =3D find_service_by_handle(instance, handle= ); - struct bulk_waiter *bulk_waiter =3D NULL; - struct vchiq_bulk *bulk; - int status =3D -EINVAL; - - if (!service) - goto error_exit; - - if (service->srvstate !=3D VCHIQ_SRVSTATE_OPEN) - goto error_exit; - - if (!offset && !uoffset) - goto error_exit; - - if (vchiq_check_service(service)) - goto error_exit; - - switch (mode) { - case VCHIQ_BULK_MODE_NOCALLBACK: - case VCHIQ_BULK_MODE_CALLBACK: - break; - default: - goto error_exit; - } - - status =3D vchiq_bulk_xfer_queue_msg_interruptible(service, offset, uoffs= et, - size, userdata, mode, dir); - if (status) - goto error_exit; - - vchiq_service_put(service); - - status =3D 0; - - if (bulk_waiter) { - bulk_waiter->bulk =3D bulk; - if (wait_for_completion_interruptible(&bulk_waiter->event)) - status =3D -EAGAIN; - else if (bulk_waiter->actual =3D=3D VCHIQ_BULK_ACTUAL_ABORTED) - status =3D -EINVAL; - } - - return status; - -error_exit: - if (service) - vchiq_service_put(service); - return status; -} - /* * This function is called by VCHIQ ioctl interface and is interruptible. * It may receive -EAGAIN to indicate that a signal has been received diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h= b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h index 8aaf3c9d3dbe..be85a15df9a7 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h @@ -485,11 +485,6 @@ bulk_xfer_callback_interruptible(struct vchiq_instance= *instance, unsigned int h enum vchiq_bulk_mode mode, void *userdata, enum vchiq_bulk_dir dir); =20 -extern int -vchiq_bulk_transfer(struct vchiq_instance *instance, unsigned int handle, = void *offset, - void __user *uoffset, int size, void *userdata, enum vchiq_bulk_mode= mode, - enum vchiq_bulk_dir dir); - extern void vchiq_dump_state(struct seq_file *f, struct vchiq_state *state); =20 diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c = b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c index 7ecfcaa85569..4d8432158259 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c @@ -308,8 +308,6 @@ static int vchiq_irq_queue_bulk_tx_rx(struct vchiq_inst= ance *instance, status =3D bulk_xfer_blocking_interruptible(instance, args->handle, NULL, args->data, args->size, userdata, dir); - - goto bulk_transfer_handled; } else if (args->mode =3D=3D VCHIQ_BULK_MODE_WAITING) { mutex_lock(&instance->bulk_waiter_list_mutex); list_for_each_entry(iter, &instance->bulk_waiter_list, @@ -332,22 +330,14 @@ static int vchiq_irq_queue_bulk_tx_rx(struct vchiq_in= stance *instance, userdata =3D &waiter->bulk_waiter; =20 status =3D bulk_xfer_waiting_interruptible(instance, args->handle, userd= ata); - - goto bulk_transfer_handled; } else { userdata =3D args->userdata; =20 status =3D bulk_xfer_callback_interruptible(instance, args->handle, NULL, args->data, args->size, args->mode, userdata, dir); - - goto bulk_transfer_handled; } =20 - status =3D vchiq_bulk_transfer(instance, args->handle, NULL, args->data, = args->size, - userdata, args->mode, dir); - -bulk_transfer_handled: if (!waiter) { ret =3D 0; goto out; --=20 2.45.0 From nobody Sun Feb 8 23:06:57 2026 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E0CCC18BC06 for ; Fri, 23 Aug 2024 15:14:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724426085; cv=none; b=U/hplM0UuuwvJxCelbNcMQ4gETy41ogAftPGdrF7NOG2lelxDLbI06MN/1Kc0C5e3b3nn8owMB72553ekcGmbNTXg40vt1uuPk1UV/3293iNiUi/EHQ0xVf4w/rEULbdZA4svbpVi49OI2pOKZ98Lhy1bAENasL9nW2qwDclBSs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724426085; c=relaxed/simple; bh=FuY4JrrtVry+i6FwzoUp0xVRKb3WmzVQh96lFM7/H8c=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=G/U7RHnzJddTPTk6OUFKvQn5HAB8HnUb/SGLhZnLQPbYOgUPDVQXezdoD0I9j4SFo8dLTWDAywYF5cHdRHXr/pydUZe8eW0TCuqx5D/PvO9wUTOSg4MWsC9M5tRgSrOT0Kg6HUiHvql/dNqHuRZGlVPktTfEOeUv0IRu7m/U+2A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=NnaYfUM1; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="NnaYfUM1" Received: from [192.168.29.25] (unknown [IPv6:2405:201:2015:f873:55f8:639e:8e9f:12ec]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 8DD46C8E; Fri, 23 Aug 2024 17:13:36 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1724426018; bh=FuY4JrrtVry+i6FwzoUp0xVRKb3WmzVQh96lFM7/H8c=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=NnaYfUM1ecQVaq0d+ahEYy79dbrA2ptgA1/7/GFGShAe8IuAZ/IjaLZH4zpim1n6M onI1C2RCJs5jB/Fl6XMPb9DqtabZZj5gLuMbzFrua5Rf8RrLH3ts1hcSIEQ+yTNguF CpZEoQZpWdJIFz82LUzgA2++hcxAOm0/O774tu4o= From: Umang Jain Date: Fri, 23 Aug 2024 20:44:26 +0530 Subject: [PATCH 6/7] staging: vchiq_core: Remove unused function argument 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: <20240823-to_sent2-v1-6-8bc182a0adaf@ideasonboard.com> References: <20240823-to_sent2-v1-0-8bc182a0adaf@ideasonboard.com> In-Reply-To: <20240823-to_sent2-v1-0-8bc182a0adaf@ideasonboard.com> To: Florian Fainelli , Broadcom internal kernel review list , Greg Kroah-Hartman Cc: linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Dan Carpenter , Laurent Pinchart , Kieran Bingham , Arnd Bergmann , Stefan Wahren , Dave Stevenson , Phil Elwell , Umang Jain X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724426064; l=1745; i=umang.jain@ideasonboard.com; s=20240731; h=from:subject:message-id; bh=FuY4JrrtVry+i6FwzoUp0xVRKb3WmzVQh96lFM7/H8c=; b=s6EOD48L5pUZyfs+LJAIqeLH0I1oCG7QmrNiemyJQhRlW3QuLacsmGK8HDK9tS95woDJB3h18 IAlEJYVf0h9CeHNNVHxhcmVNTKnWJPudmmJFRKuk5/bEWYRKqlqv+hs X-Developer-Key: i=umang.jain@ideasonboard.com; a=ed25519; pk=7pvnIBNsDpFUMiph0Vlhrr01+rAn5fSIn/QtDeLeXL0= The argument 'is_blocking' in queue_message_sync() is not used in the function. Drop it. Signed-off-by: Umang Jain Reviewed-by: Stefan Wahren --- drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c= b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c index 43c6a214be86..84631878f77d 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c @@ -1146,7 +1146,7 @@ queue_message_sync(struct vchiq_state *state, struct = vchiq_service *service, int msgid, ssize_t (*copy_callback)(void *context, void *dest, size_t offset, size_t maxsize), - void *context, int size, int is_blocking) + void *context, int size) { struct vchiq_shared_state *local; struct vchiq_header *header; @@ -1524,7 +1524,7 @@ parse_open(struct vchiq_state *state, struct vchiq_he= ader *header) /* Acknowledge the OPEN */ if (service->sync) { if (queue_message_sync(state, NULL, openack_id, memcpy_copy_callback, - &ack_payload, sizeof(ack_payload), 0) =3D=3D -EAGAIN) + &ack_payload, sizeof(ack_payload)) =3D=3D -EAGAIN) goto bail_not_ready; =20 /* The service is now open */ @@ -3150,7 +3150,7 @@ vchiq_queue_message(struct vchiq_instance *instance, = unsigned int handle, break; case VCHIQ_SRVSTATE_OPENSYNC: status =3D queue_message_sync(service->state, service, data_id, - copy_callback, context, size, 1); + copy_callback, context, size); break; default: status =3D -EINVAL; --=20 2.45.0 From nobody Sun Feb 8 23:06:57 2026 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C25AD18BC2F for ; Fri, 23 Aug 2024 15:14:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724426088; cv=none; b=hro9Adrnr2z3Lxcsaq/rOQmjkvMILJnpnX4DrNDGWYxsbQ6gYxOkQet3pUO6XqXl/zceO00BrpTbjuNGXvhdk5o2ixFz3/yPqCIiUVyRbOq4cSEhzTQk6lLUtGxeVsUkqNd/1HJNRsxJhwkcfPWBCFOKkTv5B1lLXlrhUscvToc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724426088; c=relaxed/simple; bh=ft5HmVJ271Ka/bJA/94LL3znx98d6bWSWFX0dUAPefw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=u9kI//vnz//tX3j9nkBPMtLPCuoLuNS2X+HaRtRsKS12dew2a1+HUSGyd1jlfdTp3ZXGuYC97ItAbAFFoAF+I79HGqYi/VX1nquszSYrOJBZslsvBTN0M3HSP8XnWy6VynQEBEBPfpdTnK3c8w70prfE1TKof2HAB8HWJw3hUac= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=Q3DZFXpc; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="Q3DZFXpc" Received: from [192.168.29.25] (unknown [IPv6:2405:201:2015:f873:55f8:639e:8e9f:12ec]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 29C2F2D5; Fri, 23 Aug 2024 17:13:39 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1724426021; bh=ft5HmVJ271Ka/bJA/94LL3znx98d6bWSWFX0dUAPefw=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Q3DZFXpclHdZ/+6e4Jd18ji1LPG6XHt6HoeugzKlc1vCDyuPyKukYEfbts7zoTRsJ IMWj87TkkD21HmPnkkOM3XufvajTkaKTv73XwZGGQW82o5pDm3iCDoyPzAP08aGxRc uYEopsfFomI9/abZflIW58K6KfGmX8enyjRpw9f8= From: Umang Jain Date: Fri, 23 Aug 2024 20:44:27 +0530 Subject: [PATCH 7/7] staging: vchiq_core: Pass enumerated flag instead of int 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: <20240823-to_sent2-v1-7-8bc182a0adaf@ideasonboard.com> References: <20240823-to_sent2-v1-0-8bc182a0adaf@ideasonboard.com> In-Reply-To: <20240823-to_sent2-v1-0-8bc182a0adaf@ideasonboard.com> To: Florian Fainelli , Broadcom internal kernel review list , Greg Kroah-Hartman Cc: linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Dan Carpenter , Laurent Pinchart , Kieran Bingham , Arnd Bergmann , Stefan Wahren , Dave Stevenson , Phil Elwell , Umang Jain X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724426064; l=1116; i=umang.jain@ideasonboard.com; s=20240731; h=from:subject:message-id; bh=ft5HmVJ271Ka/bJA/94LL3znx98d6bWSWFX0dUAPefw=; b=706rLwU+aQ7hCnwi1dFxvBR3MCVDFdJxF5p7v54O82gJEHTRCNQvzEUFefEXbgDTezf176Ldi 5FZTvpp/mEMDk9U3lAXJI0dnlAtyS/HHN9x78XUHnnRvtNZpX/iqfW3 X-Developer-Key: i=umang.jain@ideasonboard.com; a=ed25519; pk=7pvnIBNsDpFUMiph0Vlhrr01+rAn5fSIn/QtDeLeXL0= Pass proper enumerated flag which exists, instead of an integer while calling queue_message(). It helps with readability of the code. Signed-off-by: Umang Jain Reviewed-by: Stefan Wahren --- drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c= b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c index 84631878f77d..54e21a4273b8 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c @@ -3146,7 +3146,8 @@ vchiq_queue_message(struct vchiq_instance *instance, = unsigned int handle, switch (service->srvstate) { case VCHIQ_SRVSTATE_OPEN: status =3D queue_message(service->state, service, data_id, - copy_callback, context, size, 1); + copy_callback, context, size, + QMFLAGS_IS_BLOCKING); break; case VCHIQ_SRVSTATE_OPENSYNC: status =3D queue_message_sync(service->state, service, data_id, --=20 2.45.0