drmn gets into the way as non PCIe device

From: Bjoern A. Zeeb <bzeeb-lists_at_lists.zabbadoz.net>
Date: Sat, 10 May 2025 20:00:16 UTC
Hi,

based on panics we have seen and a suggestion from jhb in a PR I was
working on mirroring the PCIe hierarchy in LinuxKPI.  This is also needed
for suspend/resume of WiFi.

That howver gives a panic as the PCI code asserts that there is no
non-PCI device in the hierarchy:

pci_find_pcie_root_port():
         pci_class = devclass_find("pci");
         KASSERT(device_get_devclass(device_get_parent(dev)) == pci_class,
             ("%s: non-pci device %s", __func__, device_get_nameunit(dev)));

I'd rather not replicate logic in LinuxKPI to filter out drmn.. the only thing
I could do is filter out the drmn path entirely but sooner or later we might
want to do looks there as well for crashes (if they don't do already) and hit
the problem there as well.

I assume this has to do with the special magic we do with vgapci and drm-kmod?
Can this be solved or should I start hacking around this?
I haven't looked at the drm code yet as I have another 4 different panics on main
to deal with.

panic: pci_find_pcie_root_port: non-pci device drmn0
cpuid = 0
time = 1746898822
KDB: stack backtrace:
db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe01066a6700
vpanic() at vpanic+0x136/frame 0xfffffe01066a6830
panic() at panic+0x43/frame 0xfffffe01066a6890
pci_find_pcie_root_port() at pci_find_pcie_root_port+0xe2/frame 0xfffffe01066a68c0
linux_pci_attach_device() at linux_pci_attach_device+0x440/frame 0xfffffe01066a6910
device_attach() at device_attach+0x45b/frame 0xfffffe01066a6960
bus_generic_driver_added() at bus_generic_driver_added+0x90/frame 0xfffffe01066a6980
devclass_driver_added() at devclass_driver_added+0x29/frame 0xfffffe01066a69b0
devclass_add_driver() at devclass_add_driver+0x138/frame 0xfffffe01066a69f0
_linux_pci_register_driver() at _linux_pci_register_driver+0xc1/frame 0xfffffe01066a6a20
i915kms_evh() at i915kms_evh+0x299/frame 0xfffffe01066a6a50
module_register_init() at module_register_init+0xb0/frame 0xfffffe01066a6a80
linker_load_module() at linker_load_module+0xc51/frame 0xfffffe01066a6d80
kern_kldload() at kern_kldload+0x16e/frame 0xfffffe01066a6dd0
sys_kldload() at sys_kldload+0x59/frame 0xfffffe01066a6e00
amd64_syscall() at amd64_syscall+0x15a/frame 0xfffffe01066a6f30
fast_syscall_common() at fast_syscall_common+0xf8/frame 0xfffffe01066a6f30
--- syscall (304, FreeBSD ELF64, kldload), rip = 0xa35e0882a0a, rsp = 0xa35de06fe88, rbp = 0xa35de070400 ---
KDB: enter: panic


-- 
Bjoern A. Zeeb                                                     r15:7