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.
Details
Details
- Reviewers
nwhitehorn marcel - Group Reviewers
PowerPC - Commits
- rS296142: Implement pmap_change_attr() for PowerPC (Book-E only for now)
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
Diff Detail
- Repository
- rS FreeBSD src repository - subversion
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
Comment Actions
Looks good. In those drivers, though, why not use pmap_mapdev_attr()? Why do you need to change it later?
Comment Actions
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.