Page MenuHomeFreeBSD

Implement pmap_change_attr() for PowerPC (Book-E only for now)
ClosedPublic

Authored by jhibbits on Feb 27 2016, 4:59 AM.

Details

Summary

Some drivers need special memory requirements. X86 solves this with a
pmap_change_attr() API, which DRM uses for changing the mapping of the GART and
other memory regions. Implement the same function for PowerPC. AIM currently
does not need this, but will in the future for DRM, so a default is added for
that, for business as usual. Book-E has some drivers coming down that do
require non-default memory coherency. In this case, the Datapath Acceleration
Architecture (DPAA) based ethernet controller has 2 regions for the buffer
portals: cache-inhibited, and cache-enabled. By default, device memory is
cache-inhibited. If the cache-enabled memory regions are mapped
cache-inhibited, an alignment exception is thrown on access.

Test Plan

Tested with a new driver to be added after this (DPAA dTSEC
ethernet driver). No alignment exceptions thrown, driver works as expected with
this.

Diff Detail

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

Event Timeline

jhibbits retitled this revision from to Implement pmap_change_attr() for PowerPC (Book-E only for now).
jhibbits updated this object.
jhibbits edited the test plan for this revision. (Show Details)
jhibbits added reviewers: PowerPC, nwhitehorn, marcel.
nwhitehorn edited edge metadata.

Looks good. In those drivers, though, why not use pmap_mapdev_attr()? Why do you need to change it later?

This revision is now accepted and ready to land.Feb 27 2016, 6:41 PM

Looks good. In those drivers, though, why not use pmap_mapdev_attr()? Why do you need to change it later?

I was initially trying to do it all through bus_alloc_resource(), with adding a new RF_CACHEABLE flag, but there were objections. Kib mentioned DRM using pmap_change_attr() to get around bus_alloc_resource() setting only default memory constraints, so I went that route.

I could also just do it as pmap_mapdev_attr() + rman_activate_resource(). There's not much difference.

I will defer to Kostik on this one.

This revision was automatically updated to reflect the committed changes.