RE: [EXTERNAL] Re: [PATCH v2 1/5] net: marvell: prestera: fix driver reload

From: Elad Nachman
Date: Thu Mar 21 2024 - 13:22:43 EST




> -----Original Message-----
> From: Andrew Lunn <andrew@xxxxxxx>
> Sent: Thursday, March 21, 2024 12:58 AM
> To: Elad Nachman <enachman@xxxxxxxxxxx>
> Cc: Taras Chornyi <taras.chornyi@xxxxxxxxxxx>; davem@xxxxxxxxxxxxx;
> edumazet@xxxxxxxxxx; kuba@xxxxxxxxxx; pabeni@xxxxxxxxxx;
> kory.maincent@xxxxxxxxxxx; thomas.petazzoni@xxxxxxxxxxx;
> miquel.raynal@xxxxxxxxxxx; przemyslaw.kitszel@xxxxxxxxx;
> dkirjanov@xxxxxxx; netdev@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx
> Subject: [EXTERNAL] Re: [PATCH v2 1/5] net: marvell: prestera: fix driver
> reload
>
> Prioritize security for external emails: Confirm sender and content safety
> before clicking links or opening attachments
>
> ----------------------------------------------------------------------
> On Wed, Mar 20, 2024 at 07:20:04PM +0200, Elad Nachman wrote:
> > From: Elad Nachman <enachman@xxxxxxxxxxx>
> >
> > Driver rmmod after insmod would fail because API call to reset the
> > switch HW and restart the firmware CPU code loading procedure was
> > missing in driver removal code handler.
> >
> > Firmware reset and reload is needed as the firmware termination will
> > make the firmware loader change its state machine to the firmware
> > loading state, and thus will be able to load new firmware, which is
> > done at the beginning of the probing of the prestera_pci module.
> >
> > Without this reset, the firmware loader will stay in the wrong state,
> > causing the next firmware loading phase in the probe to fail.
>
> What is missing from this is an explanation why you need to reload the
> firmware at the next re-probe. That just seems like a waste of time if you have
> already loaded it once.
>
> Andrew

Unfortunately that's how the firmware loader on the firmware cpu state machine works.
There is no ABI interface to verify which firmware is already loaded, and then supporting
Warm boot reading of the values back to the kernel.
Since many of these firmware binaries are secure-boot protected, upgrading is very tricky.

Elad.