All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <ckoenig.leichtzumerken@gmail.com>
To: Alex Deucher <alexander.deucher@amd.com>, amd-gfx@lists.freedesktop.org
Cc: Jack Xiao <Jack.Xiao@amd.com>, Hawking Zhang <Hawking.Zhang@amd.com>
Subject: Re: [PATCH] drm/amdgpu/gmc11: avoid cpu accessing registers to flush VM
Date: Wed, 4 May 2022 08:25:37 +0200	[thread overview]
Message-ID: <04d2af18-1d38-5a8d-b272-a68c295ca213@gmail.com> (raw)
In-Reply-To: <20220503200855.1163186-17-alexander.deucher@amd.com>

Am 03.05.22 um 22:08 schrieb Alex Deucher:
> From: Jack Xiao <Jack.Xiao@amd.com>
>
> Due to gfxoff on, cpu accessing registers is not expected.
>
> Signed-off-by: Jack Xiao <Jack.Xiao@amd.com>
> Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c | 51 +++++++++++++++++++++++++-
>   1 file changed, 50 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c
> index 61db2a378008..032414d7429d 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c
> @@ -265,6 +265,12 @@ static void gmc_v11_0_flush_vm_hub(struct amdgpu_device *adev, uint32_t vmid,
>   static void gmc_v11_0_flush_gpu_tlb(struct amdgpu_device *adev, uint32_t vmid,
>   					uint32_t vmhub, uint32_t flush_type)
>   {
> +	struct amdgpu_ring *ring = adev->mman.buffer_funcs_ring;
> +	struct dma_fence *fence;
> +	struct amdgpu_job *job;
> +
> +	int r;
> +
>   	if ((vmhub == AMDGPU_GFXHUB_0) && !adev->gfx.is_poweron)
>   		return;
>   
> @@ -288,8 +294,51 @@ static void gmc_v11_0_flush_gpu_tlb(struct amdgpu_device *adev, uint32_t vmid,
>   	}
>   
>   	mutex_lock(&adev->mman.gtt_window_lock);
> -	gmc_v11_0_flush_vm_hub(adev, vmid, vmhub, 0);
> +
> +	if (vmhub == AMDGPU_MMHUB_0) {
> +		gmc_v11_0_flush_vm_hub(adev, vmid, AMDGPU_MMHUB_0, 0);
> +		mutex_unlock(&adev->mman.gtt_window_lock);
> +		return;
> +	}
> +
> +	BUG_ON(vmhub != AMDGPU_GFXHUB_0);

I've already responded on the internal review that this BUG_ON is not 
justified.

We should rather change the "if (vmhub ==..." above to make sure that 
all other HUBs don't use the gfxoff workaround.

Christian.

> +
> +	if (!adev->mman.buffer_funcs_enabled ||
> +	    !adev->ib_pool_ready ||
> +	    amdgpu_in_reset(adev) ||
> +	    ring->sched.ready == false) {
> +		gmc_v11_0_flush_vm_hub(adev, vmid, AMDGPU_GFXHUB_0, 0);
> +		mutex_unlock(&adev->mman.gtt_window_lock);
> +		return;
> +	}
> +
> +	r = amdgpu_job_alloc_with_ib(adev, 16 * 4, AMDGPU_IB_POOL_IMMEDIATE,
> +				     &job);
> +	if (r)
> +		goto error_alloc;
> +
> +	job->vm_pd_addr = amdgpu_gmc_pd_addr(adev->gart.bo);
> +	job->vm_needs_flush = true;
> +	job->ibs->ptr[job->ibs->length_dw++] = ring->funcs->nop;
> +	amdgpu_ring_pad_ib(ring, &job->ibs[0]);
> +	r = amdgpu_job_submit(job, &adev->mman.entity,
> +			      AMDGPU_FENCE_OWNER_UNDEFINED, &fence);
> +	if (r)
> +		goto error_submit;
> +
> +	mutex_unlock(&adev->mman.gtt_window_lock);
> +
> +	dma_fence_wait(fence, false);
> +	dma_fence_put(fence);
> +
> +	return;
> +
> +error_submit:
> +	amdgpu_job_free(job);
> +
> +error_alloc:
>   	mutex_unlock(&adev->mman.gtt_window_lock);
> +	DRM_ERROR("Error flushing GPU TLB using the SDMA (%d)!\n", r);
>   	return;
>   }
>   


  reply	other threads:[~2022-05-04  6:25 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-03 20:08 [PATCH] drm/amd/pm: enable power limit retrieving and setting for SMU 13.0.0 Alex Deucher
2022-05-03 20:08 ` [PATCH] drm/amd/pm: enable ac/dc switching " Alex Deucher
2022-05-03 20:08 ` [PATCH] drm/amd/pm: enable power profile setting " Alex Deucher
2022-05-03 20:08 ` [PATCH] drm/amd/pm: enable RunDcBtc support " Alex Deucher
2022-05-03 20:08 ` [PATCH] drm/amd/pm: enable ppfeature mask setting " Alex Deucher
2022-05-03 20:08 ` [PATCH] drm/amd/pm: enable PMLOG support " Alex Deucher
2022-05-03 20:08 ` [PATCH] drm/amd/pm: enable df cstate feature " Alex Deucher
2022-05-03 20:08 ` [PATCH] drm/amdgpu: enable more GFX clockgating features for GC 11.0.0 Alex Deucher
2022-05-03 20:08 ` [PATCH] drm/amd/pm: support more DPM features for SMU 13.0.0 Alex Deucher
2022-05-03 20:08 ` [PATCH] drm/amd/pm: enable deep sleep features control " Alex Deucher
2022-05-03 20:08 ` [PATCH] drm/amd/pm: enable gfx ulv feature " Alex Deucher
2022-05-03 20:08 ` [PATCH] drm/amd/pm: enable more dpm features to pair with PMFW 78.31.0 Alex Deucher
2022-05-03 20:08 ` [PATCH] drm/amdgpu: enable MGCG and LS for ATHUB 3.0 Alex Deucher
2022-05-03 20:08 ` [PATCH] drm/amdgpu: enable MGCG and LS for MMHUB 3.0 Alex Deucher
2022-05-03 20:08 ` [PATCH] drm/amdgpu: enable clock gating for IH 6.0 Alex Deucher
2022-05-03 20:08 ` [PATCH] drm/amdgpu: enable clock gating for HDP 6.0 Alex Deucher
2022-05-03 20:08 ` [PATCH] drm/amdgpu/gmc11: avoid cpu accessing registers to flush VM Alex Deucher
2022-05-04  6:25   ` Christian König [this message]
2022-05-03 20:08 ` [PATCH] drm/amdgpu: add soc21 support for GC 11.0.2 Alex Deucher
2022-05-03 20:08 ` [PATCH] drm/amdgpu/discovery: " Alex Deucher
2022-05-03 20:08 ` [PATCH] drm/amdgpu: add support for ATHUB 3.0.2 Alex Deucher
2022-05-03 20:08 ` [PATCH] drm/amdgpu/discovery: add ih6 support for IH 6.0.2 Alex Deucher
2022-05-03 20:08 ` [PATCH] drm/amdgpu/discovery: add smu13 support for MP1 13.0.7 Alex Deucher
2022-05-03 20:08 ` [PATCH] drm/amdgpu/discovery: add nbio 4.3 support for NBIO 4.3.1 Alex Deucher
2022-05-03 20:08 ` [PATCH] drm/amdgpu/discovery: add hdp6 support for HDP 6.0.1 Alex Deucher
2022-05-03 20:08 ` [PATCH] drm/amdgpu/discovery: add SMUIO_13_0_8 func support Alex Deucher
2022-05-05 20:07 [PATCH] drm/amd/pm: enable lclk dpm/ds and BACO features for SMU 13.0.0 Alex Deucher
2022-05-05 20:07 ` [PATCH] drm/amdgpu/gmc11: avoid cpu accessing registers to flush VM Alex Deucher
2022-05-12  3:08 [PATCH] drm/amdgpu/gfx11: fix me field handling in map_queue packet Alex Deucher
2022-05-12  3:08 ` [PATCH] drm/amdgpu/gmc11: avoid cpu accessing registers to flush VM Alex Deucher

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=04d2af18-1d38-5a8d-b272-a68c295ca213@gmail.com \
    --to=ckoenig.leichtzumerken@gmail.com \
    --cc=Hawking.Zhang@amd.com \
    --cc=Jack.Xiao@amd.com \
    --cc=alexander.deucher@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.