From patchwork Wed Nov 29 11:33:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 13472712 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 95CABC4167B for ; Wed, 29 Nov 2023 11:38:37 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AFD7110E1AE; Wed, 29 Nov 2023 11:38:36 +0000 (UTC) Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7DD8D10E1AE for ; Wed, 29 Nov 2023 11:38:34 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by ams.source.kernel.org (Postfix) with ESMTP id B9FD3B83E0B; Wed, 29 Nov 2023 11:38:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 16BDCC433C7; Wed, 29 Nov 2023 11:38:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701257912; bh=MaraAAbR77wuMHigpLQ9a033vE+F6BEBFhIO1I4KWAY=; h=From:To:Cc:Subject:Date:From; b=VSoB2KAVDCk+9Fcrt6jgLi/HJKmeNyRK92hzWpS/g4wFGrOytNtwdVOzYm6HedTDU uZhxrUOBcYPPS5TN1jBAVH97NeymLIGQPH5RysCgf3kZjNhjoTcJDXlm1/Mb28ixle mkOhxosewvvccPKOanB6sOWYyHr1eWf2n8Az4JEsWfO2VE0Q/+uxC5bmy4A1CrtIOL vboj7S5a45n253tiJsOxczk3znUpF4ab3V9zbTeTgGrxjt1yR9EmnpEUCV5RSWRwp0 f9shJH9pZ5eIx5IWYyYU/xcwfznxVONhQHb5whxWDUrxvVN7axzGbOlNfpVppLQQWG GRd4kxYI30/rA== From: Arnd Bergmann To: Frank Binns , Donald Robson , Matt Coster Subject: [PATCH 1/2] drm/imagination: avoid -Wmissing-prototype warnings Date: Wed, 29 Nov 2023 12:33:07 +0100 Message-Id: <20231129113825.2961913-1-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sarah Walker , Thomas Zimmermann , Arnd Bergmann , linux-kernel@vger.kernel.org, Maxime Ripard , Boris Brezillon , Danilo Krummrich , dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Arnd Bergmann This warning option is now enabled by default, causing a few build regressions in combination with the newly added pvr driver: drivers/gpu/drm/imagination/pvr_device.c:130:6: error: no previous prototype for 'pvr_device_process_active_queues' [-Werror=missing-prototypes] 130 | void pvr_device_process_active_queues(struct pvr_device *pvr_dev) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/gpu/drm/imagination/pvr_fw_meta.c:33:1: error: no previous prototype for 'pvr_meta_cr_read32' [-Werror=missing-prototypes] 33 | pvr_meta_cr_read32(struct pvr_device *pvr_dev, u32 reg_addr, u32 *reg_value_out) | ^~~~~~~~~~~~~~~~~~ drivers/gpu/drm/imagination/pvr_vm.c:542:6: error: no previous prototype for 'pvr_gpuvm_free' [-Werror=missing-prototypes] 542 | void pvr_gpuvm_free(struct drm_gpuvm *gpuvm) Mark pvr_device_process_active_queues and pvr_gpuvm_free static as they are only used in the file they are defined in, and include the correct header for the pvr_meta_cr_read32 declaration. Fixes: eaf01ee5ba28 ("drm/imagination: Implement job submission and scheduling") Fixes: cc1aeedb98ad ("drm/imagination: Implement firmware infrastructure and META FW support") Fixes: ff5f643de0bf ("drm/imagination: Add GEM and VM related code") Signed-off-by: Arnd Bergmann --- drivers/gpu/drm/imagination/pvr_device.c | 2 +- drivers/gpu/drm/imagination/pvr_fw_meta.c | 1 + drivers/gpu/drm/imagination/pvr_vm.c | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/imagination/pvr_device.c b/drivers/gpu/drm/imagination/pvr_device.c index 8499becf4fbb..048eba776cf2 100644 --- a/drivers/gpu/drm/imagination/pvr_device.c +++ b/drivers/gpu/drm/imagination/pvr_device.c @@ -127,7 +127,7 @@ static int pvr_device_clk_init(struct pvr_device *pvr_dev) * This is called any time we receive a FW event. It iterates over all * active queues and calls pvr_queue_process() on them. */ -void pvr_device_process_active_queues(struct pvr_device *pvr_dev) +static void pvr_device_process_active_queues(struct pvr_device *pvr_dev) { struct pvr_queue *queue, *tmp_queue; LIST_HEAD(active_queues); diff --git a/drivers/gpu/drm/imagination/pvr_fw_meta.c b/drivers/gpu/drm/imagination/pvr_fw_meta.c index 119934c36184..c39beb70c317 100644 --- a/drivers/gpu/drm/imagination/pvr_fw_meta.c +++ b/drivers/gpu/drm/imagination/pvr_fw_meta.c @@ -4,6 +4,7 @@ #include "pvr_device.h" #include "pvr_fw.h" #include "pvr_fw_info.h" +#include "pvr_fw_meta.h" #include "pvr_gem.h" #include "pvr_rogue_cr_defs.h" #include "pvr_rogue_meta.h" diff --git a/drivers/gpu/drm/imagination/pvr_vm.c b/drivers/gpu/drm/imagination/pvr_vm.c index 2aab53594a77..30ecd7d7052e 100644 --- a/drivers/gpu/drm/imagination/pvr_vm.c +++ b/drivers/gpu/drm/imagination/pvr_vm.c @@ -539,7 +539,7 @@ pvr_device_addr_and_size_are_valid(struct pvr_vm_context *vm_ctx, (device_addr + size <= PVR_PAGE_TABLE_ADDR_SPACE_SIZE); } -void pvr_gpuvm_free(struct drm_gpuvm *gpuvm) +static void pvr_gpuvm_free(struct drm_gpuvm *gpuvm) { kfree(to_pvr_vm_context(gpuvm)); } From patchwork Wed Nov 29 11:33:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 13472713 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1328EC4167B for ; Wed, 29 Nov 2023 11:39:02 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6A1C310E1AF; Wed, 29 Nov 2023 11:39:01 +0000 (UTC) Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by gabe.freedesktop.org (Postfix) with ESMTPS id E959E10E1AF for ; Wed, 29 Nov 2023 11:38:57 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by ams.source.kernel.org (Postfix) with ESMTP id 3DCD5B83EAC; Wed, 29 Nov 2023 11:38:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E9FF8C433C8; Wed, 29 Nov 2023 11:38:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701257935; bh=ufry6q9U5ZmREMm6xuUdy9QV3vgImT5VbY3R0cMBVYU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aJvwWcWDK1PJDXxtbz3yC9wGeTMZuo3FPb8840B7EIqSF6i4F/8wPu5kDEiPa6ofB 6gbB2wmIIWfgoMhCftIjLXb7/KuO0LrK3d1KxMxXg0IKms07CXk79yngHABb0vMYpt a/jgli2lJ4CBc2IWCB38u8uc9LSXoPISRDpvRIRn6n4aww9Pu54+qYRwIGgjE+tDxd L3xYxJD+ReUT6ltL47ZihjKKrSxnut15Dxfzk8IDZW9kD491OvfvB2a6180IcBOPIz Bm/RXJmP0eSaHBF9z9aDiiWmutNvi5PkdrdW9a0ykMjvCALbPuMOCvpMGBv3TMpNaf MSwNSDBGCoCAw== From: Arnd Bergmann To: Frank Binns , Donald Robson , Matt Coster Subject: [PATCH 2/2] drm/imagination: avoid -Woverflow warning Date: Wed, 29 Nov 2023 12:33:08 +0100 Message-Id: <20231129113825.2961913-2-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231129113825.2961913-1-arnd@kernel.org> References: <20231129113825.2961913-1-arnd@kernel.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sarah Walker , Thomas Zimmermann , Arnd Bergmann , linux-kernel@vger.kernel.org, Maxime Ripard , dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Arnd Bergmann The array size calculation in pvr_vm_mips_fini() appears to be incorrect based on taking the size of the pointer rather than the size of the array, which manifests as a warning about signed integer overflow: In file included from include/linux/kernel.h:16, from drivers/gpu/drm/imagination/pvr_rogue_fwif.h:10, from drivers/gpu/drm/imagination/pvr_ccb.h:7, from drivers/gpu/drm/imagination/pvr_device.h:7, from drivers/gpu/drm/imagination/pvr_vm_mips.c:4: drivers/gpu/drm/imagination/pvr_vm_mips.c: In function 'pvr_vm_mips_fini': include/linux/array_size.h:11:25: error: overflow in conversion from 'long unsigned int' to 'int' changes value from '18446744073709551615' to '-1' [-Werror=overflow] 11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) | ^ drivers/gpu/drm/imagination/pvr_vm_mips.c:106:24: note: in expansion of macro 'ARRAY_SIZE' 106 | for (page_nr = ARRAY_SIZE(mips_data->pt_pages) - 1; page_nr >= 0; page_nr--) { | ^~~~~~~~~~ Just use the number of array elements directly here, and in the corresponding init function for consistency. Fixes: 927f3e0253c1 ("drm/imagination: Implement MIPS firmware processor and MMU support") Signed-off-by: Arnd Bergmann Reviewed-by: Donald Robson --- drivers/gpu/drm/imagination/pvr_vm_mips.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/imagination/pvr_vm_mips.c b/drivers/gpu/drm/imagination/pvr_vm_mips.c index 7268cf6e630b..6c2e4cc4e6db 100644 --- a/drivers/gpu/drm/imagination/pvr_vm_mips.c +++ b/drivers/gpu/drm/imagination/pvr_vm_mips.c @@ -46,7 +46,7 @@ pvr_vm_mips_init(struct pvr_device *pvr_dev) if (!mips_data) return -ENOMEM; - for (page_nr = 0; page_nr < ARRAY_SIZE(mips_data->pt_pages); page_nr++) { + for (page_nr = 0; page_nr < PVR_MIPS_PT_PAGE_COUNT; page_nr++) { mips_data->pt_pages[page_nr] = alloc_page(GFP_KERNEL | __GFP_ZERO); if (!mips_data->pt_pages[page_nr]) { err = -ENOMEM; @@ -103,7 +103,7 @@ pvr_vm_mips_fini(struct pvr_device *pvr_dev) int page_nr; vunmap(mips_data->pt); - for (page_nr = ARRAY_SIZE(mips_data->pt_pages) - 1; page_nr >= 0; page_nr--) { + for (page_nr = PVR_MIPS_PT_PAGE_COUNT - 1; page_nr >= 0; page_nr--) { dma_unmap_page(from_pvr_device(pvr_dev)->dev, mips_data->pt_dma_addr[page_nr], PAGE_SIZE, DMA_TO_DEVICE);