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: <CAMMMRMc6YYpQMo0hDqvjVwg28tTazJxxxgQ5j9iUq-ZWeYg6qA@mail.gmail.com>
Date: Fri, 22 Aug 2025 14:52:05 +0200
From: Andrei Kuchynski <akuchynski@...omium.org>
To: Heikki Krogerus <heikki.krogerus@...ux.intel.com>
Cc: Abhishek Pandit-Subedi <abhishekpandit@...omium.org>, Benson Leung <bleung@...omium.org>, 
	Jameson Thies <jthies@...gle.com>, Tzung-Bi Shih <tzungbi@...nel.org>, linux-usb@...r.kernel.org, 
	chrome-platform@...ts.linux.dev, Guenter Roeck <groeck@...omium.org>, 
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>, 
	Dmitry Baryshkov <dmitry.baryshkov@....qualcomm.com>, "Christian A. Ehrhardt" <lk@...e.de>, 
	Venkat Jayaraman <venkat.jayaraman@...el.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1 4/5] usb: typec: Implement alternate mode priority handling

On Thu, Aug 21, 2025 at 1:15 PM Heikki Krogerus
<heikki.krogerus@...ux.intel.com> wrote:
>
> Hi again,
>
> On Thu, Aug 21, 2025 at 01:09:57PM +0300, Heikki Krogerus wrote:
> > > diff --git a/drivers/usb/typec/mode_selection.c b/drivers/usb/typec/mode_selection.c
> > > new file mode 100644
> > > index 000000000000..8a54639b86bf
> > > --- /dev/null
> > > +++ b/drivers/usb/typec/mode_selection.c
> > > @@ -0,0 +1,127 @@
> > > +// SPDX-License-Identifier: GPL-2.0-only
> > > +/*
> > > + * Copyright 2025 Google LLC.
> > > + */
> > > +
> > > +#include <linux/usb/typec_altmode.h>
> > > +#include <linux/slab.h>
> > > +#include <linux/list.h>
> > > +#include "mode_selection.h"
> > > +#include "class.h"
> > > +
> > > +static const char * const mode_names[TYPEC_ALTMODE_MAX] = {
> > > +   [TYPEC_ALTMODE_DP] = "DisplayPort",
> > > +   [TYPEC_ALTMODE_TBT] = "Thunderbolt3",
> > > +   [TYPEC_ALTMODE_USB4] = "USB4",
> > > +};
> >
> > You only need string for USB4. The altmode names come from the drivers.
>
> Sorry, that won't work with port altmode. But you can still do the
> lookup with just the sid.
>

Hi Heikki,

I can get names from altmode partner. Names are only needed to
provide results of entering the mode. No partner - no results.

>
> I think this needs to be simplified. You don't need this elaborate
> implementation in the beginning.
>
> I'm going to do some suggestions. I don't know if all of them work,
> but hopefully you get the idea how I would like to see the initial
> support to be implemented.
>

I checked your suggestions. It looks like all of them should
work. Thank you!

- priority is a member to struct typec_altmode
- use svid instead of enum typec_mode_type
- no list or other variables in struct typec_port.
- struct mode_selection_state will be introduced in other series

>
> The default priorities is an array of svids. And I really think that
> the highest priority should be 1 not 0.
>

I think your idea of setting priorities based on the order of
port altmod registrations is better. We don't really need default
priorities in this case.

>
> No driver so you would need to use the mode_names, but instead of
> doing that, just don't limit this at all.
>
> If there is no name for the mode, use the svid.
>
> thanks,
>
> --
> heikki

What if we later create typec_USB4 driver, similar to the
existing typec_displayport and typec_thunderbolt?
This approach could unify how various modes are handled,
eliminating exceptions for USB4 or any other mode.

The port altmode would contain priority and support "enter" and
"exit" operations, while partner altmode would handle "activate"
and name field. I've explored this approach with cros_ec_typec
driver, and it appears to be a promising way to manage USB4 as
alternate mode.

Thanks,

Andrei

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ