I'm interested in CMA scheme or preserved memory allocation of ION
(ION_HEAP_TYPE_CARVEOUT heap type)
I knew many SoC vendors (TI, nvidia, qualcom) already used similar
approaches for multimedia processing in the past.
However, reservation of physical memory should waste memory and limit
available system memory, so now they use an IOMMU to support a contiguous
virtual address region.
In addition to, ICS (Ice Cream Sandwitch) support overlay UI layer
requiring lots of contiguous memory allocation area.
Now I'm suggesting an idea to use lots of contiguous memory allocation area
without IOMMU.
So ION_HEAP_TYPE_CARVEOUT heap type of ION is one of my considerations, but
you know that it might exhaust much physical memory. However, I think
physical memory wasting problem can be solved in the virtualized system.
In case of virtualized environment, physical memory is intermediate
physical memory instead of real physical memory, so a preserved carveout
heap does not exhaust real physical memory any more. In addition to, if
virtual address and intermediate physical address are 32 and 40bits
respectively, virtual memory is not exhausted neither.
How do you think about my suggestion?
From: Prathyush K <prathyush.k(a)samsung.com>
With these set of patches, the Exynos5 DRM module will be able to
allocate, export and map non-contiguous memory for GEM objects using the
dma-mapping IOMMU framework.
These patches are based on the following references:
1> Exynos 5 SYSMMU driver by Kyongho Cho
http://lists.infradead.org/pipermail/linux-arm-kernel/2011-December/078636.…
2> DMA-MAPPING IOMMU framework by Marek Szyprowski
http://lists.infradead.org/pipermail/linux-arm-kernel/2011-June/053636.html
3> DRM-PRIME by Dave Airlie
http://patches.linaro.org/7480/
4> DRM Exynos DMABUF module by Inki Dae
http://git.infradead.org/users/kmpark/linux-2.6-samsung/commit/
d59d3e521d8a9d27e7b329f89f24a8473f32f50c/
5> Support for dma_get_pages by Tomasz Stanislawski
http://patchwork.linuxtv.org/patch/9639/
The updated GEM framework by Inki Dae is not considered for this patch set.
IOMMU mapping is created for exynos-drm-device initially.
Allocation of GEM objects happens through dma_alloc_writecombine which
inturn calls arm_iommu_alloc_attrs. This will allocate a non-contig set of
pages, allocate a iova and map all the pages.
The following changes are done to support non-contiguous memory for GEM objects
[PATCH 1/4]:
drm/exynos: DMABUF: Added support for exporting non-contig buffers.
This patch is for creating and mapping a SGT in map_dma_buf by
retrieving the pages by calling dma_get_pages.
[PATCH 2/4]:
drm/exynos: Mapping of gem objects uses dma_mmap_writecombine.
This patch is for mapping the non-contiguous GEM objects to user
space by calling dma_mmap_writecombine.
[PATCH 3/4]:
drm/Exynos: Added 'disable' function to Exynos drm crtc module.
This patch is required for safe release of DRM. If a FB of a CRTC
is released, the driver tries to disable the CRTC if that is
supported by the CRTC. This patch adds Exynos DRM CRTC disable
functionality.
[PATCH 4/4]:
drm: Releasing FBs before releasing GEM objects during drm_release.
This patch is required for safe release of DRM. During drm release,
all the FBs and GEM objects are released. A gem object which is used
as a FB must not be freed first before releasing the FB. This patch
modifies the drm release function to first release the FBs and then
release the GEMs.
drivers/gpu/drm/drm_fops.c | 6 +-
drivers/gpu/drm/exynos/exynos_drm_crtc.c | 11 +++
drivers/gpu/drm/exynos/exynos_drm_dmabuf.c | 98 +++++++++++++++++++++++-----
drivers/gpu/drm/exynos/exynos_drm_gem.c | 70 +++++++++-----------
4 files changed, 128 insertions(+), 57 deletions(-)
Hi!
This is an example of the IOMMU aware DMA-mapping implementation usage
on a Samsung Exynos4 based NURI board. The ARM DMA-mapping IOMMU aware
implementation is available in the [1] thread:
This patch essentially registers DMA-mmaping/IOMMU support for FIMC and
MFC devices and performs some tweaks in clocks hierarchy to get SYSMMU
driver working correctly.
The drivers have been tested with mainline V4L2 drivers for FIMC and MFC
hardware.
For easier testing I've created a separate kernel branch with all
required prerequisite patches. It is based on lastest kgene/for-next
branch and is available on my git repository:
git://git.linaro.org/people/mszyprowski/linux-dma-mapping.git 3.4-rc2-arm-dma-v8-samsung
This patch requires the following items:
1. ARM DMA-mapping patches [1]
2. Exynos SYSMMU driver v12 [2]
3. Exynos SYSMMU driver runtime pm fixes
4. Exynos4 gen_pd power domain driver fixes
Runtime pm and power domain patches are required on Samsung Nuri board,
but might be optional on boards where bootloader doesn't disable all
devices on boot.
[1] http://www.spinics.net/lists/linux-arch/msg17331.html
[2] https://lkml.org/lkml/2012/3/15/51
Best regards
Marek Szyprowski
Samsung Poland R&D Center
Patch summary:
Marek Szyprowski (1):
ARM: Exynos4: integrate SYSMMU driver with DMA-mapping interface
arch/arm/mach-exynos/Kconfig | 1 +
arch/arm/mach-exynos/clock-exynos4.c | 64 +++++++++++++++-------------
arch/arm/mach-exynos/dev-sysmmu.c | 44 +++++++++++++++++++
arch/arm/mach-exynos/include/mach/sysmmu.h | 3 +
drivers/iommu/Kconfig | 1 +
5 files changed, 84 insertions(+), 29 deletions(-)
--
1.7.1.569.g6f426
Hello everyone,
The patcheset adds support for DMABUF [1] importing to vmalloc allocator in
videobuf2 stack. This is an incremental patch to 'Integration of videobuf2
with dmabuf' patchset [2]. This patch makes use of vmap extension for dmabuf
proposed by Dave Airlie [3].
The vmap was preferred over the kmap extension. The reason is that VIVI driver
requires the memory to be mapped into a contiguous block of virtual memory
accessible by kernel. The workaround could be mapping all pages into kernel
memory but the dmabuf-kmap interface does guarantee that consecutive pages are
mapped into consecutive addresses.
[1] https://lkml.org/lkml/2011/12/26/29
[2] http://thread.gmane.org/gmane.linux.drivers.video-input-infrastructure/46586
[3] http://cgit.freedesktop.org/~airlied/linux/commit/?h=drm-dmabuf2&id=c481a54…
Dave Airlie (1):
dma-buf: add vmap interface
Tomasz Stanislawski (2):
v4l: vb2-vmalloc: add support for dmabuf importing
v4l: vivi: support for dmabuf importing
drivers/base/dma-buf.c | 29 ++++++++++++++++
drivers/media/video/Kconfig | 1 +
drivers/media/video/videobuf2-vmalloc.c | 56 +++++++++++++++++++++++++++++++
drivers/media/video/vivi.c | 2 +-
include/linux/dma-buf.h | 16 +++++++++
5 files changed, 103 insertions(+), 1 deletions(-)
--
1.7.5.4