Commit Graph

35 Commits

Author SHA1 Message Date
Olav Haugan
1beef4be65 gpu: ion: Use standard cache routines
Instead of using custom routines for cache operations use the
standard operations for cache flush, cache clean, and cache
invalidate. In addition only call outer cache routines if
outer cache is available.

Change-Id: Idb51bf7348fd526ebdea1e6ff2e366b8a3b4de33
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
2013-02-07 17:44:16 -08:00
Olav Haugan
6c18ca537d gpu: ion: Map everything into IOMMU with 64K pages.
Due to performance issues with 4K pages and the IOMMU we should use
64K pages. However, minimum allocation from ION is 4K so instead of
mapping on demand we need to map the full heap into the IOMMU when
the first request for mapping comes. Only unmap everything from the
IOMMU when the last buffer is freed.

CRs-fixed: 348606
Change-Id: Ic1793f5caaff2f69bf1fb7e8c8b3bd03378131b8
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
[sboyd: drop board file, fmem, memory changes]
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
2013-02-07 17:44:10 -08:00
Larry Bassel
8c4028791d ion: support creation of mm heap in a fixed place
The multimedia firmware on 8960 will always be
loaded into a fixed address, and all callers into
this firmware must be no more than 256M above the
start of this firmware.

This implies that the the mm ION heap and its associated heaps
(mm_fw and mfc) must also be created in a fixed place.

This version of the patch keeps the mm fw heap size
to 2M for compatibility with the current tip. This
will eventually be reduced to 1M.

Change-Id: I35f89b8c60165fb0adbb9d04412e0e200117beb9
Signed-off-by: Larry Bassel <lbassel@codeaurora.org>
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
[sboyd: drop memory.c changes]
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
2013-02-07 17:44:05 -08:00
Olav Haugan
be9ab94f9f gpu: ion: Delay unmapping from IOMMU.
Due to limitations in the multimedia architecure
clients might not know when a buffer can be unmapped
from the IOMMU. In addition, the multimedia architecture
causes unnecessary mappings/unmappings for the same buffers
which reduces framerates.

Add logic to delay unmapping from the IOMMU
until buffer memory is freed and unmap any outstanding
mappings to avoid virtual memory address space leak.

Change-Id: Idaeae269d9ba623e25a0cb087a89b4cbb63915af
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
2013-02-07 17:44:02 -08:00
Olav Haugan
9c3801b1e3 gpu: ion: Add API to do cache operations
Clients need to be able to do cache operations
on ION buffers in the kernel. Add API to
flush, invalidate, or invalidate and flush the
cache of an ION buffer.

Change-Id: I2b676dbe32372b3c17e4aaf39f51878b105a699c
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
2013-02-07 17:43:59 -08:00
Olav Haugan
243ec126f7 gpu: ion: Add missing argument to iommu map func
There exists one definition for ion_map_iommu
function when ION is enabled and one definition when
ION is disabled. The argument list for the definition used
when ION is disabled is missing the buffer_size argument causing
compilation error for targets that call this function without
ION enabled.

Add buffer_size argument to ion_map_iommu function
for targets that does not have ION enabled.

Change-Id: Ie184e4a6dbec2bc3dff75ab3b25985fd64e2baac
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
2013-02-07 17:43:58 -08:00
Olav Haugan
e72f57b2cd gpu: ion: Move MFC heap to different address
Video hardware has the following requirements for
ION heaps:

1. MM heap must be at a higher address than FW heap.
2. MFC heap must at a higher address than FW
3. MM heap must be adjacent to FW heap.
   (There cannot be another heap between FW and MM heap)
4. MM and MFC heap cannot be more than 256MB away
   from the base address of the FW heap.

MM heap is configured as a reusable heap (FMEM heap) and FMEM
is carved out at a much higher address than the other heaps breaking
the above requirements. To support the above requirements the
MFC heap together with the FW heap must be carved out at the same
location as MM heap.

Change-Id: Ie0acb4b267d4307190ea3cd9ff23c710ffa1a538
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
[sboyd: drop fmem changes]
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
2013-02-07 17:43:57 -08:00
Olav Haugan
e023934a52 gpu: ion: Lower IOMMU heap priority
Video requires the IOMMU heap to be at a lower
priority so that video can try to allocate from
its MM carveout heap first and then if video needs
more memory and the MM heap is exhausted it will
automatically fall back on IOMMU heap.

Change the priority of the IOMMU heap so video
can fall back on IOMMU heap.

Change-Id: Id1fc19e2c3af18ced028132d1a1bdb6a3935380f
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
2013-02-07 17:43:55 -08:00
Laura Abbott
1f1b6e95ea gpu: ion: Add ION support for fmem
FMEM allows ION to release memory for other
purposes when ION clients are not using the
memory.

Add new heap type for fmem that make calls
into fmem API to transition memory from T to
C state and vice versa. Add support for
fmem to content protection heap.

Change-Id: I95f949b57c99949e6eafe6a6f5fd147bdaa264f6
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
2013-02-07 17:43:54 -08:00
Olav Haugan
5c3a35007c gpu: ion: Add new heap for qse comm
Add new 1MB carveout heap for Qualcomm Secure Executive (QSE)
communications.

Change-Id: I8cc87d5af68e9fd4f775770b16638ee01ef88e05
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
[sboyd: drop board file changes]
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
2013-02-07 17:43:49 -08:00
Olav Haugan
2fd338e25e gpu: ion: Add support for adjacent heaps
ION has to guarantee that two of the heaps are
adjacent to each other. This is due to a limitation
in the hardware. Add code to ensure these heaps
are adjacent.

Change-Id: Icc18437a50e1d872112468d02b61ab47fd70acc9
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
[sboyd: drop board file changes]
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
2013-02-07 17:43:45 -08:00
Olav Haugan
02d86ef9d7 gpu: ion: Refactor platform data
Refactor platform data to allow for better
expansion in the future. Add void * for
elements unique to each heap type.

Change-Id: I435679819c67ce917b5798009eff7e71047fd2ea
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
[sboyd: drop board file changes]
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
2013-02-07 17:43:45 -08:00
Olav Haugan
b6a020a45b gpu: ion: Add support for secure buffers
Secure buffers provides a way to allow premium encrypted
multimedia content to be decrypted in a secured
memory area that does not allow for interception of the
decrypted content.

Add support for heap type that allow heap to be
used for content protection. Introduce new content
protection heap type and id's.

Change-Id: Idd56aa8805b5b74d1b9ab3fe8964aacc218668c1
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
[sboyd: drop board file and scm.h changes]
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
2013-02-07 17:43:43 -08:00
Olav Haugan
89313b2541 gpu: ion: Add heap ids
Add heap ids for ion heaps. Remove unused
system contiguous heap. Fix vmalloc heap name.

Change-Id: I3c3a653a53c8db8b66a7bba2abac0dfe560c407c
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
[sboyd: drop board file changes]
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
2013-02-07 17:43:42 -08:00
Olav Haugan
dbd0c82f42 board: 8660: Add callbacks to request_region
Callbacks to request_region, release_region,
setup_region is missing from ION platform data for
SMI heap.

Change-Id: Ida603d4ac7c3246c0deedb9b80dc0c1ea64638eb
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
[sboyd: drop board file changes]
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
2013-02-07 17:43:41 -08:00
Laura Abbott
0a06f5ac59 gpu: ion: Add support for iommus
Add infrastructure to support mapping allocations
into iommus.

Change-Id: Ia5eafebee408e297013bf55284abf67d9eb8d78b
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
[sboyd: drop board file changes]
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
2013-02-07 17:43:39 -08:00
Alex Bird
b340bc1b9b gpu: ion: Add callbacks to enable SMI voting in ION.
This change is part of the move from PMEM to ION. ION needs an SMI
voting interface smiliar to PMEM's.

Change-Id: I18888f46198848694fb7e1e0d2671074bf51d7c9
Signed-off-by: Alex Bird <alexbird@codeaurora.org>
2013-02-07 17:43:37 -08:00
Laura Abbott
5769ad8032 gpu: ion: Add support for flushing via fd
Userspace clients pass fds around, not handles. Support flushing
via fd.

Change-Id: Ic22d9327e9fa72cb604c3010a2a6f798be8dfdb1
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
2013-02-07 17:43:36 -08:00
Alex Bird
dd69763c97 msm: Add SMI callbacks to ION platform data.
As part of the transition from PMEM to ION, the interface for accessing
SMI memory needs to be accessible from ION as it was from PMEM.

Change-Id: Ia6f9475dc030bbb0dafdcc1b6dbe93c7cdeca268
Signed-off-by: Alex Bird <alexbird@codeaurora.org>
2013-02-07 17:43:34 -08:00
Laura Abbott
30c8accd86 8660: Add support for Ion
Add support for Ion

Change-Id: I1c04b8a6df005c6ced8681f419f4445592b4832d
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
[sboyd: only ion header]
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
2013-02-07 17:43:32 -08:00
Laura Abbott
8d5660ca8b gpu: ion: Add header file for ERR_PTR
Add err.h for the declaration of ERR_PTR which
is used with the stubbed out ion headers.

Change-Id: Ic5e5aea556723ea6b9c8953ef54ad5a82d3761ec
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
2013-02-07 17:43:29 -08:00
Laura Abbott
c079ad9f94 board-msm8960: Add ion heaps corresponding to pmem heaps
Add adsp heaps for ion. This corresponds directly
to what pmem currently does. This also includes disabling
the adsp and pmem heaps for pmem.

Change-Id: I4354c713413ebbe949579741efdd75e9c444c8e7
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
[sboyd: only ion header]
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
2013-02-07 17:43:28 -08:00
Jordan Crouse
d784ff4e9e gpu: ion: Add inline stubs for Ion functions
Add inline stubs for in-kernel Ion functions to use when
Ion is not enabled in the kernel config.

Change-Id: Ic0dedbadbe4d7bab8f24763e67dd775c769b06df
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
2013-02-07 17:43:28 -08:00
Laura Abbott
323102293b gpu: ion: Add API to get the buffer flags
Clients may want to know what the existing flags are on a
handle for mapping, cache flushing or other purposes. Add
an API to get those flags.

Change-Id: I2d8c93194d1fc940042529b8851ebecf35d6e3de
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
2013-02-07 17:43:27 -08:00
Laura Abbott
973acfd39b Kbuild: Add ion header file
Make sure the header file for Ion gets exported to userspace.
Also make sure userspace can actually use the header.

Change-Id: I44f436005a6a503811c85d4fb0f89264ba160571
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
2013-02-07 17:43:25 -08:00
Laura Abbott
767d0d5934 gpu: ion: Add cache flushing APIs
Add ioctl to support flushing the caches of ion
buffers from userspace.

Change-Id: I60f1daf0eef09e1307242bb3fd0ce4aef374a111
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
2013-02-07 17:43:23 -08:00
Laura Abbott
3bd7db8021 gpu: ion: Add IS_CACHED macro
Add a proper IS_CACHED macro for detecting whether or not
flags indicated a cached mapping.

Change-Id: I2a7e130bd185d6b0bcb4b11593420b5888937880
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
2013-02-07 17:43:23 -08:00
Laura Abbott
1d94d6cd3f gpu: ion: Add support for cached and uncached mappings
Add explicit support for cached and uncached mappings. Functions
now describe whether mappings will be cached or uncached.

Change-Id: I3f0540c0486b134d7bc610480a3f72350337e5b1
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
2013-02-07 17:43:21 -08:00
Laura Abbott
0f9ac6831e gpu: ion: Add support for carveout heaps on msm targets
Add infrastructure for supporting ion carveout heaps.
The memory type should be specified in the board file using
mach/ion.h. The ion platform driver will be responsible for
allocating the correct memory.

Change-Id: Id70ed1fd799f9a5a16ff971b18d0e868bc09d875
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
2013-02-07 17:43:21 -08:00
Laura Abbott
b870e54e8a gpu: ion: Add platform driver for msm ion
Add platform driver for msm specific ion devices

Change-Id: I8f5f2c135c667ef1ff2504306ffedc295553efe0
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
2013-02-07 17:43:20 -08:00
Rebecca Schultz Zavin
903f6c716d gpu: ion: Get an sg_table from an ion handle
This patch adds an interface to return and sg_table given a
valid ion handle.

Change-Id: Icd948c60c1af0a4279f337bcd591cd39b46325e8
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
2012-05-23 13:20:25 -07:00
Rebecca Schultz Zavin
043a61468f ion: Switch ion to use dma-buf
Ion now uses dma-buf file descriptors to share
buffers with userspace.  Ion becomes a dma-buf
exporter and any driver that can import dma-bufs
can now import ion file descriptors.

Change-Id: Ia04d6d72fb301dc088eb8db6576822e9260ff332
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
2012-05-22 14:01:06 -07:00
Rebecca Schultz Zavin
6f9e56945d ion: Add reserve function to ion
Rather than requiring each platform call memblock_remove or reserve
from the board file, add this to ion

Change-Id: Ie418a692c13e9e0cfe93ecc83d253d3ce860fc83
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
2012-05-22 14:01:05 -07:00
Rebecca Schultz Zavin
7191e9ba25 ion: Switch map/unmap dma api to sg_tables
Switch these api's from scatterlists to sg_tables

Change-Id: I8b99e39633df009d472ce24704fa26af7bb50fa2
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
2012-05-22 14:01:05 -07:00
Rebecca Schultz Zavin
0c38bfd0ed gpu: ion: Add ION Memory Manager
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
2012-04-09 13:57:56 -07:00