lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <xqnlucuofqpex427dawqxc3kggvt26s63i46wfi3ewuboo7nab@oqutuzpmy2kf>
Date: Thu, 26 Dec 2024 21:04:42 +0200
From: Dmitry Baryshkov <dmitry.baryshkov@...aro.org>
To: Abel Vesa <abel.vesa@...aro.org>
Cc: Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>, 
	Maxime Ripard <mripard@...nel.org>, Thomas Zimmermann <tzimmermann@...e.de>, 
	David Airlie <airlied@...il.com>, Simona Vetter <simona@...ll.ch>, 
	Karol Herbst <kherbst@...hat.com>, Lyude Paul <lyude@...hat.com>, 
	Danilo Krummrich <dakr@...hat.com>, Jani Nikula <jani.nikula@...ux.intel.com>, 
	Rodrigo Vivi <rodrigo.vivi@...el.com>, Joonas Lahtinen <joonas.lahtinen@...ux.intel.com>, 
	Tvrtko Ursulin <tursulin@...ulin.net>, Rob Clark <robdclark@...il.com>, 
	Abhinav Kumar <quic_abhinavk@...cinc.com>, Sean Paul <sean@...rly.run>, 
	Marijn Suijten <marijn.suijten@...ainline.org>, Bjorn Andersson <andersson@...nel.org>, 
	Konrad Dybcio <konradybcio@...nel.org>, Johan Hovold <johan@...nel.org>, dri-devel@...ts.freedesktop.org, 
	linux-kernel@...r.kernel.org, nouveau@...ts.freedesktop.org, intel-gfx@...ts.freedesktop.org, 
	intel-xe@...ts.freedesktop.org, linux-arm-msm@...r.kernel.org, freedreno@...ts.freedesktop.org
Subject: Re: [PATCH v2 1/4] drm/dp: Add helper to set LTTPRs in transparent
 mode

On Thu, Dec 26, 2024 at 02:09:46PM +0200, Abel Vesa wrote:
> On 24-12-11 21:22:00, Dmitry Baryshkov wrote:
> > On Wed, Dec 11, 2024 at 03:04:12PM +0200, Abel Vesa wrote:
> > > According to the DisplayPort standard, LTTPRs have two operating
> > > modes:
> > >  - non-transparent - it replies to DPCD LTTPR field specific AUX
> > >    requests, while passes through all other AUX requests
> > >  - transparent - it passes through all AUX requests.
> > > 
> > > Switching between this two modes is done by the DPTX by issuing
> > > an AUX write to the DPCD PHY_REPEATER_MODE register.
> > > 
> > > Add a generic helper that allows switching between these modes.
> > > 
> > > Also add a generic wrapper for the helper that handles the explicit
> > > disabling of non-transparent mode and its disable->enable sequence
> > > mentioned in the DP Standard v2.0 section 3.6.6.1. Do this in order
> > > to move this handling out of the vendor specific driver implementation
> > > into the generic framework.
> > > 
> > > Signed-off-by: Abel Vesa <abel.vesa@...aro.org>
> > > ---
> > >  drivers/gpu/drm/display/drm_dp_helper.c | 50 +++++++++++++++++++++++++++++++++
> > >  include/drm/display/drm_dp_helper.h     |  2 ++
> > >  2 files changed, 52 insertions(+)
> > > 
> > 
> > 
> > > +/**
> > > + * drm_dp_lttpr_init - init LTTPR transparency mode according to DP standard
> > > + *
> > > + * @aux: DisplayPort AUX channel
> > > + * @lttpr_count: Number of LTTPRs
> > > + *
> > > + * Returns 0 on success or a negative error code on failure.
> > > + */
> > > +int drm_dp_lttpr_init(struct drm_dp_aux *aux, int lttpr_count)
> > > +{
> > > +	if (!lttpr_count)
> > > +		return 0;
> > > +
> > > +	/*
> > > +	 * See DP Standard v2.0 3.6.6.1 about the explicit disabling of
> > > +	 * non-transparent mode and the disable->enable non-transparent mode
> > > +	 * sequence.
> > > +	 */
> > > +	drm_dp_lttpr_set_transparent_mode(aux, true);
> > > +
> > > +	if (lttpr_count > 0 && !drm_dp_lttpr_set_transparent_mode(aux, false))
> > > +		return 0;
> > > +
> > > +	/*
> > > +	 * Roll-back to tranparent mode if setting non-tranparent mode failed or
> > > +	 * the number of LTTPRs is invalid
> > > +	 */
> > > +	drm_dp_lttpr_set_transparent_mode(aux, true);
> > 
> > This means that if lttpr_count < 0, then there will be two requests to
> > set LTTPRs to a transparent mode. Is that expected?
> 
> Yes, exactly. If counting the LTTPRs (see drm_dp_lttpr_count) results in an
> invalid number (e.g. more than 8), then according to the DP standard,
> we need to roll back to transparent mode.
> 
> Do you think I need to re-word the comment above more to make it more
> clearer?

My concern is that you already call
drm_dp_lttpr_set_transparent_mode(true) first. So the DP should be in
the transparent mode. Then if lttpr_count is 0 or less, then you call it
_again_.

Shouldn't it be instead:
drm_dp_lttpr_set_transparent_mode(aux, true);
if (lttpr_count <= 0)
	return 0? // or error?

if (!drm_dp_lttpr_set_transparent_mode(aux, false))
	return 0;

/* roll-back */
drm_dp_lttpr_set_transparent_mode(aux, true);

> 
> > 
> > > +
> > > +	return -EINVAL;
> > > +}
> > > +EXPORT_SYMBOL(drm_dp_lttpr_init);
> > > +
> > 
> > -- 
> > With best wishes
> > Dmitry
> 
> Thanks for reviewing,
> Abel

-- 
With best wishes
Dmitry

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ