All of lore.kernel.org
 help / color / mirror / Atom feed
From: zhoucm1 <david1.zhou-5C7GfCeVMHo@public.gmane.org>
To: Monk Liu <Monk.Liu-5C7GfCeVMHo@public.gmane.org>,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: Re: [PATCH 5/6] drm/amdgpu:use FRAME_CNTL for new GFX ucode
Date: Thu, 4 May 2017 18:23:15 +0800	[thread overview]
Message-ID: <590B0113.40304@amd.com> (raw)
In-Reply-To: <1493892295-28221-5-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>



On 2017年05月04日 18:04, Monk Liu wrote:
> VI/AI affected:
>
> CP/HW team requires KMD insert FRAME_CONTROL(end) after
> the last IB and before the fence of this DMAframe.
>
> this is to make sure the cache are flushed, and it's a must
> change no matter MCBP/SR-IOV or bare-metal case because new
> CP hw won't do the cache flush for each IB anymore, it just
> leaves it to KMD now.
>
> with this patch, certain MCBP hang issue when rendering
> vulkan/chained-ib are resolved.
>
> Change-Id: I34ee7528aa32e704b2850bc6d50774b24c29b840
> Signed-off-by: Monk Liu <Monk.Liu@amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c   |  3 +++
>   drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h |  1 +
>   drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c    | 11 +++++++++++
>   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c    | 11 +++++++++++
>   include/uapi/drm/amdgpu_drm.h            |  2 ++
>   5 files changed, 28 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
> index 4480e01..df49709 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
> @@ -201,6 +201,9 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,
>   			!amdgpu_sriov_vf(adev)) /* for SRIOV preemption, Preamble CE ib must be inserted anyway */
>   			continue;
>   
> +		if (i == num_ibs - 1)
> +			ib->flags |= AMDGPU_IB_FLAG_LAST;
We can wrap the ring func like amdgpu_ring_emit_tmz(), and add it before 
emit fence.

Regards,
David Zhou
> +
>   		amdgpu_ring_emit_ib(ring, ib, job ? job->vm_id : 0,
>   				    need_ctx_switch);
>   		need_ctx_switch = false;
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
> index 2acaac6..03e88c6 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
> @@ -143,6 +143,7 @@ struct amdgpu_ring_funcs {
>   	void (*emit_cntxcntl) (struct amdgpu_ring *ring, uint32_t flags);
>   	void (*emit_rreg)(struct amdgpu_ring *ring, uint32_t reg);
>   	void (*emit_wreg)(struct amdgpu_ring *ring, uint32_t reg, uint32_t val);
> +	void (*emit_tmz)(struct amdgpu_ring *ring, bool start);
>   };
>   
>   struct amdgpu_ring {
> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
> index eed5745..f4aeba6 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
> @@ -6422,6 +6422,10 @@ static void gfx_v8_0_ring_emit_ib_gfx(struct amdgpu_ring *ring,
>   			  (ib->gpu_addr & 0xFFFFFFFC));
>   	amdgpu_ring_write(ring, upper_32_bits(ib->gpu_addr) & 0xFFFF);
>   	amdgpu_ring_write(ring, control);
> +
> +	/* insert FRAME_CONTROL (end) after the last IB */
> +	if (ib->flags & AMDGPU_IB_FLAG_LAST && ring->funcs->emit_tmz)
> +		ring->funcs->emit_tmz(ring, false);
>   }
>   
>   static void gfx_v8_0_ring_emit_ib_compute(struct amdgpu_ring *ring,
> @@ -6651,6 +6655,12 @@ static void gfx_v8_0_ring_emit_patch_cond_exec(struct amdgpu_ring *ring, unsigne
>   		ring->ring[offset] = (ring->ring_size >> 2) - offset + cur;
>   }
>   
> +static void gfx_v8_0_ring_emit_tmz(struct amdgpu_ring *ring, bool start)
> +{
> +	amdgpu_ring_write(ring, PACKET3(PACKET3_FRAME_CONTROL, 0));
> +	amdgpu_ring_write(ring, FRAME_CMD(start ? 0 : 1)); /* frame_end */
> +}
> +
>   
>   static void gfx_v8_0_ring_emit_rreg(struct amdgpu_ring *ring, uint32_t reg)
>   {
> @@ -6932,6 +6942,7 @@ static const struct amdgpu_ring_funcs gfx_v8_0_ring_funcs_gfx = {
>   	.emit_cntxcntl = gfx_v8_ring_emit_cntxcntl,
>   	.init_cond_exec = gfx_v8_0_ring_emit_init_cond_exec,
>   	.patch_cond_exec = gfx_v8_0_ring_emit_patch_cond_exec,
> +	.emit_tmz = gfx_v8_0_ring_emit_tmz,
>   };
>   
>   static const struct amdgpu_ring_funcs gfx_v8_0_ring_funcs_compute = {
> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
> index f192297..745e2f7 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
> @@ -2899,6 +2899,10 @@ BUG_ON(ib->gpu_addr & 0x3); /* Dword align */
>   		lower_32_bits(ib->gpu_addr));
>   	amdgpu_ring_write(ring, upper_32_bits(ib->gpu_addr));
>   	amdgpu_ring_write(ring, control);
> +
> +	/* insert FRAME_CONTROL (end) after the last IB */
> +	if (ib->flags & AMDGPU_IB_FLAG_LAST && ring->funcs->emit_tmz)
> +		ring->funcs->emit_tmz(ring, false);
>   }
>   
>   #define	INDIRECT_BUFFER_VALID                   (1 << 23)
> @@ -3156,6 +3160,12 @@ static void gfx_v9_0_ring_emit_patch_cond_exec(struct amdgpu_ring *ring, unsigne
>   		ring->ring[offset] = (ring->ring_size>>2) - offset + cur;
>   }
>   
> +static void gfx_v9_0_ring_emit_tmz(struct amdgpu_ring *ring, bool start)
> +{
> +	amdgpu_ring_write(ring, PACKET3(PACKET3_FRAME_CONTROL, 0));
> +	amdgpu_ring_write(ring, FRAME_CMD(start ? 0 : 1)); /* frame_end */
> +}
> +
>   static void gfx_v9_0_ring_emit_rreg(struct amdgpu_ring *ring, uint32_t reg)
>   {
>   	struct amdgpu_device *adev = ring->adev;
> @@ -3490,6 +3500,7 @@ static const struct amdgpu_ring_funcs gfx_v9_0_ring_funcs_gfx = {
>   	.emit_cntxcntl = gfx_v9_ring_emit_cntxcntl,
>   	.init_cond_exec = gfx_v9_0_ring_emit_init_cond_exec,
>   	.patch_cond_exec = gfx_v9_0_ring_emit_patch_cond_exec,
> +	.emit_tmz = gfx_v9_0_ring_emit_tmz,
>   };
>   
>   static const struct amdgpu_ring_funcs gfx_v9_0_ring_funcs_compute = {
> diff --git a/include/uapi/drm/amdgpu_drm.h b/include/uapi/drm/amdgpu_drm.h
> index 20ea895..e979285 100644
> --- a/include/uapi/drm/amdgpu_drm.h
> +++ b/include/uapi/drm/amdgpu_drm.h
> @@ -478,6 +478,8 @@ union drm_amdgpu_cs {
>   /* Preempt flag, IB should set Pre_enb bit if PREEMPT flag detected */
>   #define AMDGPU_IB_FLAG_PREEMPT (1<<2)
>   
> +#define AMDGPU_IB_FLAG_LAST (1<<3)
> +
>   struct drm_amdgpu_cs_chunk_ib {
>   	__u32 _pad;
>   	/** AMDGPU_IB_FLAG_* */

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

  parent reply	other threads:[~2017-05-04 10:23 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-04 10:04 [PATCH 1/6] drm/amdgpu:cleanup intent/format for gfx_v9_0.c Monk Liu
     [not found] ` <1493892295-28221-1-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
2017-05-04 10:04   ` [PATCH 2/6] drm/amdgpu:unify gfx8/9 ce/de meta_data Monk Liu
     [not found]     ` <1493892295-28221-2-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
2017-05-04 14:35       ` Deucher, Alexander
2017-05-04 10:04   ` [PATCH 3/6] drm/amdgpu:change SR-IOV DMAframe scheme Monk Liu
     [not found]     ` <1493892295-28221-3-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
2017-05-04 14:35       ` Deucher, Alexander
2017-05-04 10:04   ` [PATCH 4/6] drm/amdgpu:new PM4 entry for VI/AI Monk Liu
     [not found]     ` <1493892295-28221-4-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
2017-05-04 14:36       ` Deucher, Alexander
2017-05-04 10:04   ` [PATCH 5/6] drm/amdgpu:use FRAME_CNTL for new GFX ucode Monk Liu
     [not found]     ` <1493892295-28221-5-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
2017-05-04 10:22       ` zhoucm1
2017-05-04 10:23       ` zhoucm1 [this message]
2017-05-04 10:04   ` [PATCH 6/6] drm/amdgpu:cleanup flag not used Monk Liu
     [not found]     ` <1493892295-28221-6-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
2017-05-04 14:36       ` Deucher, Alexander
2017-05-04 10:17   ` [PATCH 1/6] drm/amdgpu:cleanup intent/format for gfx_v9_0.c Christian König
     [not found]     ` <3d118149-8188-a6b3-db17-0553499ce132-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2017-05-04 10:47       ` Liu, Monk
2017-05-04 14:34   ` Deucher, Alexander

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=590B0113.40304@amd.com \
    --to=david1.zhou-5c7gfcevmho@public.gmane.org \
    --cc=Monk.Liu-5C7GfCeVMHo@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.