Skip to contentSkip to conversation

PRT support for amdgpu

PATCH In review Christian König 6 participants 25 messages Jan 30, 2017 – Feb 2, 2017 15 messages not in the archive

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

Hi Dave and Bas,

Hi Dave and Bas,

the following set of patches is a proposal for adding support for partial resident textures (PRT) to the amdgpu kernel module.

The basic idea behind PRT support is that you turn of VM fault reporting and only map parts of a texture into your virtual address space.

When a shader now tries to sample from a not present page it gets a notification instead of a VM fault and can react gracefully by switch to a different LOD for example.

On our current available hardware generation you can unfortunately only turn of VM faults globally, but on future generation you can do this on a per page basis. So my proposal is to have a consistent interface over all generations with a per mapping PRT flag, but enable/disable it globally on current hardware when the first/last mapping is made/destroyed.

An open problem with the proposal is that we don't know when or if we want to add the userspace implementation into radeonsi.

So price question could you guys use this for radv as well? Or is it sufficient to just write an unit test for it?

Best regards,
Christian.

_______________________________________________
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): 1485781060-1910-1-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org

#2 lore raw

PATCH 1/6 drm/amdgpu: add support for BO_VAs without BO

From: Christian König <[email protected]>

For PRT support we need mappings which aren't backed by any memory.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +14 -6
index 8e6030d..87eae9b 100644
@@ -1117,7 +1117,7 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,
 	struct fence *exclusive;
 	int r;
 
-	if (clear) {
+	if (clear || !bo_va->bo) {
 		mem = NULL;
 		nodes = NULL;
 		exclusive = NULL;
@@ -1134,9 +1134,15 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,
 		exclusive = reservation_object_get_excl(bo_va->bo->tbo.resv);
 	}
 
-	flags = amdgpu_ttm_tt_pte_flags(adev, bo_va->bo->tbo.ttm, mem);
-	gtt_flags = (amdgpu_ttm_is_bound(bo_va->bo->tbo.ttm) &&
-		adev == amdgpu_ttm_adev(bo_va->bo->tbo.bdev)) ? flags : 0;
+	if (bo_va->bo) {
+		flags = amdgpu_ttm_tt_pte_flags(adev, bo_va->bo->tbo.ttm, mem);
+		gtt_flags = (amdgpu_ttm_is_bound(bo_va->bo->tbo.ttm) &&
+			adev == amdgpu_ttm_adev(bo_va->bo->tbo.bdev)) ?
+			flags : 0;
+	} else {
+		flags = 0x0;
+		gtt_flags = ~0x0;
+	}
 
 	spin_lock(&vm->status_lock);
 	if (!list_empty(&bo_va->vm_status))
@@ -1271,7 +1277,8 @@ struct amdgpu_bo_va *amdgpu_vm_bo_add(struct amdgpu_device *adev,
 	INIT_LIST_HEAD(&bo_va->invalids);
 	INIT_LIST_HEAD(&bo_va->vm_status);
 
-	list_add_tail(&bo_va->bo_list, &bo->va);
+	if (bo)
+		list_add_tail(&bo_va->bo_list, &bo->va);
 
 	return bo_va;
 }
@@ -1309,7 +1316,8 @@ int amdgpu_vm_bo_map(struct amdgpu_device *adev,
 
 	/* make sure object fit at this offset */
 	eaddr = saddr + size - 1;
-	if ((saddr >= eaddr) || (offset + size > amdgpu_bo_size(bo_va->bo)))
+	if (bo_va->bo && (saddr >= eaddr ||
+			  (offset + size > amdgpu_bo_size(bo_va->bo))))
 		return -EINVAL;
 
 	last_pfn = eaddr / AMDGPU_GPU_PAGE_SIZE;
Signature · 6 lines
2.5.0

_______________________________________________
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): 1485781060-1910-2-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org

#4 lore raw

Re: [PATCH 1/6] drm/amdgpu: add support for BO_VAs without BO

Quoted 52 lines · Christian König

From: Christian König <[email protected]>

For PRT support we need mappings which aren't backed by any memory.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +12 -5
index 8e6030d..87eae9b 100644
@@ -1117,7 +1117,7 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,
 	struct fence *exclusive;
 	int r;
 
-	if (clear) {
+	if (clear || !bo_va->bo) {
 		mem = NULL;
 		nodes = NULL;
 		exclusive = NULL;
@@ -1134,9 +1134,15 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,
 		exclusive = reservation_object_get_excl(bo_va->bo->tbo.resv);
 	}
 
-	flags = amdgpu_ttm_tt_pte_flags(adev, bo_va->bo->tbo.ttm, mem);
-	gtt_flags = (amdgpu_ttm_is_bound(bo_va->bo->tbo.ttm) &&
-		adev == amdgpu_ttm_adev(bo_va->bo->tbo.bdev)) ? flags : 0;
+	if (bo_va->bo) {
+		flags = amdgpu_ttm_tt_pte_flags(adev, bo_va->bo->tbo.ttm, mem);
+		gtt_flags = (amdgpu_ttm_is_bound(bo_va->bo->tbo.ttm) &&
+			adev == amdgpu_ttm_adev(bo_va->bo->tbo.bdev)) ?
+			flags : 0;
+	} else {
+		flags = 0x0;
+		gtt_flags = ~0x0;
+	}
 
 	spin_lock(&vm->status_lock);
 	if (!list_empty(&bo_va->vm_status))
@@ -1271,7 +1277,8 @@ struct amdgpu_bo_va *amdgpu_vm_bo_add(struct amdgpu_device *adev,
 	INIT_LIST_HEAD(&bo_va->invalids);
 	INIT_LIST_HEAD(&bo_va->vm_status);
 
-	list_add_tail(&bo_va->bo_list, &bo->va);
+	if (bo)
+		list_add_tail(&bo_va->bo_list, &bo->va);
 
 	return bo_va;
 }

drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c int amdgpu_vm_bo_map(struct amdgpu_device *adev, · line 1321

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +2 -1
@@ -1309,7 +1316,8 @@ int amdgpu_vm_bo_map(struct amdgpu_device *adev,
 
 	/* make sure object fit at this offset */
 	eaddr = saddr + size - 1;
-	if ((saddr >= eaddr) || (offset + size > amdgpu_bo_size(bo_va->bo)))
+	if (bo_va->bo && (saddr >= eaddr ||
+			  (offset + size > amdgpu_bo_size(bo_va->bo))))
 		return -EINVAL;

At least the saddr >= eaddr check should probably apply apply.

Come to think of it, what if offset + size wraps around? There should probably be an explicit check for that.

Cheers,
Nicolai

drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c int amdgpu_vm_bo_map(struct amdgpu_device *adev, · line 1323

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0 -0
 	last_pfn = eaddr / AMDGPU_GPU_PAGE_SIZE;
 

_______________________________________________
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): 51ab062e-733b-bde8-ed41-c14fda72519a-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#6 lore raw

Re: [PATCH 1/6] drm/amdgpu: add support for BO_VAs without BO

Am 30.01.2017 um 15:43 schrieb Nicolai Hähnle:

Quoted 57 lines · Christian König
Quoted 56 lines

From: Christian König <[email protected]>

For PRT support we need mappings which aren't backed by any memory.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1 -1
index 8e6030d..87eae9b 100644
@@ -1117,7 +1117,7 @@ int amdgpu_vm_bo_update(struct amdgpu_device 
 *adev,
     struct fence *exclusive;
     int r;
 
-    if (clear) {
+    if (clear || !bo_va->bo) {
         mem = NULL;
         nodes = NULL;
         exclusive = NULL;
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +9 -3
@@ -1134,9 +1134,15 @@ int amdgpu_vm_bo_update(struct amdgpu_device 
 *adev,
         exclusive = reservation_object_get_excl(bo_va->bo->tbo.resv);
     }
 
-    flags = amdgpu_ttm_tt_pte_flags(adev, bo_va->bo->tbo.ttm, mem);
-    gtt_flags = (amdgpu_ttm_is_bound(bo_va->bo->tbo.ttm) &&
-        adev == amdgpu_ttm_adev(bo_va->bo->tbo.bdev)) ? flags : 0;
+    if (bo_va->bo) {
+        flags = amdgpu_ttm_tt_pte_flags(adev, bo_va->bo->tbo.ttm, mem);
+        gtt_flags = (amdgpu_ttm_is_bound(bo_va->bo->tbo.ttm) &&
+            adev == amdgpu_ttm_adev(bo_va->bo->tbo.bdev)) ?
+            flags : 0;
+    } else {
+        flags = 0x0;
+        gtt_flags = ~0x0;
+    }
 
     spin_lock(&vm->status_lock);
     if (!list_empty(&bo_va->vm_status))
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +2 -1
@@ -1271,7 +1277,8 @@ struct amdgpu_bo_va *amdgpu_vm_bo_add(struct 
 amdgpu_device *adev,
     INIT_LIST_HEAD(&bo_va->invalids);
     INIT_LIST_HEAD(&bo_va->vm_status);
 
-    list_add_tail(&bo_va->bo_list, &bo->va);
+    if (bo)
+        list_add_tail(&bo_va->bo_list, &bo->va);
 
     return bo_va;

}

drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0 -0
@@ -1309,7 +1316,8 @@ int amdgpu_vm_bo_map(struct amdgpu_device *adev,
 
Quoted 9 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c int amdgpu_vm_bo_map(struct amdgpu_device *adev, · line 1321

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +2 -1
     /* make sure object fit at this offset */
     eaddr = saddr + size - 1;
-    if ((saddr >= eaddr) || (offset + size > 
 amdgpu_bo_size(bo_va->bo)))
+    if (bo_va->bo && (saddr >= eaddr ||
+              (offset + size > amdgpu_bo_size(bo_va->bo))))
         return -EINVAL;

At least the saddr >= eaddr check should probably apply apply.

Oh, yes of course.

Quoted 2 lines

Come to think of it, what if offset + size wraps around?

Well that is exactly what the saddr >= eaddr check is good for :)

Christian.

Quoted 9 lines

There should probably be an explicit check for that.

Cheers,
Nicolai

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0 -0
     last_pfn = eaddr / AMDGPU_GPU_PAGE_SIZE;

_______________________________________________
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): f3cd0c09-3d57-84e8-b7e4-6fc3dded5974-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org

#8 lore raw

Re: [PATCH 1/6] drm/amdgpu: add support for BO_VAs without BO

Quoted 69 lines · Christian König

Am 30.01.2017 um 15:43 schrieb Nicolai Hähnle:

Quoted 58 lines · Christian König
Quoted 57 lines

From: Christian König <[email protected]>

For PRT support we need mappings which aren't backed by any memory.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1 -1
index 8e6030d..87eae9b 100644
@@ -1117,7 +1117,7 @@ int amdgpu_vm_bo_update(struct amdgpu_device
 *adev,
     struct fence *exclusive;
     int r;
 
-    if (clear) {
+    if (clear || !bo_va->bo) {
         mem = NULL;
         nodes = NULL;
         exclusive = NULL;
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +9 -3
@@ -1134,9 +1134,15 @@ int amdgpu_vm_bo_update(struct amdgpu_device
 *adev,
         exclusive = reservation_object_get_excl(bo_va->bo->tbo.resv);
     }
 
-    flags = amdgpu_ttm_tt_pte_flags(adev, bo_va->bo->tbo.ttm, mem);
-    gtt_flags = (amdgpu_ttm_is_bound(bo_va->bo->tbo.ttm) &&
-        adev == amdgpu_ttm_adev(bo_va->bo->tbo.bdev)) ? flags : 0;
+    if (bo_va->bo) {
+        flags = amdgpu_ttm_tt_pte_flags(adev, bo_va->bo->tbo.ttm, mem);
+        gtt_flags = (amdgpu_ttm_is_bound(bo_va->bo->tbo.ttm) &&
+            adev == amdgpu_ttm_adev(bo_va->bo->tbo.bdev)) ?
+            flags : 0;
+    } else {
+        flags = 0x0;
+        gtt_flags = ~0x0;
+    }
 
     spin_lock(&vm->status_lock);
     if (!list_empty(&bo_va->vm_status))
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +2 -1
@@ -1271,7 +1277,8 @@ struct amdgpu_bo_va *amdgpu_vm_bo_add(struct
 amdgpu_device *adev,
     INIT_LIST_HEAD(&bo_va->invalids);
     INIT_LIST_HEAD(&bo_va->vm_status);
 
-    list_add_tail(&bo_va->bo_list, &bo->va);
+    if (bo)
+        list_add_tail(&bo_va->bo_list, &bo->va);
 
     return bo_va;

}

drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0 -0
@@ -1309,7 +1316,8 @@ int amdgpu_vm_bo_map(struct amdgpu_device *adev,
 
Quoted 9 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c int amdgpu_vm_bo_map(struct amdgpu_device *adev, · line 1321

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +2 -1
     /* make sure object fit at this offset */
     eaddr = saddr + size - 1;
-    if ((saddr >= eaddr) || (offset + size >
 amdgpu_bo_size(bo_va->bo)))
+    if (bo_va->bo && (saddr >= eaddr ||
+              (offset + size > amdgpu_bo_size(bo_va->bo))))
         return -EINVAL;

At least the saddr >= eaddr check should probably apply apply.

Quoted 6 lines

Oh, yes of course.

Quoted 2 lines

Come to think of it, what if offset + size wraps around?

Well that is exactly what the saddr >= eaddr check is good for :)

But eaddr doesn't take offset into account. It seems to me that offset can be arbitrarily large and this isn't checked anywhere. At least I don't see it.

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

#9 lore raw

PATCH 2/6 drm/amdgpu: add basic PRT support

In reply to a message not in the archive

From: Christian König <[email protected]>

Future hardware generations can handle PRT flags on a per page basis, but current hardware can only turn it on globally.

Add the basic handling for both, a global callback to enable/disable triggered by setting a per mapping flag.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h    |   2 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 101 +++++++++++++++++++++++++++++----
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h |   6 ++
 3 files changed, 98 insertions(+), 11 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +2 -0
index 402a895..34a971a 100644
@@ -296,6 +296,8 @@ struct amdgpu_gart_funcs {
 			   uint32_t gpu_page_idx, /* pte/pde to update */
 			   uint64_t addr, /* addr to write into pte/pde */
 			   uint32_t flags); /* access flags */
+	/* enable/disable PRT support */
+	void (*set_prt)(struct amdgpu_device *adev, bool enable);
 };
 
 /* provided by the ih block */
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +90 -11

173 lines not on this page · raw message

drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h +6 -0
index 1f99715..4d26e9b 100644
@@ -65,6 +65,8 @@ struct amdgpu_bo_list_entry;
 
 #define AMDGPU_PTE_FRAG(x)	((x & 0x1f) << 7)
 
+#define AMDGPU_PTE_PRT		(1UL << 63)
+
 /* How to programm VM fault handling */
 #define AMDGPU_VM_FAULT_STOP_NEVER	0
 #define AMDGPU_VM_FAULT_STOP_FIRST	1
@@ -159,6 +161,10 @@ struct amdgpu_vm_manager {
 	atomic_t				vm_pte_next_ring;
 	/* client id counter */
 	atomic64_t				client_counter;
+
+	/* partial resident texture handling */
+	spinlock_t				prt_lock;
+	atomic_t				num_prt_mappings;
 };
 
 void amdgpu_vm_manager_init(struct amdgpu_device *adev);
Signature · 6 lines
2.5.0

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

PATCH 3/6 drm/amdgpu: IOCTL interface for PRT support v3

In reply to a message not in the archive

From: Junwei Zhang <[email protected]>

Till GFX8 we can only enable PRT support globally, but with the next hardware generation we can do this on a per page basis.

Keep the interface consistent by adding PRT mappings and enable support globally on current hardware when the first mapping is made.

v2: disable PRT support delayed and on all error paths
v3: PRT and other permissions are mutal exclusive,
PRT mappings don't need a BO.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h     |  1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 62 ++++++++++++++++++++-------------
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 10 ++++++
 include/uapi/drm/amdgpu_drm.h           |  2 ++
 4 files changed, 51 insertions(+), 24 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
index 34a971a..99ca5e8 100644
@@ -703,6 +703,7 @@ void amdgpu_ctx_mgr_fini(struct amdgpu_ctx_mgr *mgr);
 
 struct amdgpu_fpriv {
 	struct amdgpu_vm	vm;
+	struct amdgpu_bo_va	*prt_va;
 	struct mutex		bo_list_lock;
 	struct idr		bo_list_handles;
 	struct amdgpu_ctx_mgr	ctx_mgr;
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +38 -24

107 lines not on this page · raw message

drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +10 -0
index 215f73b..d5f9d6a4 100644
@@ -656,6 +656,14 @@ int amdgpu_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv)
 		goto out_suspend;
 	}
 
+	fpriv->prt_va = amdgpu_vm_bo_add(adev, &fpriv->vm, NULL);
+	if (!fpriv->prt_va) {
+		r = -ENOMEM;
+		amdgpu_vm_fini(adev, &fpriv->vm);
+		kfree(fpriv);
+		goto out_suspend;
+	}
+
 	if (amdgpu_sriov_vf(adev)) {
 		r = amdgpu_map_static_csa(adev, &fpriv->vm);
 		if (r)
@@ -700,6 +708,8 @@ void amdgpu_driver_postclose_kms(struct drm_device *dev,
 	amdgpu_uvd_free_handles(adev, file_priv);
 	amdgpu_vce_free_handles(adev, file_priv);
 
+	amdgpu_vm_bo_rmv(adev, fpriv->prt_va);
+
 	if (amdgpu_sriov_vf(adev)) {
 		/* TODO: how to handle reserve failure */
 		BUG_ON(amdgpu_bo_reserve(adev->virt.csa_obj, false));
include/uapi/drm/amdgpu_drm.h +2 -0
index 2cf8df8..07e3710 100644
@@ -363,6 +363,8 @@ struct drm_amdgpu_gem_op {
 #define AMDGPU_VM_PAGE_WRITEABLE	(1 << 2)
 /* executable mapping, new for VI */
 #define AMDGPU_VM_PAGE_EXECUTABLE	(1 << 3)
+/* partially resident texture */
+#define AMDGPU_VM_PAGE_PRT		(1 << 4)
 
 struct drm_amdgpu_gem_va {
 	/** GEM object handle */
Signature · 6 lines
2.5.0

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

PATCH 4/6 drm/amdgpu: implement PRT for GFX6

In reply to a message not in the archive

From: Christian König <[email protected]>

Enable/disable the handling globally for now and print a warning when we enable it for the first time.

---
 drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c | 63 +++++++++++++++++++++++++++++++++++
 1 file changed, 63 insertions(+)
drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c +63 -0
index e2b0b16..c23503e 100644
@@ -398,6 +398,68 @@ static void gmc_v6_0_set_fault_enable_default(struct amdgpu_device *adev,
 	WREG32(mmVM_CONTEXT1_CNTL, tmp);
 }
 
+ /**
+   + * gmc_v8_0_set_prt - set PRT VM fault
+   + *
+   + * @adev: amdgpu_device pointer
+   + * @enable: enable/disable VM fault handling for PRT
+   +*/
+static void gmc_v6_0_set_prt(struct amdgpu_device *adev, bool enable)
+{
+	u32 tmp;
+
+	if (enable && !adev->mc.prt_warning) {
+		dev_warn(adev->dev, "Disabling VM faults because of PRT request!\n");
+		adev->mc.prt_warning = true;
+	}
+
+	tmp = RREG32(mmVM_PRT_CNTL);
+	tmp = REG_SET_FIELD(tmp, VM_PRT_CNTL,
+			    CB_DISABLE_READ_FAULT_ON_UNMAPPED_ACCESS,
+			    enable);
+	tmp = REG_SET_FIELD(tmp, VM_PRT_CNTL,
+			    CB_DISABLE_WRITE_FAULT_ON_UNMAPPED_ACCESS,
+			    enable);
+	tmp = REG_SET_FIELD(tmp, VM_PRT_CNTL,
+			    TC_DISABLE_READ_FAULT_ON_UNMAPPED_ACCESS,
+			    enable);
+	tmp = REG_SET_FIELD(tmp, VM_PRT_CNTL,
+			    TC_DISABLE_WRITE_FAULT_ON_UNMAPPED_ACCESS,
+			    enable);
+	tmp = REG_SET_FIELD(tmp, VM_PRT_CNTL,
+			    L2_CACHE_STORE_INVALID_ENTRIES,
+			    enable);
+	tmp = REG_SET_FIELD(tmp, VM_PRT_CNTL,
+			    L1_TLB_STORE_INVALID_ENTRIES,
+			    enable);
+	tmp = REG_SET_FIELD(tmp, VM_PRT_CNTL,
+			    MASK_PDE0_FAULT, enable);
+	WREG32(mmVM_CONTEXT1_CNTL, tmp);
+
+	if (enable) {
+		uint32_t low = AMDGPU_VA_RESERVED_SIZE >> AMDGPU_GPU_PAGE_SHIFT;
+		uint32_t high = adev->vm_manager.max_pfn;
+
+		WREG32(mmVM_PRT_APERTURE0_LOW_ADDR, low);
+		WREG32(mmVM_PRT_APERTURE1_LOW_ADDR, low);
+		WREG32(mmVM_PRT_APERTURE2_LOW_ADDR, low);
+		WREG32(mmVM_PRT_APERTURE3_LOW_ADDR, low);
+		WREG32(mmVM_PRT_APERTURE0_HIGH_ADDR, high);
+		WREG32(mmVM_PRT_APERTURE1_HIGH_ADDR, high);
+		WREG32(mmVM_PRT_APERTURE2_HIGH_ADDR, high);
+		WREG32(mmVM_PRT_APERTURE3_HIGH_ADDR, high);
+	} else {
+		WREG32(mmVM_PRT_APERTURE0_LOW_ADDR, 0xfffffff);
+		WREG32(mmVM_PRT_APERTURE1_LOW_ADDR, 0xfffffff);
+		WREG32(mmVM_PRT_APERTURE2_LOW_ADDR, 0xfffffff);
+		WREG32(mmVM_PRT_APERTURE3_LOW_ADDR, 0xfffffff);
+		WREG32(mmVM_PRT_APERTURE0_HIGH_ADDR, 0x0);
+		WREG32(mmVM_PRT_APERTURE1_HIGH_ADDR, 0x0);
+		WREG32(mmVM_PRT_APERTURE2_HIGH_ADDR, 0x0);
+		WREG32(mmVM_PRT_APERTURE3_HIGH_ADDR, 0x0);
+	}
+}
+
 static int gmc_v6_0_gart_enable(struct amdgpu_device *adev)
 {
 	int r, i;
@@ -1080,6 +1142,7 @@ static const struct amd_ip_funcs gmc_v6_0_ip_funcs = {
 static const struct amdgpu_gart_funcs gmc_v6_0_gart_funcs = {
 	.flush_gpu_tlb = gmc_v6_0_gart_flush_gpu_tlb,
 	.set_pte_pde = gmc_v6_0_gart_set_pte_pde,
+	.set_prt = gmc_v6_0_set_prt,
 };
 
 static const struct amdgpu_irq_src_funcs gmc_v6_0_irq_funcs = {
Signature · 6 lines
2.5.0

_______________________________________________
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): 1485781060-1910-5-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org

#13 lore raw

Re: [PATCH 4/6] drm/amdgpu: implement PRT for GFX6

Minor nit: the comment says v8 [😊]

The changes to the GFX6/7/8 look reasonable though only question is you read from mmVM_PRT_CNTL and then write to mmVM_CONTEXT1_CNTL . Is that expected?

Tom

________________________________
From: amd-gfx <[email protected]> on behalf of Christian König <[email protected]>
Sent: Monday, January 30, 2017 07:57
To: [email protected]; [email protected]
Cc: [email protected]
Subject: [PATCH 4/6] drm/amdgpu: implement PRT for GFX6

From: Christian König <[email protected]>

Enable/disable the handling globally for now and print a warning when we enable it for the first time.

---
 drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c | 63 +++++++++++++++++++++++++++++++++++
 1 file changed, 63 insertions(+)
drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c +63 -0
index e2b0b16..c23503e 100644
@@ -398,6 +398,68 @@ static void gmc_v6_0_set_fault_enable_default(struct amdgpu_device *adev,
         WREG32(mmVM_CONTEXT1_CNTL, tmp);
 }
 
+ /**
+   + * gmc_v8_0_set_prt - set PRT VM fault
+   + *
+   + * @adev: amdgpu_device pointer
+   + * @enable: enable/disable VM fault handling for PRT
+   +*/
+static void gmc_v6_0_set_prt(struct amdgpu_device *adev, bool enable)
+{
+       u32 tmp;
+
+       if (enable && !adev->mc.prt_warning) {
+               dev_warn(adev->dev, "Disabling VM faults because of PRT request!\n");
+               adev->mc.prt_warning = true;
+       }
+
+       tmp = RREG32(mmVM_PRT_CNTL);
+       tmp = REG_SET_FIELD(tmp, VM_PRT_CNTL,
+                           CB_DISABLE_READ_FAULT_ON_UNMAPPED_ACCESS,
+                           enable);
+       tmp = REG_SET_FIELD(tmp, VM_PRT_CNTL,
+                           CB_DISABLE_WRITE_FAULT_ON_UNMAPPED_ACCESS,
+                           enable);
+       tmp = REG_SET_FIELD(tmp, VM_PRT_CNTL,
+                           TC_DISABLE_READ_FAULT_ON_UNMAPPED_ACCESS,
+                           enable);
+       tmp = REG_SET_FIELD(tmp, VM_PRT_CNTL,
+                           TC_DISABLE_WRITE_FAULT_ON_UNMAPPED_ACCESS,
+                           enable);
+       tmp = REG_SET_FIELD(tmp, VM_PRT_CNTL,
+                           L2_CACHE_STORE_INVALID_ENTRIES,
+                           enable);
+       tmp = REG_SET_FIELD(tmp, VM_PRT_CNTL,
+                           L1_TLB_STORE_INVALID_ENTRIES,
+                           enable);
+       tmp = REG_SET_FIELD(tmp, VM_PRT_CNTL,
+                           MASK_PDE0_FAULT, enable);
+       WREG32(mmVM_CONTEXT1_CNTL, tmp);
+
+       if (enable) {
+               uint32_t low = AMDGPU_VA_RESERVED_SIZE >> AMDGPU_GPU_PAGE_SHIFT;
+               uint32_t high = adev->vm_manager.max_pfn;
+
+               WREG32(mmVM_PRT_APERTURE0_LOW_ADDR, low);
+               WREG32(mmVM_PRT_APERTURE1_LOW_ADDR, low);
+               WREG32(mmVM_PRT_APERTURE2_LOW_ADDR, low);
+               WREG32(mmVM_PRT_APERTURE3_LOW_ADDR, low);
+               WREG32(mmVM_PRT_APERTURE0_HIGH_ADDR, high);
+               WREG32(mmVM_PRT_APERTURE1_HIGH_ADDR, high);
+               WREG32(mmVM_PRT_APERTURE2_HIGH_ADDR, high);
+               WREG32(mmVM_PRT_APERTURE3_HIGH_ADDR, high);
+       } else {
+               WREG32(mmVM_PRT_APERTURE0_LOW_ADDR, 0xfffffff);
+               WREG32(mmVM_PRT_APERTURE1_LOW_ADDR, 0xfffffff);
+               WREG32(mmVM_PRT_APERTURE2_LOW_ADDR, 0xfffffff);
+               WREG32(mmVM_PRT_APERTURE3_LOW_ADDR, 0xfffffff);
+               WREG32(mmVM_PRT_APERTURE0_HIGH_ADDR, 0x0);
+               WREG32(mmVM_PRT_APERTURE1_HIGH_ADDR, 0x0);
+               WREG32(mmVM_PRT_APERTURE2_HIGH_ADDR, 0x0);
+               WREG32(mmVM_PRT_APERTURE3_HIGH_ADDR, 0x0);
+       }
+}
+
 static int gmc_v6_0_gart_enable(struct amdgpu_device *adev)
 {
         int r, i;
@@ -1080,6 +1142,7 @@ static const struct amd_ip_funcs gmc_v6_0_ip_funcs = {
 static const struct amdgpu_gart_funcs gmc_v6_0_gart_funcs = {
         .flush_gpu_tlb = gmc_v6_0_gart_flush_gpu_tlb,
         .set_pte_pde = gmc_v6_0_gart_set_pte_pde,
+       .set_prt = gmc_v6_0_set_prt,
 };
 
 static const struct amdgpu_irq_src_funcs gmc_v6_0_irq_funcs = {

--
2.5.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
amd-gfx Info Page - lists.freedesktop.org<https://lists.freedesktop.org/mailman/listinfo/amd-gfx>
lists.freedesktop.org
To see the collection of prior postings to the list, visit the amd-gfx Archives. Using amd-gfx: To post a message to all the list members, send email ...

_______________________________________________
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): CY4PR12MB1768231152C68AFABF76535AF74B0-rpdhrqHFk06yjjPBNVDk/[email protected]

#15 lore raw

Re: [PATCH 4/6] drm/amdgpu: implement PRT for GFX6

Quoted 1 line

The changes to the GFX6/7/8 look reasonable though only question is you read from mmVM_PRT_CNTL and then write to mmVM_CONTEXT1_CNTL . Is that expected?

Not at all! Looks like a copy&paste error while modifying the original patch. Thanks for catching this.

Also the whole set is so far only compile tested, still need to give it a run on all hardware generations anyway.

Christian.

Am 30.01.2017 um 14:59 schrieb StDenis, Tom:

Quoted 112 lines

Minor nit: the comment says v8 😊

The changes to the GFX6/7/8 look reasonable though only question is you read from mmVM_PRT_CNTL and then write to mmVM_CONTEXT1_CNTL . Is that expected?

Tom

------------------------------------------------------------------------
*From:* amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> on behalf of Christian König <[email protected]> *Sent:* Monday, January 30, 2017 07:57
*To:* bas-dldO88ZXqoXqqjsSq9zF6IRWq/[email protected]; [email protected]
*Cc:* [email protected]
*Subject:* [PATCH 4/6] drm/amdgpu: implement PRT for GFX6
From: Christian König <[email protected]>

Enable/disable the handling globally for now and print a warning when we enable it for the first time.

---
 drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c | 63 
+++++++++++++++++++++++++++++++++++
 1 file changed, 63 insertions(+)
drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c +62 -0
index e2b0b16..c23503e 100644
@@ -398,6 +398,68 @@ static void 
 gmc_v6_0_set_fault_enable_default(struct amdgpu_device *adev,
         WREG32(mmVM_CONTEXT1_CNTL, tmp);
 }
 
+ /**
+   + * gmc_v8_0_set_prt - set PRT VM fault
+   + *
+   + * @adev: amdgpu_device pointer
+   + * @enable: enable/disable VM fault handling for PRT
+   +*/
+static void gmc_v6_0_set_prt(struct amdgpu_device *adev, bool enable)
+{
+       u32 tmp;
+
+       if (enable && !adev->mc.prt_warning) {
+               dev_warn(adev->dev, "Disabling VM faults because of 
 PRT request!\n");
+               adev->mc.prt_warning = true;
+       }
+
+       tmp = RREG32(mmVM_PRT_CNTL);
+       tmp = REG_SET_FIELD(tmp, VM_PRT_CNTL,
+ CB_DISABLE_READ_FAULT_ON_UNMAPPED_ACCESS,
+                           enable);
+       tmp = REG_SET_FIELD(tmp, VM_PRT_CNTL,
+ CB_DISABLE_WRITE_FAULT_ON_UNMAPPED_ACCESS,
+                           enable);
+       tmp = REG_SET_FIELD(tmp, VM_PRT_CNTL,
+ TC_DISABLE_READ_FAULT_ON_UNMAPPED_ACCESS,
+                           enable);
+       tmp = REG_SET_FIELD(tmp, VM_PRT_CNTL,
+ TC_DISABLE_WRITE_FAULT_ON_UNMAPPED_ACCESS,
+                           enable);
+       tmp = REG_SET_FIELD(tmp, VM_PRT_CNTL,
+ L2_CACHE_STORE_INVALID_ENTRIES,
+                           enable);
+       tmp = REG_SET_FIELD(tmp, VM_PRT_CNTL,
+ L1_TLB_STORE_INVALID_ENTRIES,
+                           enable);
+       tmp = REG_SET_FIELD(tmp, VM_PRT_CNTL,
+                           MASK_PDE0_FAULT, enable);
+       WREG32(mmVM_CONTEXT1_CNTL, tmp);
+
+       if (enable) {
+               uint32_t low = AMDGPU_VA_RESERVED_SIZE >> 
 AMDGPU_GPU_PAGE_SHIFT;
+               uint32_t high = adev->vm_manager.max_pfn;
+
+               WREG32(mmVM_PRT_APERTURE0_LOW_ADDR, low);
+               WREG32(mmVM_PRT_APERTURE1_LOW_ADDR, low);
+               WREG32(mmVM_PRT_APERTURE2_LOW_ADDR, low);
+               WREG32(mmVM_PRT_APERTURE3_LOW_ADDR, low);
+               WREG32(mmVM_PRT_APERTURE0_HIGH_ADDR, high);
+               WREG32(mmVM_PRT_APERTURE1_HIGH_ADDR, high);
+               WREG32(mmVM_PRT_APERTURE2_HIGH_ADDR, high);
+               WREG32(mmVM_PRT_APERTURE3_HIGH_ADDR, high);
+       } else {
+               WREG32(mmVM_PRT_APERTURE0_LOW_ADDR, 0xfffffff);
+               WREG32(mmVM_PRT_APERTURE1_LOW_ADDR, 0xfffffff);
+               WREG32(mmVM_PRT_APERTURE2_LOW_ADDR, 0xfffffff);
+               WREG32(mmVM_PRT_APERTURE3_LOW_ADDR, 0xfffffff);
+               WREG32(mmVM_PRT_APERTURE0_HIGH_ADDR, 0x0);
+               WREG32(mmVM_PRT_APERTURE1_HIGH_ADDR, 0x0);
+               WREG32(mmVM_PRT_APERTURE2_HIGH_ADDR, 0x0);
+               WREG32(mmVM_PRT_APERTURE3_HIGH_ADDR, 0x0);
+       }
+}
+

static int gmc_v6_0_gart_enable(struct amdgpu_device *adev)

 {
         int r, i;
drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c +1 -0
@@ -1080,6 +1142,7 @@ static const struct amd_ip_funcs 
 gmc_v6_0_ip_funcs = {
 static const struct amdgpu_gart_funcs gmc_v6_0_gart_funcs = {
         .flush_gpu_tlb = gmc_v6_0_gart_flush_gpu_tlb,
         .set_pte_pde = gmc_v6_0_gart_set_pte_pde,
+       .set_prt = gmc_v6_0_set_prt,
 };
 
Quoted 14 lines

static const struct amdgpu_irq_src_funcs gmc_v6_0_irq_funcs = {

Signature · 9 lines
2.5.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
amd-gfx Info Page - lists.freedesktop.org <https://lists.freedesktop.org/mailman/listinfo/amd-gfx>
lists.freedesktop.org
To see the collection of prior postings to the list, visit the amd-gfx Archives. Using amd-gfx: To post a message to all the list members, send email ...

_______________________________________________
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): fc54cc73-6b75-59b3-f67a-9a395d749e23-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org

#17 lore raw

Re: [PATCH 4/6] drm/amdgpu: implement PRT for GFX6

Hi Christian,

I have SI,CI,VI gear in my office if you have a unit test to try it with.

Cheers,

Tom

________________________________
From: Christian König <[email protected]>
Sent: Monday, January 30, 2017 09:14
To: StDenis, Tom; bas-dldO88ZXqoXqqjsSq9zF6IRWq/[email protected]; [email protected]
Cc: [email protected]
Subject: Re: [PATCH 4/6] drm/amdgpu: implement PRT for GFX6

The changes to the GFX6/7/8 look reasonable though only question is you read from mmVM_PRT_CNTL and then write to mmVM_CONTEXT1_CNTL . Is that expected? Not at all! Looks like a copy&paste error while modifying the original patch. Thanks for catching this.

Also the whole set is so far only compile tested, still need to give it a run on all hardware generations anyway.

Christian.

Am 30.01.2017 um 14:59 schrieb StDenis, Tom:

Minor nit: the comment says v8 [??]

The changes to the GFX6/7/8 look reasonable though only question is you read from mmVM_PRT_CNTL and then write to mmVM_CONTEXT1_CNTL . Is that expected?

Tom

________________________________
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org><mailto:[email protected]> on behalf of Christian König <[email protected]><mailto:[email protected]>
Sent: Monday, January 30, 2017 07:57
To: bas-dldO88ZXqoXqqjsSq9zF6IRWq/[email protected]<mailto:bas-dldO88ZXqoXqqjsSq9zF6IRWq/[email protected]>; [email protected]<mailto:[email protected]>
Cc: [email protected]<mailto:[email protected]>
Subject: [PATCH 4/6] drm/amdgpu: implement PRT for GFX6

From: Christian König <[email protected]><mailto:[email protected]>

Enable/disable the handling globally for now and print a warning when we enable it for the first time.

---
 drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c | 63 +++++++++++++++++++++++++++++++++++
 1 file changed, 63 insertions(+)
drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c +63 -0
index e2b0b16..c23503e 100644
@@ -398,6 +398,68 @@ static void gmc_v6_0_set_fault_enable_default(struct amdgpu_device *adev,
         WREG32(mmVM_CONTEXT1_CNTL, tmp);
 }
 
+ /**
+   + * gmc_v8_0_set_prt - set PRT VM fault
+   + *
+   + * @adev: amdgpu_device pointer
+   + * @enable: enable/disable VM fault handling for PRT
+   +*/
+static void gmc_v6_0_set_prt(struct amdgpu_device *adev, bool enable)
+{
+       u32 tmp;
+
+       if (enable && !adev->mc.prt_warning) {
+               dev_warn(adev->dev, "Disabling VM faults because of PRT request!\n");
+               adev->mc.prt_warning = true;
+       }
+
+       tmp = RREG32(mmVM_PRT_CNTL);
+       tmp = REG_SET_FIELD(tmp, VM_PRT_CNTL,
+                           CB_DISABLE_READ_FAULT_ON_UNMAPPED_ACCESS,
+                           enable);
+       tmp = REG_SET_FIELD(tmp, VM_PRT_CNTL,
+                           CB_DISABLE_WRITE_FAULT_ON_UNMAPPED_ACCESS,
+                           enable);
+       tmp = REG_SET_FIELD(tmp, VM_PRT_CNTL,
+                           TC_DISABLE_READ_FAULT_ON_UNMAPPED_ACCESS,
+                           enable);
+       tmp = REG_SET_FIELD(tmp, VM_PRT_CNTL,
+                           TC_DISABLE_WRITE_FAULT_ON_UNMAPPED_ACCESS,
+                           enable);
+       tmp = REG_SET_FIELD(tmp, VM_PRT_CNTL,
+                           L2_CACHE_STORE_INVALID_ENTRIES,
+                           enable);
+       tmp = REG_SET_FIELD(tmp, VM_PRT_CNTL,
+                           L1_TLB_STORE_INVALID_ENTRIES,
+                           enable);
+       tmp = REG_SET_FIELD(tmp, VM_PRT_CNTL,
+                           MASK_PDE0_FAULT, enable);
+       WREG32(mmVM_CONTEXT1_CNTL, tmp);
+
+       if (enable) {
+               uint32_t low = AMDGPU_VA_RESERVED_SIZE >> AMDGPU_GPU_PAGE_SHIFT;
+               uint32_t high = adev->vm_manager.max_pfn;
+
+               WREG32(mmVM_PRT_APERTURE0_LOW_ADDR, low);
+               WREG32(mmVM_PRT_APERTURE1_LOW_ADDR, low);
+               WREG32(mmVM_PRT_APERTURE2_LOW_ADDR, low);
+               WREG32(mmVM_PRT_APERTURE3_LOW_ADDR, low);
+               WREG32(mmVM_PRT_APERTURE0_HIGH_ADDR, high);
+               WREG32(mmVM_PRT_APERTURE1_HIGH_ADDR, high);
+               WREG32(mmVM_PRT_APERTURE2_HIGH_ADDR, high);
+               WREG32(mmVM_PRT_APERTURE3_HIGH_ADDR, high);
+       } else {
+               WREG32(mmVM_PRT_APERTURE0_LOW_ADDR, 0xfffffff);
+               WREG32(mmVM_PRT_APERTURE1_LOW_ADDR, 0xfffffff);
+               WREG32(mmVM_PRT_APERTURE2_LOW_ADDR, 0xfffffff);
+               WREG32(mmVM_PRT_APERTURE3_LOW_ADDR, 0xfffffff);
+               WREG32(mmVM_PRT_APERTURE0_HIGH_ADDR, 0x0);
+               WREG32(mmVM_PRT_APERTURE1_HIGH_ADDR, 0x0);
+               WREG32(mmVM_PRT_APERTURE2_HIGH_ADDR, 0x0);
+               WREG32(mmVM_PRT_APERTURE3_HIGH_ADDR, 0x0);
+       }
+}
+
 static int gmc_v6_0_gart_enable(struct amdgpu_device *adev)
 {
         int r, i;
@@ -1080,6 +1142,7 @@ static const struct amd_ip_funcs gmc_v6_0_ip_funcs = {
 static const struct amdgpu_gart_funcs gmc_v6_0_gart_funcs = {
         .flush_gpu_tlb = gmc_v6_0_gart_flush_gpu_tlb,
         .set_pte_pde = gmc_v6_0_gart_set_pte_pde,
+       .set_prt = gmc_v6_0_set_prt,
 };
 
 static const struct amdgpu_irq_src_funcs gmc_v6_0_irq_funcs = {

--
2.5.0

_______________________________________________
amd-gfx mailing list [email protected]<mailto:[email protected]>
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
amd-gfx Info Page - lists.freedesktop.org<https://lists.freedesktop.org/mailman/listinfo/amd-gfx>
lists.freedesktop.org
To see the collection of prior postings to the list, visit the amd-gfx Archives. Using amd-gfx: To post a message to all the list members, send email ...

_______________________________________________
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): CY4PR12MB1768D597CD5AA969E892F02FF74B0-rpdhrqHFk06yjjPBNVDk/[email protected]

#19 lore raw

Re: [PATCH 4/6] drm/amdgpu: implement PRT for GFX6

Thanks, going to come back to that when I actually write the unit test.

But I will wait what Dave&Bas says to the interface.

Regards,
Christian.

Am 30.01.2017 um 15:15 schrieb StDenis, Tom:

Quoted 145 lines

Hi Christian,

I have SI,CI,VI gear in my office if you have a unit test to try it with.

Cheers,

Tom

------------------------------------------------------------------------
*From:* Christian König <[email protected]>
*Sent:* Monday, January 30, 2017 09:14
*To:* StDenis, Tom; bas-dldO88ZXqoXqqjsSq9zF6IRWq/[email protected]; [email protected] *Cc:* [email protected]
*Subject:* Re: [PATCH 4/6] drm/amdgpu: implement PRT for GFX6

Quoted 2 lines

The changes to the GFX6/7/8 look reasonable though only question is you read from mmVM_PRT_CNTL and then write to mmVM_CONTEXT1_CNTL .
Is that expected?

Not at all! Looks like a copy&paste error while modifying the original patch. Thanks for catching this.

Also the whole set is so far only compile tested, still need to give it a run on all hardware generations anyway.

Christian.

Am 30.01.2017 um 14:59 schrieb StDenis, Tom:

Quoted 117 lines

Minor nit: the comment says v8 ��

The changes to the GFX6/7/8 look reasonable though only question is you read from mmVM_PRT_CNTL and then write to mmVM_CONTEXT1_CNTL .
Is that expected?

Tom

------------------------------------------------------------------------
*From:* amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> on behalf of Christian König <[email protected]> *Sent:* Monday, January 30, 2017 07:57
*To:* bas-dldO88ZXqoXqqjsSq9zF6IRWq/[email protected]; [email protected]
*Cc:* [email protected]
*Subject:* [PATCH 4/6] drm/amdgpu: implement PRT for GFX6
From: Christian König <[email protected]>

Enable/disable the handling globally for now and print a warning when we enable it for the first time.

---
 drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c | 63 
+++++++++++++++++++++++++++++++++++
 1 file changed, 63 insertions(+)
drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c +62 -0
index e2b0b16..c23503e 100644
@@ -398,6 +398,68 @@ static void 
 gmc_v6_0_set_fault_enable_default(struct amdgpu_device *adev,
         WREG32(mmVM_CONTEXT1_CNTL, tmp);
 }
 
+ /**
+   + * gmc_v8_0_set_prt - set PRT VM fault
+   + *
+   + * @adev: amdgpu_device pointer
+   + * @enable: enable/disable VM fault handling for PRT
+   +*/
+static void gmc_v6_0_set_prt(struct amdgpu_device *adev, bool enable)
+{
+       u32 tmp;
+
+       if (enable && !adev->mc.prt_warning) {
+               dev_warn(adev->dev, "Disabling VM faults because of 
 PRT request!\n");
+               adev->mc.prt_warning = true;
+       }
+
+       tmp = RREG32(mmVM_PRT_CNTL);
+       tmp = REG_SET_FIELD(tmp, VM_PRT_CNTL,
+ CB_DISABLE_READ_FAULT_ON_UNMAPPED_ACCESS,
+                           enable);
+       tmp = REG_SET_FIELD(tmp, VM_PRT_CNTL,
+ CB_DISABLE_WRITE_FAULT_ON_UNMAPPED_ACCESS,
+                           enable);
+       tmp = REG_SET_FIELD(tmp, VM_PRT_CNTL,
+ TC_DISABLE_READ_FAULT_ON_UNMAPPED_ACCESS,
+                           enable);
+       tmp = REG_SET_FIELD(tmp, VM_PRT_CNTL,
+ TC_DISABLE_WRITE_FAULT_ON_UNMAPPED_ACCESS,
+                           enable);
+       tmp = REG_SET_FIELD(tmp, VM_PRT_CNTL,
+ L2_CACHE_STORE_INVALID_ENTRIES,
+                           enable);
+       tmp = REG_SET_FIELD(tmp, VM_PRT_CNTL,
+ L1_TLB_STORE_INVALID_ENTRIES,
+                           enable);
+       tmp = REG_SET_FIELD(tmp, VM_PRT_CNTL,
+                           MASK_PDE0_FAULT, enable);
+       WREG32(mmVM_CONTEXT1_CNTL, tmp);
+
+       if (enable) {
+               uint32_t low = AMDGPU_VA_RESERVED_SIZE >> 
 AMDGPU_GPU_PAGE_SHIFT;
+               uint32_t high = adev->vm_manager.max_pfn;
+
+ WREG32(mmVM_PRT_APERTURE0_LOW_ADDR, low);
+ WREG32(mmVM_PRT_APERTURE1_LOW_ADDR, low);
+ WREG32(mmVM_PRT_APERTURE2_LOW_ADDR, low);
+ WREG32(mmVM_PRT_APERTURE3_LOW_ADDR, low);
+ WREG32(mmVM_PRT_APERTURE0_HIGH_ADDR, high);
+ WREG32(mmVM_PRT_APERTURE1_HIGH_ADDR, high);
+ WREG32(mmVM_PRT_APERTURE2_HIGH_ADDR, high);
+ WREG32(mmVM_PRT_APERTURE3_HIGH_ADDR, high);
+       } else {
+ WREG32(mmVM_PRT_APERTURE0_LOW_ADDR, 0xfffffff);
+ WREG32(mmVM_PRT_APERTURE1_LOW_ADDR, 0xfffffff);
+ WREG32(mmVM_PRT_APERTURE2_LOW_ADDR, 0xfffffff);
+ WREG32(mmVM_PRT_APERTURE3_LOW_ADDR, 0xfffffff);
+ WREG32(mmVM_PRT_APERTURE0_HIGH_ADDR, 0x0);
+ WREG32(mmVM_PRT_APERTURE1_HIGH_ADDR, 0x0);
+ WREG32(mmVM_PRT_APERTURE2_HIGH_ADDR, 0x0);
+ WREG32(mmVM_PRT_APERTURE3_HIGH_ADDR, 0x0);
+       }
+}
+

static int gmc_v6_0_gart_enable(struct amdgpu_device *adev)

 {
         int r, i;
drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c +1 -0
@@ -1080,6 +1142,7 @@ static const struct amd_ip_funcs 
 gmc_v6_0_ip_funcs = {
 static const struct amdgpu_gart_funcs gmc_v6_0_gart_funcs = {
         .flush_gpu_tlb = gmc_v6_0_gart_flush_gpu_tlb,
         .set_pte_pde = gmc_v6_0_gart_set_pte_pde,
+       .set_prt = gmc_v6_0_set_prt,
 };
 

static const struct amdgpu_irq_src_funcs gmc_v6_0_irq_funcs = {

Signature · 1 line
2.5.0
Quoted 11 lines
Quoted 10 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
amd-gfx Info Page - lists.freedesktop.org <https://lists.freedesktop.org/mailman/listinfo/amd-gfx>
lists.freedesktop.org
To see the collection of prior postings to the list, visit the amd-gfx Archives. Using amd-gfx: To post a message to all the list members, send email ...

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

#20 lore raw

PATCH 5/6 drm/amdgpu: implement PRT for GFX7

In reply to a message not in the archive

From: Christian König <[email protected]>

Enable/disable the handling globally for now and print a warning when we enable it for the first time.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h   |  1 +
 drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c | 57 +++++++++++++++++++++++++++++++++++
 2 files changed, 58 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
index 99ca5e8..d8516dd 100644
@@ -571,6 +571,7 @@ struct amdgpu_mc {
 	uint32_t		vram_type;
 	uint32_t                srbm_soft_reset;
 	struct amdgpu_mode_mc_save save;
+	bool			prt_warning;
 };
 
 /*
drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c +57 -0

69 lines not on this page · raw message

Signature · 6 lines
2.5.0

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

PATCH 6/6 drm/amdgpu: implement PRT for GFX8

In reply to a message not in the archive

From: Christian König <[email protected]>

Enable/disable the handling globally for now and print a warning when we enable it for the first time.

---
 drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c | 57 +++++++++++++++++++++++++++++++++++
 1 file changed, 57 insertions(+)
drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c +57 -0
index 7669b32..d950a03 100644
@@ -595,6 +595,62 @@ static void gmc_v8_0_set_fault_enable_default(struct amdgpu_device *adev,
 }
 
 /**
+ * gmc_v8_0_set_prt - set PRT VM fault
+ *
+ * @adev: amdgpu_device pointer
+ * @enable: enable/disable VM fault handling for PRT
+*/
+static void gmc_v8_0_set_prt(struct amdgpu_device *adev, bool enable)
+{
+	u32 tmp;
+
+	if (enable && !adev->mc.prt_warning) {
+		dev_warn(adev->dev, "Disabling VM faults because of PRT request!\n");
+		adev->mc.prt_warning = true;
+	}
+
+	tmp = RREG32(mmVM_PRT_CNTL);
+	tmp = REG_SET_FIELD(tmp, VM_PRT_CNTL,
+			    CB_DISABLE_READ_FAULT_ON_UNMAPPED_ACCESS, enable);
+	tmp = REG_SET_FIELD(tmp, VM_PRT_CNTL,
+			    CB_DISABLE_WRITE_FAULT_ON_UNMAPPED_ACCESS, enable);
+	tmp = REG_SET_FIELD(tmp, VM_PRT_CNTL,
+			    TC_DISABLE_READ_FAULT_ON_UNMAPPED_ACCESS, enable);
+	tmp = REG_SET_FIELD(tmp, VM_PRT_CNTL,
+			    TC_DISABLE_WRITE_FAULT_ON_UNMAPPED_ACCESS, enable);
+	tmp = REG_SET_FIELD(tmp, VM_PRT_CNTL,
+			    L2_CACHE_STORE_INVALID_ENTRIES, enable);
+	tmp = REG_SET_FIELD(tmp, VM_PRT_CNTL,
+			    L1_TLB_STORE_INVALID_ENTRIES, enable);
+	tmp = REG_SET_FIELD(tmp, VM_PRT_CNTL,
+			    MASK_PDE0_FAULT, enable);
+	WREG32(mmVM_CONTEXT1_CNTL, tmp);
+
+	if (enable) {
+		uint32_t low = AMDGPU_VA_RESERVED_SIZE >> AMDGPU_GPU_PAGE_SHIFT;
+		uint32_t high = adev->vm_manager.max_pfn;
+
+		WREG32(mmVM_PRT_APERTURE0_LOW_ADDR, low);
+		WREG32(mmVM_PRT_APERTURE1_LOW_ADDR, low);
+		WREG32(mmVM_PRT_APERTURE2_LOW_ADDR, low);
+		WREG32(mmVM_PRT_APERTURE3_LOW_ADDR, low);
+		WREG32(mmVM_PRT_APERTURE0_HIGH_ADDR, high);
+		WREG32(mmVM_PRT_APERTURE1_HIGH_ADDR, high);
+		WREG32(mmVM_PRT_APERTURE2_HIGH_ADDR, high);
+		WREG32(mmVM_PRT_APERTURE3_HIGH_ADDR, high);
+	} else {
+		WREG32(mmVM_PRT_APERTURE0_LOW_ADDR, 0xfffffff);
+		WREG32(mmVM_PRT_APERTURE1_LOW_ADDR, 0xfffffff);
+		WREG32(mmVM_PRT_APERTURE2_LOW_ADDR, 0xfffffff);
+		WREG32(mmVM_PRT_APERTURE3_LOW_ADDR, 0xfffffff);
+		WREG32(mmVM_PRT_APERTURE0_HIGH_ADDR, 0x0);
+		WREG32(mmVM_PRT_APERTURE1_HIGH_ADDR, 0x0);
+		WREG32(mmVM_PRT_APERTURE2_HIGH_ADDR, 0x0);
+		WREG32(mmVM_PRT_APERTURE3_HIGH_ADDR, 0x0);
+	}
+}
+
+/**
  * gmc_v8_0_gart_enable - gart enable
  *
  * @adev: amdgpu_device pointer
@@ -1485,6 +1541,7 @@ static const struct amd_ip_funcs gmc_v8_0_ip_funcs = {
 static const struct amdgpu_gart_funcs gmc_v8_0_gart_funcs = {
 	.flush_gpu_tlb = gmc_v8_0_gart_flush_gpu_tlb,
 	.set_pte_pde = gmc_v8_0_gart_set_pte_pde,
+	.set_prt = gmc_v8_0_set_prt,
 };
 
 static const struct amdgpu_irq_src_funcs gmc_v8_0_irq_funcs = {
Signature · 6 lines
2.5.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#22 lore raw
In reply to a message not in the archive

[ Cc John for addrlib ]

Quoted 3 lines · Christian König

An open problem with the proposal is that we don't know when or if we want to add the userspace implementation into radeonsi.

So price question could you guys use this for radv as well? Or is it sufficient to just write an unit test for it?

For radeonsi, I think the question is more "when", not "if". At least PRT/sparse textures are necessarily immutable, so the associated Mesa headache should be bounded, but still...

As you know, I think the ioctl interface is good.

One thing to keep in mind is that I don't know how well PRT layout is supported by the open addrlib. There have been a bunch of PRT-related fixes in the internal copy of addrlib, but opening them has been stuck in review limbo for a while now...

Cheers,
Nicolai

Quoted 9 lines

Best regards,
Christian.

_______________________________________________
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

#23 lore raw
In reply to a message not in the archive
Quoted 9 lines · Christian König

Hi Dave and Bas,

Hi Dave and Bas,

the following set of patches is a proposal for adding support for partial resident textures (PRT) to the amdgpu kernel module.

The basic idea behind PRT support is that you turn of VM fault reporting and only map parts of a texture into your virtual address space.

If we add some backing to a range, do we need to unmap the PRT range, split and map two PRt ranges? Or will this be handled like mmap and a new map just overrides the earlier maps for that range?

Quoted 4 lines

When a shader now tries to sample from a not present page it gets a notification instead of a VM fault and can react gracefully by switch to a different LOD for example.

So to confirm this is just using texture instruction with the TFE bit enabled, no trap handlers or such?

Quoted 7 lines

On our current available hardware generation you can unfortunately only turn of VM faults globally, but on future generation you can do this on a per page basis. So my proposal is to have a consistent interface over all generations with a per mapping PRT flag, but enable/disable it globally on current hardware when the first/last mapping is made/destroyed.

Quoted 5 lines

An open problem with the proposal is that we don't know when or if we want to add the userspace implementation into radeonsi.

So price question could you guys use this for radv as well? Or is it sufficient to just write an unit test for it?

So this API seems usable, and I think this is something we can use for radv. However, I'm not sure how much time it takes for us to implement, as the TFE variants are not in LLVM yet and I haven't figured out what values the NACKs get.

Furthermore, if addrlib is missing stuff like Nicolai suggests then that could result in complications. I can try if I can get something working over the weekend, but no promises.

As far as an unit test being sufficient, I assume you mean as open source user for inclusion into the kernel? I think that'd be a question answered better by Dave.

Quoted 8 lines

Best regards,
Christian.

_______________________________________________
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): 1485867969.839629.865389344.09B29312-2RFepEojUI2N1INw9kWLP6GC3tUn3ZHUQQ4Iyu8u01E@public.gmane.org

#25 lore raw

Am 31.01.2017 um 14:06 schrieb Bas Nieuwenhuizen:

Quoted 6 lines · Christian König
Quoted 4 lines

Hi Dave and Bas,

Hi Dave and Bas,

Quoted 8 lines
Quoted 5 lines

the following set of patches is a proposal for adding support for partial resident textures (PRT) to the amdgpu kernel module.

The basic idea behind PRT support is that you turn of VM fault reporting and only map parts of a texture into your virtual address space.

If we add some backing to a range, do we need to unmap the PRT range, split and map two PRt ranges? Or will this be handled like mmap and a new map just overrides the earlier maps for that range?

Currently the idea is to unmap the PRT range first and then map the new stuff. But I've already discussed internally with Nicolai a couple of alternatives.

The problem is that IOCTL are supposed to be transactional, e.g. they either fail completely or they success completely. But that is rather tricky when you need to split mappings like you suggested as well.

So at least for the initial implementation I would like to stick to manual unmap calls we can still add the ability to split mappings later on if we find performance problems with that approach

Quoted 5 lines
Quoted 3 lines

When a shader now tries to sample from a not present page it gets a notification instead of a VM fault and can react gracefully by switch to a different LOD for example.

So to confirm this is just using texture instruction with the TFE bit enabled, no trap handlers or such?

I'm not so deeply into the shader instructions, but I think so yes.

Quoted 9 lines
Quoted 9 lines

On our current available hardware generation you can unfortunately only turn of VM faults globally, but on future generation you can do this on a per page basis. So my proposal is to have a consistent interface over all generations with a per mapping PRT flag, but enable/disable it globally on current hardware when the first/last mapping is made/destroyed.

An open problem with the proposal is that we don't know when or if we want to add the userspace implementation into radeonsi.

Quoted 6 lines
Quoted 2 lines

So price question could you guys use this for radv as well? Or is it sufficient to just write an unit test for it?

So this API seems usable, and I think this is something we can use for radv. However, I'm not sure how much time it takes for us to implement, as the TFE variants are not in LLVM yet and I haven't figured out what values the NACKs get.

Actually this is also useful without the special NACK handling. E.g. when you sample from a texture part which isn't present you always get zero and writes are ignored.

The TFE bit and the extra signaling to for special handling in shader code are only optional if I'm not completely mistaken.

Quoted 3 lines

Furthermore, if addrlib is missing stuff like Nicolai suggests then that could result in complications. I can try if I can get something working over the weekend, but no promises.

Not sure what concern Nicolai has about addrlib here. In general we should know where the different parts of a texture start (LODs, layers etc...) and as far as I can see that's all you need to know.

Quoted 2 lines

As far as an unit test being sufficient, I assume you mean as open source user for inclusion into the kernel?

Yes.

Quoted 2 lines

I think that'd be a question
answered better by Dave.

Yeah, though so as well. Dave can you comment?

Thanks for the comments,
Christian.

Quoted 4 lines
Quoted 4 lines

Best regards,
Christian.

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

A message that is not in the archive (sent off-list or not yet received): ba418c16-e2ca-ddff-4147-387e5b7a2d14-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org

#27 lore raw
Quoted 6 lines · Christian König

Am 31.01.2017 um 14:06 schrieb Bas Nieuwenhuizen:

Quoted 4 lines

So this API seems usable, and I think this is something we can use for radv. However, I'm not sure how much time it takes for us to implement, as the TFE variants are not in LLVM yet and I haven't figured out what values the NACKs get.

Quoted 6 lines

Actually this is also useful without the special NACK handling. E.g. when you sample from a texture part which isn't present you always get zero and writes are ignored.

The TFE bit and the extra signaling to for special handling in shader code are only optional if I'm not completely mistaken.

I think it's needed for ARB_sparse_texture2 / whatever the Vulkan equivalent of that is. But yeah, I don't think ARB_sparse_texture needs TFE support in LLVM.

Quoted 7 lines
Quoted 3 lines

Furthermore, if addrlib is missing stuff like Nicolai suggests then that could result in complications. I can try if I can get something working over the weekend, but no promises.

Not sure what concern Nicolai has about addrlib here. In general we should know where the different parts of a texture start (LODs, layers etc...) and as far as I can see that's all you need to know.

Well, you're right that it's probably possible to work with the open addrlib already.

In particular, you need address info not just for layers and levels, but also for blocks within each 2D image, to be able to compute VIRTUAL_PAGE_SIZE_X/Y, and to map them to the corresponding addresses.

There are AddrComputeSurfaceAddrFromCoord and AddrComputeSurfaceCoordFromAddr functions that can be tricked into providing the necessary info.

It may be more natural with some additional functions that aren't open yet.

Also, you might possibly want different tilings for sparse textures, but I don't think that's really needed for an initial implementation.

Cheers,
Nicolai

Quoted 27 lines
Quoted 2 lines

As far as an unit test being sufficient, I assume you mean as open source user for inclusion into the kernel?

Yes.

Quoted 2 lines

I think that'd be a question
answered better by Dave.

Yeah, though so as well. Dave can you comment?

Thanks for the comments,
Christian.

Quoted 4 lines
Quoted 4 lines

Best regards,
Christian.

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

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

#28 lore raw
In reply to a message not in the archive
Quoted 4 lines
Quoted 1 line

answered better by Dave.

Yeah, though so as well. Dave can you comment?

I think we would require a fully open source user for this sort of thing, there are way to many corner cases for us to fall down here, prematurely pushing the API without a proven test suite running on it would be bad.

We'd want to get radeonsi or radv up and running and have a complete run of the conformance suite to make sure the kernel API was sane, design is good, proving the design is the hard bit.

And uggh on addrlib, just stick the whole thing on github already.

Dave.
_______________________________________________
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): CAPM=9tzUNgK5MHVBaMzVsn-z=Pn-nSBFTswUcGc+zttbYLE7FA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#30 lore raw

[ ceterum censeo, + John for addrlib :P ]

Quoted 5 lines · Dave Airlie
Quoted 4 lines
Quoted 1 line

answered better by Dave.

Yeah, though so as well. Dave can you comment?

Quoted 7 lines

I think we would require a fully open source user for this sort of thing, there are way to many corner cases for us to fall down here, prematurely pushing the API without a proven test suite running on it would be bad.

We'd want to get radeonsi or radv up and running and have a complete run of the conformance suite to make sure the kernel API was sane, design is good, proving the design is the hard bit.

I think we can start with just GL_ARB_sparse_buffer. That extension isn't as useful in comparison, but it exercises all the memory management bits without having to worry about texture layout considerations, and doing that one first seems like a reasonable development strategy anyway.

Quoted 1 line

And uggh on addrlib, just stick the whole thing on github already.

I wish :/

Nicolai
_______________________________________________
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): 720067e3-c786-0af0-aec6-dfd1f41db378-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#32 lore raw
Quoted 16 lines · Nicolai Hähnle

[ ceterum censeo, + John for addrlib :P ]

Quoted 5 lines · Dave Airlie
Quoted 4 lines
Quoted 1 line

answered better by Dave.

Yeah, though so as well. Dave can you comment?

Quoted 7 lines

I think we would require a fully open source user for this sort of thing, there are way to many corner cases for us to fall down here, prematurely pushing the API without a proven test suite running on it would be bad.

We'd want to get radeonsi or radv up and running and have a complete run of the conformance suite to make sure the kernel API was sane, design is good, proving the design is the hard bit.

Quoted 5 lines

I think we can start with just GL_ARB_sparse_buffer. That extension isn't as useful in comparison, but it exercises all the memory management bits without having to worry about texture layout considerations, and doing that one first seems like a reasonable development strategy anyway.

Yeah, I noticed that vulkan had a similar extension that can be done pretty easily, trying to get that done before the weekend.

What would be a plan for upstreaming all this? In an earlier case (the wait on multiple fences ioctl), AFAIU the problem for upstreaming was that there was no open-source user. However I then wrote a branch (which is probably outdated by now ...), but would like to wait with upstreaming it till I know which libdrm and kernel driver version to use for the feature tests. As a result all three the parts (kernel, libdrm, radv) haven't been upstreamed yet. How can we avoid having the same problem with this feature?

Quoted 7 lines
Quoted 3 lines

And uggh on addrlib, just stick the whole thing on github already.

I wish :/

Nicolai

_______________________________________________
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): 1486027743.694234.867769672.09921E90-2RFepEojUI2N1INw9kWLP6GC3tUn3ZHUQQ4Iyu8u01E@public.gmane.org

#34 lore raw
Quoted 10 lines · Bas Nieuwenhuizen
Quoted 9 lines · Nicolai Hähnle
Quoted 7 lines · Dave Airlie

I think we would require a fully open source user for this sort of thing, there are way to many corner cases for us to fall down here, prematurely pushing the API without a proven test suite running on it would be bad.

We'd want to get radeonsi or radv up and running and have a complete run of the conformance suite to make sure the kernel API was sane, design is good, proving the design is the hard bit.

Quoted 8 lines
Quoted 5 lines

I think we can start with just GL_ARB_sparse_buffer. That extension isn't as useful in comparison, but it exercises all the memory management bits without having to worry about texture layout considerations, and doing that one first seems like a reasonable development strategy anyway.

Yeah, I noticed that vulkan had a similar extension that can be done pretty easily, trying to get that done before the weekend.

That would be cool. I thought of doing this for radeonsi, but I seriously doubt that I'll get to it any time soon.

Quoted 8 lines

What would be a plan for upstreaming all this? In an earlier case (the wait on multiple fences ioctl), AFAIU the problem for upstreaming was that there was no open-source user. However I then wrote a branch (which is probably outdated by now ...), but would like to wait with upstreaming it till I know which libdrm and kernel driver version to use for the feature tests. As a result all three the parts (kernel, libdrm, radv) haven't been upstreamed yet. How can we avoid having the same problem with this feature?

Once all the parts are there, the sequence should be upstream kernel, upstream libdrm, upstream radv.

Maybe you can ping the corresponding threads or re-send the patches for review?

Nicolai
_______________________________________________
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): 0ace8731-3737-a88d-807c-f30d7be9070e-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#36 lore raw

Am 02.02.2017 um 10:33 schrieb Nicolai Hähnle:

Quoted 17 lines · Bas Nieuwenhuizen
Quoted 16 lines · Nicolai Hähnle
Quoted 14 lines · Dave Airlie
Quoted 7 lines

I think we would require a fully open source user for this sort of thing, there are way to many corner cases for us to fall down here, prematurely pushing the API without a proven test suite running on it would be bad.

We'd want to get radeonsi or radv up and running and have a complete run of the conformance suite to make sure the kernel API was sane, design is good, proving the design is the hard bit.

I think we can start with just GL_ARB_sparse_buffer. That extension isn't as useful in comparison, but it exercises all the memory management bits without having to worry about texture layout considerations, and doing that one first seems like a reasonable development strategy anyway.

Quoted 4 lines
Quoted 2 lines

Yeah, I noticed that vulkan had a similar extension that can be done pretty easily, trying to get that done before the weekend.

That would be cool. I thought of doing this for radeonsi, but I seriously doubt that I'll get to it any time soon.

Thanks, that would be great. I'm going to send out my latest bug fixes for the kernel side in a few minutes.

Quoted 11 lines
Quoted 10 lines

What would be a plan for upstreaming all this? In an earlier case (the wait on multiple fences ioctl), AFAIU the problem for upstreaming was that there was no open-source user. However I then wrote a branch (which is probably outdated by now ...), but would like to wait with upstreaming it till I know which libdrm and kernel driver version to use for the feature tests. As a result all three the parts (kernel, libdrm, radv) haven't been upstreamed yet. How can we avoid having the same problem with this feature?

Quoted 3 lines

Once all the parts are there, the sequence should be upstream kernel, upstream libdrm, upstream radv.

Maybe you can ping the corresponding threads or re-send the patches for review?

Alex did that internally just last week, but nobody volunteered to take care of pushing it.

Basically everybody is just to busy to look into it.

Regards,
Christian.

Quoted 2 lines

Nicolai

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

#37 lore raw
In reply to a message not in the archive
Quoted 9 lines · Christian König

Hi Dave and Bas,

Hi Dave and Bas,

the following set of patches is a proposal for adding support for partial resident textures (PRT) to the amdgpu kernel module.

The basic idea behind PRT support is that you turn of VM fault reporting and only map parts of a texture into your virtual address space.

When a shader now tries to sample from a not present page it gets a notification instead of a VM fault and can react gracefully by switch to a different LOD for example.

Do we actually need to disable faults? I guess the shader hw probably requires it to get the proper result in the shader?

Alex

Quoted 7 lines

On our current available hardware generation you can unfortunately only turn of VM faults globally, but on future generation you can do this on a per page basis. So my proposal is to have a consistent interface over all generations with a per mapping PRT flag, but enable/disable it globally on current hardware when the first/last mapping is made/destroyed.

An open problem with the proposal is that we don't know when or if we want to add the userspace implementation into radeonsi.

So price question could you guys use this for radv as well? Or is it sufficient to just write an unit test for it?

Quoted 7 lines

Best regards,
Christian.

_______________________________________________
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_P1qAznmzCaYahL0ud=HhCR+8BD3RUVEpm32nZx-STVmA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#39 lore raw

Am 31.01.2017 um 17:09 schrieb Alex Deucher:

Quoted 6 lines
Quoted 4 lines · Christian König

Hi Dave and Bas,

Hi Dave and Bas,

Quoted 7 lines
Quoted 5 lines

the following set of patches is a proposal for adding support for partial resident textures (PRT) to the amdgpu kernel module.

The basic idea behind PRT support is that you turn of VM fault reporting and only map parts of a texture into your virtual address space.

When a shader now tries to sample from a not present page it gets a notification instead of a VM fault and can react gracefully by switch to a different LOD for example.

Do we actually need to disable faults? I guess the shader hw probably requires it to get the proper result in the shader?

Yes, you need to disable the VM faults for the PRT range otherwise the interrupt ring will just be flooded with faults.

Keep in mind that faults (or rather NACKs from the MC) are considered normal with that approach. This is also the reason why we need to change the TLB rules and also keep invalid entries in there.

Regards,
Christian.

Quoted 12 lines

Alex

Quoted 9 lines

On our current available hardware generation you can unfortunately only turn of VM faults globally, but on future generation you can do this on a per page basis. So my proposal is to have a consistent interface over all generations with a per mapping PRT flag, but enable/disable it globally on current hardware when the first/last mapping is made/destroyed.

An open problem with the proposal is that we don't know when or if we want to add the userspace implementation into radeonsi.

So price question could you guys use this for radv as well? Or is it sufficient to just write an unit test for it?

Best regards,
Christian.

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