summaryrefslogtreecommitdiffstats
path: root/sys/powerpc/powerpc
diff options
context:
space:
mode:
authorjhibbits <jhibbits@FreeBSD.org>2016-02-27 20:39:36 +0000
committerjhibbits <jhibbits@FreeBSD.org>2016-02-27 20:39:36 +0000
commit0677ff9cefa9d73fbf058b41d01e7b358a4c8678 (patch)
treed928d1f765dac476468ab1e3f1a45dd369f96ede /sys/powerpc/powerpc
parentcd50f0196723942045f247e8f82245d3d266f9c7 (diff)
downloadFreeBSD-src-0677ff9cefa9d73fbf058b41d01e7b358a4c8678.zip
FreeBSD-src-0677ff9cefa9d73fbf058b41d01e7b358a4c8678.tar.gz
Implement pmap_change_attr() for PowerPC (Book-E only for now)
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. Reviewed By: nwhitehorn Sponsored by: Alex Perez/Inertial Computing Differential Revision: https://reviews.freebsd.org/D5471
Diffstat (limited to 'sys/powerpc/powerpc')
-rw-r--r--sys/powerpc/powerpc/mmu_if.m23
-rw-r--r--sys/powerpc/powerpc/pmap_dispatch.c7
2 files changed, 30 insertions, 0 deletions
diff --git a/sys/powerpc/powerpc/mmu_if.m b/sys/powerpc/powerpc/mmu_if.m
index 6c41c74..ce05bd4 100644
--- a/sys/powerpc/powerpc/mmu_if.m
+++ b/sys/powerpc/powerpc/mmu_if.m
@@ -124,6 +124,12 @@ CODE {
{
return;
}
+
+ static int mmu_null_change_attr(mmu_t mmu, vm_offset_t va,
+ vm_size_t sz, vm_memattr_t mode)
+ {
+ return (0);
+ }
};
@@ -956,3 +962,20 @@ METHOD void quick_remove_page {
vm_offset_t _va;
};
+/**
+ * @brief Change the specified virtual address range's memory type.
+ *
+ * @param _va The virtual base address to change
+ *
+ * @param _sz Size of the region to change
+ *
+ * @param _mode New mode to set on the VA range
+ *
+ * @retval error 0 on success, EINVAL or ENOMEM on error.
+ */
+METHOD int change_attr {
+ mmu_t _mmu;
+ vm_offset_t _va;
+ vm_size_t _sz;
+ vm_memattr_t _mode;
+} DEFAULT mmu_null_change_attr;
diff --git a/sys/powerpc/powerpc/pmap_dispatch.c b/sys/powerpc/powerpc/pmap_dispatch.c
index 2082ba0..e7b6d76 100644
--- a/sys/powerpc/powerpc/pmap_dispatch.c
+++ b/sys/powerpc/powerpc/pmap_dispatch.c
@@ -564,6 +564,13 @@ pmap_quick_remove_page(vm_offset_t addr)
MMU_QUICK_REMOVE_PAGE(mmu_obj, addr);
}
+int
+pmap_change_attr(vm_offset_t addr, vm_size_t size, vm_memattr_t mode)
+{
+ CTR4(KTR_PMAP, "%s(%#x, %#zx, %d)", __func__, addr, size, mode);
+ return (MMU_CHANGE_ATTR(mmu_obj, addr, size, mode));
+}
+
/*
* MMU install routines. Highest priority wins, equal priority also
* overrides allowing last-set to win.
OpenPOWER on IntegriCloud