Skip to contentSkip to conversation

drm/amdgpu/psp: move TMR to cpu invisible vram region

PATCH In review Tianci Yin 2 participants 3 messages Aug 19, 2019 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

Tianci Yin

author
#0 lore raw

PATCH 1/1 drm/amdgpu/psp: move TMR to cpu invisible vram region

From: "Tianci.Yin" <[email protected]>

so that more visible vram can be available for ocl applications.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 5 +++--
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c    | 4 ++--
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h    | 1 -
 3 files changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +3 -2
index 1059771..ca35869 100644
@@ -246,8 +246,9 @@ int amdgpu_bo_create_reserved(struct amdgpu_device *adev,
 	bp.size = size;
 	bp.byte_align = align;
 	bp.domain = domain;
-	bp.flags = AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED |
-		AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS;
+	bp.flags = (cpu_addr)?AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED
+		:AMDGPU_GEM_CREATE_NO_CPU_ACCESS;
+	bp.flags |= AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS;
 	bp.type = ttm_bo_type_kernel;
 	bp.resv = NULL;
 
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +2 -2
index 7715c0d..5e7fbbe 100644
@@ -264,7 +264,7 @@ static int psp_tmr_init(struct psp_context *psp)
 
 	ret = amdgpu_bo_create_kernel(psp->adev, tmr_size, PSP_TMR_SIZE,
 				      AMDGPU_GEM_DOMAIN_VRAM,
-				      &psp->tmr_bo, &psp->tmr_mc_addr, &psp->tmr_buf);
+				      &psp->tmr_bo, &psp->tmr_mc_addr, NULL);
 
 	return ret;
 }
@@ -1215,7 +1215,7 @@ static int psp_hw_fini(void *handle)
 
 	psp_ring_destroy(psp, PSP_RING_TYPE__KM);
 
-	amdgpu_bo_free_kernel(&psp->tmr_bo, &psp->tmr_mc_addr, &psp->tmr_buf);
+	amdgpu_bo_free_kernel(&psp->tmr_bo, &psp->tmr_mc_addr, NULL);
 	amdgpu_bo_free_kernel(&psp->fw_pri_bo,
 			      &psp->fw_pri_mc_addr, &psp->fw_pri_buf);
 	amdgpu_bo_free_kernel(&psp->fence_buf_bo,
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h +0 -1
index 0029fa2..48b057d 100644
@@ -172,7 +172,6 @@ struct psp_context
 	/* tmr buffer */
 	struct amdgpu_bo		*tmr_bo;
 	uint64_t			tmr_mc_addr;
-	void				*tmr_buf;
 
 	/* asd firmware and buffer */
 	const struct firmware		*asd_fw;
Signature · 6 lines
2.7.4

_______________________________________________
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): 1566200092-17283-1-git-send-email-tianci.yin-5C7GfCeVMHo@public.gmane.org

#2 lore raw

Am 19.08.19 um 09:34 schrieb Tianci Yin:

Quoted 16 lines

From: "Tianci.Yin" <[email protected]>

so that more visible vram can be available for ocl applications.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 5 +++--
  drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c    | 4 ++--
  drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h    | 1 -
  3 files changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +0 -0
index 1059771..ca35869 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_object.c int amdgpu_bo_create_reserved(struct amdgpu_device *adev, · line 250

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +2 -2
@@ -246,8 +246,9 @@ int amdgpu_bo_create_reserved(struct amdgpu_device *adev,
  	bp.size = size;
  	bp.byte_align = align;
  	bp.domain = domain;
-	bp.flags = AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED |
-		AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS;
+	bp.flags = (cpu_addr)?AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED
+		:AMDGPU_GEM_CREATE_NO_CPU_ACCESS;

Coding style: You can drop the "()",  but there should be spaces before and after the "?" and ":".

And please double check that this change doesn't affect any other user of amdgpu_bo_create_kernel()/amdgpu_bo_create_reserved().

Apart from that looks good to me and is a nice improvement, Christian.

Quoted 31 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +1 -0
+	bp.flags |= AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS;
  	bp.type = ttm_bo_type_kernel;
  	bp.resv = NULL;
 
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +2 -2
index 7715c0d..5e7fbbe 100644
@@ -264,7 +264,7 @@ static int psp_tmr_init(struct psp_context *psp)
 
  	ret = amdgpu_bo_create_kernel(psp->adev, tmr_size, PSP_TMR_SIZE,
  				      AMDGPU_GEM_DOMAIN_VRAM,
-				      &psp->tmr_bo, &psp->tmr_mc_addr, &psp->tmr_buf);
+				      &psp->tmr_bo, &psp->tmr_mc_addr, NULL);
 
  	return ret;
  }
@@ -1215,7 +1215,7 @@ static int psp_hw_fini(void *handle)
 
  	psp_ring_destroy(psp, PSP_RING_TYPE__KM);
 
-	amdgpu_bo_free_kernel(&psp->tmr_bo, &psp->tmr_mc_addr, &psp->tmr_buf);
+	amdgpu_bo_free_kernel(&psp->tmr_bo, &psp->tmr_mc_addr, NULL);
  	amdgpu_bo_free_kernel(&psp->fw_pri_bo,
  			      &psp->fw_pri_mc_addr, &psp->fw_pri_buf);
  	amdgpu_bo_free_kernel(&psp->fence_buf_bo,
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h +0 -0
index 0029fa2..48b057d 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h struct psp_context · line 177

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h +0 -1
@@ -172,7 +172,6 @@ struct psp_context
  	/* tmr buffer */
  	struct amdgpu_bo		*tmr_bo;
  	uint64_t			tmr_mc_addr;
-	void				*tmr_buf;
 
  	/* asd firmware and buffer */
  	const struct firmware		*asd_fw;

_______________________________________________
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): 8f923347-6255-c663-03fd-fe77aa4e3eff-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#4 lore raw

Thanks Christian, I'll improve the coding style.
________________________________
From: Christian K?nig <[email protected]>
Sent: Monday, August 19, 2019 15:39
To: Yin, Tianci (Rico) <[email protected]>; [email protected] <[email protected]>
Cc: Xiao, Jack <[email protected]>; Yuan, Xiaojie <[email protected]>; Zhang, Hawking <[email protected]>
Subject: Re: [PATCH] drm/amdgpu/psp: move TMR to cpu invisible vram region

Am 19.08.19 um 09:34 schrieb Tianci Yin:

Quoted 16 lines

From: "Tianci.Yin" <[email protected]>

so that more visible vram can be available for ocl applications.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 5 +++--
  drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c    | 4 ++--
  drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h    | 1 -
  3 files changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +0 -0
index 1059771..ca35869 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_object.c int amdgpu_bo_create_reserved(struct amdgpu_device *adev, · line 250

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +2 -2
@@ -246,8 +246,9 @@ int amdgpu_bo_create_reserved(struct amdgpu_device *adev,
       bp.size = size;
       bp.byte_align = align;
       bp.domain = domain;
-     bp.flags = AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED |
-             AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS;
+     bp.flags = (cpu_addr)?AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED
+             :AMDGPU_GEM_CREATE_NO_CPU_ACCESS;

Coding style: You can drop the "()", but there should be spaces before and after the "?" and ":".

And please double check that this change doesn't affect any other user of amdgpu_bo_create_kernel()/amdgpu_bo_create_reserved().

Apart from that looks good to me and is a nice improvement, Christian.

Quoted 31 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +1 -0
+     bp.flags |= AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS;
       bp.type = ttm_bo_type_kernel;
       bp.resv = NULL;
 
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +2 -2
index 7715c0d..5e7fbbe 100644
@@ -264,7 +264,7 @@ static int psp_tmr_init(struct psp_context *psp)
 
       ret = amdgpu_bo_create_kernel(psp->adev, tmr_size, PSP_TMR_SIZE,
                                     AMDGPU_GEM_DOMAIN_VRAM,
-                                   &psp->tmr_bo, &psp->tmr_mc_addr, &psp->tmr_buf);
+                                   &psp->tmr_bo, &psp->tmr_mc_addr, NULL);
 
       return ret;
  }
@@ -1215,7 +1215,7 @@ static int psp_hw_fini(void *handle)
 
       psp_ring_destroy(psp, PSP_RING_TYPE__KM);
 
-     amdgpu_bo_free_kernel(&psp->tmr_bo, &psp->tmr_mc_addr, &psp->tmr_buf);
+     amdgpu_bo_free_kernel(&psp->tmr_bo, &psp->tmr_mc_addr, NULL);
       amdgpu_bo_free_kernel(&psp->fw_pri_bo,
                             &psp->fw_pri_mc_addr, &psp->fw_pri_buf);
       amdgpu_bo_free_kernel(&psp->fence_buf_bo,
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h +0 -0
index 0029fa2..48b057d 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h struct psp_context · line 177

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h +0 -1
@@ -172,7 +172,6 @@ struct psp_context
       /* tmr buffer */
       struct amdgpu_bo                *tmr_bo;
       uint64_t                        tmr_mc_addr;
-     void                            *tmr_buf;
 
       /* asd firmware and buffer */
       const struct firmware           *asd_fw;

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