Page MenuHomeFreeBSD

vmd: Rename vmd_bus class to pci
ClosedPublic

Authored by nc on Jul 6 2021, 1:19 AM.

Details

Summary

This fixes a kernel panic when probing for vmd_bus on Intel TigerLake on 14-CURRENT. Apparently, vmd_bus is a type of PCI bus, but still registers as a separate device class.

PR: 256915

Test Plan

This is tested to load the VMD-based SSD on an Intel TigerLake system (HP Spectre x360 13t-aw200)

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint OK
Unit
No Unit Test Coverage
Build Status
Buildable 40338
Build 37227: arc lint + arc unit

Event Timeline

nc requested review of this revision.Jul 6 2021, 1:19 AM
nc created this revision.
nc edited the test plan for this revision. (Show Details)
sys/dev/pci/pci.c
6268

The assert is wrong, but I don't think is the right way to fix it. We want to pass and devclass that's pci or derived from pci, I think. That may need a new newbus helper function which I'm happy to write if jhb concurs.

6288

I think this would need it to to be complete general.

https://reviews.freebsd.org/D31073 implements the hints, and is presented for testing only at the moment.

Can we not just rename the PCI bus that VMD creates to "pci"? There are some other places that use this same sort of check to know if they are dealing with a PCI device. I think renaming the bus device might really be the simplest approach. We do this for other PCI buses we discover via curious means (e.g. qpi.c).

In D31071#701646, @jhb wrote:

Can we not just rename the PCI bus that VMD creates to "pci"? There are some other places that use this same sort of check to know if they are dealing with a PCI device. I think renaming the bus device might really be the simplest approach. We do this for other PCI buses we discover via curious means (e.g. qpi.c).

While I didn't find many, this would be the path of least resistance.

Instead of asserting, I renamed the class to pci. It works!

Now I just have to worry about rebuilding my custom drm-kmod branch.

nc retitled this revision from pci: Assert for vmd_bus along with pci to vmd: Rename vmd_bus class to pci.Jul 16 2021, 2:06 AM
This revision is now accepted and ready to land.Jul 16 2021, 2:23 AM
This revision was automatically updated to reflect the committed changes.

It would be good to note, that to find out if a child is attached to vmd, that they will have to look for the vmd device and not the bus. I have some uncommitted code that had to skip a check in the PCI hot plug code when in VMD mode. So I added code to walk the chain to see how it was attached. It would be good to have a comment here why this was done.