Page MenuHomeFreeBSD

arm64/riscv nexus: Implement bus_unmap_resource
ClosedPublic

Authored by jhb on Nov 22 2023, 8:03 PM.
Tags
None
Referenced Files
F102734065: D42725.id130441.diff
Sat, Nov 16, 12:25 PM
Unknown Object (File)
Tue, Nov 12, 8:58 PM
Unknown Object (File)
Sat, Nov 2, 4:56 AM
Unknown Object (File)
Sun, Oct 27, 7:57 PM
Unknown Object (File)
Wed, Oct 23, 8:47 AM
Unknown Object (File)
Wed, Oct 23, 8:47 AM
Unknown Object (File)
Wed, Oct 23, 8:47 AM
Unknown Object (File)
Wed, Oct 23, 8:40 AM

Diff Detail

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

Event Timeline

jhb requested review of this revision.Nov 22 2023, 8:03 PM
imp added inline comments.
sys/arm64/arm64/nexus.c
506

Do we even have ioport references on !x86?

This revision is now accepted and ready to land.Nov 22 2023, 8:14 PM
sys/arm64/arm64/nexus.c
506

IO bars are still a thing in PCI and always send up as SYS_RES_IOPORT from the PCI bus driver up to its parent. Up to the platform how it chooses to map those resources, usually to some alternate MMIO window.

sys/arm64/arm64/nexus.c
451

Note that deactivate_resource uses bus_space_unmap, but complementing the pmap_mapdev() in nexus_map_resource() seems more correct.

jrtc27 added inline comments.
sys/arm64/arm64/nexus.c
506

All the way up to nexus? Would the PCI controller driver not be the thing that remaps it to a memory range? That’s normally where the decision gets made as to what it means. Though perhaps it still gets identified as an I/O port beyond that, just using the same memory address space? But dodgy if so though…

sys/arm64/arm64/nexus.c
506

That's what happens today, yes. It depends a bit on "who" defines the backing MMIO range for I/O ports.

Note though that this is not new, the existing nexus_map_resource function already handles SYS_RES_IOPORT and this is just mirroring that.

sys/arm64/arm64/nexus.c
506

Which happens? If the controller's turning into SYS_RES_MEMORY, I would expect it to be an error to have SYS_RES_IOPORT reach nexus for arm64 or riscv given that has no sane meaning.

sys/arm64/arm64/nexus.c
506

I think "bubbles all the way up to nexus" is what happens today. However, in this particular set of work I'm refactoring the existing code that is already here to reduce duplication across platforms (and also I would like working map/unmap_resource to fix a long-standing layering violation down in sys/dev/pci/pci_pci.c). Whether or not SYS_RES_IOPORT should be handled differently in the various PCI controller drivers is orthogonal to this change.

This revision was automatically updated to reflect the committed changes.