All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lang Yu <Lang.Yu@amd.com>
To: Jack Xiao <Jack.Xiao@amd.com>
Cc: amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH 6/7] drm/amdgpu/mes: add mes ring test
Date: Wed, 29 Jun 2022 16:35:51 +0800	[thread overview]
Message-ID: <YrwO53lyAaF27xR1@lang-desktop> (raw)
In-Reply-To: <20220629032034.2994328-6-Jack.Xiao@amd.com>

On 06/29/ , Jack Xiao wrote:
> Use read/write register to test mes ring.
> 
> Signed-off-by: Jack Xiao <Jack.Xiao@amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 36 +++++++++++++++++++++++++
>  drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h |  1 +
>  drivers/gpu/drm/amd/amdgpu/mes_v11_0.c  |  6 +++++
>  3 files changed, 43 insertions(+)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c
> index b6c2a5058b64..c18ea0bc00eb 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c
> @@ -926,6 +926,42 @@ int amdgpu_mes_reg_wait(struct amdgpu_device *adev, uint32_t reg,
>  	return r;
>  }
>  
> +int amdgpu_mes_ring_test_ring(struct amdgpu_device *adev)
> +{
> +	uint32_t scratch;
> +	uint32_t tmp = 0;
> +	unsigned i;
> +	int r = 0;
> +
> +	r = amdgpu_gfx_scratch_get(adev, &scratch);

amdgpu_gfx_scratch_get/free() have been removed in latest amd-staging-drm-next.
See e9b8129d8ca5 (drm/amdgpu: nuke dynamic gfx scratch reg allocation).

Regards,
Lang

> +	if (r) {
> +		DRM_ERROR("amdgpu: mes failed to get scratch reg (%d).\n", r);
> +		return r;
> +	}
> +
> +	WREG32(scratch, 0xCAFEDEAD);
> +
> +	tmp = amdgpu_mes_rreg(adev, scratch);
> +	if (tmp != 0xCAFEDEAD) {
> +		DRM_ERROR("mes failed to read register\n");
> +		goto error;
> +	}
> +
> +	r = amdgpu_mes_wreg(adev, scratch, 0xDEADBEEF);
> +	if (r)
> +		goto error;
> +
> +	tmp = RREG32(scratch);
> +	if (tmp != 0xDEADBEEF) {
> +		DRM_ERROR("mes failed to write register\n");
> +		r = -EIO;
> +	}
> +
> +error:
> +	amdgpu_gfx_scratch_free(adev, scratch);
> +	return r;
> +}
> +
>  static void
>  amdgpu_mes_ring_to_queue_props(struct amdgpu_device *adev,
>  			       struct amdgpu_ring *ring,
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h
> index 93b2ba817916..81610e3f3059 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h
> @@ -341,6 +341,7 @@ int amdgpu_mes_reg_wait(struct amdgpu_device *adev, uint32_t reg,
>  int amdgpu_mes_reg_write_reg_wait(struct amdgpu_device *adev,
>  				  uint32_t reg0, uint32_t reg1,
>  				  uint32_t ref, uint32_t mask);
> +int amdgpu_mes_ring_test_ring(struct amdgpu_device *adev);
>  
>  int amdgpu_mes_add_ring(struct amdgpu_device *adev, int gang_id,
>  			int queue_type, int idx,
> diff --git a/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c b/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c
> index 2a6c7a680c62..c4d085429d26 100644
> --- a/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c
> @@ -1194,6 +1194,12 @@ static int mes_v11_0_hw_init(void *handle)
>  		goto failure;
>  	}
>  
> +	r = amdgpu_mes_ring_test_ring(adev);
> +	if (r) {
> +		DRM_ERROR("MES ring test failed\n");
> +		goto failure;
> +	}
> +
>  	/*
>  	 * Disable KIQ ring usage from the driver once MES is enabled.
>  	 * MES uses KIQ ring exclusively so driver cannot access KIQ ring
> -- 
> 2.35.1
> 

  reply	other threads:[~2022-06-29  8:36 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-29  3:20 [PATCH 1/7] drm/amdgpu/mes11: update mes interface for acessing registers Jack Xiao
2022-06-29  3:20 ` [PATCH 2/7] drm/amdgpu: add common interface for mes misc op Jack Xiao
2022-06-29  3:20 ` [PATCH 3/7] drm/amdgpu/mes11: add mes11 " Jack Xiao
2022-06-29  3:20 ` [PATCH 4/7] drm/amdgpu/mes: add mes register access interface Jack Xiao
2022-06-29  3:20 ` [PATCH 5/7] drm/amdgpu: enable mes to access registers v2 Jack Xiao
2022-06-29  3:20 ` [PATCH 6/7] drm/amdgpu/mes: add mes ring test Jack Xiao
2022-06-29  8:35   ` Lang Yu [this message]
2022-06-30  1:50     ` Xiao, Jack
2022-06-29  3:20 ` [PATCH 7/7] Revert "drm/amdgpu/gmc11: avoid cpu accessing registers to flush VM" Jack Xiao

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=YrwO53lyAaF27xR1@lang-desktop \
    --to=lang.yu@amd.com \
    --cc=Jack.Xiao@amd.com \
    --cc=amd-gfx@lists.freedesktop.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.