]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
drm/amdgpu: zero-initialize GART table on allocation
authorPhilip Yang <Philip.Yang@amd.com>
Mon, 27 Apr 2026 13:30:23 +0000 (09:30 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 5 May 2026 14:17:22 +0000 (10:17 -0400)
commite6c2e6c2e1fa066968a16aca1cb66cd1bdde7741
treedf0984e91ce3c2bae6f9ab386e42f3658fcbd416
parent78d2e624fa073c14970aa097adcf3ea31c157a66
drm/amdgpu: zero-initialize GART table on allocation

GART TLB is flushed after unmapping but not after mapping. Since
amdgpu_bo_create_kernel() does not zero-initialize the buffer, when a
single PTE is written the TLB may speculatively load other uninitialized
entries from the same cacheline. Those garbage entries can appear valid,
and a subsequent write to another PTE in the same cacheline may cause the
GPU to use a stale garbage PTE from the TLB.

Fix this by calling memset_io() to zero-initialize the GART table with
gart_pte_flags immediately after allocation.

Using AMDGPU_GEM_CREATE_VRAM_CLEARED, SDMA-based clear will not work
since SDMA needs GART to be initialized to work.

Suggested-by: Felix Kuehling <felix.kuehling@amd.com>
Signed-off-by: Philip Yang <Philip.Yang@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit d9af8263b82b6eaa60c5718e0c6631c5037e4b24)
Cc: stable@vger.kernel.org
drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c