Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Joey Lu" <a0987203069@gmail.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v2 3/4] drm/verisilicon: introduce per-variant hardware ops table
Date: Tue, 19 May 2026 06:41:31 +0000	[thread overview]
Message-ID: <20260519064132.0E0EFC2BCB3@smtp.kernel.org> (raw)
In-Reply-To: <20260519055114.1886525-4-a0987203069@gmail.com>

Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [High] The newly added `crtc_disable` hook is invoked after the pixel clock is disabled, which will cause bus errors.
- [High] The register clearing sequence in `vs_dc8200_bridge_disable` is inverted compared to the original code, causing a functional regression.
- [Medium] Unconditional assignment of `dc->funcs` without verifying hardware identity, contradicting the commit message.
--

commit 9ad7489590b539e39997172552aadb2d24ac579b
Author: Joey Lu <a0987203069@gmail.com>

drm/verisilicon: introduce per-variant hardware ops table

This commit refactors hardware-specific operations into a vs_dc_funcs
vtable to support multiple IP variants without scattering if/else branches,
extracting DC8200-specific operations into vs_dc8200.c.

> diff --git a/drivers/gpu/drm/verisilicon/vs_crtc.c b/drivers/gpu/drm/verisilicon/vs_crtc.c
> index 9080344398ca2..a87caa6f73bac 100644
> --- a/drivers/gpu/drm/verisilicon/vs_crtc.c
> +++ b/drivers/gpu/drm/verisilicon/vs_crtc.c

[ ... ]

> @@ -30,6 +53,9 @@ static void vs_crtc_atomic_disable(struct drm_crtc *crtc,
>  	drm_crtc_vblank_off(crtc);
>  
>  	clk_disable_unprepare(dc->pix_clk[output]);
> +
> +	if (dc->funcs->crtc_disable)
> +		dc->funcs->crtc_disable(dc, output);
>  }

Will calling the crtc_disable hook here cause bus errors? It looks like
clk_disable_unprepare() disables the pixel clock before we call into the
hardware-specific teardown function, which likely accesses MMIO registers
while the clock is off. Symmetrically, vs_crtc_atomic_enable() invokes
crtc_enable after the clock is prepared and enabled.

> diff --git a/drivers/gpu/drm/verisilicon/vs_dc.c b/drivers/gpu/drm/verisilicon/vs_dc.c
> index dad9967bc10b8..c949570241890 100644
> --- a/drivers/gpu/drm/verisilicon/vs_dc.c
> +++ b/drivers/gpu/drm/verisilicon/vs_dc.c

[ ... ]

> @@ -136,6 +134,8 @@ static int vs_dc_probe(struct platform_device *pdev)
>  	dev_info(dev, "Found DC%x rev %x customer %x\n", dc->identity.model,
>  		 dc->identity.revision, dc->identity.customer_id);
>  
> +	dc->funcs = &vs_dc8200_funcs;
> +
>  	if (port_count > dc->identity.display_count) {
>  		dev_err(dev, "too many downstream ports than HW capability\n");
>  		ret = -EINVAL;

The commit message states "After vs_fill_chip_identity() confirms a DC8200
(or compatible) identity, vs_dc_probe() assigns dc->funcs = &vs_dc8200_funcs".

However, this assignment happens unconditionally without checking
dc->identity.model. Could this apply the wrong operations if probed with a
different hardware variant?

> diff --git a/drivers/gpu/drm/verisilicon/vs_dc8200.c b/drivers/gpu/drm/verisilicon/vs_dc8200.c
> new file mode 100644
> index 0000000000000..db9e1b3cd9032
> --- /dev/null
> +++ b/drivers/gpu/drm/verisilicon/vs_dc8200.c

[ ... ]

> +static void vs_dc8200_bridge_disable(struct vs_dc *dc, unsigned int output)
> +{
> +	regmap_clear_bits(dc->regs, VSDC_DISP_PANEL_CONFIG(output),
> +			  VSDC_DISP_PANEL_CONFIG_RUNNING);
> +	regmap_clear_bits(dc->regs, VSDC_DISP_PANEL_START,
> +			  VSDC_DISP_PANEL_START_MULTI_DISP_SYNC |
> +			  VSDC_DISP_PANEL_START_RUNNING(output));

Is this register clearing sequence inverted compared to the original code? 

The commit message says "No functional change for DC8200 platforms", but
the original code in vs_bridge_atomic_disable() cleared VSDC_DISP_PANEL_START
before clearing VSDC_DISP_PANEL_CONFIG:

    regmap_clear_bits(dc->regs, VSDC_DISP_PANEL_START,
              VSDC_DISP_PANEL_START_MULTI_DISP_SYNC |
              VSDC_DISP_PANEL_START_RUNNING(output));
    regmap_clear_bits(dc->regs, VSDC_DISP_PANEL_CONFIG(output),
              VSDC_DISP_PANEL_CONFIG_RUNNING);

Could reversing this order violate display hardware teardown constraints and
result in display glitches or pipeline lockups?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260519055114.1886525-1-a0987203069@gmail.com?part=3

  reply	other threads:[~2026-05-19  6:41 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-19  5:51 [PATCH v2 0/4] drm/verisilicon: add Nuvoton MA35D1 DCU Lite support Joey Lu
2026-05-19  5:51 ` [PATCH v2 1/4] dt-bindings: display: verisilicon,dc: generalize for single-output variants Joey Lu
2026-05-19  6:15   ` sashiko-bot
2026-05-19  7:26   ` [PATCH v2 1/4] dt-bindings: display: verisilicon, dc: " Icenowy Zheng
2026-05-19 16:47     ` Conor Dooley
2026-05-19  5:51 ` [PATCH v2 2/4] drm/verisilicon: add model ID constants and DCU Lite chip identity Joey Lu
2026-05-19  6:25   ` sashiko-bot
2026-05-19  7:37   ` Icenowy Zheng
2026-05-19  5:51 ` [PATCH v2 3/4] drm/verisilicon: introduce per-variant hardware ops table Joey Lu
2026-05-19  6:41   ` sashiko-bot [this message]
2026-05-19  5:51 ` [PATCH v2 4/4] drm/verisilicon: add Nuvoton MA35D1 DCU Lite display controller support Joey Lu
2026-05-19  7:17   ` sashiko-bot
2026-05-19  7:44   ` Icenowy Zheng

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=20260519064132.0E0EFC2BCB3@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=a0987203069@gmail.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=robh@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox