AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Lazar, Lijo" <lijo.lazar@amd.com>
To: Yiqing Yao <YiQing.Yao@amd.com>,
	amd-gfx@lists.freedesktop.org, christian.koenig@amd.com,
	alexander.deucher@amd.com
Cc: owen.zhang2@amd.com, haijun.chang@amd.com, horace.chen@amd.com,
	qing.ma@amd.com
Subject: Re: [PATCH v2] drm/amdgpu: use local xcc to flush tlb
Date: Wed, 12 Jun 2024 16:28:32 +0530	[thread overview]
Message-ID: <e2fd8fca-ff7b-4c7e-a04d-cd757dabd6f6@amd.com> (raw)
In-Reply-To: <20240612093641.3682677-1-YiQing.Yao@amd.com>



On 6/12/2024 3:06 PM, Yiqing Yao wrote:
> When flushing gpu tlb using kiq for gfxhub, kiq ring is always
> local by selecting kiq instance. Test shows mmreg write data packet's
> higher bits then 16 have no effect when flush using kiq on gfxhub.
> 
> Also some variant have policy blocking higher offset when req/ack is set
> with extra bits and can cause flush to timeout.
> 
> So keep the lower 16 bits only.
> 
> Remove redundant code.
> 
> Signed-off-by: Yiqing Yao <YiQing.Yao@amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
> index 350f6b6676f1..f3fe318e0c1d 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
> @@ -853,8 +853,16 @@ static void gmc_v9_0_flush_gpu_tlb(struct amdgpu_device *adev, uint32_t vmid,
>  	 */
>  	if (adev->gfx.kiq[inst].ring.sched.ready &&
>  	    (amdgpu_sriov_runtime(adev) || !amdgpu_sriov_vf(adev))) {
> -		uint32_t req = hub->vm_inv_eng0_req + hub->eng_distance * eng;
> -		uint32_t ack = hub->vm_inv_eng0_ack + hub->eng_distance * eng;
> +
> +		/* 
> +		 * Select lower 16 bits to write in local xcc when flushing
> +		 * using kiq to write gfx as higher bits are always ignored
> +		 */
> +		if (vmhub < AMDGPU_MMHUB0(0))
> +		{
> +			req = req & 0xffff;
> +			ack = ack & 0xffff;
> +		}
>  

The issue is incorrect mask passed by host driver in discovery table
which results in incorrect register offsets. The fix should be in
discovery table passed by host driver and RRMT mechanism will then take
care.

Thanks,
Lijo

>  		amdgpu_gmc_fw_reg_write_reg_wait(adev, req, ack, inv_req,
>  						 1 << vmid, inst);

      parent reply	other threads:[~2024-06-12 10:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-12  9:36 [PATCH v2] drm/amdgpu: use local xcc to flush tlb Yiqing Yao
     [not found] ` <BL1PR12MB5876C672D00C550E43E00045EEC02@BL1PR12MB5876.namprd12.prod.outlook.com>
2024-06-12 10:23   ` Christian König
2024-06-12 10:58 ` Lazar, Lijo [this message]

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=e2fd8fca-ff7b-4c7e-a04d-cd757dabd6f6@amd.com \
    --to=lijo.lazar@amd.com \
    --cc=YiQing.Yao@amd.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=christian.koenig@amd.com \
    --cc=haijun.chang@amd.com \
    --cc=horace.chen@amd.com \
    --cc=owen.zhang2@amd.com \
    --cc=qing.ma@amd.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox