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; }