Page MenuHomeFreeBSD

sys: Use is_pci_device instead of direct comparisons to devclasses
ClosedPublic

Authored by jhb on Wed, May 13, 8:27 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, May 27, 1:17 PM
Unknown Object (File)
Tue, May 26, 5:36 PM
Unknown Object (File)
Tue, May 26, 5:27 PM
Unknown Object (File)
Mon, May 25, 8:44 PM
Unknown Object (File)
Mon, May 25, 8:25 AM
Unknown Object (File)
Mon, May 25, 7:46 AM
Unknown Object (File)
Mon, May 25, 5:10 AM
Unknown Object (File)
Mon, May 25, 5:07 AM
Subscribers

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 73088
Build 69971: arc lint + arc unit

Event Timeline

bz requested changes to this revision.Wed, May 13, 9:01 PM
bz added a subscriber: bz.

No necessarily changes but the LinuxKPI dev_is_pci() variant should get more careful checking (especially in drm land; I believe wireless is fine).

sys/compat/linuxkpi/common/include/linux/pci.h
403

This seems wrong, doesn't it one or the other way (before or now)?
We were not getting the parent here but now.
In theory that should be fine unless it's the acpi0 -> pcib0 lookup (unlikely to be hit with this function) or we hit any special "drmn" magic which is not a PCI device.

sys/dev/iommu/busdma_iommu.c
120

Could move some of them into a smaller scope; at least for pcip and pcibp that would make sense now.

This revision now requires changes to proceed.Wed, May 13, 9:01 PM
sys/compat/linuxkpi/common/include/linux/pci.h
403

Yea. All the others check the parent. This checks the device

sys/compat/linuxkpi/common/include/linux/pci.h
403

Oh humm, so it is. I wonder if the old version of this was broken though. The code on Linux appears to be testing a leaf device not a PCI bus device, in particular see how it is used in dev_is_pf in the next line which clearly assumes that it is operating on a PF, not a logical bus:

https://github.com/torvalds/linux/blob/e1914add2799225a87502051415fc5c32aeb02ae/include/linux/pci.h#L1278

That said, that means this change should be its own followup commit as a fix for a pre-existing bug, or perhaps I should fix it to check the parent first?

jhb added inline comments.
sys/dev/iommu/busdma_iommu.c
120

Possibly, though that adds more noise to the diff? It's also true that pcip isn't really needed either if one is content with a nested call to device_get_parent.

x86/iommu part is certainly fine.

sys/compat/linuxkpi/common/include/linux/pci.h
403

Can you do a quick fix in main and then rebase this on top? I'd try to approve as son as I see it.

Rebase on top of LinuxKPI fixup

This revision is now accepted and ready to land.Mon, May 18, 3:40 PM