Page MenuHomeFreeBSD

mps(4): add support for hostboot
Needs ReviewPublic

Authored by allanjude on Sun, Sep 20, 1:52 AM.
Tags
None
Referenced Files
F173188745: D59854.diff
Thu, Sep 24, 4:40 AM
Unknown Object (File)
Tue, Sep 22, 10:19 AM
Unknown Object (File)
Tue, Sep 22, 4:20 AM
Unknown Object (File)
Sun, Sep 20, 10:30 PM
Unknown Object (File)
Sun, Sep 20, 6:16 PM
Unknown Object (File)
Sun, Sep 20, 4:53 AM
Unknown Object (File)
Sun, Sep 20, 3:02 AM
Unknown Object (File)
Sun, Sep 20, 3:01 AM
Subscribers

Details

Summary

If the mps/mpr(4) device has corrupted or missing firmware then
it will fail to attach at boot.

Add a new /dev/mp{s,r}_hostboot device, and a corresponding
mpsutil hostboot command, to reset the device and boot
from firmware loaded from host memory.

Also add an interface to use firmware(9) to load the firmware at boot.

Loosely based on https://github.com/marcan/lsirec/

Assisted by: Claude Code (Sonnet 5)
Sponsored by: Klara, Inc.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 77102
Build 73985: arc lint + arc unit

Event Timeline

sys/dev/mpr/mpr.c
979

I've never done this kind of driver stuff (DMA) before, so this needs extra careful review.

sys/dev/mpr/mpr_user.c
272

silly question. If there's no driver attached, then how do we open a device to all this ioctl? How could you possibly recover a device that mpr doesn't attach to? Why do you need that code to allocate resources?

You might want to explain the exact mechanism how this comes to pass. the missing bit from the comments is that that mpr associate with the device because probe succeeds.

But the bigger issue, I'd think, is that if probe succeeds and attach doesn't, then I think there'd be no devsw registered...

sys/dev/mpr/mpr_user.c
272

Indeed, probe succeeds, and mpr_attach() fails, because the device stays in the MPI2_IOC_STATE_RESET state, because it has no firmware.
So we end up with no /dev/mprN device.

So, this patch adds a new /dev/mpr_hostboot device, that isn't associated with any hardware, and will just "always exist".
Then mprutil can IOCTL to it, and ask it "could you please boot pci0:7:0:0 with this firmware (pointer + length)"

And then you can devctl attach pci0:7:0:0 and suddenly you have /dev/mpr0 that you didn't before.

The primary use case is actually to preload the firmware in loader.conf and stop the initial attach from failing, be having the card booted to said firmware so it doesn't fail to attach.

This is some oddball hardware I bought, a single card that is a PCI-e switch, a Mellanox ConnectX-3, and 2x LSI SAS2308 chips (basically 9305-8e), all on one card.
When making this custom card, they did not include any flash storage for the firmware.
see: https://forums.servethehome.com/index.php?threads/unique-oem-dual-lsi-2308-mellanox-connectx-3-vpi-combo-expansion-cards.30532/

If you'd like one to play with, they are only $29.99: https://www.ebay.com/itm/188115617273?itmmeta=01M2V5GZ247M7TP012W8M9FMF2&hash=item2bcc9085f9:g:YPcAAOSwpI5eCaDK