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