Skip to contentSkip to conversation

drm/amdgpu: Use better names to reflect it is CP MQD buffer

PATCH In review Yong Zhao 2 participants 2 messages Mar 4, 2020 – Mar 5, 2020

Subsystems (4)
lore
Share & tools
lore

Yong Zhao

author
#0 lore raw

PATCH 1/1 drm/amdgpu: Use better names to reflect it is CP MQD buffer

Add "CP" to AMDGPU_GEM_CREATE_MQD_GFX9 to indicate it is only for CP MQD.

Change-Id Ie69cd3ba477e4bac161ea5b20ec2919a35f3528e
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 6 +++---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c    | 7 +++++--
 include/uapi/drm/amdgpu_drm.h              | 2 +-
 3 files changed, 9 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +3 -3
index bc2e72a66db9..726c91ab6761 100644
@@ -224,7 +224,7 @@ void amdgpu_amdkfd_gpu_reset(struct kgd_dev *kgd)
 
 int amdgpu_amdkfd_alloc_gtt_mem(struct kgd_dev *kgd, size_t size,
 				void **mem_obj, uint64_t *gpu_addr,
-				void **cpu_ptr, bool mqd_gfx9)
+				void **cpu_ptr, bool cp_mqd_gfx9)
 {
 	struct amdgpu_device *adev = (struct amdgpu_device *)kgd;
 	struct amdgpu_bo *bo = NULL;
@@ -240,8 +240,8 @@ int amdgpu_amdkfd_alloc_gtt_mem(struct kgd_dev *kgd, size_t size,
 	bp.type = ttm_bo_type_kernel;
 	bp.resv = NULL;
 
-	if (mqd_gfx9)
-		bp.flags |= AMDGPU_GEM_CREATE_MQD_GFX9;
+	if (cp_mqd_gfx9)
+		bp.flags |= AMDGPU_GEM_CREATE_CP_MQD_GFX9;
 
 	r = amdgpu_bo_create(adev, &bp, &bo);
 	if (r) {
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +5 -2
index fca87bafe174..665db2353a78 100644
@@ -1043,7 +1043,7 @@ int amdgpu_ttm_gart_bind(struct amdgpu_device *adev,
 	if (amdgpu_bo_encrypted(abo))
 		flags |= AMDGPU_PTE_TMZ;
 
-	if (abo->flags & AMDGPU_GEM_CREATE_MQD_GFX9) {
+	if (abo->flags & AMDGPU_GEM_CREATE_CP_MQD_GFX9) {
 		uint64_t page_idx = 1;
 
 		r = amdgpu_gart_bind(adev, gtt->offset, page_idx,
@@ -1051,7 +1051,10 @@ int amdgpu_ttm_gart_bind(struct amdgpu_device *adev,
 		if (r)
 			goto gart_bind_fail;
 
-		/* Patch mtype of the second part BO */
+		/* The memory type of the first page defaults to UC. Now
+		 * modify the memory type to NC from the second page of
+		 * the BO onward.
+		 */
 		flags &= ~AMDGPU_PTE_MTYPE_VG10_MASK;
 		flags |= AMDGPU_PTE_MTYPE_VG10(AMDGPU_MTYPE_NC);
 
include/uapi/drm/amdgpu_drm.h +1 -1
index eaf94a421901..1e59c0146531 100644
@@ -130,7 +130,7 @@ extern "C" {
 /* Flag that indicates allocating MQD gart on GFX9, where the mtype
  * for the second page onward should be set to NC.
  */
-#define AMDGPU_GEM_CREATE_MQD_GFX9		(1 << 8)
+#define AMDGPU_GEM_CREATE_CP_MQD_GFX9		(1 << 8)
 /* Flag that BO may contain sensitive data that must be wiped before
  * releasing the memory
  */
Signature · 6 lines
2.17.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Acked-by on v1 1/1
#1 lore raw

Am 04.03.20 um 21:35 schrieb Yong Zhao:

Quoted 1 line

Add "CP" to AMDGPU_GEM_CREATE_MQD_GFX9 to indicate it is only for CP MQD.

You should probably note that we can do this because it was always illegal for userspace to use the flag.

Quoted 2 lines
Change-Id Ie69cd3ba477e4bac161ea5b20ec2919a35f3528e
Quoted 60 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 6 +++---
  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c    | 7 +++++--
  include/uapi/drm/amdgpu_drm.h              | 2 +-
  3 files changed, 9 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +3 -3
index bc2e72a66db9..726c91ab6761 100644
@@ -224,7 +224,7 @@ void amdgpu_amdkfd_gpu_reset(struct kgd_dev *kgd)
 
  int amdgpu_amdkfd_alloc_gtt_mem(struct kgd_dev *kgd, size_t size,
  				void **mem_obj, uint64_t *gpu_addr,
-				void **cpu_ptr, bool mqd_gfx9)
+				void **cpu_ptr, bool cp_mqd_gfx9)
  {
  	struct amdgpu_device *adev = (struct amdgpu_device *)kgd;
  	struct amdgpu_bo *bo = NULL;
@@ -240,8 +240,8 @@ int amdgpu_amdkfd_alloc_gtt_mem(struct kgd_dev *kgd, size_t size,
  	bp.type = ttm_bo_type_kernel;
  	bp.resv = NULL;
 
-	if (mqd_gfx9)
-		bp.flags |= AMDGPU_GEM_CREATE_MQD_GFX9;
+	if (cp_mqd_gfx9)
+		bp.flags |= AMDGPU_GEM_CREATE_CP_MQD_GFX9;
 
  	r = amdgpu_bo_create(adev, &bp, &bo);
  	if (r) {
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +5 -2
index fca87bafe174..665db2353a78 100644
@@ -1043,7 +1043,7 @@ int amdgpu_ttm_gart_bind(struct amdgpu_device *adev,
  	if (amdgpu_bo_encrypted(abo))
  		flags |= AMDGPU_PTE_TMZ;
 
-	if (abo->flags & AMDGPU_GEM_CREATE_MQD_GFX9) {
+	if (abo->flags & AMDGPU_GEM_CREATE_CP_MQD_GFX9) {
  		uint64_t page_idx = 1;
 
  		r = amdgpu_gart_bind(adev, gtt->offset, page_idx,
@@ -1051,7 +1051,10 @@ int amdgpu_ttm_gart_bind(struct amdgpu_device *adev,
  		if (r)
  			goto gart_bind_fail;
 
-		/* Patch mtype of the second part BO */
+		/* The memory type of the first page defaults to UC. Now
+		 * modify the memory type to NC from the second page of
+		 * the BO onward.
+		 */
  		flags &= ~AMDGPU_PTE_MTYPE_VG10_MASK;
  		flags |= AMDGPU_PTE_MTYPE_VG10(AMDGPU_MTYPE_NC);
 
include/uapi/drm/amdgpu_drm.h +0 -0
index eaf94a421901..1e59c0146531 100644

include/uapi/drm/amdgpu_drm.h extern "C" { · line 136

Quoted 8 lines
include/uapi/drm/amdgpu_drm.h +1 -1
@@ -130,7 +130,7 @@ extern "C" {
  /* Flag that indicates allocating MQD gart on GFX9, where the mtype
   * for the second page onward should be set to NC.
   */
-#define AMDGPU_GEM_CREATE_MQD_GFX9		(1 << 8)
+#define AMDGPU_GEM_CREATE_CP_MQD_GFX9		(1 << 8)
  /* Flag that BO may contain sensitive data that must be wiped before
   * releasing the memory
   */

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