Re: [PATCH 3/4] cxl: add a firmware update mechanism using the sysfs firmware loader

From: Verma, Vishal L
Date: Wed May 31 2023 - 17:25:55 EST


On Thu, 2023-05-11 at 17:06 +0100, Jonathan Cameron wrote:
> On Fri, 21 Apr 2023 21:09:27 -0600
> Vishal Verma <vishal.l.verma@xxxxxxxxx> wrote:
>
> > The sysfs based firmware loader mechanism was created to easily allow
> > userspace to upload firmware images to FPGA cards. This also happens to
> > be pretty suitable to create a user-initiated but kernel-controlled
> > firmware update mechanism for CXL devices, using the CXL specified
> > mailbox commands.
> >
> > Since firmware update commands can be long-running, and can be processed
> > in the background by the endpoint device, it is desirable to have the
> > ability to chunk the firmware transfer down to smaller pieces, so that
> > one operation does not monopolize the mailbox, locking out any other
> > long running background commands entirely - e.g. security commands like
> > 'sanitize' or poison scanning operations.
> >
> > The firmware loader mechanism allows a natural way to perform this
> > chunking, as after each mailbox command, that is restricted to the
> > maximum mailbox payload size, the cxl memdev driver relinquishes control
> > back to the fw_loader system and awaits the next chunk of data to
> > transfer. This opens opportunities for other background commands to
> > access the mailbox and send their own slices of background commands.
> >
> > Add the necessary helpers and state tracking to be able to perform the
> > 'Get FW Info', 'Transfer FW', and 'Activate FW' mailbox commands as
> > described in the CXL spec. Wire these up to the firmware loader
> > callbacks, and register with that system to create the memX/firmware/
> > sysfs ABI.
> >
> > Signed-off-by: Vishal Verma <vishal.l.verma@xxxxxxxxx>
> Hi Vishal,
>
> Various comments inline.
>
Hi Jonathan - all of the comments were fine, I've addressed them for
v2. Thanks for reviewing these!

Vishal