Commit graph

6 commits

Author SHA1 Message Date
Samuel Pitoiset
a6e1316d03 add missing include to util_math.h
This fixes a build error with Tegra.

Fixes: 8cc2d09c ("amdgpu: reserve half of the addr space to implement a workaround for PRT")
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
2026-04-27 17:42:30 +02:00
Samuel Pitoiset
8cc2d09c29 amdgpu: reserve half of the addr space to implement a workaround for PRT
On GFX6-GFX12, except GFX9, SMEM loads on NULL PRT pages would just
fault and hang the GPU. The better workaround that we found is to split
the address space in two equal parts "LOW"/"HIGH", here's more details:

To workaround that, the driver splits the total VA space in half, so
that a single bit controls whether it's the "HIGH" or the "LOW"
address space. Every sparse residency buffer allocations that might
be used with SMEM get two allocations:

- the "HIGH" address space is mapped normally and its VA is returned
  to the application.
- the "LOW" address space is explicitly mapped to a zero-initialized
  buffer when it's allocated or when it's unmapped.

Other buffer allocations are always allocated in the "LOW" address.

The driver also creates a zero-allocated BO that will be used to map
partially resident buffers at creation and when explicitly unmapped.
The size is arbitrary but it seems that allocating 8MiB is perfectly
reasonable and fast enough in most cases. This BO is marked as
read-only for the GPU because the backend compilers don't use SMEM
stores.

For example this makes the "LOW" half of the HIGH VA range like
[0xffff800100000000,0xffffbfffffbfe000], and the "HIGH" half is left
for PRT.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
2026-04-27 09:59:32 +02:00
Tom Anderson
b06d71bb22 Fix build with -std=c11
typeof() is a GNU extension that will only work when the compiler is passed
-std=gnu*.  __typeof__() works with -std=c*, however.
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
2018-09-05 13:09:29 +01:00
Emil Velikov
6c88173f7e util_math: add MAX3 macro
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
2015-09-21 17:42:51 +01:00
Jammy Zhou
90e14d453a drm: fix the ALIGN macro to avoid value clamp
If the value is 64bit, but the alignment is 32bit type, the high 32bit
will be clamped with previous definition

Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
2015-08-05 13:47:52 -04:00
Alex Deucher
a3c89dda5b drm: add util_math.h
Used by amdgpu, could be used by other components.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2015-08-05 13:47:48 -04:00