Page MenuHomeFreeBSD

linuxkpi: Fix `pci_upstream_bridge()` with DRM devices
ClosedPublic

Authored by dumbbell on Mar 15 2025, 11:26 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Jun 29, 9:14 PM
Unknown Object (File)
Sun, Jun 29, 4:15 AM
Unknown Object (File)
Sat, Jun 21, 6:05 PM
Unknown Object (File)
Sat, Jun 21, 4:19 AM
Unknown Object (File)
Thu, Jun 19, 8:08 PM
Unknown Object (File)
Thu, Jun 19, 1:09 PM
Unknown Object (File)
Tue, Jun 17, 8:20 PM
Unknown Object (File)
Tue, Jun 10, 1:23 AM
Subscribers

Details

Summary

In the case of DRM drivers, the passed device is a child of vgapci. We want to start the lookup from vgapci, so the parent of the passed drmn. We use the isdrm flag to determine if we are in this situation.

This fixes an infinite loop with the amdgpu DRM driver that started to use this function in Linux 6.8: pci_upstream_bridge() was returning itself and the code in amdgpu was calling it again, hoping to get a device with a vendor that is not "ATI".

This is part of the update of DRM drivers to Linux 6.8.

Sponsored by: The FreeBSD Foundation

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

bz requested changes to this revision.Apr 1 2025, 11:32 PM
bz added a subscriber: bz.
bz added inline comments.
sys/compat/linuxkpi/common/include/linux/pci.h
532

If you just want to add the one extra skip, is that .. as initialized by linux_pci_register_driver()?

if (pdev->pdrv != NULL && pdev->pdrv->isdrm)
     bridge = device_get_parent(bridge);
This revision now requires changes to proceed.Apr 1 2025, 11:32 PM
dumbbell edited the summary of this revision. (Show Details)
This revision is now accepted and ready to land.Apr 12 2025, 10:04 PM