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
F114804332: D49388.diff
Thu, Apr 17, 2:46 AM
Unknown Object (File)
Mon, Apr 14, 10:52 AM
Unknown Object (File)
Sun, Apr 13, 10:51 AM
Unknown Object (File)
Thu, Apr 10, 2:30 PM
Unknown Object (File)
Mon, Apr 7, 11:33 AM
Unknown Object (File)
Sat, Apr 5, 9:54 AM
Unknown Object (File)
Sat, Apr 5, 5:30 AM
Unknown Object (File)
Tue, Apr 1, 11:32 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.Tue, Apr 1, 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.Tue, Apr 1, 11:32 PM
dumbbell edited the summary of this revision. (Show Details)
This revision is now accepted and ready to land.Sat, Apr 12, 10:04 PM