2020-06-22 14:33:01

by Mario Limonciello

[permalink] [raw]
Subject: [PATCH 0/2] Allow breaking up Thunderbolt/USB4 updates

Currently updates to Thunderbolt and USB4 controllers are fully atomic
actions. When writing into the non-active NVM nothing gets flushed to
the hardware until authenticate is sent.

There has been some desire to improve the perceived performance of these
updates, particularly for userland that may perform the update upon
a performance sensitive time like logging out.

So allow userland to flush the image to hardware at runtime, and then
allow authenticating the image at another time.

For the Dell WD19TB some specific hardware capability exists that allows
extending this to automatically complete the update when unplugged.
Export that functionality to userspace as well.

This patch series is done relative thunderbolt.git/next.

Mario Limonciello (2):
thunderbolt: Add support for separating the flush to SPI and
authenticate
thunderbolt: Add support for authenticate on disconnect

.../ABI/testing/sysfs-bus-thunderbolt | 24 +++++-
drivers/thunderbolt/Makefile | 1 +
drivers/thunderbolt/eeprom.c | 2 +
drivers/thunderbolt/lc.c | 14 ++++
drivers/thunderbolt/quirks.c | 38 +++++++++
drivers/thunderbolt/switch.c | 81 +++++++++++++++----
drivers/thunderbolt/tb-quirks.h | 16 ++++
drivers/thunderbolt/tb.h | 4 +
drivers/thunderbolt/tb_regs.h | 1 +
9 files changed, 162 insertions(+), 19 deletions(-)
create mode 100644 drivers/thunderbolt/quirks.c
create mode 100644 drivers/thunderbolt/tb-quirks.h

--
2.25.1


2020-06-22 14:42:11

by Mario Limonciello

[permalink] [raw]
Subject: RE: [PATCH 0/2] Allow breaking up Thunderbolt/USB4 updates

> -----Original Message-----
> From: Limonciello, Mario <[email protected]>
> Sent: Monday, June 22, 2020 9:31 AM
> To: Andreas Noever; Michael Jamet; Mika Westerberg; Yehezkel Bernat
> Cc: [email protected]; [email protected]; Limonciello,
> Mario
> Subject: [PATCH 0/2] Allow breaking up Thunderbolt/USB4 updates
>
> Currently updates to Thunderbolt and USB4 controllers are fully atomic
> actions. When writing into the non-active NVM nothing gets flushed to
> the hardware until authenticate is sent.
>
> There has been some desire to improve the perceived performance of these
> updates, particularly for userland that may perform the update upon
> a performance sensitive time like logging out.
>
> So allow userland to flush the image to hardware at runtime, and then
> allow authenticating the image at another time.
>
> For the Dell WD19TB some specific hardware capability exists that allows
> extending this to automatically complete the update when unplugged.
> Export that functionality to userspace as well.
>
> This patch series is done relative thunderbolt.git/next.
>
> Mario Limonciello (2):
> thunderbolt: Add support for separating the flush to SPI and
> authenticate
> thunderbolt: Add support for authenticate on disconnect
>
> .../ABI/testing/sysfs-bus-thunderbolt | 24 +++++-
> drivers/thunderbolt/Makefile | 1 +
> drivers/thunderbolt/eeprom.c | 2 +
> drivers/thunderbolt/lc.c | 14 ++++
> drivers/thunderbolt/quirks.c | 38 +++++++++
> drivers/thunderbolt/switch.c | 81 +++++++++++++++----
> drivers/thunderbolt/tb-quirks.h | 16 ++++
> drivers/thunderbolt/tb.h | 4 +
> drivers/thunderbolt/tb_regs.h | 1 +
> 9 files changed, 162 insertions(+), 19 deletions(-)
> create mode 100644 drivers/thunderbolt/quirks.c
> create mode 100644 drivers/thunderbolt/tb-quirks.h
>
> --
> 2.25.1

Just to connect the dots, here is the matching userspace changes for this
change: https://github.com/fwupd/fwupd/pull/2204

2020-06-22 16:40:17

by Mika Westerberg

[permalink] [raw]
Subject: Re: [PATCH 0/2] Allow breaking up Thunderbolt/USB4 updates

Hi Mario,

On Mon, Jun 22, 2020 at 09:30:33AM -0500, Mario Limonciello wrote:
> Currently updates to Thunderbolt and USB4 controllers are fully atomic
> actions. When writing into the non-active NVM nothing gets flushed to
> the hardware until authenticate is sent.
>
> There has been some desire to improve the perceived performance of these
> updates, particularly for userland that may perform the update upon
> a performance sensitive time like logging out.
>
> So allow userland to flush the image to hardware at runtime, and then
> allow authenticating the image at another time.
>
> For the Dell WD19TB some specific hardware capability exists that allows
> extending this to automatically complete the update when unplugged.
> Export that functionality to userspace as well.
>
> This patch series is done relative thunderbolt.git/next.

Thanks for the patch series. I wonder if you could base this on top of
my "retimer NVM upgrade" series here (you are also Cc'd):

https://lore.kernel.org/linux-usb/[email protected]/

That series moves some of the common NVM functionality into a separate
file (nvm.c).

> Mario Limonciello (2):
> thunderbolt: Add support for separating the flush to SPI and
> authenticate
> thunderbolt: Add support for authenticate on disconnect
>
> .../ABI/testing/sysfs-bus-thunderbolt | 24 +++++-
> drivers/thunderbolt/Makefile | 1 +
> drivers/thunderbolt/eeprom.c | 2 +
> drivers/thunderbolt/lc.c | 14 ++++
> drivers/thunderbolt/quirks.c | 38 +++++++++
> drivers/thunderbolt/switch.c | 81 +++++++++++++++----
> drivers/thunderbolt/tb-quirks.h | 16 ++++
> drivers/thunderbolt/tb.h | 4 +
> drivers/thunderbolt/tb_regs.h | 1 +
> 9 files changed, 162 insertions(+), 19 deletions(-)
> create mode 100644 drivers/thunderbolt/quirks.c
> create mode 100644 drivers/thunderbolt/tb-quirks.h
>
> --
> 2.25.1

2020-06-22 16:44:06

by Mario Limonciello

[permalink] [raw]
Subject: RE: [PATCH 0/2] Allow breaking up Thunderbolt/USB4 updates

> -----Original Message-----
> From: Mika Westerberg <[email protected]>
> Sent: Monday, June 22, 2020 11:38 AM
> To: Limonciello, Mario
> Cc: Andreas Noever; Michael Jamet; Yehezkel Bernat; [email protected];
> [email protected]
> Subject: Re: [PATCH 0/2] Allow breaking up Thunderbolt/USB4 updates
>
>
> [EXTERNAL EMAIL]
>
> Hi Mario,
>
> On Mon, Jun 22, 2020 at 09:30:33AM -0500, Mario Limonciello wrote:
> > Currently updates to Thunderbolt and USB4 controllers are fully atomic
> > actions. When writing into the non-active NVM nothing gets flushed to
> > the hardware until authenticate is sent.
> >
> > There has been some desire to improve the perceived performance of these
> > updates, particularly for userland that may perform the update upon
> > a performance sensitive time like logging out.
> >
> > So allow userland to flush the image to hardware at runtime, and then
> > allow authenticating the image at another time.
> >
> > For the Dell WD19TB some specific hardware capability exists that allows
> > extending this to automatically complete the update when unplugged.
> > Export that functionality to userspace as well.
> >
> > This patch series is done relative thunderbolt.git/next.
>
> Thanks for the patch series. I wonder if you could base this on top of
> my "retimer NVM upgrade" series here (you are also Cc'd):
>
> https://lore.kernel.org/linux-usb/20200616135617.85752-1-
> [email protected]/
>
> That series moves some of the common NVM functionality into a separate
> file (nvm.c).

Sure thing. Do you by chance already have that on a public branch somewhere
that I can easily rebase it?

>
> > Mario Limonciello (2):
> > thunderbolt: Add support for separating the flush to SPI and
> > authenticate
> > thunderbolt: Add support for authenticate on disconnect
> >
> > .../ABI/testing/sysfs-bus-thunderbolt | 24 +++++-
> > drivers/thunderbolt/Makefile | 1 +
> > drivers/thunderbolt/eeprom.c | 2 +
> > drivers/thunderbolt/lc.c | 14 ++++
> > drivers/thunderbolt/quirks.c | 38 +++++++++
> > drivers/thunderbolt/switch.c | 81 +++++++++++++++----
> > drivers/thunderbolt/tb-quirks.h | 16 ++++
> > drivers/thunderbolt/tb.h | 4 +
> > drivers/thunderbolt/tb_regs.h | 1 +
> > 9 files changed, 162 insertions(+), 19 deletions(-)
> > create mode 100644 drivers/thunderbolt/quirks.c
> > create mode 100644 drivers/thunderbolt/tb-quirks.h
> >
> > --
> > 2.25.1

2020-06-22 17:11:38

by Mika Westerberg

[permalink] [raw]
Subject: Re: [PATCH 0/2] Allow breaking up Thunderbolt/USB4 updates

On Mon, Jun 22, 2020 at 04:41:35PM +0000, [email protected] wrote:
> > -----Original Message-----
> > From: Mika Westerberg <[email protected]>
> > Sent: Monday, June 22, 2020 11:38 AM
> > To: Limonciello, Mario
> > Cc: Andreas Noever; Michael Jamet; Yehezkel Bernat; [email protected];
> > [email protected]
> > Subject: Re: [PATCH 0/2] Allow breaking up Thunderbolt/USB4 updates
> >
> >
> > [EXTERNAL EMAIL]
> >
> > Hi Mario,
> >
> > On Mon, Jun 22, 2020 at 09:30:33AM -0500, Mario Limonciello wrote:
> > > Currently updates to Thunderbolt and USB4 controllers are fully atomic
> > > actions. When writing into the non-active NVM nothing gets flushed to
> > > the hardware until authenticate is sent.
> > >
> > > There has been some desire to improve the perceived performance of these
> > > updates, particularly for userland that may perform the update upon
> > > a performance sensitive time like logging out.
> > >
> > > So allow userland to flush the image to hardware at runtime, and then
> > > allow authenticating the image at another time.
> > >
> > > For the Dell WD19TB some specific hardware capability exists that allows
> > > extending this to automatically complete the update when unplugged.
> > > Export that functionality to userspace as well.
> > >
> > > This patch series is done relative thunderbolt.git/next.
> >
> > Thanks for the patch series. I wonder if you could base this on top of
> > my "retimer NVM upgrade" series here (you are also Cc'd):
> >
> > https://lore.kernel.org/linux-usb/20200616135617.85752-1-
> > [email protected]/
> >
> > That series moves some of the common NVM functionality into a separate
> > file (nvm.c).
>
> Sure thing. Do you by chance already have that on a public branch somewhere
> that I can easily rebase it?

I just pushed "bleeding-edge" branch that you should be able to base
your stuff on top:

https://git.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt.git/log/?h=bleeding-edge

It includes a couple of other patches as well (subject to change since
they are also under review).