Page MenuHomeFreeBSD

linuxkpi: enhance various PCI bits
ClosedPublic

Authored by bz on Jan 15 2021, 11:44 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Apr 17, 7:24 PM
Unknown Object (File)
Tue, Apr 16, 3:03 AM
Unknown Object (File)
Tue, Apr 16, 3:02 AM
Unknown Object (File)
Thu, Apr 11, 7:12 PM
Unknown Object (File)
Mar 24 2024, 4:54 AM
Unknown Object (File)
Feb 4 2024, 5:11 AM
Unknown Object (File)
Dec 22 2023, 11:08 PM
Unknown Object (File)
Dec 14 2023, 10:06 PM
Subscribers

Details

Summary

linuxkpi: enhance various PCI bits

  • In linux_pci_attach_device() get rid of dinfo apart from the two lines actually needing it. Given we set ivars, we can then use proper pci_get_*() accessor functions instead in either case.

    Move some more of these accessor initialisations to lkpifill_pci_dev(), which also avoids duplicat work for "device" and "vendor".
  • Move pdev->bus allocation common to lkpinew_pci_dev() and linux_pci_attach_device() into lkpifill_pci_dev().
  • Move the pdev->dev.* and kobj initializations from linux_pci_attach_device() into lkpifill_pci_dev() allowing the lkpinew_pci_dev() case to also use them.
  • Add a pdev->dev.release function for the lkpinew_pci_dev() case simply freeing the pdev->bus and the pdev called through the normal logic when the kref of the kobj of the dev of the pdev goes to 0.
  • With pdev->dev.kobj always initialized and the release function, Implement pci_dev_put() in the expected way (previously discussed as part of D27550).

All but the pci_domain_nr() changes are so that DRM will use the
normal dev/kobj refcount logic and common functions without any
special hack for device management. We keep doing this without
actually adding the allocated pci devices (incl. the kobjb satte)
from lkpinew_pci_dev() to the pci_devices list.

Sponsored-by: The FreeBSD Foundation
Obtained-from: bz_iwlwifi (partially)

Test Plan

Loading i915kms and unloading i915kms did work.

Diff Detail

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

Event Timeline

bz requested review of this revision.Jan 15 2021, 11:44 PM
bz retitled this revision from linuxkpi: ehance various PCI bits to linuxkpi: enhance various PCI bits.Jan 16 2021, 12:03 AM
bz edited the summary of this revision. (Show Details)

Anyone any last comments; I'd love to commit this before Monday.

This revision was not accepted when it landed; it landed in state Needs Review.Jan 28 2021, 4:47 PM
This revision was automatically updated to reflect the committed changes.