From patchwork Mon Jun 29 15:09:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Saenz Julienne X-Patchwork-Id: 11631177 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1AAE414B7 for ; Mon, 29 Jun 2020 15:30:50 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E5DF3251E2 for ; Mon, 29 Jun 2020 15:30:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="b5rQkuRP"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="Hb38oKdj" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E5DF3251E2 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=+s6s3nnyY1/Zm0KL6XnuCCSPai9ccmjp80ahsACnmQE=; b=b5rQkuRPfrJMFpAcl9So8cq/v x/GL/37E+K8vsG5Dh3nvro6g8ACE+6hEPzrwYivCE4rTakd2Rb/d3O5BvrMGB/hbGESEHAKGwQC3/ pcVGXKbBwqPy+RtpQnqRVEk3mNi3mjmmZy2t07brAGUVJmS9JwTmtR/uSZHr/Pl9bjm/9HPFdh+6I E/D84NoujqcxeVsAFu/TgAUwUnmk84O8vMmnunfqLz+SjDcqvoShg4HRaBIo+oXkPu3t5Gs7z1uGT Y7dU1pz4iP9o2zwE75Kw5+FUNnlrGYi7Io6bdUdFH5BDmVEyQISups263E+e3pztOvds6/MrQOwqk Jn+M/bHnQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jpvht-00031C-Da; Mon, 29 Jun 2020 15:28:29 +0000 Received: from casper.infradead.org ([90.155.50.34]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jpvQW-0002pN-UH; Mon, 29 Jun 2020 15:10:34 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=PKl50sN6mObSsLoA0QCSV/H6KVjD/ExfvEBosK9vVbo=; b=Hb38oKdjqVYy9h4fSQ116mQKk7 +GdCGM7vQqFglEIQ+x2KMMwHYgsXmc8Hr9+Z7YAv+72EE+PD9ltFMqe5wU6FCUY9F7z+AU1vGAxr9 uIy50loXNgNutvUvgMPEr75WMpBBnA+2Z4FXnlKQAkRiyqT3Yn4+WlQf9x8gmPro2xqxJXB5JH+aL lifWRPYkHroV1I04ml/G/t5CbqG4+GmYQDArow8C+yZpgFAF/TP1bs1WkZ8eASiN9rryBGEe7NtbX hgGwgHLtLCiUtVlm5UFM+NN5cpuDhnjkdwivspeVnYezo2PY1HIuHOCpc2XxVA3t2R7HOj3tvxB0z X+FJMnMw==; Received: from mx2.suse.de ([195.135.220.15]) by casper.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jpvQD-0003SN-Ju; Mon, 29 Jun 2020 15:10:30 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 59B8BB066; Mon, 29 Jun 2020 15:10:10 +0000 (UTC) From: Nicolas Saenz Julienne To: gregkh@linuxfoundation.org Subject: [PATCH v2 42/47] staging: vchi: Move vchi_queue_kernel_message() into vchiq Date: Mon, 29 Jun 2020 17:09:40 +0200 Message-Id: <20200629150945.10720-43-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200629150945.10720-1-nsaenzjulienne@suse.de> References: <20200629150945.10720-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200629_161014_926966_AF5345C7 X-CRM114-Status: GOOD ( 15.68 ) X-Spam-Score: -4.2 (----) X-Spam-Report: SpamAssassin version 3.4.4 on casper.infradead.org summary: Content analysis details: (-4.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [195.135.220.15 listed in wl.mailspike.net] -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [195.135.220.15 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devel@driverdev.osuosl.org, kernel-list@raspberrypi.com, linux-kernel@vger.kernel.org, Nicolas Saenz Julienne , laurent.pinchart@ideasonboard.com, linux-arm-kernel@lists.infradead.org, linux-rpi-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org We can't really merge it with vchiq_queue_message() as it has internal users that will not benefit from the retry mechanism vchiq_queue_kernel_message() uses. So, for the sake of getting rid of vchi, move it into vchiq. Signed-off-by: Nicolas Saenz Julienne --- .../bcm2835-audio/bcm2835-vchiq.c | 8 +++---- .../vc04_services/interface/vchi/vchi.h | 4 ---- .../interface/vchiq_arm/vchiq_core.c | 23 ++++++++++++++++--- .../interface/vchiq_arm/vchiq_if.h | 4 ++-- .../interface/vchiq_arm/vchiq_shim.c | 22 ------------------ .../vc04_services/vchiq-mmal/mmal-vchiq.c | 14 +++++------ 6 files changed, 32 insertions(+), 43 deletions(-) diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c index 28d64bc895cd..efaa2ae11f52 100644 --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c @@ -44,8 +44,8 @@ static int bcm2835_audio_send_msg_locked(struct bcm2835_audio_instance *instance init_completion(&instance->msg_avail_comp); } - status = vchi_queue_kernel_message(instance->service_handle, - m, sizeof(*m)); + status = vchiq_queue_kernel_message(instance->service_handle, + m, sizeof(*m)); if (status) { dev_err(instance->dev, "vchi message queue failed: %d, msg=%d\n", @@ -350,8 +350,8 @@ int bcm2835_audio_write(struct bcm2835_alsa_stream *alsa_stream, while (count > 0) { int bytes = min(instance->max_packet, count); - status = vchi_queue_kernel_message(instance->service_handle, - src, bytes); + status = vchiq_queue_kernel_message(instance->service_handle, + src, bytes); src += bytes; count -= bytes; } diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h b/drivers/staging/vc04_services/interface/vchi/vchi.h index c800796f9986..6de5df43cc29 100644 --- a/drivers/staging/vc04_services/interface/vchi/vchi.h +++ b/drivers/staging/vc04_services/interface/vchi/vchi.h @@ -37,10 +37,6 @@ extern int32_t vchi_service_use(unsigned handle); // Routine to decrement ref count on a named service extern int32_t vchi_service_release(unsigned handle); -/* Routine to send a message from kernel memory across a service */ -extern int vchi_queue_kernel_message(unsigned handle, void *data, - unsigned int size); - // Routine to look at a message in place. // The message is dequeued, so the caller is left holding it; the descriptor is // filled in and must be released when the user has finished with the message. 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 bb69c91c44b0..39d15f9f4a18 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c @@ -3213,11 +3213,28 @@ vchiq_queue_message(unsigned int handle, return status; } -enum vchiq_status vchiq_queue_kernel_message(unsigned int handle, void *context, - size_t size) +int vchiq_queue_kernel_message(unsigned handle, void *data, unsigned size) { - return vchiq_queue_message(handle, memcpy_copy_callback, context, size); + enum vchiq_status status; + + while (1) { + status = vchiq_queue_message(handle, memcpy_copy_callback, + data, size); + + /* + * vchiq_queue_message() may return VCHIQ_RETRY, so we need to + * implement a retry mechanism since this function is supposed + * to block until queued + */ + if (status != VCHIQ_RETRY) + break; + + msleep(1); + } + + return status; } +EXPORT_SYMBOL(vchiq_queue_kernel_message); void vchiq_release_message(unsigned int handle, diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h index 931debcd6492..6374eda4ea0c 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h @@ -89,8 +89,8 @@ extern enum vchiq_status vchiq_open_service(struct vchiq_instance *instance, extern enum vchiq_status vchiq_close_service(unsigned int service); extern enum vchiq_status vchiq_use_service(unsigned int service); extern enum vchiq_status vchiq_release_service(unsigned int service); -extern enum vchiq_status vchiq_queue_kernel_message(unsigned int handle, - void *context, size_t size); +extern int vchiq_queue_kernel_message(unsigned handle, void *data, + unsigned size); extern void vchiq_msg_queue_push(unsigned handle, struct vchiq_header *header); extern void vchiq_release_message(unsigned int service, struct vchiq_header *header); diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c index 33493643b5f8..57ac6a289a08 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c @@ -9,28 +9,6 @@ #include "../vchi/vchi.h" #include "vchiq.h" -int vchi_queue_kernel_message(unsigned handle, void *data, unsigned int size) -{ - enum vchiq_status status; - - while (1) { - status = vchiq_queue_kernel_message(handle, data, size); - - /* - * vchiq_queue_message() may return VCHIQ_RETRY, so we need to - * implement a retry mechanism since this function is supposed - * to block until queued - */ - if (status != VCHIQ_RETRY) - break; - - msleep(1); - } - - return status; -} -EXPORT_SYMBOL(vchi_queue_kernel_message); - /*********************************************************** * Name: vchi_held_msg_release * diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c index 4c6a6f4d89fc..c7a425db1d29 100644 --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c @@ -440,10 +440,9 @@ buffer_from_host(struct vchiq_mmal_instance *instance, vchi_service_use(instance->service_handle); - ret = vchi_queue_kernel_message(instance->service_handle, - &m, - sizeof(struct mmal_msg_header) + - sizeof(m.u.buffer_from_host)); + ret = vchiq_queue_kernel_message(instance->service_handle, &m, + sizeof(struct mmal_msg_header) + + sizeof(m.u.buffer_from_host)); vchi_service_release(instance->service_handle); @@ -681,10 +680,9 @@ static int send_synchronous_mmal_msg(struct vchiq_mmal_instance *instance, vchi_service_use(instance->service_handle); - ret = vchi_queue_kernel_message(instance->service_handle, - msg, - sizeof(struct mmal_msg_header) + - payload_len); + ret = vchiq_queue_kernel_message(instance->service_handle, msg, + sizeof(struct mmal_msg_header) + + payload_len); vchi_service_release(instance->service_handle);