All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Rob Clark" <robin.clark@oss.qualcomm.com>,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 10/12] drm/msm/a8xx: Switch to generated nonctx regs
Date: Tue, 20 Oct 2026 23:32:45 +0000	[thread overview]
Message-ID: <sashiko-outbox-179605@kernel.org> (raw)
In-Reply-To: <20261020204728.28844-11-robin.clark@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] drm/msm/a8xx: a8xx_nonctxt_config() clobbers LLCC SCID in GBIF_SCACHE_CNTL0
- [Medium] drm/msm/a8xx: nonctxt_reglist clobbers CX GBIF config in a8xx_nonctxt_config()
--

commit 966abf648e13ba76b4165851da9f6e5975e5c769
Author: Rob Clark <robin.clark@oss.qualcomm.com>

drm/msm/a8xx: Switch to generated nonctx regs

This commit removes the hand-maintained non-context register tables in
drivers/gpu/drm/msm/adreno/a8xx_catalog.c and switches the A8xx GPU catalog
entries to use the generated non-context register lists from the catalog
headers.

> diff --git a/drivers/gpu/drm/msm/adreno/a8xx_catalog.c b/drivers/gpu/drm/msm/adreno/a8xx_catalog.c
> index 15fc10d5db688..bc79013165c13 100644
> --- a/drivers/gpu/drm/msm/adreno/a8xx_catalog.c
> +++ b/drivers/gpu/drm/msm/adreno/a8xx_catalog.c

[ ... ]

> @@ -1556,7 +1216,7 @@ static const struct adreno_info a8xx_gpus[] = {
>  		.funcs = &a8xx_gpu_funcs,
>  		.a6xx = &(const struct a6xx_info) {
>  			.protect = &a830_protect,
> -			.nonctxt_reglist = a830_nonctxt_regs,
> +			.nonctxt_reglist = pakala_nonctxt_regs,
>  			.pwrup_reglist = &a830_pwrup_reglist,
>  			.dyn_pwrup_reglist = &a830_dyn_pwrup_reglist,
>  			.ifpc_reglist = &a830_ifpc_reglist,

[Severity: Medium]
Will switching .nonctxt_reglist in a8xx_gpus to pakala_nonctxt_regs (and the
other generated *_nonctxt_regs tables) cause a8xx_nonctxt_config() to clobber
the LLCC slice IDs in REG_A6XX_GBIF_SCACHE_CNTL0?

In drivers/gpu/drm/msm/adreno/catalog/adreno_pakala.h (as well as the
glymur_nonctxt_regs, kaanapali_nonctxt_regs, milos_nonctxt_regs,
maili_nonctxt_regs, and hawi_nonctxt_regs tables), the generated list
includes:

	{ 0x00003c01 /* GBIF_SCACHE_CNTL0                   */, 0x00000100, BIT(PIPE_NONE) },

On initial GPU load (adreno_load_gpu()), job submission after runtime suspend
(msm_gpu_submit()), or recovery (a8xx_recover()), pm_runtime_get_sync() runs
adreno_runtime_resume() -> a6xx_gmu_pm_resume() in
drivers/gpu/drm/msm/adreno/a6xx_gpu.c:

	gpu->needs_hw_init = true;
	...
	if (adreno_is_a8xx(adreno_gpu))
		a8xx_llc_activate(a6xx_gpu);

In drivers/gpu/drm/msm/adreno/a8xx_gpu.c, a8xx_llc_activate() programs the
system cache slice ID into REG_A6XX_GBIF_SCACHE_CNTL0 (0x3c01):

	gpu_write(gpu, REG_A6XX_GBIF_SCACHE_CNTL0,
		  FIELD_PREP(GENMASK(27, 22), gpu_scid) |
		  FIELD_PREP(GENMASK(21, 16), gpu_scid) |
		  FIELD_PREP(GENMASK(15, 10), gpu_scid) |
		  BIT(8));

Immediately afterwards, msm_gpu_hw_init() sees gpu->needs_hw_init == true and
calls a8xx_hw_init() -> hw_init() -> a8xx_nonctxt_config(), which executes:

	gpu_write(gpu, regs[i].offset, regs[i].value);

Because 0x00003c01 is in info->nonctxt_reglist with value 0x00000100,
wouldn't this overwrite REG_A6XX_GBIF_SCACHE_CNTL0 and zero out the gpu_scid
fields in bits [27:10] on every hardware init?

> @@ -1601,7 +1261,7 @@ static const struct adreno_info a8xx_gpus[] = {
>  		.funcs = &a8xx_gpu_funcs,
>  		.a6xx = &(const struct a6xx_info) {
>  			.protect = &x285_protect,
> -			.nonctxt_reglist = x285_nonctxt_regs,
> +			.nonctxt_reglist = glymur_nonctxt_regs,
>  			.pwrup_reglist = &a840_pwrup_reglist,
>  			.dyn_pwrup_reglist = &x285_dyn_pwrup_reglist,
>  			.ifpc_reglist = &a840_ifpc_reglist,
> @@ -1646,7 +1306,7 @@ static const struct adreno_info a8xx_gpus[] = {
>  		.funcs = &a8xx_gpu_funcs,
>  		.a6xx = &(const struct a6xx_info) {
>  			.protect = &a840_protect,
> -			.nonctxt_reglist = a840_nonctxt_regs,
> +			.nonctxt_reglist = kaanapali_nonctxt_regs,
>  			.pwrup_reglist = &a840_pwrup_reglist,
>  			.dyn_pwrup_reglist = &a840_dyn_pwrup_reglist,
>  			.ifpc_reglist = &a840_ifpc_reglist,
> @@ -1692,7 +1352,7 @@ static const struct adreno_info a8xx_gpus[] = {
>  		.zapfw = "gen80300_zap.mbn",
>  		.a6xx = &(const struct a6xx_info) {
>  			.protect = &a810_protect,
> -			.nonctxt_reglist = a810_nonctxt_regs,
> +			.nonctxt_reglist = milos_nonctxt_regs,
>  			.pwrup_reglist = &a810_pwrup_reglist,
>  			.dyn_pwrup_reglist = &a810_dyn_pwrup_reglist,
>  			.ifpc_reglist = &a810_ifpc_reglist,
> @@ -1735,7 +1395,7 @@ static const struct adreno_info a8xx_gpus[] = {
>  		.funcs = &a8xx_gpu_funcs,
>  		.a6xx = &(const struct a6xx_info) {
>  			.protect = &x285_protect,
> -			.nonctxt_reglist = x285_nonctxt_regs,
> +			.nonctxt_reglist = glymur_nonctxt_regs,
>  			.pwrup_reglist = &a840_pwrup_reglist,
>  			.dyn_pwrup_reglist = &x285_dyn_pwrup_reglist,
>  			.ifpc_reglist = &a840_ifpc_reglist,
> @@ -1778,7 +1438,7 @@ static const struct adreno_info a8xx_gpus[] = {
>  		.funcs = &a8xx_gpu_funcs,
>  		.a6xx = &(const struct a6xx_info) {
>  			.protect = &a850_protect,
> -			.nonctxt_reglist = a845_nonctxt_regs,
> +			.nonctxt_reglist = maili_nonctxt_regs,
>  			.pwrup_reglist = &a850_pwrup_reglist,
>  			.dyn_pwrup_reglist = &a850_dyn_pwrup_reglist,
>  			.ifpc_reglist = &a850_ifpc_reglist,
> @@ -1822,7 +1482,7 @@ static const struct adreno_info a8xx_gpus[] = {
>  		.funcs = &a8xx_gpu_funcs,
>  		.a6xx = &(const struct a6xx_info) {
>  			.protect = &a850_protect,
> -			.nonctxt_reglist = a850_nonctxt_regs,
> +			.nonctxt_reglist = hawi_nonctxt_regs,
>  			.pwrup_reglist = &a850_pwrup_reglist,
>  			.dyn_pwrup_reglist = &a850_dyn_pwrup_reglist,
>  			.ifpc_reglist = &a850_ifpc_reglist,

[Severity: Medium]
Should the CX GBIF registers (0x3c00..0x3c45) in the generated *_nonctxt_regs
tables also be excluded or handled separately in a8xx_nonctxt_config()?

Unlike the previous hand-maintained nonctxt_regs arrays in
drivers/gpu/drm/msm/adreno/a8xx_catalog.c, all six generated *_nonctxt_regs
tables include CX GBIF entries:

	{ 0x00003c00 /* GBIF_CX_CONFIG                      */, 0x20023020, BIT(PIPE_NONE) },
	{ 0x00003c01 /* GBIF_SCACHE_CNTL0                   */, 0x00000100, BIT(PIPE_NONE) },
	{ 0x00003c03 /* GBIF_QSB_SIDE0                      */, 0x00071e20, BIT(PIPE_NONE) },
	{ 0x00003c04 /* GBIF_QSB_SIDE1                      */, 0x00071e20, BIT(PIPE_NONE) },
	{ 0x00003c05 /* GBIF_QSB_SIDE2                      */, 0x00071e20, BIT(PIPE_NONE) },
	{ 0x00003c06 /* GBIF_QSB_SIDE3                      */, 0x00071e20, BIT(PIPE_NONE) },
	{ 0x00003c45 /* GBIF_HALT                           */, 0x00000008, BIT(PIPE_NONE) },

During resume, a6xx_gmu_pm_resume() -> a6xx_gmu_resume() ->
a6xx_gmu_fw_start() configures gbif_cx and boots the GMU (which enables clock
gating in REG_A6XX_GBIF_CX_CONFIG BIT(0), as noted in a8xx_set_hwcg() in
drivers/gpu/drm/msm/adreno/a8xx_gpu.c):

	/*
	 * GMU enables clk gating in GBIF during boot up. So,
	 * override that here when hwcg feature is disabled
	 */
	gpu_rmw(gpu, REG_A6XX_GBIF_CX_CONFIG, BIT(0), 0);

Then in drivers/gpu/drm/msm/adreno/a8xx_gpu.c, hw_init() explicitly clears
REG_A6XX_GBIF_HALT before calling a8xx_nonctxt_config():

	/* Clear GBIF halt in case GX domain was not collapsed */
	gpu_write(gpu, REG_A6XX_GBIF_HALT, 0);
	gpu_read(gpu, REG_A6XX_GBIF_HALT);
	...
	a8xx_nonctxt_config(gpu);

When a8xx_nonctxt_config() subsequently writes the generated nonctxt_reglist,
could writing 0x20023020 to REG_A6XX_GBIF_CX_CONFIG (0x3c00) clear BIT(0)
that the GMU enabled on boot, and could writing 0x00000008 to
REG_A6XX_GBIF_HALT (0x3c45) undo the earlier clear in hw_init() in addition
to overwriting REG_A6XX_GBIF_SCACHE_CNTL0 (0x3c01)?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261020204728.28844-1-robin.clark@oss.qualcomm.com?part=10

  reply	other threads:[~2026-10-20 23:32 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-20 20:46 [PATCH 00/12] drm/msm/a8xx: GPU state capture support Rob Clark
2026-10-20 20:46 ` [PATCH 01/12] drm/msm: Import adreno_snapshot.h Rob Clark
2026-10-20 20:46 ` [PATCH 02/12] drm/msm/a8xx: Export aperture helpers Rob Clark
2026-10-20 20:46 ` [PATCH 03/12] drm/msm/a8xx: Add a8xx_aperture_acquire_slice() Rob Clark
2026-10-20 20:46 ` [PATCH 04/12] drm/msm/a8xx: Allow nonctx reglist to include GMU regs Rob Clark
2026-10-21  8:38   ` Konrad Dybcio
2026-10-20 20:46 ` [PATCH 05/12] drm/msm/a8xx: Stop getting GMEM_PROTECT from nonctx list Rob Clark
2026-10-20 20:46 ` [PATCH 06/12] drm/msm/adreno: Fix PROTECT span length Rob Clark
2026-10-21  8:40   ` Konrad Dybcio
2026-10-20 20:46 ` [PATCH 07/12] drm/msm/adreno: add temporary __maybe_unused Rob Clark
2026-10-20 20:46 ` [PATCH 08/12] drm/msm/a8xx: Import generated headers Rob Clark
2026-10-20 20:46 ` [PATCH 09/12] drm/msm/a8xx: devcoredump state capture support Rob Clark
2026-10-20 23:13   ` sashiko-bot
2026-10-21  8:42   ` Konrad Dybcio
2026-10-20 20:46 ` [PATCH 10/12] drm/msm/a8xx: Switch to generated nonctx regs Rob Clark
2026-10-20 23:32   ` sashiko-bot [this message]
2026-10-21  8:43   ` Konrad Dybcio
2026-10-20 20:46 ` [PATCH 11/12] drm/msm/a8xx: Switch to generated protect regs Rob Clark
2026-10-20 23:41   ` sashiko-bot
2026-10-21  8:44   ` Konrad Dybcio
2026-10-20 20:46 ` [PATCH 12/12] drm/msm/adreno: Remove temporary __maybe_unused Rob Clark

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-179605@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=robin.clark@oss.qualcomm.com \
    --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.