The dma_contiguous_remap() function clears existing section maps using
the wrong size (PGDIR_SIZE instead of PMD_SIZE). This is a bug which
does not affect non-LPAE systems, where PGDIR_SIZE and PMD_SIZE are the same.
On LPAE systems, however, this bug causes the kernel to hang at this point.
This fix has been tested on both LPAE and non-LPAE kernel builds.
Signed-off-by: Vitaly Andrianov <vitalya(a)ti.com>
---
arch/arm/mm/dma-mapping.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index 446dc1b..d220d4f 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -414,7 +414,7 @@ void __init dma_contiguous_remap(void)
* Clear previous low-memory mapping
*/
for (addr = __phys_to_virt(start); addr < __phys_to_virt(end);
- addr += PGDIR_SIZE)
+ addr += PMD_SIZE)
pmd_clear(pmd_off_k(addr));
iotable_init(&map, 1);
--
1.7.5.4
This dma attribute can be used to pass to the iommu ops of dma-mapping framework to differentiate between kernel and user space allocations.
Signed-off-by: Abhinav <abhinav.k(a)samsung.com>
---
include/linux/dma-attrs.h | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/include/linux/dma-attrs.h b/include/linux/dma-attrs.h
index 547ab56..861df09 100644
--- a/include/linux/dma-attrs.h
+++ b/include/linux/dma-attrs.h
@@ -15,6 +15,7 @@ enum dma_attr {
DMA_ATTR_WEAK_ORDERING,
DMA_ATTR_WRITE_COMBINE,
DMA_ATTR_NON_CONSISTENT,
+ DMA_ATTR_USER_SPACE,
DMA_ATTR_MAX,
};
--
1.7.0.4
Hi all,
I have one question on memory migration. As we know, malloc() from
user app will allocate MIGRATE_MOVABLE pages. But if we want to use
this memory as DMA usage, we can't accept MIGRATE_MOVABLE type. Could
we change its behavior before DMA working?
Thanks
Haojian
With this add a new attribute that can be passsed to dma-mapping IOMMU apis
to differentiate between kernel and user allcoations.
diff --git a/include/linux/dma-attrs.h b/include/linux/dma-attrs.h
index 547ab56..861df09 100644
--- a/include/linux/dma-attrs.h
+++ b/include/linux/dma-attrs.h
@@ -15,6 +15,7 @@ enum dma_attr {
DMA_ATTR_WEAK_ORDERING,
DMA_ATTR_WRITE_COMBINE,
DMA_ATTR_NON_CONSISTENT,
+ DMA_ATTR_USER_SPACE,
DMA_ATTR_MAX,
};
Hello,
This is a request for comments on dma-mapping patches for ARM. I
did some additions for issue related to kernel virtual memory allocations
in the iommu ops defined in dma-mapping framework.
The patches are based on:
git://git.linaro.org/people/mszyprowski/linux-dma-mapping.git3.4-rc3-arm-dm…
The code has been tested on Samsung Exynos5 SMDK5250.
These patches do the following:
1. Define a new dma attribute to identify user space allocation.
2. Add new wrapper functions to pass the dma attribute defined in (1)
above, as in the current framework there is no way to pass the new
attribute which can be used to differentiate between kernel and user
allocations.
3. Extend the existing arm_dma_ops for iommu enabled devices to
differentiate between kernel and user space allocations.
Patch summary:
[PATCH 1/3]:
Common: add DMA_ATTR_USER_SPACE to dma-attr. This can be passed to
arm_dma_ops to identify the type of allocation which can be either from
kernel or from user.
[PATCH 2/3]:
ARM: add "struct page_infodma" to hold information for allocated pages.
This can be attached to any of the devices which is making use of
dma-mapping APIs. Any interested device should allocate this structure and
store all the relevant information about the allocated pages to be able to
do a look up for all future references.
ARM: add dma_alloc_writecombine_user() function to pass DMA_ATTR_USER_SPACE
attribute
ARM: add dma_free_writecombine_user() function to pass DMA_ATTR_USER_SPACE
attribute
ARM: add dma_mmap_writecombine_user() function to pass DMA_ATTR_USER_SPACE
attribute
[PATCH 3/3]:
ARM: add check for allocation type in __dma_alloc_remap() function
ARM: add check for allocation type in arm_iommu_alloc_attrs() function
ARM: add check for allocation type in arm_iommu_mmap_attrs() function
ARM: re-used dma_addr as a flag to check for memory allocation type. It was
an unused argument and the prototype does not pass dma-attrs, so used this
as a means to pass the flag.
ARM: add check for allocation type in arm_iommu_free_attrs() function
arch/arm/include/asm/dma-mapping.h | 31 +++++++
arch/arm/mm/dma-mapping.c | 168
++++++++++++++++++++++++++----------
include/linux/dma-attrs.h | 1 +
3 files changed, 155 insertions(+), 45 deletions(-)