From: "Nautiyal, Ankit K" <ankit.k.nautiyal@intel.com>
To: Jani Nikula <jani.nikula@intel.com>,
<intel-gfx@lists.freedesktop.org>,
<intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH 2/4] drm/i915/gvt: drop dependency on display struct dpll
Date: Thu, 29 Jan 2026 09:54:30 +0530 [thread overview]
Message-ID: <67c23c23-b132-41ba-ad45-5537f057bae1@intel.com> (raw)
In-Reply-To: <ff7478efa80323c638a31c578cb1d707692ef51d.1769612208.git.jani.nikula@intel.com>
On 1/28/2026 8:29 PM, Jani Nikula wrote:
> The gvt code has no real need for struct dpll, it's just a collection of
> variables. So use a bunch of variables instead.
>
> Cc: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
>
> ---
>
> Tip: 'git show --color-words' is easier to review.
> ---
> drivers/gpu/drm/i915/gvt/handlers.c | 33 ++++++++++++-----------------
> 1 file changed, 14 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/gvt/handlers.c b/drivers/gpu/drm/i915/gvt/handlers.c
> index bd20f287720f..383b04160559 100644
> --- a/drivers/gpu/drm/i915/gvt/handlers.c
> +++ b/drivers/gpu/drm/i915/gvt/handlers.c
> @@ -558,7 +558,7 @@ static u32 bxt_vgpu_get_dp_bitrate(struct intel_vgpu *vgpu, enum port port)
> int refclk = 100000;
> enum dpio_phy phy = DPIO_PHY0;
> enum dpio_channel ch = DPIO_CH0;
> - struct dpll clock = {};
> + int m1, m2, n, p1, p2, m, p, vco, dot;
> u32 temp;
>
> /* Port to PHY mapping is fixed, see bxt_ddi_phy_info{} */
> @@ -587,30 +587,25 @@ static u32 bxt_vgpu_get_dp_bitrate(struct intel_vgpu *vgpu, enum port port)
> goto out;
> }
>
> - clock.m1 = 2;
> - clock.m2 = REG_FIELD_GET(PORT_PLL_M2_INT_MASK,
> - vgpu_vreg_t(vgpu, BXT_PORT_PLL(phy, ch, 0))) << 22;
> + m1 = 2;
> + m2 = REG_FIELD_GET(PORT_PLL_M2_INT_MASK, vgpu_vreg_t(vgpu, BXT_PORT_PLL(phy, ch, 0))) << 22;
> if (vgpu_vreg_t(vgpu, BXT_PORT_PLL(phy, ch, 3)) & PORT_PLL_M2_FRAC_ENABLE)
> - clock.m2 |= REG_FIELD_GET(PORT_PLL_M2_FRAC_MASK,
> - vgpu_vreg_t(vgpu, BXT_PORT_PLL(phy, ch, 2)));
> - clock.n = REG_FIELD_GET(PORT_PLL_N_MASK,
> - vgpu_vreg_t(vgpu, BXT_PORT_PLL(phy, ch, 1)));
> - clock.p1 = REG_FIELD_GET(PORT_PLL_P1_MASK,
> - vgpu_vreg_t(vgpu, BXT_PORT_PLL_EBB_0(phy, ch)));
> - clock.p2 = REG_FIELD_GET(PORT_PLL_P2_MASK,
> - vgpu_vreg_t(vgpu, BXT_PORT_PLL_EBB_0(phy, ch)));
> - clock.m = clock.m1 * clock.m2;
> - clock.p = clock.p1 * clock.p2 * 5;
> -
> - if (clock.n == 0 || clock.p == 0) {
> + m2 |= REG_FIELD_GET(PORT_PLL_M2_FRAC_MASK, vgpu_vreg_t(vgpu, BXT_PORT_PLL(phy, ch, 2)));
> + n = REG_FIELD_GET(PORT_PLL_N_MASK, vgpu_vreg_t(vgpu, BXT_PORT_PLL(phy, ch, 1)));
> + p1 = REG_FIELD_GET(PORT_PLL_P1_MASK, vgpu_vreg_t(vgpu, BXT_PORT_PLL_EBB_0(phy, ch)));
> + p2 = REG_FIELD_GET(PORT_PLL_P2_MASK, vgpu_vreg_t(vgpu, BXT_PORT_PLL_EBB_0(phy, ch)));
> + m = m1 * m2;
> + p = p1 * p2 * 5;
> +
> + if (n == 0 || p == 0) {
> gvt_dbg_dpy("vgpu-%d PORT_%c PLL has invalid divider\n", vgpu->id, port_name(port));
> goto out;
> }
>
> - clock.vco = DIV_ROUND_CLOSEST_ULL(mul_u32_u32(refclk, clock.m), clock.n << 22);
> - clock.dot = DIV_ROUND_CLOSEST(clock.vco, clock.p);
> + vco = DIV_ROUND_CLOSEST_ULL(mul_u32_u32(refclk, m), n << 22);
> + dot = DIV_ROUND_CLOSEST(vco, p);
>
> - dp_br = clock.dot;
> + dp_br = dot;
>
> out:
> return dp_br;
next prev parent reply other threads:[~2026-01-29 4:24 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-28 14:59 [PATCH 0/4] drm/i915/gvt: further reduce dependency on display Jani Nikula
2026-01-28 14:59 ` [PATCH 1/4] drm/i915/display: move enum aux_ch to intel_display_limits.h Jani Nikula
2026-01-29 3:02 ` Kandpal, Suraj
2026-01-29 4:22 ` Nautiyal, Ankit K
2026-01-28 14:59 ` [PATCH 2/4] drm/i915/gvt: drop dependency on display struct dpll Jani Nikula
2026-01-29 4:24 ` Nautiyal, Ankit K [this message]
2026-01-28 14:59 ` [PATCH 3/4] drm/i915/gvt: drop dependency on intel_display_types.h Jani Nikula
2026-01-29 4:31 ` Nautiyal, Ankit K
2026-01-29 8:46 ` Jani Nikula
2026-01-28 14:59 ` [PATCH 4/4] drm/i915/gvt: drop unnecessary include of intel_display.h Jani Nikula
2026-01-29 4:36 ` Nautiyal, Ankit K
2026-01-28 19:43 ` ✗ CI.checkpatch: warning for drm/i915/gvt: further reduce dependency on display Patchwork
2026-01-28 19:44 ` ✓ CI.KUnit: success " Patchwork
2026-01-28 19:59 ` ✗ CI.checksparse: warning " Patchwork
2026-01-28 20:18 ` ✓ Xe.CI.BAT: success " 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=67c23c23-b132-41ba-ad45-5537f057bae1@intel.com \
--to=ankit.k.nautiyal@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=jani.nikula@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox