Currently, if processing an SG table consumes more memory
than can fit in the pre-allocated buffer, then calls to
hyp_assign_table() will fail as if there were not enough
memory available to process the request.
Instead, for every call to hyp assign, allocate enough
memory to process the maximum batch size, and process large
SG tables in pieces, using this memory. This avoids failures
due to large SG tables. Also, since the memory for handling
these requests is now allocated per hyp_assign_table() call,
we can drop the pre-allocated buffer, as it is no longer in
use.
Change-Id: Ie9899a5e2c8de6127707609101f5fb557e3f0533
Signed-off-by: Isaac J. Manjarres <isaacm@codeaurora.org>
For "chunk_list + chunk_list_len", if the chunk_list is type of u32*,
the chunk_list_len will be 4 * of original size. So we flushed a wrong
area size. In some condition like we enabled CONFIG_DEBUG_PAGEALLOC, it
may flush out of page bound of the invalid pte page.
Fix it by manually convert it as void* when doing the addition.
CRs-Fixed: 2309993
Change-Id: I2b88d78ba73d9904fa2bf6106937001715b6037f
Signed-off-by: Zhenhua Huang <zhenhuah@codeaurora.org>
Add support for SPSS_SP_SHARED vmid. This vmid is equivalent
to TZ VM, which can be used for sharing memory with TZ with
the assign call.
Change-Id: I10b98820796e8bab7b8275f5ddf44e8814dc0fb0
Signed-off-by: Sudarshan Rajagopalan <sudaraja@codeaurora.org>
Update the function return value and input scm_ret variable
type for restore secure configuration in scm_restore_sec_cfg() fn.
Adding scm_ret input variable for scm_get_feat_version() fn.
Change-Id: Ideef914ded8dfdb4c780fd27d7273986eeb41f5c
Signed-off-by: Mohammed Khajapasha <mkhaja@codeaurora.org>
Fix the symbol linking error for loadable kernel modules
which is using secure buffer hypervisor api for smmu configuration.
CRs-Fixed: 2019262
Change-Id: I3d83fd4b1854298c1283e03f220de8c673195492
Signed-off-by: Sarada Prasanna Garnayak <sgarna@codeaurora.org>
Ensure variables are set before the are used to prevent random behavior.
Change-Id: Ib31e5aca648c0f442afe4cbe576ad79786fe6427
Signed-off-by: Patrick Daly <pdaly@codeaurora.org>
For hyp_assign calls, dest_vm_and_perm_info wrongly
defines ctx as u32 * type, while TZ expects it as u64.
This creates an inconsistency on 32bit system. Fix it.
Change-Id: I31e8e0b5e9ae240ca031f625cf7c49f1bfe165d4
Signed-off-by: Shiraz Hashim <shashim@codeaurora.org>
hyp_assign_table() is a costly operation during which nonsecure interrupts
are disabled. Split this operation into multiple parts for better
real-time behavior.
Splitting is done by the following criteria:
maximum number of physically contiguous memory regions
maximum total memory size.
Here is a chart showing the average performance of hyp_assign_table() with
N physically contiguous chunks each with size X.
#chunks chunk_size(pages) total_memory(pages) time(ms)
2 1 2 3.354
2 4 8 12.979
2 512 1024 4.349
8 1 8 4.714
8 4 32 26.781
8 512 4096 8.724
32 1 32 17.093
32 4 128 50.700
32 512 16384 26.717
128 1 128 71.076
128 4 512 126.305
Based on the above, select a maximum of 32 chunks or 512 total pages
as the limits.
Change-Id: I530cfdce76c8a2c38f60d6118647eaefd269e693
Signed-off-by: Patrick Daly <pdaly@codeaurora.org>
Allocate objects via kzalloc() when possible. For the case where a large
chunk (512 Kb) of physically contiguous memory is required, continue to use
a special purpose buffer reserved at boot. Since this special purpose
buffer is no longer used for random metadata, the associated code is
simpler to understand.
Change-Id: I85078f351293b556a501e9aca075ef87e2e86afd
Signed-off-by: Patrick Daly <pdaly@codeaurora.org>
Presently we were passing NULL dma_handle while
making dma_alloc_coherent call. This is an issue
as alloc function would try to populate handle
value with dma address and would end up getting
NULL pointer error. Fix this.
Change-Id: I38ebb9bbae2d6e1e1311fe438b3c8fc3f65e5692
Signed-off-by: Susheel Khiani <skhiani@codeaurora.org>
Re-use the same buffer for the hyp assign calls rather than allocating
a new one for every single call.
Change-Id: Ia76f9743c7eb83d3432ac19cc98be243434c2aa8
Signed-off-by: Rohit Vaswani <rvaswani@codeaurora.org>
Buffers shared with hypervisor might undergo some cache maintenance on
the hypervisor side. Currently, we're passing a buffer that might not
be cache-aligned (source_vm_list), so when the hypervisor does some
cache maintenance on it they might be corrupting data. Fix this by
ensuring that all buffers being shared with the hypervisor are
cache-aligned by kmalloc'ing and memcpy'ing the source_vm_list before
sending it across.
Change-Id: I661f8ca852ade159e3432904086b060be8bfb806
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
It can be useful to convert secure VMID values into strings. Provide a
helper function to do so.
Change-Id: If907a0bac92c5d164154c0e5dfe67933115163c8
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
The hyp_assign_phys() api can be called by different
usecases where it is not guaranteed that the source vm is
always VMID_HLOS.
Pass the responsibility of setting the source_vm to
caller of the function.
Change-Id: I3851a6681f49d4bb6fa5b7a889a16a158497e9e6
Signed-off-by: Neeti Desai <neetid@codeaurora.org>
The assign call apis have been updated by TZ to
include more usecases. Update the secure_buffer
api files with the same. The system secure heap
needs to be updated to reflect the change in
the api calls.
Change-Id: Idc784ddac222e6ad9f5defafc422e6e3fb88aa0c
Signed-off-by: Neeti Desai <neetid@codeaurora.org>
Move all function declarations and types to the header
file to make the macros and definitions available even
when the CONFIG_MSM_SECURE_BUFFER is not enabled. Rename
rid of the msm_ion_secure_table and msm_ion_unsecure_table
to something more generic.
Change-Id: Ia5ca0c52f971a67c7936c64b42cd2522aa1773fa
Signed-off-by: Neeti Desai <neetid@codeaurora.org>
The secure_buffer.c files does not have anything specific
to ion. The functions defined here might be needed by other
drivers as well. If the ion driver is disabled that might
not work. So move the file to a new location.
Change-Id: I3498de791c01019b7933feb65d196152887fcf24
Signed-off-by: Neeti Desai <neetid@codeaurora.org>
2016-03-22 11:04:31 -07:00
Renamed from drivers/staging/android/ion/msm/secure_buffer.c (Browse further)