public inbox for llvm@lists.linux.dev
 help / color / mirror / Atom feed
* [PATCH 2/3] drm/xe/mmio: fix build warning for BAR resize on 32-bit
       [not found] <20240224121528.1972719-1-arnd@kernel.org>
@ 2024-02-24 12:15 ` Arnd Bergmann
  2024-02-26  3:44   ` Lucas De Marchi
  0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2024-02-24 12:15 UTC (permalink / raw)
  To: Lucas De Marchi, Oded Gabbay, Thomas Hellström
  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,
	dri-devel, linux-kernel, llvm

From: Arnd Bergmann <arnd@arndb.de>

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 <arnd@arndb.de>
---
 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;
 	}
 
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 2/3] drm/xe/mmio: fix build warning for BAR resize on 32-bit
  2024-02-24 12:15 ` [PATCH 2/3] drm/xe/mmio: fix build warning for BAR resize on 32-bit Arnd Bergmann
@ 2024-02-26  3:44   ` Lucas De Marchi
  0 siblings, 0 replies; 2+ messages in thread
From: Lucas De Marchi @ 2024-02-26  3:44 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Oded Gabbay, Thomas Hellström, 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, dri-devel, linux-kernel, llvm

On Sat, Feb 24, 2024 at 01:15:00PM +0100, Arnd Bergmann wrote:
>From: Arnd Bergmann <arnd@arndb.de>
>
>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")

this second Fixes should not be here? How would "disabling 32bits build"
break 32bits build? I think just the first one is enough, otherwise
237412e45390 ("drm/xe: Enable 32bits build") is your next good
candidate.


Acked-by: Lucas De Marchi <lucas.demarchi@intel.com>

Lucas De Marchi

>Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>---
> 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;
> 	}
>
>-- 
>2.39.2
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-02-26  3:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20240224121528.1972719-1-arnd@kernel.org>
2024-02-24 12:15 ` [PATCH 2/3] drm/xe/mmio: fix build warning for BAR resize on 32-bit Arnd Bergmann
2024-02-26  3:44   ` Lucas De Marchi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox