]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
drm/amdgpu: cleanup VM fragment defines
authorChristian König <christian.koenig@amd.com>
Wed, 3 Aug 2016 15:46:42 +0000 (17:46 +0200)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 10 Aug 2016 18:05:30 +0000 (14:05 -0400)
We can actually do way more than just the 64KB we currently used as default.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu.h
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c

index 3b7330c3825f939b1570a7a0fab72d1ec7b5bea7..3d128c16334dc11e791847d3d2b66a0f366ab95a 100644 (file)
@@ -830,6 +830,9 @@ struct amdgpu_ring {
 /* PTBs (Page Table Blocks) need to be aligned to 32K */
 #define AMDGPU_VM_PTB_ALIGN_SIZE   32768
 
+/* LOG2 number of continuous pages for the fragment field */
+#define AMDGPU_LOG2_PAGES_PER_FRAG 4
+
 #define AMDGPU_PTE_VALID       (1 << 0)
 #define AMDGPU_PTE_SYSTEM      (1 << 1)
 #define AMDGPU_PTE_SNOOPED     (1 << 2)
@@ -840,10 +843,7 @@ struct amdgpu_ring {
 #define AMDGPU_PTE_READABLE    (1 << 5)
 #define AMDGPU_PTE_WRITEABLE   (1 << 6)
 
-/* PTE (Page Table Entry) fragment field for different page sizes */
-#define AMDGPU_PTE_FRAG_4KB    (0 << 7)
-#define AMDGPU_PTE_FRAG_64KB   (4 << 7)
-#define AMDGPU_LOG2_PAGES_PER_FRAG 4
+#define AMDGPU_PTE_FRAG(x)     ((x & 0x1f) << 7)
 
 /* How to programm VM fault handling */
 #define AMDGPU_VM_FAULT_STOP_NEVER     0
index 8e642fc48df45c665053a3b835d0abe803d7124b..ac209a51772bad46fd6be3cbca50b4493335b7a4 100644 (file)
@@ -739,7 +739,7 @@ static void amdgpu_vm_frag_ptes(struct amdgpu_device *adev,
         */
 
        /* SI and newer are optimized for 64KB */
-       uint64_t frag_flags = AMDGPU_PTE_FRAG_64KB;
+       uint64_t frag_flags = AMDGPU_PTE_FRAG(AMDGPU_LOG2_PAGES_PER_FRAG);
        uint64_t frag_align = 0x80;
 
        uint64_t frag_start = ALIGN(pe_start, frag_align);