All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Jesse Zhang" <Jesse.Zhang@amd.com>, amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH v5 12/15] drm/amdgpu/gfx11: include SOFT_RESET_GFX in the gfx engine soft reset
Date: Thu, 26 Nov 2026 09:57:44 +0000	[thread overview]
Message-ID: <sashiko-outbox-235204@kernel.org> (raw)
In-Reply-To: <20261126093417.192538-12-Jesse.Zhang@amd.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] drm/amdgpu/gfx11: wrong regGCVM_L2_STATUS offset in
  gfx_v11_0_wait_gc_idle()
--

commit b092d369a399e18251a9318c45400741bdc05ea3
Author: Jesse Zhang <Jesse.Zhang@amd.com>

drm/amdgpu/gfx11: include SOFT_RESET_GFX in the gfx engine soft reset

This commit halts MES and RLC F32, waits for in-flight GC memory requests
to drain in gfx_v11_0_wait_gc_idle(), and pulses SOFT_RESET_GFX together
with SOFT_RESET_CPF and SOFT_RESET_CPG during a gfx engine soft reset.

> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
> index a0ed3363f84d1..824d7914bece9 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
> @@ -6827,15 +6827,74 @@ static void gfx_v11_0_emit_mem_sync(struct amdgpu_ring *ring)
>  				 CP_STAT__UTCL2IU_BUSY_MASK)
>  
>  /* Reset CPF/CPG, PFP/ME and the gfx HQDs, then boot PFP/ME again. */
> +/*
> + * SOFT_RESET_GFX drops the memory requests in flight through the blocks it
> + * resets, and their clients then wait for them forever: MES still fetches
> + * instructions with its queues suspended, and RLC still writes its DRAM log
> + * in safe mode. The reset halts both, then waits for these busy bits of the
> + * GC memory interfaces to clear.
> + */
> +#define GFX11_GC_MEM_BUSY	(GRBM_STATUS2__EA_BUSY_MASK | \
> +				 GRBM_STATUS2__EA_LINK_BUSY_MASK | \
> +				 GRBM_STATUS2__UTCL2_BUSY_MASK | \
> +				 GRBM_STATUS2__UTCL2_RQ_PENDING_MASK | \
> +				 GRBM_STATUS2__TCP_BUSY_MASK | \
> +				 GRBM_STATUS2__CPC_BUSY_MASK | \
> +				 GRBM_STATUS2__RLC_BUSY_MASK | \
> +				 GRBM_STATUS2__RLC_RQ_PENDING_MASK | \
> +				 GRBM_STATUS2__SDMA_BUSY_MASK | \
> +				 GRBM_STATUS2__SDMA_SCH_RQ_PENDING_MASK | \
> +				 GRBM_STATUS2__SDMA0_RQ_PENDING_MASK | \
> +				 GRBM_STATUS2__SDMA1_RQ_PENDING_MASK)
> +
> +/* The RLC busy bits of its memory requests */
> +#define GFX11_RLC_MEM_BUSY	(RLC_STAT__MC_BUSY_MASK | \
> +				 RLC_STAT__RLC_SRM_BUSY_MASK | \
> +				 RLC_STAT__RLC_SPM_BUSY_MASK)
> +
> +/* Wait for the requests in flight in the GC, with MES and RLC F32 halted. */
> +static int gfx_v11_0_wait_gc_idle(struct amdgpu_device *adev)
> +{
> +	u32 busy, cpc, rlc;
> +	int i;
> +
> +	for (i = 0; i < adev->usec_timeout; i++) {
> +		busy = RREG32_SOC15(GC, 0, regGRBM_STATUS2) & GFX11_GC_MEM_BUSY;
> +		cpc = RREG32_SOC15(GC, 0, regCP_CPC_STATUS);
> +		rlc = RREG32_SOC15(GC, 0, regRLC_STAT);
> +
> +		/* The halted MES and F32 can stay busy, not their memory requests. */
> +		if (!(cpc & GENMASK(21, 0) & ~CP_CPC_STATUS__MES_BUSY_MASK))
> +			busy &= ~GRBM_STATUS2__CPC_BUSY_MASK;
> +		if (!(rlc & GFX11_RLC_MEM_BUSY))
> +			busy &= ~GRBM_STATUS2__RLC_BUSY_MASK;
> +
> +		if (!busy && !(RREG32_SOC15(GC, 0, regGCVM_L2_STATUS) &
> +			       GCVM_L2_STATUS__L2_BUSY_MASK))
> +			return 0;

[Severity: Medium]
Does RREG32_SOC15(GC, 0, regGCVM_L2_STATUS) read the wrong MMIO offset on
GC 11.0.3, GC 11.5.x and GC 11.7.x?

gfx_v11_0.c includes gc/gc_11_0_0_offset.h, where regGCVM_L2_STATUS is
0x15bf (BASE_IDX 0).  On GC 11.0.3 (gc/gc_11_0_3_offset.h) and GC 11.5.x /
11.7.x (gc/gc_11_5_0_offset.h), the gc_gcvml2pfdec block is shifted by 4
dwords (which is why gmc_v11_0_set_gfxhub_funcs() selects
gfxhub_v3_0_3_funcs and gfxhub_v11_5_0_funcs for those IP versions):
regGCVM_L2_CNTL is at 0x15c0 and regGCVM_L2_STATUS is at 0x15c3, leaving
0x15bf in an unmapped gap before regGCVM_L2_CNTL.

On those ASICs (such as GC 11.5.1 and GC 11.5.3 where gfx engine soft
reset is enabled), gfx_v11_0_wait_gc_idle() will not poll the real
GCVM_L2_STATUS register and can pulse SOFT_RESET_GFX while L2 requests are
still in flight, or time out if the unmapped read returns all-ones.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261126093417.192538-1-Jesse.Zhang@amd.com?part=12

  reply	other threads:[~2026-11-26  9:57 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-26  9:33 [PATCH v5 01/15] drm/amdgpu: pass the device to the multi ring reset helpers Jesse Zhang
2026-11-26  9:33 ` [PATCH v5 02/15] drm/amdgpu/ring: During multi-queue reset, only call begin helper if needed Jesse Zhang
2026-11-26  9:52   ` sashiko-bot
2026-11-26  9:33 ` [PATCH v5 03/15] drm/amdgpu: add an engine scope to the IP block soft reset Jesse Zhang
2026-11-26 10:00   ` sashiko-bot
2026-11-26  9:33 ` [PATCH v5 04/15] drm/amdgpu/gfx: add callbacks to save and restore a gfx HQD Jesse Zhang
2026-11-26  9:33 ` [PATCH v5 05/15] drm/amdgpu/gfx12: " Jesse Zhang
2026-11-26  9:33 ` [PATCH v5 06/15] drm/amdgpu/gfx11: " Jesse Zhang
2026-11-26  9:33 ` [PATCH v5 07/15] drm/amdgpu/userq: add a helper to signal the fences of a queue up to a point Jesse Zhang
2026-11-26  9:33 ` [PATCH v5 08/15] drm/amdgpu/userq: add helpers to keep the user queues of one engine across a reset Jesse Zhang
2026-11-26 10:03   ` sashiko-bot
2026-11-26  9:33 ` [PATCH v5 09/15] drm/amdgpu/gfx12: add a gfx engine soft reset Jesse Zhang
2026-11-26  9:57   ` sashiko-bot
2026-11-26  9:33 ` [PATCH v5 10/15] drm/amdgpu/gfx11: " Jesse Zhang
2026-11-26  9:59   ` sashiko-bot
2026-11-26  9:33 ` [PATCH v5 11/15] drm/amdgpu/gfx12: include SOFT_RESET_GFX in the " Jesse Zhang
2026-11-26  9:33 ` [PATCH v5 12/15] drm/amdgpu/gfx11: " Jesse Zhang
2026-11-26  9:57   ` sashiko-bot [this message]
2026-11-26  9:33 ` [PATCH v5 13/15] drm/amdgpu/userq: reset the gfx engine when a gfx user queue reset fails Jesse Zhang
2026-11-26 10:15   ` sashiko-bot
2026-11-26  9:33 ` [PATCH v5 14/15] drm/amdgpu/gfx12: enable the gfx engine soft reset Jesse Zhang
2026-11-26  9:33 ` [PATCH v5 15/15] drm/amdgpu/gfx11: " Jesse Zhang
2026-11-26 10:10   ` sashiko-bot

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=sashiko-outbox-235204@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Jesse.Zhang@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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.