From patchwork Sat Feb 24 12:14:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 13570392 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 CDFA6C54E4A for ; Sat, 24 Feb 2024 12:15:39 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C5C1910E13B; Sat, 24 Feb 2024 12:15:38 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="PRUsTOnO"; dkim-atps=neutral Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6B28A10E0F5; Sat, 24 Feb 2024 12:15:37 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 227B460AE2; Sat, 24 Feb 2024 12:15:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 468BBC433C7; Sat, 24 Feb 2024 12:15:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708776935; bh=GNq+evKLQVdJDM94sIz8nN00faZ597yvTUdvqvR4sM0=; h=From:To:Cc:Subject:Date:From; b=PRUsTOnOixxCx6+PhkNqgR6u7CrHGxeKdMmu0HhuiPwo8HX6cv+nHUn/nK/5AgwWZ qGWygkErblxxAjS9Znim/qclXfJGMDBUc8aQ0CNojOT6m/bU6Q2wonJlaCoD73YFOS u3l3ZiBiGeyCHT8imaBNwhyNW2oXV04YhilqCkZkfhfmNYpRIjrnveq/k53sKT7yu7 RHBRCafGsQQUcAkDy1BQY4Sm4tbyoqF1fD8XQBHXktLZoII/pogUvICy0mdH5y9jyw LKYX+yMqZeeyU1ksrLEeOBN4rBk6Rb87rM+upgv+WgowiHWxe03rKJs585KZt9iDdj WWUKYA7ZA4cWg== From: Arnd Bergmann To: Lucas De Marchi , Oded Gabbay , =?utf-8?q?Thomas_Hellstr=C3=B6m?= Cc: Arnd Bergmann , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Rodrigo Vivi , Matthew Brost , Francois Dugast , Jani Nikula , Tejas Upadhyay , Matthew Auld , Mauro Carvalho Chehab , Michal Wajdeczko , Matt Roper , Daniele Ceraolo Spurio , intel-xe@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/3] drm/xe/kunit: fix link failure with built-in xe Date: Sat, 24 Feb 2024 13:14:59 +0100 Message-Id: <20240224121528.1972719-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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Arnd Bergmann When the driver is built-in but the tests are in loadable modules, the helpers don't actually get put into the driver: ERROR: modpost: "xe_kunit_helper_alloc_xe_device" [drivers/gpu/drm/xe/tests/xe_test.ko] undefined! Change the Makefile to ensure they are always part of the driver even when the rest of the kunit tests are in loadable modules. The tests/xe_kunit_helpers.c file depends on DRM_KUNIT_TEST_HELPERS, so this has to always be selected by the main XE module now, rather than the actual tests. In turn, the "depends on (m || (y && KUNIT=y))" doesn't really do what it tried and can just be removed. Fixes: 5095d13d758b ("drm/xe/kunit: Define helper functions to allocate fake xe device") Signed-off-by: Arnd Bergmann --- drivers/gpu/drm/xe/Kconfig | 3 ++- drivers/gpu/drm/xe/Kconfig.debug | 1 - drivers/gpu/drm/xe/Makefile | 6 ++++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/xe/Kconfig b/drivers/gpu/drm/xe/Kconfig index 6d4428b19a4c..2948650680e1 100644 --- a/drivers/gpu/drm/xe/Kconfig +++ b/drivers/gpu/drm/xe/Kconfig @@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0-only config DRM_XE tristate "Intel Xe Graphics" - depends on DRM && PCI && MMU && (m || (y && KUNIT=y)) + depends on DRM && PCI && MMU depends on ACPI_VIDEO || !ACPI select INTERVAL_TREE # we need shmfs for the swappable backing store, and in particular @@ -11,6 +11,7 @@ config DRM_XE select DRM_BUDDY select DRM_EXEC select DRM_KMS_HELPER + select DRM_KUNIT_TEST_HELPERS if DRM_XE_KUNIT_TEST != n select DRM_PANEL select DRM_SUBALLOC_HELPER select DRM_DISPLAY_DP_HELPER diff --git a/drivers/gpu/drm/xe/Kconfig.debug b/drivers/gpu/drm/xe/Kconfig.debug index 549065f57a78..df02e5d17d26 100644 --- a/drivers/gpu/drm/xe/Kconfig.debug +++ b/drivers/gpu/drm/xe/Kconfig.debug @@ -76,7 +76,6 @@ config DRM_XE_KUNIT_TEST depends on DRM_XE && KUNIT && DEBUG_FS default KUNIT_ALL_TESTS select DRM_EXPORT_FOR_TESTS if m - select DRM_KUNIT_TEST_HELPERS help Choose this option to allow the driver to perform selftests under the kunit framework diff --git a/drivers/gpu/drm/xe/Makefile b/drivers/gpu/drm/xe/Makefile index 4c6ffe4b2172..b596e4482a9b 100644 --- a/drivers/gpu/drm/xe/Makefile +++ b/drivers/gpu/drm/xe/Makefile @@ -158,8 +158,10 @@ xe-$(CONFIG_PCI_IOV) += \ xe_lmtt_2l.o \ xe_lmtt_ml.o -xe-$(CONFIG_DRM_XE_KUNIT_TEST) += \ - tests/xe_kunit_helpers.o +# include helpers for tests even when XE is built-in +ifdef CONFIG_DRM_XE_KUNIT_TEST +xe-y += tests/xe_kunit_helpers.o +endif # i915 Display compat #defines and #includes subdir-ccflags-$(CONFIG_DRM_XE_DISPLAY) += \ From patchwork Sat Feb 24 12:15:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 13570393 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 0387BC54E49 for ; Sat, 24 Feb 2024 12:15:56 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id ED73410E145; Sat, 24 Feb 2024 12:15:54 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="JWj5D/Lb"; dkim-atps=neutral Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by gabe.freedesktop.org (Postfix) with ESMTPS id CB81E10E0F5; Sat, 24 Feb 2024 12:15:53 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 018A26090C; Sat, 24 Feb 2024 12:15:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A5597C433C7; Sat, 24 Feb 2024 12:15:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708776952; bh=oP261W1pt6YMYe8qcA9fKGIH4omThSFAKhryuBOrQu8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JWj5D/Lbhnfny8owmLC3lczUAT9S5jtD5sU8TU8QhGT26WP/1weK5cK8AHcWA5qEr vw/Vo5aAnO5uho3XszpE2+nui1H5lIahI6iktAdCxtURW4MTgc3+FC47zrxgJpQba4 H+c9EJ9Y+tW7ixHzdCopIHFqSPERkhYJ0ftNSQwkcoUVYF6PK4IPMVYJBjyiRpwSpP T8uzMrHbYhFjn1bgKF4r1bujG3jbzogaatVPGfE2j6OOHe3x0KCtdpnIYDzWmOCT2c zYLL3n+T6eH/0CWXMh2GovCRMWz1efiHBxRG8DZFfVoPXB1NA7ZXcEeV4d/LN1vZN1 bjOt1HAejD04g== From: Arnd Bergmann To: Lucas De Marchi , Oded Gabbay , =?utf-8?q?Thomas_Hellstr=C3=B6m?= Cc: Arnd Bergmann , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Rodrigo Vivi , Matt Roper , Matthew Auld , Matthew Brost , Koby Elbaz , "Michael J. Ruhl" , Francois Dugast , Dave Airlie , intel-xe@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: [PATCH 2/3] drm/xe/mmio: fix build warning for BAR resize on 32-bit Date: Sat, 24 Feb 2024 13:15:00 +0100 Message-Id: <20240224121528.1972719-2-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240224121528.1972719-1-arnd@kernel.org> References: <20240224121528.1972719-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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Arnd Bergmann clang complains about a nonsensical test on builds with a 32-bit phys_addr_t, which means resizing will always fail: drivers/gpu/drm/xe/xe_mmio.c:109:23: error: result of comparison of constant 4294967296 with expression of type 'resource_size_t' (aka 'unsigned int') is always false [-Werror,-Wtautological-constant-out-of-range-compare] 109 | root_res->start > 0x100000000ull) | ~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~ Previously, BAR resize was always disallowed on 32-bit kernels, but this apparently changed recently. Since 32-bit machines can in theory support PAE/LPAE for large address spaces, this may end up useful, so change the driver to shut up the warning but still work when phys_addr_t/resource_size_t is 64 bit wide. Fixes: 9a6e6c14bfde ("drm/xe/mmio: Use non-atomic writeq/readq variant for 32b") Fixes: ea97a66a2218 ("drm/xe: Disable 32bits build") Signed-off-by: Arnd Bergmann Acked-by: Lucas De Marchi --- drivers/gpu/drm/xe/xe_mmio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/xe/xe_mmio.c b/drivers/gpu/drm/xe/xe_mmio.c index e3db3a178760..7ba2477452d7 100644 --- a/drivers/gpu/drm/xe/xe_mmio.c +++ b/drivers/gpu/drm/xe/xe_mmio.c @@ -106,7 +106,7 @@ static void xe_resize_vram_bar(struct xe_device *xe) pci_bus_for_each_resource(root, root_res, i) { if (root_res && root_res->flags & (IORESOURCE_MEM | IORESOURCE_MEM_64) && - root_res->start > 0x100000000ull) + (u64)root_res->start > 0x100000000ul) break; } From patchwork Sat Feb 24 12:15:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 13570394 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 DF36DC54E4A for ; Sat, 24 Feb 2024 12:16:17 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 325A010E17F; Sat, 24 Feb 2024 12:16:17 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="XjL/ME58"; dkim-atps=neutral Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by gabe.freedesktop.org (Postfix) with ESMTPS id 18EBD10E0F5; Sat, 24 Feb 2024 12:16:15 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 40014CE2BF5; Sat, 24 Feb 2024 12:16:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C6462C433F1; Sat, 24 Feb 2024 12:16:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708776971; bh=FVqwkjBGiGZ+FrnuOmvhnP6hzKLmcnGCY/w4xZTohpY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XjL/ME582gBj+PnpaYTcAJdRjWCltO0ujLpFGlmYasM9RQuSkdzve0IpVw+2qvHrb 4oqTU1S+Iep91HOzIAgIb+hHbKAhsa9/b3uTFbcowMuARdI3FpC4SAwzG/DR+zo3CV aPrwkUhUDsQrdBsTyE5lAkwd3Rp5jpwNDIcIfx1X7WaWscenCVj97SVKk16zJe3L5U KF8z9/nNbY+1dQFiuJEnfp/+cJnxufDun68bUW1FNO2I8JVGO3cbkJ12p3x1s3Az1S IjrNd3LUfFkHv4PjvnnH+cDfNE5fHimeCIxJu5w8by24eFIaNEYMXmosPgkoyqsmSS MrYuj+UrUAwKQ== From: Arnd Bergmann To: Lucas De Marchi , Oded Gabbay , =?utf-8?q?Thomas_Hellstr=C3=B6m?= Cc: Arnd Bergmann , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Rodrigo Vivi , Matt Roper , Matthew Brost , Himal Prasad Ghimiray , Francois Dugast , Dave Airlie , intel-xe@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/3] drm/xe/xe2: fix 64-bit division in pte_update_size Date: Sat, 24 Feb 2024 13:15:01 +0100 Message-Id: <20240224121528.1972719-3-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240224121528.1972719-1-arnd@kernel.org> References: <20240224121528.1972719-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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Arnd Bergmann This function does not build on 32-bit targets when the compiler fails to reduce DIV_ROUND_UP() into a shift: ld.lld: error: undefined symbol: __aeabi_uldivmod >>> referenced by xe_migrate.c >>> drivers/gpu/drm/xe/xe_migrate.o:(pte_update_size) in archive vmlinux.a There are two instances in this function. Change the first to use an open-coded shift with the same behavior, and the second one to a 32-bit calculation, which is sufficient here as the size is never more than 2^32 pages (16TB). Fixes: ea97a66a2218 ("drm/xe: Disable 32bits build") Signed-off-by: Arnd Bergmann --- drivers/gpu/drm/xe/xe_migrate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/xe/xe_migrate.c b/drivers/gpu/drm/xe/xe_migrate.c index a66fdf2d2991..ee1bb938c493 100644 --- a/drivers/gpu/drm/xe/xe_migrate.c +++ b/drivers/gpu/drm/xe/xe_migrate.c @@ -462,7 +462,7 @@ static u32 pte_update_size(struct xe_migrate *m, } else { /* Clip L0 to available size */ u64 size = min(*L0, (u64)avail_pts * SZ_2M); - u64 num_4k_pages = DIV_ROUND_UP(size, XE_PAGE_SIZE); + u32 num_4k_pages = (size + XE_PAGE_SIZE - 1) >> XE_PTE_SHIFT; *L0 = size; *L0_ofs = xe_migrate_vm_addr(pt_ofs, 0);