linux-stable/drivers/gpu
Arnd Bergmann 014d15b8f3 drm/amdgpu: avoid integer overflow warning in amdgpu_device_resize_fb_bar()
[ Upstream commit 822130b5e8 ]

On 32-bit architectures comparing a resource against a value larger than
U32_MAX can cause a warning:

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:1344:18: 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]
                    res->start > 0x100000000ull)
                    ~~~~~~~~~~ ^ ~~~~~~~~~~~~~~

As gcc does not warn about this in dead code, add an IS_ENABLED() check at
the start of the function. This will always return success but not actually resize
the BAR on 32-bit architectures without high memory, which is exactly what
we want here, as the driver can fall back to bank switching the VRAM
access.

Fixes: 31b8adab32 ("drm/amdgpu: require a root bus window above 4GB for BAR resize")
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-09-23 10:48:02 +02:00
..
drm drm/amdgpu: avoid integer overflow warning in amdgpu_device_resize_fb_bar() 2023-09-23 10:48:02 +02:00
host1x gpu: host1x: Don't skip assigning syncpoints to channels 2023-03-11 16:31:40 +01:00
ipu-v3 gpu: ipu-v3: common: Add of_node_put() for reference returned by of_graph_get_port_by_id() 2023-03-11 16:31:39 +01:00
vga
Makefile