Skip to content

Commit aa25c11

Browse files
ChristianKoenigAMDalexdeucher
authored andcommitted
drm/amdgpu: fix 4-level paging if GMC supports 57-bit VA v2
It turned that using 4 level page tables on GMC generations which support 57bit VAs actually doesn't work at all. Background is that the GMC actually can't switch between 4 and 5 levels, but rather just uses a subset of address space when less than 5 levels are selected. Philip already removed the automatically switch to 4levels, now fix it as well should it be enabled by module parameters. v2: fix AMDGPU_GMC_HOLE_MASK as well, fix off by one issue pointed out by Philip Signed-off-by: Christian König <christian.koenig@amd.com> Acked-by: Alex Deucher <alexander.deucher@amd.com> Reviewed-by: Philip Yang <philip.yang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent 096bb75 commit aa25c11

3 files changed

Lines changed: 6 additions & 4 deletions

File tree

drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@
3333
#include "amdgpu_ras.h"
3434

3535
/* VA hole for 48bit and 57bit addresses */
36-
#define AMDGPU_GMC_HOLE_START (adev->vm_manager.root_level == AMDGPU_VM_PDB3 ?\
36+
#define AMDGPU_GMC_HOLE_START (adev->vm_manager.max_level == 4 ?\
3737
0x0100000000000000ULL : 0x0000800000000000ULL)
38-
#define AMDGPU_GMC_HOLE_END (adev->vm_manager.root_level == AMDGPU_VM_PDB3 ?\
38+
#define AMDGPU_GMC_HOLE_END (adev->vm_manager.max_level == 4 ?\
3939
0xff00000000000000ULL : 0xffff800000000000ULL)
4040

4141
/*
@@ -45,8 +45,8 @@
4545
* This mask is used to remove the upper 16bits of the VA and so come up with
4646
* the linear addr value.
4747
*/
48-
#define AMDGPU_GMC_HOLE_MASK (adev->vm_manager.root_level == AMDGPU_VM_PDB3 ?\
49-
0x00ffffffffffffffULL : 0x0000ffffffffffffULL)
48+
#define AMDGPU_GMC_HOLE_MASK (adev->vm_manager.max_level == 4 ?\
49+
0x01ffffffffffffffULL : 0x0000ffffffffffffULL)
5050

5151
/*
5252
* Ring size as power of two for the log of recent faults.

drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2400,6 +2400,7 @@ void amdgpu_vm_adjust_size(struct amdgpu_device *adev, uint32_t min_vm_size,
24002400
}
24012401

24022402
adev->vm_manager.max_pfn = (uint64_t)vm_size << 18;
2403+
adev->vm_manager.max_level = max_level;
24032404

24042405
tmp = roundup_pow_of_two(adev->vm_manager.max_pfn);
24052406
if (amdgpu_vm_block_size != -1)

drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,7 @@ struct amdgpu_vm_manager {
456456
bool concurrent_flush;
457457

458458
uint64_t max_pfn;
459+
uint32_t max_level;
459460
uint32_t num_level;
460461
uint32_t block_size;
461462
uint32_t fragment_size;

0 commit comments

Comments
 (0)