Skip to contentSkip to conversation

drm/amdgpu: remove extra root PD alignment

PATCH In review Christian König 3 participants 13 messages Aug 24, 2018 – Aug 27, 2018 7 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/5 drm/amdgpu: remove extra root PD alignment

Just another leftover from radeon.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 4 +---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 3 ---
 2 files changed, 1 insertion(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1 -3
index a6b1126c61fd..53ce9982a5ee 100644
@@ -2566,8 +2566,6 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm,
 {
 	struct amdgpu_bo_param bp;
 	struct amdgpu_bo *root;
-	const unsigned align = min(AMDGPU_VM_PTB_ALIGN_SIZE,
-		AMDGPU_VM_PTE_COUNT(adev) * 8);
 	unsigned long size;
 	uint64_t flags;
 	int r, i;
@@ -2615,7 +2613,7 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm,
 	size = amdgpu_vm_bo_size(adev, adev->vm_manager.root_level);
 	memset(&bp, 0, sizeof(bp));
 	bp.size = size;
-	bp.byte_align = align;
+	bp.byte_align = AMDGPU_GPU_PAGE_SIZE;
 	bp.domain = AMDGPU_GEM_DOMAIN_VRAM;
 	bp.flags = flags;
 	bp.type = ttm_bo_type_kernel;
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h +0 -3
index 1162c2bf3138..1c9049feaaea 100644
@@ -48,9 +48,6 @@ struct amdgpu_bo_list_entry;
 /* number of entries in page table */
 #define AMDGPU_VM_PTE_COUNT(adev) (1 << (adev)->vm_manager.block_size)
 
-/* PTBs (Page Table Blocks) need to be aligned to 32K */
-#define AMDGPU_VM_PTB_ALIGN_SIZE   32768
-
 #define AMDGPU_PTE_VALID	(1ULL << 0)
 #define AMDGPU_PTE_SYSTEM	(1ULL << 1)
 #define AMDGPU_PTE_SNOOPED	(1ULL << 2)
Signature · 6 lines
2.17.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 20180824142002.2315-1-christian.koenig-5C7GfCeVMHo@public.gmane.org

#2 lore raw

PATCH 2/5 drm/amdgpu: add helper for VM PD/PT allocation parameters v2

Add a helper function to figure them out only once.

v2: fix typo with memset

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 61 ++++++++++++--------------
 1 file changed, 28 insertions(+), 33 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +28 -33
index 53ce9982a5ee..d7ecbeb2f8a4 100644
@@ -446,6 +446,31 @@ static int amdgpu_vm_clear_bo(struct amdgpu_device *adev,
 	return r;
 }
 
+/**
+ * amdgpu_vm_bo_param - fill in parameters for PD/PT allocation
+ *
+ * @adev: amdgpu_device pointer
+ * @vm: requesting vm
+ * @bp: resulting BO allocation parameters
+ */
+static void amdgpu_vm_bo_param(struct amdgpu_device *adev, struct amdgpu_vm *vm,
+			       int level, struct amdgpu_bo_param *bp)
+{
+	memset(bp, 0, sizeof(*bp));
+
+	bp->size = amdgpu_vm_bo_size(adev, level);
+	bp->byte_align = AMDGPU_GPU_PAGE_SIZE;
+	bp->domain = AMDGPU_GEM_DOMAIN_VRAM;
+	bp->flags = AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS;
+	if (vm->use_cpu_for_update)
+		bp->flags |= AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED;
+	else
+		bp->flags |= AMDGPU_GEM_CREATE_SHADOW;
+	bp->type = ttm_bo_type_kernel;
+	if (vm->root.base.bo)
+		bp->resv = vm->root.base.bo->tbo.resv;
+}
+
 /**
  * amdgpu_vm_alloc_levels - allocate the PD/PT levels
  *
@@ -469,8 +494,8 @@ static int amdgpu_vm_alloc_levels(struct amdgpu_device *adev,
 				  unsigned level, bool ats)
 {
 	unsigned shift = amdgpu_vm_level_shift(adev, level);
+	struct amdgpu_bo_param bp;
 	unsigned pt_idx, from, to;
-	u64 flags;
 	int r;
 
 	if (!parent->entries) {
@@ -494,29 +519,14 @@ static int amdgpu_vm_alloc_levels(struct amdgpu_device *adev,
 	saddr = saddr & ((1 << shift) - 1);
 	eaddr = eaddr & ((1 << shift) - 1);
 
-	flags = AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS;
-	if (vm->use_cpu_for_update)
-		flags |= AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED;
-	else
-		flags |= (AMDGPU_GEM_CREATE_NO_CPU_ACCESS |
-				AMDGPU_GEM_CREATE_SHADOW);
+	amdgpu_vm_bo_param(adev, vm, level, &bp);
 
 	/* walk over the address space and allocate the page tables */
 	for (pt_idx = from; pt_idx <= to; ++pt_idx) {
-		struct reservation_object *resv = vm->root.base.bo->tbo.resv;
 		struct amdgpu_vm_pt *entry = &parent->entries[pt_idx];
 		struct amdgpu_bo *pt;
 
 		if (!entry->base.bo) {
-			struct amdgpu_bo_param bp;
-
-			memset(&bp, 0, sizeof(bp));
-			bp.size = amdgpu_vm_bo_size(adev, level);
-			bp.byte_align = AMDGPU_GPU_PAGE_SIZE;
-			bp.domain = AMDGPU_GEM_DOMAIN_VRAM;
-			bp.flags = flags;
-			bp.type = ttm_bo_type_kernel;
-			bp.resv = resv;
 			r = amdgpu_bo_create(adev, &bp, &pt);
 			if (r)
 				return r;
@@ -2566,8 +2576,6 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm,
 {
 	struct amdgpu_bo_param bp;
 	struct amdgpu_bo *root;
-	unsigned long size;
-	uint64_t flags;
 	int r, i;
 
 	vm->va = RB_ROOT_CACHED;
@@ -2604,20 +2612,7 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm,
 		  "CPU update of VM recommended only for large BAR system\n");
 	vm->last_update = NULL;
 
-	flags = AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS;
-	if (vm->use_cpu_for_update)
-		flags |= AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED;
-	else
-		flags |= AMDGPU_GEM_CREATE_SHADOW;
-
-	size = amdgpu_vm_bo_size(adev, adev->vm_manager.root_level);
-	memset(&bp, 0, sizeof(bp));
-	bp.size = size;
-	bp.byte_align = AMDGPU_GPU_PAGE_SIZE;
-	bp.domain = AMDGPU_GEM_DOMAIN_VRAM;
-	bp.flags = flags;
-	bp.type = ttm_bo_type_kernel;
-	bp.resv = NULL;
+	amdgpu_vm_bo_param(adev, vm, adev->vm_manager.root_level, &bp);
 	r = amdgpu_bo_create(adev, &bp, &root);
 	if (r)
 		goto error_free_sched_entity;
Signature · 6 lines
2.17.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 20180824142002.2315-2-christian.koenig-5C7GfCeVMHo@public.gmane.org

Reviewed-by
#4 lore raw

Re: [PATCH 2/5] drm/amdgpu: add helper for VM PD/PT allocation parameters v2

Quoted 7 lines · Christian König

Add a helper function to figure them out only once.

v2: fix typo with memset

Quoted 115 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 61 ++++++++++++--------------
 1 file changed, 28 insertions(+), 33 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +28 -34
index 53ce9982a5ee..d7ecbeb2f8a4 100644
@@ -446,6 +446,31 @@ static int amdgpu_vm_clear_bo(struct amdgpu_device *adev,
        return r;
 }
 
+/**
+ * amdgpu_vm_bo_param - fill in parameters for PD/PT allocation
+ *
+ * @adev: amdgpu_device pointer
+ * @vm: requesting vm
+ * @bp: resulting BO allocation parameters
+ */
+static void amdgpu_vm_bo_param(struct amdgpu_device *adev, struct amdgpu_vm *vm,
+                              int level, struct amdgpu_bo_param *bp)
+{
+       memset(bp, 0, sizeof(*bp));
+
+       bp->size = amdgpu_vm_bo_size(adev, level);
+       bp->byte_align = AMDGPU_GPU_PAGE_SIZE;
+       bp->domain = AMDGPU_GEM_DOMAIN_VRAM;
+       bp->flags = AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS;
+       if (vm->use_cpu_for_update)
+               bp->flags |= AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED;
+       else
+               bp->flags |= AMDGPU_GEM_CREATE_SHADOW;
+       bp->type = ttm_bo_type_kernel;
+       if (vm->root.base.bo)
+               bp->resv = vm->root.base.bo->tbo.resv;
+}
+
 /**
  * amdgpu_vm_alloc_levels - allocate the PD/PT levels
  *
@@ -469,8 +494,8 @@ static int amdgpu_vm_alloc_levels(struct amdgpu_device *adev,
                                  unsigned level, bool ats)
 {
        unsigned shift = amdgpu_vm_level_shift(adev, level);
+       struct amdgpu_bo_param bp;
        unsigned pt_idx, from, to;
-       u64 flags;
        int r;
 
        if (!parent->entries) {
@@ -494,29 +519,14 @@ static int amdgpu_vm_alloc_levels(struct amdgpu_device *adev,
        saddr = saddr & ((1 << shift) - 1);
        eaddr = eaddr & ((1 << shift) - 1);
 
-       flags = AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS;
-       if (vm->use_cpu_for_update)
-               flags |= AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED;
-       else
-               flags |= (AMDGPU_GEM_CREATE_NO_CPU_ACCESS |
-                               AMDGPU_GEM_CREATE_SHADOW);
+       amdgpu_vm_bo_param(adev, vm, level, &bp);
 
        /* walk over the address space and allocate the page tables */
        for (pt_idx = from; pt_idx <= to; ++pt_idx) {
-               struct reservation_object *resv = vm->root.base.bo->tbo.resv;
                struct amdgpu_vm_pt *entry = &parent->entries[pt_idx];
                struct amdgpu_bo *pt;
 
                if (!entry->base.bo) {
-                       struct amdgpu_bo_param bp;
-
-                       memset(&bp, 0, sizeof(bp));
-                       bp.size = amdgpu_vm_bo_size(adev, level);
-                       bp.byte_align = AMDGPU_GPU_PAGE_SIZE;
-                       bp.domain = AMDGPU_GEM_DOMAIN_VRAM;
-                       bp.flags = flags;
-                       bp.type = ttm_bo_type_kernel;
-                       bp.resv = resv;
                        r = amdgpu_bo_create(adev, &bp, &pt);
                        if (r)
                                return r;
@@ -2566,8 +2576,6 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm,
 {
        struct amdgpu_bo_param bp;
        struct amdgpu_bo *root;
-       unsigned long size;
-       uint64_t flags;
        int r, i;
 
        vm->va = RB_ROOT_CACHED;
@@ -2604,20 +2612,7 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm,
                  "CPU update of VM recommended only for large BAR system\n");
        vm->last_update = NULL;
 
-       flags = AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS;
-       if (vm->use_cpu_for_update)
-               flags |= AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED;
-       else
-               flags |= AMDGPU_GEM_CREATE_SHADOW;
-
-       size = amdgpu_vm_bo_size(adev, adev->vm_manager.root_level);
-       memset(&bp, 0, sizeof(bp));
-       bp.size = size;
-       bp.byte_align = AMDGPU_GPU_PAGE_SIZE;
-       bp.domain = AMDGPU_GEM_DOMAIN_VRAM;
-       bp.flags = flags;
-       bp.type = ttm_bo_type_kernel;
-       bp.resv = NULL;
+       amdgpu_vm_bo_param(adev, vm, adev->vm_manager.root_level, &bp);
        r = amdgpu_bo_create(adev, &bp, &root);
        if (r)
                goto error_free_sched_entity;
--

2.17.1

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#5 lore raw

PATCH 3/5 drm/amdgpu: add GMC9 support for PDs/PTs in system memory

In reply to a message not in the archive

Add the necessary handling.

---
 drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +1 -1
index a82b3eb429e8..453bd7ea50e7 100644
@@ -560,7 +560,7 @@ static uint64_t gmc_v9_0_get_vm_pte_flags(struct amdgpu_device *adev,
 static void gmc_v9_0_get_vm_pde(struct amdgpu_device *adev, int level,
 				uint64_t *addr, uint64_t *flags)
 {
-	if (!(*flags & AMDGPU_PDE_PTE))
+	if (!(*flags & AMDGPU_PDE_PTE) && !(*flags & AMDGPU_PTE_SYSTEM))
 		*addr = adev->vm_manager.vram_base_offset + *addr -
 			adev->gmc.vram_start;
 	BUG_ON(*addr & 0xFFFF00000000003FULL);
Signature · 6 lines
2.17.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 20180824142002.2315-3-christian.koenig-5C7GfCeVMHo@public.gmane.org

Reviewed-by
#7 lore raw

Re: [PATCH 3/5] drm/amdgpu: add GMC9 support for PDs/PTs in system memory

Quoted 4 lines · Christian König

Add the necessary handling.

Quoted 20 lines
---
 drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +1 -2
index a82b3eb429e8..453bd7ea50e7 100644
@@ -560,7 +560,7 @@ static uint64_t gmc_v9_0_get_vm_pte_flags(struct amdgpu_device *adev,
 static void gmc_v9_0_get_vm_pde(struct amdgpu_device *adev, int level,
                                uint64_t *addr, uint64_t *flags)
 {
-       if (!(*flags & AMDGPU_PDE_PTE))
+       if (!(*flags & AMDGPU_PDE_PTE) && !(*flags & AMDGPU_PTE_SYSTEM))
                *addr = adev->vm_manager.vram_base_offset + *addr -
                        adev->gmc.vram_start;
        BUG_ON(*addr & 0xFFFF00000000003FULL);
--

2.17.1

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): CADnq5_OmN244thgd=RLJKAJfZCQtgBzctwn7XMPf6_Z=Kr7hBQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

Reviewed-by Junwei Zhang
#9 lore raw

Re: [PATCH 3/5] drm/amdgpu: add GMC9 support for PDs/PTs in system memory

Quoted 8 lines · Alex Deucher
Quoted 4 lines · Christian König

Add the necessary handling.

Quoted 21 lines
Quoted 21 lines
---
  drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +1 -2
index a82b3eb429e8..453bd7ea50e7 100644
@@ -560,7 +560,7 @@ static uint64_t gmc_v9_0_get_vm_pte_flags(struct amdgpu_device *adev,
  static void gmc_v9_0_get_vm_pde(struct amdgpu_device *adev, int level,
                                 uint64_t *addr, uint64_t *flags)
  {
-       if (!(*flags & AMDGPU_PDE_PTE))
+       if (!(*flags & AMDGPU_PDE_PTE) && !(*flags & AMDGPU_PTE_SYSTEM))
                 *addr = adev->vm_manager.vram_base_offset + *addr -
                         adev->gmc.vram_start;
         BUG_ON(*addr & 0xFFFF00000000003FULL);
--

2.17.1

Quoted 9 lines
Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#10 lore raw

PATCH 4/5 drm/amdgpu: add amdgpu_gmc_get_pde_for_bo helper

In reply to a message not in the archive

Helper to get the PDE for a PD/PT.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 37 +++++++++++++++++++++++--
 drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h |  2 ++
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 21 ++++++++++++--
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h |  1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c  |  4 +--
 5 files changed, 57 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +35 -2
index 36058feac64f..6f79ce108728 100644
@@ -26,6 +26,38 @@
 
 #include "amdgpu.h"
 
+/**
+ * amdgpu_gmc_get_pde_for_bo - get the PDE for a BO
+ *
+ * @bo: the BO to get the PDE for
+ * @level: the level in the PD hirarchy
+ * @addr: resulting addr
+ * @flags: resulting flags
+ *
+ * Get the address and flags to be used for a PDE.
+ */
+void amdgpu_gmc_get_pde_for_bo(struct amdgpu_bo *bo, int level,
+			       uint64_t *addr, uint64_t *flags)
+{
+	struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev);
+	struct ttm_dma_tt *ttm;
+
+	switch (bo->tbo.mem.mem_type) {
+	case TTM_PL_TT:
+		ttm = container_of(bo->tbo.ttm, struct ttm_dma_tt, ttm);
+		*addr = ttm->dma_address[0];
+		break;
+	case TTM_PL_VRAM:
+		*addr = amdgpu_bo_gpu_offset(bo);
+		break;
+	default:
+		*addr = 0;
+		break;
+	}
+	*flags = amdgpu_ttm_tt_pde_flags(bo->tbo.ttm, &bo->tbo.mem);
+	amdgpu_gmc_get_vm_pde(adev, level, addr, flags);
+}
+
 /**
  * amdgpu_gmc_pd_addr - return the address of the root directory
  *
@@ -35,13 +67,14 @@ uint64_t amdgpu_gmc_pd_addr(struct amdgpu_bo *bo)
 	struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev);
 	uint64_t pd_addr;
 
-	pd_addr = amdgpu_bo_gpu_offset(bo);
 	/* TODO: move that into ASIC specific code */
 	if (adev->asic_type >= CHIP_VEGA10) {
 		uint64_t flags = AMDGPU_PTE_VALID;
 
-		amdgpu_gmc_get_vm_pde(adev, -1, &pd_addr, &flags);
+		amdgpu_gmc_get_pde_for_bo(bo, -1, &pd_addr, &flags);
 		pd_addr |= flags;
+	} else {
+		pd_addr = amdgpu_bo_gpu_offset(bo);
 	}
 	return pd_addr;
 }
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h +2 -0
index 7c469cce0498..0d2c9f65ca13 100644
@@ -131,6 +131,8 @@ static inline bool amdgpu_gmc_vram_full_visible(struct amdgpu_gmc *gmc)
 	return (gmc->real_vram_size == gmc->visible_vram_size);
 }
 
+void amdgpu_gmc_get_pde_for_bo(struct amdgpu_bo *bo, int level,
+			       uint64_t *addr, uint64_t *flags);
 uint64_t amdgpu_gmc_pd_addr(struct amdgpu_bo *bo);
 
 #endif
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +18 -3
index eb08a03b82a0..72366643e3c2 100644
@@ -1428,13 +1428,14 @@ bool amdgpu_ttm_tt_is_readonly(struct ttm_tt *ttm)
 }
 
 /**
- * amdgpu_ttm_tt_pte_flags - Compute PTE flags for ttm_tt object
+ * amdgpu_ttm_tt_pde_flags - Compute PDE flags for ttm_tt object
  *
  * @ttm: The ttm_tt object to compute the flags for
  * @mem: The memory registry backing this ttm_tt object
+ *
+ * Figure out the flags to use for a VM PDE.
  */
-uint64_t amdgpu_ttm_tt_pte_flags(struct amdgpu_device *adev, struct ttm_tt *ttm,
-				 struct ttm_mem_reg *mem)
+uint64_t amdgpu_ttm_tt_pde_flags(struct ttm_tt *ttm, struct ttm_mem_reg *mem)
 {
 	uint64_t flags = 0;
 
@@ -1448,6 +1449,20 @@ uint64_t amdgpu_ttm_tt_pte_flags(struct amdgpu_device *adev, struct ttm_tt *ttm,
 			flags |= AMDGPU_PTE_SNOOPED;
 	}
 
+	return flags;
+}
+
+/**
+ * amdgpu_ttm_tt_pte_flags - Compute PTE flags for ttm_tt object
+ *
+ * @ttm: The ttm_tt object to compute the flags for
+ * @mem: The memory registry backing this ttm_tt object
+ */
+uint64_t amdgpu_ttm_tt_pte_flags(struct amdgpu_device *adev, struct ttm_tt *ttm,
+				 struct ttm_mem_reg *mem)
+{
+	uint64_t flags = amdgpu_ttm_tt_pde_flags(ttm, mem);
+
 	flags |= adev->gart.gart_pte_flags;
 	flags |= AMDGPU_PTE_READABLE;
 
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h +1 -0
index 8b3cc6687769..fe8f276e9811 100644
@@ -116,6 +116,7 @@ bool amdgpu_ttm_tt_userptr_invalidated(struct ttm_tt *ttm,
 				       int *last_invalidated);
 bool amdgpu_ttm_tt_userptr_needs_pages(struct ttm_tt *ttm);
 bool amdgpu_ttm_tt_is_readonly(struct ttm_tt *ttm);
+uint64_t amdgpu_ttm_tt_pde_flags(struct ttm_tt *ttm, struct ttm_mem_reg *mem);
 uint64_t amdgpu_ttm_tt_pte_flags(struct amdgpu_device *adev, struct ttm_tt *ttm,
 				 struct ttm_mem_reg *mem);
 
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1 -3
index d7ecbeb2f8a4..c951ebeac5fd 100644
@@ -992,9 +992,7 @@ static void amdgpu_vm_update_pde(struct amdgpu_pte_update_params *params,
 		pbo = pbo->parent;
 
 	level += params->adev->vm_manager.root_level;
-	pt = amdgpu_bo_gpu_offset(entry->base.bo);
-	flags = AMDGPU_PTE_VALID;
-	amdgpu_gmc_get_vm_pde(params->adev, level, &pt, &flags);
+	amdgpu_gmc_get_pde_for_bo(entry->base.bo, level, &pt, &flags);
 	pde = (entry - parent->entries) * 8;
 	if (bo->shadow)
 		params->func(params, bo->shadow, pde, pt, 1, 0, flags);
Signature · 6 lines
2.17.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 20180824142002.2315-4-christian.koenig-5C7GfCeVMHo@public.gmane.org

Reviewed-by
#12 lore raw

Re: [PATCH 4/5] drm/amdgpu: add amdgpu_gmc_get_pde_for_bo helper

Quoted 4 lines · Christian König

Helper to get the PDE for a PD/PT.

A few comments below. With those fixed:

Quoted 15 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 37 +++++++++++++++++++++++--
 drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h |  2 ++
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 21 ++++++++++++--
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h |  1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c  |  4 +--
 5 files changed, 57 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +0 -0
index 36058feac64f..6f79ce108728 100644
@@ -26,6 +26,38 @@
 
 #include "amdgpu.h"

drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c line 37

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +9 -0
 
+/**
+ * amdgpu_gmc_get_pde_for_bo - get the PDE for a BO
+ *
+ * @bo: the BO to get the PDE for
+ * @level: the level in the PD hirarchy
+ * @addr: resulting addr
+ * @flags: resulting flags
+ *
+ * Get the address and flags to be used for a PDE.

Define PDE (Page Directory Entry) to make it clear what it is.

Quoted 61 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +26 -2
+ */
+void amdgpu_gmc_get_pde_for_bo(struct amdgpu_bo *bo, int level,
+                              uint64_t *addr, uint64_t *flags)
+{
+       struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev);
+       struct ttm_dma_tt *ttm;
+
+       switch (bo->tbo.mem.mem_type) {
+       case TTM_PL_TT:
+               ttm = container_of(bo->tbo.ttm, struct ttm_dma_tt, ttm);
+               *addr = ttm->dma_address[0];
+               break;
+       case TTM_PL_VRAM:
+               *addr = amdgpu_bo_gpu_offset(bo);
+               break;
+       default:
+               *addr = 0;
+               break;
+       }
+       *flags = amdgpu_ttm_tt_pde_flags(bo->tbo.ttm, &bo->tbo.mem);
+       amdgpu_gmc_get_vm_pde(adev, level, addr, flags);
+}
+
 /**
  * amdgpu_gmc_pd_addr - return the address of the root directory
  *
@@ -35,13 +67,14 @@ uint64_t amdgpu_gmc_pd_addr(struct amdgpu_bo *bo)
        struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev);
        uint64_t pd_addr;
 
-       pd_addr = amdgpu_bo_gpu_offset(bo);
        /* TODO: move that into ASIC specific code */
        if (adev->asic_type >= CHIP_VEGA10) {
                uint64_t flags = AMDGPU_PTE_VALID;
 
-               amdgpu_gmc_get_vm_pde(adev, -1, &pd_addr, &flags);
+               amdgpu_gmc_get_pde_for_bo(bo, -1, &pd_addr, &flags);
                pd_addr |= flags;
+       } else {
+               pd_addr = amdgpu_bo_gpu_offset(bo);
        }
        return pd_addr;
 }
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h +2 -0
index 7c469cce0498..0d2c9f65ca13 100644
@@ -131,6 +131,8 @@ static inline bool amdgpu_gmc_vram_full_visible(struct amdgpu_gmc *gmc)
        return (gmc->real_vram_size == gmc->visible_vram_size);
 }
 
+void amdgpu_gmc_get_pde_for_bo(struct amdgpu_bo *bo, int level,
+                              uint64_t *addr, uint64_t *flags);
 uint64_t amdgpu_gmc_pd_addr(struct amdgpu_bo *bo);
 
 #endif
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +0 -0
index eb08a03b82a0..72366643e3c2 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c bool amdgpu_ttm_tt_is_readonly(struct ttm_tt *ttm) · line 1436

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +3 -1
@@ -1428,13 +1428,14 @@ bool amdgpu_ttm_tt_is_readonly(struct ttm_tt *ttm)
 }
 
 /**
- * amdgpu_ttm_tt_pte_flags - Compute PTE flags for ttm_tt object
+ * amdgpu_ttm_tt_pde_flags - Compute PDE flags for ttm_tt object
  *
  * @ttm: The ttm_tt object to compute the flags for
  * @mem: The memory registry backing this ttm_tt object
+ *
+ * Figure out the flags to use for a VM PDE.

Define PDE here as well.

Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1 -2
  */
-uint64_t amdgpu_ttm_tt_pte_flags(struct amdgpu_device *adev, struct ttm_tt *ttm,
-                                struct ttm_mem_reg *mem)
+uint64_t amdgpu_ttm_tt_pde_flags(struct ttm_tt *ttm, struct ttm_mem_reg *mem)
 {
        uint64_t flags = 0;
 
@@ -1448,6 +1449,20 @@ uint64_t amdgpu_ttm_tt_pte_flags(struct amdgpu_device *adev, struct ttm_tt *ttm,
                        flags |= AMDGPU_PTE_SNOOPED;

drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c uint64_t amdgpu_ttm_tt_pte_flags(struct amdgpu_device *adev, struct ttm_tt *ttm, · line 1459

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +8 -0
        }
 
+       return flags;
+}
+
+/**
+ * amdgpu_ttm_tt_pte_flags - Compute PTE flags for ttm_tt object
+ *
+ * @ttm: The ttm_tt object to compute the flags for
+ * @mem: The memory registry backing this ttm_tt object

Define PTE here and add a function description.

Quoted 39 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +6 -0
+ */
+uint64_t amdgpu_ttm_tt_pte_flags(struct amdgpu_device *adev, struct ttm_tt *ttm,
+                                struct ttm_mem_reg *mem)
+{
+       uint64_t flags = amdgpu_ttm_tt_pde_flags(ttm, mem);
+
        flags |= adev->gart.gart_pte_flags;
        flags |= AMDGPU_PTE_READABLE;
 
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h +1 -0
index 8b3cc6687769..fe8f276e9811 100644
@@ -116,6 +116,7 @@ bool amdgpu_ttm_tt_userptr_invalidated(struct ttm_tt *ttm,
                                       int *last_invalidated);
 bool amdgpu_ttm_tt_userptr_needs_pages(struct ttm_tt *ttm);
 bool amdgpu_ttm_tt_is_readonly(struct ttm_tt *ttm);
+uint64_t amdgpu_ttm_tt_pde_flags(struct ttm_tt *ttm, struct ttm_mem_reg *mem);
 uint64_t amdgpu_ttm_tt_pte_flags(struct amdgpu_device *adev, struct ttm_tt *ttm,
                                 struct ttm_mem_reg *mem);
 
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1 -4
index d7ecbeb2f8a4..c951ebeac5fd 100644
@@ -992,9 +992,7 @@ static void amdgpu_vm_update_pde(struct amdgpu_pte_update_params *params,
                pbo = pbo->parent;
 
        level += params->adev->vm_manager.root_level;
-       pt = amdgpu_bo_gpu_offset(entry->base.bo);
-       flags = AMDGPU_PTE_VALID;
-       amdgpu_gmc_get_vm_pde(params->adev, level, &pt, &flags);
+       amdgpu_gmc_get_pde_for_bo(entry->base.bo, level, &pt, &flags);
        pde = (entry - parent->entries) * 8;
        if (bo->shadow)
                params->func(params, bo->shadow, pde, pt, 1, 0, flags);
--

2.17.1

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reviewed-by Junwei Zhang
#13 lore raw

Re: [PATCH 4/5] drm/amdgpu: add amdgpu_gmc_get_pde_for_bo helper

In reply to a message not in the archive
Quoted 3 lines · Christian König

Helper to get the PDE for a PD/PT.

Quoted 142 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 37 +++++++++++++++++++++++--
  drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h |  2 ++
  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 21 ++++++++++++--
  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h |  1 +
  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c  |  4 +--
  5 files changed, 57 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +35 -2
index 36058feac64f..6f79ce108728 100644
@@ -26,6 +26,38 @@
 
  #include "amdgpu.h"
 
+/**
+ * amdgpu_gmc_get_pde_for_bo - get the PDE for a BO
+ *
+ * @bo: the BO to get the PDE for
+ * @level: the level in the PD hirarchy
+ * @addr: resulting addr
+ * @flags: resulting flags
+ *
+ * Get the address and flags to be used for a PDE.
+ */
+void amdgpu_gmc_get_pde_for_bo(struct amdgpu_bo *bo, int level,
+			       uint64_t *addr, uint64_t *flags)
+{
+	struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev);
+	struct ttm_dma_tt *ttm;
+
+	switch (bo->tbo.mem.mem_type) {
+	case TTM_PL_TT:
+		ttm = container_of(bo->tbo.ttm, struct ttm_dma_tt, ttm);
+		*addr = ttm->dma_address[0];
+		break;
+	case TTM_PL_VRAM:
+		*addr = amdgpu_bo_gpu_offset(bo);
+		break;
+	default:
+		*addr = 0;
+		break;
+	}
+	*flags = amdgpu_ttm_tt_pde_flags(bo->tbo.ttm, &bo->tbo.mem);
+	amdgpu_gmc_get_vm_pde(adev, level, addr, flags);
+}
+
  /**
   * amdgpu_gmc_pd_addr - return the address of the root directory
   *
@@ -35,13 +67,14 @@ uint64_t amdgpu_gmc_pd_addr(struct amdgpu_bo *bo)
  	struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev);
  	uint64_t pd_addr;
 
-	pd_addr = amdgpu_bo_gpu_offset(bo);
  	/* TODO: move that into ASIC specific code */
  	if (adev->asic_type >= CHIP_VEGA10) {
  		uint64_t flags = AMDGPU_PTE_VALID;
 
-		amdgpu_gmc_get_vm_pde(adev, -1, &pd_addr, &flags);
+		amdgpu_gmc_get_pde_for_bo(bo, -1, &pd_addr, &flags);
  		pd_addr |= flags;
+	} else {
+		pd_addr = amdgpu_bo_gpu_offset(bo);
  	}
  	return pd_addr;
  }
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h +2 -0
index 7c469cce0498..0d2c9f65ca13 100644
@@ -131,6 +131,8 @@ static inline bool amdgpu_gmc_vram_full_visible(struct amdgpu_gmc *gmc)
  	return (gmc->real_vram_size == gmc->visible_vram_size);
  }
 
+void amdgpu_gmc_get_pde_for_bo(struct amdgpu_bo *bo, int level,
+			       uint64_t *addr, uint64_t *flags);
  uint64_t amdgpu_gmc_pd_addr(struct amdgpu_bo *bo);
 
  #endif
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +18 -3
index eb08a03b82a0..72366643e3c2 100644
@@ -1428,13 +1428,14 @@ bool amdgpu_ttm_tt_is_readonly(struct ttm_tt *ttm)
  }
 
  /**
- * amdgpu_ttm_tt_pte_flags - Compute PTE flags for ttm_tt object
+ * amdgpu_ttm_tt_pde_flags - Compute PDE flags for ttm_tt object
   *
   * @ttm: The ttm_tt object to compute the flags for
   * @mem: The memory registry backing this ttm_tt object
+ *
+ * Figure out the flags to use for a VM PDE.
   */
-uint64_t amdgpu_ttm_tt_pte_flags(struct amdgpu_device *adev, struct ttm_tt *ttm,
-				 struct ttm_mem_reg *mem)
+uint64_t amdgpu_ttm_tt_pde_flags(struct ttm_tt *ttm, struct ttm_mem_reg *mem)
  {
  	uint64_t flags = 0;
 
@@ -1448,6 +1449,20 @@ uint64_t amdgpu_ttm_tt_pte_flags(struct amdgpu_device *adev, struct ttm_tt *ttm,
  			flags |= AMDGPU_PTE_SNOOPED;
  	}
 
+	return flags;
+}
+
+/**
+ * amdgpu_ttm_tt_pte_flags - Compute PTE flags for ttm_tt object
+ *
+ * @ttm: The ttm_tt object to compute the flags for
+ * @mem: The memory registry backing this ttm_tt object
+ */
+uint64_t amdgpu_ttm_tt_pte_flags(struct amdgpu_device *adev, struct ttm_tt *ttm,
+				 struct ttm_mem_reg *mem)
+{
+	uint64_t flags = amdgpu_ttm_tt_pde_flags(ttm, mem);
+
  	flags |= adev->gart.gart_pte_flags;
  	flags |= AMDGPU_PTE_READABLE;
 
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h +1 -0
index 8b3cc6687769..fe8f276e9811 100644
@@ -116,6 +116,7 @@ bool amdgpu_ttm_tt_userptr_invalidated(struct ttm_tt *ttm,
  				       int *last_invalidated);
  bool amdgpu_ttm_tt_userptr_needs_pages(struct ttm_tt *ttm);
  bool amdgpu_ttm_tt_is_readonly(struct ttm_tt *ttm);
+uint64_t amdgpu_ttm_tt_pde_flags(struct ttm_tt *ttm, struct ttm_mem_reg *mem);
  uint64_t amdgpu_ttm_tt_pte_flags(struct amdgpu_device *adev, struct ttm_tt *ttm,
  				 struct ttm_mem_reg *mem);
 
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0 -0
index d7ecbeb2f8a4..c951ebeac5fd 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c static void amdgpu_vm_update_pde(struct amdgpu_pte_update_params *params, · line 998

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1 -3
@@ -992,9 +992,7 @@ static void amdgpu_vm_update_pde(struct amdgpu_pte_update_params *params,
  		pbo = pbo->parent;
 
  	level += params->adev->vm_manager.root_level;
-	pt = amdgpu_bo_gpu_offset(entry->base.bo);
-	flags = AMDGPU_PTE_VALID;
-	amdgpu_gmc_get_vm_pde(params->adev, level, &pt, &flags);
+	amdgpu_gmc_get_pde_for_bo(entry->base.bo, level, &pt, &flags);
  	pde = (entry - parent->entries) * 8;
  	if (bo->shadow)
  		params->func(params, bo->shadow, pde, pt, 1, 0, flags);

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#14 lore raw

PATCH 5/5 drm/amdgpu: enable GTT PD/PT for raven v2

In reply to a message not in the archive

Should work on Vega10 as well, but with an obvious performance hit.

Older APUs can be enabled as well, but will probably be more work.

v2: fix error checking

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +12 -1
index c951ebeac5fd..c80555efbfac 100644
@@ -308,6 +308,9 @@ int amdgpu_vm_validate_pt_bos(struct amdgpu_device *adev, struct amdgpu_vm *vm,
 			list_move(&bo_base->vm_status, &vm->moved);
 			spin_unlock(&vm->moved_lock);
 		} else {
+			r = amdgpu_ttm_alloc_gart(&bo->tbo);
+			if (r)
+				break;
 			list_move(&bo_base->vm_status, &vm->relocated);
 		}
 	}
@@ -396,6 +399,10 @@ static int amdgpu_vm_clear_bo(struct amdgpu_device *adev,
 	if (r)
 		goto error;
 
+	r = amdgpu_ttm_alloc_gart(&bo->tbo);
+	if (r)
+		return r;
+
 	r = amdgpu_job_alloc_with_ib(adev, 64, &job);
 	if (r)
 		goto error;
@@ -461,7 +468,11 @@ static void amdgpu_vm_bo_param(struct amdgpu_device *adev, struct amdgpu_vm *vm,
 	bp->size = amdgpu_vm_bo_size(adev, level);
 	bp->byte_align = AMDGPU_GPU_PAGE_SIZE;
 	bp->domain = AMDGPU_GEM_DOMAIN_VRAM;
-	bp->flags = AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS;
+	if (bp->size <= PAGE_SIZE && adev->asic_type == CHIP_RAVEN)
+		bp->domain |= AMDGPU_GEM_DOMAIN_GTT;
+	bp->domain = amdgpu_bo_get_preferred_pin_domain(adev, bp->domain);
+	bp->flags = AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS |
+		AMDGPU_GEM_CREATE_CPU_GTT_USWC;
 	if (vm->use_cpu_for_update)
 		bp->flags |= AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED;
 	else
Signature · 6 lines
2.17.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 20180824142002.2315-5-christian.koenig-5C7GfCeVMHo@public.gmane.org

Reviewed-by
#16 lore raw

Re: [PATCH 5/5] drm/amdgpu: enable GTT PD/PT for raven v2

Quoted 38 lines · Christian König

Should work on Vega10 as well, but with an obvious performance hit.

Older APUs can be enabled as well, but will probably be more work.

v2: fix error checking

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +7 -0
index c951ebeac5fd..c80555efbfac 100644
@@ -308,6 +308,9 @@ int amdgpu_vm_validate_pt_bos(struct amdgpu_device *adev, struct amdgpu_vm *vm,
                        list_move(&bo_base->vm_status, &vm->moved);
                        spin_unlock(&vm->moved_lock);
                } else {
+                       r = amdgpu_ttm_alloc_gart(&bo->tbo);
+                       if (r)
+                               break;
                        list_move(&bo_base->vm_status, &vm->relocated);
                }
        }
@@ -396,6 +399,10 @@ static int amdgpu_vm_clear_bo(struct amdgpu_device *adev,
        if (r)
                goto error;
 
+       r = amdgpu_ttm_alloc_gart(&bo->tbo);
+       if (r)
+               return r;
+
        r = amdgpu_job_alloc_with_ib(adev, 64, &job);
        if (r)
                goto error;

drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c static void amdgpu_vm_bo_param(struct amdgpu_device *adev, struct amdgpu_vm *vm, · line 471

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1 -1
@@ -461,7 +468,11 @@ static void amdgpu_vm_bo_param(struct amdgpu_device *adev, struct amdgpu_vm *vm,
        bp->size = amdgpu_vm_bo_size(adev, level);
        bp->byte_align = AMDGPU_GPU_PAGE_SIZE;
        bp->domain = AMDGPU_GEM_DOMAIN_VRAM;
-       bp->flags = AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS;
+       if (bp->size <= PAGE_SIZE && adev->asic_type == CHIP_RAVEN)

Maybe change this to (asic_type >= VEGA10 and flags & IS_APU) so we get it automatically on newer APUs. Either way:

Alex

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +4 -1
+               bp->domain |= AMDGPU_GEM_DOMAIN_GTT;
+       bp->domain = amdgpu_bo_get_preferred_pin_domain(adev, bp->domain);
+       bp->flags = AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS |
+               AMDGPU_GEM_CREATE_CPU_GTT_USWC;
        if (vm->use_cpu_for_update)
                bp->flags |= AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED;
        else
--

2.17.1

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reviewed-by
#17 lore raw
In reply to a message not in the archive
Quoted 4 lines · Christian König

Just another leftover from radeon.

Quoted 44 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 4 +---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 3 ---
 2 files changed, 1 insertion(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1 -3
index a6b1126c61fd..53ce9982a5ee 100644
@@ -2566,8 +2566,6 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm,
 {
        struct amdgpu_bo_param bp;
        struct amdgpu_bo *root;
-       const unsigned align = min(AMDGPU_VM_PTB_ALIGN_SIZE,
-               AMDGPU_VM_PTE_COUNT(adev) * 8);
        unsigned long size;
        uint64_t flags;
        int r, i;
@@ -2615,7 +2613,7 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm,
        size = amdgpu_vm_bo_size(adev, adev->vm_manager.root_level);
        memset(&bp, 0, sizeof(bp));
        bp.size = size;
-       bp.byte_align = align;
+       bp.byte_align = AMDGPU_GPU_PAGE_SIZE;
        bp.domain = AMDGPU_GEM_DOMAIN_VRAM;
        bp.flags = flags;
        bp.type = ttm_bo_type_kernel;
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h +0 -4
index 1162c2bf3138..1c9049feaaea 100644
@@ -48,9 +48,6 @@ struct amdgpu_bo_list_entry;
 /* number of entries in page table */
 #define AMDGPU_VM_PTE_COUNT(adev) (1 << (adev)->vm_manager.block_size)
 
-/* PTBs (Page Table Blocks) need to be aligned to 32K */
-#define AMDGPU_VM_PTB_ALIGN_SIZE   32768
-
 #define AMDGPU_PTE_VALID       (1ULL << 0)
 #define AMDGPU_PTE_SYSTEM      (1ULL << 1)
 #define AMDGPU_PTE_SNOOPED     (1ULL << 2)
--

2.17.1

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): CADnq5_P01PKQHCyOSZ2yoREN3QAebzK3wQaoD9z27ynQRW6xmQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

Reviewed-by Junwei Zhang
#19 lore raw
Quoted 8 lines · Alex Deucher
Quoted 4 lines · Christian König

Just another leftover from radeon.

Quoted 45 lines
Quoted 45 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 4 +---
  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 3 ---
  2 files changed, 1 insertion(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1 -3
index a6b1126c61fd..53ce9982a5ee 100644
@@ -2566,8 +2566,6 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm,
  {
         struct amdgpu_bo_param bp;
         struct amdgpu_bo *root;
-       const unsigned align = min(AMDGPU_VM_PTB_ALIGN_SIZE,
-               AMDGPU_VM_PTE_COUNT(adev) * 8);
         unsigned long size;
         uint64_t flags;
         int r, i;
@@ -2615,7 +2613,7 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm,
         size = amdgpu_vm_bo_size(adev, adev->vm_manager.root_level);
         memset(&bp, 0, sizeof(bp));
         bp.size = size;
-       bp.byte_align = align;
+       bp.byte_align = AMDGPU_GPU_PAGE_SIZE;
         bp.domain = AMDGPU_GEM_DOMAIN_VRAM;
         bp.flags = flags;
         bp.type = ttm_bo_type_kernel;
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h +0 -4
index 1162c2bf3138..1c9049feaaea 100644
@@ -48,9 +48,6 @@ struct amdgpu_bo_list_entry;
  /* number of entries in page table */
  #define AMDGPU_VM_PTE_COUNT(adev) (1 << (adev)->vm_manager.block_size)
 
-/* PTBs (Page Table Blocks) need to be aligned to 32K */
-#define AMDGPU_VM_PTB_ALIGN_SIZE   32768
-
  #define AMDGPU_PTE_VALID       (1ULL << 0)
  #define AMDGPU_PTE_SYSTEM      (1ULL << 1)
  #define AMDGPU_PTE_SNOOPED     (1ULL << 2)
--

2.17.1

Quoted 9 lines
Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx