When a user space client application crashes without
disabling clk vote, there is a possibiltity of crypto
HW being left at its high bandwidth mode. This results
in power drain.
This patch ties the performance request to the client
handle. When any client handle is released (done when
the client handle is closed explicitly or when a client
application crashes), appropriate calls are invoked to
disable clk voting as part of closing the handle
Change-Id: I7f801d642ec53e3e5bf18a5d3a6076f973bb5175
Signed-off-by: Mona Hossain <mhossain@codeaurora.org>
Existing driver allocated BAM descriptor at fixed sizes each
with interrupt flag set. Notification on data was received when
the descriptor is fully consumed by the HW. The descriptor size
on one hand need to be big enough so that we don't receive too much
interrupts for high-bitrate streams, and on other hand needs
to be small enough so that for low-bitrate stream we are not starved
waiting for data for a long period of time.
The change adds support of allocating small descriptors and set
interrupt flags on part of descriptors. In addition, expiration
timer is used so that if interrupt is not received after long period
of time the timer handler reports back descriptors are already ready
to be consumed. This allows low-rate of interrupts and
handling of low-bitrate streams.
As descriptors are smaller now (size of single TS packet), exposed
API within SW demux that handles a single packet to save the function
call to the API that handles multiple packets for efficiency. Information
regarding the new buffer allocation was added to debugfs.
CRs-Fixed: 420818
Change-Id: I4bb05177774ab0e0bad0737ca1106a0c33f843ae
Signed-off-by: Hamad Kadmany <hkadmany@codeaurora.org>
In qseecom_start_app(), when __check_if_app_exist() returns an
error status, the function is exited with a -EINVAL error.
This result in not de-allocating memory that was allocated for
the handle prior to calling __check_if_app_exists()
Memory that was allocted for the handle, needs to be de-allocated
before exiting with an error status when __check_if_app_exists()
return a failure.
The fix is to re-order the memory allocation of the handle after
__check_if_app_exists() goes through successfully.
Change-Id: I9dde552deb2296ab719ee815314c9da161a5d1da
Signed-off-by: Mona Hossain <mhossain@codeaurora.org>
Enable TSIF status interrupt to expose the following
information in debugfs:
- stat_rx_chunks: Counts number of TS packets chunks received from HW.
- stat_overflow: Counts number of times buffer has overflowed.
- stat_lost_sync: Counts number of times TSIF lost sync with input.
- stat_timeout: Counts number of times TSIF reached timeout
waiting for packets.
All counters can read and reset by writing to the respective file.
Change-Id: I475c2c0845c85ac22ea720059fb28c4a588fedcf
Signed-off-by: Hamad Kadmany <hkadmany@codeaurora.org>
There is a chance of send a request to QSEE to load an app that
is already previously loaded. Requesting QSEE to load an app
that is already loaded will result in a failure.
Issuing a request to QSEE to check if app already exists before
issuing a request to load it, all within the same app_access_lock
mutex, fixes this issue.
CRs-Fixed: 420473
Change-Id: Ie839db89a10644d4f1d84ffa3a87cea8da16e796
Signed-off-by: Mona Hossain <mhossain@codeaurora.org>
QSEE verion 2 supports relocatable images. To support this
a chunk of contiguous memory in the first 256MB bank is
reserved for loading the secure applications. The location
and size of this memory region is defined in the device tree
data of the driver.
This patch
- Adds supports for retrieving the address and size of the
memory region reserved for the secure app from the device
tree data
- Adds a new command to issue to QSEE for notifying this
app region information (retrieved from device tree)
Change-Id: I0310815bf42c3705e0f15bd69bd4b02c6f4c56b0
Signed-off-by: Mona Hossain <mhossain@codeaurora.org>
TI's DRV2667 controller is used for driving haptics.
It can operate in two modes - analog and digital. The
first version of the driver supports only digital mode.
Change-Id: I448d8b34d4ad1b2500e5a4d0973cfc5b22515d5a
Signed-off-by: Mohan Pallaka <mpallaka@codeaurora.org>
Get the scatter gather entries for non contiguous Ion
allocated memory and populate the list within the command
message with the physical address of each chunks.
Change-Id: I0e8d930525f50b6aac38b0bd3e7debec9024d1f0
Signed-off-by: Mona Hossain <mhossain@codeaurora.org>
Add API to allow kernel space clients to bump up
CE clks for improved performance
Change-Id: Iff4d16f3ae840a68fa0d064ce463b50a869669be
Signed-off-by: Mona Hossain <mhossain@codeaurora.org>
Loading of app is stuck waiting for lock on app_access_lock
being released. This mutex is already locked prior to invoking
load_fw.
Removing the mutex lock (already called before invoking load_fw),
in load_fw, fixes the issue with the loading getting stuck.
Change-Id: Ib43a7f5a01b5246b1f1b180380f14fb70a4c92ff
Signed-off-by: Mona Hossain <mhossain@codeaurora.org>
Add support for setting the Crypto HW to operate in
high bandwidth mode before issuing a request to load
image.
This is needed for better performance when using crypto
HW to authenticate the image before loading it.
Change-Id: I42d40554ad2d64551db222ea7255bc904b9af256
Signed-off-by: Mona Hossain <mhossain@codeaurora.org>
The CE clock was initialized to run at max of 100 MHz. This
was done during the probe call. Running the CE clk at 100 MHz
always, is causing a power regression.
Fix is to enable the clk and set it to run at the nominal level
of 50 MHz. Further more, add clk gating to ensure CE clks are only
bumped up to the max of 100 MHz when client request for high bandwidth.
CRs-Fixed: 416759
Change-Id: I311f6b29e9129a04c3ec7e2a8f893fa08a518bbd
Signed-off-by: Mona Hossain <mhossain@codeaurora.org>
Load the common library image on secure domain during
initialization of the driver.
All secure app loaded on the secure domain (TZ) is currently
refactored to not include all secure libraries. The libraries
are now a part of separate image. This is used by all secure app.
This common lib image needs to be loaded before any secure app
can be loaded.
This patch adds support for handling this new change based off
the QSEE version running on secure domain. The change is to
load the common library image before loading any secure app.
Change-Id: I1c7692b612ea4c7bddbca1af07ddf32a073d70a8
Signed-off-by: Mona Hossain <mhossain@codeaurora.org>
The TSPP driver can allocate its output buffers internally or
externally. External buffer allocation is required when Demux wishes
to use the ION driver to allocate a physically contiguous buffer
(e.g. to pass to TZ).
This commit improves the TSPP driver support for external buffer
allocation and implements the external memory allocation and free
functions in the Demux driver.
Change-Id: I71da4f18c090ef224c4fc7b23f55b9b3636be996
Signed-off-by: Liron Kuch <lkuch@codeaurora.org>
Do a tree wide sed to replace pil_get and pil_put() with their
subsystem counterpart. With all the pil drivers migrated over to
the new subsystem start/stop API this is essentially a no-op.
We rename "q6" to "adsp" to be more in line with how future
chipsets name the low power audio subsystem. This requires minor
changes to userspace; hopefully no more changes will be
necessary.
Change-Id: I22dbbdcf7f5aaaa80394a6d70b5cfc24cdb32044
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Add support for kernel space client:
- add support for starting secure app by kernel client
- add support for shutting down secure app by kernel client
- add support for sending command to secure app loaded by
kernel space client(s)
The above is needed for allowing kernel modules to communicate
with app running in secure domain.
Change-Id: I3ae3a7648714eb7d7f4801b2f8e7cd94b5c64bdf
Signed-off-by: Mona Hossain <mhossain@codeaurora.org>
Signed-off-by: Hariprasad Dhalinarasimha <hnamgund@codeaurora.org>
Signed-off-by: Mona Hossain <mhossain@codeaurora.org>
Support communication with an external CI bridge over
SPI interface using GSBI.
A simple SPI slave driver is implemented along with the
required platform changes (clocks, GPIOs).
Change-Id: I5577b2ac4689b9efcd0f606eba6280beda297f4f
Signed-off-by: Bar Weiner <bweiner@codeaurora.org>
TSIF signals (clock, data, enable and sync) may be configured
to be inversed at TSPP unit input. This is useful in case
TSIF signals from external units need to be inversed.
Change-Id: Idd21948baccedc7499b31ed1d4df0f737538c870
Signed-off-by: Hamad Kadmany <hkadmany@codeaurora.org>
TSIF signals (clock, data, enable and sync) may be configured
to be inversed at TSIF unit input. This is useful in case
TSIF signals from external units need to be inversed.
Change-Id: I21a5c8eca73df0f4458c0d035ef8ae90920ea0c5
Signed-off-by: Hamad Kadmany <hkadmany@codeaurora.org>
All interactions with secure applications on TZ by non-secure
apps on HLOS need the crypto clocks on.
Without this, simple operations as loading secure apps in
Trust zone fail.
Change-Id: I37097cb401508f7582de014e502f3709170ca6b2
Signed-off-by: Ramesh Masavarapu <rameshm@codeaurora.org>
In the current functionality, if DFAB clock is already on and a
request is made to turn on SFPB clock, the DFAB clock is turned
off and SFPB clock is turned on and vice-versa.
The above situation can lead to unexpected errors. The current fix
makes sure that clocks that are on are not voted to be off without
explicit request.
Change-Id: I6c3230e23b105c049cdb0aace579b8a176328c84
Signed-off-by: Ramesh Masavarapu <rameshm@codeaurora.org>
Currently the qseecom driver calls qsee_disable_clock_vote() in
the release function. This reduces the reference count during
disabling of the clock and results in turning off the bus clocks
inconsistently.
This change fixes the inconsistency.
Change-Id: I33aa90744a65a3e1a9aba0c368de99ef61a35073
Signed-off-by: Ramesh Masavarapu <rameshm@codeaurora.org>
Buffer flags are going to be specified at allocation time rather than
map time. This removes the flags argument from the ion kernel map
function.
Change-Id: I91589ca7b1ab142bb5ac8e6b0f4c06fa1305f23a
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
Currently, bus scaling topology for qseecom is incorrect.
-Added the correct topology paths for accessing Crypto
Engine which is controlled by QSEE.
-Removed setting the clock frequency of DFAB. This is
done by the bus driver.
-Removed references to the dfab clock instance defined
in clocks file.
Change-Id: Ib6953ea3bf5721d458bfe2aa06c54be329a8fdb9
Signed-off-by: Ramesh Masavarapu <rameshm@codeaurora.org>
qseecom_release() returns a failure, if it is unable to find
app_id of zero, associated with the handle in the app list.
There exists scenarios where the handle may not have the
app_id initialized and remain to be 0. In these scenarios,
once the uninitialized zero app_id is not found in the list,
it returns a failure.
Fix to this is look for non-zero valid app_id in the app_list when
releasing the handle.
Change-Id: If0bf918a6397d8d5f925abde895b096dab76a9bb
Signed-off-by: Mona Hossain <mhossain@codeaurora.org>
All msm_ion clients need to use <linux/msm_ion.h> instead of
<linux/ion.h>
Change-Id: If78e8a3aa66209b93449569cc9bd670b8d21008c
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
During tsif stress tests it was reported that the dma flush caused by
calling action_close() is sometimes unrecoverable. The root cause is
stopping the tsif while a read by the dma of the tsif FIFO is in
progress. The previous workaround relied on closing the tsif GPIOs
to stop incoming data to the tsif, then add a delay to allow the
dma to complete all outstanding transactions. A customer still reported
seeing the dma issue. The reason the issue was still happening is due to
the call of gpio API (request/free) which was done on pins not configured
to act as GPIOs. Doing so caused tsif interface not to be closed properly.
Per gpio-mux documentation, pins with function configured as non-gpio
may suffer from un-expected behavior when calling gpio API, these calls
were removed. The delay after closing tsif interface was enlarged to better
cope with low bitrate streams.
Change-Id: I67828c9ad946072a2a925a1d55f35c730a52170c
Signed-off-by: Hamad Kadmany <hkadmany@codeaurora.org>
The demux is an in-kernel software component whose purpose is to take
an incoming TSIF stream and split it into multiple output channels
based on the PID field in each TS packet. Each output channel can be
used for a different purpose, such as audio, video or channel
information. In order to get good performance when moving such large
data streams around, the demux was placed in kernel-space as to
prevent copying memory buffers between kernel-space and user-space, at
least at this early stage in processing the traffic. Originally the
design of the TSPP driver was based on the earlier TSIF driver, so it
contained only a user-space API.
Change-Id: I22799eb19d9049e3635d5c589b02f999d9b8e1c7
Signed-off-by: Joel Nider <jnider@codeaurora.org>
When qseecom_unload_app() is invoked, wait_event_freezable() is called
in an atomic context (within a spinlock). wait_event_freezable() allows
sleep and should not be called in an atomic context where sleep is not
allowed.
Change-Id: I8c9c6d28f9e492fbbf2ac74a5ee3d1067c7733ad
Signed-off-by: Mona Hossain <mhossain@codeaurora.org>
Replace the clk_enable() with clk_prepare_enable() and replace
clk_disable() with clk_disable_unprepare() functions.
Add a new tasklet so the clocks can be turned off and
unprepared from the irq context in the case of emergency.
Change-Id: Ic63c6c25600069938b414974c5e1237943ffe2e7
Signed-off-by: Joel Nider <jnider@codeaurora.org>
When multiple clients request qseecom to load an application, an app
id is assigned. If the request is to load an app that already exists
in qsee, the app id should return to the qseecom library.
Returning the app id was done in the qseecom_load_app() but not done
in the qseecom_query_app_loaded(). This change fixes the issue when
multiple clients request to load the same app in qsee.
Change-Id: Icaa5053906b61ace1d257ff1c96308cc89e3a9cc
Signed-off-by: Ramesh Masavarapu <rameshm@codeaurora.org>
Replace the clk_enable() with clk_prepare_enable() and replace
clk_disable() with clk_disable_unprepare() functions.
Change-Id: I63479090eccbeac46f091bf95faeb857139d23a4
Signed-off-by: Joel Nider <jnider@codeaurora.org>
Pull in Ion patches for 3.4 upgrade. Inclues the following
patches from google:
commit 7191e9ba25
Author: Rebecca Schultz Zavin <rebecca@android.com>
Date: Mon Jan 30 14:18:08 2012 -0800
ion: Switch map/unmap dma api to sg_tables
Switch these api's from scatterlists to sg_tables
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
commit 6f9e56945d
Author: Rebecca Schultz Zavin <rebecca@android.com>
Date: Tue Jan 31 09:40:30 2012 -0800
ion: Add reserve function to ion
Rather than requiring each platform call memblock_remove or reserve
from the board file, add this to ion
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
commit 9ae7e01de1
Author: KyongHo Cho <pullip.cho@samsung.com>
Date: Wed Sep 7 11:27:07 2011 +0900
gpu: ion: several bugfixes and enhancements of ION
1. Verifying if the size of memory allocation in ion_alloc() is aligned
by PAGE_SIZE at least. If it is not, this change makes the size to be
aligned by PAGE_SIZE.
2. Unmaps all mappings to the kernel and DMA address spaces when
destroying ion_buffer in ion_buffer_destroy(). This prevents leaks in
those virtual address spaces.
3. Makes the return value of ion_alloc() to be explicit Linux error code
when it fails to allocate a buffer.
4. Makes ion_alloc() implementation simpler. Removes 'goto' statement and
relavant call to ion_buffer_put().
5. Checks if the task is valid before calling put_task_struct() due
to failure on creating a ion client in ion_client_create().
6. Returns error when buffer allocation requested by userspace is failed.
Signed-off-by: KyongHo Cho <pullip.cho@samsung.com>
commit 043a61468f
Author: Rebecca Schultz Zavin <rebecca@android.com>
Date: Wed Feb 1 11:09:46 2012 -0800
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.
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
commit 0d1259b5f8
Author: Rebecca Schultz Zavin <rebecca@android.com>
Date: Mon Apr 30 16:45:38 2012 -0700
gpu: ion: Use alloc_pages instead of vmalloc from the system heap
With this change the ion_system_heap will only use kernel address
space when the memory is mapped into the kernel (rare case).
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
commit be4a1ee79a
Author: Rebecca Schultz Zavin <rebecca@android.com>
Date: Thu Apr 26 20:44:10 2012 -0700
gpu: ion: support begin/end and kmap/kunmap dma_buf ops
These ops were added in the 3.4 kernel. This patch adds support
for them to ion. Previous ion_map/unmap_kernel api is also
retained in addition to this new api.
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
commit 46d71337f9
Author: Rebecca Schultz Zavin <rebecca@android.com>
Date: Mon May 7 16:06:32 2012 -0700
gpu: ion: Allocate the sg_table at creation time rather than dynamically
Rather than calling map_dma on the allocations dynamically, this patch
switches to creating the sg_table at the time the buffer is created.
This is necessary because in future updates the sg_table will be used
for cache maintenance.
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
commit 903f6c716d
Author: Rebecca Schultz Zavin <rebecca@android.com>
Date: Wed May 23 12:55:55 2012 -0700
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.
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
The commit also includes fixups needed for MSM specific code.
Change-Id: Idbcfa9d6af0febf06f56daaa6beaa59cc08e4351
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
Currently, qseecom user-space library does not have a way to
verify if a particular secure application is loaded in the
qsee or not. This new ioctl solves this issue.
Change-Id: Ia96459f3b8aadee2f6a3af564bb1cc83695759b5
Signed-off-by: Ramesh Masavarapu <rameshm@codeaurora.org>
Currently, if a client tries to load a secure app
in QSEE and another client tries to send a message to
another secure app, it results in a crash. Instead
of using 2 different mutex's - one for sending
messages and another for rest of the operations, now
only one mutex is used for all operations.
Change-Id: I8e1ad9ddf84cca602c6159a6f50b1abaff427b7c
Signed-off-by: Ramesh Masavarapu <rameshm@codeaurora.org>
During tsif stress tests it was reported that the dma flush caused by
calling action_close() is sometimes unrecoverable. The root cause is
stopping the tsif while a read by the dma of the tsif FIFO is in
progress. This workaround works by starving the tsif FIFO allowing
any in-flight transfers to complete, and thus ensuring a clean shutdown.
CRs-Fixed: 357934
CRs-Fixed: 358384
Change-Id: I766f53abe4a6a6a5905caa55c2e7fa0afba5cff4
Signed-off-by: Joel Nider <jnider@codeaurora.org>
Remove tzcom driver components that includes files,
clock definitions. Currently tzcom driver has been replaced
by qseecom driver.
Change-Id: I1832d921a7b949057b84a7e0aa9afaa445be5194
Signed-off-by: Ramesh Masavarapu <rameshm@codeaurora.org>