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: <CAA8EJpqPhZF7Urbc7LPFJehBLWdWQX5Bk=y0iTw7Nz-J4qQdRg@mail.gmail.com>
Date: Wed, 18 Dec 2024 12:31:37 +0200
From: Dmitry Baryshkov <dmitry.baryshkov@...aro.org>
To: Xin Ji <xji@...logixsemi.com>
Cc: Pin-yen Lin <treapking@...omium.org>, Andrzej Hajda <andrzej.hajda@...el.com>, 
	Neil Armstrong <neil.armstrong@...aro.org>, Robert Foss <rfoss@...nel.org>, 
	Laurent Pinchart <Laurent.pinchart@...asonboard.com>, Jonas Karlman <jonas@...boo.se>, 
	Jernej Skrabec <jernej.skrabec@...il.com>, 
	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>, 
	Bernie Liang <bliang@...logixsemi.com>, Qilin Wen <qwen@...logixsemi.com>, 
	"treapking@...gle.com" <treapking@...gle.com>, 
	"dri-devel@...ts.freedesktop.org" <dri-devel@...ts.freedesktop.org>, 
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v3] drm/bridge:anx7625: Update HDCP status at atomic_enable()

On Wed, 18 Dec 2024 at 10:46, Xin Ji <xji@...logixsemi.com> wrote:
>
> > -----Original Message-----
> > From: Dmitry Baryshkov <dmitry.baryshkov@...aro.org>
> > Sent: Tuesday, December 17, 2024 8:30 PM
> > To: Xin Ji <xji@...logixsemi.com>
> > Cc: Pin-yen Lin <treapking@...omium.org>; Andrzej Hajda
> > <andrzej.hajda@...el.com>; Neil Armstrong <neil.armstrong@...aro.org>;
> > Robert Foss <rfoss@...nel.org>; Laurent Pinchart
> > <Laurent.pinchart@...asonboard.com>; Jonas Karlman <jonas@...boo.se>;
> > Jernej Skrabec <jernej.skrabec@...il.com>; 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>; Bernie Liang
> > <bliang@...logixsemi.com>; Qilin Wen <qwen@...logixsemi.com>;
> > treapking@...gle.com; dri-devel@...ts.freedesktop.org; linux-
> > kernel@...r.kernel.org
> > Subject: Re: [PATCH v3] drm/bridge:anx7625: Update HDCP status at
> > atomic_enable()
> >
> >
> > On Tue, Dec 17, 2024 at 01:50:00AM +0000, Xin Ji wrote:
> > > > -----Original Message-----
> > > > From: Pin-yen Lin <treapking@...omium.org>
> > > > Sent: Monday, December 16, 2024 8:05 PM
> > > > To: Dmitry Baryshkov <dmitry.baryshkov@...aro.org>
> > > > Cc: Xin Ji <xji@...logixsemi.com>; Andrzej Hajda
> > > > <andrzej.hajda@...el.com>; Neil Armstrong
> > > > <neil.armstrong@...aro.org>; Robert Foss <rfoss@...nel.org>; Laurent
> > > > Pinchart <Laurent.pinchart@...asonboard.com>; Jonas Karlman
> > > > <jonas@...boo.se>; Jernej Skrabec <jernej.skrabec@...il.com>;
> > > > 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>; Bernie
> > > > Liang <bliang@...logixsemi.com>; Qilin Wen <qwen@...logixsemi.com>;
> > > > treapking@...gle.com; dri-devel@...ts.freedesktop.org; linux-
> > > > kernel@...r.kernel.org
> > > > Subject: Re: [PATCH v3] drm/bridge:anx7625: Update HDCP status at
> > > > atomic_enable()
> > > >
> > > >
> > > > Hi Dmitry,
> > > >
> > > > On Mon, Dec 16, 2024 at 7:59 PM Dmitry Baryshkov
> > > > <dmitry.baryshkov@...aro.org> wrote:
> > > > >
> > > > > On Mon, Dec 16, 2024 at 08:33:23AM +0000, Xin Ji wrote:
> > > > > > > -----Original Message-----
> > > > > > > From: Dmitry Baryshkov <dmitry.baryshkov@...aro.org>
> > > > > > > Sent: Friday, December 13, 2024 9:17 PM
> > > > > > > To: Xin Ji <xji@...logixsemi.com>
> > > > > > > Cc: Andrzej Hajda <andrzej.hajda@...el.com>; Neil Armstrong
> > > > > > > <neil.armstrong@...aro.org>; Robert Foss <rfoss@...nel.org>;
> > > > > > > Laurent Pinchart <Laurent.pinchart@...asonboard.com>; Jonas
> > > > > > > Karlman <jonas@...boo.se>; Jernej Skrabec
> > > > > > > <jernej.skrabec@...il.com>; 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>; Bernie Liang <bliang@...logixsemi.com>;
> > > > > > > Qilin Wen <qwen@...logixsemi.com>; treapking@...gle.com;
> > > > > > > dri-devel@...ts.freedesktop.org; linux- kernel@...r.kernel.org
> > > > > > > Subject: Re: [PATCH v3] drm/bridge:anx7625: Update HDCP status
> > > > > > > at
> > > > > > > atomic_enable()
> > > > > > >
> > > > > > > CAUTION: This email originated from outside of the organization.
> > > > > > > Please do not click links or open attachments unless you
> > > > > > > recognize the sender, and know the content is safe.
> > > > > > >
> > > > > > >
> > > > > > > On Fri, 13 Dec 2024 at 13:00, Xin Ji <xji@...logixsemi.com> wrote:
> > > > > > > >
> > > > > > > > Hi Dmitry, sorry, I didn't clear describe the reason.
> > > > > > >
> > > > > > > Please. Do not top-post. Please paste your answer under the
> > > > > > > question, not somewhere at the top of the email. This allows
> > > > > > > us to have a more constructive dialog. Additional bonus if you
> > > > > > > can fix your email client to insert sensible quoting
> > > > > > > information instead of dumping
> > > > the headers of the original email.
> > > > > > Hi Dmitry, OK, sorry about it. Currently, we have problem to
> > > > > > fetch email from Microsoft on Ubuntu. I'll try to fix it later.
> > > > > > >
> > > > > > > >
> > > > > > > > Anx7625 implement DSI to DP convert behind USB Type-C port,
> > > > > > > > when user plug into USB Type-C Dongle with DP monitor, the
> > > > > > > > user space will enable HDCP feature, then kernel do HDCP and
> > > > > > > > output display and set HDCP content to ENABLE, but the issue
> > > > > > > > happened if user manually change the
> > > > > > > monitor's resolution later.
> > > > > > > >
> > > > > > > > Each time user change the resolution, kernel will call
> > > > > > > > bridge interface .atomic_disable() and .atomic_enable(), the
> > > > > > > > old driver will keep HDCP state to ENABLE, this is a BUG,
> > > > > > > > when user change the resolution, kernel must change HDCP
> > > > > > > > content too (mustn't keep to ENABLE),
> > > > > > >
> > > > > > > Why? Could you please point me to the corresponding
> > > > > > > documentation or a code path in the other driver? Preferably i915,
> > AMD or Nouveau.
> > > > > > As
> > > > https://elixir.bootlin.com/linux/v6.12.5/source/drivers/gpu/drm/drm_
> > > > connecto
> > > > r.c#L1423:
> > > > > >         - ENABLED -> DESIRED (termination of authentication) As
> > > > > > there is no other interface to tell anx7625 bridge driver, so
> > > > > > the I think best place to handle ENABLE -> DESIRED in .atomic_disable().
> > > > >
> > > > > I was looking for something like
> > > > > cdns_mhdp_connector_atomic_check(),
> > > > > which switches to UNDESIRED if there is no new CRTC. Likewise i915
> > > > > driver performs this in intel_hdcp_atomic_check() if there is a
> > > > > need for modeset.
> > > Hi Dmitry, the bridge driver is different with i915, anx7625 bridge
> > > driver only implement some passive callback interface. There is no
> > > HDCP status checking while do resolution switch.
> >
> > Does that mean that you _have_ to reestablish HDCP after mode switching in
> > order for it to work?
> Hi Dmitry, anx7625 bridge IC will be power down after call .atomic_disable(),
> and all HDCP status will be lost on chip. So, we should reestablish HDCP again
> in .atomic_enable().

Finally! This phrase should be in the commit message.

> >
> > > >
> > > > I believe you mean "DESIRED" here.
> > > > >
> > > > > For the "termination of authentication" case see
> > > > > cdns_mhdp_hdcp_check_link(), which detects if the HDCP got
> > > > > disabled by HW and then updates the status accordingly.
> > > > >
> > > > > >
> > > > > > >
> > > > > > > > as DRM doc said, kernel cannot change from ENABLE to
> > > > > > > > UNDESIRE, so next patch, I'll change it to DESIRE in .atomic_disable().
> > > > >
> > > > > This e.g. will result in HDCP being restarted for all modesets. Is
> > > > > this an expected behaviour?
> > > >
> > > > The bridge could be powered off between .atomic_disable() and
> > > > .atomic_enable(), though I'm not sure if this would be a concern for
> > > > anx7625. I'll let Xin to comment on this.
> > > The flow of resolution switch is:
> > >     -> .atomic_disable().
> > >         -> .atomic_enable().
> > >             -> HDCP status check and enable.
> > > As resolution switch is triggered by user space, at this moment, the
> > > HDCP works fine(cannot get disabled event from HW).
> > > So, I think, .atomic_disable() is
> > > the best place to do termination of authentication (turn HDCP status to
> > DESIRED).
> > > This is the only entrance which can do termination of authentication,
> > > I cannot find others.
> >
> > I'm probably still missing a reference to the standard (please excuse me, I don't
> > know it by heart). Is it a standard requirement to reauthenticate on the mode
> > switch?
> I'm not sure, but anx7625 have power cycle on the mode switch. All HDCP status
> Will be lost.
> >
> > BTW, while reading the anx7625 code, I noticed that there is a possible race
> > between .atomic_enable() / .atomic_disable() which set
> > ctx->connector and the hdcp_check_work_func() which reads ctx->connector
> > without any protection.
> OK, I'll upstream another patch.
> >
> > --
> > With best wishes
> > Dmitry



-- 
With best wishes
Dmitry

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ