All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu/psp: move TMR to cpu invisible vram region
@ 2019-08-19  7:34 Tianci Yin
       [not found] ` <1566200092-17283-1-git-send-email-tianci.yin-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Tianci Yin @ 2019-08-19  7:34 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
  Cc: Jack Xiao, Tianci Yin, Xiaojie Yuan, Hawking Zhang

From: "Tianci.Yin" <tianci.yin@amd.com>

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

Signed-off-by: Tianci.Yin <tianci.yin@amd.com>
---
 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(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
index 1059771..ca35869 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
@@ -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;
 
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
index 7715c0d..5e7fbbe 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
@@ -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,
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
index 0029fa2..48b057d 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
@@ -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;
-- 
2.7.4

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] drm/amdgpu/psp: move TMR to cpu invisible vram region
       [not found] ` <1566200092-17283-1-git-send-email-tianci.yin-5C7GfCeVMHo@public.gmane.org>
@ 2019-08-19  7:39   ` Christian König
       [not found]     ` <8f923347-6255-c663-03fd-fe77aa4e3eff-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Christian König @ 2019-08-19  7:39 UTC (permalink / raw)
  To: Tianci Yin, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
  Cc: Jack Xiao, Hawking Zhang, Xiaojie Yuan

Am 19.08.19 um 09:34 schrieb Tianci Yin:
> From: "Tianci.Yin" <tianci.yin@amd.com>
>
> so that more visible vram can be available for ocl applications.
>
> Signed-off-by: Tianci.Yin <tianci.yin@amd.com>
> ---
>   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(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> index 1059771..ca35869 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> @@ -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.

> +	bp.flags |= AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS;
>   	bp.type = ttm_bo_type_kernel;
>   	bp.resv = NULL;
>   
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
> index 7715c0d..5e7fbbe 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
> @@ -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,
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
> index 0029fa2..48b057d 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
> @@ -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
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] drm/amdgpu/psp: move TMR to cpu invisible vram region
       [not found]     ` <8f923347-6255-c663-03fd-fe77aa4e3eff-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2019-08-19  7:44       ` Yin, Tianci (Rico)
  0 siblings, 0 replies; 7+ messages in thread
From: Yin, Tianci (Rico) @ 2019-08-19  7:44 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Koenig, Christian
  Cc: Xiao, Jack, Zhang, Hawking, Yuan, Xiaojie


[-- Attachment #1.1: Type: text/plain, Size: 3852 bytes --]

Thanks Christian, I'll improve the coding style.
________________________________
From: Christian K?nig <ckoenig.leichtzumerken-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Sent: Monday, August 19, 2019 15:39
To: Yin, Tianci (Rico) <Tianci.Yin-5C7GfCeVMHo@public.gmane.org>; amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org <amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>
Cc: Xiao, Jack <Jack.Xiao-5C7GfCeVMHo@public.gmane.org>; Yuan, Xiaojie <Xiaojie.Yuan-5C7GfCeVMHo@public.gmane.org>; Zhang, Hawking <Hawking.Zhang-5C7GfCeVMHo@public.gmane.org>
Subject: Re: [PATCH] drm/amdgpu/psp: move TMR to cpu invisible vram region

Am 19.08.19 um 09:34 schrieb Tianci Yin:
> From: "Tianci.Yin" <tianci.yin-5C7GfCeVMHo@public.gmane.org>
>
> so that more visible vram can be available for ocl applications.
>
> Signed-off-by: Tianci.Yin <tianci.yin-5C7GfCeVMHo@public.gmane.org>
> ---
>   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(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> index 1059771..ca35869 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> @@ -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.

> +     bp.flags |= AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS;
>        bp.type = ttm_bo_type_kernel;
>        bp.resv = NULL;
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
> index 7715c0d..5e7fbbe 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
> @@ -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,
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
> index 0029fa2..48b057d 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
> @@ -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;


[-- Attachment #1.2: Type: text/html, Size: 7305 bytes --]

[-- Attachment #2: Type: text/plain, Size: 153 bytes --]

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] drm/amdgpu/psp: move TMR to cpu invisible vram region
       [not found]         ` <MN2PR12MB2974D98262E42F1C6FB6644A95A80-rweVpJHSKTo/Ss4KemNrlQdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
@ 2019-08-19  8:46           ` Koenig, Christian
  0 siblings, 0 replies; 7+ messages in thread
From: Koenig, Christian @ 2019-08-19  8:46 UTC (permalink / raw)
  To: Yin, Tianci (Rico), amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
  Cc: Xiao, Jack, Zhang, Hawking, Yuan, Xiaojie


[-- Attachment #1.1: Type: text/plain, Size: 4480 bytes --]

OH, STOP!  Good that we talked about that because that would have caused quite a bunch of trouble.

The case in amdgpu_ttm_init() would break, we intentionally reserve memory at the beginning of the visible space here to avoid problem switching between VBIOS and KMS.

I suggest to first add a dummy pointer to amdgpu_ttm_init() to fix this before you apply this patch.

Regards,
Christian.

Am 19.08.19 um 10:16 schrieb Yin, Tianci (Rico):
Thanks very much Christian!

I scanned the whole code, only two functions pass in NULL cpu_addr,
amdgpu_ttm_init() and gfx_v9_0_ngg_create_buf(),
but the related BOs are not further mapped for cpu access.
so I think this change is safe.


________________________________
From: Christian König <ckoenig.leichtzumerken@gmail.com><mailto:ckoenig.leichtzumerken@gmail.com>
Sent: Monday, August 19, 2019 16:07
To: Yin, Tianci (Rico) <Tianci.Yin@amd.com><mailto:Tianci.Yin@amd.com>; amd-gfx@lists.freedesktop.org<mailto:amd-gfx@lists.freedesktop.org> <amd-gfx@lists.freedesktop.org><mailto:amd-gfx@lists.freedesktop.org>
Cc: Xiao, Jack <Jack.Xiao@amd.com><mailto:Jack.Xiao@amd.com>; Yuan, Xiaojie <Xiaojie.Yuan@amd.com><mailto:Xiaojie.Yuan@amd.com>; Zhang, Hawking <Hawking.Zhang@amd.com><mailto:Hawking.Zhang@amd.com>
Subject: Re: [PATCH] drm/amdgpu/psp: move TMR to cpu invisible vram region

Am 19.08.19 um 10:05 schrieb Tianci Yin:
> From: "Tianci.Yin" <tianci.yin@amd.com><mailto:tianci.yin@amd.com>
>
> so that more visible vram can be available for umd.
>
> Signed-off-by: Tianci.Yin <tianci.yin@amd.com><mailto:tianci.yin@amd.com>

Assuming that you checked that we don't have other users who are using
amdgpu_bo_create_kernel() without a CPU pointer this patch is
Reviewed-by: Christian König <christian.koenig@amd.com><mailto:christian.koenig@amd.com>.

> ---
>   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(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> index 1059771..0476790 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> @@ -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;
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
> index 7715c0d..5e7fbbe 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
> @@ -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,
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
> index 0029fa2..48b057d 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
> @@ -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;



[-- Attachment #1.2: Type: text/html, Size: 9396 bytes --]

[-- Attachment #2: Type: text/plain, Size: 153 bytes --]

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] drm/amdgpu/psp: move TMR to cpu invisible vram region
       [not found]     ` <b1b7dd46-8ee5-deaf-1a24-ef152c96dcb6-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2019-08-19  8:16       ` Yin, Tianci (Rico)
       [not found]         ` <MN2PR12MB2974D98262E42F1C6FB6644A95A80-rweVpJHSKTo/Ss4KemNrlQdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Yin, Tianci (Rico) @ 2019-08-19  8:16 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Koenig, Christian
  Cc: Xiao, Jack, Zhang, Hawking, Yuan, Xiaojie


[-- Attachment #1.1: Type: text/plain, Size: 3942 bytes --]

Thanks very much Christian!

I scanned the whole code, only two functions pass in NULL cpu_addr,
amdgpu_ttm_init() and gfx_v9_0_ngg_create_buf(),
but the related BOs are not further mapped for cpu access.
so I think this change is safe.


________________________________
From: Christian König <ckoenig.leichtzumerken-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Sent: Monday, August 19, 2019 16:07
To: Yin, Tianci (Rico) <Tianci.Yin-5C7GfCeVMHo@public.gmane.org>; amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org <amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>
Cc: Xiao, Jack <Jack.Xiao-5C7GfCeVMHo@public.gmane.org>; Yuan, Xiaojie <Xiaojie.Yuan-5C7GfCeVMHo@public.gmane.org>; Zhang, Hawking <Hawking.Zhang-5C7GfCeVMHo@public.gmane.org>
Subject: Re: [PATCH] drm/amdgpu/psp: move TMR to cpu invisible vram region

Am 19.08.19 um 10:05 schrieb Tianci Yin:
> From: "Tianci.Yin" <tianci.yin-5C7GfCeVMHo@public.gmane.org>
>
> so that more visible vram can be available for umd.
>
> Signed-off-by: Tianci.Yin <tianci.yin-5C7GfCeVMHo@public.gmane.org>

Assuming that you checked that we don't have other users who are using
amdgpu_bo_create_kernel() without a CPU pointer this patch is
Reviewed-by: Christian König <christian.koenig-5C7GfCeVMHo@public.gmane.org>.

> ---
>   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(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> index 1059771..0476790 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> @@ -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;
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
> index 7715c0d..5e7fbbe 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
> @@ -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,
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
> index 0029fa2..48b057d 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
> @@ -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;


[-- Attachment #1.2: Type: text/html, Size: 8132 bytes --]

[-- Attachment #2: Type: text/plain, Size: 153 bytes --]

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] drm/amdgpu/psp: move TMR to cpu invisible vram region
       [not found] ` <1566201945-18101-1-git-send-email-tianci.yin-5C7GfCeVMHo@public.gmane.org>
@ 2019-08-19  8:07   ` Christian König
       [not found]     ` <b1b7dd46-8ee5-deaf-1a24-ef152c96dcb6-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Christian König @ 2019-08-19  8:07 UTC (permalink / raw)
  To: Tianci Yin, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
  Cc: Jack Xiao, Hawking Zhang, Xiaojie Yuan

Am 19.08.19 um 10:05 schrieb Tianci Yin:
> From: "Tianci.Yin" <tianci.yin@amd.com>
>
> so that more visible vram can be available for umd.
>
> Signed-off-by: Tianci.Yin <tianci.yin@amd.com>

Assuming that you checked that we don't have other users who are using 
amdgpu_bo_create_kernel() without a CPU pointer this patch is 
Reviewed-by: Christian König <christian.koenig@amd.com>.

> ---
>   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(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> index 1059771..0476790 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> @@ -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;
>   
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
> index 7715c0d..5e7fbbe 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
> @@ -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,
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
> index 0029fa2..48b057d 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
> @@ -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
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH] drm/amdgpu/psp: move TMR to cpu invisible vram region
@ 2019-08-19  8:05 Tianci Yin
       [not found] ` <1566201945-18101-1-git-send-email-tianci.yin-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Tianci Yin @ 2019-08-19  8:05 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
  Cc: Jack Xiao, Tianci Yin, Xiaojie Yuan, Hawking Zhang

From: "Tianci.Yin" <tianci.yin@amd.com>

so that more visible vram can be available for umd.

Signed-off-by: Tianci.Yin <tianci.yin@amd.com>
---
 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(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
index 1059771..0476790 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
@@ -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;
 
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
index 7715c0d..5e7fbbe 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
@@ -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,
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
index 0029fa2..48b057d 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
@@ -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;
-- 
2.7.4

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-08-19  8:46 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-19  7:34 [PATCH] drm/amdgpu/psp: move TMR to cpu invisible vram region Tianci Yin
     [not found] ` <1566200092-17283-1-git-send-email-tianci.yin-5C7GfCeVMHo@public.gmane.org>
2019-08-19  7:39   ` Christian König
     [not found]     ` <8f923347-6255-c663-03fd-fe77aa4e3eff-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2019-08-19  7:44       ` Yin, Tianci (Rico)
2019-08-19  8:05 Tianci Yin
     [not found] ` <1566201945-18101-1-git-send-email-tianci.yin-5C7GfCeVMHo@public.gmane.org>
2019-08-19  8:07   ` Christian König
     [not found]     ` <b1b7dd46-8ee5-deaf-1a24-ef152c96dcb6-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2019-08-19  8:16       ` Yin, Tianci (Rico)
     [not found]         ` <MN2PR12MB2974D98262E42F1C6FB6644A95A80-rweVpJHSKTo/Ss4KemNrlQdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2019-08-19  8:46           ` Koenig, Christian

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.