Page MenuHomeFreeBSD

Add a way to map arm64 non-posted device memory
ClosedPublic

Authored by andrew on Apr 12 2021, 9:33 AM.

Details

Summary

On arm64 we currently use a non-posted write for device memory, however
we should move to use posted writes. This is expected to work on most
hardware, however we will need to support a non-posted option for some
broken hardware.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Pass ma to pmap_mapdev_attr

bcr added a subscriber: bcr.

OK from manpages.

sys/arm64/include/vm.h
43

They are both the same, is that a typo ?

sys/arm64/include/vm.h
43

I'm planning on changing VM_MEMATTR_DEVICE to VM_MEMATTR_DEVICE_nGnRE, but need to update the PCIe drivers to use non-posted memory for their config space first.

manu added inline comments.
sys/arm64/include/vm.h
43

Ok thanks, maybe include that in the commit message so people don't ask the same question as me :)

This revision is now accepted and ready to land.Apr 12 2021, 11:51 AM
  • Teach vmstat about VM_MEMATTR_DEVICE_NP
  • Add a comment explaining why the device meory types are the same
This revision now requires review to proceed.Apr 12 2021, 1:43 PM
This revision is now accepted and ready to land.Apr 12 2021, 3:01 PM

We'll never have 'old broken devices' needing to use the BUS_SPACE_MAP_NONPOSTED attribute any place except arm64 because that's the only place they could possibly be, right?
Do we have any notion of which devices might be like this? Or is this a easy to do patch that allows quick 'CYA' fixes later if one remains hidden?

It's needed by the Tegra PCIe driver as it maps its config space via bus_space_map. The other PCI drivers use bus_alloc_resource_any for their config space so can be updated to use RF_UNMAPPED and bus_map_resource.