From patchwork Fri Aug 23 15:14:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 13775410 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 221B3C52D7C for ; Fri, 23 Aug 2024 15:17:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=D8TBtZLKLgo7B0UwuEMMTDI8E8CGBzrii9pivN5kru0=; b=l1AmoOv2s30KSAcA47aeAPy/zE BHohT2nm5lR8ayN/v4/xHYwsr8oXNCVKQsSPcZiKkjYLEXbyUFDJ7aB4xWAFpmNyosVr23NM2vfhq IKbZhkYgXaN7LO85Hsli6UkwGNVdCjcomQPKF2lEuTJxqRnZbwfmqJUe0UzQ6pewVY3ckKz6MqrkF ll3drqFNURtHzQMY2Uiw9Qq1TZlgIsdYAJcPPB5F5N/BOjwKXSoKr0iXVQvw8PSSLB2ZkOfs94/r5 00Dhde9eDs8CSc7RM8kejgaEvxbGnJCnCi8+LO6TBMOwKoXng1k2gxtTZfr7MelG7bNl3s5UcJcum CU1vDCkQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1shW2F-0000000HGWx-0onH; Fri, 23 Aug 2024 15:17:07 +0000 Received: from perceval.ideasonboard.com ([213.167.242.64]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1shVzn-0000000HFhY-0KOQ; Fri, 23 Aug 2024 15:14:36 +0000 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 MIME-Version: 1.0 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= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240823_081435_319424_5EC01BEE X-CRM114-Status: GOOD ( 14.94 ) 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 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 *instance, unsigned int handle, bulk_waiter->actual = 0; bulk_waiter->bulk = NULL; break; - case VCHIQ_BULK_MODE_WAITING: - bulk_waiter = userdata; - bulk = bulk_waiter->bulk; - goto waiting; default: goto error_exit; } @@ -3115,7 +3111,6 @@ int vchiq_bulk_transfer(struct vchiq_instance *instance, unsigned int handle, state->id, service->localport, dir_char, queue->local_insert, queue->remote_insert, queue->process); -waiting: vchiq_service_put(service); status = 0; @@ -3143,6 +3138,53 @@ int vchiq_bulk_transfer(struct vchiq_instance *instance, unsigned int handle, 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 + * 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 = find_service_by_handle(instance, handle); + struct bulk_waiter *bulk_waiter = NULL; + struct vchiq_bulk *bulk; + int status = -EINVAL; + + if (!service) + goto error_exit; + + if (!userdata) + goto error_exit; + + if (service->srvstate != VCHIQ_SRVSTATE_OPEN) + goto error_exit; + + if (vchiq_check_service(service)) + goto error_exit; + + bulk_waiter = userdata; + bulk = bulk_waiter->bulk; + + vchiq_service_put(service); + + status = 0; + + bulk_waiter->bulk = bulk; + if (wait_for_completion_interruptible(&bulk_waiter->event)) + status = -EAGAIN; + else if (bulk_waiter->actual == VCHIQ_BULK_ACTUAL_ABORTED) + status = -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, struct vchiq_instance *instan extern void remote_event_pollall(struct vchiq_state *state); +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_instance *instance, dev_dbg(service->state->dev, "arm: found bulk_waiter %pK for pid %d\n", waiter, current->pid); userdata = &waiter->bulk_waiter; + + status = bulk_xfer_waiting_interruptible(instance, args->handle, userdata); + + goto bulk_transfer_handled; } else { userdata = args->userdata; } @@ -331,6 +335,7 @@ static int vchiq_irq_queue_bulk_tx_rx(struct vchiq_instance *instance, status = vchiq_bulk_transfer(instance, args->handle, NULL, args->data, args->size, userdata, args->mode, dir); +bulk_transfer_handled: if (!waiter) { ret = 0; goto out; From patchwork Fri Aug 23 15:14:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 13775409 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 6C8A9C52D7C for ; Fri, 23 Aug 2024 15:16:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=g6lx3LRkaAEqu9xzjg0yH2gAwUt2lHDPA27TvqD+BkM=; b=GOUjncZ/MriyZMPo34O0p9IVQs YCCtJXoAWS0YynvYHV2HUzHYppkYMuwYwvrxn02EZlgHj1z5PE5L7bwW8PYFaOw1q1ySUPZBX+HnN IxdN/Z3TM0AJHEJi8mge9x40VACZZ6abnVp3m2UFL7JG5RzYJTgx2Zj8GTmgyGQxziqY4yeN/1uFK FUeK+U6VcD9ZoECkTGv5RIhEILkfvHqiDEN5uz5Msxrbs4jBWxnEzJAu7jcjdgWDG9J9OsRc8Et3h Lv/xLebDv04V5MHYBrxKTEoHYq0KM44mWrVxXrcDKTwI0KJFPa7uGD5pr7xO8ONnhQ7W7zuZ+66a5 ZPvV8Xhw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1shW1Q-0000000HGEj-3RnB; Fri, 23 Aug 2024 15:16:16 +0000 Received: from perceval.ideasonboard.com ([213.167.242.64]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1shVzm-0000000HFim-0NqN; Fri, 23 Aug 2024 15:14:35 +0000 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() MIME-Version: 1.0 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= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240823_081434_315611_2BD916FC X-CRM114-Status: GOOD ( 16.47 ) 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 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[] = { static void release_message_sync(struct vchiq_state *state, struct vchiq_header *header); +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 *instance, unsigned int handle, enum vchiq_bulk_mode mode, enum vchiq_bulk_dir dir) { struct vchiq_service *service = find_service_by_handle(instance, handle); - struct vchiq_bulk_queue *queue; - struct vchiq_bulk *bulk; - struct vchiq_state *state; struct bulk_waiter *bulk_waiter = NULL; - const char dir_char = (dir == VCHIQ_BULK_TRANSMIT) ? 't' : 'r'; - const int dir_msgtype = (dir == VCHIQ_BULK_TRANSMIT) ? - VCHIQ_MSG_BULK_TX : VCHIQ_MSG_BULK_RX; + struct vchiq_bulk *bulk; int status = -EINVAL; - int payload[2]; if (!service) goto error_exit; @@ -3027,89 +3028,10 @@ int vchiq_bulk_transfer(struct vchiq_instance *instance, unsigned int handle, goto error_exit; } - state = service->state; - - queue = (dir == VCHIQ_BULK_TRANSMIT) ? - &service->bulk_tx : &service->bulk_rx; - - if (mutex_lock_killable(&service->bulk_mutex)) { - status = -EAGAIN; - goto error_exit; - } - - if (queue->local_insert == 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 = -EAGAIN; - goto error_exit; - } - if (mutex_lock_killable(&service->bulk_mutex)) { - status = -EAGAIN; - goto error_exit; - } - } while (queue->local_insert == queue->remove + - VCHIQ_NUM_SERVICE_BULKS); - } - - bulk = &queue->bulks[BULK_INDEX(queue->local_insert)]; - - bulk->mode = mode; - bulk->dir = dir; - bulk->userdata = userdata; - bulk->size = size; - bulk->actual = 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 = -EAGAIN; - goto cancel_bulk_error_exit; - } - - if (service->srvstate != VCHIQ_SRVSTATE_OPEN) - goto unlock_both_error_exit; - - payload[0] = lower_32_bits(bulk->data); - payload[1] = bulk->size; - status = 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 = vchiq_bulk_xfer_queue_msg_interruptible(service, offset, uoffset, + 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=%x ri=%x p=%x\n", - state->id, service->localport, dir_char, queue->local_insert, - queue->remote_insert, queue->process); + goto error_exit; vchiq_service_put(service); @@ -3125,13 +3047,6 @@ int vchiq_bulk_transfer(struct vchiq_instance *instance, unsigned int handle, 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); - error_exit: if (service) vchiq_service_put(service); @@ -3294,6 +3209,116 @@ vchiq_release_message(struct vchiq_instance *instance, unsigned int handle, } EXPORT_SYMBOL(vchiq_release_message); +/* + * Prepares a bulk transfer to be queued. The function is interruptible and is + * intended to be called from user threads. It may return -EAGAIN to indicate + * that a signal has been received and the call should be retried after being + * 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 = service->state; + const char dir_char = (dir == VCHIQ_BULK_TRANSMIT) ? 't' : 'r'; + const int dir_msgtype = (dir == VCHIQ_BULK_TRANSMIT) ? + VCHIQ_MSG_BULK_TX : VCHIQ_MSG_BULK_RX; + int status = -EINVAL; + int payload[2]; + + queue = (dir == VCHIQ_BULK_TRANSMIT) ? + &service->bulk_tx : &service->bulk_rx; + + if (mutex_lock_killable(&service->bulk_mutex)) + return -EAGAIN; + + if (queue->local_insert == 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 == queue->remove + + VCHIQ_NUM_SERVICE_BULKS); + } + + bulk = &queue->bulks[BULK_INDEX(queue->local_insert)]; + + bulk->mode = mode; + bulk->dir = dir; + bulk->userdata = userdata; + bulk->size = size; + bulk->actual = VCHIQ_BULK_ACTUAL_ABORTED; + + if (vchiq_prepare_bulk_data(service->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 = -EAGAIN; + goto cancel_bulk_error_exit; + } + + if (service->srvstate != VCHIQ_SRVSTATE_OPEN) + goto unlock_both_error_exit; + + payload[0] = lower_32_bits(bulk->data); + payload[1] = bulk->size; + status = 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=%x ri=%x p=%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 *header) { From patchwork Fri Aug 23 15:14:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 13775412 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 8173AC531DC for ; Fri, 23 Aug 2024 15:18:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=isq8Ou/bcysSQPxeMTczXjp+Mov2kFy0XVewYzmOXKA=; b=jnPnGFFgEYgOehSc17kFKNLfDK gUZ70kr4Uv1vWYI4R5CLW0hoxlq5pSjjaXHwHSb/bTv49oWlxY7xgw89m/v3+E0seaye+O1BgqaVC o9O1HmLT6Fd1xgpkW9GhgcMdfbb4R0uY1LfjxXZDdQ5HfDwyaVLmPNqtDZxJU+oq1J6vd8rm6jihM qmZ6+A84R7cW6hVjX56NaL9EVlteWBo8jfrAcguiHHkHu8h/BZe90MON1g84/uQNbG1fZZvvIxLsZ 5LddQKhUTSbUzxH+xGbqRT03ul/z71Y6Vjaj9pdJVbYJloO9F7NRM721zmjFvccR+dqQ8NtbfasOh lxN3AKrg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1shW2y-0000000HGef-1dbU; Fri, 23 Aug 2024 15:17:52 +0000 Received: from perceval.ideasonboard.com ([213.167.242.64]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1shVzo-0000000HFja-0TOQ; Fri, 23 Aug 2024 15:14:37 +0000 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 MIME-Version: 1.0 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= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240823_081436_337031_3E688B10 X-CRM114-Status: GOOD ( 13.96 ) 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 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 *instance, unsigned int handl return -ENOMEM; } - ret = vchiq_bulk_transfer(instance, handle, data, NULL, size, - &waiter->bulk_waiter, - VCHIQ_BULK_MODE_BLOCKING, dir); + ret = bulk_xfer_blocking_interruptible(instance, handle, data, NULL, size, + &waiter->bulk_waiter, dir); if ((ret != -EAGAIN) || fatal_signal_pending(current) || !waiter->bulk_waiter.bulk) { struct vchiq_bulk *bulk = waiter->bulk_waiter.bulk; 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; } +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 = find_service_by_handle(instance, handle); + struct bulk_waiter *bulk_waiter = NULL; + enum vchiq_bulk_mode mode = VCHIQ_BULK_MODE_BLOCKING; + int status = -EINVAL; + + if (!service) + goto error_exit; + + if (service->srvstate != VCHIQ_SRVSTATE_OPEN) + goto error_exit; + + if (!offset && !uoffset) + goto error_exit; + + if (vchiq_check_service(service)) + goto error_exit; + + bulk_waiter = userdata; + init_completion(&bulk_waiter->event); + bulk_waiter->actual = 0; + bulk_waiter->bulk = NULL; + + status = vchiq_bulk_xfer_queue_msg_interruptible(service, offset, uoffset, 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 *instance, unsigned int handle, case VCHIQ_BULK_MODE_NOCALLBACK: case VCHIQ_BULK_MODE_CALLBACK: break; - case VCHIQ_BULK_MODE_BLOCKING: - bulk_waiter = userdata; - init_completion(&bulk_waiter->event); - bulk_waiter->actual = 0; - bulk_waiter->bulk = 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); +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_instance *instance, } userdata = &waiter->bulk_waiter; + + status = bulk_xfer_blocking_interruptible(instance, args->handle, + NULL, args->data, args->size, + userdata, dir); + + goto bulk_transfer_handled; } else if (args->mode == VCHIQ_BULK_MODE_WAITING) { mutex_lock(&instance->bulk_waiter_list_mutex); list_for_each_entry(iter, &instance->bulk_waiter_list, From patchwork Fri Aug 23 15:14:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 13775415 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 D2AECC531DC for ; Fri, 23 Aug 2024 15:21:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ZwEYVGTL3KZ6nUt0DyTP0zIaYPsX7BI6ruHEbqz/vfo=; b=ScC4Ynrl2GEd9PhZdEyE/UahqE PtbEI+J6eaiM2hBWs7Nc3uTQ9QIGLc1BIsgJrdFwuh3Hu5I1kiWnyJ74mCs7Xjg0RstCqPMFh2325 qogFpyyZkYgnBUvHO2r2n7QitS8S6JrCVrxY9myu0fXRavdDMhix6fkz+2cCfICcx93kVkNmPosdX B/hmeMexMCUdbsaMuGmsMTZj8rzgFAPXsWFa+muZeZ/g94wEHRhVYdQeHLQQtdCkhdTXrlisHXrXM lBkuEAzj7+sKJtMAaLSpvxuKhrer3OXILMauV2wisqL9zSr8iOkryrTW9WbOZmwGV+Uso2zLs+PB+ 37gzZkrQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1shW5p-0000000HHAS-1x8d; Fri, 23 Aug 2024 15:20:49 +0000 Received: from perceval.ideasonboard.com ([213.167.242.64]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1shVzq-0000000HFkX-2rp6; Fri, 23 Aug 2024 15:14:41 +0000 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 MIME-Version: 1.0 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= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240823_081438_905667_D49C52B5 X-CRM114-Status: GOOD ( 13.65 ) 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 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 = vchiq_bulk_transfer(instance, handle, - (void *)data, NULL, - size, userdata, mode, - VCHIQ_BULK_TRANSMIT); + ret = bulk_xfer_callback_interruptible(instance, handle, + (void *)data, NULL, + size, mode, userdata, + VCHIQ_BULK_TRANSMIT); break; case VCHIQ_BULK_MODE_BLOCKING: ret = vchiq_blocking_bulk_transfer(instance, handle, (void *)data, size, @@ -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 = vchiq_bulk_transfer(instance, handle, data, NULL, - size, userdata, - mode, VCHIQ_BULK_RECEIVE); + ret = bulk_xfer_callback_interruptible(instance, handle, + (void *)data, NULL, + size, mode, userdata, + VCHIQ_BULK_RECEIVE); break; case VCHIQ_BULK_MODE_BLOCKING: ret = vchiq_blocking_bulk_transfer(instance, handle, (void *)data, size, 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_instance *instance, unsigned int h return status; } +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 = find_service_by_handle(instance, handle); + int status = -EINVAL; + + if (!service) + goto error_exit; + + if (mode != VCHIQ_BULK_MODE_CALLBACK && + mode != VCHIQ_BULK_MODE_NOCALLBACK) + goto error_exit; + + if (service->srvstate != VCHIQ_SRVSTATE_OPEN) + goto error_exit; + + if (!offset && !uoffset) + goto error_exit; + + if (vchiq_check_service(service)) + goto error_exit; + + status = vchiq_bulk_xfer_queue_msg_interruptible(service, offset, uoffset, + 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); +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_instance *instance, goto bulk_transfer_handled; } else { userdata = args->userdata; + + status = bulk_xfer_callback_interruptible(instance, args->handle, + NULL, args->data, args->size, + args->mode, userdata, dir); + + goto bulk_transfer_handled; } status = vchiq_bulk_transfer(instance, args->handle, NULL, args->data, args->size, From patchwork Fri Aug 23 15:14:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 13775413 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 53C6AC52D7C for ; Fri, 23 Aug 2024 15:19:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=uFoBf27mmGfWuI3VdAgNOqjoA9C+q0V9DSHa0UM5b6k=; b=brL8MmiiAdi/b7h/IRyobtUJ90 EBoIwfR/x7YbVVcjrNuopC4S5WfxuH22829qe/M+aXeMbwOG2f287+vnkFIFsO3VenHk+tm+TMNIh lU4iQ1c/QWdIhTKYc3MU99Xm1oHVonrn5VjRqIW95JRTNsz7pqTrG+RZFrq+lt87G+nwOryYbuqkV MJ/OCEwdUEVCI0F9PPykQSfTFnv5wELxqW61vQYFx3V7sBjqtm/EBFeRRog8AbezijN7M74KPzBo9 CgFtuUrn9JBkKgCd1AVJyalnZo7BrmxUAAFsRGQNxfU6n3Kw9JEDAvVvEsOZl3D/3EnzhuYK1sPOv lUZ63rJg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1shW46-0000000HGt5-0JBl; Fri, 23 Aug 2024 15:19:02 +0000 Received: from perceval.ideasonboard.com ([213.167.242.64]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1shVzt-0000000HFle-1WV9; Fri, 23 Aug 2024 15:14:43 +0000 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() MIME-Version: 1.0 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= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240823_081441_691340_663561CB X-CRM114-Status: GOOD ( 13.02 ) 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 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_instance *instance, unsigned int h 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 - * 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 handle, - void *offset, void __user *uoffset, int size, void *userdata, - enum vchiq_bulk_mode mode, enum vchiq_bulk_dir dir) -{ - struct vchiq_service *service = find_service_by_handle(instance, handle); - struct bulk_waiter *bulk_waiter = NULL; - struct vchiq_bulk *bulk; - int status = -EINVAL; - - if (!service) - goto error_exit; - - if (service->srvstate != 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 = vchiq_bulk_xfer_queue_msg_interruptible(service, offset, uoffset, - size, userdata, mode, dir); - if (status) - goto error_exit; - - vchiq_service_put(service); - - status = 0; - - if (bulk_waiter) { - bulk_waiter->bulk = bulk; - if (wait_for_completion_interruptible(&bulk_waiter->event)) - status = -EAGAIN; - else if (bulk_waiter->actual == VCHIQ_BULK_ACTUAL_ABORTED) - status = -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); -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); 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_instance *instance, status = bulk_xfer_blocking_interruptible(instance, args->handle, NULL, args->data, args->size, userdata, dir); - - goto bulk_transfer_handled; } else if (args->mode == 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_instance *instance, userdata = &waiter->bulk_waiter; status = bulk_xfer_waiting_interruptible(instance, args->handle, userdata); - - goto bulk_transfer_handled; } else { userdata = args->userdata; status = bulk_xfer_callback_interruptible(instance, args->handle, NULL, args->data, args->size, args->mode, userdata, dir); - - goto bulk_transfer_handled; } - status = vchiq_bulk_transfer(instance, args->handle, NULL, args->data, args->size, - userdata, args->mode, dir); - -bulk_transfer_handled: if (!waiter) { ret = 0; goto out; From patchwork Fri Aug 23 15:14:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 13775414 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 9D082C531DC for ; Fri, 23 Aug 2024 15:19:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=FW8739WG2pW91yBk/tQlD5UtDuolLDnWC79ydPFcmm8=; b=oWk3PZooxKHIWz1qz/1cG1wZqC L0sSptdPMNPnm7FzMyAyUWTkWh+Q/U4DHjWNCnD/cSqyR4i6Oj2utBJqCqojr+4IEZ4eCT/JkOu+5 JZYBNeoP9s+zWyMMBFaMUJilze6H6btrZoldA05XVdSC9lzHAM2JK1RI1IIm5qP3V25Tl55TqTE1q TlkEX4PydDtyGOmoAn4GVTs60M19SyQKW4CFSGhkyGEs6tCmsWwyQA74/qnAsAImLQMFrv6CWaumO i4ax8OeS/nci0xfjKHFewrPdTkLyVW0JwtS1B8o4D5ID1WHEcvXwsUbzuZB93b5kNKTO6fgeRSTXR xLm4ra7g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1shW4p-0000000HH1C-3FXG; Fri, 23 Aug 2024 15:19:47 +0000 Received: from perceval.ideasonboard.com ([213.167.242.64]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1shVzv-0000000HFms-3apu; Fri, 23 Aug 2024 15:14:45 +0000 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 MIME-Version: 1.0 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= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240823_081444_070624_F4999B50 X-CRM114-Status: UNSURE ( 9.50 ) X-CRM114-Notice: Please train this message. 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 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_header *header) /* Acknowledge the OPEN */ if (service->sync) { if (queue_message_sync(state, NULL, openack_id, memcpy_copy_callback, - &ack_payload, sizeof(ack_payload), 0) == -EAGAIN) + &ack_payload, sizeof(ack_payload)) == -EAGAIN) goto bail_not_ready; /* 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 = queue_message_sync(service->state, service, data_id, - copy_callback, context, size, 1); + copy_callback, context, size); break; default: status = -EINVAL; From patchwork Fri Aug 23 15:14:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 13775416 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 D9071C52D7C for ; Fri, 23 Aug 2024 15:21:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=0c0COUOBxosZ6Dh6bvR6TkUXfLHs/HYf1LvR6gsqcgQ=; b=jDO2o7ijOyPwpCVMBS7pg2CM3P ymdQoiGlpjNXJwUyNhMDB0Mg/tgO0DUMjs5JpT6bTNLW4xuAxJSxgWNaL4D90b0C+6vSPznXyncKr NXJhypXKTFqsG8ONRfQqObCkRl7M3nTNnYpxCLf+ggSpWmZdzO/AoUjJ1zxmGNVJv6b+Ro3C674g5 rAZm/vvzibjBVheV9nMBlV4DOoHPsx5pJxuwHX5hg0aZ6bWHO3mK1Nyc89u/U1YwfjRdooNTWx8jT 5yWi7zjjDmSGjUCqx66XM4w2habvPDXt1PefAqipGdOGLXXkaGrpmUALiOYiKbEQRvM9TQos7y/tv ESVCbj5w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1shW6X-0000000HHJ0-1L1e; Fri, 23 Aug 2024 15:21:33 +0000 Received: from perceval.ideasonboard.com ([213.167.242.64]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1shVzy-0000000HFoD-1weF; Fri, 23 Aug 2024 15:14:48 +0000 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 MIME-Version: 1.0 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= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240823_081446_735261_48169986 X-CRM114-Status: UNSURE ( 7.93 ) X-CRM114-Notice: Please train this message. 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 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 = 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 = queue_message_sync(service->state, service, data_id,