From patchwork Wed May 27 11:53:06 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: 11572677 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 E444592A for ; Wed, 27 May 2020 11:55:29 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id C01BD208B6 for ; Wed, 27 May 2020 11:55:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="WACfe4UI" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C01BD208B6 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=bombadil.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=1VoNmUt2JKFu9RKhabE3E+qAT47vzI8li5dWi+LmB6I=; b=WACfe4UIpNuh2X Q70ZRT0dAzuLfh5yaaNmIizdk0snF4JG93sreYOdKxHbSp8cP8uu5QneyuK4sSSgDmUNprUzW23DC SGaOQUYmziOW3637dgfybWxzHrlh3eKLpr1cdO2ukZNf6tnnodQpuk5mVjXcOyugEbqwswHBypP75 OC8LboWry/4rXIs9Z/QC/K9kn4YfRdCzVwnr00nJVRdvixWKcY7au3KnRgtlfPICSEFZ/Prfdodr7 QerfsqLe3TujoXoVSYaynduR9FwsKc6/9zy+PBHrb/SQVDaVCAk4BTiKCkGDgFTH65ipHNwPxQJEV rPJZFmVZM/1ha/6oxWZw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jduee-0001fW-He; Wed, 27 May 2020 11:55:28 +0000 Received: from mx2.suse.de ([195.135.220.15]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdudV-0006Xm-L5; Wed, 27 May 2020 11:54:19 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 785A2AC91; Wed, 27 May 2020 11:54:15 +0000 (UTC) From: Nicolas Saenz Julienne To: bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [RFC 01/50] staging: vchi: Get rid of vchi_service_destroy() Date: Wed, 27 May 2020 13:53:06 +0200 Message-Id: <20200527115400.31391-2-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527115400.31391-1-nsaenzjulienne@suse.de> References: <20200527115400.31391-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200527_045417_887813_E4C90A1A X-CRM114-Status: UNSURE ( 9.20 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -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] 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [195.135.220.15 listed in wl.mailspike.net] -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, laurent.pinchart@ideasonboard.com, Nicolas Saenz Julienne , gregkh@linuxfoundation.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org The function has no users. Signed-off-by: Nicolas Saenz Julienne --- .../vc04_services/interface/vchi/vchi.h | 3 --- .../interface/vchiq_arm/vchiq_shim.c | 19 ------------------- 2 files changed, 22 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h b/drivers/staging/vc04_services/interface/vchi/vchi.h index ff2b960d8cac..686cfc536012 100644 --- a/drivers/staging/vc04_services/interface/vchi/vchi.h +++ b/drivers/staging/vc04_services/interface/vchi/vchi.h @@ -83,9 +83,6 @@ extern uint32_t vchi_current_time(struct vchi_instance_handle *instance_handle); /****************************************************************************** * Global service API *****************************************************************************/ -// Routine to destroy a service -extern int32_t vchi_service_destroy(const struct vchi_service_handle *handle); - // Routine to open a named service extern int32_t vchi_service_open(struct vchi_instance_handle *instance_handle, struct service_creation *setup, 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 efdd3b1c7d85..9a040651bb9b 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c @@ -642,25 +642,6 @@ int32_t vchi_service_close(const struct vchi_service_handle *handle) } EXPORT_SYMBOL(vchi_service_close); -int32_t vchi_service_destroy(const struct vchi_service_handle *handle) -{ - int32_t ret = -1; - struct shim_service *service = (struct shim_service *)handle; - - if (service) { - enum vchiq_status status = vchiq_remove_service(service->handle); - - if (status == VCHIQ_SUCCESS) { - service_free(service); - service = NULL; - } - - ret = vchiq_status_to_vchi(status); - } - return ret; -} -EXPORT_SYMBOL(vchi_service_destroy); - int32_t vchi_service_set_option(const struct vchi_service_handle *handle, enum vchi_service_option option, int value) From patchwork Wed May 27 11:53:07 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: 11572675 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 BD64D92A for ; Wed, 27 May 2020 11:54:48 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 6B2F820EDD for ; Wed, 27 May 2020 11:54:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="CXDvf3sJ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6B2F820EDD 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=bombadil.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=OR+LfE6iiGjgzeEutUydS2L4bC/oIDaxAKxMrJeHvMU=; b=CXDvf3sJxpHk7L ztdaDTxJWi8KHtwGmNR7le70AmqPjRUscVuvglH7G+CnCukfLjht1LxR3fDLYHJBzmhPGQse+APE3 UXqfUW2/6VnvzoYCHczGcXsbekY+hbOFmlOBSHCjeZ70kQzMKFg1tqg5bUNNwS/IZu+9+i4Xrjoq9 UABFN/kw7MMyUwqCHNpWnJIz75WZ89fTP34dpBxAwSHgwwTZdSn80cCOtrG3uBxSppP+ngvdfJ0Zy xxsJ7g0TTw4uV6fxO77v5XqIcX2M6YRGYFC47RdSEZKZRYMCDtwjZYh0DD6frl/V25VUvmMP/Ie9A XCBpA6ZzIyje2Um/qdhA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdudt-0006xi-Ag; Wed, 27 May 2020 11:54:41 +0000 Received: from mx2.suse.de ([195.135.220.15]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdudV-0006Xl-GP; Wed, 27 May 2020 11:54:19 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 413C8ADE3; Wed, 27 May 2020 11:54:16 +0000 (UTC) From: Nicolas Saenz Julienne To: bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [RFC 02/50] staging: vchi: Get rid of vchi_queue_user_message() Date: Wed, 27 May 2020 13:53:07 +0200 Message-Id: <20200527115400.31391-3-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527115400.31391-1-nsaenzjulienne@suse.de> References: <20200527115400.31391-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200527_045417_712242_DCB04A95 X-CRM114-Status: UNSURE ( 9.13 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -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] -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_H3 RBL: Good reputation (+3) [195.135.220.15 listed in wl.mailspike.net] 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, laurent.pinchart@ideasonboard.com, Nicolas Saenz Julienne , gregkh@linuxfoundation.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org The function has no users. Signed-off-by: Nicolas Saenz Julienne --- .../vc04_services/interface/vchi/vchi.h | 6 ---- .../interface/vchiq_arm/vchiq_shim.c | 34 ------------------- 2 files changed, 40 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h b/drivers/staging/vc04_services/interface/vchi/vchi.h index 686cfc536012..62d9d3efa755 100644 --- a/drivers/staging/vc04_services/interface/vchi/vchi.h +++ b/drivers/staging/vc04_services/interface/vchi/vchi.h @@ -111,12 +111,6 @@ vchi_queue_kernel_message(struct vchi_service_handle *handle, void *data, unsigned int size); -/* Routine to send a message from user memory across a service */ -extern int -vchi_queue_user_message(struct vchi_service_handle *handle, - void __user *data, - unsigned int size); - // Routine to receive a msg from a service // Dequeue is equivalent to hold, copy into client buffer, release extern int32_t vchi_msg_dequeue(struct vchi_service_handle *handle, 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 9a040651bb9b..2c2bd7a9dc27 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c @@ -150,40 +150,6 @@ vchi_queue_kernel_message(struct vchi_service_handle *handle, } EXPORT_SYMBOL(vchi_queue_kernel_message); -struct vchi_queue_user_message_context { - void __user *data; -}; - -static ssize_t -vchi_queue_user_message_callback(void *context, - void *dest, - size_t offset, - size_t maxsize) -{ - struct vchi_queue_user_message_context *copycontext = context; - - if (copy_from_user(dest, copycontext->data + offset, maxsize)) - return -EFAULT; - - return maxsize; -} - -int -vchi_queue_user_message(struct vchi_service_handle *handle, - void __user *data, - unsigned int size) -{ - struct vchi_queue_user_message_context copycontext = { - .data = data - }; - - return vchi_msg_queue(handle, - vchi_queue_user_message_callback, - ©context, - size); -} -EXPORT_SYMBOL(vchi_queue_user_message); - /*********************************************************** * Name: vchi_bulk_queue_receive * From patchwork Wed May 27 11:53:08 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: 11572683 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 B791860D for ; Wed, 27 May 2020 11:56:34 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 707CE207D8 for ; Wed, 27 May 2020 11:56:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="PoLMkyFF" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 707CE207D8 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=bombadil.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=XaNFIxiHCa1ZLLgdK71nykjda5WxE+zo9xMVDkcRgTo=; b=PoLMkyFF38qp6j e0Lh/SPwfoZnI4VQ6elJgS46WxPCBKWt+uK3gS9Vdtg+XT90ZnFxlQFyS8dYSORf6Y+cPCdaR6jdU /SZD7/LAAVIjkH9Zs3OmYVgaQb9IbsZLt23I+BT8X+HeFwncMzsBlsG6k8S0/8dZByPwYzCOAATI4 5e8+x428fUcE4+BHDkbfhlsHSlY2gs9Q7xUVQckMqe4lApH9KWSzWNz7FtofqqMWPhwquNEk7/KZW V1+dO/QM2B/CIcjG10z2Jw2YchrTDySIzO0BNMv8jgG2I1DZkrUVFMk1ABmmRf6FQSqdC2jGsVRZr 4fZouxEnvjRG97AKDUIQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdufb-0002UG-Vo; Wed, 27 May 2020 11:56:28 +0000 Received: from mx2.suse.de ([195.135.220.15]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdudV-0006Xp-GQ; Wed, 27 May 2020 11:54:21 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 30B07AD2B; Wed, 27 May 2020 11:54:17 +0000 (UTC) From: Nicolas Saenz Julienne To: bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [RFC 03/50] staging: vchiq: Move copy callback handling into vchiq Date: Wed, 27 May 2020 13:53:08 +0200 Message-Id: <20200527115400.31391-4-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527115400.31391-1-nsaenzjulienne@suse.de> References: <20200527115400.31391-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200527_045417_892278_5C512CAF X-CRM114-Status: GOOD ( 12.43 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -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] 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [195.135.220.15 listed in wl.mailspike.net] -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, laurent.pinchart@ideasonboard.com, Nicolas Saenz Julienne , gregkh@linuxfoundation.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org All vchi users use the kernel variant of the copy callback. The only user for the user space variant of the copy callback is in the ioctl implementation. So move all this copying logic into vchiq, and expose a new function that explicitly passes kernel messages. Signed-off-by: Nicolas Saenz Julienne --- .../interface/vchiq_arm/vchiq_core.c | 6 ++++ .../interface/vchiq_arm/vchiq_core.h | 7 ++++ .../interface/vchiq_arm/vchiq_if.h | 8 ++--- .../interface/vchiq_arm/vchiq_shim.c | 34 ++++--------------- 4 files changed, 22 insertions(+), 33 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 edcd97373809..67b2090c91db 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c @@ -3147,6 +3147,12 @@ vchiq_queue_message(unsigned int handle, return status; } +enum vchiq_status vchiq_queue_kernel_message(unsigned int handle, void *context, + size_t size) +{ + return vchiq_queue_message(handle, memcpy_copy_callback, context, size); +} + void vchiq_release_message(unsigned int handle, struct vchiq_header *header) 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 cedd8e721aae..1fe6cd8b86c0 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h @@ -587,6 +587,13 @@ lock_service(struct vchiq_service *service); extern void unlock_service(struct vchiq_service *service); +extern enum vchiq_status +vchiq_queue_message(unsigned int handle, + ssize_t (*copy_callback)(void *context, void *dest, + size_t offset, size_t maxsize), + void *context, + size_t size); + /* The following functions are called from vchiq_core, and external ** implementations must be provided. */ 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 39b77ea19210..b62fd6d6f1ac 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h @@ -105,12 +105,8 @@ extern enum vchiq_status vchiq_close_service(unsigned int service); extern enum vchiq_status vchiq_remove_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_message(unsigned int handle, - ssize_t (*copy_callback)(void *context, void *dest, - size_t offset, size_t maxsize), - void *context, - size_t size); +extern enum vchiq_status vchiq_queue_kernel_message(unsigned int handle, + void *context, size_t size); extern void vchiq_release_message(unsigned int service, struct vchiq_header *header); extern enum vchiq_status vchiq_bulk_transmit(unsigned int service, 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 2c2bd7a9dc27..1c5ddea8b076 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c @@ -99,20 +99,15 @@ EXPORT_SYMBOL(vchi_msg_remove); * ***********************************************************/ static -int32_t vchi_msg_queue(struct vchi_service_handle *handle, - ssize_t (*copy_callback)(void *context, void *dest, - size_t offset, size_t maxsize), - void *context, - uint32_t data_size) +int32_t vchi_msg_queue(struct vchi_service_handle *handle, void *context, + uint32_t data_size) { struct shim_service *service = (struct shim_service *)handle; enum vchiq_status status; while (1) { - status = vchiq_queue_message(service->handle, - copy_callback, - context, - data_size); + status = vchiq_queue_kernel_message(service->handle, context, + data_size); /* * vchiq_queue_message() may return VCHIQ_RETRY, so we need to @@ -128,25 +123,10 @@ int32_t vchi_msg_queue(struct vchi_service_handle *handle, return vchiq_status_to_vchi(status); } -static ssize_t -vchi_queue_kernel_message_callback(void *context, - void *dest, - size_t offset, - size_t maxsize) +int vchi_queue_kernel_message(struct vchi_service_handle *handle, void *data, + unsigned int size) { - memcpy(dest, context + offset, maxsize); - return maxsize; -} - -int -vchi_queue_kernel_message(struct vchi_service_handle *handle, - void *data, - unsigned int size) -{ - return vchi_msg_queue(handle, - vchi_queue_kernel_message_callback, - data, - size); + return vchi_msg_queue(handle, data, size); } EXPORT_SYMBOL(vchi_queue_kernel_message); From patchwork Wed May 27 11:53:09 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: 11572689 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 CA81D60D for ; Wed, 27 May 2020 11:57:40 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 76985207CB for ; Wed, 27 May 2020 11:57:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="IzcvaAaU" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 76985207CB 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=bombadil.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=JhSxUzN5aj7ZB3UgIUa/sevokW3Zwg3c995HCy4GRzg=; b=IzcvaAaUzBu6+m RFVNKWm+5zEIRp7sha6g7OjUdZVdYFuoziBi8jtQrkv1MzEp6TX+YE6/0QR8mdQ41MO7I/g8fEouP 8YZgqSpx6mzdB1rdZlPRYTfHZDBKffcBza81y/znQLT5mpLx4mbXpECAMhQW8KxLmVpxVsmDf9qiz 0wwt8ioZRJyjrPUPPxrR7MggLgT1ByyOqGnroUXTCtEaPS7qO0Ub+g1LE27O+tkG4fZJu413hjJ8s nlOmeWriH3RGFFrjMsVnl6FBAAtDob883UEmwOlpYp/psIWlJLat4dDfmx4B8NjqXePy0c7iO4+NI OvL6nEl+datrTFCohItA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdugk-0003Ua-On; Wed, 27 May 2020 11:57:38 +0000 Received: from mx2.suse.de ([195.135.220.15]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdudW-0006Xs-69; Wed, 27 May 2020 11:54:21 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id D9E3AAD66; Wed, 27 May 2020 11:54:17 +0000 (UTC) From: Nicolas Saenz Julienne To: bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [RFC 04/50] staging: vchi: Merge vchi_msg_queue() into vchi_queue_kernel_message() Date: Wed, 27 May 2020 13:53:09 +0200 Message-Id: <20200527115400.31391-5-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527115400.31391-1-nsaenzjulienne@suse.de> References: <20200527115400.31391-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200527_045418_385564_DBBC3556 X-CRM114-Status: UNSURE ( 9.55 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -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] 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [195.135.220.15 listed in wl.mailspike.net] -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, laurent.pinchart@ideasonboard.com, Nicolas Saenz Julienne , gregkh@linuxfoundation.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org There are no gains from that extra indirection level. Also, get rid of the function description, the whole file will disappear soon. Signed-off-by: Nicolas Saenz Julienne --- .../interface/vchiq_arm/vchiq_shim.c | 29 +++---------------- 1 file changed, 4 insertions(+), 25 deletions(-) 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 1c5ddea8b076..081ab67ad6fd 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c @@ -84,30 +84,15 @@ int32_t vchi_msg_remove(struct vchi_service_handle *handle) } EXPORT_SYMBOL(vchi_msg_remove); -/*********************************************************** - * Name: vchi_msg_queue - * - * Arguments: struct vchi_service_handle *handle, - * ssize_t (*copy_callback)(void *context, void *dest, - * size_t offset, size_t maxsize), - * void *context, - * uint32_t data_size - * - * Description: Thin wrapper to queue a message onto a connection - * - * Returns: int32_t - success == 0 - * - ***********************************************************/ -static -int32_t vchi_msg_queue(struct vchi_service_handle *handle, void *context, - uint32_t data_size) +int vchi_queue_kernel_message(struct vchi_service_handle *handle, void *data, + unsigned int size) { struct shim_service *service = (struct shim_service *)handle; enum vchiq_status status; while (1) { - status = vchiq_queue_kernel_message(service->handle, context, - data_size); + status = vchiq_queue_kernel_message(service->handle, data, + size); /* * vchiq_queue_message() may return VCHIQ_RETRY, so we need to @@ -122,12 +107,6 @@ int32_t vchi_msg_queue(struct vchi_service_handle *handle, void *context, return vchiq_status_to_vchi(status); } - -int vchi_queue_kernel_message(struct vchi_service_handle *handle, void *data, - unsigned int size) -{ - return vchi_msg_queue(handle, data, size); -} EXPORT_SYMBOL(vchi_queue_kernel_message); /*********************************************************** From patchwork Wed May 27 11:53:10 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: 11572687 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 E057560D for ; Wed, 27 May 2020 11:57:17 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 8C76F207CB for ; Wed, 27 May 2020 11:57:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="TBFyTdyG" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8C76F207CB 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=bombadil.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=GgAyB2PUv9+p3Mu5Rb1VBxWum/VpyM3BOwIDnh9fSE4=; b=TBFyTdyGDbNWlV xzVB8Llw/rmegBtXln4Hlq+O4U79rzKnUa6Hi3ZRxwwt4GdcM/uf3ffKQo5+o/L+W4GviFK7jjd6h l9a+9Uj0PRkxb9I9RQJQzIQUoIvsXvXCpAt0v/lvOd9Au9U7aDQzToxl3++zOaiQ9xlCSRZvpeXRT toNUkeaoDHuA4GwhLEsFc8G87R89HPz7Zm6fZ/gC5B9YYJGp1gnkNPZKyOUHuFudCONuQFQddGsuO xc/6k931/hHzE0w5sVyZWKSG2lE/069sWA4tME1NRylq5+ZYjR9pH8+jrjJMuDqDXf783ZFWlMH83 /OIkwqEzXaXMjFJiK0Fw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdugG-000378-Ck; Wed, 27 May 2020 11:57:08 +0000 Received: from mx2.suse.de ([195.135.220.15]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdudY-0006ci-T6; Wed, 27 May 2020 11:54:23 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id A26A8ACF2; Wed, 27 May 2020 11:54:18 +0000 (UTC) From: Nicolas Saenz Julienne To: bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [RFC 05/50] staging: vchi: Get rid of vchi_service_set_option() Date: Wed, 27 May 2020 13:53:10 +0200 Message-Id: <20200527115400.31391-6-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527115400.31391-1-nsaenzjulienne@suse.de> References: <20200527115400.31391-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200527_045421_212529_FC094E3B X-CRM114-Status: GOOD ( 10.45 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -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] 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [195.135.220.15 listed in wl.mailspike.net] -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, laurent.pinchart@ideasonboard.com, Nicolas Saenz Julienne , gregkh@linuxfoundation.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org There are no users for that function. Signed-off-by: Nicolas Saenz Julienne --- .../vc04_services/interface/vchi/vchi.h | 5 --- .../interface/vchiq_arm/vchiq_shim.c | 31 ------------------- 2 files changed, 36 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h b/drivers/staging/vc04_services/interface/vchi/vchi.h index 62d9d3efa755..1e8d17531e9d 100644 --- a/drivers/staging/vc04_services/interface/vchi/vchi.h +++ b/drivers/staging/vc04_services/interface/vchi/vchi.h @@ -100,11 +100,6 @@ extern int32_t vchi_service_use(const struct vchi_service_handle *handle); // Routine to decrement ref count on a named service extern int32_t vchi_service_release(const struct vchi_service_handle *handle); -// Routine to set a control option for a named service -extern int32_t vchi_service_set_option(const struct vchi_service_handle *handle, - enum vchi_service_option option, - int value); - /* Routine to send a message from kernel memory across a service */ extern int vchi_queue_kernel_message(struct vchi_service_handle *handle, 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 081ab67ad6fd..429b0c71e455 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c @@ -567,37 +567,6 @@ int32_t vchi_service_close(const struct vchi_service_handle *handle) } EXPORT_SYMBOL(vchi_service_close); -int32_t vchi_service_set_option(const struct vchi_service_handle *handle, - enum vchi_service_option option, - int value) -{ - int32_t ret = -1; - struct shim_service *service = (struct shim_service *)handle; - enum vchiq_service_option vchiq_option; - - switch (option) { - case VCHI_SERVICE_OPTION_TRACE: - vchiq_option = VCHIQ_SERVICE_OPTION_TRACE; - break; - case VCHI_SERVICE_OPTION_SYNCHRONOUS: - vchiq_option = VCHIQ_SERVICE_OPTION_SYNCHRONOUS; - break; - default: - service = NULL; - break; - } - if (service) { - enum vchiq_status status = - vchiq_set_service_option(service->handle, - vchiq_option, - value); - - ret = vchiq_status_to_vchi(status); - } - return ret; -} -EXPORT_SYMBOL(vchi_service_set_option); - int32_t vchi_get_peer_version(const struct vchi_service_handle *handle, short *peer_version) { int32_t ret = -1; From patchwork Wed May 27 11:53:11 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: 11572691 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 1B2ED92A for ; Wed, 27 May 2020 11:58:06 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id ED074208C3 for ; Wed, 27 May 2020 11:58:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="M2rnXJ0Z" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org ED074208C3 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=bombadil.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=PLheT/VKq043X8pNKWHQXaVIomD6aUEY01qXnXlUVN8=; b=M2rnXJ0Z5EhCi/ +loo/GmzYHkHU1xAgvY8CsU3yWwQCBdOV11269jEg8N7Hsk19qfceIOFwMpt601BgvA+MHNDTCs7y OI+7GWy2RV2HAbFGaXIti5ced0aPgkV6W6cmsrQSNDsl9mB5F35qLJMafShdhh8T6+U8o8vd3Xa16 I2ZcZCxiDn2VrqT9v8yxHX0k80rV9G3EBlNKzdk9fDuLc9r0NOBRpewwTdB7X/Fvpn9Av5vuLKMqd qDA1HEz6u/sEGlBM78sd82pN41mWbUdqvsJmUsQre165mFf2fU/wRIZZqEkONJgVVVxb2GuMYWcMf MDreZDCatYmn8mTUEM8w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jduh6-0003ml-Dj; Wed, 27 May 2020 11:58:00 +0000 Received: from mx2.suse.de ([195.135.220.15]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdudY-0006cf-T6; Wed, 27 May 2020 11:54:23 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 6073FAD17; Wed, 27 May 2020 11:54:19 +0000 (UTC) From: Nicolas Saenz Julienne To: bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [RFC 06/50] staging: vchi: Get rid of vchiq_status_to_vchi() Date: Wed, 27 May 2020 13:53:11 +0200 Message-Id: <20200527115400.31391-7-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527115400.31391-1-nsaenzjulienne@suse.de> References: <20200527115400.31391-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200527_045421_267054_E4D4C854 X-CRM114-Status: GOOD ( 10.95 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -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] 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [195.135.220.15 listed in wl.mailspike.net] -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, laurent.pinchart@ideasonboard.com, Nicolas Saenz Julienne , gregkh@linuxfoundation.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org vchiq functions return an enum and vchi's ints. Those are compatible, no need to explicitly cast them. Signed-off-by: Nicolas Saenz Julienne --- .../interface/vchiq_arm/vchiq_shim.c | 25 ++++++++----------- 1 file changed, 11 insertions(+), 14 deletions(-) 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 429b0c71e455..0fc5fa05c6c2 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c @@ -9,8 +9,6 @@ #include "vchiq_util.h" -#define vchiq_status_to_vchi(status) ((int32_t)status) - struct shim_service { unsigned int handle; @@ -105,7 +103,7 @@ int vchi_queue_kernel_message(struct vchi_service_handle *handle, void *data, msleep(1); } - return vchiq_status_to_vchi(status); + return status; } EXPORT_SYMBOL(vchi_queue_kernel_message); @@ -146,7 +144,7 @@ int32_t vchi_bulk_queue_receive(struct vchi_service_handle *handle, void *data_d break; default: WARN(1, "unsupported message\n"); - return vchiq_status_to_vchi(VCHIQ_ERROR); + return VCHIQ_ERROR; } while (1) { @@ -163,7 +161,7 @@ int32_t vchi_bulk_queue_receive(struct vchi_service_handle *handle, void *data_d msleep(1); } - return vchiq_status_to_vchi(status); + return status; } EXPORT_SYMBOL(vchi_bulk_queue_receive); @@ -207,7 +205,7 @@ int32_t vchi_bulk_queue_transmit(struct vchi_service_handle *handle, break; default: WARN(1, "unsupported message\n"); - return vchiq_status_to_vchi(VCHIQ_ERROR); + return VCHIQ_ERROR; } while (1) { @@ -225,7 +223,7 @@ int32_t vchi_bulk_queue_transmit(struct vchi_service_handle *handle, msleep(1); } - return vchiq_status_to_vchi(status); + return status; } EXPORT_SYMBOL(vchi_bulk_queue_transmit); @@ -372,7 +370,7 @@ int32_t vchi_initialise(struct vchi_instance_handle **instance_handle) *instance_handle = (struct vchi_instance_handle *)instance; - return vchiq_status_to_vchi(status); + return status; } EXPORT_SYMBOL(vchi_initialise); @@ -410,7 +408,7 @@ int32_t vchi_disconnect(struct vchi_instance_handle *instance_handle) { struct vchiq_instance *instance = (struct vchiq_instance *)instance_handle; - return vchiq_status_to_vchi(vchiq_shutdown(instance)); + return vchiq_shutdown(instance); } EXPORT_SYMBOL(vchi_disconnect); @@ -561,7 +559,7 @@ int32_t vchi_service_close(const struct vchi_service_handle *handle) if (status == VCHIQ_SUCCESS) service_free(service); - ret = vchiq_status_to_vchi(status); + ret = status; } return ret; } @@ -576,7 +574,7 @@ int32_t vchi_get_peer_version(const struct vchi_service_handle *handle, short *p enum vchiq_status status; status = vchiq_get_peer_version(service->handle, peer_version); - ret = vchiq_status_to_vchi(status); + ret = status; } return ret; } @@ -598,7 +596,7 @@ int32_t vchi_service_use(const struct vchi_service_handle *handle) struct shim_service *service = (struct shim_service *)handle; if (service) - ret = vchiq_status_to_vchi(vchiq_use_service(service->handle)); + ret = vchiq_use_service(service->handle); return ret; } EXPORT_SYMBOL(vchi_service_use); @@ -619,8 +617,7 @@ int32_t vchi_service_release(const struct vchi_service_handle *handle) struct shim_service *service = (struct shim_service *)handle; if (service) - ret = vchiq_status_to_vchi( - vchiq_release_service(service->handle)); + ret = vchiq_release_service(service->handle); return ret; } EXPORT_SYMBOL(vchi_service_release); From patchwork Wed May 27 11:53:12 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: 11572685 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 4854F60D for ; Wed, 27 May 2020 11:57:02 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 15EFD207D8 for ; Wed, 27 May 2020 11:57:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="rWbEtKXq" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 15EFD207D8 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=bombadil.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=kQt24wR/+RGgWqGVtuAPhAP+2x3Ojlp/5NkfGEKy43k=; b=rWbEtKXqVVJ+sZ cJkf31mlzgfkCgPUK3WYqhkl2BCmuUbkq0YwkEoCDjN1JvOsT7dFogSDFM7AAnB6KssQpGp7D4pKn Ja9gMzOpeWaezeh6aUGOT0H0uC+qzT+QPROZZKSHSc2dCJjdgSywTo8mGvqQLVnKG4Yyri1UVbKKt T1JuOT8nZbUWHwUBQfprTV5nOIGSVZv9aBVpb/Gs66FGS8yuOp6gVxhuD2t6EMxgXCXnV8k+RMkdd kbagU+IXVxvVB83qgdZ1lh8LlxzDKgdQ2xenNCXIK56Z+9dN3Yh2NJAqD5vUYTbc69aRVPSaOLQSy t30NEqjhYhI3FRqItqDg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdug2-0002sF-5x; Wed, 27 May 2020 11:56:54 +0000 Received: from mx2.suse.de ([195.135.220.15]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdudZ-0006ck-5z; Wed, 27 May 2020 11:54:23 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 3DF3FAE44; Wed, 27 May 2020 11:54:20 +0000 (UTC) From: Nicolas Saenz Julienne To: bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [RFC 07/50] staging: vchi: Get rid of not implemented function declarations Date: Wed, 27 May 2020 13:53:12 +0200 Message-Id: <20200527115400.31391-8-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527115400.31391-1-nsaenzjulienne@suse.de> References: <20200527115400.31391-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200527_045421_515150_223262D9 X-CRM114-Status: GOOD ( 11.25 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -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] 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [195.135.220.15 listed in wl.mailspike.net] -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, laurent.pinchart@ideasonboard.com, Nicolas Saenz Julienne , gregkh@linuxfoundation.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org They don't exist, they have no users, get rid of them. Signed-off-by: Nicolas Saenz Julienne --- .../vc04_services/interface/vchi/vchi.h | 59 ------------------- 1 file changed, 59 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h b/drivers/staging/vc04_services/interface/vchi/vchi.h index 1e8d17531e9d..2e41b5f7bdec 100644 --- a/drivers/staging/vc04_services/interface/vchi/vchi.h +++ b/drivers/staging/vc04_services/interface/vchi/vchi.h @@ -67,19 +67,12 @@ extern "C" { // Routine used to initialise the vchi on both local + remote connections extern int32_t vchi_initialise(struct vchi_instance_handle **instance_handle); -extern int32_t vchi_exit(void); - extern int32_t vchi_connect(struct vchi_instance_handle *instance_handle); //When this is called, ensure that all services have no data pending. //Bulk transfers can remain 'queued' extern int32_t vchi_disconnect(struct vchi_instance_handle *instance_handle); -// helper functions -extern void *vchi_allocate_buffer(struct vchi_service_handle *handle, uint32_t *length); -extern void vchi_free_buffer(struct vchi_service_handle *handle, void *address); -extern uint32_t vchi_current_time(struct vchi_instance_handle *instance_handle); - /****************************************************************************** * Global service API *****************************************************************************/ @@ -135,54 +128,14 @@ extern int32_t vchi_msg_hold(struct vchi_service_handle *handle, enum vchi_flags flags, struct vchi_held_msg *message_descriptor); -// Initialise an iterator to look through messages in place -extern int32_t vchi_msg_look_ahead(struct vchi_service_handle *handle, - struct vchi_msg_iter *iter, - enum vchi_flags flags); - /******************************************************************************* * Global service support API - operations on held messages * and message iterators ******************************************************************************/ -// Routine to get the address of a held message -extern void *vchi_held_msg_ptr(const struct vchi_held_msg *message); - -// Routine to get the size of a held message -extern int32_t vchi_held_msg_size(const struct vchi_held_msg *message); - -// Routine to get the transmit timestamp as written into the header by the peer -extern uint32_t vchi_held_msg_tx_timestamp(const struct vchi_held_msg *message); - -// Routine to get the reception timestamp, written as we parsed the header -extern uint32_t vchi_held_msg_rx_timestamp(const struct vchi_held_msg *message); - // Routine to release a held message after it has been processed extern int32_t vchi_held_msg_release(struct vchi_held_msg *message); -// Indicates whether the iterator has a next message. -extern int32_t vchi_msg_iter_has_next(const struct vchi_msg_iter *iter); - -// Return the pointer and length for the next message and advance the iterator. -extern int32_t vchi_msg_iter_next(struct vchi_msg_iter *iter, - void **data, - uint32_t *msg_size); - -// Remove the last message returned by vchi_msg_iter_next. -// Can only be called once after each call to vchi_msg_iter_next. -extern int32_t vchi_msg_iter_remove(struct vchi_msg_iter *iter); - -// Hold the last message returned by vchi_msg_iter_next. -// Can only be called once after each call to vchi_msg_iter_next. -extern int32_t vchi_msg_iter_hold(struct vchi_msg_iter *iter, - struct vchi_held_msg *message); - -// Return information for the next message, and hold it, advancing the iterator. -extern int32_t vchi_msg_iter_hold_next(struct vchi_msg_iter *iter, - void **data, // } may be NULL - uint32_t *msg_size, // } - struct vchi_held_msg *message); - /****************************************************************************** * Global bulk API *****************************************************************************/ @@ -194,13 +147,6 @@ extern int32_t vchi_bulk_queue_receive(struct vchi_service_handle *handle, enum vchi_flags flags, void *transfer_handle); -// Prepare interface for a transfer from the other side into relocatable memory. -int32_t vchi_bulk_queue_receive_reloc(const struct vchi_service_handle *handle, - uint32_t offset, - uint32_t data_size, - const enum vchi_flags flags, - void * const bulk_handle); - // Routine to queue up data ready for transfer to the other (once they have signalled they are ready) extern int32_t vchi_bulk_queue_transmit(struct vchi_service_handle *handle, const void *data_src, @@ -216,11 +162,6 @@ extern int32_t vchi_bulk_queue_transmit(struct vchi_service_handle *handle, } #endif -extern int32_t vchi_bulk_queue_transmit_reloc(struct vchi_service_handle *handle, - uint32_t offset, - uint32_t data_size, - enum vchi_flags flags, - void *transfer_handle); #endif /* VCHI_H_ */ /****************************** End of file **********************************/ From patchwork Wed May 27 11:53:13 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: 11572681 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 7C44292A for ; Wed, 27 May 2020 11:56:10 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 17F67207D8 for ; Wed, 27 May 2020 11:56:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="PO5mNliL" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 17F67207D8 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=bombadil.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=R7QXblsP6aBWHbSWc6Rq6EXJ/jGalzY+u45xHBMHY/Q=; b=PO5mNliLlD3uCT QWcGKGFzzhJap4R/oimFw1W9YkgSS0azzS9x+J+nhkQPkGTrsy86uaVRKOOCBO64+8ki0lypcLWUP QJYXzMSEFCu9rEo4e1Va3hUHTA6kGIaqM5CCmHJ5Cs1CYs3EQTiAqKra4axCVQs8pbCwXoJbI2J3Q vWcx4yI/2nModPpJ0pj9XHSyB4XgdfGaOCsVLNnkzyvx/lB/wmSX+cPKPDPPtkMbF6V7ZYctlG9TP Msepq6uTt3n0GH6m7fmiBqDzDPzLzrz6a+eN/3/jsPQFMyCOfQpNwmtKaVTfUoqJArj9BvZnqMwvK pQ/dr41nDc5kJc30TqFA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdufC-0002C5-76; Wed, 27 May 2020 11:56:02 +0000 Received: from mx2.suse.de ([195.135.220.15]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdudZ-0006cl-61; Wed, 27 May 2020 11:54:23 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id F0B2EAC84; Wed, 27 May 2020 11:54:20 +0000 (UTC) From: Nicolas Saenz Julienne To: bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [RFC 08/50] staging: vchi: Get rid of C++ guards Date: Wed, 27 May 2020 13:53:13 +0200 Message-Id: <20200527115400.31391-9-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527115400.31391-1-nsaenzjulienne@suse.de> References: <20200527115400.31391-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200527_045421_391162_81790EDF X-CRM114-Status: GOOD ( 10.11 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -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] 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [195.135.220.15 listed in wl.mailspike.net] -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, laurent.pinchart@ideasonboard.com, Nicolas Saenz Julienne , gregkh@linuxfoundation.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org This is an include only used by the Linux kernel, so no need to worry about C++ compatibility. Signed-off-by: Nicolas Saenz Julienne --- drivers/staging/vc04_services/interface/vchi/vchi.h | 8 -------- 1 file changed, 8 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h b/drivers/staging/vc04_services/interface/vchi/vchi.h index 2e41b5f7bdec..1a981e98e82b 100644 --- a/drivers/staging/vc04_services/interface/vchi/vchi.h +++ b/drivers/staging/vc04_services/interface/vchi/vchi.h @@ -60,10 +60,6 @@ struct vchi_service_handle; * (local / remote) *****************************************************************************/ -#ifdef __cplusplus -extern "C" { -#endif - // Routine used to initialise the vchi on both local + remote connections extern int32_t vchi_initialise(struct vchi_instance_handle **instance_handle); @@ -158,10 +154,6 @@ extern int32_t vchi_bulk_queue_transmit(struct vchi_service_handle *handle, * Configuration plumbing *****************************************************************************/ -#ifdef __cplusplus -} -#endif - #endif /* VCHI_H_ */ /****************************** End of file **********************************/ From patchwork Wed May 27 11:53:14 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: 11572699 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 DC40992A for ; Wed, 27 May 2020 11:59:50 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id AEA88207CB for ; Wed, 27 May 2020 11:59:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="G5LaIp+X" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AEA88207CB 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=bombadil.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=p+YOljT3c3XWnGZKp28h+70Wy4WJS0L9ae9AbZbAtmY=; b=G5LaIp+XM/TiaL 0QBLa4OyQvuApJU0Qx6QqvMFVreuLES8UKFjAwSG7039ZUrHQ+SsuRMCkd1UvQ22fwCR4QRm0quCq V2t392D+azm+makxxJMJ3im9mSp5+K+lwNY3H+oJ2/irH/pSNY3nAlWOcPSnMetqDZ3DrdWEjRNMz +3Z64obHWV5jzkjvyWitrhSs/JyKGMmY+7EtKxkHV9voKe2VX3M652CG3brFQfSwrbAPwbGUIGUv/ uwCHkqK2MywWQ5rRH49xUUYaj0OPuXQsYWSNpzgkRHU0QiccDZeaZ1HxY0M6J2XzJU1j7PNNzcNhp GkhFNjnbHCHkybpVoAqQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jduin-0005CK-16; Wed, 27 May 2020 11:59:45 +0000 Received: from mx2.suse.de ([195.135.220.15]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jduda-0006ew-VJ; Wed, 27 May 2020 11:54:24 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id B8CE3ACB8; Wed, 27 May 2020 11:54:21 +0000 (UTC) From: Nicolas Saenz Julienne To: bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [RFC 09/50] staging: vchiq: move vchiq_release_message() into vchiq Date: Wed, 27 May 2020 13:53:14 +0200 Message-Id: <20200527115400.31391-10-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527115400.31391-1-nsaenzjulienne@suse.de> References: <20200527115400.31391-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200527_045423_209312_07A24019 X-CRM114-Status: GOOD ( 11.59 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -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] 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [195.135.220.15 listed in wl.mailspike.net] -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, laurent.pinchart@ideasonboard.com, Nicolas Saenz Julienne , gregkh@linuxfoundation.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org For messages with a reason different from VCHIQ_MESSAGE_AVAILABLE the responsibility for releasing them is kept in vchi, in other words, services don't need to worry about it. As we're trying to unify vchi and vchiq, move the release code into vchiq. Signed-off-by: Nicolas Saenz Julienne --- .../staging/vc04_services/interface/vchiq_arm/vchiq_core.c | 4 ++++ .../staging/vc04_services/interface/vchiq_arm/vchiq_shim.c | 4 +--- 2 files changed, 5 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 67b2090c91db..ef31e541c902 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c @@ -372,6 +372,10 @@ make_service_callback(struct vchiq_service *service, enum vchiq_reason reason, service->state->id, service->handle); status = VCHIQ_SUCCESS; } + + if (reason != VCHIQ_MESSAGE_AVAILABLE) + vchiq_release_message(service->handle, header); + return status; } 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 0fc5fa05c6c2..55f9e34ea50e 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c @@ -444,7 +444,7 @@ static enum vchiq_status shim_callback(enum vchiq_reason reason, service->callback(service->callback_param, VCHI_CALLBACK_MSG_AVAILABLE, NULL); - goto done; + break; case VCHIQ_BULK_TRANSMIT_DONE: service->callback(service->callback_param, @@ -483,8 +483,6 @@ static enum vchiq_status shim_callback(enum vchiq_reason reason, } release: - vchiq_release_message(service->handle, header); -done: return VCHIQ_SUCCESS; } From patchwork Wed May 27 11:53:15 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: 11572693 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 72B7960D for ; Wed, 27 May 2020 11:58:38 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 50E3B207D8 for ; Wed, 27 May 2020 11:58:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="tdSJ/Dc3" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 50E3B207D8 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=bombadil.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=mjsdUilk2T7cwDc7XRO1GLCVDUVFF7YOALyWFWsLlAE=; b=tdSJ/Dc3njYpZt R9qejgPQGPUfjT/bo3R5S6lwj9wuDrMgyzeoB/kv8gIN5w44UtBBBB/QVB8O3ZiKB1J+YZpO/JnNX ai51yCmozAdyKW9GCj9gBpBj58l72KHtxZGdXLMB9mSiiZ/L7gTGVkqW598x8YCmHvsfUEItUeOis B/tHNcBCcT4Qi8onxWDdrfbM+65jJaKKVMszN0Jv9A70MCuHytqkiXiKRE01UJNjEzzCKZD8ypyoJ uMnv3FjYSvlnAB2QaCxAmcWhym9htWqKqu4UkPCUnTxU5XnBxa+speVY+GEhLT6zdz7CHhCM00KsJ IOngHo/765BseBoDfxWg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jduhZ-0004DA-Tt; Wed, 27 May 2020 11:58:30 +0000 Received: from mx2.suse.de ([195.135.220.15]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jduda-0006ex-VI; Wed, 27 May 2020 11:54:24 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 77FDCAF16; Wed, 27 May 2020 11:54:22 +0000 (UTC) From: Nicolas Saenz Julienne To: bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [RFC 10/50] staging: vchiq: Get rid of VCHIQ_SERVICE_OPENEND callback reason Date: Wed, 27 May 2020 13:53:15 +0200 Message-Id: <20200527115400.31391-11-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527115400.31391-1-nsaenzjulienne@suse.de> References: <20200527115400.31391-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200527_045423_183061_EF91B364 X-CRM114-Status: GOOD ( 10.09 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -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] 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [195.135.220.15 listed in wl.mailspike.net] -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, laurent.pinchart@ideasonboard.com, Nicolas Saenz Julienne , gregkh@linuxfoundation.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Nobody uses it and it's routinely discarded in vchi. Signed-off-by: Nicolas Saenz Julienne --- .../vc04_services/interface/vchiq_arm/vchiq_core.c | 9 --------- .../vc04_services/interface/vchiq_arm/vchiq_shim.c | 4 ---- 2 files changed, 13 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 ef31e541c902..ae9183db44ee 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c @@ -1484,15 +1484,6 @@ parse_open(struct vchiq_state *state, struct vchiq_header *header) : VCHIQ_SRVSTATE_OPEN); } - service->remoteport = remoteport; - service->client_id = ((int *)header->data)[1]; - if (make_service_callback(service, VCHIQ_SERVICE_OPENED, - NULL, NULL) == VCHIQ_RETRY) { - /* Bail out if not ready */ - service->remoteport = VCHIQ_PORT_FREE; - goto bail_not_ready; - } - /* Success - the message has been dealt with */ unlock_service(service); return 1; 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 55f9e34ea50e..75d87b6992c4 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c @@ -461,10 +461,6 @@ static enum vchiq_status shim_callback(enum vchiq_reason reason, VCHI_CALLBACK_SERVICE_CLOSED, NULL); break; - case VCHIQ_SERVICE_OPENED: - /* No equivalent VCHI reason */ - break; - case VCHIQ_BULK_TRANSMIT_ABORTED: service->callback(service->callback_param, VCHI_CALLBACK_BULK_TRANSMIT_ABORTED, From patchwork Wed May 27 11:53:16 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: 11572695 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 2D68292A for ; Wed, 27 May 2020 11:58:56 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 03B24207CB for ; Wed, 27 May 2020 11:58:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="bDcLT8Vp" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 03B24207CB 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=bombadil.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=nHjpULkvuYZ5uw3txh0IaCGB6uhddalqiyZiyHq9HiE=; b=bDcLT8VplewCBX 9d5GV71Lk1qFpvr36ZfRfNFsUSjWloNLChrGjnS4nL7UBKLKYVB9m+KJEW0cQ+0BDc89f5QUYQ/7u J+WcFIg0m3dQAmV5n/P+t8kYJOu05pm7Q2lLosC64NdfplNfQX65wEcj6t0ky/QQ5oWSzj0rOve2V KOop7GpBcl9dTCAXFRnc93YMAGnjElhr2yQrI5rE2VOxvKEB1K3OWBbTgF0/+2rN708SF7deBXFVv 6Nt95ZTWj6nb1rRtPvY9m0fy8Dju6Z4mZE4Wh8l0ysss1JCMRKHY3tLE1HNlnp8sewyWhBiBqbeRz z2ZYqrHg/ahQRQO82aCw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jduhv-0004Tw-GB; Wed, 27 May 2020 11:58:51 +0000 Received: from mx2.suse.de ([195.135.220.15]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdudb-0006ey-5F; Wed, 27 May 2020 11:54:25 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 37455AF38; Wed, 27 May 2020 11:54:23 +0000 (UTC) From: Nicolas Saenz Julienne To: bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [RFC 11/50] staging: vchi: Get rid of all useless callback reasons Date: Wed, 27 May 2020 13:53:16 +0200 Message-Id: <20200527115400.31391-12-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527115400.31391-1-nsaenzjulienne@suse.de> References: <20200527115400.31391-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200527_045423_435067_86A8E29D X-CRM114-Status: GOOD ( 12.55 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -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] 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [195.135.220.15 listed in wl.mailspike.net] -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, laurent.pinchart@ideasonboard.com, Nicolas Saenz Julienne , gregkh@linuxfoundation.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org They are neither produced nor expected, so just delete them. Signed-off-by: Nicolas Saenz Julienne --- .../interface/vchi/vchi_common.h | 40 ++----------------- 1 file changed, 3 insertions(+), 37 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchi/vchi_common.h b/drivers/staging/vc04_services/interface/vchi/vchi_common.h index 7fc04e38936d..0f79bea4757d 100644 --- a/drivers/staging/vc04_services/interface/vchi/vchi_common.h +++ b/drivers/staging/vc04_services/interface/vchi/vchi_common.h @@ -31,8 +31,6 @@ enum vchi_crc_control { //callback reasons when an event occurs on a service enum vchi_callback_reason { - VCHI_CALLBACK_REASON_MIN, - /* * This indicates that there is data available handle is the msg id that * was transmitted with the data @@ -41,44 +39,12 @@ enum vchi_callback_reason { * Tasks get kicked by the callback, reset their event and try and read * from the fifo until it fails */ + VCHI_CALLBACK_SERVICE_CLOSED, VCHI_CALLBACK_MSG_AVAILABLE, - VCHI_CALLBACK_MSG_SENT, - VCHI_CALLBACK_MSG_SPACE_AVAILABLE, // XXX not yet implemented - - // This indicates that a transfer from the other side has completed - VCHI_CALLBACK_BULK_RECEIVED, - //This indicates that data queued up to be sent has now gone - //handle is the msg id that was used when sending the data VCHI_CALLBACK_BULK_SENT, - VCHI_CALLBACK_BULK_RX_SPACE_AVAILABLE, // XXX not yet implemented - VCHI_CALLBACK_BULK_TX_SPACE_AVAILABLE, // XXX not yet implemented - - VCHI_CALLBACK_SERVICE_CLOSED, - - /* - * this side has sent XOFF to peer due to lack of data consumption by - * service (suggests the service may need to take some recovery action - * if it has been deliberately holding off consuming data) - */ - VCHI_CALLBACK_SENT_XOFF, - VCHI_CALLBACK_SENT_XON, - - // indicates that a bulk transfer has finished reading the source buffer - VCHI_CALLBACK_BULK_DATA_READ, - - // power notification events (currently host side only) - VCHI_CALLBACK_PEER_OFF, - VCHI_CALLBACK_PEER_SUSPENDED, - VCHI_CALLBACK_PEER_ON, - VCHI_CALLBACK_PEER_RESUMED, - VCHI_CALLBACK_FORCED_POWER_OFF, - - // some extra notifications provided by vchiq_arm - VCHI_CALLBACK_SERVICE_OPENED, - VCHI_CALLBACK_BULK_RECEIVE_ABORTED, + VCHI_CALLBACK_BULK_RECEIVED, VCHI_CALLBACK_BULK_TRANSMIT_ABORTED, - - VCHI_CALLBACK_REASON_MAX + VCHI_CALLBACK_BULK_RECEIVE_ABORTED, }; // service control options From patchwork Wed May 27 11:53:17 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: 11572697 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 2E03960D for ; Wed, 27 May 2020 11:59:17 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 9E8C6207D8 for ; Wed, 27 May 2020 11:59:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="u0j0RlvY" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9E8C6207D8 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=bombadil.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=QtDCmSBng/EWuqOziZqMDg7KLfW83phmnc+jqxK9mWU=; b=u0j0RlvYAod/e3 OkXitol0RTVP4w+h28J2OZRUxm92zXEMhSyXzvvazK1njRr0edGg2vLPL92CtjP/kGvjgRxXRpnWX 8sQaY46OgKwIwM/NFzoJkKYt8Y3e2LBJZEDy+PVrr6NQEDmCkIyM6L+ICHH89Ld6jRqKCRoCKFENo zrKc2/ZSUgSkkH6hi8v8aYg92pPUviyDRbcMNoq+llWcLKb/686l4Pdo+fwMDT+/4bvbNH2x73DQy rThjQDc6PfdvEnshacZH3oNfDTkVXRpgMJTCm2/7n7444gtIM5NptSPMX3kwclsE/SvUxnDRl057E 6V2KjpbQKxJVFAJV1sBA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jduiC-0004kj-Ku; Wed, 27 May 2020 11:59:08 +0000 Received: from mx2.suse.de ([195.135.220.15]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdudb-0006f0-Bb; Wed, 27 May 2020 11:54:25 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 2F67BAE61; Wed, 27 May 2020 11:54:24 +0000 (UTC) From: Nicolas Saenz Julienne To: bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [RFC 12/50] staging: vchi: Get rid of vchi_msg_peek() Date: Wed, 27 May 2020 13:53:17 +0200 Message-Id: <20200527115400.31391-13-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527115400.31391-1-nsaenzjulienne@suse.de> References: <20200527115400.31391-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200527_045423_707901_9D5E4B9D X-CRM114-Status: GOOD ( 16.66 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -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] 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [195.135.220.15 listed in wl.mailspike.net] -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, laurent.pinchart@ideasonboard.com, Nicolas Saenz Julienne , gregkh@linuxfoundation.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org There already is a function that covers most of the functionality vchi_msg_peek() provides: vchi_msg_hold(). The main difference being that the later removes the message from vchu's queue while the other does it later on, while releasing the message. There are no users of this function that can't be trivially converted to vchi_msg_hold(). So, for the sake of removing duplicate code, get rid of vchi_msg_peek(). Note that the opposite change could be performed as well. But vchi_msg_peek()'s implementation was deemed less robust as messages have to be released in order. Signed-off-by: Nicolas Saenz Julienne --- .../vc04_services/interface/vchi/vchi.h | 12 ---- .../interface/vchiq_arm/vchiq_shim.c | 64 ------------------- .../interface/vchiq_arm/vchiq_util.c | 12 ---- .../interface/vchiq_arm/vchiq_util.h | 1 - .../vc04_services/vc-sm-cma/vc_sm_cma_vchi.c | 7 +- 5 files changed, 4 insertions(+), 92 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h b/drivers/staging/vc04_services/interface/vchi/vchi.h index 1a981e98e82b..1daef5ad70f1 100644 --- a/drivers/staging/vc04_services/interface/vchi/vchi.h +++ b/drivers/staging/vc04_services/interface/vchi/vchi.h @@ -103,18 +103,6 @@ extern int32_t vchi_msg_dequeue(struct vchi_service_handle *handle, uint32_t *actual_msg_size, enum vchi_flags flags); -// Routine to look at a message in place. -// The message is not dequeued, so a subsequent call to peek or dequeue -// will return the same message. -extern int32_t vchi_msg_peek(struct vchi_service_handle *handle, - void **data, - uint32_t *msg_size, - enum vchi_flags flags); - -// Routine to remove a message after it has been read in place with peek -// The first message on the queue is dequeued. -extern int32_t vchi_msg_remove(struct vchi_service_handle *handle); - // 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_shim.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c index 75d87b6992c4..54c2492b7c83 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c @@ -18,70 +18,6 @@ struct shim_service { void *callback_param; }; -/*********************************************************** - * Name: vchi_msg_peek - * - * Arguments: struct vchi_service_handle *handle, - * void **data, - * uint32_t *msg_size, - - * enum vchi_flags flags - * - * Description: Routine to return a pointer to the current message (to allow in - * place processing). The message can be removed using - * vchi_msg_remove when you're finished - * - * Returns: int32_t - success == 0 - * - ***********************************************************/ -int32_t vchi_msg_peek(struct vchi_service_handle *handle, - void **data, - uint32_t *msg_size, - enum vchi_flags flags) -{ - struct shim_service *service = (struct shim_service *)handle; - struct vchiq_header *header; - - WARN_ON((flags != VCHI_FLAGS_NONE) && - (flags != VCHI_FLAGS_BLOCK_UNTIL_OP_COMPLETE)); - - if (flags == VCHI_FLAGS_NONE) - if (vchiu_queue_is_empty(&service->queue)) - return -1; - - header = vchiu_queue_peek(&service->queue); - - *data = header->data; - *msg_size = header->size; - - return 0; -} -EXPORT_SYMBOL(vchi_msg_peek); - -/*********************************************************** - * Name: vchi_msg_remove - * - * Arguments: struct vchi_service_handle *handle, - * - * Description: Routine to remove a message (after it has been read with - * vchi_msg_peek) - * - * Returns: int32_t - success == 0 - * - ***********************************************************/ -int32_t vchi_msg_remove(struct vchi_service_handle *handle) -{ - struct shim_service *service = (struct shim_service *)handle; - struct vchiq_header *header; - - header = vchiu_queue_pop(&service->queue); - - vchiq_release_message(service->handle, header); - - return 0; -} -EXPORT_SYMBOL(vchi_msg_remove); - int vchi_queue_kernel_message(struct vchi_service_handle *handle, void *data, unsigned int size) { diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.c index 644844d88fed..c1c81f9ab9e6 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.c @@ -55,18 +55,6 @@ void vchiu_queue_push(struct vchiu_queue *queue, struct vchiq_header *header) complete(&queue->push); } -struct vchiq_header *vchiu_queue_peek(struct vchiu_queue *queue) -{ - while (queue->write == queue->read) { - if (wait_for_completion_interruptible(&queue->push)) - flush_signals(current); - } - - complete(&queue->push); // We haven't removed anything from the queue. - - return queue->storage[queue->read & (queue->size - 1)]; -} - struct vchiq_header *vchiu_queue_pop(struct vchiu_queue *queue) { struct vchiq_header *header; diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.h index f03a4250de0d..1c90a8da1a92 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.h +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.h @@ -44,7 +44,6 @@ extern int vchiu_queue_is_empty(struct vchiu_queue *queue); extern void vchiu_queue_push(struct vchiu_queue *queue, struct vchiq_header *header); -extern struct vchiq_header *vchiu_queue_peek(struct vchiu_queue *queue); extern struct vchiq_header *vchiu_queue_pop(struct vchiu_queue *queue); #endif diff --git a/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c b/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c index 6a203c60bf7f..cd3f62844616 100644 --- a/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c +++ b/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c @@ -180,6 +180,7 @@ static int vc_sm_cma_vchi_videocore_io(void *arg) struct sm_instance *instance = arg; struct sm_cmd_rsp_blk *cmd = NULL, *cmd_tmp; struct vc_sm_result_t *reply; + struct vchi_held_msg msg; u32 reply_len; s32 status; int svc_use = 1; @@ -236,8 +237,8 @@ static int vc_sm_cma_vchi_videocore_io(void *arg) } while (1); - while (!vchi_msg_peek(instance->vchi_handle[0], (void **)&reply, - &reply_len, VCHI_FLAGS_NONE)) { + while (!vchi_msg_hold(instance->vchi_handle[0], (void **)&reply, + &reply_len, VCHI_FLAGS_NONE, &msg)) { if (reply->trans_id & 0x80000000) { /* Async event or cmd from the VPU */ if (instance->vpu_event) @@ -248,7 +249,7 @@ static int vc_sm_cma_vchi_videocore_io(void *arg) reply_len); } - vchi_msg_remove(instance->vchi_handle[0]); + vchi_held_msg_release(&msg); } /* Go through the dead list and free them */ From patchwork Wed May 27 11:53:18 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: 11572703 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 1F15E92A for ; Wed, 27 May 2020 12:00:46 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id ED79A207CB for ; Wed, 27 May 2020 12:00:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="HAU5+tSm" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org ED79A207CB 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=bombadil.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=y58NEPxaoQMozBmbODaxwklKek9yBMm/OqoW53fGThE=; b=HAU5+tSmUFJYUr jsFRRnHDMKos7gfMBHco1n8CpEcd/eeNZj0tGUWulj0pin9o9lN8LFS0tIpeIeD2CXaL0oeXPj3bu 4I3WbccUMD5G/vhrAaIILamuwfO9xPkr9B04BQ9eyhj1+5+IDOxXKhb9zH2ZS02I0vSbvu/gh1n7B TMfUqippTziZ8YRFZbHqF57DVJeZyTq5JfLqAWih28ayAg+U5PKa+B/gOhrCESRnzWUxfuGUbks3b LNQKXvuGAp2UnpAbE75ZLMzB6b90q4b6Xfcd7euZTOVV8UO6vf3N4N8WRTXLkArWsgWWx5l3nU09d 53AN0Flp0/mWZnCpSVsQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdujc-00085b-HH; Wed, 27 May 2020 12:00:36 +0000 Received: from mx2.suse.de ([195.135.220.15]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdudd-0006h0-3b; Wed, 27 May 2020 11:54:27 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id A8046AC5B; Wed, 27 May 2020 11:54:25 +0000 (UTC) From: Nicolas Saenz Julienne To: bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Nicolas Saenz Julienne , Florian Fainelli , Ray Jui , Scott Branden Subject: [RFC 13/50] staging: vchi: Get rid of struct vchi_instance_handle Date: Wed, 27 May 2020 13:53:18 +0200 Message-Id: <20200527115400.31391-14-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527115400.31391-1-nsaenzjulienne@suse.de> References: <20200527115400.31391-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200527_045425_450217_BF16B5F5 X-CRM114-Status: GOOD ( 21.34 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -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] 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [195.135.220.15 listed in wl.mailspike.net] -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, laurent.pinchart@ideasonboard.com, linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org The idea behind this was to create an opaque handle to struct vchiq_instance. This can be achieved without creating a new type by means of a forward declaration of struct vchiq_instance. This saves us from a lot of useless casting and overall simplifies code. Signed-off-by: Nicolas Saenz Julienne --- .../bcm2835-audio/bcm2835-vchiq.c | 20 ++++++------- .../vc04_services/bcm2835-audio/bcm2835.h | 2 +- .../vc04_services/interface/vchi/vchi.h | 12 ++++---- .../interface/vchiq_arm/vchiq_shim.c | 30 ++++++------------- .../staging/vc04_services/vc-sm-cma/vc_sm.c | 8 ++--- .../vc04_services/vc-sm-cma/vc_sm_cma_vchi.c | 4 +-- .../vc04_services/vc-sm-cma/vc_sm_cma_vchi.h | 2 +- .../vc04_services/vchiq-mmal/mmal-vchiq.c | 8 ++--- 8 files changed, 37 insertions(+), 49 deletions(-) diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c index 73144f1ce45e..8c9390153a26 100644 --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c @@ -122,7 +122,7 @@ static void audio_vchi_callback(void *param, } static int -vc_vchi_audio_init(struct vchi_instance_handle *vchi_instance, +vc_vchi_audio_init(struct vchiq_instance *vchiq_instance, struct bcm2835_audio_instance *instance) { struct service_creation params = { @@ -134,7 +134,7 @@ vc_vchi_audio_init(struct vchi_instance_handle *vchi_instance, int status; /* Open the VCHI service connections */ - status = vchi_service_open(vchi_instance, ¶ms, + status = vchi_service_open(vchiq_instance, ¶ms, &instance->vchi_handle); if (status) { @@ -173,20 +173,20 @@ int bcm2835_new_vchi_ctx(struct device *dev, struct bcm2835_vchi_ctx *vchi_ctx) int ret; /* Initialize and create a VCHI connection */ - ret = vchi_initialise(&vchi_ctx->vchi_instance); + ret = vchi_initialise(&vchi_ctx->instance); if (ret) { dev_err(dev, "failed to initialise VCHI instance (ret=%d)\n", ret); return -EIO; } - ret = vchi_connect(vchi_ctx->vchi_instance); + ret = vchi_connect(vchi_ctx->instance); if (ret) { dev_dbg(dev, "failed to connect VCHI instance (ret=%d)\n", ret); - kfree(vchi_ctx->vchi_instance); - vchi_ctx->vchi_instance = NULL; + kfree(vchi_ctx->instance); + vchi_ctx->instance = NULL; return -EIO; } @@ -196,10 +196,10 @@ int bcm2835_new_vchi_ctx(struct device *dev, struct bcm2835_vchi_ctx *vchi_ctx) void bcm2835_free_vchi_ctx(struct bcm2835_vchi_ctx *vchi_ctx) { - /* Close the VCHI connection - it will also free vchi_instance */ - WARN_ON(vchi_disconnect(vchi_ctx->vchi_instance)); + /* Close the VCHI connection - it will also free vchi_ctx->instance */ + WARN_ON(vchi_disconnect(vchi_ctx->instance)); - vchi_ctx->vchi_instance = NULL; + vchi_ctx->instance = NULL; } int bcm2835_audio_open(struct bcm2835_alsa_stream *alsa_stream) @@ -217,7 +217,7 @@ int bcm2835_audio_open(struct bcm2835_alsa_stream *alsa_stream) instance->alsa_stream = alsa_stream; alsa_stream->instance = instance; - err = vc_vchi_audio_init(vchi_ctx->vchi_instance, + err = vc_vchi_audio_init(vchi_ctx->instance, instance); if (err < 0) goto free_instance; diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h b/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h index d2fe8d36ab7d..2a94e825194f 100644 --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h @@ -44,7 +44,7 @@ enum snd_bcm2835_ctrl { }; struct bcm2835_vchi_ctx { - struct vchi_instance_handle *vchi_instance; + struct vchiq_instance *instance; }; /* definition of the chip-specific record */ diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h b/drivers/staging/vc04_services/interface/vchi/vchi.h index 1daef5ad70f1..6b73d8fb394a 100644 --- a/drivers/staging/vc04_services/interface/vchi/vchi.h +++ b/drivers/staging/vc04_services/interface/vchi/vchi.h @@ -49,8 +49,8 @@ struct service_creation { void *callback_param; }; -// Opaque handle for a VCHI instance -struct vchi_instance_handle; +// Opaque handle for a VCHIQ instance +struct vchiq_instance; // Opaque handle for a server or client struct vchi_service_handle; @@ -61,19 +61,19 @@ struct vchi_service_handle; *****************************************************************************/ // Routine used to initialise the vchi on both local + remote connections -extern int32_t vchi_initialise(struct vchi_instance_handle **instance_handle); +extern int32_t vchi_initialise(struct vchiq_instance **instance); -extern int32_t vchi_connect(struct vchi_instance_handle *instance_handle); +extern int32_t vchi_connect(struct vchiq_instance *instance); //When this is called, ensure that all services have no data pending. //Bulk transfers can remain 'queued' -extern int32_t vchi_disconnect(struct vchi_instance_handle *instance_handle); +extern int32_t vchi_disconnect(struct vchiq_instance *instance); /****************************************************************************** * Global service API *****************************************************************************/ // Routine to open a named service -extern int32_t vchi_service_open(struct vchi_instance_handle *instance_handle, +extern int32_t vchi_service_open(struct vchiq_instance *instance, struct service_creation *setup, struct vchi_service_handle **handle); 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 54c2492b7c83..8758704d61c9 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c @@ -287,7 +287,7 @@ EXPORT_SYMBOL(vchi_msg_hold); /*********************************************************** * Name: vchi_initialise * - * Arguments: struct vchi_instance_handle **instance_handle + * Arguments: struct vchiq_instance **instance * * Description: Initialises the hardware but does not transmit anything * When run as a Host App this will be called twice hence the need @@ -297,23 +297,16 @@ EXPORT_SYMBOL(vchi_msg_hold); * ***********************************************************/ -int32_t vchi_initialise(struct vchi_instance_handle **instance_handle) +int32_t vchi_initialise(struct vchiq_instance **instance) { - struct vchiq_instance *instance; - enum vchiq_status status; - - status = vchiq_initialise(&instance); - - *instance_handle = (struct vchi_instance_handle *)instance; - - return status; + return vchiq_initialise(instance); } EXPORT_SYMBOL(vchi_initialise); /*********************************************************** * Name: vchi_connect * - * Arguments: struct vchi_instance_handle *instance_handle + * Arguments: struct vchiq_instance *instance * * Description: Starts the command service on each connection, * causing INIT messages to be pinged back and forth @@ -321,10 +314,8 @@ EXPORT_SYMBOL(vchi_initialise); * Returns: 0 if successful, failure otherwise * ***********************************************************/ -int32_t vchi_connect(struct vchi_instance_handle *instance_handle) +int32_t vchi_connect(struct vchiq_instance *instance) { - struct vchiq_instance *instance = (struct vchiq_instance *)instance_handle; - return vchiq_connect(instance); } EXPORT_SYMBOL(vchi_connect); @@ -332,7 +323,7 @@ EXPORT_SYMBOL(vchi_connect); /*********************************************************** * Name: vchi_disconnect * - * Arguments: struct vchi_instance_handle *instance_handle + * Arguments: struct vchiq_instance *instance * * Description: Stops the command service on each connection, * causing DE-INIT messages to be pinged back and forth @@ -340,10 +331,8 @@ EXPORT_SYMBOL(vchi_connect); * Returns: 0 if successful, failure otherwise * ***********************************************************/ -int32_t vchi_disconnect(struct vchi_instance_handle *instance_handle) +int32_t vchi_disconnect(struct vchiq_instance *instance) { - struct vchiq_instance *instance = (struct vchiq_instance *)instance_handle; - return vchiq_shutdown(instance); } EXPORT_SYMBOL(vchi_disconnect); @@ -352,7 +341,7 @@ EXPORT_SYMBOL(vchi_disconnect); * Name: vchi_service_open * Name: vchi_service_create * - * Arguments: struct vchi_instance_handle *instance_handle + * Arguments: struct vchiq_instance *instance * struct service_creation *setup, * struct vchi_service_handle **handle * @@ -446,11 +435,10 @@ static void service_free(struct shim_service *service) } } -int32_t vchi_service_open(struct vchi_instance_handle *instance_handle, +int32_t vchi_service_open(struct vchiq_instance *instance, struct service_creation *setup, struct vchi_service_handle **handle) { - struct vchiq_instance *instance = (struct vchiq_instance *)instance_handle; struct shim_service *service = service_alloc(instance, setup); *handle = (struct vchi_service_handle *)service; diff --git a/drivers/staging/vc04_services/vc-sm-cma/vc_sm.c b/drivers/staging/vc04_services/vc-sm-cma/vc_sm.c index cd5fb561debb..3f95ea90c08a 100644 --- a/drivers/staging/vc04_services/vc-sm-cma/vc_sm.c +++ b/drivers/staging/vc04_services/vc-sm-cma/vc_sm.c @@ -1505,7 +1505,7 @@ static const struct file_operations vc_sm_ops = { static void vc_sm_connected_init(void) { int ret; - struct vchi_instance_handle *vchi_instance; + struct vchiq_instance *instance; struct vc_sm_version version; struct vc_sm_result_t version_result; @@ -1515,7 +1515,7 @@ static void vc_sm_connected_init(void) * Initialize and create a VCHI connection for the shared memory service * running on videocore. */ - ret = vchi_initialise(&vchi_instance); + ret = vchi_initialise(&instance); if (ret) { pr_err("[%s]: failed to initialise VCHI instance (ret=%d)\n", __func__, ret); @@ -1523,7 +1523,7 @@ static void vc_sm_connected_init(void) return; } - ret = vchi_connect(vchi_instance); + ret = vchi_connect(instance); if (ret) { pr_err("[%s]: failed to connect VCHI instance (ret=%d)\n", __func__, ret); @@ -1532,7 +1532,7 @@ static void vc_sm_connected_init(void) } /* Initialize an instance of the shared memory service. */ - sm_state->sm_handle = vc_sm_cma_vchi_init(vchi_instance, 1, + sm_state->sm_handle = vc_sm_cma_vchi_init(instance, 1, vc_sm_vpu_event); if (!sm_state->sm_handle) { pr_err("[%s]: failed to initialize shared memory service\n", diff --git a/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c b/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c index cd3f62844616..b142fadb2bb5 100644 --- a/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c +++ b/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c @@ -285,7 +285,7 @@ static void vc_sm_cma_vchi_callback(void *param, } } -struct sm_instance *vc_sm_cma_vchi_init(struct vchi_instance_handle *vchi_instance, +struct sm_instance *vc_sm_cma_vchi_init(struct vchiq_instance *vchiq_instance, unsigned int num_connections, vpu_event_cb vpu_event) { @@ -328,7 +328,7 @@ struct sm_instance *vc_sm_cma_vchi_init(struct vchi_instance_handle *vchi_instan .callback_param = instance, }; - status = vchi_service_open(vchi_instance, + status = vchi_service_open(vchiq_instance, ¶ms, &instance->vchi_handle[i]); if (status) { pr_err("%s: failed to open VCHI service (%d)", diff --git a/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.h b/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.h index e8db34bd1e91..44cc389364f4 100644 --- a/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.h +++ b/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.h @@ -28,7 +28,7 @@ typedef void (*vpu_event_cb)(struct sm_instance *instance, /* * Initialize the shared memory service, opens up vchi connection to talk to it. */ -struct sm_instance *vc_sm_cma_vchi_init(struct vchi_instance_handle *vchi_instance, +struct sm_instance *vc_sm_cma_vchi_init(struct vchiq_instance *vchiq_instance, unsigned int num_connections, vpu_event_cb vpu_event); diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c index 4c89bc0bec15..3504ea8aed4f 100644 --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c @@ -2098,7 +2098,7 @@ int vchiq_mmal_init(struct vchiq_mmal_instance **out_instance) { int status; struct vchiq_mmal_instance *instance; - static struct vchi_instance_handle *vchi_instance; + static struct vchiq_instance *vchiq_instance; struct service_creation params = { .version = VCHI_VERSION_EX(VC_MMAL_VER, VC_MMAL_MIN_VER), .service_id = VC_MMAL_SERVER_NAME, @@ -2120,14 +2120,14 @@ int vchiq_mmal_init(struct vchiq_mmal_instance **out_instance) BUILD_BUG_ON(sizeof(struct mmal_port) != 64); /* create a vchi instance */ - status = vchi_initialise(&vchi_instance); + status = vchi_initialise(&vchiq_instance); if (status) { pr_err("Failed to initialise VCHI instance (status=%d)\n", status); return -EIO; } - status = vchi_connect(vchi_instance); + status = vchi_connect(vchiq_instance); if (status) { pr_err("Failed to connect VCHI instance (status=%d)\n", status); return -EIO; @@ -2152,7 +2152,7 @@ int vchiq_mmal_init(struct vchiq_mmal_instance **out_instance) if (!instance->bulk_wq) goto err_free; - status = vchi_service_open(vchi_instance, ¶ms, &instance->handle); + status = vchi_service_open(vchiq_instance, ¶ms, &instance->handle); if (status) { pr_err("Failed to open VCHI service connection (status=%d)\n", status); From patchwork Wed May 27 11:53:19 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: 11572701 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 680BF92A for ; Wed, 27 May 2020 12:00:23 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 2489B20721 for ; Wed, 27 May 2020 12:00:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="fyL2Uqzx" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2489B20721 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=bombadil.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=ekNtBL0AyDeOgGZ4SeuV9ceffiKPufTP89mZQV1FCz4=; b=fyL2UqzxWxcyv8 u/JvF9M72lQCRuBYZIaobG2HokYPWH0nTPamFKEGww3gX4y4a6uz9sWzbiC8sbubgIc/4oGmjgGjw 21GMz4q4kTls96tH5E5Dh8scUflxP2Uv546o43I1i1gbYrspwqR1nGSdpZ4Olw2QZQhXNEypyAE8V ZVb9y7pDoQP2GykHZ9V1n8ZdTBo4ll8/BYl006YWftEhXKtrefCvYHTUZpyKuMsnD6POWLQ6PzSJY OOG32fHGS5mI8liYBZfRoYLrDjP60I/DtJ59DRfAdgx1yTB14GlVVhxyCT5oXmFXQcwftPYGLOPMV wBY3FN5ZBW5ZCKLqE/dQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdujN-0007dF-LK; Wed, 27 May 2020 12:00:22 +0000 Received: from mx2.suse.de ([195.135.220.15]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdude-0006j9-Mx; Wed, 27 May 2020 11:54:31 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id AD25AAB7D; Wed, 27 May 2020 11:54:27 +0000 (UTC) From: Nicolas Saenz Julienne To: bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Nicolas Saenz Julienne , Florian Fainelli , Ray Jui , Scott Branden Subject: [RFC 14/50] staging: vchi: Unify struct shim_service and struct vchi_service_handle Date: Wed, 27 May 2020 13:53:19 +0200 Message-Id: <20200527115400.31391-15-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527115400.31391-1-nsaenzjulienne@suse.de> References: <20200527115400.31391-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200527_045427_235768_8EB161E2 X-CRM114-Status: GOOD ( 17.84 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -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] 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [195.135.220.15 listed in wl.mailspike.net] -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, laurent.pinchart@ideasonboard.com, linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org The idea behind struct vchi_service_handle is to create an opaque handle to struct shim_service. This can be achieved by doing a forward declaration of struct shim_service, which will avoid unwarranted casts and pointer play. Ultimately as a rename is due all over the vchi user space, rename struct shim_service into struvt vchi_service, which is more consistent with the rest of the exposed API. Signed-off-by: Nicolas Saenz Julienne --- .../bcm2835-audio/bcm2835-vchiq.c | 24 +++---- .../vc04_services/interface/vchi/vchi.h | 27 ++++---- .../interface/vchiq_arm/vchiq_shim.c | 68 ++++++++----------- .../vc04_services/vc-sm-cma/vc_sm_cma_vchi.c | 24 +++---- .../vc04_services/vchiq-mmal/mmal-vchiq.c | 34 +++++----- 5 files changed, 81 insertions(+), 96 deletions(-) diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c index 8c9390153a26..62eef233275f 100644 --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c @@ -9,7 +9,7 @@ struct bcm2835_audio_instance { struct device *dev; - struct vchi_service_handle *vchi_handle; + struct vchi_service *service; struct completion msg_avail_comp; struct mutex vchi_mutex; struct bcm2835_alsa_stream *alsa_stream; @@ -25,12 +25,12 @@ MODULE_PARM_DESC(force_bulk, "Force use of vchiq bulk for audio"); static void bcm2835_audio_lock(struct bcm2835_audio_instance *instance) { mutex_lock(&instance->vchi_mutex); - vchi_service_use(instance->vchi_handle); + vchi_service_use(instance->service); } static void bcm2835_audio_unlock(struct bcm2835_audio_instance *instance) { - vchi_service_release(instance->vchi_handle); + vchi_service_release(instance->service); mutex_unlock(&instance->vchi_mutex); } @@ -44,7 +44,7 @@ static int bcm2835_audio_send_msg_locked(struct bcm2835_audio_instance *instance init_completion(&instance->msg_avail_comp); } - status = vchi_queue_kernel_message(instance->vchi_handle, + status = vchi_queue_kernel_message(instance->service, m, sizeof(*m)); if (status) { dev_err(instance->dev, @@ -101,7 +101,7 @@ static void audio_vchi_callback(void *param, if (reason != VCHI_CALLBACK_MSG_AVAILABLE) return; - status = vchi_msg_dequeue(instance->vchi_handle, + status = vchi_msg_dequeue(instance->service, &m, sizeof(m), &msg_len, VCHI_FLAGS_NONE); if (status) return; @@ -135,7 +135,7 @@ vc_vchi_audio_init(struct vchiq_instance *vchiq_instance, /* Open the VCHI service connections */ status = vchi_service_open(vchiq_instance, ¶ms, - &instance->vchi_handle); + &instance->service); if (status) { dev_err(instance->dev, @@ -145,7 +145,7 @@ vc_vchi_audio_init(struct vchiq_instance *vchiq_instance, } /* Finished with the service for now */ - vchi_service_release(instance->vchi_handle); + vchi_service_release(instance->service); return 0; } @@ -155,10 +155,10 @@ static void vc_vchi_audio_deinit(struct bcm2835_audio_instance *instance) int status; mutex_lock(&instance->vchi_mutex); - vchi_service_use(instance->vchi_handle); + vchi_service_use(instance->service); /* Close all VCHI service connections */ - status = vchi_service_close(instance->vchi_handle); + status = vchi_service_close(instance->service); if (status) { dev_err(instance->dev, "failed to close VCHI service connection (status=%d)\n", @@ -228,7 +228,7 @@ int bcm2835_audio_open(struct bcm2835_alsa_stream *alsa_stream) goto deinit; bcm2835_audio_lock(instance); - vchi_get_peer_version(instance->vchi_handle, &instance->peer_version); + vchi_get_peer_version(instance->service, &instance->peer_version); bcm2835_audio_unlock(instance); if (instance->peer_version < 2 || force_bulk) instance->max_packet = 0; /* bulk transfer */ @@ -344,7 +344,7 @@ int bcm2835_audio_write(struct bcm2835_alsa_stream *alsa_stream, count = size; if (!instance->max_packet) { /* Send the message to the videocore */ - status = vchi_bulk_queue_transmit(instance->vchi_handle, + status = vchi_bulk_queue_transmit(instance->service, src, count, VCHI_FLAGS_BLOCK_UNTIL_DATA_READ, NULL); @@ -352,7 +352,7 @@ 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->vchi_handle, + status = vchi_queue_kernel_message(instance->service, 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 6b73d8fb394a..ff302e6b8b1b 100644 --- a/drivers/staging/vc04_services/interface/vchi/vchi.h +++ b/drivers/staging/vc04_services/interface/vchi/vchi.h @@ -53,7 +53,7 @@ struct service_creation { struct vchiq_instance; // Opaque handle for a server or client -struct vchi_service_handle; +struct vchi_service; /****************************************************************************** * Global funcs - implementation is specific to which side you are on @@ -75,30 +75,27 @@ extern int32_t vchi_disconnect(struct vchiq_instance *instance); // Routine to open a named service extern int32_t vchi_service_open(struct vchiq_instance *instance, struct service_creation *setup, - struct vchi_service_handle **handle); + struct vchi_service **service); -extern int32_t vchi_get_peer_version(const struct vchi_service_handle *handle, +extern int32_t vchi_get_peer_version(struct vchi_service *service, short *peer_version); // Routine to close a named service -extern int32_t vchi_service_close(const struct vchi_service_handle *handle); +extern int32_t vchi_service_close(struct vchi_service *service); // Routine to increment ref count on a named service -extern int32_t vchi_service_use(const struct vchi_service_handle *handle); +extern int32_t vchi_service_use(struct vchi_service *service); // Routine to decrement ref count on a named service -extern int32_t vchi_service_release(const struct vchi_service_handle *handle); +extern int32_t vchi_service_release(struct vchi_service *service); /* Routine to send a message from kernel memory across a service */ -extern int -vchi_queue_kernel_message(struct vchi_service_handle *handle, - void *data, - unsigned int size); +extern int vchi_queue_kernel_message(struct vchi_service *service, void *data, + unsigned int size); // Routine to receive a msg from a service // Dequeue is equivalent to hold, copy into client buffer, release -extern int32_t vchi_msg_dequeue(struct vchi_service_handle *handle, - void *data, +extern int32_t vchi_msg_dequeue(struct vchi_service *service, void *data, uint32_t max_data_size_to_read, uint32_t *actual_msg_size, enum vchi_flags flags); @@ -106,7 +103,7 @@ extern int32_t vchi_msg_dequeue(struct vchi_service_handle *handle, // 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. -extern int32_t vchi_msg_hold(struct vchi_service_handle *handle, +extern int32_t vchi_msg_hold(struct vchi_service *service, void **data, // } may be NULL, as info can be uint32_t *msg_size, // } obtained from HELD_MSG_T enum vchi_flags flags, @@ -125,14 +122,14 @@ extern int32_t vchi_held_msg_release(struct vchi_held_msg *message); *****************************************************************************/ // Routine to prepare interface for a transfer from the other side -extern int32_t vchi_bulk_queue_receive(struct vchi_service_handle *handle, +extern int32_t vchi_bulk_queue_receive(struct vchi_service *service, void *data_dst, uint32_t data_size, enum vchi_flags flags, void *transfer_handle); // Routine to queue up data ready for transfer to the other (once they have signalled they are ready) -extern int32_t vchi_bulk_queue_transmit(struct vchi_service_handle *handle, +extern int32_t vchi_bulk_queue_transmit(struct vchi_service *service, const void *data_src, uint32_t data_size, enum vchi_flags flags, 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 8758704d61c9..99eb7a5ccce6 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c @@ -9,7 +9,7 @@ #include "vchiq_util.h" -struct shim_service { +struct vchi_service { unsigned int handle; struct vchiu_queue queue; @@ -18,10 +18,9 @@ struct shim_service { void *callback_param; }; -int vchi_queue_kernel_message(struct vchi_service_handle *handle, void *data, - unsigned int size) +int vchi_queue_kernel_message(struct vchi_service *service, void *data, + unsigned int size) { - struct shim_service *service = (struct shim_service *)handle; enum vchiq_status status; while (1) { @@ -57,11 +56,10 @@ EXPORT_SYMBOL(vchi_queue_kernel_message); * Returns: int32_t - success == 0 * ***********************************************************/ -int32_t vchi_bulk_queue_receive(struct vchi_service_handle *handle, void *data_dst, +int32_t vchi_bulk_queue_receive(struct vchi_service *service, void *data_dst, uint32_t data_size, enum vchi_flags flags, void *bulk_handle) { - struct shim_service *service = (struct shim_service *)handle; enum vchiq_bulk_mode mode; enum vchiq_status status; @@ -115,13 +113,12 @@ EXPORT_SYMBOL(vchi_bulk_queue_receive); * Returns: int32_t - success == 0 * ***********************************************************/ -int32_t vchi_bulk_queue_transmit(struct vchi_service_handle *handle, +int32_t vchi_bulk_queue_transmit(struct vchi_service *service, const void *data_src, uint32_t data_size, enum vchi_flags flags, void *bulk_handle) { - struct shim_service *service = (struct shim_service *)handle; enum vchiq_bulk_mode mode; enum vchiq_status status; @@ -166,7 +163,7 @@ EXPORT_SYMBOL(vchi_bulk_queue_transmit); /*********************************************************** * Name: vchi_msg_dequeue * - * Arguments: struct vchi_service_handle *handle, + * Arguments: struct vchi_service *service, * void *data, * uint32_t max_data_size_to_read, * uint32_t *actual_msg_size @@ -177,11 +174,10 @@ EXPORT_SYMBOL(vchi_bulk_queue_transmit); * Returns: int32_t - success == 0 * ***********************************************************/ -int32_t vchi_msg_dequeue(struct vchi_service_handle *handle, void *data, +int32_t vchi_msg_dequeue(struct vchi_service *service, void *data, uint32_t max_data_size_to_read, uint32_t *actual_msg_size, enum vchi_flags flags) { - struct shim_service *service = (struct shim_service *)handle; struct vchiq_header *header; WARN_ON((flags != VCHI_FLAGS_NONE) && @@ -235,7 +231,7 @@ EXPORT_SYMBOL(vchi_held_msg_release); /*********************************************************** * Name: vchi_msg_hold * - * Arguments: struct vchi_service_handle *handle, + * Arguments: struct vchi_service *service, * void **data, * uint32_t *msg_size, * enum vchi_flags flags, @@ -249,11 +245,10 @@ EXPORT_SYMBOL(vchi_held_msg_release); * Returns: int32_t - success == 0 * ***********************************************************/ -int32_t vchi_msg_hold(struct vchi_service_handle *handle, void **data, +int32_t vchi_msg_hold(struct vchi_service *service, void **data, uint32_t *msg_size, enum vchi_flags flags, struct vchi_held_msg *message_handle) { - struct shim_service *service = (struct shim_service *)handle; struct vchiq_header *header; WARN_ON((flags != VCHI_FLAGS_NONE) && @@ -343,7 +338,7 @@ EXPORT_SYMBOL(vchi_disconnect); * * Arguments: struct vchiq_instance *instance * struct service_creation *setup, - * struct vchi_service_handle **handle + * struct vchi_service **service * * Description: Routine to open a service * @@ -356,8 +351,8 @@ static enum vchiq_status shim_callback(enum vchiq_reason reason, unsigned int handle, void *bulk_user) { - struct shim_service *service = - (struct shim_service *)VCHIQ_GET_SERVICE_USERDATA(handle); + struct vchi_service *service = + (struct vchi_service *)VCHIQ_GET_SERVICE_USERDATA(handle); if (!service->callback) goto release; @@ -407,10 +402,10 @@ static enum vchiq_status shim_callback(enum vchiq_reason reason, return VCHIQ_SUCCESS; } -static struct shim_service *service_alloc(struct vchiq_instance *instance, +static struct vchi_service *service_alloc(struct vchiq_instance *instance, struct service_creation *setup) { - struct shim_service *service = kzalloc(sizeof(struct shim_service), GFP_KERNEL); + struct vchi_service *service = kzalloc(sizeof(struct vchi_service), GFP_KERNEL); (void)instance; @@ -427,7 +422,7 @@ static struct shim_service *service_alloc(struct vchiq_instance *instance, return service; } -static void service_free(struct shim_service *service) +static void service_free(struct vchi_service *service) { if (service) { vchiu_queue_delete(&service->queue); @@ -437,12 +432,10 @@ static void service_free(struct shim_service *service) int32_t vchi_service_open(struct vchiq_instance *instance, struct service_creation *setup, - struct vchi_service_handle **handle) + struct vchi_service **service) { - struct shim_service *service = service_alloc(instance, setup); - - *handle = (struct vchi_service_handle *)service; + *service = service_alloc(instance, setup); if (service) { struct vchiq_service_params params; enum vchiq_status status; @@ -450,27 +443,25 @@ int32_t vchi_service_open(struct vchiq_instance *instance, memset(¶ms, 0, sizeof(params)); params.fourcc = setup->service_id; params.callback = shim_callback; - params.userdata = service; + params.userdata = *service; params.version = setup->version.version; params.version_min = setup->version.version_min; status = vchiq_open_service(instance, ¶ms, - &service->handle); + &((*service)->handle)); if (status != VCHIQ_SUCCESS) { - service_free(service); - service = NULL; - *handle = NULL; + service_free(*service); + *service = NULL; } } - return service ? 0 : -1; + return *service ? 0 : -1; } EXPORT_SYMBOL(vchi_service_open); -int32_t vchi_service_close(const struct vchi_service_handle *handle) +int32_t vchi_service_close(struct vchi_service *service) { int32_t ret = -1; - struct shim_service *service = (struct shim_service *)handle; if (service) { enum vchiq_status status = vchiq_close_service(service->handle); @@ -483,10 +474,9 @@ int32_t vchi_service_close(const struct vchi_service_handle *handle) } EXPORT_SYMBOL(vchi_service_close); -int32_t vchi_get_peer_version(const struct vchi_service_handle *handle, short *peer_version) +int32_t vchi_get_peer_version(struct vchi_service *service, short *peer_version) { int32_t ret = -1; - struct shim_service *service = (struct shim_service *)handle; if (service) { enum vchiq_status status; @@ -501,18 +491,17 @@ EXPORT_SYMBOL(vchi_get_peer_version); /*********************************************************** * Name: vchi_service_use * - * Arguments: const struct vchi_service_handle *handle + * Arguments: struct vchi_service *service * * Description: Routine to increment refcount on a service * * Returns: void * ***********************************************************/ -int32_t vchi_service_use(const struct vchi_service_handle *handle) +int32_t vchi_service_use(struct vchi_service *service) { int32_t ret = -1; - struct shim_service *service = (struct shim_service *)handle; if (service) ret = vchiq_use_service(service->handle); return ret; @@ -522,18 +511,17 @@ EXPORT_SYMBOL(vchi_service_use); /*********************************************************** * Name: vchi_service_release * - * Arguments: const struct vchi_service_handle *handle + * Arguments: struct vchi_service *service * * Description: Routine to decrement refcount on a service * * Returns: void * ***********************************************************/ -int32_t vchi_service_release(const struct vchi_service_handle *handle) +int32_t vchi_service_release(struct vchi_service *service) { int32_t ret = -1; - struct shim_service *service = (struct shim_service *)handle; if (service) ret = vchiq_release_service(service->handle); return ret; diff --git a/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c b/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c index b142fadb2bb5..32706eb2838b 100644 --- a/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c +++ b/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c @@ -47,7 +47,7 @@ struct sm_cmd_rsp_blk { struct sm_instance { u32 num_connections; - struct vchi_service_handle *vchi_handle[VCHI_MAX_NUM_CONNECTIONS]; + struct vchi_service *service[VCHI_MAX_NUM_CONNECTIONS]; struct task_struct *io_thread; struct completion io_cmplt; @@ -76,11 +76,11 @@ struct sm_instance { /* ---- Private Functions ------------------------------------------------ */ static int -bcm2835_vchi_msg_queue(struct vchi_service_handle *handle, +bcm2835_vchi_msg_queue(struct vchi_service *service, void *data, unsigned int size) { - return vchi_queue_kernel_message(handle, + return vchi_queue_kernel_message(service, data, size); } @@ -187,13 +187,13 @@ static int vc_sm_cma_vchi_videocore_io(void *arg) while (1) { if (svc_use) - vchi_service_release(instance->vchi_handle[0]); + vchi_service_release(instance->service[0]); svc_use = 0; if (wait_for_completion_interruptible(&instance->io_cmplt)) continue; - vchi_service_use(instance->vchi_handle[0]); + vchi_service_use(instance->service[0]); svc_use = 1; do { @@ -214,7 +214,7 @@ static int vc_sm_cma_vchi_videocore_io(void *arg) /* Send the command */ status = - bcm2835_vchi_msg_queue(instance->vchi_handle[0], + bcm2835_vchi_msg_queue(instance->service[0], cmd->msg, cmd->length); if (status) { pr_err("%s: failed to queue message (%d)", @@ -237,7 +237,7 @@ static int vc_sm_cma_vchi_videocore_io(void *arg) } while (1); - while (!vchi_msg_hold(instance->vchi_handle[0], (void **)&reply, + while (!vchi_msg_hold(instance->service[0], (void **)&reply, &reply_len, VCHI_FLAGS_NONE, &msg)) { if (reply->trans_id & 0x80000000) { /* Async event or cmd from the VPU */ @@ -329,7 +329,7 @@ struct sm_instance *vc_sm_cma_vchi_init(struct vchiq_instance *vchiq_instance, }; status = vchi_service_open(vchiq_instance, - ¶ms, &instance->vchi_handle[i]); + ¶ms, &instance->service[i]); if (status) { pr_err("%s: failed to open VCHI service (%d)", __func__, status); @@ -355,8 +355,8 @@ struct sm_instance *vc_sm_cma_vchi_init(struct vchiq_instance *vchiq_instance, err_close_services: for (i = 0; i < instance->num_connections; i++) { - if (instance->vchi_handle[i]) - vchi_service_close(instance->vchi_handle[i]); + if (instance->service[i]) + vchi_service_close(instance->service[i]); } kfree(instance); err_null: @@ -385,9 +385,9 @@ int vc_sm_cma_vchi_stop(struct sm_instance **handle) for (i = 0; i < instance->num_connections; i++) { s32 success; - vchi_service_use(instance->vchi_handle[i]); + vchi_service_use(instance->service[i]); - success = vchi_service_close(instance->vchi_handle[i]); + success = vchi_service_close(instance->service[i]); } kfree(instance); diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c index 3504ea8aed4f..a1995d1e5180 100644 --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c @@ -170,7 +170,7 @@ struct mmal_msg_context { }; struct vchiq_mmal_instance { - struct vchi_service_handle *handle; + struct vchi_service *service; /* ensure serialised access to service */ struct mutex vchiq_mutex; @@ -292,8 +292,8 @@ static void buffer_to_host_work_cb(struct work_struct *work) /* Dummy receive to ensure the buffers remain in order */ len = 8; /* queue the bulk submission */ - vchi_service_use(instance->handle); - ret = vchi_bulk_queue_receive(instance->handle, + vchi_service_use(instance->service); + ret = vchi_bulk_queue_receive(instance->service, msg_context->u.bulk.buffer->buffer, /* Actual receive needs to be a multiple * of 4 bytes @@ -303,7 +303,7 @@ static void buffer_to_host_work_cb(struct work_struct *work) VCHI_FLAGS_BLOCK_UNTIL_QUEUED, msg_context); - vchi_service_release(instance->handle); + vchi_service_release(instance->service); if (ret != 0) pr_err("%s: ctx: %p, vchi_bulk_queue_receive failed %d\n", @@ -383,7 +383,7 @@ buffer_from_host(struct vchiq_mmal_instance *instance, if (!port->enabled) return -EINVAL; - pr_debug("instance:%p buffer:%p\n", instance->handle, buf); + pr_debug("instance:%p buffer:%p\n", instance->service, buf); /* get context */ if (!buf->msg_context) { @@ -451,14 +451,14 @@ buffer_from_host(struct vchiq_mmal_instance *instance, /* no payload in message */ m.u.buffer_from_host.payload_in_message = 0; - vchi_service_use(instance->handle); + vchi_service_use(instance->service); - ret = vchi_queue_kernel_message(instance->handle, + ret = vchi_queue_kernel_message(instance->service, &m, sizeof(struct mmal_msg_header) + sizeof(m.u.buffer_from_host)); - vchi_service_release(instance->handle); + vchi_service_release(instance->service); return ret; } @@ -693,7 +693,7 @@ static void service_callback(void *param, switch (reason) { case VCHI_CALLBACK_MSG_AVAILABLE: - status = vchi_msg_hold(instance->handle, (void **)&msg, + status = vchi_msg_hold(instance->service, (void **)&msg, &msg_len, VCHI_FLAGS_NONE, &msg_handle); if (status) { pr_err("Unable to dequeue a message (%d)\n", status); @@ -809,14 +809,14 @@ static int send_synchronous_mmal_msg(struct vchiq_mmal_instance *instance, DBG_DUMP_MSG(msg, (sizeof(struct mmal_msg_header) + payload_len), ">>> sync message"); - vchi_service_use(instance->handle); + vchi_service_use(instance->service); - ret = vchi_queue_kernel_message(instance->handle, + ret = vchi_queue_kernel_message(instance->service, msg, sizeof(struct mmal_msg_header) + payload_len); - vchi_service_release(instance->handle); + vchi_service_release(instance->service); if (ret) { pr_err("error %d queuing message\n", ret); @@ -2073,9 +2073,9 @@ int vchiq_mmal_finalise(struct vchiq_mmal_instance *instance) if (mutex_lock_interruptible(&instance->vchiq_mutex)) return -EINTR; - vchi_service_use(instance->handle); + vchi_service_use(instance->service); - status = vchi_service_close(instance->handle); + status = vchi_service_close(instance->service); if (status != 0) pr_err("mmal-vchiq: VCHIQ close failed\n"); @@ -2152,21 +2152,21 @@ int vchiq_mmal_init(struct vchiq_mmal_instance **out_instance) if (!instance->bulk_wq) goto err_free; - status = vchi_service_open(vchiq_instance, ¶ms, &instance->handle); + status = vchi_service_open(vchiq_instance, ¶ms, &instance->service); if (status) { pr_err("Failed to open VCHI service connection (status=%d)\n", status); goto err_close_services; } - vchi_service_release(instance->handle); + vchi_service_release(instance->service); *out_instance = instance; return 0; err_close_services: - vchi_service_close(instance->handle); + vchi_service_close(instance->service); destroy_workqueue(instance->bulk_wq); err_free: vfree(instance->bulk_scratch); From patchwork Wed May 27 11:53:20 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: 11572707 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 5AA4F92A for ; Wed, 27 May 2020 12:01:31 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 34F61207CB for ; Wed, 27 May 2020 12:01:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="eiAUN+K3" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 34F61207CB 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=bombadil.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=3dqXg9nt+Do+4Dx7+LoqwwMjuXH8PE8wJdlXtIe9cLg=; b=eiAUN+K3EwFU+S VQhrVbGjcGhOtv0rw/0KY5xMJw/LRLJMnvNaHngvbp/Zd8RUv+H+ZeyM7aA9zBKKm/SLgNcuHVlmf Oiyv++sz/MXrb3NAOLApStPBQiBoSy8h4W19E5nQ4x8lyVQY7AH0rohIS3SLOmh0gJu4R+Y7VG+xw I9JyPGZHF3Nf5R1o4CWMQW1ilGfiGr53z+DZfNV+gJEW9oi4X1IT1OuZwla04DosL7tlHkYV6jytR WbUGdy+1LgkdcAojLxBe+pr+dCwZDczuGTx2pYwQvB+BGp4ROs2gvtxyZ9hyoMAwXUbzabhUH71s3 adN0D1z1CGXFQ1qJaaIw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdukO-00009g-TJ; Wed, 27 May 2020 12:01:24 +0000 Received: from mx2.suse.de ([195.135.220.15]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdudg-0006jr-2u; Wed, 27 May 2020 11:54:30 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id ABBA3AC91; Wed, 27 May 2020 11:54:28 +0000 (UTC) From: Nicolas Saenz Julienne To: bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Florian Fainelli , Ray Jui , Scott Branden , Nicolas Saenz Julienne Subject: [RFC 15/50] staging: vc04_services: bcm2835-audio: Use vchi_msg_hold() Date: Wed, 27 May 2020 13:53:20 +0200 Message-Id: <20200527115400.31391-16-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527115400.31391-1-nsaenzjulienne@suse.de> References: <20200527115400.31391-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200527_045428_284523_E849514A X-CRM114-Status: GOOD ( 15.52 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -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] 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [195.135.220.15 listed in wl.mailspike.net] -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, laurent.pinchart@ideasonboard.com, linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org vchi_msg_dequeue() provides the same functionality as vchi_msg_hold() except it copies the message data as opposed to the later which provides the data in place. The copying is done on a local variable, so there is no need to keep the message out the function's bounds, so use vchi_msg_hold() instead. Signed-off-by: Nicolas Saenz Julienne --- .../bcm2835-audio/bcm2835-vchiq.c | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c index 62eef233275f..5018b5baa009 100644 --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c @@ -94,31 +94,34 @@ static void audio_vchi_callback(void *param, void *msg_handle) { struct bcm2835_audio_instance *instance = param; - struct vc_audio_msg m; - int msg_len; + struct vchi_held_msg handle; + struct vc_audio_msg *m; + unsigned size; int status; if (reason != VCHI_CALLBACK_MSG_AVAILABLE) return; - status = vchi_msg_dequeue(instance->service, - &m, sizeof(m), &msg_len, VCHI_FLAGS_NONE); + status = vchi_msg_hold(instance->service, (void **)&m, &size, + VCHI_FLAGS_NONE, &handle); if (status) return; - if (m.type == VC_AUDIO_MSG_TYPE_RESULT) { - instance->result = m.result.success; + if (m->type == VC_AUDIO_MSG_TYPE_RESULT) { + instance->result = m->result.success; complete(&instance->msg_avail_comp); - } else if (m.type == VC_AUDIO_MSG_TYPE_COMPLETE) { - if (m.complete.cookie1 != VC_AUDIO_WRITE_COOKIE1 || - m.complete.cookie2 != VC_AUDIO_WRITE_COOKIE2) + } else if (m->type == VC_AUDIO_MSG_TYPE_COMPLETE) { + if (m->complete.cookie1 != VC_AUDIO_WRITE_COOKIE1 || + m->complete.cookie2 != VC_AUDIO_WRITE_COOKIE2) dev_err(instance->dev, "invalid cookie\n"); else bcm2835_playback_fifo(instance->alsa_stream, - m.complete.count); + m->complete.count); } else { - dev_err(instance->dev, "unexpected callback type=%d\n", m.type); + dev_err(instance->dev, "unexpected callback type=%d\n", m->type); } + + vchi_held_msg_release(&handle); } static int From patchwork Wed May 27 11:53:21 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: 11572705 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 3AD8E14C0 for ; Wed, 27 May 2020 12:01:11 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id E6D02207CB for ; Wed, 27 May 2020 12:01:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="HnyVUbOD" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E6D02207CB 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=bombadil.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=KMJbKCnj8kf9t9xrwm6y4/WSqfQSsUrBvFtALz5F0pQ=; b=HnyVUbODyEi1sS ztW/yloM/+9eK/dpe/wuDiSSRRg2EOsxyahVL0eCRO3i3/ANVPgDdY3Gyih0knpGgrPVbM1Yl02f3 Jt3vUJigvSC30CPNeXmId9OO9KpqYVHlRSkOkOBLXNitypTvRUw228qD+upB8KWY7EpFNOThwcyil jHCM9YHc0Ayy7U///VjIA/JcpW6x6Ih4EsqQxB1GDAtWmXtgJXFkP501sQxj9AnXQD6zJ3MZ3d3s3 qfNdTbKeaSy2HjU6djq8qlPiNWWczdegZE1sayAqi/ME1+YNwFYuD6Acw2Z7yw3kBot12id7+vduy uk7pUzg/0lu2img2V2fw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jduk2-0008Lw-Pv; Wed, 27 May 2020 12:01:02 +0000 Received: from mx2.suse.de ([195.135.220.15]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdudg-0006ka-WA; Wed, 27 May 2020 11:54:31 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 74905ACB8; Wed, 27 May 2020 11:54:29 +0000 (UTC) From: Nicolas Saenz Julienne To: bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [RFC 16/50] staging: vchi: Get rid of vchi_msg_dequeue() Date: Wed, 27 May 2020 13:53:21 +0200 Message-Id: <20200527115400.31391-17-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527115400.31391-1-nsaenzjulienne@suse.de> References: <20200527115400.31391-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200527_045429_283323_7EFD0017 X-CRM114-Status: UNSURE ( 9.12 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -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] 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [195.135.220.15 listed in wl.mailspike.net] -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, laurent.pinchart@ideasonboard.com, Nicolas Saenz Julienne , gregkh@linuxfoundation.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Nobody uses it. Get rid of it. Signed-off-by: Nicolas Saenz Julienne --- .../vc04_services/interface/vchi/vchi.h | 7 ---- .../interface/vchiq_arm/vchiq_shim.c | 39 ------------------- 2 files changed, 46 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h b/drivers/staging/vc04_services/interface/vchi/vchi.h index ff302e6b8b1b..a369feb3a448 100644 --- a/drivers/staging/vc04_services/interface/vchi/vchi.h +++ b/drivers/staging/vc04_services/interface/vchi/vchi.h @@ -93,13 +93,6 @@ extern int32_t vchi_service_release(struct vchi_service *service); extern int vchi_queue_kernel_message(struct vchi_service *service, void *data, unsigned int size); -// Routine to receive a msg from a service -// Dequeue is equivalent to hold, copy into client buffer, release -extern int32_t vchi_msg_dequeue(struct vchi_service *service, void *data, - uint32_t max_data_size_to_read, - uint32_t *actual_msg_size, - enum vchi_flags flags); - // 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_shim.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c index 99eb7a5ccce6..0c3473861a8d 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c @@ -160,45 +160,6 @@ int32_t vchi_bulk_queue_transmit(struct vchi_service *service, } EXPORT_SYMBOL(vchi_bulk_queue_transmit); -/*********************************************************** - * Name: vchi_msg_dequeue - * - * Arguments: struct vchi_service *service, - * void *data, - * uint32_t max_data_size_to_read, - * uint32_t *actual_msg_size - * enum vchi_flags flags - * - * Description: Routine to dequeue a message into the supplied buffer - * - * Returns: int32_t - success == 0 - * - ***********************************************************/ -int32_t vchi_msg_dequeue(struct vchi_service *service, void *data, - uint32_t max_data_size_to_read, - uint32_t *actual_msg_size, enum vchi_flags flags) -{ - struct vchiq_header *header; - - WARN_ON((flags != VCHI_FLAGS_NONE) && - (flags != VCHI_FLAGS_BLOCK_UNTIL_OP_COMPLETE)); - - if (flags == VCHI_FLAGS_NONE) - if (vchiu_queue_is_empty(&service->queue)) - return -1; - - header = vchiu_queue_pop(&service->queue); - - memcpy(data, header->data, header->size < max_data_size_to_read ? - header->size : max_data_size_to_read); - - *actual_msg_size = header->size; - - vchiq_release_message(service->handle, header); - - return 0; -} -EXPORT_SYMBOL(vchi_msg_dequeue); /*********************************************************** * Name: vchi_held_msg_release From patchwork Wed May 27 11:53:22 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: 11572713 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 CCC4492A for ; Wed, 27 May 2020 12:02:56 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 3A48F207CB for ; Wed, 27 May 2020 12:02:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="KEwj8oLS" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3A48F207CB 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=bombadil.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=H+LLTTjKXAmWbtIxsloEwSkHBtKIrPWeINGmLT+MoWk=; b=KEwj8oLSRFAIre IwVKGhf03Rbg7vAq1W8Diym36Op70mojWunRvUqUGntwZC0luw/VmM1eAcX+VF+KBUxwFD/n2sRWQ mdfiPcntwnQoEHYwvCWlQzwKVafZmYZz8FJirCLBWPTK+6KMts/W1qqljuYXUq30EDX+MAf+6IScT GmQfkbmSDiS8t53h+fB+u9bUoIetIRpHqmF19XrHMFHlFySsTx00hoAIa7zwglnozqLv5x/suT0NL gVjonjF30xU2cH6U1xtK4QNOfd4+ejBPq4MdVdG72GP2tgFoR6ZSV0/aQ7powhhZozr8Nb3p23E7E 3/pP8FskTrWcnsCID/0A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jduln-0001BW-Kn; Wed, 27 May 2020 12:02:51 +0000 Received: from mx2.suse.de ([195.135.220.15]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdudh-0006la-Et; Wed, 27 May 2020 11:54:31 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 788BDACF2; Wed, 27 May 2020 11:54:30 +0000 (UTC) From: Nicolas Saenz Julienne To: bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [RFC 17/50] staging: vchi_common: Get rid of all unused definitions Date: Wed, 27 May 2020 13:53:22 +0200 Message-Id: <20200527115400.31391-18-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527115400.31391-1-nsaenzjulienne@suse.de> References: <20200527115400.31391-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200527_045429_809010_F16ED149 X-CRM114-Status: GOOD ( 11.91 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -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] 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [195.135.220.15 listed in wl.mailspike.net] -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, laurent.pinchart@ideasonboard.com, Nicolas Saenz Julienne , gregkh@linuxfoundation.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org There is a series of structures and enums defined but never used. Get rid of them. Signed-off-by: Nicolas Saenz Julienne --- .../interface/vchi/vchi_common.h | 65 ------------------- 1 file changed, 65 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchi/vchi_common.h b/drivers/staging/vc04_services/interface/vchi/vchi_common.h index 0f79bea4757d..e07376fe4dfd 100644 --- a/drivers/staging/vc04_services/interface/vchi/vchi_common.h +++ b/drivers/staging/vc04_services/interface/vchi/vchi_common.h @@ -10,23 +10,7 @@ enum vchi_flags { VCHI_FLAGS_BLOCK_UNTIL_OP_COMPLETE = 0x1, // waits for message to be received, or sent (NB. not the same as being seen on other side) VCHI_FLAGS_CALLBACK_WHEN_OP_COMPLETE = 0x2, // run a callback when message sent VCHI_FLAGS_BLOCK_UNTIL_QUEUED = 0x4, // return once the transfer is in a queue ready to go - VCHI_FLAGS_ALLOW_PARTIAL = 0x8, VCHI_FLAGS_BLOCK_UNTIL_DATA_READ = 0x10, - VCHI_FLAGS_CALLBACK_WHEN_DATA_READ = 0x20, - - VCHI_FLAGS_ALIGN_SLOT = 0x000080, // internal use only - VCHI_FLAGS_BULK_AUX_QUEUED = 0x010000, // internal use only - VCHI_FLAGS_BULK_AUX_COMPLETE = 0x020000, // internal use only - VCHI_FLAGS_BULK_DATA_QUEUED = 0x040000, // internal use only - VCHI_FLAGS_BULK_DATA_COMPLETE = 0x080000, // internal use only - VCHI_FLAGS_INTERNAL = 0xFF0000 -}; - -// constants for vchi_crc_control() -enum vchi_crc_control { - VCHI_CRC_NOTHING = -1, - VCHI_CRC_PER_SERVICE = 0, - VCHI_CRC_EVERYTHING = 1, }; //callback reasons when an event occurs on a service @@ -47,58 +31,9 @@ enum vchi_callback_reason { VCHI_CALLBACK_BULK_RECEIVE_ABORTED, }; -// service control options -enum vchi_service_option { - VCHI_SERVICE_OPTION_MIN, - - VCHI_SERVICE_OPTION_TRACE, - VCHI_SERVICE_OPTION_SYNCHRONOUS, - - VCHI_SERVICE_OPTION_MAX -}; - //Callback used by all services / bulk transfers typedef void (*vchi_callback)(void *callback_param, //my service local param enum vchi_callback_reason reason, void *handle); //for transmitting msg's only -/* - * Define vector struct for scatter-gather (vector) operations - * Vectors can be nested - if a vector element has negative length, then - * the data pointer is treated as pointing to another vector array, with - * '-vec_len' elements. Thus to append a header onto an existing vector, - * you can do this: - * - * void foo(const struct vchi_msg_vector *v, int n) - * { - * struct vchi_msg_vector nv[2]; - * nv[0].vec_base = my_header; - * nv[0].vec_len = sizeof my_header; - * nv[1].vec_base = v; - * nv[1].vec_len = -n; - * ... - * - */ -struct vchi_msg_vector { - const void *vec_base; - int32_t vec_len; -}; - -/* - * Iterator structure for reading ahead through received message queue. - * Allocated by client, initialised by vchi_msg_look_ahead. Fields are for - * internal VCHI use only. - * Iterates over messages in queue at the instant of the call to - * vchi_msg_lookahead - will not proceed to messages received since. - * Behaviour is undefined if an iterator is used again after messages for that - * service are removed/dequeued by any means other than vchi_msg_iter_... - * calls on the iterator itself. - */ -struct vchi_msg_iter { - struct opaque_vchi_service_t *service; - void *last; - void *next; - void *remove; -}; - #endif // VCHI_COMMON_H_ From patchwork Wed May 27 11:53:23 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: 11572709 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 1627F14C0 for ; Wed, 27 May 2020 12:02:25 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id E7C6D207CB for ; Wed, 27 May 2020 12:02:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="uR4s1vsR" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E7C6D207CB 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=bombadil.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=PkcuBqebD5GNZS9eR6/9KIrBprcU6aacAjycnNZyJ88=; b=uR4s1vsRDMJDH0 /tvrJlEC5e28LJRU+aSzvPjzeE+8N0sXoZqNlFE6JrR4fX1EvKF2FcGeSEjhP0L1P31ZSCJjNBr0E Gwljr8x/HlbYJGeE6ZgSuwpW7RRiMIjFzL7Qc6A+RJNJGKcWwemeWREXYnHrWCkgz9j0+yqc47cw2 LX8x1H2gGKTzTYhWQ70ofq68+GS2rpzBIrH5bKQOtCwu0jKkC+EYbKCjF0EruvZ+yXJ4GQ9CzWNZb y2MQSzfXBr9xCPGi9+Ha39/hgbpew384706goV7I2ugrgY7QnDHZYF3Q6T0s3ztm42zVVycevn9Pg YYxfbRTSyd71iVaBbF6w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdulE-0000jd-7F; Wed, 27 May 2020 12:02:16 +0000 Received: from mx2.suse.de ([195.135.220.15]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdudj-0006mB-5w; Wed, 27 May 2020 11:54:33 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 58AD0AC5B; Wed, 27 May 2020 11:54:31 +0000 (UTC) From: Nicolas Saenz Julienne To: bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [RFC 18/50] staging: vc04_services: vc-sm-cma: Get rid of the multiple connections option Date: Wed, 27 May 2020 13:53:23 +0200 Message-Id: <20200527115400.31391-19-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527115400.31391-1-nsaenzjulienne@suse.de> References: <20200527115400.31391-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200527_045431_537788_28338D95 X-CRM114-Status: GOOD ( 18.88 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -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] 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [195.135.220.15 listed in wl.mailspike.net] -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, laurent.pinchart@ideasonboard.com, Nicolas Saenz Julienne , gregkh@linuxfoundation.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Multiple connections are not handled by the IO thread, so it's not really necessary to handle them on initialization. Signed-off-by: Nicolas Saenz Julienne --- .../staging/vc04_services/vc-sm-cma/vc_sm.c | 3 +- .../vc04_services/vc-sm-cma/vc_sm_cma_vchi.c | 67 ++++++------------- .../vc04_services/vc-sm-cma/vc_sm_cma_vchi.h | 1 - 3 files changed, 23 insertions(+), 48 deletions(-) diff --git a/drivers/staging/vc04_services/vc-sm-cma/vc_sm.c b/drivers/staging/vc04_services/vc-sm-cma/vc_sm.c index 3f95ea90c08a..e660f546a7e4 100644 --- a/drivers/staging/vc04_services/vc-sm-cma/vc_sm.c +++ b/drivers/staging/vc04_services/vc-sm-cma/vc_sm.c @@ -1532,8 +1532,7 @@ static void vc_sm_connected_init(void) } /* Initialize an instance of the shared memory service. */ - sm_state->sm_handle = vc_sm_cma_vchi_init(instance, 1, - vc_sm_vpu_event); + sm_state->sm_handle = vc_sm_cma_vchi_init(instance, vc_sm_vpu_event); if (!sm_state->sm_handle) { pr_err("[%s]: failed to initialize shared memory service\n", __func__); diff --git a/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c b/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c index 32706eb2838b..72b09685db31 100644 --- a/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c +++ b/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c @@ -46,8 +46,7 @@ struct sm_cmd_rsp_blk { }; struct sm_instance { - u32 num_connections; - struct vchi_service *service[VCHI_MAX_NUM_CONNECTIONS]; + struct vchi_service *service; struct task_struct *io_thread; struct completion io_cmplt; @@ -187,13 +186,13 @@ static int vc_sm_cma_vchi_videocore_io(void *arg) while (1) { if (svc_use) - vchi_service_release(instance->service[0]); + vchi_service_release(instance->service); svc_use = 0; if (wait_for_completion_interruptible(&instance->io_cmplt)) continue; - vchi_service_use(instance->service[0]); + vchi_service_use(instance->service); svc_use = 1; do { @@ -214,7 +213,7 @@ static int vc_sm_cma_vchi_videocore_io(void *arg) /* Send the command */ status = - bcm2835_vchi_msg_queue(instance->service[0], + bcm2835_vchi_msg_queue(instance->service, cmd->msg, cmd->length); if (status) { pr_err("%s: failed to queue message (%d)", @@ -237,7 +236,7 @@ static int vc_sm_cma_vchi_videocore_io(void *arg) } while (1); - while (!vchi_msg_hold(instance->service[0], (void **)&reply, + while (!vchi_msg_hold(instance->service, (void **)&reply, &reply_len, VCHI_FLAGS_NONE, &msg)) { if (reply->trans_id & 0x80000000) { /* Async event or cmd from the VPU */ @@ -286,21 +285,20 @@ static void vc_sm_cma_vchi_callback(void *param, } struct sm_instance *vc_sm_cma_vchi_init(struct vchiq_instance *vchiq_instance, - unsigned int num_connections, vpu_event_cb vpu_event) { - u32 i; + struct service_creation params = { + .version = VCHI_VERSION_EX(VC_SM_VER, VC_SM_MIN_VER), + .service_id = VC_SM_SERVER_NAME, + .callback = vc_sm_cma_vchi_callback, + .callback_param = NULL, + }; struct sm_instance *instance; int status; + int i; pr_debug("%s: start", __func__); - if (num_connections > VCHI_MAX_NUM_CONNECTIONS) { - pr_err("%s: unsupported number of connections %u (max=%u)", - __func__, num_connections, VCHI_MAX_NUM_CONNECTIONS); - - goto err_null; - } /* Allocate memory for this instance */ instance = kzalloc(sizeof(*instance), GFP_KERNEL); @@ -317,25 +315,15 @@ struct sm_instance *vc_sm_cma_vchi_init(struct vchiq_instance *vchiq_instance, init_completion(&instance->free_blk[i].cmplt); list_add(&instance->free_blk[i].head, &instance->free_list); } + params.callback_param = instance; /* Open the VCHI service connections */ - instance->num_connections = num_connections; - for (i = 0; i < num_connections; i++) { - struct service_creation params = { - .version = VCHI_VERSION_EX(VC_SM_VER, VC_SM_MIN_VER), - .service_id = VC_SM_SERVER_NAME, - .callback = vc_sm_cma_vchi_callback, - .callback_param = instance, - }; - - status = vchi_service_open(vchiq_instance, - ¶ms, &instance->service[i]); - if (status) { - pr_err("%s: failed to open VCHI service (%d)", - __func__, status); - - goto err_close_services; - } + status = vchi_service_open(vchiq_instance, ¶ms, &instance->service); + if (status) { + pr_err("%s: failed to open VCHI service (%d)", + __func__, status); + + goto err_close_services; } /* Create the thread which takes care of all io to/from videoocore. */ @@ -354,12 +342,8 @@ struct sm_instance *vc_sm_cma_vchi_init(struct vchiq_instance *vchiq_instance, return instance; err_close_services: - for (i = 0; i < instance->num_connections; i++) { - if (instance->service[i]) - vchi_service_close(instance->service[i]); - } + vchi_service_close(instance->service); kfree(instance); -err_null: pr_debug("%s: FAILED", __func__); return NULL; } @@ -367,7 +351,6 @@ struct sm_instance *vc_sm_cma_vchi_init(struct vchiq_instance *vchiq_instance, int vc_sm_cma_vchi_stop(struct sm_instance **handle) { struct sm_instance *instance; - u32 i; if (!handle) { pr_err("%s: invalid pointer to handle %p", __func__, handle); @@ -381,14 +364,8 @@ int vc_sm_cma_vchi_stop(struct sm_instance **handle) instance = *handle; - /* Close all VCHI service connections */ - for (i = 0; i < instance->num_connections; i++) { - s32 success; - - vchi_service_use(instance->service[i]); - - success = vchi_service_close(instance->service[i]); - } + vchi_service_use(instance->service); + vchi_service_close(instance->service); kfree(instance); diff --git a/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.h b/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.h index 44cc389364f4..09ef0fc59566 100644 --- a/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.h +++ b/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.h @@ -29,7 +29,6 @@ typedef void (*vpu_event_cb)(struct sm_instance *instance, * Initialize the shared memory service, opens up vchi connection to talk to it. */ struct sm_instance *vc_sm_cma_vchi_init(struct vchiq_instance *vchiq_instance, - unsigned int num_connections, vpu_event_cb vpu_event); /* From patchwork Wed May 27 11:53:24 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: 11572715 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 844C892A for ; Wed, 27 May 2020 12:03:16 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 555F5207CB for ; Wed, 27 May 2020 12:03:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="dkS6wClx" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 555F5207CB 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=bombadil.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=+rtyxoWP41l92qzFm/TADVATRa2ADI7nkMKn+cWKlhc=; b=dkS6wClxE/URhC K2v+66wPDABLey8jIu6dzLJfwGOk5VrhIcaHuE81Tet0ME0/J3ZLU0fIlAjGmQzt8hY/MWOJQMgKu f6KciTD/yRWU7G2M6lvrPOAcPo6di3+FycGKLYpdan9LDR5fRpiUV0WhALeUY4Zj3PEF2ZYnE6Cjr NRyPoFWujSuYSEno8PDSNEJHyjOjsPK5L5bXJIQNqtqImz5CiSwEU8Jar5R0C5kkylOIBAGpeJGLk BxRhzFS+dkMnlgRMaI8ienYkwb+VDlR6ilLH7hXaUpEox7RgbJUB85kyjhTrPwWbZgwVAo9JCb940 gWxmzNF6jRmE4Vhf0DBg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdum4-0001QI-Jx; Wed, 27 May 2020 12:03:08 +0000 Received: from mx2.suse.de ([195.135.220.15]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdudj-0006oW-CX; Wed, 27 May 2020 11:54:33 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 16DC5AD17; Wed, 27 May 2020 11:54:32 +0000 (UTC) From: Nicolas Saenz Julienne To: bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [RFC 19/50] staging: vchi: Get rid of unnecessary defines Date: Wed, 27 May 2020 13:53:24 +0200 Message-Id: <20200527115400.31391-20-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527115400.31391-1-nsaenzjulienne@suse.de> References: <20200527115400.31391-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200527_045431_576243_0E9419A6 X-CRM114-Status: UNSURE ( 8.55 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -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] 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [195.135.220.15 listed in wl.mailspike.net] -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, laurent.pinchart@ideasonboard.com, Nicolas Saenz Julienne , gregkh@linuxfoundation.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Those defines aren't used by anyone. Get rid of them. Signed-off-by: Nicolas Saenz Julienne --- drivers/staging/vc04_services/interface/vchi/vchi.h | 11 ----------- drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c | 1 - 2 files changed, 12 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h b/drivers/staging/vc04_services/interface/vchi/vchi.h index a369feb3a448..bf0c7a496f5a 100644 --- a/drivers/staging/vc04_services/interface/vchi/vchi.h +++ b/drivers/staging/vc04_services/interface/vchi/vchi.h @@ -11,21 +11,10 @@ * Global defs *****************************************************************************/ -#define VCHI_BULK_ROUND_UP(x) ((((unsigned long)(x)) + VCHI_BULK_ALIGN - 1) & ~(VCHI_BULK_ALIGN - 1)) -#define VCHI_BULK_ROUND_DOWN(x) (((unsigned long)(x)) & ~(VCHI_BULK_ALIGN - 1)) -#define VCHI_BULK_ALIGN_NBYTES(x) (VCHI_BULK_ALIGNED(x) ? 0 : (VCHI_BULK_ALIGN - ((unsigned long)(x) & (VCHI_BULK_ALIGN - 1)))) - -#ifdef USE_VCHIQ_ARM -#define VCHI_BULK_ALIGNED(x) 1 -#else -#define VCHI_BULK_ALIGNED(x) (((unsigned long)(x) & (VCHI_BULK_ALIGN - 1)) == 0) -#endif - struct vchi_version { uint32_t version; uint32_t version_min; }; -#define VCHI_VERSION(v_) { v_, v_ } #define VCHI_VERSION_EX(v_, m_) { v_, m_ } // Macros to manipulate 'FOURCC' values diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c index a1995d1e5180..5183aff453eb 100644 --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c @@ -32,7 +32,6 @@ #include "vc-sm-cma/vc_sm_knl.h" -#define USE_VCHIQ_ARM #include "interface/vchi/vchi.h" /* From patchwork Wed May 27 11:53:25 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: 11572711 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 AF64092A for ; Wed, 27 May 2020 12:02:40 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 74CF7207CB for ; Wed, 27 May 2020 12:02:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ia/ksUMI" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 74CF7207CB 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=bombadil.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=QvzOA1tL64/buIjLYs633ytV3pZO3zzSYCH1bysQFFg=; b=ia/ksUMIFCcjJJ u8nFK/0QwZ+EpvvUNKqCf7tdAFSNV2o0RNBI+WR8ZhaG8hQyFhSE0lPDIKky7V0gkfKiuCym/CIFJ Fc6EV1tFKytbwsckaZMxPGYx7N3IbhaYFzWemMoppqQca66iMisbG5CBLlXZxGSMksBDcjl1ZFVye 0UkHbvYi2BHsw5BCNx0f4/9KvvblUCsQJ01CYJmHJo2/CtZLTP3ZUWqm8NretXXRXe7j5YsjrRmx6 DX6qKJ0ZslSYPAVqqa7Cu1T6SgSgw/CmBabMGxUU33SSMXntAdD8h65zZOtWhp+y8TEkvA+TNwMjJ sckRQ9BFc6CxJbA0BcfA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdulV-0000yj-Ta; Wed, 27 May 2020 12:02:34 +0000 Received: from mx2.suse.de ([195.135.220.15]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdudj-0006qb-S9; Wed, 27 May 2020 11:54:34 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 04D8BAC91; Wed, 27 May 2020 11:54:32 +0000 (UTC) From: Nicolas Saenz Julienne To: bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [RFC 20/50] staging: vc04_services: Get rid of vchi_cfg.h Date: Wed, 27 May 2020 13:53:25 +0200 Message-Id: <20200527115400.31391-21-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527115400.31391-1-nsaenzjulienne@suse.de> References: <20200527115400.31391-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200527_045432_203975_D41389E6 X-CRM114-Status: GOOD ( 20.07 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -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] 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [195.135.220.15 listed in wl.mailspike.net] -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, laurent.pinchart@ideasonboard.com, Nicolas Saenz Julienne , gregkh@linuxfoundation.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Nothing in it is being used. Signed-off-by: Nicolas Saenz Julienne --- .../vc04_services/interface/vchi/vchi.h | 1 - .../vc04_services/interface/vchi/vchi_cfg.h | 238 ------------------ 2 files changed, 239 deletions(-) delete mode 100644 drivers/staging/vc04_services/interface/vchi/vchi_cfg.h diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h b/drivers/staging/vc04_services/interface/vchi/vchi.h index bf0c7a496f5a..55e51e5a1fdc 100644 --- a/drivers/staging/vc04_services/interface/vchi/vchi.h +++ b/drivers/staging/vc04_services/interface/vchi/vchi.h @@ -4,7 +4,6 @@ #ifndef VCHI_H_ #define VCHI_H_ -#include "vchi_cfg.h" #include "vchi_common.h" /****************************************************************************** diff --git a/drivers/staging/vc04_services/interface/vchi/vchi_cfg.h b/drivers/staging/vc04_services/interface/vchi/vchi_cfg.h deleted file mode 100644 index 138c36151a22..000000000000 --- a/drivers/staging/vc04_services/interface/vchi/vchi_cfg.h +++ /dev/null @@ -1,238 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ -/* Copyright (c) 2010-2012 Broadcom. All rights reserved. */ - -#ifndef VCHI_CFG_H_ -#define VCHI_CFG_H_ - -/******************************************************************************* - * Defines in this first section are part of the VCHI API and may be examined by - * VCHI services. - ******************************************************************************/ - -/* - * Required alignment of base addresses for bulk transfer, if unaligned - * transfers are not enabled - * Really determined by the message driver, and should be available from - * a run-time call. - */ -#ifndef VCHI_BULK_ALIGN -# if __VCCOREVER__ >= 0x04000000 -# define VCHI_BULK_ALIGN 32 // Allows for the need to do cache cleans -# else -# define VCHI_BULK_ALIGN 16 -# endif -#endif - -/* - * Required length multiple for bulk transfers, if unaligned transfers are - * not enabled - * May be less than or greater than VCHI_BULK_ALIGN - * Really determined by the message driver, and should be available from - * a run-time call. - */ -#ifndef VCHI_BULK_GRANULARITY -# if __VCCOREVER__ >= 0x04000000 -# define VCHI_BULK_GRANULARITY 32 // Allows for the need to do cache cleans -# else -# define VCHI_BULK_GRANULARITY 16 -# endif -#endif - -/* The largest possible message to be queued with vchi_msg_queue. */ -#ifndef VCHI_MAX_MSG_SIZE -# if defined VCHI_LOCAL_HOST_PORT -# define VCHI_MAX_MSG_SIZE 16384 // makes file transfers fast, but should they be using bulk? -# else -# define VCHI_MAX_MSG_SIZE 4096 // NOTE: THIS MUST BE LARGER THAN OR EQUAL TO THE SIZE OF THE KHRONOS MERGE BUFFER!! -# endif -#endif - -/****************************************************************************** - * Defines below are system configuration options, and should not be used by - * VCHI services. - ******************************************************************************/ - -/* - * How many connections can we support? A localhost implementation uses - * 2 connections, 1 for host-app, 1 for VMCS, and these are hooked together - * by a loopback MPHI VCFW driver. - */ -#ifndef VCHI_MAX_NUM_CONNECTIONS -# define VCHI_MAX_NUM_CONNECTIONS 3 -#endif - -/* - * How many services can we open per connection? Extending this doesn't cost - * processing time, just a small amount of static memory. - */ -#ifndef VCHI_MAX_SERVICES_PER_CONNECTION -# define VCHI_MAX_SERVICES_PER_CONNECTION 36 -#endif - -/* Adjust if using a message driver that supports more logical TX channels */ -#ifndef VCHI_MAX_BULK_TX_CHANNELS_PER_CONNECTION -# define VCHI_MAX_BULK_TX_CHANNELS_PER_CONNECTION 9 // 1 MPHI + 8 CCP2 logical channels -#endif - -/* Adjust if using a message driver that supports more logical RX channels */ -#ifndef VCHI_MAX_BULK_RX_CHANNELS_PER_CONNECTION -# define VCHI_MAX_BULK_RX_CHANNELS_PER_CONNECTION 1 // 1 MPHI -#endif - -/* - * How many receive slots do we use. This times VCHI_MAX_MSG_SIZE gives the - * effective receive queue space, less message headers. - */ -#ifndef VCHI_NUM_READ_SLOTS -# if defined(VCHI_LOCAL_HOST_PORT) -# define VCHI_NUM_READ_SLOTS 4 -# else -# define VCHI_NUM_READ_SLOTS 48 -# endif -#endif - -/* - * Do we utilise overrun facility for receive message slots? Can aid peer - * transmit performance. Only define on VideoCore end, talking to host. - */ -//#define VCHI_MSG_RX_OVERRUN - -/* - * How many transmit slots do we use. Generally don't need many, - * as the hardware driver underneath VCHI will usually have its own buffering. - */ -#ifndef VCHI_NUM_WRITE_SLOTS -# define VCHI_NUM_WRITE_SLOTS 4 -#endif - -/* - * If a service has held or queued received messages in VCHI_XOFF_THRESHOLD or - * more slots, then it's taking up too much buffer space, - * and the peer service will be told to stop transmitting with an XOFF message. - * For this to be effective, the VCHI_NUM_READ_SLOTS needs to be considerably - * bigger than VCHI_NUM_WRITE_SLOTS, or the transmit latency is too high. - */ -#ifndef VCHI_XOFF_THRESHOLD -# define VCHI_XOFF_THRESHOLD (VCHI_NUM_READ_SLOTS / 2) -#endif - -/* - * After we've sent an XOFF, the peer will be told to resume transmission - * once the local service has dequeued/released enough messages that it's now - * occupying VCHI_XON_THRESHOLD slots or fewer. - */ -#ifndef VCHI_XON_THRESHOLD -# define VCHI_XON_THRESHOLD (VCHI_NUM_READ_SLOTS / 4) -#endif - -/* - * A size below which a bulk transfer omits the handshake completely and always - * goes via the message channel, if bulk auxiliary is being sent on that - * service. (The user can guarantee this by enabling unaligned transmits). - * Not API. - */ -#ifndef VCHI_MIN_BULK_SIZE -# define VCHI_MIN_BULK_SIZE (VCHI_MAX_MSG_SIZE / 2 < 4096 ? VCHI_MAX_MSG_SIZE / 2 : 4096) -#endif - -/* - * Maximum size of bulk transmission chunks, for each interface type. - * A trade-off between speed and latency; the smaller the chunk size the better - * change of messages and other bulk transmissions getting in when big bulk - * transfers are happening. Set to 0 to not break transmissions into chunks. - */ -#ifndef VCHI_MAX_BULK_CHUNK_SIZE_MPHI -# define VCHI_MAX_BULK_CHUNK_SIZE_MPHI (16 * 1024) -#endif - -/* - * NB Chunked CCP2 transmissions violate the letter of the CCP2 spec - * by using "JPEG8" mode with multiple-line frames. Only use if the receiver - * can cope. - */ -#ifndef VCHI_MAX_BULK_CHUNK_SIZE_CCP2 -# define VCHI_MAX_BULK_CHUNK_SIZE_CCP2 0 -#endif - -/* - * How many TX messages can we have pending in our transmit slots. - * Once exhausted, vchi_msg_queue will be blocked. - */ -#ifndef VCHI_TX_MSG_QUEUE_SIZE -# define VCHI_TX_MSG_QUEUE_SIZE 256 -#endif - -/* - * How many RX messages can we have parsed in the receive slots. Once exhausted, - * parsing will be suspended until older messages are dequeued/released. - */ -#ifndef VCHI_RX_MSG_QUEUE_SIZE -# define VCHI_RX_MSG_QUEUE_SIZE 256 -#endif - -/* - * Really should be able to cope if we run out of received message descriptors, - * by suspending parsing as the comment above says, but we don't. - * This sweeps the issue under the carpet. - */ -#if VCHI_RX_MSG_QUEUE_SIZE < (VCHI_MAX_MSG_SIZE / 16 + 1) * VCHI_NUM_READ_SLOTS -# undef VCHI_RX_MSG_QUEUE_SIZE -# define VCHI_RX_MSG_QUEUE_SIZE ((VCHI_MAX_MSG_SIZE / 16 + 1) * VCHI_NUM_READ_SLOTS) -#endif - -/* - * How many bulk transmits can we have pending. Once exhausted, - * vchi_bulk_queue_transmit will be blocked. - */ -#ifndef VCHI_TX_BULK_QUEUE_SIZE -# define VCHI_TX_BULK_QUEUE_SIZE 64 -#endif - -/* - * How many bulk receives can we have pending. Once exhausted, - *vchi_bulk_queue_receive will be blocked. - */ -#ifndef VCHI_RX_BULK_QUEUE_SIZE -# define VCHI_RX_BULK_QUEUE_SIZE 64 -#endif - -/* - * A limit on how many outstanding bulk requests we expect the peer to give us. - * If the peer asks for more than this, VCHI will fail and assert. - * The number is determined by the peer's hardware - * - it's the number of outstanding requests that can be queued - * on all bulk channels. VC3's MPHI peripheral allows 16. - */ -#ifndef VCHI_MAX_PEER_BULK_REQUESTS -# define VCHI_MAX_PEER_BULK_REQUESTS 32 -#endif - -/* - * Define VCHI_CCP2TX_MANUAL_POWER if the host tells us when to turn the CCP2 - * transmitter on and off. - */ -/*#define VCHI_CCP2TX_MANUAL_POWER*/ - -#ifndef VCHI_CCP2TX_MANUAL_POWER - -/* - * Timeout (in milliseconds) for putting the CCP2TX interface into IDLE state. - * Set negative for no IDLE. - */ -# ifndef VCHI_CCP2TX_IDLE_TIMEOUT -# define VCHI_CCP2TX_IDLE_TIMEOUT 5 -# endif - -/* - * Timeout (in milliseconds) for putting the CCP2TX interface into OFF state. - * Set negative for no OFF. - */ -# ifndef VCHI_CCP2TX_OFF_TIMEOUT -# define VCHI_CCP2TX_OFF_TIMEOUT 1000 -# endif - -#endif /* VCHI_CCP2TX_MANUAL_POWER */ - -#endif /* VCHI_CFG_H_ */ - -/****************************** End of file **********************************/ From patchwork Wed May 27 11:53:26 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: 11572717 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 E571A14C0 for ; Wed, 27 May 2020 12:03:47 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id BF85A207CB for ; Wed, 27 May 2020 12:03:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="MVgXi/TP" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BF85A207CB 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=bombadil.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=RaVrheNMF7BXN7OB/zb5tZn12HdGF9KoZMrhe4sw17I=; b=MVgXi/TPqsANZw +ZdvYIekSiqIoSmtYoujY1AGYVaMrZ3bkxSRzaP+9EY5FfUqZ+oU/q74H8OoV0KrYcMB+rtDEveZv M6IqIhhW0q+07DhaP8XwDYjLJGSaFmkZQn3zFSyLwQyLNcCufZ2GCdsk3furXapHtlo111abML5tD gkrnswRu33oZYbO/vCzP6jIRFA84QuVDJ7Y/QCXL1Mk2fxkdo5y2NjIrJD1IPSfVqv5XOYdsHRqXI 9D8I3LC53jfqqwrTzVTpeyxIwyyUvK6tegMsrzyej2KtVU8w9EZ2YogiiwOBKpsz7n/lrMc/PQ31P vVMaJ0rIRw9x6nkT0IMA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdumZ-0001pi-Dm; Wed, 27 May 2020 12:03:39 +0000 Received: from mx2.suse.de ([195.135.220.15]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdudl-0006sf-PX; Wed, 27 May 2020 11:54:35 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 18955AD2B; Wed, 27 May 2020 11:54:34 +0000 (UTC) From: Nicolas Saenz Julienne To: bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Florian Fainelli , Ray Jui , Scott Branden , Nicolas Saenz Julienne Subject: [RFC 21/50] staging: vchi: Get rid of flags argument in vchi_msg_hold() Date: Wed, 27 May 2020 13:53:26 +0200 Message-Id: <20200527115400.31391-22-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527115400.31391-1-nsaenzjulienne@suse.de> References: <20200527115400.31391-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200527_045434_143671_A448D76E X-CRM114-Status: GOOD ( 15.15 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -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] 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [195.135.220.15 listed in wl.mailspike.net] -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, laurent.pinchart@ideasonboard.com, linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org All users are ignoring the flags argument. So for the sake of simplicity delete it. Signed-off-by: Nicolas Saenz Julienne --- .../vc04_services/bcm2835-audio/bcm2835-vchiq.c | 3 +-- drivers/staging/vc04_services/interface/vchi/vchi.h | 1 - .../vc04_services/interface/vchiq_arm/vchiq_shim.c | 12 +++--------- .../staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c | 2 +- .../staging/vc04_services/vchiq-mmal/mmal-vchiq.c | 2 +- 5 files changed, 6 insertions(+), 14 deletions(-) diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c index 5018b5baa009..68119246f10b 100644 --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c @@ -102,8 +102,7 @@ static void audio_vchi_callback(void *param, if (reason != VCHI_CALLBACK_MSG_AVAILABLE) return; - status = vchi_msg_hold(instance->service, (void **)&m, &size, - VCHI_FLAGS_NONE, &handle); + status = vchi_msg_hold(instance->service, (void **)&m, &size, &handle); if (status) return; diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h b/drivers/staging/vc04_services/interface/vchi/vchi.h index 55e51e5a1fdc..92ce811fc28d 100644 --- a/drivers/staging/vc04_services/interface/vchi/vchi.h +++ b/drivers/staging/vc04_services/interface/vchi/vchi.h @@ -87,7 +87,6 @@ extern int vchi_queue_kernel_message(struct vchi_service *service, void *data, extern int32_t vchi_msg_hold(struct vchi_service *service, void **data, // } may be NULL, as info can be uint32_t *msg_size, // } obtained from HELD_MSG_T - enum vchi_flags flags, struct vchi_held_msg *message_descriptor); /******************************************************************************* 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 0c3473861a8d..0466512cfe3c 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c @@ -195,7 +195,6 @@ EXPORT_SYMBOL(vchi_held_msg_release); * Arguments: struct vchi_service *service, * void **data, * uint32_t *msg_size, - * enum vchi_flags flags, * struct vchi_held_msg *message_handle * * Description: Routine to return a pointer to the current message (to allow @@ -207,17 +206,12 @@ EXPORT_SYMBOL(vchi_held_msg_release); * ***********************************************************/ int32_t vchi_msg_hold(struct vchi_service *service, void **data, - uint32_t *msg_size, enum vchi_flags flags, - struct vchi_held_msg *message_handle) + uint32_t *msg_size, struct vchi_held_msg *message_handle) { struct vchiq_header *header; - WARN_ON((flags != VCHI_FLAGS_NONE) && - (flags != VCHI_FLAGS_BLOCK_UNTIL_OP_COMPLETE)); - - if (flags == VCHI_FLAGS_NONE) - if (vchiu_queue_is_empty(&service->queue)) - return -1; + if (vchiu_queue_is_empty(&service->queue)) + return -1; header = vchiu_queue_pop(&service->queue); diff --git a/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c b/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c index 72b09685db31..826cac7922d2 100644 --- a/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c +++ b/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c @@ -237,7 +237,7 @@ static int vc_sm_cma_vchi_videocore_io(void *arg) } while (1); while (!vchi_msg_hold(instance->service, (void **)&reply, - &reply_len, VCHI_FLAGS_NONE, &msg)) { + &reply_len, &msg)) { if (reply->trans_id & 0x80000000) { /* Async event or cmd from the VPU */ if (instance->vpu_event) diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c index 5183aff453eb..9f905f529d91 100644 --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c @@ -693,7 +693,7 @@ static void service_callback(void *param, switch (reason) { case VCHI_CALLBACK_MSG_AVAILABLE: status = vchi_msg_hold(instance->service, (void **)&msg, - &msg_len, VCHI_FLAGS_NONE, &msg_handle); + &msg_len, &msg_handle); if (status) { pr_err("Unable to dequeue a message (%d)\n", status); break; From patchwork Wed May 27 11:53:27 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: 11572721 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 0F10D14C0 for ; Wed, 27 May 2020 12:04:52 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id DE6F6207CB for ; Wed, 27 May 2020 12:04:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="UInqXMJR" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DE6F6207CB 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=bombadil.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=w9Uvyue02nG+dksC8h4YnrKSZrbxxnTM15Za1fzhopw=; b=UInqXMJRxjsanL bsL7RNFapNWGVPctbTdStknxj2E8G/xQ7cBJfKou1qyKCp/+LHDdmZEwOYnC8MLNyvvnRt8Bwv9Yn NfGkDTAKg0JFF1XZvzjUKmvSXu361VOmAZBwbRqSidWr6GYI7rfDRuySjlhWgSChAFXHpGUXskU5c IDSFlhj3Ycg5pd/ZQvkkbFZxXvq5INloFXH8CCCvhWCkkRMX0y+1dwEpdLJNlBDHGri59dEAMK7nd mjWj3vhu5dU12E3+44B7W5NvGuDlJp3OsK6ILMnQUUX9o83+lCcU42RGTUkfbEfSdB4Wvyra/q0nk 4/B815al5RDt2O8tqktQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdunc-0002fy-Ul; Wed, 27 May 2020 12:04:45 +0000 Received: from mx2.suse.de ([195.135.220.15]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdudm-0006tb-Vc; Wed, 27 May 2020 11:54:38 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 7CF2FAF16; Wed, 27 May 2020 11:54:35 +0000 (UTC) From: Nicolas Saenz Julienne To: bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Nicolas Saenz Julienne , Florian Fainelli , Ray Jui , Scott Branden Subject: [RFC 22/50] staging: vchi: Use enum vchiq_bulk_mode instead of vchi's transmission flags Date: Wed, 27 May 2020 13:53:27 +0200 Message-Id: <20200527115400.31391-23-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527115400.31391-1-nsaenzjulienne@suse.de> References: <20200527115400.31391-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200527_045435_988245_4AD88563 X-CRM114-Status: GOOD ( 17.09 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -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] 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [195.135.220.15 listed in wl.mailspike.net] -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, laurent.pinchart@ideasonboard.com, linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org vchi has a set of transfer flags which almost map 1:1 to vchiq's own transfer modes. For the sake of simplicity let's use the later and delete vchi's. Signed-off-by: Nicolas Saenz Julienne --- .../bcm2835-audio/bcm2835-vchiq.c | 2 +- .../vc04_services/bcm2835-audio/bcm2835.h | 1 + .../vc04_services/interface/vchi/vchi.h | 4 +- .../interface/vchi/vchi_common.h | 9 ---- .../interface/vchiq_arm/vchiq_shim.c | 44 ++----------------- .../vc04_services/vc-sm-cma/vc_sm_cma_vchi.c | 1 + .../vc04_services/vchiq-mmal/mmal-vchiq.c | 4 +- 7 files changed, 10 insertions(+), 55 deletions(-) diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c index 68119246f10b..565853ec1e7a 100644 --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c @@ -348,7 +348,7 @@ int bcm2835_audio_write(struct bcm2835_alsa_stream *alsa_stream, /* Send the message to the videocore */ status = vchi_bulk_queue_transmit(instance->service, src, count, - VCHI_FLAGS_BLOCK_UNTIL_DATA_READ, + VCHIQ_BULK_MODE_BLOCKING, NULL); } else { while (count > 0) { diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h b/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h index 2a94e825194f..7a0e4ab50fc7 100644 --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h @@ -9,6 +9,7 @@ #include #include #include +#include "interface/vchiq_arm/vchiq_if.h" #include "interface/vchi/vchi.h" #define MAX_SUBSTREAMS (8) diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h b/drivers/staging/vc04_services/interface/vchi/vchi.h index 92ce811fc28d..9a74ca4e1062 100644 --- a/drivers/staging/vc04_services/interface/vchi/vchi.h +++ b/drivers/staging/vc04_services/interface/vchi/vchi.h @@ -105,14 +105,14 @@ extern int32_t vchi_held_msg_release(struct vchi_held_msg *message); extern int32_t vchi_bulk_queue_receive(struct vchi_service *service, void *data_dst, uint32_t data_size, - enum vchi_flags flags, + enum vchiq_bulk_mode mode, void *transfer_handle); // Routine to queue up data ready for transfer to the other (once they have signalled they are ready) extern int32_t vchi_bulk_queue_transmit(struct vchi_service *service, const void *data_src, uint32_t data_size, - enum vchi_flags flags, + enum vchiq_bulk_mode mode, void *transfer_handle); /****************************************************************************** diff --git a/drivers/staging/vc04_services/interface/vchi/vchi_common.h b/drivers/staging/vc04_services/interface/vchi/vchi_common.h index e07376fe4dfd..52b447c19445 100644 --- a/drivers/staging/vc04_services/interface/vchi/vchi_common.h +++ b/drivers/staging/vc04_services/interface/vchi/vchi_common.h @@ -4,15 +4,6 @@ #ifndef VCHI_COMMON_H_ #define VCHI_COMMON_H_ -//flags used when sending messages (must be bitmapped) -enum vchi_flags { - VCHI_FLAGS_NONE = 0x0, - VCHI_FLAGS_BLOCK_UNTIL_OP_COMPLETE = 0x1, // waits for message to be received, or sent (NB. not the same as being seen on other side) - VCHI_FLAGS_CALLBACK_WHEN_OP_COMPLETE = 0x2, // run a callback when message sent - VCHI_FLAGS_BLOCK_UNTIL_QUEUED = 0x4, // return once the transfer is in a queue ready to go - VCHI_FLAGS_BLOCK_UNTIL_DATA_READ = 0x10, -}; - //callback reasons when an event occurs on a service enum vchi_callback_reason { /* 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 0466512cfe3c..3a5545e0db6b 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c @@ -3,6 +3,7 @@ #include #include +#include "vchiq_if.h" #include "../vchi/vchi.h" #include "vchiq.h" #include "vchiq_core.h" @@ -57,30 +58,11 @@ EXPORT_SYMBOL(vchi_queue_kernel_message); * ***********************************************************/ int32_t vchi_bulk_queue_receive(struct vchi_service *service, void *data_dst, - uint32_t data_size, enum vchi_flags flags, + uint32_t data_size, enum vchiq_bulk_mode mode, void *bulk_handle) { - enum vchiq_bulk_mode mode; enum vchiq_status status; - switch ((int)flags) { - case VCHI_FLAGS_CALLBACK_WHEN_OP_COMPLETE - | VCHI_FLAGS_BLOCK_UNTIL_QUEUED: - WARN_ON(!service->callback); - mode = VCHIQ_BULK_MODE_CALLBACK; - break; - case VCHI_FLAGS_BLOCK_UNTIL_OP_COMPLETE: - mode = VCHIQ_BULK_MODE_BLOCKING; - break; - case VCHI_FLAGS_BLOCK_UNTIL_QUEUED: - case VCHI_FLAGS_NONE: - mode = VCHIQ_BULK_MODE_NOCALLBACK; - break; - default: - WARN(1, "unsupported message\n"); - return VCHIQ_ERROR; - } - while (1) { status = vchiq_bulk_receive(service->handle, data_dst, data_size, bulk_handle, mode); @@ -116,31 +98,11 @@ EXPORT_SYMBOL(vchi_bulk_queue_receive); int32_t vchi_bulk_queue_transmit(struct vchi_service *service, const void *data_src, uint32_t data_size, - enum vchi_flags flags, + enum vchiq_bulk_mode mode, void *bulk_handle) { - enum vchiq_bulk_mode mode; enum vchiq_status status; - switch ((int)flags) { - case VCHI_FLAGS_CALLBACK_WHEN_OP_COMPLETE - | VCHI_FLAGS_BLOCK_UNTIL_QUEUED: - WARN_ON(!service->callback); - mode = VCHIQ_BULK_MODE_CALLBACK; - break; - case VCHI_FLAGS_BLOCK_UNTIL_DATA_READ: - case VCHI_FLAGS_BLOCK_UNTIL_OP_COMPLETE: - mode = VCHIQ_BULK_MODE_BLOCKING; - break; - case VCHI_FLAGS_BLOCK_UNTIL_QUEUED: - case VCHI_FLAGS_NONE: - mode = VCHIQ_BULK_MODE_NOCALLBACK; - break; - default: - WARN(1, "unsupported message\n"); - return VCHIQ_ERROR; - } - while (1) { status = vchiq_bulk_transmit(service->handle, data_src, data_size, bulk_handle, mode); diff --git a/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c b/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c index 826cac7922d2..b7de8526fc54 100644 --- a/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c +++ b/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c @@ -19,6 +19,7 @@ #include #include +#include "interface/vchiq_arm/vchiq_if.h" #include "vc_sm_cma_vchi.h" #define VC_SM_VER 1 diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c index 9f905f529d91..1d9a3f94799a 100644 --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c @@ -32,6 +32,7 @@ #include "vc-sm-cma/vc_sm_knl.h" +#include "interface/vchiq_arm/vchiq_if.h" #include "interface/vchi/vchi.h" /* @@ -298,8 +299,7 @@ static void buffer_to_host_work_cb(struct work_struct *work) * of 4 bytes */ (len + 3) & ~3, - VCHI_FLAGS_CALLBACK_WHEN_OP_COMPLETE | - VCHI_FLAGS_BLOCK_UNTIL_QUEUED, + VCHIQ_BULK_MODE_CALLBACK, msg_context); vchi_service_release(instance->service); From patchwork Wed May 27 11:53:28 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: 11572725 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 6B55B14B7 for ; Wed, 27 May 2020 12:05:37 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 2065820657 for ; Wed, 27 May 2020 12:05:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ZFOj1Z2l" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2065820657 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=bombadil.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=y2NYSCeDIZkUYdS0ZHbacoU+7wuDi02W+DNJwhyzWFo=; b=ZFOj1Z2lwh+y0C UdTMws9sfb/3VX4DRBvC1PIdNSJnK/oDH0TsPHpl8tc+LEN4h+4LXX7H30vCzA9Dj2bfxaUau0LGC rJDP8QpUxF6i5zsWlasMs9meLJ17cnP9NA4YAp+qqymQDEYNaEn0CRpAAwCeZMoXm2EjFu0P/nu5d /BYLXZsnRk5NvYtfjCPnPsrA8ddhv+6XIa8byQjlYzq5EgP0u+HXKM0utR1twvgoxOoyA88a7pE8Z ExfNUDmkQgTfI+CIIHMpO+sV8loE14+5USy7Rur1vO0ALqtp8KRK0QfBlNRY4fGvaEBPK78GacdkV nG0+ETeOTJw6QHrrXHcw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jduoJ-0005WF-Kc; Wed, 27 May 2020 12:05:27 +0000 Received: from mx2.suse.de ([195.135.220.15]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdudn-0006uS-MT; Wed, 27 May 2020 11:54:38 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id AD89AAD17; Wed, 27 May 2020 11:54:36 +0000 (UTC) From: Nicolas Saenz Julienne To: bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Nicolas Saenz Julienne , Florian Fainelli , Ray Jui , Scott Branden Subject: [RFC 23/50] staging: vchi: Use vchiq's enum vchiq_reason Date: Wed, 27 May 2020 13:53:28 +0200 Message-Id: <20200527115400.31391-24-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527115400.31391-1-nsaenzjulienne@suse.de> References: <20200527115400.31391-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200527_045436_070642_06AAD7C7 X-CRM114-Status: GOOD ( 17.86 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -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] 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [195.135.220.15 listed in wl.mailspike.net] -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, laurent.pinchart@ideasonboard.com, linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org enum vchi_callback_reason maps 1:1 to enum vchiq_reason, in an effort to simplify things, let's use the later, and get rid of the extra indirection. Signed-off-by: Nicolas Saenz Julienne --- .../bcm2835-audio/bcm2835-vchiq.c | 5 +-- .../interface/vchi/vchi_common.h | 20 +--------- .../interface/vchiq_arm/vchiq_shim.c | 40 +------------------ .../staging/vc04_services/vc-sm-cma/vc_sm.c | 1 + .../vc04_services/vc-sm-cma/vc_sm_cma_vchi.c | 7 ++-- .../vc04_services/vchiq-mmal/mmal-vchiq.c | 11 +++-- 6 files changed, 14 insertions(+), 70 deletions(-) diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c index 565853ec1e7a..0f97eda4ec90 100644 --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c @@ -89,8 +89,7 @@ static int bcm2835_audio_send_simple(struct bcm2835_audio_instance *instance, return bcm2835_audio_send_msg(instance, &m, wait); } -static void audio_vchi_callback(void *param, - const enum vchi_callback_reason reason, +static void audio_vchi_callback(void *param, const enum vchiq_reason reason, void *msg_handle) { struct bcm2835_audio_instance *instance = param; @@ -99,7 +98,7 @@ static void audio_vchi_callback(void *param, unsigned size; int status; - if (reason != VCHI_CALLBACK_MSG_AVAILABLE) + if (reason != VCHIQ_MESSAGE_AVAILABLE) return; status = vchi_msg_hold(instance->service, (void **)&m, &size, &handle); diff --git a/drivers/staging/vc04_services/interface/vchi/vchi_common.h b/drivers/staging/vc04_services/interface/vchi/vchi_common.h index 52b447c19445..24e8665e214a 100644 --- a/drivers/staging/vc04_services/interface/vchi/vchi_common.h +++ b/drivers/staging/vc04_services/interface/vchi/vchi_common.h @@ -4,27 +4,9 @@ #ifndef VCHI_COMMON_H_ #define VCHI_COMMON_H_ -//callback reasons when an event occurs on a service -enum vchi_callback_reason { - /* - * This indicates that there is data available handle is the msg id that - * was transmitted with the data - * When a message is received and there was no FULL message available - * previously, send callback - * Tasks get kicked by the callback, reset their event and try and read - * from the fifo until it fails - */ - VCHI_CALLBACK_SERVICE_CLOSED, - VCHI_CALLBACK_MSG_AVAILABLE, - VCHI_CALLBACK_BULK_SENT, - VCHI_CALLBACK_BULK_RECEIVED, - VCHI_CALLBACK_BULK_TRANSMIT_ABORTED, - VCHI_CALLBACK_BULK_RECEIVE_ABORTED, -}; - //Callback used by all services / bulk transfers typedef void (*vchi_callback)(void *callback_param, //my service local param - enum vchi_callback_reason reason, + enum vchiq_reason reason, void *handle); //for transmitting msg's only #endif // VCHI_COMMON_H_ 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 3a5545e0db6b..649a65f02578 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c @@ -274,46 +274,10 @@ static enum vchiq_status shim_callback(enum vchiq_reason reason, if (!service->callback) goto release; - switch (reason) { - case VCHIQ_MESSAGE_AVAILABLE: + if (reason == VCHIQ_MESSAGE_AVAILABLE) vchiu_queue_push(&service->queue, header); - service->callback(service->callback_param, - VCHI_CALLBACK_MSG_AVAILABLE, NULL); - - break; - - case VCHIQ_BULK_TRANSMIT_DONE: - service->callback(service->callback_param, - VCHI_CALLBACK_BULK_SENT, bulk_user); - break; - - case VCHIQ_BULK_RECEIVE_DONE: - service->callback(service->callback_param, - VCHI_CALLBACK_BULK_RECEIVED, bulk_user); - break; - - case VCHIQ_SERVICE_CLOSED: - service->callback(service->callback_param, - VCHI_CALLBACK_SERVICE_CLOSED, NULL); - break; - - case VCHIQ_BULK_TRANSMIT_ABORTED: - service->callback(service->callback_param, - VCHI_CALLBACK_BULK_TRANSMIT_ABORTED, - bulk_user); - break; - - case VCHIQ_BULK_RECEIVE_ABORTED: - service->callback(service->callback_param, - VCHI_CALLBACK_BULK_RECEIVE_ABORTED, - bulk_user); - break; - - default: - WARN(1, "not supported\n"); - break; - } + service->callback(service->callback_param, reason, bulk_user); release: return VCHIQ_SUCCESS; diff --git a/drivers/staging/vc04_services/vc-sm-cma/vc_sm.c b/drivers/staging/vc04_services/vc-sm-cma/vc_sm.c index e660f546a7e4..fcef607e9446 100644 --- a/drivers/staging/vc04_services/vc-sm-cma/vc_sm.c +++ b/drivers/staging/vc04_services/vc-sm-cma/vc_sm.c @@ -48,6 +48,7 @@ #include #include +#include "vchiq_if.h" #include "vchiq_connected.h" #include "vc_sm_cma_vchi.h" diff --git a/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c b/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c index b7de8526fc54..7efe42d51e46 100644 --- a/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c +++ b/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c @@ -265,8 +265,7 @@ static int vc_sm_cma_vchi_videocore_io(void *arg) return 0; } -static void vc_sm_cma_vchi_callback(void *param, - const enum vchi_callback_reason reason, +static void vc_sm_cma_vchi_callback(void *param, const enum vchiq_reason reason, void *msg_handle) { struct sm_instance *instance = param; @@ -274,11 +273,11 @@ static void vc_sm_cma_vchi_callback(void *param, (void)msg_handle; switch (reason) { - case VCHI_CALLBACK_MSG_AVAILABLE: + case VCHIQ_MESSAGE_AVAILABLE: complete(&instance->io_cmplt); break; - case VCHI_CALLBACK_SERVICE_CLOSED: + case VCHIQ_SERVICE_CLOSED: pr_info("%s: service CLOSED!!", __func__); default: break; diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c index 1d9a3f94799a..258cfab7d397 100644 --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c @@ -674,8 +674,7 @@ static void bulk_abort_cb(struct vchiq_mmal_instance *instance, } /* incoming event service callback */ -static void service_callback(void *param, - const enum vchi_callback_reason reason, +static void service_callback(void *param, const enum vchiq_reason reason, void *bulk_ctx) { struct vchiq_mmal_instance *instance = param; @@ -691,7 +690,7 @@ static void service_callback(void *param, } switch (reason) { - case VCHI_CALLBACK_MSG_AVAILABLE: + case VCHIQ_MESSAGE_AVAILABLE: status = vchi_msg_hold(instance->service, (void **)&msg, &msg_len, &msg_handle); if (status) { @@ -756,15 +755,15 @@ static void service_callback(void *param, break; - case VCHI_CALLBACK_BULK_RECEIVED: + case VCHIQ_BULK_RECEIVE_DONE: bulk_receive_cb(instance, bulk_ctx); break; - case VCHI_CALLBACK_BULK_RECEIVE_ABORTED: + case VCHIQ_BULK_RECEIVE_ABORTED: bulk_abort_cb(instance, bulk_ctx); break; - case VCHI_CALLBACK_SERVICE_CLOSED: + case VCHIQ_SERVICE_CLOSED: /* TODO: consider if this requires action if received when * driver is not explicitly closing the service */ From patchwork Wed May 27 11:53:29 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: 11572723 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 B5D1A166C for ; Wed, 27 May 2020 12:05:16 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 616D7206DF for ; Wed, 27 May 2020 12:05:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="uOa+s7WZ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 616D7206DF 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=bombadil.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=BCo0nicHPlVhyulR1eDIsFCxuSiL+jy1KTeiFILPzis=; b=uOa+s7WZo7gVJZ ZnUEh2sMI2AEp2JANiQMLG6peEhphyNAVuzb83hqhPlhcmma7ebSWUzZ4YT9Xy8+PFZ/9FgatDl4z 8s2YiwDKBOFmiRtEJEG4xZKthzwse3pbaL9ERLV4IwVM89Y2vutNxk7tMoLV3ZnjV9K4WeKCiDGKI g1uEziF5ViLPaIn1bpKeJYf5U+Uva0qdB8L8b8Sl26yU+447K0a7jsXaRv9a9IRguvYkU4zZj15Il zMeBl2FkCMAXU7wx0NIf3OxB68eEp2wmZTM7m4SXJp3YZRRpukJzbHnkD65DDNvorYyTC7Awr4aSP C0DEW8T817AeavqvBc9Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdunz-0002v6-Cw; Wed, 27 May 2020 12:05:07 +0000 Received: from mx2.suse.de ([195.135.220.15]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdudo-0006un-Eo; Wed, 27 May 2020 11:54:38 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 5951AAC91; Wed, 27 May 2020 11:54:37 +0000 (UTC) From: Nicolas Saenz Julienne To: bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [RFC 24/50] staging: vchi: Get rid of effect less expression Date: Wed, 27 May 2020 13:53:29 +0200 Message-Id: <20200527115400.31391-25-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527115400.31391-1-nsaenzjulienne@suse.de> References: <20200527115400.31391-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200527_045436_702239_75010D22 X-CRM114-Status: GOOD ( 10.18 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -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] 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [195.135.220.15 listed in wl.mailspike.net] -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, laurent.pinchart@ideasonboard.com, Nicolas Saenz Julienne , gregkh@linuxfoundation.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org It was probably there to trick compilers into ignoring unused variables, which isn't needed in Linux. Signed-off-by: Nicolas Saenz Julienne --- drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c | 2 -- 1 file changed, 2 deletions(-) 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 649a65f02578..e09c595d6f9d 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c @@ -288,8 +288,6 @@ static struct vchi_service *service_alloc(struct vchiq_instance *instance, { struct vchi_service *service = kzalloc(sizeof(struct vchi_service), GFP_KERNEL); - (void)instance; - if (service) { if (!vchiu_queue_init(&service->queue, 64)) { service->callback = setup->callback; From patchwork Wed May 27 11:53:30 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: 11572719 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 8FE1914C0 for ; Wed, 27 May 2020 12:04:26 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 6B7CD207CB for ; Wed, 27 May 2020 12:04:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Bk9ZuIvu" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6B7CD207CB 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=bombadil.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=Zz3zM9ez/aOcmsZosIOlInhkkyqI0zjBQsSL3o3FjCo=; b=Bk9ZuIvuWZ/7GF h7VLTcM797T7FzlsJS+nvNgha/XdhgJzqHGe8RRQA0pnqKKqIdFB7V1ECMiK3moPiOmS2ln6UzmtI dpkFdtzGoZv5qpCmgBdDO5JnzP9SRgIWjanVdknRnzeYlHSXvvIqMI/GIW5FWlOXTat19bKJ6XZpI VH3CjcujYjwMDXEL1Bu0qy89LB0YMSrdCSmGXkbo0KeL0dGIk32hfGnQqCYA6/CaPLpXVvdFyxRaw SWR86GQlZYIfaDf+BrrFw3G/RcsyHhdV/VQ/idWlDUR24DZg/sH45AQZOneeaEc4qgOp8iWZc7AXd cil0RLdnPnvZeRdPNsrA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdunE-0002LX-Ok; Wed, 27 May 2020 12:04:20 +0000 Received: from mx2.suse.de ([195.135.220.15]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdudp-0006vG-HJ; Wed, 27 May 2020 11:54:40 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 29337AE2D; Wed, 27 May 2020 11:54:38 +0000 (UTC) From: Nicolas Saenz Julienne To: bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [RFC 25/50] staging: vchiq: Introduce vchiq_validate_params() Date: Wed, 27 May 2020 13:53:30 +0200 Message-Id: <20200527115400.31391-26-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527115400.31391-1-nsaenzjulienne@suse.de> References: <20200527115400.31391-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200527_045437_730718_DD673197 X-CRM114-Status: GOOD ( 12.75 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -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] 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [195.135.220.15 listed in wl.mailspike.net] -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, laurent.pinchart@ideasonboard.com, Nicolas Saenz Julienne , gregkh@linuxfoundation.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org When adding a new service validate the configuration parameters provided, and remove unnecessary checks in vchi, now that we have validated service's config. Signed-off-by: Nicolas Saenz Julienne --- .../interface/vchiq_arm/vchiq_core.c | 15 +++++++++++++++ .../interface/vchiq_arm/vchiq_shim.c | 4 ---- 2 files changed, 15 insertions(+), 4 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 ae9183db44ee..46b09b7154f8 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c @@ -2265,6 +2265,16 @@ vchiq_init_state(struct vchiq_state *state, struct vchiq_slot_zero *slot_zero) return VCHIQ_ERROR; } +static int vchiq_validate_params(const struct vchiq_service_params *params) +{ + if (!params->callback || !params->fourcc) { + vchiq_loud_error("Can't add service, invalid params\n"); + return -EINVAL; + } + + return 0; +} + /* Called from application thread when a client or server service is created. */ struct vchiq_service * vchiq_add_service_internal(struct vchiq_state *state, @@ -2275,8 +2285,13 @@ vchiq_add_service_internal(struct vchiq_state *state, struct vchiq_service *service; struct vchiq_service __rcu **pservice = NULL; struct vchiq_service_quota *service_quota; + int ret; int i; + ret = vchiq_validate_params(params); + if (ret) + return NULL; + service = kmalloc(sizeof(*service), GFP_KERNEL); if (!service) return service; 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 e09c595d6f9d..dcf8776834b1 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c @@ -271,15 +271,11 @@ static enum vchiq_status shim_callback(enum vchiq_reason reason, struct vchi_service *service = (struct vchi_service *)VCHIQ_GET_SERVICE_USERDATA(handle); - if (!service->callback) - goto release; - if (reason == VCHIQ_MESSAGE_AVAILABLE) vchiu_queue_push(&service->queue, header); service->callback(service->callback_param, reason, bulk_user); -release: return VCHIQ_SUCCESS; } From patchwork Wed May 27 11:53:31 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: 11572729 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 85C36166C for ; Wed, 27 May 2020 12:06:09 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 5723220657 for ; Wed, 27 May 2020 12:06:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ppywaGns" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5723220657 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=bombadil.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=40L3NBM1puFwaU2YiJySp/WWroLXiWAUaSyht7azI6U=; b=ppywaGnsIMA7Ko GDAOzCss+7bqYt9pBIgsbYuFxlYSGC+hjE961/gpuzQMKAhHtUG7sj7yd+NVPYPoid4/hhQaB/JKh uDNLQKFH3hF1g0PVwHJ0LARtl2OOoFyzqDZ1+EjHOr7KN4HE7wyzB6EsQKTLcvxhAUFaUqOZ0cbYd 7xZUtrEVuGtJOrigitVpUX3uaT5F60/p3kI3vO3UONNaqhUgmLGIwodDZQ/mwHcsJT2AMzvYaTRUH G45hwcPSuIftiB7oySlD4h/HjAq2hndwyGxUvAfSfagXON0+4E5P5x5psqo/Mc9BWBYCoRu40BjdC w3NMCK5odaVi90Aw9seQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jduor-00060I-7U; Wed, 27 May 2020 12:06:01 +0000 Received: from mx2.suse.de ([195.135.220.15]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdudq-0006x0-Bo; Wed, 27 May 2020 11:54:41 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 6A614AD2B; Wed, 27 May 2020 11:54:39 +0000 (UTC) From: Nicolas Saenz Julienne To: bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Nicolas Saenz Julienne Subject: [RFC 26/50] staging: vchiq: Move message queue into struct vchiq_service Date: Wed, 27 May 2020 13:53:31 +0200 Message-Id: <20200527115400.31391-27-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527115400.31391-1-nsaenzjulienne@suse.de> References: <20200527115400.31391-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200527_045438_711532_47D938EC X-CRM114-Status: GOOD ( 19.23 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -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] 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [195.135.220.15 listed in wl.mailspike.net] -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, laurent.pinchart@ideasonboard.com, linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org This has historically been handled by vchi, but there is no reason why this couldn't be handled directly in vchiq. The patch tries to avoid altering any behavior, with the exception of the msg_queue size, which is now fixed to VCHIQ_MAX_SLOTS (it was set to VCHIQ_MAX_SLOTS / 2). This is done to match vchiq's user_service message queue, which could be merged with this one in the future. Signed-off-by: Nicolas Saenz Julienne --- drivers/staging/vc04_services/Makefile | 1 - .../interface/vchiq_arm/vchiq_core.c | 46 ++++++++++++ .../interface/vchiq_arm/vchiq_core.h | 6 ++ .../interface/vchiq_arm/vchiq_if.h | 2 + .../interface/vchiq_arm/vchiq_shim.c | 24 ++---- .../interface/vchiq_arm/vchiq_util.c | 73 ------------------- .../interface/vchiq_arm/vchiq_util.h | 22 ------ 7 files changed, 61 insertions(+), 113 deletions(-) delete mode 100644 drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.c diff --git a/drivers/staging/vc04_services/Makefile b/drivers/staging/vc04_services/Makefile index 5fc3b65224a3..6a426572793b 100644 --- a/drivers/staging/vc04_services/Makefile +++ b/drivers/staging/vc04_services/Makefile @@ -7,7 +7,6 @@ vchiq-objs := \ interface/vchiq_arm/vchiq_2835_arm.o \ interface/vchiq_arm/vchiq_debugfs.o \ interface/vchiq_arm/vchiq_shim.o \ - interface/vchiq_arm/vchiq_util.o \ interface/vchiq_arm/vchiq_connected.o \ obj-$(CONFIG_SND_BCM2835) += bcm2835-audio/ 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 46b09b7154f8..0e9680904e68 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c @@ -2265,6 +2265,47 @@ vchiq_init_state(struct vchiq_state *state, struct vchiq_slot_zero *slot_zero) return VCHIQ_ERROR; } +void vchiq_msg_queue_push(unsigned handle, struct vchiq_header *header) +{ + struct vchiq_service *service = find_service_by_handle(handle); + int pos; + + while (service->msg_queue_write == service->msg_queue_read + + VCHIQ_MAX_SLOTS) { + if (wait_for_completion_interruptible(&service->msg_queue_pop)) + flush_signals(current); + } + + pos = service->msg_queue_write++ & (VCHIQ_MAX_SLOTS - 1); + service->msg_queue[pos] = header; + + complete(&service->msg_queue_push); +} +EXPORT_SYMBOL(vchiq_msg_queue_push); + +struct vchiq_header *vchiq_msg_hold(unsigned handle) +{ + struct vchiq_service *service = find_service_by_handle(handle); + struct vchiq_header *header; + int pos; + + if (service->msg_queue_write == service->msg_queue_read) + return NULL; + + while (service->msg_queue_write == service->msg_queue_read) { + if (wait_for_completion_interruptible(&service->msg_queue_push)) + flush_signals(current); + } + + pos = service->msg_queue_read++ & (VCHIQ_MAX_SLOTS - 1); + header = service->msg_queue[pos]; + + complete(&service->msg_queue_pop); + + return header; +} +EXPORT_SYMBOL(vchiq_msg_hold); + static int vchiq_validate_params(const struct vchiq_service_params *params) { if (!params->callback || !params->fourcc) { @@ -2319,12 +2360,17 @@ vchiq_add_service_internal(struct vchiq_state *state, service->state = state; service->instance = instance; service->service_use_count = 0; + service->msg_queue_read = 0; + service->msg_queue_write = 0; init_bulk_queue(&service->bulk_tx); init_bulk_queue(&service->bulk_rx); init_completion(&service->remove_event); init_completion(&service->bulk_remove_event); + init_completion(&service->msg_queue_pop); + init_completion(&service->msg_queue_push); mutex_init(&service->bulk_mutex); memset(&service->stats, 0, sizeof(service->stats)); + memset(&service->msg_queue, 0, sizeof(service->msg_queue)); /* Although it is perfectly possible to use a spinlock ** to protect the creation of services, it is overkill as it 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 1fe6cd8b86c0..b97b661bea1c 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h @@ -297,6 +297,12 @@ struct vchiq_service { uint64_t bulk_tx_bytes; uint64_t bulk_rx_bytes; } stats; + + int msg_queue_read; + int msg_queue_write; + struct completion msg_queue_pop; + struct completion msg_queue_push; + struct vchiq_header *msg_queue[VCHIQ_MAX_SLOTS]; }; /* The quota information is outside struct vchiq_service so that it can 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 b62fd6d6f1ac..8fd51d885a18 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h @@ -136,5 +136,7 @@ extern enum vchiq_status vchiq_dump_phys_mem(unsigned int service, extern enum vchiq_status vchiq_get_peer_version(unsigned int handle, short *peer_version); +extern void vchiq_msg_queue_push(unsigned handle, struct vchiq_header *header); +extern struct vchiq_header *vchiq_msg_hold(unsigned handle); #endif /* VCHIQ_IF_H */ 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 dcf8776834b1..85d79d0033bf 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c @@ -13,8 +13,6 @@ struct vchi_service { unsigned int handle; - struct vchiu_queue queue; - vchi_callback callback; void *callback_param; }; @@ -172,10 +170,9 @@ int32_t vchi_msg_hold(struct vchi_service *service, void **data, { struct vchiq_header *header; - if (vchiu_queue_is_empty(&service->queue)) - return -1; - - header = vchiu_queue_pop(&service->queue); + header = vchiq_msg_hold(service->handle); + if (!header) + return -ENOENT; *data = header->data; *msg_size = header->size; @@ -272,7 +269,7 @@ static enum vchiq_status shim_callback(enum vchiq_reason reason, (struct vchi_service *)VCHIQ_GET_SERVICE_USERDATA(handle); if (reason == VCHIQ_MESSAGE_AVAILABLE) - vchiu_queue_push(&service->queue, header); + vchiq_msg_queue_push(service->handle, header); service->callback(service->callback_param, reason, bulk_user); @@ -285,13 +282,8 @@ static struct vchi_service *service_alloc(struct vchiq_instance *instance, struct vchi_service *service = kzalloc(sizeof(struct vchi_service), GFP_KERNEL); if (service) { - if (!vchiu_queue_init(&service->queue, 64)) { - service->callback = setup->callback; - service->callback_param = setup->callback_param; - } else { - kfree(service); - service = NULL; - } + service->callback = setup->callback; + service->callback_param = setup->callback_param; } return service; @@ -299,10 +291,8 @@ static struct vchi_service *service_alloc(struct vchiq_instance *instance, static void service_free(struct vchi_service *service) { - if (service) { - vchiu_queue_delete(&service->queue); + if (service) kfree(service); - } } int32_t vchi_service_open(struct vchiq_instance *instance, diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.c deleted file mode 100644 index c1c81f9ab9e6..000000000000 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.c +++ /dev/null @@ -1,73 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause -/* Copyright (c) 2010-2012 Broadcom. All rights reserved. */ - -#include "vchiq_util.h" - -static inline int is_pow2(int i) -{ - return i && !(i & (i - 1)); -} - -int vchiu_queue_init(struct vchiu_queue *queue, int size) -{ - WARN_ON(!is_pow2(size)); - - queue->size = size; - queue->read = 0; - queue->write = 0; - queue->initialized = 1; - - init_completion(&queue->pop); - init_completion(&queue->push); - - queue->storage = kcalloc(size, sizeof(struct vchiq_header *), - GFP_KERNEL); - if (!queue->storage) { - vchiu_queue_delete(queue); - return -ENOMEM; - } - return 0; -} - -void vchiu_queue_delete(struct vchiu_queue *queue) -{ - kfree(queue->storage); -} - -int vchiu_queue_is_empty(struct vchiu_queue *queue) -{ - return queue->read == queue->write; -} - -void vchiu_queue_push(struct vchiu_queue *queue, struct vchiq_header *header) -{ - if (!queue->initialized) - return; - - while (queue->write == queue->read + queue->size) { - if (wait_for_completion_interruptible(&queue->pop)) - flush_signals(current); - } - - queue->storage[queue->write & (queue->size - 1)] = header; - queue->write++; - - complete(&queue->push); -} - -struct vchiq_header *vchiu_queue_pop(struct vchiu_queue *queue) -{ - struct vchiq_header *header; - - while (queue->write == queue->read) { - if (wait_for_completion_interruptible(&queue->push)) - flush_signals(current); - } - - header = queue->storage[queue->read & (queue->size - 1)]; - queue->read++; - - complete(&queue->pop); - - return header; -} diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.h index 1c90a8da1a92..dcf081079c39 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.h +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.h @@ -24,26 +24,4 @@ #include "vchiq_if.h" -struct vchiu_queue { - int size; - int read; - int write; - int initialized; - - struct completion pop; - struct completion push; - - struct vchiq_header **storage; -}; - -extern int vchiu_queue_init(struct vchiu_queue *queue, int size); -extern void vchiu_queue_delete(struct vchiu_queue *queue); - -extern int vchiu_queue_is_empty(struct vchiu_queue *queue); - -extern void vchiu_queue_push(struct vchiu_queue *queue, - struct vchiq_header *header); - -extern struct vchiq_header *vchiu_queue_pop(struct vchiu_queue *queue); - #endif From patchwork Wed May 27 11:53:32 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: 11572731 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 1C15514B7 for ; Wed, 27 May 2020 12:06:20 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id EE8F420657 for ; Wed, 27 May 2020 12:06:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Sem4FxhA" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EE8F420657 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=bombadil.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=fNfF+Mf8X9kNZIDFwaHn83KDp6P6i3LKBn3C4hphqB0=; b=Sem4FxhAF7c7tS ONYKY//lhdqIOMMK1ivaYLhmmzL1diFCo/dla1tbFnpOY8XZxD99LB72w/oOmbDYJA3lFNI+NTyeP QCbAhV140EJ1HG1bqn49uqIBsoFbpo7Uetwrwo6evEmYi8J65/EWjI7lJL+9aFVNN6WBfL0ppVQM8 3thZcbuHcqoJnm2KrZUczE1GYB9bg1e5QakTa5ApEPepDI3hCm3X80fbAoyIpidhYCC3ynjEA6y4u jdIe69PsGFl6iuKWZahScn51/IfkKxruwS9dEDGavsRcQnUx9SH5PMPmZzp8N6PQ4s908USoQn85r ytTlrEJ/JD7Xhl4YGb0w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdup4-0006E2-MP; Wed, 27 May 2020 12:06:14 +0000 Received: from mx2.suse.de ([195.135.220.15]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdudr-0006yA-LJ; Wed, 27 May 2020 11:54:42 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 9B992AB7D; Wed, 27 May 2020 11:54:40 +0000 (UTC) From: Nicolas Saenz Julienne To: bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [RFC 27/50] staging: vchiq: Get rid of vchiq_util.h Date: Wed, 27 May 2020 13:53:32 +0200 Message-Id: <20200527115400.31391-28-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527115400.31391-1-nsaenzjulienne@suse.de> References: <20200527115400.31391-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200527_045440_012002_FC2194E3 X-CRM114-Status: GOOD ( 13.11 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -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] 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [195.135.220.15 listed in wl.mailspike.net] -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, laurent.pinchart@ideasonboard.com, Nicolas Saenz Julienne , gregkh@linuxfoundation.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org The header file only provides other includes. Move the relevant includes to their respective C files and delete it for good. Signed-off-by: Nicolas Saenz Julienne --- .../vc04_services/interface/vchiq_arm/vchiq.h | 1 - .../interface/vchiq_arm/vchiq_2835_arm.c | 1 + .../interface/vchiq_arm/vchiq_arm.c | 1 + .../interface/vchiq_arm/vchiq_core.c | 9 +++++++ .../interface/vchiq_arm/vchiq_shim.c | 4 +-- .../interface/vchiq_arm/vchiq_util.h | 27 ------------------- 6 files changed, 13 insertions(+), 30 deletions(-) delete mode 100644 drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.h diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq.h index 25af99a0f394..211b20705e36 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq.h +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq.h @@ -5,7 +5,6 @@ #define VCHIQ_VCHIQ_H #include "vchiq_if.h" -#include "vchiq_util.h" /* Do this so that we can test-build the code on non-rpi systems */ #if IS_ENABLED(CONFIG_RASPBERRYPI_FIRMWARE) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c index ecec84ad4345..d80c5f9b5cd8 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #define TOTAL_SLOTS (VCHIQ_SLOT_ZERO_SLOTS + 2 * 32) 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 abc30e593b67..4230f33ac38a 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include "vchiq_core.h" 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 0e9680904e68..5b55d32e62a0 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c @@ -1,8 +1,17 @@ // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause /* Copyright (c) 2010-2012 Broadcom. All rights reserved. */ +#include +#include +#include +#include +#include +#include +#include +#include #include #include +#include #include "vchiq_core.h" 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 85d79d0033bf..9728667adbd9 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c @@ -2,14 +2,14 @@ /* Copyright (c) 2010-2012 Broadcom. All rights reserved. */ #include #include +#include +#include #include "vchiq_if.h" #include "../vchi/vchi.h" #include "vchiq.h" #include "vchiq_core.h" -#include "vchiq_util.h" - struct vchi_service { unsigned int handle; diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.h deleted file mode 100644 index dcf081079c39..000000000000 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.h +++ /dev/null @@ -1,27 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ -/* Copyright (c) 2010-2012 Broadcom. All rights reserved. */ - -#ifndef VCHIQ_UTIL_H -#define VCHIQ_UTIL_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include /* for time_t */ -#include - -#include "vchiq_if.h" - -#endif From patchwork Wed May 27 11:53:33 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: 11572727 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 93171166C for ; Wed, 27 May 2020 12:05:49 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 3F06220657 for ; Wed, 27 May 2020 12:05: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="EkryFcOx" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3F06220657 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=bombadil.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=25zJbCOzgsPGo2eXF17/SB+Ytemum5KQMpiG7pv+4l8=; b=EkryFcOxAMKzaA I8hpRC/whvnjGwykIYE69ChcYlL0j8B95j9UeCU6JuRAhjYC8O+qFzaK5XeRel584LvxxGO7gdrs7 8jHUYRbw7br+4Ab4JAdsoP2torEBRzGh4c99TSn+uX/w9AGBJn5MfNxkI63kZ5CyvJlLm71723EBB knJGnbAhNH/TtPUvJsK2+LfOwn0H6kBZrDwlx+rPCYRx2l8wotxREocw2mYrbowFgsg3Wn1vime3n 9Xk/qAxmCcFUp3WubiflHm8Vm3E2EVI9PEFJTeoK3SCuLWpWBWVqsY8dS6DEhcb9WsL+oAf5zx+cL W5pQWe4pG9kwkgL3gpUg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jduoa-0005mD-01; Wed, 27 May 2020 12:05:44 +0000 Received: from mx2.suse.de ([195.135.220.15]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jduds-0006yu-BB; Wed, 27 May 2020 11:54:42 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 54E6DAC5B; Wed, 27 May 2020 11:54:41 +0000 (UTC) From: Nicolas Saenz Julienne To: bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [RFC 28/50] staging: vchi: Expose struct vchi_service Date: Wed, 27 May 2020 13:53:33 +0200 Message-Id: <20200527115400.31391-29-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527115400.31391-1-nsaenzjulienne@suse.de> References: <20200527115400.31391-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200527_045440_554321_1E97134D X-CRM114-Status: GOOD ( 10.19 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -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] 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [195.135.220.15 listed in wl.mailspike.net] -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, laurent.pinchart@ideasonboard.com, Nicolas Saenz Julienne , gregkh@linuxfoundation.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org This will make further changes easier. The struct will ultimately disappear. Signed-off-by: Nicolas Saenz Julienne --- drivers/staging/vc04_services/interface/vchi/vchi.h | 10 +++++++--- .../vc04_services/interface/vchiq_arm/vchiq_shim.c | 7 ------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h b/drivers/staging/vc04_services/interface/vchi/vchi.h index 9a74ca4e1062..789acb7999d1 100644 --- a/drivers/staging/vc04_services/interface/vchi/vchi.h +++ b/drivers/staging/vc04_services/interface/vchi/vchi.h @@ -29,6 +29,13 @@ struct vchi_held_msg { void *message; }; +struct vchi_service { + unsigned int handle; + + vchi_callback callback; + void *callback_param; +}; + // structure used to provide the information needed to open a server or a client struct service_creation { struct vchi_version version; @@ -40,9 +47,6 @@ struct service_creation { // Opaque handle for a VCHIQ instance struct vchiq_instance; -// Opaque handle for a server or client -struct vchi_service; - /****************************************************************************** * Global funcs - implementation is specific to which side you are on * (local / remote) 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 9728667adbd9..843ee978928f 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c @@ -10,13 +10,6 @@ #include "vchiq.h" #include "vchiq_core.h" -struct vchi_service { - unsigned int handle; - - vchi_callback callback; - void *callback_param; -}; - int vchi_queue_kernel_message(struct vchi_service *service, void *data, unsigned int size) { From patchwork Wed May 27 11:53:34 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: 11572735 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 BA41B90 for ; Wed, 27 May 2020 12:06:55 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 98E2320657 for ; Wed, 27 May 2020 12:06:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="VsRdb3GP" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 98E2320657 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=bombadil.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=Obu96/cVHbpNC6OmDdvxetWCYfqkj522Hf7owanUloY=; b=VsRdb3GPCYh+ch qUjjrdY+EQisaZMvaCs6Aqg09qP+FCEO1Cv2Thxa8/Tr6YPeI0aGTx1zYsMr0K6Pi2MIEiiPr0VAF w9PoPAWivduUyuNWsGslECxA4x0/wlKNjR+6vh6f6XKA7vaLUAIQb6FlpJwwAjN0MW0oyJnSQJRJl N7noEyPls/1P755cLYi0Xl3PyZX2aWG3O1KWlcLKxHe1yV1/YVRggPDhE4t5FR9yZCnKneJ2Q5cJr 06xOvJuYs0J1w5d8uglHeOlbnekf9b8wvDqIm6trg5jMD0Gbms2VTe4Odf+SbL30Y87c2r0/kbDZU 0NFCmfP0dwgI38te7zLA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdupd-0006kC-PD; Wed, 27 May 2020 12:06:49 +0000 Received: from mx2.suse.de ([195.135.220.15]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdudt-00070I-R1; Wed, 27 May 2020 11:54:43 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id C5C3EACB8; Wed, 27 May 2020 11:54:42 +0000 (UTC) From: Nicolas Saenz Julienne To: bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [RFC 29/50] staging: vchiq: Export vchiq_get_service_userdata() Date: Wed, 27 May 2020 13:53:34 +0200 Message-Id: <20200527115400.31391-30-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527115400.31391-1-nsaenzjulienne@suse.de> References: <20200527115400.31391-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200527_045442_020635_A605E47D X-CRM114-Status: UNSURE ( 9.45 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -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] 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [195.135.220.15 listed in wl.mailspike.net] -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, laurent.pinchart@ideasonboard.com, Nicolas Saenz Julienne , gregkh@linuxfoundation.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org This is for service's callbacks to get their private data. Signed-off-by: Nicolas Saenz Julienne --- drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c | 1 + 1 file changed, 1 insertion(+) 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 5b55d32e62a0..01a9331dbff4 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c @@ -332,6 +332,7 @@ vchiq_get_service_userdata(unsigned int handle) rcu_read_unlock(); return userdata; } +EXPORT_SYMBOL(vchiq_get_service_userdata); static void mark_service_closing_internal(struct vchiq_service *service, int sh_thread) From patchwork Wed May 27 11:53:35 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: 11572733 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 582FE90 for ; Wed, 27 May 2020 12:06:44 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 2221F20657 for ; Wed, 27 May 2020 12:06:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="F22SNZme" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2221F20657 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=bombadil.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=NaxAISowfgNnvEgrFHEUH7Qnahd6jII6bFzAeRbX4Y8=; b=F22SNZme7vG89g +kpXhoeKYILNFtX5nNp9iWE2BQorSMhlNCzxieAo7cjLNvhG+yceVrUSXxddxOsUMFb5Vlf7BqKrB IZlwOaEv7Qo6Fys70C7Gl9LL/kxKLSgDkj7vKI1+VvvogW50fy6jMfMQdx7P2UXk1vncLCyedLkiG Q2dLHsrQUjWw39lJdFOSTWFEBlT7qn6n6feSTJN87MOW5Na2oVsi/LB365uI7HPTXoIwytXtqmz0l ovvAcOwguTGWzwMHfQGzhIAjkzq3wqPhRNBtsOGrVS7pTB7B58D1KIaohSz7Aehk5WN4jFpNe/GnM XE0njIoYG2Cmdc3/KeUQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdupP-0006Wx-Ea; Wed, 27 May 2020 12:06:35 +0000 Received: from mx2.suse.de ([195.135.220.15]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdudu-00070i-EV; Wed, 27 May 2020 11:54:44 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 89954ACF2; Wed, 27 May 2020 11:54:43 +0000 (UTC) From: Nicolas Saenz Julienne To: bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [RFC 30/50] staging: vchiq: Export vchiq_msg_queue_push Date: Wed, 27 May 2020 13:53:35 +0200 Message-Id: <20200527115400.31391-31-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527115400.31391-1-nsaenzjulienne@suse.de> References: <20200527115400.31391-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200527_045442_638107_ED080544 X-CRM114-Status: UNSURE ( 9.34 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -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] 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [195.135.220.15 listed in wl.mailspike.net] -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, laurent.pinchart@ideasonboard.com, Nicolas Saenz Julienne , gregkh@linuxfoundation.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org vchiq consumer drivers may need to use this function in order to get the benefits of vchiq's per service message queueing mechanism. Signed-off-by: Nicolas Saenz Julienne --- drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h | 1 + 1 file changed, 1 insertion(+) 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 8fd51d885a18..c99caa3add57 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h @@ -107,6 +107,7 @@ 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 void vchiq_msg_queue_push(unsigned handle, struct vchiq_header *header); extern void vchiq_release_message(unsigned int service, struct vchiq_header *header); extern enum vchiq_status vchiq_bulk_transmit(unsigned int service, From patchwork Wed May 27 11:53:36 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: 11572737 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 00AE8159A for ; Wed, 27 May 2020 12:07:23 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id C298D207CB for ; Wed, 27 May 2020 12:07:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="mLdKkK5C" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C298D207CB 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=bombadil.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=16KdFg6ZGHCz/cQWKsVyC0Ld6kLqtojXJICAt5SlyOA=; b=mLdKkK5CwrbI99 5tU9/oIUI+hWIfGpUVxMXu+bUZc/koC68KA9o7ICF0xdseynEl8soTjUI/2lUeWfcw1rH7B+rTVr8 h9gaTIiJbpnu9a5beWPZy4lxu5MR0ETpLd+KcthAvZXOVhnoUGa6IKkWAeZJLSSpYSuNO0ZDxNft8 xkJJD90PW2djQIYYZrQi8ml14UHXFKU37/TqmV+/n44DrUoKPuo61wYLHJpXMC2ZBfIBAotmkAuhD YZ60lGEFBPEYyREFnmXWsQRp6hpPekXVV30L/DOo0487OkiZDW6cTzEc6fGrBiMS9/SOxmVFVPcKI IvCd/c0OfaAxnO6oLCxA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jduqA-0007CP-6V; Wed, 27 May 2020 12:07:22 +0000 Received: from mx2.suse.de ([195.135.220.15]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdudw-00072z-To; Wed, 27 May 2020 11:54:50 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id E67F8AD17; Wed, 27 May 2020 11:54:45 +0000 (UTC) From: Nicolas Saenz Julienne To: bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Florian Fainelli , Ray Jui , Scott Branden , Nicolas Saenz Julienne Subject: [RFC 31/50] staging: vchi: Get rid of vchiq_shim's message callback Date: Wed, 27 May 2020 13:53:36 +0200 Message-Id: <20200527115400.31391-32-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527115400.31391-1-nsaenzjulienne@suse.de> References: <20200527115400.31391-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200527_045445_270273_D62814A8 X-CRM114-Status: GOOD ( 20.69 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -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] 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [195.135.220.15 listed in wl.mailspike.net] -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, laurent.pinchart@ideasonboard.com, linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org As vchiq_shim's callback does nothing aside from pushing messages into the service's queue, let's bypass it and jump directly to the service's callbacks, letting them choose whether to use the message queue. It turns out most services don't need to use the message queue, which makes for simpler code in the end. Signed-off-by: Nicolas Saenz Julienne --- .../bcm2835-audio/bcm2835-vchiq.c | 20 ++--- .../vc04_services/interface/vchi/vchi.h | 9 +- .../interface/vchi/vchi_common.h | 12 --- .../interface/vchiq_arm/vchiq_shim.c | 42 ++-------- .../vc04_services/vc-sm-cma/vc_sm_cma_vchi.c | 17 ++-- .../vc04_services/vchiq-mmal/mmal-vchiq.c | 83 +++++++++---------- 6 files changed, 69 insertions(+), 114 deletions(-) delete mode 100644 drivers/staging/vc04_services/interface/vchi/vchi_common.h diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c index 0f97eda4ec90..71750ef891dd 100644 --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c @@ -89,22 +89,17 @@ static int bcm2835_audio_send_simple(struct bcm2835_audio_instance *instance, return bcm2835_audio_send_msg(instance, &m, wait); } -static void audio_vchi_callback(void *param, const enum vchiq_reason reason, - void *msg_handle) +static enum vchiq_status audio_vchi_callback(enum vchiq_reason reason, + struct vchiq_header *header, + unsigned handle, void *userdata) { - struct bcm2835_audio_instance *instance = param; - struct vchi_held_msg handle; + struct bcm2835_audio_instance *instance = vchiq_get_service_userdata(handle); struct vc_audio_msg *m; - unsigned size; - int status; if (reason != VCHIQ_MESSAGE_AVAILABLE) - return; - - status = vchi_msg_hold(instance->service, (void **)&m, &size, &handle); - if (status) - return; + return VCHIQ_SUCCESS; + m = (void *)header->data; if (m->type == VC_AUDIO_MSG_TYPE_RESULT) { instance->result = m->result.success; complete(&instance->msg_avail_comp); @@ -119,7 +114,8 @@ static void audio_vchi_callback(void *param, const enum vchiq_reason reason, dev_err(instance->dev, "unexpected callback type=%d\n", m->type); } - vchi_held_msg_release(&handle); + vchiq_release_message(handle, header); + return VCHIQ_SUCCESS; } static int diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h b/drivers/staging/vc04_services/interface/vchi/vchi.h index 789acb7999d1..fdc243f3f60a 100644 --- a/drivers/staging/vc04_services/interface/vchi/vchi.h +++ b/drivers/staging/vc04_services/interface/vchi/vchi.h @@ -4,8 +4,6 @@ #ifndef VCHI_H_ #define VCHI_H_ -#include "vchi_common.h" - /****************************************************************************** * Global defs *****************************************************************************/ @@ -31,16 +29,13 @@ struct vchi_held_msg { struct vchi_service { unsigned int handle; - - vchi_callback callback; - void *callback_param; }; // structure used to provide the information needed to open a server or a client struct service_creation { struct vchi_version version; int32_t service_id; - vchi_callback callback; + vchiq_callback callback; void *callback_param; }; @@ -88,7 +83,7 @@ extern int vchi_queue_kernel_message(struct vchi_service *service, void *data, // 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. -extern int32_t vchi_msg_hold(struct vchi_service *service, +extern int32_t vchi_msg_hold(unsigned handle, void **data, // } may be NULL, as info can be uint32_t *msg_size, // } obtained from HELD_MSG_T struct vchi_held_msg *message_descriptor); diff --git a/drivers/staging/vc04_services/interface/vchi/vchi_common.h b/drivers/staging/vc04_services/interface/vchi/vchi_common.h deleted file mode 100644 index 24e8665e214a..000000000000 --- a/drivers/staging/vc04_services/interface/vchi/vchi_common.h +++ /dev/null @@ -1,12 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ -/* Copyright (c) 2010-2012 Broadcom. All rights reserved. */ - -#ifndef VCHI_COMMON_H_ -#define VCHI_COMMON_H_ - -//Callback used by all services / bulk transfers -typedef void (*vchi_callback)(void *callback_param, //my service local param - enum vchiq_reason reason, - void *handle); //for transmitting msg's only - -#endif // VCHI_COMMON_H_ 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 843ee978928f..e6773cd51b44 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c @@ -158,12 +158,12 @@ EXPORT_SYMBOL(vchi_held_msg_release); * Returns: int32_t - success == 0 * ***********************************************************/ -int32_t vchi_msg_hold(struct vchi_service *service, void **data, - uint32_t *msg_size, struct vchi_held_msg *message_handle) +int32_t vchi_msg_hold(unsigned handle, void **data, uint32_t *msg_size, + struct vchi_held_msg *message_handle) { struct vchiq_header *header; - header = vchiq_msg_hold(service->handle); + header = vchiq_msg_hold(handle); if (!header) return -ENOENT; @@ -179,7 +179,7 @@ int32_t vchi_msg_hold(struct vchi_service *service, void **data, */ message_handle->service = - (struct opaque_vchi_service_t *)(long)service->handle; + (struct opaque_vchi_service_t *)(long)handle; message_handle->message = header; return 0; @@ -253,33 +253,9 @@ EXPORT_SYMBOL(vchi_disconnect); * ***********************************************************/ -static enum vchiq_status shim_callback(enum vchiq_reason reason, - struct vchiq_header *header, - unsigned int handle, - void *bulk_user) +static struct vchi_service *service_alloc(void) { - struct vchi_service *service = - (struct vchi_service *)VCHIQ_GET_SERVICE_USERDATA(handle); - - if (reason == VCHIQ_MESSAGE_AVAILABLE) - vchiq_msg_queue_push(service->handle, header); - - service->callback(service->callback_param, reason, bulk_user); - - return VCHIQ_SUCCESS; -} - -static struct vchi_service *service_alloc(struct vchiq_instance *instance, - struct service_creation *setup) -{ - struct vchi_service *service = kzalloc(sizeof(struct vchi_service), GFP_KERNEL); - - if (service) { - service->callback = setup->callback; - service->callback_param = setup->callback_param; - } - - return service; + return kzalloc(sizeof(struct vchi_service), GFP_KERNEL); } static void service_free(struct vchi_service *service) @@ -293,15 +269,15 @@ int32_t vchi_service_open(struct vchiq_instance *instance, struct vchi_service **service) { - *service = service_alloc(instance, setup); + *service = service_alloc(); if (service) { struct vchiq_service_params params; enum vchiq_status status; memset(¶ms, 0, sizeof(params)); params.fourcc = setup->service_id; - params.callback = shim_callback; - params.userdata = *service; + params.callback = setup->callback; + params.userdata = setup->callback_param; params.version = setup->version.version; params.version_min = setup->version.version_min; diff --git a/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c b/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c index 7efe42d51e46..5088f72f57c9 100644 --- a/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c +++ b/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c @@ -237,8 +237,8 @@ static int vc_sm_cma_vchi_videocore_io(void *arg) } while (1); - while (!vchi_msg_hold(instance->service, (void **)&reply, - &reply_len, &msg)) { + while (!vchi_msg_hold(instance->service->handle, + (void **)&reply, &reply_len, &msg)) { if (reply->trans_id & 0x80000000) { /* Async event or cmd from the VPU */ if (instance->vpu_event) @@ -265,15 +265,16 @@ static int vc_sm_cma_vchi_videocore_io(void *arg) return 0; } -static void vc_sm_cma_vchi_callback(void *param, const enum vchiq_reason reason, - void *msg_handle) +static enum vchiq_status vc_sm_cma_vchi_callback(enum vchiq_reason reason, + struct vchiq_header *header, + unsigned handle, + void *user_data) { - struct sm_instance *instance = param; - - (void)msg_handle; + struct sm_instance *instance = vchiq_get_service_userdata(handle); switch (reason) { case VCHIQ_MESSAGE_AVAILABLE: + vchiq_msg_queue_push(handle, header); complete(&instance->io_cmplt); break; @@ -282,6 +283,8 @@ static void vc_sm_cma_vchi_callback(void *param, const enum vchiq_reason reason, default: break; } + + return VCHIQ_SUCCESS; } struct sm_instance *vc_sm_cma_vchi_init(struct vchiq_instance *vchiq_instance, diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c index 258cfab7d397..3207d0612515 100644 --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c @@ -157,7 +157,7 @@ struct mmal_msg_context { struct { /* message handle to release */ - struct vchi_held_msg msg_handle; + struct vchiq_header *msg_handle; /* pointer to received message */ struct mmal_msg *msg; /* received message length */ @@ -674,54 +674,49 @@ static void bulk_abort_cb(struct vchiq_mmal_instance *instance, } /* incoming event service callback */ -static void service_callback(void *param, const enum vchiq_reason reason, - void *bulk_ctx) +static enum vchiq_status service_callback(enum vchiq_reason reason, + struct vchiq_header *header, + unsigned handle, void *bulk_ctx) { - struct vchiq_mmal_instance *instance = param; - int status; + struct vchiq_mmal_instance *instance = vchiq_get_service_userdata(handle); u32 msg_len; struct mmal_msg *msg; - struct vchi_held_msg msg_handle; struct mmal_msg_context *msg_context; if (!instance) { pr_err("Message callback passed NULL instance\n"); - return; + return VCHIQ_SUCCESS; } switch (reason) { case VCHIQ_MESSAGE_AVAILABLE: - status = vchi_msg_hold(instance->service, (void **)&msg, - &msg_len, &msg_handle); - if (status) { - pr_err("Unable to dequeue a message (%d)\n", status); - break; - } + msg = (void *)header->data; + msg_len = header->size; DBG_DUMP_MSG(msg, msg_len, "<<< reply message"); /* handling is different for buffer messages */ switch (msg->h.type) { case MMAL_MSG_TYPE_BUFFER_FROM_HOST: - vchi_held_msg_release(&msg_handle); + vchiq_release_message(handle, header); break; case MMAL_MSG_TYPE_EVENT_TO_HOST: event_to_host_cb(instance, msg, msg_len); - vchi_held_msg_release(&msg_handle); + vchiq_release_message(handle, header); break; case MMAL_MSG_TYPE_BUFFER_TO_HOST: buffer_to_host_cb(instance, msg, msg_len); - vchi_held_msg_release(&msg_handle); + vchiq_release_message(handle, header); break; default: /* messages dependent on header context to complete */ if (!msg->h.context) { pr_err("received message context was null!\n"); - vchi_held_msg_release(&msg_handle); + vchiq_release_message(handle, header); break; } @@ -730,12 +725,12 @@ static void service_callback(void *param, const enum vchiq_reason reason, if (!msg_context) { pr_err("received invalid message context %u!\n", msg->h.context); - vchi_held_msg_release(&msg_handle); + vchiq_release_message(handle, header); break; } /* fill in context values */ - msg_context->u.sync.msg_handle = msg_handle; + msg_context->u.sync.msg_handle = header; msg_context->u.sync.msg = msg; msg_context->u.sync.msg_len = msg_len; @@ -773,13 +768,15 @@ static void service_callback(void *param, const enum vchiq_reason reason, pr_err("Received unhandled message reason %d\n", reason); break; } + + return VCHIQ_SUCCESS; } static int send_synchronous_mmal_msg(struct vchiq_mmal_instance *instance, struct mmal_msg *msg, unsigned int payload_len, struct mmal_msg **msg_out, - struct vchi_held_msg *msg_handle_out) + struct vchiq_header **msg_handle) { struct mmal_msg_context *msg_context; int ret; @@ -833,7 +830,7 @@ static int send_synchronous_mmal_msg(struct vchiq_mmal_instance *instance, } *msg_out = msg_context->u.sync.msg; - *msg_handle_out = msg_context->u.sync.msg_handle; + *msg_handle = msg_context->u.sync.msg_handle; release_msg_context(msg_context); return 0; @@ -905,7 +902,7 @@ static int port_info_set(struct vchiq_mmal_instance *instance, int ret; struct mmal_msg m; struct mmal_msg *rmsg; - struct vchi_held_msg rmsg_handle; + struct vchiq_header *rmsg_handle; pr_debug("setting port info port %p\n", port); if (!port) @@ -954,7 +951,7 @@ static int port_info_set(struct vchiq_mmal_instance *instance, port->component->handle, port->handle); release_msg: - vchi_held_msg_release(&rmsg_handle); + vchiq_release_message(instance->service->handle, rmsg_handle); return ret; } @@ -966,7 +963,7 @@ static int port_info_get(struct vchiq_mmal_instance *instance, int ret; struct mmal_msg m; struct mmal_msg *rmsg; - struct vchi_held_msg rmsg_handle; + struct vchiq_header *rmsg_handle; /* port info time */ m.h.type = MMAL_MSG_TYPE_PORT_INFO_GET; @@ -1049,7 +1046,7 @@ static int port_info_get(struct vchiq_mmal_instance *instance, pr_debug("%s:result:%d component:0x%x port:%d\n", __func__, ret, port->component->handle, port->handle); - vchi_held_msg_release(&rmsg_handle); + vchiq_release_message(instance->service->handle, rmsg_handle); return ret; } @@ -1062,7 +1059,7 @@ static int create_component(struct vchiq_mmal_instance *instance, int ret; struct mmal_msg m; struct mmal_msg *rmsg; - struct vchi_held_msg rmsg_handle; + struct vchiq_header *rmsg_handle; /* build component create message */ m.h.type = MMAL_MSG_TYPE_COMPONENT_CREATE; @@ -1097,7 +1094,7 @@ static int create_component(struct vchiq_mmal_instance *instance, component->inputs, component->outputs, component->clocks); release_msg: - vchi_held_msg_release(&rmsg_handle); + vchiq_release_message(instance->service->handle, rmsg_handle); return ret; } @@ -1109,7 +1106,7 @@ static int destroy_component(struct vchiq_mmal_instance *instance, int ret; struct mmal_msg m; struct mmal_msg *rmsg; - struct vchi_held_msg rmsg_handle; + struct vchiq_header *rmsg_handle; m.h.type = MMAL_MSG_TYPE_COMPONENT_DESTROY; m.u.component_destroy.component_handle = component->handle; @@ -1130,7 +1127,7 @@ static int destroy_component(struct vchiq_mmal_instance *instance, release_msg: - vchi_held_msg_release(&rmsg_handle); + vchiq_release_message(instance->service->handle, rmsg_handle); return ret; } @@ -1142,7 +1139,7 @@ static int enable_component(struct vchiq_mmal_instance *instance, int ret; struct mmal_msg m; struct mmal_msg *rmsg; - struct vchi_held_msg rmsg_handle; + struct vchiq_header *rmsg_handle; m.h.type = MMAL_MSG_TYPE_COMPONENT_ENABLE; m.u.component_enable.component_handle = component->handle; @@ -1162,7 +1159,7 @@ static int enable_component(struct vchiq_mmal_instance *instance, ret = -rmsg->u.component_enable_reply.status; release_msg: - vchi_held_msg_release(&rmsg_handle); + vchiq_release_message(instance->service->handle, rmsg_handle); return ret; } @@ -1174,7 +1171,7 @@ static int disable_component(struct vchiq_mmal_instance *instance, int ret; struct mmal_msg m; struct mmal_msg *rmsg; - struct vchi_held_msg rmsg_handle; + struct vchiq_header *rmsg_handle; m.h.type = MMAL_MSG_TYPE_COMPONENT_DISABLE; m.u.component_disable.component_handle = component->handle; @@ -1195,7 +1192,7 @@ static int disable_component(struct vchiq_mmal_instance *instance, release_msg: - vchi_held_msg_release(&rmsg_handle); + vchiq_release_message(instance->service->handle, rmsg_handle); return ret; } @@ -1207,7 +1204,7 @@ static int get_version(struct vchiq_mmal_instance *instance, int ret; struct mmal_msg m; struct mmal_msg *rmsg; - struct vchi_held_msg rmsg_handle; + struct vchiq_header *rmsg_handle; m.h.type = MMAL_MSG_TYPE_GET_VERSION; @@ -1227,7 +1224,7 @@ static int get_version(struct vchiq_mmal_instance *instance, *minor_out = rmsg->u.version.minor; release_msg: - vchi_held_msg_release(&rmsg_handle); + vchiq_release_message(instance->service->handle, rmsg_handle); return ret; } @@ -1240,7 +1237,7 @@ static int port_action_port(struct vchiq_mmal_instance *instance, int ret; struct mmal_msg m; struct mmal_msg *rmsg; - struct vchi_held_msg rmsg_handle; + struct vchiq_header *rmsg_handle; m.h.type = MMAL_MSG_TYPE_PORT_ACTION; m.u.port_action_port.component_handle = port->component->handle; @@ -1269,7 +1266,7 @@ static int port_action_port(struct vchiq_mmal_instance *instance, port_action_type_names[action_type], action_type); release_msg: - vchi_held_msg_release(&rmsg_handle); + vchiq_release_message(instance->service->handle, rmsg_handle); return ret; } @@ -1284,7 +1281,7 @@ static int port_action_handle(struct vchiq_mmal_instance *instance, int ret; struct mmal_msg m; struct mmal_msg *rmsg; - struct vchi_held_msg rmsg_handle; + struct vchiq_header *rmsg_handle; m.h.type = MMAL_MSG_TYPE_PORT_ACTION; @@ -1317,7 +1314,7 @@ static int port_action_handle(struct vchiq_mmal_instance *instance, action_type, connect_component_handle, connect_port_handle); release_msg: - vchi_held_msg_release(&rmsg_handle); + vchiq_release_message(instance->service->handle, rmsg_handle); return ret; } @@ -1329,7 +1326,7 @@ static int port_parameter_set(struct vchiq_mmal_instance *instance, int ret; struct mmal_msg m; struct mmal_msg *rmsg; - struct vchi_held_msg rmsg_handle; + struct vchiq_header *rmsg_handle; m.h.type = MMAL_MSG_TYPE_PORT_PARAMETER_SET; @@ -1358,7 +1355,7 @@ static int port_parameter_set(struct vchiq_mmal_instance *instance, ret, port->component->handle, port->handle, parameter_id); release_msg: - vchi_held_msg_release(&rmsg_handle); + vchiq_release_message(instance->service->handle, rmsg_handle); return ret; } @@ -1370,7 +1367,7 @@ static int port_parameter_get(struct vchiq_mmal_instance *instance, int ret; struct mmal_msg m; struct mmal_msg *rmsg; - struct vchi_held_msg rmsg_handle; + struct vchiq_header *rmsg_handle; m.h.type = MMAL_MSG_TYPE_PORT_PARAMETER_GET; @@ -1417,7 +1414,7 @@ static int port_parameter_get(struct vchiq_mmal_instance *instance, ret, port->component->handle, port->handle, parameter_id); release_msg: - vchi_held_msg_release(&rmsg_handle); + vchiq_release_message(instance->service->handle, rmsg_handle); return ret; } From patchwork Wed May 27 11:53:37 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: 11572743 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 E8605159A for ; Wed, 27 May 2020 12:07:52 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id C4D3120657 for ; Wed, 27 May 2020 12:07:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="RsFUCqwB" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C4D3120657 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=bombadil.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=0B87FqIwKJGiEaw94fY8Y8mliS2i/wiPPI5gXam8IS8=; b=RsFUCqwBwGzGAh dAxZBZBMn3em80+N9EMVECyLP1i5/02JilW+81eBE6PUjxgwvwNoPzooJppANzMr+QFDhsiSolMdn 5hyrMaZipuh/l5gCV48uAIyy0L/cyLsYTnhvJxE3KonGEFpoYezNz4enVAkrhhfrsUhTxm+vOah0w Q5tpZM7EYVPdUQoOZE53VC12rrnp+wlSS9xiyzBS2xcMWFF7v1XSv08agROP8KUm/j50Wle+5lgEV IUKZIbF5p/gCZlAwsTeHidQVx+/LOtIt5jS94FALoY/3HNqDCb9siRk2Yco5cDElKg5by9kJ4hUmR Or3U9X2PmfJcZVrHYBUw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jduqZ-0007cL-F7; Wed, 27 May 2020 12:07:47 +0000 Received: from mx2.suse.de ([195.135.220.15]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdudy-00073K-6y; Wed, 27 May 2020 11:54:49 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id A4713AB7D; Wed, 27 May 2020 11:54:46 +0000 (UTC) From: Nicolas Saenz Julienne To: bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [RFC 32/50] staging: vchiq: Don't use a typedef for vchiq_callback Date: Wed, 27 May 2020 13:53:37 +0200 Message-Id: <20200527115400.31391-33-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527115400.31391-1-nsaenzjulienne@suse.de> References: <20200527115400.31391-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200527_045446_442071_3E24D5C0 X-CRM114-Status: GOOD ( 10.60 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -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] 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [195.135.220.15 listed in wl.mailspike.net] -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, laurent.pinchart@ideasonboard.com, Nicolas Saenz Julienne , gregkh@linuxfoundation.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Linux coding style says to avoid typdefs. Signed-off-by: Nicolas Saenz Julienne --- .../staging/vc04_services/interface/vchi/vchi.h | 5 ++++- .../vc04_services/interface/vchiq_arm/vchiq_if.h | 14 ++++++++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h b/drivers/staging/vc04_services/interface/vchi/vchi.h index fdc243f3f60a..cb66ea1ffad2 100644 --- a/drivers/staging/vc04_services/interface/vchi/vchi.h +++ b/drivers/staging/vc04_services/interface/vchi/vchi.h @@ -35,7 +35,10 @@ struct vchi_service { struct service_creation { struct vchi_version version; int32_t service_id; - vchiq_callback callback; + enum vchiq_status (*callback)(enum vchiq_reason reason, + struct vchiq_header *header, + unsigned int handle, + void *bulk_userdata); void *callback_param; }; 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 c99caa3add57..b3d4c14536bd 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h @@ -60,19 +60,21 @@ struct vchiq_element { unsigned int size; }; -typedef enum vchiq_status (*vchiq_callback)(enum vchiq_reason, - struct vchiq_header *, - unsigned int, void *); - struct vchiq_service_base { int fourcc; - vchiq_callback callback; + enum vchiq_status (*callback)(enum vchiq_reason reason, + struct vchiq_header *header, + unsigned int handle, + void *bulk_userdata); void *userdata; }; struct vchiq_service_params { int fourcc; - vchiq_callback callback; + enum vchiq_status (*callback)(enum vchiq_reason reason, + struct vchiq_header *header, + unsigned int handle, + void *bulk_userdata); void *userdata; short version; /* Increment for non-trivial changes */ short version_min; /* Update for incompatible changes */ From patchwork Wed May 27 11:53:38 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: 11572753 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 4541390 for ; Wed, 27 May 2020 12:08:16 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 07F0A207CB for ; Wed, 27 May 2020 12:08:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="gKtGoQaQ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 07F0A207CB 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=bombadil.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=p8nX0SaWYkAdSckEIReODcId5lp+/rsr95RQsHtAqFA=; b=gKtGoQaQHW0hEt hwL/+KIbx2alSueVL9wLPaTU/lgN7Wpnaq9H95qyrl1rUgctMxr1YTG16NFM+yhqYZwi1/O+7mnXY Vdz9dnJcK/Rqmf6K658W8UeM4IVIqtM3MXKM2VV8GvoGTz7Ypl1DhDP44ShLBu1hdtg2pNlnlx8kV uVhUo0EFeQATMchVCMMv+/RqxSgBocdq2P1sNu25QAqemzJh6MqmEhOGWAFEXj2FChixLW7iG270U OvM8KG/XjhCJHnwCXXkVcH37brwtIX/73U5Ch+HZFsO4CmAFnvsePYtY3Z85xRAwuN5WCkIfFoDsY EK44AA6ocvOX3I0bd0JQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jduqt-0007sD-D4; Wed, 27 May 2020 12:08:07 +0000 Received: from mx2.suse.de ([195.135.220.15]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdudz-00074S-5o; Wed, 27 May 2020 11:54:51 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id C13CEAC91; Wed, 27 May 2020 11:54:47 +0000 (UTC) From: Nicolas Saenz Julienne To: bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Florian Fainelli , Ray Jui , Scott Branden , Nicolas Saenz Julienne Subject: [RFC 33/50] staging: vchi: Use struct vchiq_service_params Date: Wed, 27 May 2020 13:53:38 +0200 Message-Id: <20200527115400.31391-34-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527115400.31391-1-nsaenzjulienne@suse.de> References: <20200527115400.31391-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200527_045447_532713_7D2D7039 X-CRM114-Status: GOOD ( 15.56 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -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] 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [195.135.220.15 listed in wl.mailspike.net] -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, laurent.pinchart@ideasonboard.com, linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org For initialization, vchi has its own params structure, which is then translated to vchiq's params structure. They are essentially the same, so lets directly use vchiq's. Signed-off-by: Nicolas Saenz Julienne --- .../bcm2835-audio/bcm2835-vchiq.c | 9 +++++---- .../vc04_services/interface/vchi/vchi.h | 19 +------------------ .../interface/vchiq_arm/vchiq_shim.c | 12 ++---------- .../vc04_services/vc-sm-cma/vc_sm_cma_vchi.c | 11 ++++++----- .../vc04_services/vchiq-mmal/mmal-vchiq.c | 11 ++++++----- 5 files changed, 20 insertions(+), 42 deletions(-) diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c index 71750ef891dd..c1537a41a2fe 100644 --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c @@ -122,11 +122,12 @@ static int vc_vchi_audio_init(struct vchiq_instance *vchiq_instance, struct bcm2835_audio_instance *instance) { - struct service_creation params = { - .version = VCHI_VERSION_EX(VC_AUDIOSERV_VER, VC_AUDIOSERV_MIN_VER), - .service_id = VC_AUDIO_SERVER_NAME, + struct vchiq_service_params params = { + .version = VC_AUDIOSERV_VER, + .version_min = VC_AUDIOSERV_MIN_VER, + .fourcc = VC_AUDIO_SERVER_NAME, .callback = audio_vchi_callback, - .callback_param = instance, + .userdata = instance, }; int status; diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h b/drivers/staging/vc04_services/interface/vchi/vchi.h index cb66ea1ffad2..4afa6e9f57c4 100644 --- a/drivers/staging/vc04_services/interface/vchi/vchi.h +++ b/drivers/staging/vc04_services/interface/vchi/vchi.h @@ -8,12 +8,6 @@ * Global defs *****************************************************************************/ -struct vchi_version { - uint32_t version; - uint32_t version_min; -}; -#define VCHI_VERSION_EX(v_, m_) { v_, m_ } - // Macros to manipulate 'FOURCC' values #define MAKE_FOURCC(x) ((int32_t)((x[0] << 24) | (x[1] << 16) | (x[2] << 8) | x[3])) @@ -31,17 +25,6 @@ struct vchi_service { unsigned int handle; }; -// structure used to provide the information needed to open a server or a client -struct service_creation { - struct vchi_version version; - int32_t service_id; - enum vchiq_status (*callback)(enum vchiq_reason reason, - struct vchiq_header *header, - unsigned int handle, - void *bulk_userdata); - void *callback_param; -}; - // Opaque handle for a VCHIQ instance struct vchiq_instance; @@ -64,7 +47,7 @@ extern int32_t vchi_disconnect(struct vchiq_instance *instance); *****************************************************************************/ // Routine to open a named service extern int32_t vchi_service_open(struct vchiq_instance *instance, - struct service_creation *setup, + struct vchiq_service_params *setup, struct vchi_service **service); extern int32_t vchi_get_peer_version(struct vchi_service *service, 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 e6773cd51b44..e76399e083f6 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c @@ -265,23 +265,15 @@ static void service_free(struct vchi_service *service) } int32_t vchi_service_open(struct vchiq_instance *instance, - struct service_creation *setup, + struct vchiq_service_params *params, struct vchi_service **service) { *service = service_alloc(); if (service) { - struct vchiq_service_params params; enum vchiq_status status; - memset(¶ms, 0, sizeof(params)); - params.fourcc = setup->service_id; - params.callback = setup->callback; - params.userdata = setup->callback_param; - params.version = setup->version.version; - params.version_min = setup->version.version_min; - - status = vchiq_open_service(instance, ¶ms, + status = vchiq_open_service(instance, params, &((*service)->handle)); if (status != VCHIQ_SUCCESS) { service_free(*service); diff --git a/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c b/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c index 5088f72f57c9..a37607d07335 100644 --- a/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c +++ b/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c @@ -290,11 +290,12 @@ static enum vchiq_status vc_sm_cma_vchi_callback(enum vchiq_reason reason, struct sm_instance *vc_sm_cma_vchi_init(struct vchiq_instance *vchiq_instance, vpu_event_cb vpu_event) { - struct service_creation params = { - .version = VCHI_VERSION_EX(VC_SM_VER, VC_SM_MIN_VER), - .service_id = VC_SM_SERVER_NAME, + struct vchiq_service_params params = { + .version = VC_SM_VER, + .version_min = VC_SM_MIN_VER, + .fourcc = VC_SM_SERVER_NAME, .callback = vc_sm_cma_vchi_callback, - .callback_param = NULL, + .userdata = NULL, }; struct sm_instance *instance; int status; @@ -318,7 +319,7 @@ struct sm_instance *vc_sm_cma_vchi_init(struct vchiq_instance *vchiq_instance, init_completion(&instance->free_blk[i].cmplt); list_add(&instance->free_blk[i].head, &instance->free_list); } - params.callback_param = instance; + params.userdata = instance; /* Open the VCHI service connections */ status = vchi_service_open(vchiq_instance, ¶ms, &instance->service); diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c index 3207d0612515..a3ad8aa8b8cc 100644 --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c @@ -2094,11 +2094,12 @@ int vchiq_mmal_init(struct vchiq_mmal_instance **out_instance) int status; struct vchiq_mmal_instance *instance; static struct vchiq_instance *vchiq_instance; - struct service_creation params = { - .version = VCHI_VERSION_EX(VC_MMAL_VER, VC_MMAL_MIN_VER), - .service_id = VC_MMAL_SERVER_NAME, + struct vchiq_service_params params = { + .version = VC_MMAL_VER, + .version_min = VC_MMAL_MIN_VER, + .fourcc = VC_MMAL_SERVER_NAME, .callback = service_callback, - .callback_param = NULL, + .userdata = NULL, }; /* compile time checks to ensure structure size as they are @@ -2140,7 +2141,7 @@ int vchiq_mmal_init(struct vchiq_mmal_instance **out_instance) mutex_init(&instance->context_map_lock); idr_init_base(&instance->context_map, 1); - params.callback_param = instance; + params.userdata = instance; instance->bulk_wq = alloc_ordered_workqueue("mmal-vchiq", WQ_MEM_RECLAIM); From patchwork Wed May 27 11:53:39 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: 11572773 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 14888159A for ; Wed, 27 May 2020 12:09:44 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id D446320657 for ; Wed, 27 May 2020 12:09:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="EYqZhcEc" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D446320657 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=bombadil.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=ZQkYI1n6TUnXjD0+TIcUlSyMbLNgTlzR7D0Ze10svmU=; b=EYqZhcEcZfGjo4 VkypcKE2Owe13/8NZ27i0oQgw+HRRXPXv2bU6jyZFrGFk7ER5FPou+FWDWRBVCSZdmna5HgKRaheP vHBQ63VQUtcfnYIUImKIcBljo2gUHDroTlKFyWd7bATUtPFFGWvVP2pDSHgrenZSAd5EiPgxF72Zf EOZB6osLU4lAhdOV8nwfY9kwHPJ8hlbdU7Lv/8N8D8yc/Q896wyCMckG3micMXctJ0sSQWTyrBK/B wiXZNTn5ihjwVJvd7VaGA35/NqdozyM3EVYvCkwWBfRbKRscS2WmbgBg0BDSBz/PCTZZEGizjs0Q5 +uorsJlrWS8HonF1R3Lw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdusJ-00014v-8a; Wed, 27 May 2020 12:09:35 +0000 Received: from mx2.suse.de ([195.135.220.15]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdue1-00076h-FU; Wed, 27 May 2020 11:54:56 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 19E44ACB8; Wed, 27 May 2020 11:54:50 +0000 (UTC) From: Nicolas Saenz Julienne To: bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Florian Fainelli , Ray Jui , Scott Branden , Nicolas Saenz Julienne Subject: [RFC 34/50] staging: vchi: Get rid of struct vchi_service Date: Wed, 27 May 2020 13:53:39 +0200 Message-Id: <20200527115400.31391-35-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527115400.31391-1-nsaenzjulienne@suse.de> References: <20200527115400.31391-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200527_045449_944163_2E050BC7 X-CRM114-Status: GOOD ( 19.96 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -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] 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [195.135.220.15 listed in wl.mailspike.net] -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, laurent.pinchart@ideasonboard.com, linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org The structure only contains a single parameter, which is the underlying vchiq handle. Get rid of the struct and directly pass the handle around. Signed-off-by: Nicolas Saenz Julienne --- .../bcm2835-audio/bcm2835-vchiq.c | 23 ++--- .../vc04_services/interface/vchi/vchi.h | 25 ++--- .../interface/vchiq_arm/vchiq_shim.c | 99 +++++-------------- .../vc04_services/vc-sm-cma/vc_sm_cma_vchi.c | 26 +++-- .../vc04_services/vchiq-mmal/mmal-vchiq.c | 55 ++++++----- 5 files changed, 84 insertions(+), 144 deletions(-) diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c index c1537a41a2fe..18309578e9a2 100644 --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c @@ -9,7 +9,7 @@ struct bcm2835_audio_instance { struct device *dev; - struct vchi_service *service; + unsigned service_handle; struct completion msg_avail_comp; struct mutex vchi_mutex; struct bcm2835_alsa_stream *alsa_stream; @@ -25,12 +25,12 @@ MODULE_PARM_DESC(force_bulk, "Force use of vchiq bulk for audio"); static void bcm2835_audio_lock(struct bcm2835_audio_instance *instance) { mutex_lock(&instance->vchi_mutex); - vchi_service_use(instance->service); + vchi_service_use(instance->service_handle); } static void bcm2835_audio_unlock(struct bcm2835_audio_instance *instance) { - vchi_service_release(instance->service); + vchi_service_release(instance->service_handle); mutex_unlock(&instance->vchi_mutex); } @@ -44,7 +44,7 @@ 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, + status = vchi_queue_kernel_message(instance->service_handle, m, sizeof(*m)); if (status) { dev_err(instance->dev, @@ -133,7 +133,7 @@ vc_vchi_audio_init(struct vchiq_instance *vchiq_instance, /* Open the VCHI service connections */ status = vchi_service_open(vchiq_instance, ¶ms, - &instance->service); + &instance->service_handle); if (status) { dev_err(instance->dev, @@ -143,7 +143,7 @@ vc_vchi_audio_init(struct vchiq_instance *vchiq_instance, } /* Finished with the service for now */ - vchi_service_release(instance->service); + vchi_service_release(instance->service_handle); return 0; } @@ -153,10 +153,10 @@ static void vc_vchi_audio_deinit(struct bcm2835_audio_instance *instance) int status; mutex_lock(&instance->vchi_mutex); - vchi_service_use(instance->service); + vchi_service_use(instance->service_handle); /* Close all VCHI service connections */ - status = vchi_service_close(instance->service); + status = vchi_service_close(instance->service_handle); if (status) { dev_err(instance->dev, "failed to close VCHI service connection (status=%d)\n", @@ -226,7 +226,8 @@ int bcm2835_audio_open(struct bcm2835_alsa_stream *alsa_stream) goto deinit; bcm2835_audio_lock(instance); - vchi_get_peer_version(instance->service, &instance->peer_version); + vchi_get_peer_version(instance->service_handle, + &instance->peer_version); bcm2835_audio_unlock(instance); if (instance->peer_version < 2 || force_bulk) instance->max_packet = 0; /* bulk transfer */ @@ -342,7 +343,7 @@ int bcm2835_audio_write(struct bcm2835_alsa_stream *alsa_stream, count = size; if (!instance->max_packet) { /* Send the message to the videocore */ - status = vchi_bulk_queue_transmit(instance->service, + status = vchi_bulk_queue_transmit(instance->service_handle, src, count, VCHIQ_BULK_MODE_BLOCKING, NULL); @@ -350,7 +351,7 @@ 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, + status = vchi_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 4afa6e9f57c4..74fd169e079a 100644 --- a/drivers/staging/vc04_services/interface/vchi/vchi.h +++ b/drivers/staging/vc04_services/interface/vchi/vchi.h @@ -21,10 +21,6 @@ struct vchi_held_msg { void *message; }; -struct vchi_service { - unsigned int handle; -}; - // Opaque handle for a VCHIQ instance struct vchiq_instance; @@ -46,24 +42,23 @@ extern int32_t vchi_disconnect(struct vchiq_instance *instance); * Global service API *****************************************************************************/ // Routine to open a named service -extern int32_t vchi_service_open(struct vchiq_instance *instance, - struct vchiq_service_params *setup, - struct vchi_service **service); +extern int vchi_service_open(struct vchiq_instance *instance, + struct vchiq_service_params *params, + unsigned *handle); -extern int32_t vchi_get_peer_version(struct vchi_service *service, - short *peer_version); +extern int32_t vchi_get_peer_version(unsigned handle, short *peer_version); // Routine to close a named service -extern int32_t vchi_service_close(struct vchi_service *service); +extern int32_t vchi_service_close(unsigned handle); // Routine to increment ref count on a named service -extern int32_t vchi_service_use(struct vchi_service *service); +extern int32_t vchi_service_use(unsigned handle); // Routine to decrement ref count on a named service -extern int32_t vchi_service_release(struct vchi_service *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(struct vchi_service *service, void *data, +extern int vchi_queue_kernel_message(unsigned handle, void *data, unsigned int size); // Routine to look at a message in place. @@ -87,14 +82,14 @@ extern int32_t vchi_held_msg_release(struct vchi_held_msg *message); *****************************************************************************/ // Routine to prepare interface for a transfer from the other side -extern int32_t vchi_bulk_queue_receive(struct vchi_service *service, +extern int32_t vchi_bulk_queue_receive(unsigned handle, void *data_dst, uint32_t data_size, enum vchiq_bulk_mode mode, void *transfer_handle); // Routine to queue up data ready for transfer to the other (once they have signalled they are ready) -extern int32_t vchi_bulk_queue_transmit(struct vchi_service *service, +extern int32_t vchi_bulk_queue_transmit(unsigned handle, const void *data_src, uint32_t data_size, enum vchiq_bulk_mode mode, 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 e76399e083f6..578346965da6 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c @@ -10,14 +10,12 @@ #include "vchiq.h" #include "vchiq_core.h" -int vchi_queue_kernel_message(struct vchi_service *service, void *data, - unsigned int size) +int vchi_queue_kernel_message(unsigned handle, void *data, unsigned int size) { enum vchiq_status status; while (1) { - status = vchiq_queue_kernel_message(service->handle, data, - size); + status = vchiq_queue_kernel_message(handle, data, size); /* * vchiq_queue_message() may return VCHIQ_RETRY, so we need to @@ -48,15 +46,15 @@ EXPORT_SYMBOL(vchi_queue_kernel_message); * Returns: int32_t - success == 0 * ***********************************************************/ -int32_t vchi_bulk_queue_receive(struct vchi_service *service, void *data_dst, +int32_t vchi_bulk_queue_receive(unsigned handle, void *data_dst, uint32_t data_size, enum vchiq_bulk_mode mode, void *bulk_handle) { enum vchiq_status status; while (1) { - status = vchiq_bulk_receive(service->handle, data_dst, - data_size, bulk_handle, mode); + status = vchiq_bulk_receive(handle, data_dst, data_size, + bulk_handle, mode); /* * vchiq_bulk_receive() may return VCHIQ_RETRY, so we need to * implement a retry mechanism since this function is supposed @@ -86,17 +84,15 @@ EXPORT_SYMBOL(vchi_bulk_queue_receive); * Returns: int32_t - success == 0 * ***********************************************************/ -int32_t vchi_bulk_queue_transmit(struct vchi_service *service, - const void *data_src, - uint32_t data_size, - enum vchiq_bulk_mode mode, +int32_t vchi_bulk_queue_transmit(unsigned handle, const void *data_src, + uint32_t data_size, enum vchiq_bulk_mode mode, void *bulk_handle) { enum vchiq_status status; while (1) { - status = vchiq_bulk_transmit(service->handle, data_src, - data_size, bulk_handle, mode); + status = vchiq_bulk_transmit(handle, data_src, data_size, + bulk_handle, mode); /* * vchiq_bulk_transmit() may return VCHIQ_RETRY, so we need to @@ -245,7 +241,7 @@ EXPORT_SYMBOL(vchi_disconnect); * * Arguments: struct vchiq_instance *instance * struct service_creation *setup, - * struct vchi_service **service + * unsigned *handle * * Description: Routine to open a service * @@ -253,103 +249,54 @@ EXPORT_SYMBOL(vchi_disconnect); * ***********************************************************/ -static struct vchi_service *service_alloc(void) -{ - return kzalloc(sizeof(struct vchi_service), GFP_KERNEL); -} - -static void service_free(struct vchi_service *service) -{ - if (service) - kfree(service); -} - int32_t vchi_service_open(struct vchiq_instance *instance, - struct vchiq_service_params *params, - struct vchi_service **service) + struct vchiq_service_params *params, + unsigned *handle) { - - *service = service_alloc(); - if (service) { - enum vchiq_status status; - - status = vchiq_open_service(instance, params, - &((*service)->handle)); - if (status != VCHIQ_SUCCESS) { - service_free(*service); - *service = NULL; - } - } - - return *service ? 0 : -1; + return vchiq_open_service(instance, params, handle); } EXPORT_SYMBOL(vchi_service_open); -int32_t vchi_service_close(struct vchi_service *service) +int32_t vchi_service_close(unsigned handle) { - int32_t ret = -1; - - if (service) { - enum vchiq_status status = vchiq_close_service(service->handle); - if (status == VCHIQ_SUCCESS) - service_free(service); - - ret = status; - } - return ret; + return vchiq_close_service(handle); } EXPORT_SYMBOL(vchi_service_close); -int32_t vchi_get_peer_version(struct vchi_service *service, short *peer_version) +int32_t vchi_get_peer_version(unsigned handle, short *peer_version) { - int32_t ret = -1; - - if (service) { - enum vchiq_status status; - - status = vchiq_get_peer_version(service->handle, peer_version); - ret = status; - } - return ret; + return vchiq_get_peer_version(handle, peer_version); } EXPORT_SYMBOL(vchi_get_peer_version); /*********************************************************** * Name: vchi_service_use * - * Arguments: struct vchi_service *service + * Arguments: unsigned handle * * Description: Routine to increment refcount on a service * * Returns: void * ***********************************************************/ -int32_t vchi_service_use(struct vchi_service *service) +int32_t vchi_service_use(unsigned handle) { - int32_t ret = -1; - - if (service) - ret = vchiq_use_service(service->handle); - return ret; + return vchiq_use_service(handle); } EXPORT_SYMBOL(vchi_service_use); /*********************************************************** * Name: vchi_service_release * - * Arguments: struct vchi_service *service + * Arguments: unsigned handle * * Description: Routine to decrement refcount on a service * * Returns: void * ***********************************************************/ -int32_t vchi_service_release(struct vchi_service *service) +int32_t vchi_service_release(unsigned handle) { - int32_t ret = -1; - - if (service) - ret = vchiq_release_service(service->handle); - return ret; + return vchiq_release_service(handle); } EXPORT_SYMBOL(vchi_service_release); diff --git a/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c b/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c index a37607d07335..b0339b5438aa 100644 --- a/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c +++ b/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c @@ -47,7 +47,7 @@ struct sm_cmd_rsp_blk { }; struct sm_instance { - struct vchi_service *service; + unsigned service_handle; struct task_struct *io_thread; struct completion io_cmplt; @@ -76,13 +76,9 @@ struct sm_instance { /* ---- Private Functions ------------------------------------------------ */ static int -bcm2835_vchi_msg_queue(struct vchi_service *service, - void *data, - unsigned int size) +bcm2835_vchi_msg_queue(unsigned handle, void *data, unsigned int size) { - return vchi_queue_kernel_message(service, - data, - size); + return vchi_queue_kernel_message(handle, data, size); } static struct @@ -187,13 +183,13 @@ static int vc_sm_cma_vchi_videocore_io(void *arg) while (1) { if (svc_use) - vchi_service_release(instance->service); + vchi_service_release(instance->service_handle); svc_use = 0; if (wait_for_completion_interruptible(&instance->io_cmplt)) continue; - vchi_service_use(instance->service); + vchi_service_use(instance->service_handle); svc_use = 1; do { @@ -214,7 +210,7 @@ static int vc_sm_cma_vchi_videocore_io(void *arg) /* Send the command */ status = - bcm2835_vchi_msg_queue(instance->service, + bcm2835_vchi_msg_queue(instance->service_handle, cmd->msg, cmd->length); if (status) { pr_err("%s: failed to queue message (%d)", @@ -237,7 +233,7 @@ static int vc_sm_cma_vchi_videocore_io(void *arg) } while (1); - while (!vchi_msg_hold(instance->service->handle, + while (!vchi_msg_hold(instance->service_handle, (void **)&reply, &reply_len, &msg)) { if (reply->trans_id & 0x80000000) { /* Async event or cmd from the VPU */ @@ -322,7 +318,7 @@ struct sm_instance *vc_sm_cma_vchi_init(struct vchiq_instance *vchiq_instance, params.userdata = instance; /* Open the VCHI service connections */ - status = vchi_service_open(vchiq_instance, ¶ms, &instance->service); + status = vchi_service_open(vchiq_instance, ¶ms, &instance->service_handle); if (status) { pr_err("%s: failed to open VCHI service (%d)", __func__, status); @@ -346,7 +342,7 @@ struct sm_instance *vc_sm_cma_vchi_init(struct vchiq_instance *vchiq_instance, return instance; err_close_services: - vchi_service_close(instance->service); + vchi_service_close(instance->service_handle); kfree(instance); pr_debug("%s: FAILED", __func__); return NULL; @@ -368,8 +364,8 @@ int vc_sm_cma_vchi_stop(struct sm_instance **handle) instance = *handle; - vchi_service_use(instance->service); - vchi_service_close(instance->service); + vchi_service_use(instance->service_handle); + vchi_service_close(instance->service_handle); kfree(instance); diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c index a3ad8aa8b8cc..3707212d8e7e 100644 --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c @@ -170,7 +170,7 @@ struct mmal_msg_context { }; struct vchiq_mmal_instance { - struct vchi_service *service; + unsigned service_handle; /* ensure serialised access to service */ struct mutex vchiq_mutex; @@ -292,8 +292,8 @@ static void buffer_to_host_work_cb(struct work_struct *work) /* Dummy receive to ensure the buffers remain in order */ len = 8; /* queue the bulk submission */ - vchi_service_use(instance->service); - ret = vchi_bulk_queue_receive(instance->service, + vchi_service_use(instance->service_handle); + ret = vchi_bulk_queue_receive(instance->service_handle, msg_context->u.bulk.buffer->buffer, /* Actual receive needs to be a multiple * of 4 bytes @@ -302,7 +302,7 @@ static void buffer_to_host_work_cb(struct work_struct *work) VCHIQ_BULK_MODE_CALLBACK, msg_context); - vchi_service_release(instance->service); + vchi_service_release(instance->service_handle); if (ret != 0) pr_err("%s: ctx: %p, vchi_bulk_queue_receive failed %d\n", @@ -382,7 +382,7 @@ buffer_from_host(struct vchiq_mmal_instance *instance, if (!port->enabled) return -EINVAL; - pr_debug("instance:%p buffer:%p\n", instance->service, buf); + pr_debug("instance:%u buffer:%p\n", instance->service_handle, buf); /* get context */ if (!buf->msg_context) { @@ -450,14 +450,14 @@ buffer_from_host(struct vchiq_mmal_instance *instance, /* no payload in message */ m.u.buffer_from_host.payload_in_message = 0; - vchi_service_use(instance->service); + vchi_service_use(instance->service_handle); - ret = vchi_queue_kernel_message(instance->service, + ret = vchi_queue_kernel_message(instance->service_handle, &m, sizeof(struct mmal_msg_header) + sizeof(m.u.buffer_from_host)); - vchi_service_release(instance->service); + vchi_service_release(instance->service_handle); return ret; } @@ -804,14 +804,14 @@ static int send_synchronous_mmal_msg(struct vchiq_mmal_instance *instance, DBG_DUMP_MSG(msg, (sizeof(struct mmal_msg_header) + payload_len), ">>> sync message"); - vchi_service_use(instance->service); + vchi_service_use(instance->service_handle); - ret = vchi_queue_kernel_message(instance->service, + ret = vchi_queue_kernel_message(instance->service_handle, msg, sizeof(struct mmal_msg_header) + payload_len); - vchi_service_release(instance->service); + vchi_service_release(instance->service_handle); if (ret) { pr_err("error %d queuing message\n", ret); @@ -951,7 +951,7 @@ static int port_info_set(struct vchiq_mmal_instance *instance, port->component->handle, port->handle); release_msg: - vchiq_release_message(instance->service->handle, rmsg_handle); + vchiq_release_message(instance->service_handle, rmsg_handle); return ret; } @@ -1046,7 +1046,7 @@ static int port_info_get(struct vchiq_mmal_instance *instance, pr_debug("%s:result:%d component:0x%x port:%d\n", __func__, ret, port->component->handle, port->handle); - vchiq_release_message(instance->service->handle, rmsg_handle); + vchiq_release_message(instance->service_handle, rmsg_handle); return ret; } @@ -1094,7 +1094,7 @@ static int create_component(struct vchiq_mmal_instance *instance, component->inputs, component->outputs, component->clocks); release_msg: - vchiq_release_message(instance->service->handle, rmsg_handle); + vchiq_release_message(instance->service_handle, rmsg_handle); return ret; } @@ -1127,7 +1127,7 @@ static int destroy_component(struct vchiq_mmal_instance *instance, release_msg: - vchiq_release_message(instance->service->handle, rmsg_handle); + vchiq_release_message(instance->service_handle, rmsg_handle); return ret; } @@ -1159,7 +1159,7 @@ static int enable_component(struct vchiq_mmal_instance *instance, ret = -rmsg->u.component_enable_reply.status; release_msg: - vchiq_release_message(instance->service->handle, rmsg_handle); + vchiq_release_message(instance->service_handle, rmsg_handle); return ret; } @@ -1192,7 +1192,7 @@ static int disable_component(struct vchiq_mmal_instance *instance, release_msg: - vchiq_release_message(instance->service->handle, rmsg_handle); + vchiq_release_message(instance->service_handle, rmsg_handle); return ret; } @@ -1224,7 +1224,7 @@ static int get_version(struct vchiq_mmal_instance *instance, *minor_out = rmsg->u.version.minor; release_msg: - vchiq_release_message(instance->service->handle, rmsg_handle); + vchiq_release_message(instance->service_handle, rmsg_handle); return ret; } @@ -1266,7 +1266,7 @@ static int port_action_port(struct vchiq_mmal_instance *instance, port_action_type_names[action_type], action_type); release_msg: - vchiq_release_message(instance->service->handle, rmsg_handle); + vchiq_release_message(instance->service_handle, rmsg_handle); return ret; } @@ -1314,7 +1314,7 @@ static int port_action_handle(struct vchiq_mmal_instance *instance, action_type, connect_component_handle, connect_port_handle); release_msg: - vchiq_release_message(instance->service->handle, rmsg_handle); + vchiq_release_message(instance->service_handle, rmsg_handle); return ret; } @@ -1355,7 +1355,7 @@ static int port_parameter_set(struct vchiq_mmal_instance *instance, ret, port->component->handle, port->handle, parameter_id); release_msg: - vchiq_release_message(instance->service->handle, rmsg_handle); + vchiq_release_message(instance->service_handle, rmsg_handle); return ret; } @@ -1414,7 +1414,7 @@ static int port_parameter_get(struct vchiq_mmal_instance *instance, ret, port->component->handle, port->handle, parameter_id); release_msg: - vchiq_release_message(instance->service->handle, rmsg_handle); + vchiq_release_message(instance->service_handle, rmsg_handle); return ret; } @@ -2068,9 +2068,9 @@ int vchiq_mmal_finalise(struct vchiq_mmal_instance *instance) if (mutex_lock_interruptible(&instance->vchiq_mutex)) return -EINTR; - vchi_service_use(instance->service); + vchi_service_use(instance->service_handle); - status = vchi_service_close(instance->service); + status = vchi_service_close(instance->service_handle); if (status != 0) pr_err("mmal-vchiq: VCHIQ close failed\n"); @@ -2148,21 +2148,22 @@ int vchiq_mmal_init(struct vchiq_mmal_instance **out_instance) if (!instance->bulk_wq) goto err_free; - status = vchi_service_open(vchiq_instance, ¶ms, &instance->service); + status = vchi_service_open(vchiq_instance, ¶ms, + &instance->service_handle); if (status) { pr_err("Failed to open VCHI service connection (status=%d)\n", status); goto err_close_services; } - vchi_service_release(instance->service); + vchi_service_release(instance->service_handle); *out_instance = instance; return 0; err_close_services: - vchi_service_close(instance->service); + vchi_service_close(instance->service_handle); destroy_workqueue(instance->bulk_wq); err_free: vfree(instance->bulk_scratch); From patchwork Wed May 27 11:53: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: 11572769 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 BA706159A for ; Wed, 27 May 2020 12:08:53 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 98BC6207D8 for ; Wed, 27 May 2020 12:08:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="LWe5vy/M" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 98BC6207D8 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=bombadil.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=OcX9JtP+hSgcm/i3xWAjm/BYReQt2zZ7nKxlGcgyIf4=; b=LWe5vy/MkC0cP+ LlyL7SIH1BscSv5lyT2Rrzrfi7nOTK40QuaSLbJjgBH6nu8GzDL1NmR5VzUljUQSsr9+tOhCXEoyD CgDIJGqqNfwznCn34yMoD74A2mGPWz091kp/VfnbCsfqDfexmfZSTfFuyIFtdhNFbOtywhxuZyklI lidQwtcOcZVyn6yhp4LbVoz9w1qMIGdMawJIwP5uY2GF6dtBCUDBKBzFNXJmdnGgkh3zz2URhYVqW YwMYYi7sRysNvKK7obYmbS+Er31oa16d/clizvQqlCCil1Mw6x6OC+MM7apQA79r88OHu5FwNlBlh rDZUvb+cvyQ0gt+DfrhA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdurc-0000OS-Lp; Wed, 27 May 2020 12:08:52 +0000 Received: from mx2.suse.de ([195.135.220.15]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdue2-00077M-3e; Wed, 27 May 2020 11:54:53 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 1046EAD66; Wed, 27 May 2020 11:54:51 +0000 (UTC) From: Nicolas Saenz Julienne To: bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [RFC 35/50] staging: vchiq: Pass vchiq's message when holding a message Date: Wed, 27 May 2020 13:53:40 +0200 Message-Id: <20200527115400.31391-36-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527115400.31391-1-nsaenzjulienne@suse.de> References: <20200527115400.31391-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200527_045450_570441_82B7421E X-CRM114-Status: GOOD ( 15.61 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -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] 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [195.135.220.15 listed in wl.mailspike.net] -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, laurent.pinchart@ideasonboard.com, Nicolas Saenz Julienne , gregkh@linuxfoundation.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org vchi created an opaque structure to be held by services while they process callback messages. The contents of this opaque structure are the service handle, which all services already maintain, and a pointer to vchiq's message structure, struct vchiq_header. Let's get rid of this opaque structure and directly pass struct vchiq_header, which is what ultimately vchiq consumes when handling callback messages. Signed-off-by: Nicolas Saenz Julienne --- .../vc04_services/interface/vchi/vchi.h | 14 ++--------- .../interface/vchiq_arm/vchiq_shim.c | 25 ++++++------------- .../vc04_services/vc-sm-cma/vc_sm_cma_vchi.c | 6 ++--- 3 files changed, 12 insertions(+), 33 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h b/drivers/staging/vc04_services/interface/vchi/vchi.h index 74fd169e079a..72771fdee9d6 100644 --- a/drivers/staging/vc04_services/interface/vchi/vchi.h +++ b/drivers/staging/vc04_services/interface/vchi/vchi.h @@ -11,16 +11,6 @@ // Macros to manipulate 'FOURCC' values #define MAKE_FOURCC(x) ((int32_t)((x[0] << 24) | (x[1] << 16) | (x[2] << 8) | x[3])) -// Opaque service information -struct opaque_vchi_service_t; - -// Descriptor for a held message. Allocated by client, initialised by vchi_msg_hold, -// vchi_msg_iter_hold or vchi_msg_iter_hold_next. Fields are for internal VCHI use only. -struct vchi_held_msg { - struct opaque_vchi_service_t *service; - void *message; -}; - // Opaque handle for a VCHIQ instance struct vchiq_instance; @@ -67,7 +57,7 @@ extern int vchi_queue_kernel_message(unsigned handle, void *data, extern int32_t vchi_msg_hold(unsigned handle, void **data, // } may be NULL, as info can be uint32_t *msg_size, // } obtained from HELD_MSG_T - struct vchi_held_msg *message_descriptor); + struct vchiq_header **message); /******************************************************************************* * Global service support API - operations on held messages @@ -75,7 +65,7 @@ extern int32_t vchi_msg_hold(unsigned handle, ******************************************************************************/ // Routine to release a held message after it has been processed -extern int32_t vchi_held_msg_release(struct vchi_held_msg *message); +extern int32_t vchi_held_msg_release(unsigned handle, struct vchiq_header *message); /****************************************************************************** * Global bulk API 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 578346965da6..6eb9a9878641 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c @@ -113,7 +113,8 @@ EXPORT_SYMBOL(vchi_bulk_queue_transmit); /*********************************************************** * Name: vchi_held_msg_release * - * Arguments: struct vchi_held_msg *message + * Arguments: unsgined handle + * struct vchiq_header *message * * Description: Routine to release a held message (after it has been read with * vchi_msg_hold) @@ -121,7 +122,7 @@ EXPORT_SYMBOL(vchi_bulk_queue_transmit); * Returns: int32_t - success == 0 * ***********************************************************/ -int32_t vchi_held_msg_release(struct vchi_held_msg *message) +int32_t vchi_held_msg_release(unsigned handle, struct vchiq_header *message) { /* * Convert the service field pointer back to an @@ -131,8 +132,7 @@ int32_t vchi_held_msg_release(struct vchi_held_msg *message) * to a pointer. */ - vchiq_release_message((unsigned int)(long)message->service, - (struct vchiq_header *)message->message); + vchiq_release_message(handle, message); return 0; } @@ -144,7 +144,7 @@ EXPORT_SYMBOL(vchi_held_msg_release); * Arguments: struct vchi_service *service, * void **data, * uint32_t *msg_size, - * struct vchi_held_msg *message_handle + * struct vchiq_header **message * * Description: Routine to return a pointer to the current message (to allow * in place processing). The message is dequeued - don't forget @@ -155,7 +155,7 @@ EXPORT_SYMBOL(vchi_held_msg_release); * ***********************************************************/ int32_t vchi_msg_hold(unsigned handle, void **data, uint32_t *msg_size, - struct vchi_held_msg *message_handle) + struct vchiq_header **message) { struct vchiq_header *header; @@ -165,18 +165,7 @@ int32_t vchi_msg_hold(unsigned handle, void **data, uint32_t *msg_size, *data = header->data; *msg_size = header->size; - - /* - * upcast the unsigned int which is an int - * to a pointer and stuff it in the held message. - * This pointer is opaque to everything except - * vchi_held_msg_release which simply downcasts it back - * to an int. - */ - - message_handle->service = - (struct opaque_vchi_service_t *)(long)handle; - message_handle->message = header; + *message = header; return 0; } diff --git a/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c b/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c index b0339b5438aa..08979502f551 100644 --- a/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c +++ b/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c @@ -176,7 +176,7 @@ static int vc_sm_cma_vchi_videocore_io(void *arg) struct sm_instance *instance = arg; struct sm_cmd_rsp_blk *cmd = NULL, *cmd_tmp; struct vc_sm_result_t *reply; - struct vchi_held_msg msg; + struct vchiq_header *message; u32 reply_len; s32 status; int svc_use = 1; @@ -234,7 +234,7 @@ static int vc_sm_cma_vchi_videocore_io(void *arg) } while (1); while (!vchi_msg_hold(instance->service_handle, - (void **)&reply, &reply_len, &msg)) { + (void **)&reply, &reply_len, &message)) { if (reply->trans_id & 0x80000000) { /* Async event or cmd from the VPU */ if (instance->vpu_event) @@ -245,7 +245,7 @@ static int vc_sm_cma_vchi_videocore_io(void *arg) reply_len); } - vchi_held_msg_release(&msg); + vchi_held_msg_release(instance->service_handle, message); } /* Go through the dead list and free them */ From patchwork Wed May 27 11:53:41 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: 11572761 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 3B3BB90 for ; Wed, 27 May 2020 12:08:35 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id EF205207D8 for ; Wed, 27 May 2020 12:08:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="E5VVz7eQ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EF205207D8 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=bombadil.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=AmCIncIFztoFtUYY6RQOa8Rdo6WktB5TSUir9A8TZSc=; b=E5VVz7eQqQ75uc k0frqIjl/T5xNCiArn0Rm6E/4kRdRHrtqwcAb4Qg7HfjPrDohL42MqlYMrVNPUtG7NSTqURoxx/bz GUAl8B/dq8shjEEbxoBdqhoAs8dTesPgGbmXt9HBCnTGP8UO4XC3CCEuP4+SxuYSeF1O42Sb8VQ/D WphY5g/VyaAjne/shbE9AmCrSkBbVSZhqwayb6lf1oUHTyHBow7t4f7A4/0RWy2uSnaYSuVkfh2iW buliTU+gf5Y4smgLm8W8rlM3XdzaAHEVJ8nqSaRUHhTv1oa78DpShqCdl0s2d1OIMDwfge1Iw9JLg /pf+0xX+mg+w5k29DmtQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdurG-0008Nl-Sd; Wed, 27 May 2020 12:08:30 +0000 Received: from mx2.suse.de ([195.135.220.15]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdue3-000782-Fv; Wed, 27 May 2020 11:54:54 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id DF2FAACF2; Wed, 27 May 2020 11:54:51 +0000 (UTC) From: Nicolas Saenz Julienne To: bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [RFC 36/50] staging: vchi: Rework vchi_msg_hold() to match vchiq_msg_hold() Date: Wed, 27 May 2020 13:53:41 +0200 Message-Id: <20200527115400.31391-37-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527115400.31391-1-nsaenzjulienne@suse.de> References: <20200527115400.31391-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200527_045451_831204_01040A6A X-CRM114-Status: GOOD ( 13.51 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -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] 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [195.135.220.15 listed in wl.mailspike.net] -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, laurent.pinchart@ideasonboard.com, Nicolas Saenz Julienne , gregkh@linuxfoundation.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org The services have access to struct vchiq_header's internals, so we can let them get the data pointer. This pretty much makes both functions exactly the same, which will allow us to make a switch to vchiq_msg_hold() further down the road. Signed-off-by: Nicolas Saenz Julienne --- .../staging/vc04_services/interface/vchi/vchi.h | 5 +---- .../interface/vchiq_arm/vchiq_shim.c | 15 ++------------- .../vc04_services/vc-sm-cma/vc_sm_cma_vchi.c | 9 +++++++-- 3 files changed, 10 insertions(+), 19 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h b/drivers/staging/vc04_services/interface/vchi/vchi.h index 72771fdee9d6..59559d4cd5f1 100644 --- a/drivers/staging/vc04_services/interface/vchi/vchi.h +++ b/drivers/staging/vc04_services/interface/vchi/vchi.h @@ -54,10 +54,7 @@ extern int vchi_queue_kernel_message(unsigned handle, void *data, // 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. -extern int32_t vchi_msg_hold(unsigned handle, - void **data, // } may be NULL, as info can be - uint32_t *msg_size, // } obtained from HELD_MSG_T - struct vchiq_header **message); +struct vchiq_header *vchi_msg_hold(unsigned handle); /******************************************************************************* * Global service support API - operations on held messages 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 6eb9a9878641..fc12b76617d1 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c @@ -154,20 +154,9 @@ EXPORT_SYMBOL(vchi_held_msg_release); * Returns: int32_t - success == 0 * ***********************************************************/ -int32_t vchi_msg_hold(unsigned handle, void **data, uint32_t *msg_size, - struct vchiq_header **message) +struct vchiq_header *vchi_msg_hold(unsigned handle) { - struct vchiq_header *header; - - header = vchiq_msg_hold(handle); - if (!header) - return -ENOENT; - - *data = header->data; - *msg_size = header->size; - *message = header; - - return 0; + return vchiq_msg_hold(handle); } EXPORT_SYMBOL(vchi_msg_hold); diff --git a/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c b/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c index 08979502f551..2de67ce18be2 100644 --- a/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c +++ b/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c @@ -233,8 +233,13 @@ static int vc_sm_cma_vchi_videocore_io(void *arg) } while (1); - while (!vchi_msg_hold(instance->service_handle, - (void **)&reply, &reply_len, &message)) { + while (1) { + message = vchi_msg_hold(instance->service_handle); + if (!message) + break; + reply = (struct vc_sm_result_t *)message->data; + reply_len = message->size; + if (reply->trans_id & 0x80000000) { /* Async event or cmd from the VPU */ if (instance->vpu_event) From patchwork Wed May 27 11:53:42 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: 11572779 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 E20B490 for ; Wed, 27 May 2020 12:10:40 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id C0B6120657 for ; Wed, 27 May 2020 12:10:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="tOrDCKOv" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C0B6120657 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=bombadil.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=9UWQpOPUXxE572G3uo7azYxkU5t8Cy8+A2hvDjspJ4Q=; b=tOrDCKOvx/NdZw 7t7A+TmFXe5h6Is4KvAVHKd79HitvxzVI28jwR+djoQ/NOilZ7TxkAIxVRWELebkPJPt+nYrlPFDk fK1dtJDwIObMf8rrfghgzuNgost62bA/f5MxMHT3wU2V9XI7f6prrl5tki6/XYIfnEI61BFcljs/O Re9JCHnWxogcxxg573tj8KyaJ1jCbbNdWMEkIvIimgYS/o5ayemjnUCoGtLczu8jI6cSPtvfP0pfy 407F8AJkHQEdumZ9EJV26YPu5/vA3dVvV5iMrGgaq8yZvas1rEiT+etLLxqeYkDsOUG1mP4bbbRMC nQ3qIRjLBj+naGO0f/LA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdutH-0004Jj-8u; Wed, 27 May 2020 12:10:35 +0000 Received: from mx2.suse.de ([195.135.220.15]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdue4-00079L-J9; Wed, 27 May 2020 11:54:56 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 21A15AB7D; Wed, 27 May 2020 11:54:53 +0000 (UTC) From: Nicolas Saenz Julienne To: bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Nicolas Saenz Julienne , Florian Fainelli , Ray Jui , Scott Branden Subject: [RFC 37/50] staging: vchiq: Unify fourcc definition mechanisms Date: Wed, 27 May 2020 13:53:42 +0200 Message-Id: <20200527115400.31391-38-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527115400.31391-1-nsaenzjulienne@suse.de> References: <20200527115400.31391-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200527_045452_934582_FC08FD16 X-CRM114-Status: GOOD ( 13.86 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -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] 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [195.135.220.15 listed in wl.mailspike.net] -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, laurent.pinchart@ideasonboard.com, linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org There is already enough duplication with regard to fourcc generation in the kernel. Let's at least use the same macro all over the vchiq ecosystem. Signed-off-by: Nicolas Saenz Julienne --- drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c | 2 +- .../vc04_services/bcm2835-audio/vc_vchi_audioserv_defs.h | 5 ++--- drivers/staging/vc04_services/interface/vchi/vchi.h | 3 --- drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c | 2 +- drivers/staging/vc04_services/vc-sm-cma/vc_sm_defs.h | 3 --- drivers/staging/vc04_services/vchiq-mmal/mmal-msg.h | 1 - drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c | 2 +- 7 files changed, 5 insertions(+), 13 deletions(-) diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c index 18309578e9a2..55f1e684eef1 100644 --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c @@ -125,7 +125,7 @@ vc_vchi_audio_init(struct vchiq_instance *vchiq_instance, struct vchiq_service_params params = { .version = VC_AUDIOSERV_VER, .version_min = VC_AUDIOSERV_MIN_VER, - .fourcc = VC_AUDIO_SERVER_NAME, + .fourcc = VCHIQ_MAKE_FOURCC('A', 'U', 'D', 'S'), .callback = audio_vchi_callback, .userdata = instance, }; diff --git a/drivers/staging/vc04_services/bcm2835-audio/vc_vchi_audioserv_defs.h b/drivers/staging/vc04_services/bcm2835-audio/vc_vchi_audioserv_defs.h index d6401e914ac9..b4fa239c5ebe 100644 --- a/drivers/staging/vc04_services/bcm2835-audio/vc_vchi_audioserv_defs.h +++ b/drivers/staging/vc04_services/bcm2835-audio/vc_vchi_audioserv_defs.h @@ -8,9 +8,8 @@ #define VC_AUDIOSERV_VER 2 /* FourCC codes used for VCHI communication */ -#define VC_AUDIO_SERVER_NAME MAKE_FOURCC("AUDS") -#define VC_AUDIO_WRITE_COOKIE1 MAKE_FOURCC("BCMA") -#define VC_AUDIO_WRITE_COOKIE2 MAKE_FOURCC("DATA") +#define VC_AUDIO_WRITE_COOKIE1 VCHIQ_MAKE_FOURCC('B', 'C', 'M', 'A') +#define VC_AUDIO_WRITE_COOKIE2 VCHIQ_MAKE_FOURCC('D', 'A', 'T', 'A') /* * List of screens that are currently supported diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h b/drivers/staging/vc04_services/interface/vchi/vchi.h index 59559d4cd5f1..7108c254a38a 100644 --- a/drivers/staging/vc04_services/interface/vchi/vchi.h +++ b/drivers/staging/vc04_services/interface/vchi/vchi.h @@ -8,9 +8,6 @@ * Global defs *****************************************************************************/ -// Macros to manipulate 'FOURCC' values -#define MAKE_FOURCC(x) ((int32_t)((x[0] << 24) | (x[1] << 16) | (x[2] << 8) | x[3])) - // Opaque handle for a VCHIQ instance struct vchiq_instance; diff --git a/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c b/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c index 2de67ce18be2..0b1a510d6bab 100644 --- a/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c +++ b/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c @@ -294,7 +294,7 @@ struct sm_instance *vc_sm_cma_vchi_init(struct vchiq_instance *vchiq_instance, struct vchiq_service_params params = { .version = VC_SM_VER, .version_min = VC_SM_MIN_VER, - .fourcc = VC_SM_SERVER_NAME, + .fourcc = VCHIQ_MAKE_FOURCC('S', 'M', 'E', 'M'), .callback = vc_sm_cma_vchi_callback, .userdata = NULL, }; diff --git a/drivers/staging/vc04_services/vc-sm-cma/vc_sm_defs.h b/drivers/staging/vc04_services/vc-sm-cma/vc_sm_defs.h index 8a0d1f6dbfe8..4e6354000dfd 100644 --- a/drivers/staging/vc04_services/vc-sm-cma/vc_sm_defs.h +++ b/drivers/staging/vc04_services/vc-sm-cma/vc_sm_defs.h @@ -15,9 +15,6 @@ #ifndef __VC_SM_DEFS_H__INCLUDED__ #define __VC_SM_DEFS_H__INCLUDED__ -/* FourCC code used for VCHI connection */ -#define VC_SM_SERVER_NAME MAKE_FOURCC("SMEM") - /* Maximum message length */ #define VC_SM_MAX_MSG_LEN (sizeof(union vc_sm_msg_union_t) + \ sizeof(struct vc_sm_msg_hdr_t)) diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-msg.h b/drivers/staging/vc04_services/vchiq-mmal/mmal-msg.h index bd83159403e5..ab63835ce01c 100644 --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-msg.h +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-msg.h @@ -28,7 +28,6 @@ #define VC_MMAL_VER 15 #define VC_MMAL_MIN_VER 10 -#define VC_MMAL_SERVER_NAME MAKE_FOURCC("mmal") /* max total message size is 512 bytes */ #define MMAL_MSG_MAX_SIZE 512 diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c index 3707212d8e7e..d35d2b50991b 100644 --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c @@ -2097,7 +2097,7 @@ int vchiq_mmal_init(struct vchiq_mmal_instance **out_instance) struct vchiq_service_params params = { .version = VC_MMAL_VER, .version_min = VC_MMAL_MIN_VER, - .fourcc = VC_MMAL_SERVER_NAME, + .fourcc = VCHIQ_MAKE_FOURCC('m', 'm', 'a', 'l'), .callback = service_callback, .userdata = NULL, }; From patchwork Wed May 27 11:53:43 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: 11572775 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 6B12F159A for ; Wed, 27 May 2020 12:10:00 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id EE00220657 for ; Wed, 27 May 2020 12:09:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="UB9nJayk" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EE00220657 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=bombadil.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=po5GepFEhk0rNU5xE8pYpGp0frjC2IPs2BnAYh9CgqM=; b=UB9nJaykgpsbyg Nmkx7vE2GOTbkfh6pqL0qXX8kfE//XVkNCieuJtI9ipaje5leoa7JixET8+CsOHzTmFHQwpNyE5YJ v13074ctJQu18+DRQNzPHjuNSHEOBggGG7LPx/VBp4sXd22bwqzabKuE0zfmpYtL40kFq4wY0D6dH o9kop0jjssjUlPAbqFa8OoP+/fLsihspKOtx90H391C7jFsoIhiBW51ZXZqSqzR9a9QOvKZYgCqWs xV+V86bRLcHY1pB6Pp2KeKVkWkRy8bsaeWGBvMOaG9y9DGxHvictNg6Jk7mrKzbNF1FeYkwHRVqkY iwp45b3ABaW73p1BZzRQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdusb-0001Mg-Ac; Wed, 27 May 2020 12:09:53 +0000 Received: from mx2.suse.de ([195.135.220.15]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdue4-00079u-Pm; Wed, 27 May 2020 11:54:56 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id C02A5AE44; Wed, 27 May 2020 11:54:53 +0000 (UTC) From: Nicolas Saenz Julienne To: bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [RFC 38/50] staging: vchi: Get rid of struct vchiq_instance forward declaration Date: Wed, 27 May 2020 13:53:43 +0200 Message-Id: <20200527115400.31391-39-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527115400.31391-1-nsaenzjulienne@suse.de> References: <20200527115400.31391-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200527_045453_001000_B141EC05 X-CRM114-Status: UNSURE ( 8.13 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -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] 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [195.135.220.15 listed in wl.mailspike.net] -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, laurent.pinchart@ideasonboard.com, Nicolas Saenz Julienne , gregkh@linuxfoundation.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org It's already forward declared in vchiq_if.h. So no need to insist Signed-off-by: Nicolas Saenz Julienne --- drivers/staging/vc04_services/interface/vchi/vchi.h | 7 ------- 1 file changed, 7 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h b/drivers/staging/vc04_services/interface/vchi/vchi.h index 7108c254a38a..d24e7027c08f 100644 --- a/drivers/staging/vc04_services/interface/vchi/vchi.h +++ b/drivers/staging/vc04_services/interface/vchi/vchi.h @@ -4,13 +4,6 @@ #ifndef VCHI_H_ #define VCHI_H_ -/****************************************************************************** - * Global defs - *****************************************************************************/ - -// Opaque handle for a VCHIQ instance -struct vchiq_instance; - /****************************************************************************** * Global funcs - implementation is specific to which side you are on * (local / remote) From patchwork Wed May 27 11:53:44 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: 11572771 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 5BE1A159A for ; Wed, 27 May 2020 12:09:17 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id E211920657 for ; Wed, 27 May 2020 12:09:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="QCqwMdak" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E211920657 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=bombadil.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=nITsd18vB4N5I4aD2mp93PqgFJz2enBVkSb7TR6U6vk=; b=QCqwMdak8LvOm7 5xnKZysOih2rTrUaCNSW7JlNaG4bxY7j7K1yY44GGsLooYN0aUtf5fgDaDO+U+2hrNu8qcAq108aH 1+POkp07g8t9aGYIzKv23RSnjRABQQ8jwEoBc+9ElSGi+cN+h03mVGBE+hqnrgBPfRyy4TB4Awl3G GR9S3heqytCRIxgd2rtG0fKilksE/Is3IYGnXDJJ/sX5myBxk16Ay0MZYMgwIRDTF1+caGeGvN1ss vxX4r6CBqRxFWBllC5kjuecCtnoqzXINbHrZbih1DNfWC2Dw6sRvhOlgOUK4OxkuH+4hQqqrF7jVZ RkYngK48Iw7SlA+hLbAg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdurw-0000ly-Bg; Wed, 27 May 2020 12:09:12 +0000 Received: from mx2.suse.de ([195.135.220.15]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdue5-0007Aa-El; Wed, 27 May 2020 11:54:56 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 7E0C5AC91; Wed, 27 May 2020 11:54:54 +0000 (UTC) From: Nicolas Saenz Julienne To: bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [RFC 39/50] staging: vchi: Don't include vchiq_core.h Date: Wed, 27 May 2020 13:53:44 +0200 Message-Id: <20200527115400.31391-40-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527115400.31391-1-nsaenzjulienne@suse.de> References: <20200527115400.31391-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200527_045453_656292_6D4D7A95 X-CRM114-Status: UNSURE ( 9.51 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -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] 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [195.135.220.15 listed in wl.mailspike.net] -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, laurent.pinchart@ideasonboard.com, Nicolas Saenz Julienne , gregkh@linuxfoundation.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org This file is internal to vchiq. Signed-off-by: Nicolas Saenz Julienne --- drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c | 1 - 1 file changed, 1 deletion(-) 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 fc12b76617d1..52654123463d 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c @@ -8,7 +8,6 @@ #include "vchiq_if.h" #include "../vchi/vchi.h" #include "vchiq.h" -#include "vchiq_core.h" int vchi_queue_kernel_message(unsigned handle, void *data, unsigned int size) { From patchwork Wed May 27 11:53:45 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: 11572777 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 7244290 for ; Wed, 27 May 2020 12:10:31 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 5096B20657 for ; Wed, 27 May 2020 12:10:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="XRba7fsw" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5096B20657 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=bombadil.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=eoLHWQhJGPsbKUWeAVy/Q89z7bAtlCbCb/wz6y8WjqY=; b=XRba7fswuxM1lW OmVurhAugHm3peBSHBsHhWyMi5/xLysIfrq0kY1gS9yy13G7zy2i9NjF2ke14AiMlGKw/z4mWcswv Ut6G1inexDU8vLPeMu08wxTfoJvISPr3SsttSzfEzAx/M0W35MpmHFDXKKtUH8h8dQPXfIg6Yl/fA DG6+gdgYNI08/u2MnCyjgMEyoC8A928tZ9/hwr47GncHIF9/vOInDpAweJhuxEkfcNyDWNpE5eEEn wY4877sfymm5cZx/oiQ8tNWkYqi+/MuBIzP5QOC6EdzAqFkl1/dnQ7CPa1+JVxNh6oxg1vLsorFcJ L78ErpwSxiENS59R2q6g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdut5-00044G-Pa; Wed, 27 May 2020 12:10:23 +0000 Received: from mx2.suse.de ([195.135.220.15]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdue6-0007BV-62; Wed, 27 May 2020 11:54:58 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 4B1AFAC64; Wed, 27 May 2020 11:54:55 +0000 (UTC) From: Nicolas Saenz Julienne To: bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [RFC 40/50] staging: vchiq: Get rid of unnecessary definitions in vchiq_if.h Date: Wed, 27 May 2020 13:53:45 +0200 Message-Id: <20200527115400.31391-41-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527115400.31391-1-nsaenzjulienne@suse.de> References: <20200527115400.31391-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200527_045454_402874_4AA6A9BE X-CRM114-Status: UNSURE ( 9.03 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -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] 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [195.135.220.15 listed in wl.mailspike.net] -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, laurent.pinchart@ideasonboard.com, Nicolas Saenz Julienne , gregkh@linuxfoundation.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Those functions don't actually exist, nor have any use, nor the macros. Signed-off-by: Nicolas Saenz Julienne --- .../interface/vchiq_arm/vchiq_if.h | 17 ----------------- 1 file changed, 17 deletions(-) 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 b3d4c14536bd..407e7dc31108 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h @@ -8,11 +8,9 @@ #define VCHIQ_SLOT_SIZE 4096 #define VCHIQ_MAX_MSG_SIZE (VCHIQ_SLOT_SIZE - sizeof(struct vchiq_header)) -#define VCHIQ_CHANNEL_SIZE VCHIQ_MAX_MSG_SIZE /* For backwards compatibility */ #define VCHIQ_MAKE_FOURCC(x0, x1, x2, x3) \ (((x0) << 24) | ((x1) << 16) | ((x2) << 8) | (x3)) -#define VCHIQ_GET_SERVICE_USERDATA(service) vchiq_get_service_userdata(service) enum vchiq_reason { VCHIQ_SERVICE_OPENED, /* service, -, - */ @@ -92,7 +90,6 @@ struct vchiq_config { }; struct vchiq_instance; -typedef void (*vchiq_remote_callback)(void *cb_arg); extern enum vchiq_status vchiq_initialise(struct vchiq_instance **pinstance); extern enum vchiq_status vchiq_shutdown(struct vchiq_instance *instance); @@ -118,25 +115,11 @@ extern enum vchiq_status vchiq_bulk_transmit(unsigned int service, extern enum vchiq_status vchiq_bulk_receive(unsigned int service, void *data, unsigned int size, void *userdata, enum vchiq_bulk_mode mode); -extern enum vchiq_status vchiq_bulk_transmit_handle(unsigned int service, - const void *offset, unsigned int size, - void *userdata, enum vchiq_bulk_mode mode); -extern enum vchiq_status vchiq_bulk_receive_handle(unsigned int service, - void *offset, unsigned int size, void *userdata, - enum vchiq_bulk_mode mode); extern int vchiq_get_client_id(unsigned int service); extern void *vchiq_get_service_userdata(unsigned int service); extern void vchiq_get_config(struct vchiq_config *config); extern enum vchiq_status vchiq_set_service_option(unsigned int service, enum vchiq_service_option option, int value); - -extern enum vchiq_status vchiq_remote_use(struct vchiq_instance *instance, - vchiq_remote_callback callback, void *cb_arg); -extern enum vchiq_status vchiq_remote_release(struct vchiq_instance *instance); - -extern enum vchiq_status vchiq_dump_phys_mem(unsigned int service, - void *ptr, size_t num_bytes); - extern enum vchiq_status vchiq_get_peer_version(unsigned int handle, short *peer_version); extern void vchiq_msg_queue_push(unsigned handle, struct vchiq_header *header); From patchwork Wed May 27 11:53:46 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: 11572783 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 C6D21159A for ; Wed, 27 May 2020 12:11:20 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id A358D20657 for ; Wed, 27 May 2020 12:11:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="gwMjVbKv" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A358D20657 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=bombadil.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=YkABzCy5yjqK1PptJh/YfGgOi4DgexZdSPScNbxXj6Y=; b=gwMjVbKv7hrx72 4Fivm9Zf4IDeDYUcDODkj0j+Ol7HvPm4hobaBDQSvu/JUkNT6hOmxBORJ3nSJH5HBWJmOgZITKZCG saA9txeUuQqpLzNfR9Emf+ExR0HyWLfoeHY0D2riF0bDpUubSaW4NjyN5nHSeqD5NuAS7SYXTDc4L n4vz7P99cqlM+b+SIa51OVz7ZK6lPqPPdBtGTYtP1r0DI2MuT+Hyx9ai+3nlvRxA/xkCZW6CPj35e U+NpYdEV5AqW0P/99agJR0166IKQtJanE0sF/BOU3t9UrvujhV5bEUX59c1RsXQPpveiwS0QWgU5f BUlqiz5H+SHc2An/mCHA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdutw-00053y-E7; Wed, 27 May 2020 12:11:16 +0000 Received: from mx2.suse.de ([195.135.220.15]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdue7-0007CG-2u; Wed, 27 May 2020 11:54:58 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 1DA71AF38; Wed, 27 May 2020 11:54:56 +0000 (UTC) From: Nicolas Saenz Julienne To: bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [RFC 41/50] staging: vchiq: Make vchiq_add_service() local Date: Wed, 27 May 2020 13:53:46 +0200 Message-Id: <20200527115400.31391-42-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527115400.31391-1-nsaenzjulienne@suse.de> References: <20200527115400.31391-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200527_045455_275989_06859A77 X-CRM114-Status: GOOD ( 10.70 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -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] 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [195.135.220.15 listed in wl.mailspike.net] -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, laurent.pinchart@ideasonboard.com, Nicolas Saenz Julienne , gregkh@linuxfoundation.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org The function is being exported although there is no use for it outside of vchiq's core code. Keep it local then. Signed-off-by: Nicolas Saenz Julienne --- drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 3 +-- drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h | 3 --- 2 files changed, 1 insertion(+), 5 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 4230f33ac38a..4d98d4d3ee8a 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c @@ -277,7 +277,7 @@ enum vchiq_status vchiq_connect(struct vchiq_instance *instance) } EXPORT_SYMBOL(vchiq_connect); -enum vchiq_status vchiq_add_service( +static enum vchiq_status vchiq_add_service( struct vchiq_instance *instance, const struct vchiq_service_params *params, unsigned int *phandle) @@ -314,7 +314,6 @@ enum vchiq_status vchiq_add_service( return status; } -EXPORT_SYMBOL(vchiq_add_service); enum vchiq_status vchiq_open_service( struct vchiq_instance *instance, 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 407e7dc31108..b852980447dc 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h @@ -94,9 +94,6 @@ struct vchiq_instance; extern enum vchiq_status vchiq_initialise(struct vchiq_instance **pinstance); extern enum vchiq_status vchiq_shutdown(struct vchiq_instance *instance); extern enum vchiq_status vchiq_connect(struct vchiq_instance *instance); -extern enum vchiq_status vchiq_add_service(struct vchiq_instance *instance, - const struct vchiq_service_params *params, - unsigned int *pservice); extern enum vchiq_status vchiq_open_service(struct vchiq_instance *instance, const struct vchiq_service_params *params, unsigned int *pservice); From patchwork Wed May 27 11:53:47 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: 11572789 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 D86C9159A for ; Wed, 27 May 2020 12:11:56 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id ABB04208B6 for ; Wed, 27 May 2020 12:11:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="dgs9rK/3" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org ABB04208B6 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=bombadil.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=YSgz+rif3g1Qn4tN6Djok1CUNrNyVw2DrkKn3tBiAGo=; b=dgs9rK/3q1kOaM W51bXtCdh31nfIkKOk8vGrnbulhxfO57K0GiuuFKNl7Rk2Ks7pIhK1tmV6QQsq7pN3zm/QB5Vcjl+ htJ/NxWB3G5tjxY5VCK3EMK81WR8tkPPMf28Ng/lHPpNRTw8/XSn5BnS6NM1kw0IVlkCAelafvKMK ZNfUW7JAu3i1kzqO4q2SGWsWUW98eDG1t6W9X4OOIxdRnu5F4E2kv/GwPDfltHCeHjZsVvlIARfNT BIigTlAe9S7lJ4FvmmmOkLt+eM8trYfHhgsO31/QyOyEYXLJpJHWdvKN+XOrLSMj4cjFwnwusVxeU Lf7nqkrwn7IFjpUndbFQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jduuW-0005ar-8P; Wed, 27 May 2020 12:11:52 +0000 Received: from mx2.suse.de ([195.135.220.15]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdue7-0007D5-UI; Wed, 27 May 2020 11:54:58 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id DD722AF39; Wed, 27 May 2020 11:54:56 +0000 (UTC) From: Nicolas Saenz Julienne To: bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [RFC 42/50] staging: vchiq: Move definitions only used by core into core header Date: Wed, 27 May 2020 13:53:47 +0200 Message-Id: <20200527115400.31391-43-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527115400.31391-1-nsaenzjulienne@suse.de> References: <20200527115400.31391-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200527_045456_279359_9BC09C2F X-CRM114-Status: GOOD ( 13.66 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -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] 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [195.135.220.15 listed in wl.mailspike.net] -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, laurent.pinchart@ideasonboard.com, Nicolas Saenz Julienne , gregkh@linuxfoundation.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org vchiq_if.h is used by service consumers and only the exported API should be present. Move the rest of definitions, which were not exported by the way, to vchiq_core.h where they belong. Signed-off-by: Nicolas Saenz Julienne --- .../interface/vchiq_arm/vchiq_core.h | 22 +++++++++++++++++++ .../interface/vchiq_arm/vchiq_if.h | 16 -------------- 2 files changed, 22 insertions(+), 16 deletions(-) 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 b97b661bea1c..ff91c04ba6b9 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h @@ -486,6 +486,18 @@ struct bulk_waiter { int actual; }; +struct vchiq_config { + unsigned int max_msg_size; + unsigned int bulk_threshold; /* The message size above which it + is better to use a bulk transfer + (<= max_msg_size) */ + unsigned int max_outstanding_bulks; + unsigned int max_services; + short version; /* The version of VCHIQ */ + short version_min; /* The minimum compatible version of VCHIQ */ +}; + + extern spinlock_t bulk_waiter_spinlock; extern int vchiq_core_log_level; @@ -665,4 +677,14 @@ extern void vchiq_log_dump_mem(const char *label, uint32_t addr, const void *voidMem, size_t numBytes); +extern enum vchiq_status vchiq_remove_service(unsigned int service); + +extern int vchiq_get_client_id(unsigned int service); + +extern void vchiq_get_config(struct vchiq_config *config); + +extern enum vchiq_status +vchiq_set_service_option(unsigned int service, enum vchiq_service_option option, + int value); + #endif 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 b852980447dc..931debcd6492 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h @@ -78,17 +78,6 @@ struct vchiq_service_params { short version_min; /* Update for incompatible changes */ }; -struct vchiq_config { - unsigned int max_msg_size; - unsigned int bulk_threshold; /* The message size above which it - is better to use a bulk transfer - (<= max_msg_size) */ - unsigned int max_outstanding_bulks; - unsigned int max_services; - short version; /* The version of VCHIQ */ - short version_min; /* The minimum compatible version of VCHIQ */ -}; - struct vchiq_instance; extern enum vchiq_status vchiq_initialise(struct vchiq_instance **pinstance); @@ -98,7 +87,6 @@ extern enum vchiq_status vchiq_open_service(struct vchiq_instance *instance, const struct vchiq_service_params *params, unsigned int *pservice); extern enum vchiq_status vchiq_close_service(unsigned int service); -extern enum vchiq_status vchiq_remove_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, @@ -112,11 +100,7 @@ extern enum vchiq_status vchiq_bulk_transmit(unsigned int service, extern enum vchiq_status vchiq_bulk_receive(unsigned int service, void *data, unsigned int size, void *userdata, enum vchiq_bulk_mode mode); -extern int vchiq_get_client_id(unsigned int service); extern void *vchiq_get_service_userdata(unsigned int service); -extern void vchiq_get_config(struct vchiq_config *config); -extern enum vchiq_status vchiq_set_service_option(unsigned int service, - enum vchiq_service_option option, int value); extern enum vchiq_status vchiq_get_peer_version(unsigned int handle, short *peer_version); extern void vchiq_msg_queue_push(unsigned handle, struct vchiq_header *header); From patchwork Wed May 27 11:53:48 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: 11572785 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 387F490 for ; Wed, 27 May 2020 12:11:36 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id F1CA520657 for ; Wed, 27 May 2020 12:11:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="aBcMxDKl" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F1CA520657 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=bombadil.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=QOX8KzR9m4w1pwAd4yicyKCdeEuis31S9PZNzaPDX1A=; b=aBcMxDKlKqoIbw fMvMbku92hyGl2VV2aTSMz+wCKC4S046DRYf9kYrkS7skz2d2W2yYlwWkmL6naa/NBJ2D6uoRFrch v3dRCvAlTTAjM3qk2R2SK4o1zqoAuZIl5FB0OruaIz1bwAIK9BNn7UbLokKmNSDk661kF1XMn4uoa /VKM8r9doAAPcThOTG7hTuYHPCCkX7OIEcYeJSskccQR0eIhnB7Dl1xSQwES74Sa0O2m33KdxfnTA +XUZwwJX406iWVNdGelD1gRCSn+7H7072c8L+EbBGlZxnsItiTi6RyBH27lL/oCr6JmyEXqgnIbjt h0lk406Vfv+eVWXGUWAQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jduuD-0005JQ-SU; Wed, 27 May 2020 12:11:33 +0000 Received: from mx2.suse.de ([195.135.220.15]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdue8-0007Dp-NZ; Wed, 27 May 2020 11:54:59 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id DA392AC84; Wed, 27 May 2020 11:54:57 +0000 (UTC) From: Nicolas Saenz Julienne To: bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [RFC 43/50] staging: vchi: Get rid of vchi_bulk_queue_receive() Date: Wed, 27 May 2020 13:53:48 +0200 Message-Id: <20200527115400.31391-44-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527115400.31391-1-nsaenzjulienne@suse.de> References: <20200527115400.31391-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200527_045457_086548_3A1C1642 X-CRM114-Status: GOOD ( 14.96 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -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] 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [195.135.220.15 listed in wl.mailspike.net] -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, laurent.pinchart@ideasonboard.com, Nicolas Saenz Julienne , gregkh@linuxfoundation.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Its vchiq counterpart, vchiq_bulk_receive() is only used by vchi. We can then merge both functions by moving vchi_bulk_queue_receive()'s retry mechanism into vchiq_bulk_receive() and let services call the later. Signed-off-by: Nicolas Saenz Julienne --- .../vc04_services/interface/vchi/vchi.h | 7 ---- .../interface/vchiq_arm/vchiq_arm.c | 42 ++++++++++++------- .../interface/vchiq_arm/vchiq_shim.c | 38 ----------------- .../vc04_services/vchiq-mmal/mmal-vchiq.c | 20 ++++----- 4 files changed, 37 insertions(+), 70 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h b/drivers/staging/vc04_services/interface/vchi/vchi.h index d24e7027c08f..ca20b99122f2 100644 --- a/drivers/staging/vc04_services/interface/vchi/vchi.h +++ b/drivers/staging/vc04_services/interface/vchi/vchi.h @@ -58,13 +58,6 @@ extern int32_t vchi_held_msg_release(unsigned handle, struct vchiq_header *messa * Global bulk API *****************************************************************************/ -// Routine to prepare interface for a transfer from the other side -extern int32_t vchi_bulk_queue_receive(unsigned handle, - void *data_dst, - uint32_t data_size, - enum vchiq_bulk_mode mode, - void *transfer_handle); - // Routine to queue up data ready for transfer to the other (once they have signalled they are ready) extern int32_t vchi_bulk_queue_transmit(unsigned handle, const void *data_src, 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 4d98d4d3ee8a..084e98b4ca61 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c @@ -380,24 +380,36 @@ vchiq_bulk_transmit(unsigned int handle, const void *data, } EXPORT_SYMBOL(vchiq_bulk_transmit); -enum vchiq_status -vchiq_bulk_receive(unsigned int handle, void *data, - unsigned int size, void *userdata, enum vchiq_bulk_mode mode) +enum vchiq_status vchiq_bulk_receive(unsigned int handle, void *data, + unsigned int size, void *userdata, + enum vchiq_bulk_mode mode) { enum vchiq_status status; - switch (mode) { - case VCHIQ_BULK_MODE_NOCALLBACK: - case VCHIQ_BULK_MODE_CALLBACK: - status = vchiq_bulk_transfer(handle, data, size, userdata, - mode, VCHIQ_BULK_RECEIVE); - break; - case VCHIQ_BULK_MODE_BLOCKING: - status = vchiq_blocking_bulk_transfer(handle, - (void *)data, size, VCHIQ_BULK_RECEIVE); - break; - default: - return VCHIQ_ERROR; + while (1) { + switch (mode) { + case VCHIQ_BULK_MODE_NOCALLBACK: + case VCHIQ_BULK_MODE_CALLBACK: + status = vchiq_bulk_transfer(handle, data, size, userdata, + mode, VCHIQ_BULK_RECEIVE); + break; + case VCHIQ_BULK_MODE_BLOCKING: + status = vchiq_blocking_bulk_transfer(handle, + (void *)data, size, VCHIQ_BULK_RECEIVE); + break; + default: + return VCHIQ_ERROR; + } + + /* + * vchiq_*_bulk_transfer() 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; 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 52654123463d..f69936a9eb29 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c @@ -31,44 +31,6 @@ int vchi_queue_kernel_message(unsigned handle, void *data, unsigned int size) } EXPORT_SYMBOL(vchi_queue_kernel_message); -/*********************************************************** - * Name: vchi_bulk_queue_receive - * - * Arguments: VCHI_BULK_HANDLE_T handle, - * void *data_dst, - * const uint32_t data_size, - * enum vchi_flags flags - * void *bulk_handle - * - * Description: Routine to setup a rcv buffer - * - * Returns: int32_t - success == 0 - * - ***********************************************************/ -int32_t vchi_bulk_queue_receive(unsigned handle, void *data_dst, - uint32_t data_size, enum vchiq_bulk_mode mode, - void *bulk_handle) -{ - enum vchiq_status status; - - while (1) { - status = vchiq_bulk_receive(handle, data_dst, data_size, - bulk_handle, mode); - /* - * vchiq_bulk_receive() 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_bulk_queue_receive); - /*********************************************************** * Name: vchi_bulk_queue_transmit * diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c index d35d2b50991b..b5d40074cdc7 100644 --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c @@ -277,7 +277,7 @@ static void buffer_work_cb(struct work_struct *work) * VCHI will allow up to 4 bulk receives to be scheduled before blocking. * If we block in the service_callback context then we can't process the * VCHI_CALLBACK_BULK_RECEIVED message that would otherwise allow the blocked - * vchi_bulk_queue_receive() call to complete. + * vchiq_bulk_receive() call to complete. */ static void buffer_to_host_work_cb(struct work_struct *work) { @@ -293,19 +293,19 @@ static void buffer_to_host_work_cb(struct work_struct *work) len = 8; /* queue the bulk submission */ vchi_service_use(instance->service_handle); - ret = vchi_bulk_queue_receive(instance->service_handle, - msg_context->u.bulk.buffer->buffer, - /* Actual receive needs to be a multiple - * of 4 bytes - */ - (len + 3) & ~3, - VCHIQ_BULK_MODE_CALLBACK, - msg_context); + ret = vchiq_bulk_receive(instance->service_handle, + msg_context->u.bulk.buffer->buffer, + /* Actual receive needs to be a multiple + * of 4 bytes + */ + (len + 3) & ~3, + msg_context, + VCHIQ_BULK_MODE_CALLBACK); vchi_service_release(instance->service_handle); if (ret != 0) - pr_err("%s: ctx: %p, vchi_bulk_queue_receive failed %d\n", + pr_err("%s: ctx: %p, vchiq_bulk_receive failed %d\n", __func__, msg_context, ret); } From patchwork Wed May 27 11:53:49 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: 11572781 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 657C190 for ; Wed, 27 May 2020 12:10:59 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 4324D20657 for ; Wed, 27 May 2020 12:10:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="UGzIy8w7" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4324D20657 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=bombadil.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=tpoM4j6csHOSksnaTSFlLjBXF7REEAsiIre59IsFsyE=; b=UGzIy8w7DSJ6wa 6QR7YZp71RVX3+j4e8GD8qNnVpKYWe1CBPiKIpzx+zjWS+MV3p/FJ0V6Mh62FgPJS/3I76GkibG/C JnA8BVaMmRXOhNkULKENb6rl2SLmLeh7EhtHylkGI4KSh5bIYPjE5jfIUMWm5/4Cs+70n+qCDCwb2 RkICNjcu7zAr0KrDQrYFOiTkbZPuazAJmlOuuSTW3+wkk6DpvpaIC6R/jJNWj1p9AF+PBfAyWyXje f6jn6Nw2MKRtPaIsLzW3fmIbFQNElOAt9NxNP6UX6Y3QZGm2DXNQSoI/ZL6hx2ydtQYFdsYLx7U0p Q+cuFAW3JpIgZEcAfiPw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdutX-0004bw-RK; Wed, 27 May 2020 12:10:51 +0000 Received: from mx2.suse.de ([195.135.220.15]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdue9-0007Em-Tx; Wed, 27 May 2020 11:55:00 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id DE436AD66; Wed, 27 May 2020 11:54:58 +0000 (UTC) From: Nicolas Saenz Julienne To: bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Florian Fainelli , Ray Jui , Scott Branden , Nicolas Saenz Julienne Subject: [RFC 44/50] staging: vchi: Get rid of vchi_bulk_queue_transmit() Date: Wed, 27 May 2020 13:53:49 +0200 Message-Id: <20200527115400.31391-45-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527115400.31391-1-nsaenzjulienne@suse.de> References: <20200527115400.31391-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200527_045458_271187_4A1B5317 X-CRM114-Status: GOOD ( 17.86 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -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] 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [195.135.220.15 listed in wl.mailspike.net] -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, laurent.pinchart@ideasonboard.com, linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Its vchiq counterpart, vchiq_bulk_transmit() is only used by vchi. We can then merge both functions by moving vchi_bulk_queue_transmit()'s retry mechanism into vchiq_bulk_transmit() and let services call the later. Signed-off-by: Nicolas Saenz Julienne --- .../bcm2835-audio/bcm2835-vchiq.c | 7 +- .../vc04_services/interface/vchi/vchi.h | 11 ---- .../interface/vchiq_arm/vchiq_arm.c | 38 +++++++---- .../interface/vchiq_arm/vchiq_shim.c | 66 ++++--------------- 4 files changed, 41 insertions(+), 81 deletions(-) diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c index 55f1e684eef1..28d64bc895cd 100644 --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c @@ -343,10 +343,9 @@ int bcm2835_audio_write(struct bcm2835_alsa_stream *alsa_stream, count = size; if (!instance->max_packet) { /* Send the message to the videocore */ - status = vchi_bulk_queue_transmit(instance->service_handle, - src, count, - VCHIQ_BULK_MODE_BLOCKING, - NULL); + status = vchiq_bulk_transmit(instance->service_handle, src, + count, NULL, + VCHIQ_BULK_MODE_BLOCKING); } else { while (count > 0) { int bytes = min(instance->max_packet, count); diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h b/drivers/staging/vc04_services/interface/vchi/vchi.h index ca20b99122f2..c800796f9986 100644 --- a/drivers/staging/vc04_services/interface/vchi/vchi.h +++ b/drivers/staging/vc04_services/interface/vchi/vchi.h @@ -54,17 +54,6 @@ struct vchiq_header *vchi_msg_hold(unsigned handle); // Routine to release a held message after it has been processed extern int32_t vchi_held_msg_release(unsigned handle, struct vchiq_header *message); -/****************************************************************************** - * Global bulk API - *****************************************************************************/ - -// Routine to queue up data ready for transfer to the other (once they have signalled they are ready) -extern int32_t vchi_bulk_queue_transmit(unsigned handle, - const void *data_src, - uint32_t data_size, - enum vchiq_bulk_mode mode, - void *transfer_handle); - /****************************************************************************** * Configuration plumbing *****************************************************************************/ 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 084e98b4ca61..524128225766 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c @@ -361,19 +361,31 @@ vchiq_bulk_transmit(unsigned int handle, const void *data, { enum vchiq_status status; - switch (mode) { - case VCHIQ_BULK_MODE_NOCALLBACK: - case VCHIQ_BULK_MODE_CALLBACK: - status = vchiq_bulk_transfer(handle, (void *)data, size, - userdata, mode, - VCHIQ_BULK_TRANSMIT); - break; - case VCHIQ_BULK_MODE_BLOCKING: - status = vchiq_blocking_bulk_transfer(handle, - (void *)data, size, VCHIQ_BULK_TRANSMIT); - break; - default: - return VCHIQ_ERROR; + while (1) { + switch (mode) { + case VCHIQ_BULK_MODE_NOCALLBACK: + case VCHIQ_BULK_MODE_CALLBACK: + status = vchiq_bulk_transfer(handle, (void *)data, size, + userdata, mode, + VCHIQ_BULK_TRANSMIT); + break; + case VCHIQ_BULK_MODE_BLOCKING: + status = vchiq_blocking_bulk_transfer(handle, + (void *)data, size, VCHIQ_BULK_TRANSMIT); + break; + default: + return VCHIQ_ERROR; + } + + /* + * vchiq_*_bulk_transfer() 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; 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 f69936a9eb29..33493643b5f8 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c @@ -31,46 +31,6 @@ int vchi_queue_kernel_message(unsigned handle, void *data, unsigned int size) } EXPORT_SYMBOL(vchi_queue_kernel_message); -/*********************************************************** - * Name: vchi_bulk_queue_transmit - * - * Arguments: VCHI_BULK_HANDLE_T handle, - * const void *data_src, - * uint32_t data_size, - * enum vchi_flags flags, - * void *bulk_handle - * - * Description: Routine to transmit some data - * - * Returns: int32_t - success == 0 - * - ***********************************************************/ -int32_t vchi_bulk_queue_transmit(unsigned handle, const void *data_src, - uint32_t data_size, enum vchiq_bulk_mode mode, - void *bulk_handle) -{ - enum vchiq_status status; - - while (1) { - status = vchiq_bulk_transmit(handle, data_src, data_size, - bulk_handle, mode); - - /* - * vchiq_bulk_transmit() 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_bulk_queue_transmit); - - /*********************************************************** * Name: vchi_held_msg_release * @@ -80,10 +40,10 @@ EXPORT_SYMBOL(vchi_bulk_queue_transmit); * Description: Routine to release a held message (after it has been read with * vchi_msg_hold) * - * Returns: int32_t - success == 0 + * Returns: int - success == 0 * ***********************************************************/ -int32_t vchi_held_msg_release(unsigned handle, struct vchiq_header *message) +int vchi_held_msg_release(unsigned handle, struct vchiq_header *message) { /* * Convert the service field pointer back to an @@ -104,7 +64,7 @@ EXPORT_SYMBOL(vchi_held_msg_release); * * Arguments: struct vchi_service *service, * void **data, - * uint32_t *msg_size, + * unsigned *msg_size, * struct vchiq_header **message * * Description: Routine to return a pointer to the current message (to allow @@ -112,7 +72,7 @@ EXPORT_SYMBOL(vchi_held_msg_release); * to release the message using vchi_held_msg_release when you're * finished. * - * Returns: int32_t - success == 0 + * Returns: int - success == 0 * ***********************************************************/ struct vchiq_header *vchi_msg_hold(unsigned handle) @@ -134,7 +94,7 @@ EXPORT_SYMBOL(vchi_msg_hold); * ***********************************************************/ -int32_t vchi_initialise(struct vchiq_instance **instance) +int vchi_initialise(struct vchiq_instance **instance) { return vchiq_initialise(instance); } @@ -151,7 +111,7 @@ EXPORT_SYMBOL(vchi_initialise); * Returns: 0 if successful, failure otherwise * ***********************************************************/ -int32_t vchi_connect(struct vchiq_instance *instance) +int vchi_connect(struct vchiq_instance *instance) { return vchiq_connect(instance); } @@ -168,7 +128,7 @@ EXPORT_SYMBOL(vchi_connect); * Returns: 0 if successful, failure otherwise * ***********************************************************/ -int32_t vchi_disconnect(struct vchiq_instance *instance) +int vchi_disconnect(struct vchiq_instance *instance) { return vchiq_shutdown(instance); } @@ -184,11 +144,11 @@ EXPORT_SYMBOL(vchi_disconnect); * * Description: Routine to open a service * - * Returns: int32_t - success == 0 + * Returns: int - success == 0 * ***********************************************************/ -int32_t vchi_service_open(struct vchiq_instance *instance, +int vchi_service_open(struct vchiq_instance *instance, struct vchiq_service_params *params, unsigned *handle) { @@ -196,13 +156,13 @@ int32_t vchi_service_open(struct vchiq_instance *instance, } EXPORT_SYMBOL(vchi_service_open); -int32_t vchi_service_close(unsigned handle) +int vchi_service_close(unsigned handle) { return vchiq_close_service(handle); } EXPORT_SYMBOL(vchi_service_close); -int32_t vchi_get_peer_version(unsigned handle, short *peer_version) +int vchi_get_peer_version(unsigned handle, short *peer_version) { return vchiq_get_peer_version(handle, peer_version); } @@ -218,7 +178,7 @@ EXPORT_SYMBOL(vchi_get_peer_version); * Returns: void * ***********************************************************/ -int32_t vchi_service_use(unsigned handle) +int vchi_service_use(unsigned handle) { return vchiq_use_service(handle); } @@ -234,7 +194,7 @@ EXPORT_SYMBOL(vchi_service_use); * Returns: void * ***********************************************************/ -int32_t vchi_service_release(unsigned handle) +int vchi_service_release(unsigned handle) { return vchiq_release_service(handle); } From patchwork Wed May 27 11:53:50 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: 11572791 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 244AE159A for ; Wed, 27 May 2020 12:12:28 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id ED31B207CB for ; Wed, 27 May 2020 12:12:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="qcathmRI" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org ED31B207CB 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=bombadil.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=9RATYAE2/HUTYTquEzzIQxCxA7WDCTDscxzeXPC1Oq4=; b=qcathmRIdbQ4N5 9ztbfhOp/bb3BnJcUYDPWmgOJoL8P+YLG49voQ3IjtxWtVJ+ZM0hsFOqQXuesUoIZKZegeomK6YDX wu+n6+CVGrBvRJtlURjy5O6BmtvKTh2xi5D3KvL++uQaqU5miRyq4uJY3Lv1ECfvQ/Y9L8UwnX3Tb xvH0RmCqavYuSYVzdYT3muksaGkut0rfBaPgBCAnhYeQfm/JmuNVl7TUuOPgZjuuYdIIDm1MwIEub 17OW019LWAq076M+61aG3lgIV/3nsy6qTaBwg9Vu1j7I3FoJD14j8bDysHbalmrByTvsP6xcg9WjI IGe7HLCiJ/AOm2srt2+Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jduuz-00061F-Er; Wed, 27 May 2020 12:12:21 +0000 Received: from mx2.suse.de ([195.135.220.15]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdueB-0007GE-92; Wed, 27 May 2020 11:55:01 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 3EF09AF4F; Wed, 27 May 2020 11:55:00 +0000 (UTC) From: Nicolas Saenz Julienne To: bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Florian Fainelli , Ray Jui , Scott Branden , Nicolas Saenz Julienne Subject: [RFC 45/50] staging: vchi: Move vchi_queue_kernel_message() into vchiq Date: Wed, 27 May 2020 13:53:50 +0200 Message-Id: <20200527115400.31391-46-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527115400.31391-1-nsaenzjulienne@suse.de> References: <20200527115400.31391-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200527_045459_714535_3A8C355F X-CRM114-Status: GOOD ( 17.49 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -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] 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [195.135.220.15 listed in wl.mailspike.net] -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, laurent.pinchart@ideasonboard.com, linux-kernel@vger.kernel.org, gregkh@linuxfoundation.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/vc-sm-cma/vc_sm_cma_vchi.c | 2 +- .../vc04_services/vchiq-mmal/mmal-vchiq.c | 14 +++++------ 7 files changed, 33 insertions(+), 44 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 01a9331dbff4..ee11707b7476 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/vc-sm-cma/vc_sm_cma_vchi.c b/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c index 0b1a510d6bab..dc8c469b37d2 100644 --- a/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c +++ b/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c @@ -78,7 +78,7 @@ struct sm_instance { static int bcm2835_vchi_msg_queue(unsigned handle, void *data, unsigned int size) { - return vchi_queue_kernel_message(handle, data, size); + return vchiq_queue_kernel_message(handle, data, size); } static struct diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c index b5d40074cdc7..664547c8e4a9 100644 --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c @@ -452,10 +452,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); @@ -806,10 +805,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); From patchwork Wed May 27 11:53:51 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: 11572797 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 E09FC90 for ; Wed, 27 May 2020 12:13:07 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 8E84520657 for ; Wed, 27 May 2020 12:13:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="hE3ZduTj" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8E84520657 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=bombadil.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=0Zg7eN5Tix28czdzQZqSf3K8noe/ZJXj041sglQJvuw=; b=hE3ZduTjmRVmjL jSfKjucsQkwk8w7rk7NyfDgpBCzGA5C7YMU4S6rlTRz13jlbkv+gnePpI47ozStgdcVEB4cqLWwo9 8GTn1F06BIO52SsYsLmSuXEviazrkVOGyNuzFsl7Dp1AhDlarvuoimhNB+KlQssqIIYiP75jxp0l8 J8y4KBf2qjCdgQM5Cm7ev4w0Az+fnbNXAj33uex65uGKRy9Za1itgXtemhRyX/yQ7yrgRgSmFVqWg B5zThgGoK2CdWOuzI6zOCFlRFTugYbPlBMxuI3+WX52GJnB0l3aUnKqpMhUaD6eCJk56aTcw4RkxT zdFqLlz6cOKiSCsf/AzA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jduvd-0006dL-CK; Wed, 27 May 2020 12:13:01 +0000 Received: from mx2.suse.de ([195.135.220.15]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdueD-0007I0-44; Wed, 27 May 2020 11:55:05 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 2B938AD17; Wed, 27 May 2020 11:55:02 +0000 (UTC) From: Nicolas Saenz Julienne To: bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Nicolas Saenz Julienne , Florian Fainelli , Ray Jui , Scott Branden Subject: [RFC 46/50] staging: vchiq: Get rid of vchi Date: Wed, 27 May 2020 13:53:51 +0200 Message-Id: <20200527115400.31391-47-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527115400.31391-1-nsaenzjulienne@suse.de> References: <20200527115400.31391-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200527_045501_519743_23D8411F X-CRM114-Status: GOOD ( 22.67 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -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] 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [195.135.220.15 listed in wl.mailspike.net] -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, laurent.pinchart@ideasonboard.com, linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org All the functions that vchi currently provides are a 1:1 mapping to its vchiq counterparts. Get rid of vchi altogether and use vchiq's on all services. In the process also get rid of the vchi directory, as the only remaining file was a TODO file, which now lives in the parent directory. Signed-off-by: Nicolas Saenz Julienne --- drivers/staging/vc04_services/Makefile | 1 - .../bcm2835-audio/bcm2835-vchiq.c | 24 +-- .../vc04_services/bcm2835-audio/bcm2835.h | 1 - .../vc04_services/interface/{vchi => }/TODO | 0 .../vc04_services/interface/vchi/vchi.h | 59 ------ .../interface/vchiq_arm/vchiq_arm.c | 2 + .../interface/vchiq_arm/vchiq_core.c | 3 + .../interface/vchiq_arm/vchiq_shim.c | 179 ------------------ .../staging/vc04_services/vc-sm-cma/vc_sm.c | 4 +- .../vc04_services/vc-sm-cma/vc_sm_cma_vchi.c | 17 +- .../vc04_services/vc-sm-cma/vc_sm_cma_vchi.h | 2 - .../vc04_services/vchiq-mmal/mmal-vchiq.c | 29 ++- 12 files changed, 42 insertions(+), 279 deletions(-) rename drivers/staging/vc04_services/interface/{vchi => }/TODO (100%) delete mode 100644 drivers/staging/vc04_services/interface/vchi/vchi.h delete mode 100644 drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c diff --git a/drivers/staging/vc04_services/Makefile b/drivers/staging/vc04_services/Makefile index 6a426572793b..e32c0744e7fc 100644 --- a/drivers/staging/vc04_services/Makefile +++ b/drivers/staging/vc04_services/Makefile @@ -6,7 +6,6 @@ vchiq-objs := \ interface/vchiq_arm/vchiq_arm.o \ interface/vchiq_arm/vchiq_2835_arm.o \ interface/vchiq_arm/vchiq_debugfs.o \ - interface/vchiq_arm/vchiq_shim.o \ interface/vchiq_arm/vchiq_connected.o \ obj-$(CONFIG_SND_BCM2835) += bcm2835-audio/ diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c index efaa2ae11f52..8c9ddd86fbbd 100644 --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c @@ -25,12 +25,12 @@ MODULE_PARM_DESC(force_bulk, "Force use of vchiq bulk for audio"); static void bcm2835_audio_lock(struct bcm2835_audio_instance *instance) { mutex_lock(&instance->vchi_mutex); - vchi_service_use(instance->service_handle); + vchiq_use_service(instance->service_handle); } static void bcm2835_audio_unlock(struct bcm2835_audio_instance *instance) { - vchi_service_release(instance->service_handle); + vchiq_release_service(instance->service_handle); mutex_unlock(&instance->vchi_mutex); } @@ -132,8 +132,8 @@ vc_vchi_audio_init(struct vchiq_instance *vchiq_instance, int status; /* Open the VCHI service connections */ - status = vchi_service_open(vchiq_instance, ¶ms, - &instance->service_handle); + status = vchiq_open_service(vchiq_instance, ¶ms, + &instance->service_handle); if (status) { dev_err(instance->dev, @@ -143,7 +143,7 @@ vc_vchi_audio_init(struct vchiq_instance *vchiq_instance, } /* Finished with the service for now */ - vchi_service_release(instance->service_handle); + vchiq_release_service(instance->service_handle); return 0; } @@ -153,10 +153,10 @@ static void vc_vchi_audio_deinit(struct bcm2835_audio_instance *instance) int status; mutex_lock(&instance->vchi_mutex); - vchi_service_use(instance->service_handle); + vchiq_use_service(instance->service_handle); /* Close all VCHI service connections */ - status = vchi_service_close(instance->service_handle); + status = vchiq_close_service(instance->service_handle); if (status) { dev_err(instance->dev, "failed to close VCHI service connection (status=%d)\n", @@ -171,14 +171,14 @@ int bcm2835_new_vchi_ctx(struct device *dev, struct bcm2835_vchi_ctx *vchi_ctx) int ret; /* Initialize and create a VCHI connection */ - ret = vchi_initialise(&vchi_ctx->instance); + ret = vchiq_initialise(&vchi_ctx->instance); if (ret) { dev_err(dev, "failed to initialise VCHI instance (ret=%d)\n", ret); return -EIO; } - ret = vchi_connect(vchi_ctx->instance); + ret = vchiq_connect(vchi_ctx->instance); if (ret) { dev_dbg(dev, "failed to connect VCHI instance (ret=%d)\n", ret); @@ -195,7 +195,7 @@ int bcm2835_new_vchi_ctx(struct device *dev, struct bcm2835_vchi_ctx *vchi_ctx) void bcm2835_free_vchi_ctx(struct bcm2835_vchi_ctx *vchi_ctx) { /* Close the VCHI connection - it will also free vchi_ctx->instance */ - WARN_ON(vchi_disconnect(vchi_ctx->instance)); + WARN_ON(vchiq_shutdown(vchi_ctx->instance)); vchi_ctx->instance = NULL; } @@ -226,8 +226,8 @@ int bcm2835_audio_open(struct bcm2835_alsa_stream *alsa_stream) goto deinit; bcm2835_audio_lock(instance); - vchi_get_peer_version(instance->service_handle, - &instance->peer_version); + vchiq_get_peer_version(instance->service_handle, + &instance->peer_version); bcm2835_audio_unlock(instance); if (instance->peer_version < 2 || force_bulk) instance->max_packet = 0; /* bulk transfer */ diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h b/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h index 7a0e4ab50fc7..a15f251033ac 100644 --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h @@ -10,7 +10,6 @@ #include #include #include "interface/vchiq_arm/vchiq_if.h" -#include "interface/vchi/vchi.h" #define MAX_SUBSTREAMS (8) #define AVAIL_SUBSTREAMS_MASK (0xff) diff --git a/drivers/staging/vc04_services/interface/vchi/TODO b/drivers/staging/vc04_services/interface/TODO similarity index 100% rename from drivers/staging/vc04_services/interface/vchi/TODO rename to drivers/staging/vc04_services/interface/TODO diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h b/drivers/staging/vc04_services/interface/vchi/vchi.h deleted file mode 100644 index 6de5df43cc29..000000000000 --- a/drivers/staging/vc04_services/interface/vchi/vchi.h +++ /dev/null @@ -1,59 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ -/* Copyright (c) 2010-2012 Broadcom. All rights reserved. */ - -#ifndef VCHI_H_ -#define VCHI_H_ - -/****************************************************************************** - * Global funcs - implementation is specific to which side you are on - * (local / remote) - *****************************************************************************/ - -// Routine used to initialise the vchi on both local + remote connections -extern int32_t vchi_initialise(struct vchiq_instance **instance); - -extern int32_t vchi_connect(struct vchiq_instance *instance); - -//When this is called, ensure that all services have no data pending. -//Bulk transfers can remain 'queued' -extern int32_t vchi_disconnect(struct vchiq_instance *instance); - -/****************************************************************************** - * Global service API - *****************************************************************************/ -// Routine to open a named service -extern int vchi_service_open(struct vchiq_instance *instance, - struct vchiq_service_params *params, - unsigned *handle); - -extern int32_t vchi_get_peer_version(unsigned handle, short *peer_version); - -// Routine to close a named service -extern int32_t vchi_service_close(unsigned handle); - -// Routine to increment ref count on a named service -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 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. -struct vchiq_header *vchi_msg_hold(unsigned handle); - -/******************************************************************************* - * Global service support API - operations on held messages - * and message iterators - ******************************************************************************/ - -// Routine to release a held message after it has been processed -extern int32_t vchi_held_msg_release(unsigned handle, struct vchiq_header *message); - -/****************************************************************************** - * Configuration plumbing - *****************************************************************************/ - -#endif /* VCHI_H_ */ - -/****************************** End of file **********************************/ 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 524128225766..f266d5a3a7a5 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c @@ -2576,6 +2576,7 @@ vchiq_use_service(unsigned int handle) } return ret; } +EXPORT_SYMBOL(vchiq_use_service); enum vchiq_status vchiq_release_service(unsigned int handle) @@ -2589,6 +2590,7 @@ vchiq_release_service(unsigned int handle) } return ret; } +EXPORT_SYMBOL(vchiq_release_service); struct service_data_struct { int fourcc; 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 ee11707b7476..a0525edc3093 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c @@ -2946,6 +2946,7 @@ vchiq_close_service(unsigned int handle) return status; } +EXPORT_SYMBOL(vchiq_close_service); enum vchiq_status vchiq_remove_service(unsigned int handle) @@ -3268,6 +3269,7 @@ vchiq_release_message(unsigned int handle, unlock_service(service); } +EXPORT_SYMBOL(vchiq_release_message); static void release_message_sync(struct vchiq_state *state, struct vchiq_header *header) @@ -3294,6 +3296,7 @@ vchiq_get_peer_version(unsigned int handle, short *peer_version) unlock_service(service); return status; } +EXPORT_SYMBOL(vchiq_get_peer_version); void vchiq_get_config(struct vchiq_config *config) { diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c deleted file mode 100644 index 57ac6a289a08..000000000000 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c +++ /dev/null @@ -1,179 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause -/* Copyright (c) 2010-2012 Broadcom. All rights reserved. */ -#include -#include -#include -#include - -#include "vchiq_if.h" -#include "../vchi/vchi.h" -#include "vchiq.h" - -/*********************************************************** - * Name: vchi_held_msg_release - * - * Arguments: unsgined handle - * struct vchiq_header *message - * - * Description: Routine to release a held message (after it has been read with - * vchi_msg_hold) - * - * Returns: int - success == 0 - * - ***********************************************************/ -int vchi_held_msg_release(unsigned handle, struct vchiq_header *message) -{ - /* - * Convert the service field pointer back to an - * unsigned int which is an int. - * This pointer is opaque to everything except - * vchi_msg_hold which simply upcasted the int - * to a pointer. - */ - - vchiq_release_message(handle, message); - - return 0; -} -EXPORT_SYMBOL(vchi_held_msg_release); - -/*********************************************************** - * Name: vchi_msg_hold - * - * Arguments: struct vchi_service *service, - * void **data, - * unsigned *msg_size, - * struct vchiq_header **message - * - * Description: Routine to return a pointer to the current message (to allow - * in place processing). The message is dequeued - don't forget - * to release the message using vchi_held_msg_release when you're - * finished. - * - * Returns: int - success == 0 - * - ***********************************************************/ -struct vchiq_header *vchi_msg_hold(unsigned handle) -{ - return vchiq_msg_hold(handle); -} -EXPORT_SYMBOL(vchi_msg_hold); - -/*********************************************************** - * Name: vchi_initialise - * - * Arguments: struct vchiq_instance **instance - * - * Description: Initialises the hardware but does not transmit anything - * When run as a Host App this will be called twice hence the need - * to malloc the state information - * - * Returns: 0 if successful, failure otherwise - * - ***********************************************************/ - -int vchi_initialise(struct vchiq_instance **instance) -{ - return vchiq_initialise(instance); -} -EXPORT_SYMBOL(vchi_initialise); - -/*********************************************************** - * Name: vchi_connect - * - * Arguments: struct vchiq_instance *instance - * - * Description: Starts the command service on each connection, - * causing INIT messages to be pinged back and forth - * - * Returns: 0 if successful, failure otherwise - * - ***********************************************************/ -int vchi_connect(struct vchiq_instance *instance) -{ - return vchiq_connect(instance); -} -EXPORT_SYMBOL(vchi_connect); - -/*********************************************************** - * Name: vchi_disconnect - * - * Arguments: struct vchiq_instance *instance - * - * Description: Stops the command service on each connection, - * causing DE-INIT messages to be pinged back and forth - * - * Returns: 0 if successful, failure otherwise - * - ***********************************************************/ -int vchi_disconnect(struct vchiq_instance *instance) -{ - return vchiq_shutdown(instance); -} -EXPORT_SYMBOL(vchi_disconnect); - -/*********************************************************** - * Name: vchi_service_open - * Name: vchi_service_create - * - * Arguments: struct vchiq_instance *instance - * struct service_creation *setup, - * unsigned *handle - * - * Description: Routine to open a service - * - * Returns: int - success == 0 - * - ***********************************************************/ - -int vchi_service_open(struct vchiq_instance *instance, - struct vchiq_service_params *params, - unsigned *handle) -{ - return vchiq_open_service(instance, params, handle); -} -EXPORT_SYMBOL(vchi_service_open); - -int vchi_service_close(unsigned handle) -{ - return vchiq_close_service(handle); -} -EXPORT_SYMBOL(vchi_service_close); - -int vchi_get_peer_version(unsigned handle, short *peer_version) -{ - return vchiq_get_peer_version(handle, peer_version); -} -EXPORT_SYMBOL(vchi_get_peer_version); - -/*********************************************************** - * Name: vchi_service_use - * - * Arguments: unsigned handle - * - * Description: Routine to increment refcount on a service - * - * Returns: void - * - ***********************************************************/ -int vchi_service_use(unsigned handle) -{ - return vchiq_use_service(handle); -} -EXPORT_SYMBOL(vchi_service_use); - -/*********************************************************** - * Name: vchi_service_release - * - * Arguments: unsigned handle - * - * Description: Routine to decrement refcount on a service - * - * Returns: void - * - ***********************************************************/ -int vchi_service_release(unsigned handle) -{ - return vchiq_release_service(handle); -} -EXPORT_SYMBOL(vchi_service_release); diff --git a/drivers/staging/vc04_services/vc-sm-cma/vc_sm.c b/drivers/staging/vc04_services/vc-sm-cma/vc_sm.c index fcef607e9446..572068538a4c 100644 --- a/drivers/staging/vc04_services/vc-sm-cma/vc_sm.c +++ b/drivers/staging/vc04_services/vc-sm-cma/vc_sm.c @@ -1516,7 +1516,7 @@ static void vc_sm_connected_init(void) * Initialize and create a VCHI connection for the shared memory service * running on videocore. */ - ret = vchi_initialise(&instance); + ret = vchiq_initialise(&instance); if (ret) { pr_err("[%s]: failed to initialise VCHI instance (ret=%d)\n", __func__, ret); @@ -1524,7 +1524,7 @@ static void vc_sm_connected_init(void) return; } - ret = vchi_connect(instance); + ret = vchiq_connect(instance); if (ret) { pr_err("[%s]: failed to connect VCHI instance (ret=%d)\n", __func__, ret); diff --git a/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c b/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c index dc8c469b37d2..1ff165c05706 100644 --- a/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c +++ b/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c @@ -183,13 +183,13 @@ static int vc_sm_cma_vchi_videocore_io(void *arg) while (1) { if (svc_use) - vchi_service_release(instance->service_handle); + vchiq_release_service(instance->service_handle); svc_use = 0; if (wait_for_completion_interruptible(&instance->io_cmplt)) continue; - vchi_service_use(instance->service_handle); + vchiq_use_service(instance->service_handle); svc_use = 1; do { @@ -234,7 +234,7 @@ static int vc_sm_cma_vchi_videocore_io(void *arg) } while (1); while (1) { - message = vchi_msg_hold(instance->service_handle); + message = vchiq_msg_hold(instance->service_handle); if (!message) break; reply = (struct vc_sm_result_t *)message->data; @@ -250,7 +250,7 @@ static int vc_sm_cma_vchi_videocore_io(void *arg) reply_len); } - vchi_held_msg_release(instance->service_handle, message); + vchiq_release_message(instance->service_handle, message); } /* Go through the dead list and free them */ @@ -323,7 +323,8 @@ struct sm_instance *vc_sm_cma_vchi_init(struct vchiq_instance *vchiq_instance, params.userdata = instance; /* Open the VCHI service connections */ - status = vchi_service_open(vchiq_instance, ¶ms, &instance->service_handle); + status = vchiq_open_service(vchiq_instance, ¶ms, + &instance->service_handle); if (status) { pr_err("%s: failed to open VCHI service (%d)", __func__, status); @@ -347,7 +348,7 @@ struct sm_instance *vc_sm_cma_vchi_init(struct vchiq_instance *vchiq_instance, return instance; err_close_services: - vchi_service_close(instance->service_handle); + vchiq_close_service(instance->service_handle); kfree(instance); pr_debug("%s: FAILED", __func__); return NULL; @@ -369,8 +370,8 @@ int vc_sm_cma_vchi_stop(struct sm_instance **handle) instance = *handle; - vchi_service_use(instance->service_handle); - vchi_service_close(instance->service_handle); + vchiq_use_service(instance->service_handle); + vchiq_close_service(instance->service_handle); kfree(instance); diff --git a/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.h b/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.h index 09ef0fc59566..ba86610b8d3f 100644 --- a/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.h +++ b/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.h @@ -13,8 +13,6 @@ #ifndef __VC_SM_CMA_VCHI_H__INCLUDED__ #define __VC_SM_CMA_VCHI_H__INCLUDED__ -#include "interface/vchi/vchi.h" - #include "vc_sm_defs.h" /* diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c index 664547c8e4a9..c5f59d71badf 100644 --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c @@ -33,7 +33,6 @@ #include "vc-sm-cma/vc_sm_knl.h" #include "interface/vchiq_arm/vchiq_if.h" -#include "interface/vchi/vchi.h" /* * maximum number of components supported. @@ -292,7 +291,7 @@ static void buffer_to_host_work_cb(struct work_struct *work) /* Dummy receive to ensure the buffers remain in order */ len = 8; /* queue the bulk submission */ - vchi_service_use(instance->service_handle); + vchiq_use_service(instance->service_handle); ret = vchiq_bulk_receive(instance->service_handle, msg_context->u.bulk.buffer->buffer, /* Actual receive needs to be a multiple @@ -302,7 +301,7 @@ static void buffer_to_host_work_cb(struct work_struct *work) msg_context, VCHIQ_BULK_MODE_CALLBACK); - vchi_service_release(instance->service_handle); + vchiq_release_service(instance->service_handle); if (ret != 0) pr_err("%s: ctx: %p, vchiq_bulk_receive failed %d\n", @@ -450,13 +449,13 @@ buffer_from_host(struct vchiq_mmal_instance *instance, /* no payload in message */ m.u.buffer_from_host.payload_in_message = 0; - vchi_service_use(instance->service_handle); + vchiq_use_service(instance->service_handle); 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); + vchiq_release_service(instance->service_handle); return ret; } @@ -803,13 +802,13 @@ static int send_synchronous_mmal_msg(struct vchiq_mmal_instance *instance, DBG_DUMP_MSG(msg, (sizeof(struct mmal_msg_header) + payload_len), ">>> sync message"); - vchi_service_use(instance->service_handle); + vchiq_use_service(instance->service_handle); ret = vchiq_queue_kernel_message(instance->service_handle, msg, sizeof(struct mmal_msg_header) + payload_len); - vchi_service_release(instance->service_handle); + vchiq_release_service(instance->service_handle); if (ret) { pr_err("error %d queuing message\n", ret); @@ -2066,9 +2065,9 @@ int vchiq_mmal_finalise(struct vchiq_mmal_instance *instance) if (mutex_lock_interruptible(&instance->vchiq_mutex)) return -EINTR; - vchi_service_use(instance->service_handle); + vchiq_use_service(instance->service_handle); - status = vchi_service_close(instance->service_handle); + status = vchiq_close_service(instance->service_handle); if (status != 0) pr_err("mmal-vchiq: VCHIQ close failed\n"); @@ -2114,14 +2113,14 @@ int vchiq_mmal_init(struct vchiq_mmal_instance **out_instance) BUILD_BUG_ON(sizeof(struct mmal_port) != 64); /* create a vchi instance */ - status = vchi_initialise(&vchiq_instance); + status = vchiq_initialise(&vchiq_instance); if (status) { pr_err("Failed to initialise VCHI instance (status=%d)\n", status); return -EIO; } - status = vchi_connect(vchiq_instance); + status = vchiq_connect(vchiq_instance); if (status) { pr_err("Failed to connect VCHI instance (status=%d)\n", status); return -EIO; @@ -2146,22 +2145,22 @@ int vchiq_mmal_init(struct vchiq_mmal_instance **out_instance) if (!instance->bulk_wq) goto err_free; - status = vchi_service_open(vchiq_instance, ¶ms, - &instance->service_handle); + status = vchiq_open_service(vchiq_instance, ¶ms, + &instance->service_handle); if (status) { pr_err("Failed to open VCHI service connection (status=%d)\n", status); goto err_close_services; } - vchi_service_release(instance->service_handle); + vchiq_release_service(instance->service_handle); *out_instance = instance; return 0; err_close_services: - vchi_service_close(instance->service_handle); + vchiq_close_service(instance->service_handle); destroy_workqueue(instance->bulk_wq); err_free: vfree(instance->bulk_scratch); From patchwork Wed May 27 11:53:52 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: 11572793 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 44CDE159A for ; Wed, 27 May 2020 12:12:50 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 23CC920657 for ; Wed, 27 May 2020 12:12:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="hKXgAx9C" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 23CC920657 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=bombadil.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=HBflz7FuPb5P1Iogvkw1LoxQemm1PujjvPxJW4ql5Kg=; b=hKXgAx9CQW9zWg JTe66uimHCM7Eoiq/i6uoDWPTmY5v+raas2o+mmtIXCJ+po/PiIyD7SXzAuWfkQAkmLFUoDBlBc9w d11sNXcKehc2Pp9wSC4GKq978BJs5fVtfHK3mUJnOzI14lJlrnzwYUhP1oVWs7pqwLpTjpxwYrF0Z jOZzu9ibEVAX6KbU4LmPMQXAKg6DzjKeEP5HNIIpfDbz06ZaY8ChLHVngL3KoKizsHj9cVf8aTjaM mrugereAXNkWpnbiFqCSL6MTeKqy/TYJFR4HhQ4PEF5tf4dNZWZoRIygQHl0w34h5+HOs77koPjiF 7xgRF72nmG6/BdljiakA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jduvK-0006Lw-KQ; Wed, 27 May 2020 12:12:42 +0000 Received: from mx2.suse.de ([195.135.220.15]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdueE-0007Iv-Hh; Wed, 27 May 2020 11:55:05 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id EDA56AFB1; Wed, 27 May 2020 11:55:02 +0000 (UTC) From: Nicolas Saenz Julienne To: bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [RFC 47/50] staging: vchiq: Move conditional barrier definition into vchiq_core.h Date: Wed, 27 May 2020 13:53:52 +0200 Message-Id: <20200527115400.31391-48-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527115400.31391-1-nsaenzjulienne@suse.de> References: <20200527115400.31391-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200527_045502_851643_FD8E7BA1 X-CRM114-Status: GOOD ( 10.59 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -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] 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [195.135.220.15 listed in wl.mailspike.net] -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, laurent.pinchart@ideasonboard.com, Nicolas Saenz Julienne , gregkh@linuxfoundation.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org The barrier is only used by core code. So keep the barrier definition in the core header. Signed-off-by: Nicolas Saenz Julienne --- .../vc04_services/interface/vchiq_arm/vchiq.h | 11 ----------- .../vc04_services/interface/vchiq_arm/vchiq_core.h | 12 ++++++++++++ 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq.h index 211b20705e36..57fe7d5e9a85 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq.h +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq.h @@ -6,15 +6,4 @@ #include "vchiq_if.h" -/* Do this so that we can test-build the code on non-rpi systems */ -#if IS_ENABLED(CONFIG_RASPBERRYPI_FIRMWARE) - -#else - -#ifndef dsb -#define dsb(a) -#endif - -#endif /* IS_ENABLED(CONFIG_RASPBERRYPI_FIRMWARE) */ - #endif 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 ff91c04ba6b9..15e9867f78f4 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h @@ -15,6 +15,18 @@ #include "vchiq.h" +/* Do this so that we can test-build the code on non-rpi systems */ +#if IS_ENABLED(CONFIG_RASPBERRYPI_FIRMWARE) + +#else + +#ifndef dsb +#define dsb(a) +#endif + +#endif /* IS_ENABLED(CONFIG_RASPBERRYPI_FIRMWARE) */ + + /* Run time control of log level, based on KERN_XXX level. */ #define VCHIQ_LOG_DEFAULT 4 #define VCHIQ_LOG_ERROR 3 From patchwork Wed May 27 11:53:53 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: 11572803 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 1F5DA90 for ; Wed, 27 May 2020 12:13:38 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id E48FA208B6 for ; Wed, 27 May 2020 12:13:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="GSQcvGhN" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E48FA208B6 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=bombadil.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=l4XpxQIOFuIyv+WvcxGtkrVzBpIVCo40OiELU9LQ7Kc=; b=GSQcvGhNi1HIqE zGyooQm2LNhtpqdyWbyrAr5Ch/RbBSkOkTy+zUwON69Cym5VMTrYg9S88CFEhPrnhjvInXQ2Edil+ JrwvAqabUcZkXYvajjFsxDHyKPFuppP0eHbw2DZTJpiiu0U0jkRNX72FgiSXXqc6hIe98cIf8iS/p U2E2IBCOlOCSCDIwt4D+7rk1RrDbmOayywjBC9V4tDMLZPGAycvtTBRI0CbaNp4rcaEUlTZa1TG3D Qq+QVpwuuXs60Eb4ag9rN74QUMsIPMbck2CxrOXwkXNJwtJM9S39jTw5EIqvHa3exhlDXaSqhRkCl aC/YjNP3MOqnljx6wOXw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jduw6-00073m-7M; Wed, 27 May 2020 12:13:30 +0000 Received: from mx2.suse.de ([195.135.220.15]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdueH-0007Km-3k; Wed, 27 May 2020 11:55:09 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 568A3AE44; Wed, 27 May 2020 11:55:04 +0000 (UTC) From: Nicolas Saenz Julienne To: bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Florian Fainelli , Ray Jui , Scott Branden , Nicolas Saenz Julienne Subject: [RFC 48/50] staging: vchiq: Use vchiq.h as the main header file for services Date: Wed, 27 May 2020 13:53:53 +0200 Message-Id: <20200527115400.31391-49-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527115400.31391-1-nsaenzjulienne@suse.de> References: <20200527115400.31391-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200527_045505_487642_3E12B6B8 X-CRM114-Status: GOOD ( 17.41 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -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] 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [195.135.220.15 listed in wl.mailspike.net] -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, laurent.pinchart@ideasonboard.com, linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org This used to be vchiq_if.h but vchiq.h is more concise for an include file that will hopefully be in the future in the includes directory. Signed-off-by: Nicolas Saenz Julienne --- .../vc04_services/bcm2835-audio/bcm2835.h | 2 +- .../vc04_services/interface/vchiq_arm/vchiq.h | 107 ++++++++++++++++- .../interface/vchiq_arm/vchiq_if.h | 109 ------------------ .../interface/vchiq_arm/vchiq_ioctl.h | 2 +- .../staging/vc04_services/vc-sm-cma/vc_sm.c | 2 +- .../vc04_services/vc-sm-cma/vc_sm_cma_vchi.c | 2 +- .../vc04_services/vchiq-mmal/mmal-vchiq.c | 2 +- 7 files changed, 108 insertions(+), 118 deletions(-) delete mode 100644 drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h b/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h index a15f251033ac..ca220f5230ec 100644 --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h @@ -9,7 +9,7 @@ #include #include #include -#include "interface/vchiq_arm/vchiq_if.h" +#include "interface/vchiq_arm/vchiq.h" #define MAX_SUBSTREAMS (8) #define AVAIL_SUBSTREAMS_MASK (0xff) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq.h index 57fe7d5e9a85..04b7ff41a025 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq.h +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq.h @@ -1,9 +1,108 @@ /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ /* Copyright (c) 2010-2012 Broadcom. All rights reserved. */ -#ifndef VCHIQ_VCHIQ_H -#define VCHIQ_VCHIQ_H +#ifndef VCHIQ_H +#define VCHIQ_H -#include "vchiq_if.h" +#define VCHIQ_SERVICE_HANDLE_INVALID 0 -#endif +#define VCHIQ_SLOT_SIZE 4096 +#define VCHIQ_MAX_MSG_SIZE (VCHIQ_SLOT_SIZE - sizeof(struct vchiq_header)) + +#define VCHIQ_MAKE_FOURCC(x0, x1, x2, x3) \ + (((x0) << 24) | ((x1) << 16) | ((x2) << 8) | (x3)) + +enum vchiq_reason { + VCHIQ_SERVICE_OPENED, /* service, -, - */ + VCHIQ_SERVICE_CLOSED, /* service, -, - */ + VCHIQ_MESSAGE_AVAILABLE, /* service, header, - */ + VCHIQ_BULK_TRANSMIT_DONE, /* service, -, bulk_userdata */ + VCHIQ_BULK_RECEIVE_DONE, /* service, -, bulk_userdata */ + VCHIQ_BULK_TRANSMIT_ABORTED, /* service, -, bulk_userdata */ + VCHIQ_BULK_RECEIVE_ABORTED /* service, -, bulk_userdata */ +}; + +enum vchiq_status { + VCHIQ_ERROR = -1, + VCHIQ_SUCCESS = 0, + VCHIQ_RETRY = 1 +}; + +enum vchiq_bulk_mode { + VCHIQ_BULK_MODE_CALLBACK, + VCHIQ_BULK_MODE_BLOCKING, + VCHIQ_BULK_MODE_NOCALLBACK, + VCHIQ_BULK_MODE_WAITING /* Reserved for internal use */ +}; + +enum vchiq_service_option { + VCHIQ_SERVICE_OPTION_AUTOCLOSE, + VCHIQ_SERVICE_OPTION_SLOT_QUOTA, + VCHIQ_SERVICE_OPTION_MESSAGE_QUOTA, + VCHIQ_SERVICE_OPTION_SYNCHRONOUS, + VCHIQ_SERVICE_OPTION_TRACE +}; + +struct vchiq_header { + /* The message identifier - opaque to applications. */ + int msgid; + + /* Size of message data. */ + unsigned int size; + + char data[0]; /* message */ +}; + +struct vchiq_element { + const void __user *data; + unsigned int size; +}; + +struct vchiq_service_base { + int fourcc; + enum vchiq_status (*callback)(enum vchiq_reason reason, + struct vchiq_header *header, + unsigned int handle, + void *bulk_userdata); + void *userdata; +}; + +struct vchiq_service_params { + int fourcc; + enum vchiq_status (*callback)(enum vchiq_reason reason, + struct vchiq_header *header, + unsigned int handle, + void *bulk_userdata); + void *userdata; + short version; /* Increment for non-trivial changes */ + short version_min; /* Update for incompatible changes */ +}; + +struct vchiq_instance; + +extern enum vchiq_status vchiq_initialise(struct vchiq_instance **pinstance); +extern enum vchiq_status vchiq_shutdown(struct vchiq_instance *instance); +extern enum vchiq_status vchiq_connect(struct vchiq_instance *instance); +extern enum vchiq_status vchiq_open_service(struct vchiq_instance *instance, + const struct vchiq_service_params *params, + unsigned int *pservice); +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 void vchiq_msg_queue_push(unsigned handle, struct vchiq_header *header); +extern void vchiq_release_message(unsigned int service, + struct vchiq_header *header); +extern int vchiq_queue_kernel_message(unsigned handle, void *data, + unsigned size); +extern enum vchiq_status vchiq_bulk_transmit(unsigned int service, + const void *data, unsigned int size, void *userdata, + enum vchiq_bulk_mode mode); +extern enum vchiq_status vchiq_bulk_receive(unsigned int service, + void *data, unsigned int size, void *userdata, + enum vchiq_bulk_mode mode); +extern void *vchiq_get_service_userdata(unsigned int service); +extern enum vchiq_status vchiq_get_peer_version(unsigned int handle, + short *peer_version); +extern struct vchiq_header *vchiq_msg_hold(unsigned handle); + +#endif /* VCHIQ_H */ diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h deleted file mode 100644 index 6374eda4ea0c..000000000000 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h +++ /dev/null @@ -1,109 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ -/* Copyright (c) 2010-2012 Broadcom. All rights reserved. */ - -#ifndef VCHIQ_IF_H -#define VCHIQ_IF_H - -#define VCHIQ_SERVICE_HANDLE_INVALID 0 - -#define VCHIQ_SLOT_SIZE 4096 -#define VCHIQ_MAX_MSG_SIZE (VCHIQ_SLOT_SIZE - sizeof(struct vchiq_header)) - -#define VCHIQ_MAKE_FOURCC(x0, x1, x2, x3) \ - (((x0) << 24) | ((x1) << 16) | ((x2) << 8) | (x3)) - -enum vchiq_reason { - VCHIQ_SERVICE_OPENED, /* service, -, - */ - VCHIQ_SERVICE_CLOSED, /* service, -, - */ - VCHIQ_MESSAGE_AVAILABLE, /* service, header, - */ - VCHIQ_BULK_TRANSMIT_DONE, /* service, -, bulk_userdata */ - VCHIQ_BULK_RECEIVE_DONE, /* service, -, bulk_userdata */ - VCHIQ_BULK_TRANSMIT_ABORTED, /* service, -, bulk_userdata */ - VCHIQ_BULK_RECEIVE_ABORTED /* service, -, bulk_userdata */ -}; - -enum vchiq_status { - VCHIQ_ERROR = -1, - VCHIQ_SUCCESS = 0, - VCHIQ_RETRY = 1 -}; - -enum vchiq_bulk_mode { - VCHIQ_BULK_MODE_CALLBACK, - VCHIQ_BULK_MODE_BLOCKING, - VCHIQ_BULK_MODE_NOCALLBACK, - VCHIQ_BULK_MODE_WAITING /* Reserved for internal use */ -}; - -enum vchiq_service_option { - VCHIQ_SERVICE_OPTION_AUTOCLOSE, - VCHIQ_SERVICE_OPTION_SLOT_QUOTA, - VCHIQ_SERVICE_OPTION_MESSAGE_QUOTA, - VCHIQ_SERVICE_OPTION_SYNCHRONOUS, - VCHIQ_SERVICE_OPTION_TRACE -}; - -struct vchiq_header { - /* The message identifier - opaque to applications. */ - int msgid; - - /* Size of message data. */ - unsigned int size; - - char data[0]; /* message */ -}; - -struct vchiq_element { - const void __user *data; - unsigned int size; -}; - -struct vchiq_service_base { - int fourcc; - enum vchiq_status (*callback)(enum vchiq_reason reason, - struct vchiq_header *header, - unsigned int handle, - void *bulk_userdata); - void *userdata; -}; - -struct vchiq_service_params { - int fourcc; - enum vchiq_status (*callback)(enum vchiq_reason reason, - struct vchiq_header *header, - unsigned int handle, - void *bulk_userdata); - void *userdata; - short version; /* Increment for non-trivial changes */ - short version_min; /* Update for incompatible changes */ -}; - -struct vchiq_instance; - -extern enum vchiq_status vchiq_initialise(struct vchiq_instance **pinstance); -extern enum vchiq_status vchiq_shutdown(struct vchiq_instance *instance); -extern enum vchiq_status vchiq_connect(struct vchiq_instance *instance); -extern enum vchiq_status vchiq_open_service(struct vchiq_instance *instance, - const struct vchiq_service_params *params, - unsigned int *pservice); -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 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); -extern enum vchiq_status vchiq_bulk_transmit(unsigned int service, - const void *data, unsigned int size, void *userdata, - enum vchiq_bulk_mode mode); -extern enum vchiq_status vchiq_bulk_receive(unsigned int service, - void *data, unsigned int size, void *userdata, - enum vchiq_bulk_mode mode); -extern void *vchiq_get_service_userdata(unsigned int service); -extern enum vchiq_status vchiq_get_peer_version(unsigned int handle, - short *peer_version); -extern void vchiq_msg_queue_push(unsigned handle, struct vchiq_header *header); -extern struct vchiq_header *vchiq_msg_hold(unsigned handle); - -#endif /* VCHIQ_IF_H */ diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h index 202889b3774f..f285d754ad28 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h @@ -5,7 +5,7 @@ #define VCHIQ_IOCTLS_H #include -#include "vchiq_if.h" +#include "vchiq.h" #define VCHIQ_IOC_MAGIC 0xc4 #define VCHIQ_INVALID_HANDLE (~0) diff --git a/drivers/staging/vc04_services/vc-sm-cma/vc_sm.c b/drivers/staging/vc04_services/vc-sm-cma/vc_sm.c index 572068538a4c..e4f7bdeef66d 100644 --- a/drivers/staging/vc04_services/vc-sm-cma/vc_sm.c +++ b/drivers/staging/vc04_services/vc-sm-cma/vc_sm.c @@ -48,7 +48,7 @@ #include #include -#include "vchiq_if.h" +#include "vchiq.h" #include "vchiq_connected.h" #include "vc_sm_cma_vchi.h" diff --git a/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c b/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c index 1ff165c05706..2c65416cd331 100644 --- a/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c +++ b/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c @@ -19,7 +19,7 @@ #include #include -#include "interface/vchiq_arm/vchiq_if.h" +#include "vchiq.h" #include "vc_sm_cma_vchi.h" #define VC_SM_VER 1 diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c index c5f59d71badf..2101b79780eb 100644 --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c @@ -32,7 +32,7 @@ #include "vc-sm-cma/vc_sm_knl.h" -#include "interface/vchiq_arm/vchiq_if.h" +#include "interface/vchiq_arm/vchiq.h" /* * maximum number of components supported. From patchwork Wed May 27 11:53:54 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: 11572805 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 321E290 for ; Wed, 27 May 2020 12:13:57 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 10B1020657 for ; Wed, 27 May 2020 12:13:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="eu38l8aw" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 10B1020657 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=bombadil.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=snROG70wpybT5POUcB+ZZ9mj6TXyLA3Ksl6FprvRThE=; b=eu38l8aw/7pCUa 3LeY/Dxv949WqVkz52hGMtpyGw+OJ3wQQFmU7oXxd9iJAJ+EIV3thcMze9CAcD5Y7HDVdcp+tbp0l D6xwitbP2qV9nKPjljqPCaBrniJEa+RvEuPNZOHG80QCZBcZaTeKrBZWJNsIRZQY6Whh0sYfv2rAe IwF+AO86Egcd5h8j1JOHlbX/OoC+ChF+dwNpVRa7Gx4jEN78l6S73m6QNUhDW095E41uICO10sP0m xCoOBnkZ5nJAai18DmTqeDd1n67i+if+0tkxYaJg1L/Nt/K+YFHnJK6PKo2nrFhb/zGHX/RHLvfqV 9AwSqW2pA1pL+ifWM24w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jduwS-0007NZ-FV; Wed, 27 May 2020 12:13:52 +0000 Received: from mx2.suse.de ([195.135.220.15]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdueI-0007NK-7N; Wed, 27 May 2020 11:55:08 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 43286ADE3; Wed, 27 May 2020 11:55:05 +0000 (UTC) From: Nicolas Saenz Julienne To: bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [RFC 49/50] staging: vchiq: Move defines into core header Date: Wed, 27 May 2020 13:53:54 +0200 Message-Id: <20200527115400.31391-50-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527115400.31391-1-nsaenzjulienne@suse.de> References: <20200527115400.31391-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200527_045506_452747_4D472777 X-CRM114-Status: GOOD ( 10.20 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -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] 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [195.135.220.15 listed in wl.mailspike.net] -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, laurent.pinchart@ideasonboard.com, Nicolas Saenz Julienne , gregkh@linuxfoundation.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Those are only used in the core vchiq code, while present in vchiq's 'public' API header. Move them into the right place. Signed-off-by: Nicolas Saenz Julienne --- drivers/staging/vc04_services/interface/vchiq_arm/vchiq.h | 5 ----- .../staging/vc04_services/interface/vchiq_arm/vchiq_core.h | 4 ++++ 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq.h index 04b7ff41a025..cb9ef9a4150b 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq.h +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq.h @@ -4,11 +4,6 @@ #ifndef VCHIQ_H #define VCHIQ_H -#define VCHIQ_SERVICE_HANDLE_INVALID 0 - -#define VCHIQ_SLOT_SIZE 4096 -#define VCHIQ_MAX_MSG_SIZE (VCHIQ_SLOT_SIZE - sizeof(struct vchiq_header)) - #define VCHIQ_MAKE_FOURCC(x0, x1, x2, x3) \ (((x0) << 24) | ((x1) << 16) | ((x2) << 8) | (x3)) 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 15e9867f78f4..8a27f3d7217e 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h @@ -26,6 +26,10 @@ #endif /* IS_ENABLED(CONFIG_RASPBERRYPI_FIRMWARE) */ +#define VCHIQ_SERVICE_HANDLE_INVALID 0 + +#define VCHIQ_SLOT_SIZE 4096 +#define VCHIQ_MAX_MSG_SIZE (VCHIQ_SLOT_SIZE - sizeof(struct vchiq_header)) /* Run time control of log level, based on KERN_XXX level. */ #define VCHIQ_LOG_DEFAULT 4 From patchwork Wed May 27 11:53:55 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: 11572807 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 39AD2159A for ; Wed, 27 May 2020 12:14:27 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 17A7D20657 for ; Wed, 27 May 2020 12:14:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Vo5usl04" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 17A7D20657 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=bombadil.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=gciXbU/g/Y57cd/Np5ByDBrCYToVcEVrVoZykYgtrFI=; b=Vo5usl04dZwegi yFsv3bO7JRJTFAMG51o+KFXxTFcFbiyCgsbyIn/rmV4K+rB+0MzvodnnhJzpKHwber6tX98uF4DNb ucpqMBGvSrZHWkfDr0vqnfC8bRhOB4QSHPgA4ZDrkrQQt2RFa/hjcLev2TErb6RxcDtwZjA725Ppn 1BxAAbxGWxQixtCpTVl3eHAgAsVf1QXtXPmrUxly0E2zZAI039MtJUYaT/9uoAW3+5/Sz9B5DihND GsuSVJtWc4Ork8EbJbmFvs6YracbaA8LoRMEvnHIcOR0PoWVO7AaDjKihlW3N+Yb028DAlQLAKoyv raSSqnNImmia9Kn68cyg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jduwl-0007bK-U9; Wed, 27 May 2020 12:14:11 +0000 Received: from mx2.suse.de ([195.135.220.15]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdueI-0007Ze-Qa; Wed, 27 May 2020 11:55:12 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id D415AAE2D; Wed, 27 May 2020 11:55:06 +0000 (UTC) From: Nicolas Saenz Julienne To: bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Nicolas Saenz Julienne , Florian Fainelli , Ray Jui , Scott Branden Subject: [RFC 50/50] staging: vchiq: Move vchiq.h into include directory Date: Wed, 27 May 2020 13:53:55 +0200 Message-Id: <20200527115400.31391-51-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527115400.31391-1-nsaenzjulienne@suse.de> References: <20200527115400.31391-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200527_045507_198276_A8670D56 X-CRM114-Status: GOOD ( 13.43 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -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] 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [195.135.220.15 listed in wl.mailspike.net] -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, laurent.pinchart@ideasonboard.com, linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org To make the separation clear between vchiq's header files and vchiq.h, which is to be used by services and is the 'public' API, move it into a dedicated includes directory. Signed-off-by: Nicolas Saenz Julienne --- drivers/staging/vc04_services/Makefile | 2 +- drivers/staging/vc04_services/bcm2835-audio/Makefile | 2 +- drivers/staging/vc04_services/bcm2835-audio/bcm2835.h | 2 +- .../{interface/vchiq_arm => include/linux/raspberrypi}/vchiq.h | 0 drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h | 2 +- .../staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h | 2 +- drivers/staging/vc04_services/vc-sm-cma/Makefile | 1 - drivers/staging/vc04_services/vc-sm-cma/vc_sm.c | 2 +- drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c | 2 +- drivers/staging/vc04_services/vchiq-mmal/Makefile | 1 + drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c | 3 +-- 11 files changed, 9 insertions(+), 10 deletions(-) rename drivers/staging/vc04_services/{interface/vchiq_arm => include/linux/raspberrypi}/vchiq.h (100%) diff --git a/drivers/staging/vc04_services/Makefile b/drivers/staging/vc04_services/Makefile index e32c0744e7fc..e1de39303ffe 100644 --- a/drivers/staging/vc04_services/Makefile +++ b/drivers/staging/vc04_services/Makefile @@ -14,5 +14,5 @@ obj-$(CONFIG_VIDEO_ISP_BCM2835) += bcm2835-isp/ obj-$(CONFIG_BCM_VC_SM_CMA) += vc-sm-cma/ obj-$(CONFIG_BCM2835_VCHIQ_MMAL) += vchiq-mmal/ -ccflags-y += -D__VCCOREVER__=0x04000000 +ccflags-y += -I $(srctree)/$(src)/include -D__VCCOREVER__=0x04000000 diff --git a/drivers/staging/vc04_services/bcm2835-audio/Makefile b/drivers/staging/vc04_services/bcm2835-audio/Makefile index 13fa6d7d9745..d59fe4dde615 100644 --- a/drivers/staging/vc04_services/bcm2835-audio/Makefile +++ b/drivers/staging/vc04_services/bcm2835-audio/Makefile @@ -2,4 +2,4 @@ obj-$(CONFIG_SND_BCM2835) += snd-bcm2835.o snd-bcm2835-objs := bcm2835.o bcm2835-ctl.o bcm2835-pcm.o bcm2835-vchiq.o -ccflags-y += -I $(srctree)/$(src)/.. -D__VCCOREVER__=0x04000000 +ccflags-y += -I $(srctree)/$(src)/../include -D__VCCOREVER__=0x04000000 diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h b/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h index ca220f5230ec..1b36475872d6 100644 --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h @@ -6,10 +6,10 @@ #include #include +#include #include #include #include -#include "interface/vchiq_arm/vchiq.h" #define MAX_SUBSTREAMS (8) #define AVAIL_SUBSTREAMS_MASK (0xff) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq.h b/drivers/staging/vc04_services/include/linux/raspberrypi/vchiq.h similarity index 100% rename from drivers/staging/vc04_services/interface/vchiq_arm/vchiq.h rename to drivers/staging/vc04_services/include/linux/raspberrypi/vchiq.h 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 8a27f3d7217e..e67692879249 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h @@ -10,10 +10,10 @@ #include #include #include +#include #include "vchiq_cfg.h" -#include "vchiq.h" /* Do this so that we can test-build the code on non-rpi systems */ #if IS_ENABLED(CONFIG_RASPBERRYPI_FIRMWARE) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h index f285d754ad28..3653fd99d8a1 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h @@ -5,7 +5,7 @@ #define VCHIQ_IOCTLS_H #include -#include "vchiq.h" +#include #define VCHIQ_IOC_MAGIC 0xc4 #define VCHIQ_INVALID_HANDLE (~0) diff --git a/drivers/staging/vc04_services/vc-sm-cma/Makefile b/drivers/staging/vc04_services/vc-sm-cma/Makefile index 77d173694fbf..c92a5775c62e 100644 --- a/drivers/staging/vc04_services/vc-sm-cma/Makefile +++ b/drivers/staging/vc04_services/vc-sm-cma/Makefile @@ -1,6 +1,5 @@ ccflags-y += \ -I$(srctree)/$(src)/../ \ - -I$(srctree)/$(src)/../interface/vchi \ -I$(srctree)/$(src)/../interface/vchiq_arm\ -I$(srctree)/$(src)/../include diff --git a/drivers/staging/vc04_services/vc-sm-cma/vc_sm.c b/drivers/staging/vc04_services/vc-sm-cma/vc_sm.c index e4f7bdeef66d..cc69ce932317 100644 --- a/drivers/staging/vc04_services/vc-sm-cma/vc_sm.c +++ b/drivers/staging/vc04_services/vc-sm-cma/vc_sm.c @@ -46,9 +46,9 @@ #include #include #include +#include #include -#include "vchiq.h" #include "vchiq_connected.h" #include "vc_sm_cma_vchi.h" diff --git a/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c b/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c index 2c65416cd331..8d8eda1a8142 100644 --- a/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c +++ b/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c @@ -18,8 +18,8 @@ #include #include #include +#include -#include "vchiq.h" #include "vc_sm_cma_vchi.h" #define VC_SM_VER 1 diff --git a/drivers/staging/vc04_services/vchiq-mmal/Makefile b/drivers/staging/vc04_services/vchiq-mmal/Makefile index f8164c33aec3..b2a830f48acc 100644 --- a/drivers/staging/vc04_services/vchiq-mmal/Makefile +++ b/drivers/staging/vc04_services/vchiq-mmal/Makefile @@ -5,4 +5,5 @@ obj-$(CONFIG_BCM2835_VCHIQ_MMAL) += bcm2835-mmal-vchiq.o ccflags-y += \ -I$(srctree)/$(src)/.. \ + -I$(srctree)/$(src)/../include \ -D__VCCOREVER__=0x04000000 diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c index 2101b79780eb..e057e21961d5 100644 --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include "mmal-common.h" @@ -32,8 +33,6 @@ #include "vc-sm-cma/vc_sm_knl.h" -#include "interface/vchiq_arm/vchiq.h" - /* * maximum number of components supported. * This matches the maximum permitted by default on the VPU