From: "Michał Grzelak" <michal.grzelak@intel.com>
To: Luca Coelho <luciano.coelho@intel.com>
Cc: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org
Subject: Re: [v6, 2/4] drm/i915/display: harden shifts in ICL_DPCLKA_CFGCR0_DDI_CLK_SEL macros
Date: Wed, 1 Jul 2026 20:31:34 +0200 (CEST) [thread overview]
Message-ID: <341a5d14-89be-cae3-2a89-cd380cff2d6e@intel.com> (raw)
In-Reply-To: <20260609095525.570614-3-luciano.coelho@intel.com>
[-- Attachment #1: Type: text/plain, Size: 2193 bytes --]
On Tue, 9 Jun 2026, Luca Coelho wrote:
> ICL_DPCLKA_CFGCR0 has a 2-bit DDI_CLK_SEL field per combo PHY, for
> PHY_A..PHY_D only. Any other phy value (PHY_NONE, TypeC/SNPS PHYs) is
FWIW, double space: s/ / /
> not valid here.
>
> This is not a problem with the current implementation, because phy is
> always valid when these macros are called, but it's more robust to
> cast to unsigned so the shift is always well-defined.
>
> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
> ---
> .../gpu/drm/i915/display/intel_display_regs.h | 16 +++++++++++++---
> 1 file changed, 13 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_display_regs.h b/drivers/gpu/drm/i915/display/intel_display_regs.h
> index 4321f8b529da..2dcbbad70174 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_regs.h
> +++ b/drivers/gpu/drm/i915/display/intel_display_regs.h
> @@ -2869,9 +2869,19 @@ enum skl_power_gate {
> #define ICL_DPCLKA_CFGCR0_TC_CLK_OFF(tc_port) (1 << ((tc_port) < TC_PORT_4 ? \
> (tc_port) + 12 : \
> (tc_port) - TC_PORT_4 + 21))
> -#define ICL_DPCLKA_CFGCR0_DDI_CLK_SEL_SHIFT(phy) ((phy) * 2)
> -#define ICL_DPCLKA_CFGCR0_DDI_CLK_SEL_MASK(phy) (3 << ICL_DPCLKA_CFGCR0_DDI_CLK_SEL_SHIFT(phy))
> -#define ICL_DPCLKA_CFGCR0_DDI_CLK_SEL(pll, phy) ((pll) << ICL_DPCLKA_CFGCR0_DDI_CLK_SEL_SHIFT(phy))
> +
> +/*
> + * ICL_DPCLKA_CFGCR0 has a 2-bit DDI_CLK_SEL field per combo PHY, for
> + * PHY_A..PHY_D only. Any other phy value (PHY_NONE, TypeC/SNPS PHYs)
double space: s/ / /
Reviewed-by: Michał Grzelak <michal.grzelak@intel.com>
BR,
Michał
> + * is not valid here.
> + */
> +#define ICL_DPCLKA_CFGCR0_DDI_CLK_SEL_SHIFT(phy) _PICK(phy & 0x3, 0, 2, 4, 6)
> +#define ICL_DPCLKA_CFGCR0_DDI_CLK_SEL_MASK(phy) \
> + REG_GENMASK(ICL_DPCLKA_CFGCR0_DDI_CLK_SEL_SHIFT(phy) + 1, \
> + ICL_DPCLKA_CFGCR0_DDI_CLK_SEL_SHIFT(phy))
> +#define ICL_DPCLKA_CFGCR0_DDI_CLK_SEL(pll, phy) \
> + ((pll) << ICL_DPCLKA_CFGCR0_DDI_CLK_SEL_SHIFT(phy))
> +
> #define RKL_DPCLKA_CFGCR0_DDI_CLK_SEL_SHIFT(phy) _PICK(phy, 0, 2, 4, 27)
> #define RKL_DPCLKA_CFGCR0_DDI_CLK_SEL_MASK(phy) \
> (3 << RKL_DPCLKA_CFGCR0_DDI_CLK_SEL_SHIFT(phy))
>
next prev parent reply other threads:[~2026-07-01 18:31 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-09 9:52 [PATCH v6 0/4] drm/i915/display: harden some bit-shifting operations Luca Coelho
2026-06-09 9:52 ` [PATCH v6 1/4] drm/i915/display: harden masks in HSW_AUD_PIN_ELD_CP_VLD macros Luca Coelho
2026-07-01 18:31 ` [v6, " Michał Grzelak
2026-06-09 9:52 ` [PATCH v6 2/4] drm/i915/display: harden shifts in ICL_DPCLKA_CFGCR0_DDI_CLK_SEL macros Luca Coelho
2026-07-01 18:31 ` Michał Grzelak [this message]
2026-06-09 9:52 ` [PATCH v6 3/4] drm/i915/display: harden shift in intel_ddi_compute_config_late() Luca Coelho
2026-07-01 18:32 ` [v6,3/4] " Michał Grzelak
2026-06-09 9:52 ` [PATCH v6 4/4] drm/i915/display: remove unnecessary PHY_NONE definition Luca Coelho
2026-07-01 18:36 ` [v6,4/4] " Michał Grzelak
2026-06-09 10:19 ` ✗ CI.checkpatch: warning for drm/i915/display: harden some bit-shifting operations (rev6) Patchwork
2026-06-09 10:21 ` ✓ CI.KUnit: success " Patchwork
2026-06-09 11:00 ` ✓ i915.CI.BAT: " Patchwork
2026-06-09 11:20 ` ✓ Xe.CI.BAT: " Patchwork
2026-06-09 23:10 ` ✓ Xe.CI.FULL: " Patchwork
2026-06-15 7:58 ` ✓ i915.CI.Full: " Patchwork
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=341a5d14-89be-cae3-2a89-cd380cff2d6e@intel.com \
--to=michal.grzelak@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=luciano.coelho@intel.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 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.