Commit graph

568094 commits

Author SHA1 Message Date
Andrei Danaila
0af9a4590b mhi: core: Flush CPU write buffer before DMA op
CPU write buffer must be flushed before a DMA operation
is signaled to the device.

CRs-Fixed: 812602
Change-Id: I304671fd1a403d6d897b47641910bc112310b674
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
2016-03-23 21:11:23 -07:00
Andrei Danaila
c966ff457f msm: mhi: Enable M2 exit through CLKREQ assertion
Enable M2 power state transition exit through
CLKREQ GPIO assertion due to MHI doorbell write.

CRs-Fixed: 733370
Change-Id: I27b425ee305fc9c044812a8b15c76970987a5dae
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
2016-03-23 21:11:23 -07:00
Andrei Danaila
8d7c29c161 mhi: core: Enabled full NER support
Enable NER support for MHI core. MHI core now enables
only event rings required for used channels. This saves
a substantial amount of system memory.

Change-Id: I3b9d63875cf117fba2ac062f831da1899b355e2c
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
2016-03-23 21:11:22 -07:00
Andrei Danaila
ab4c04bef6 msm: mhi: Enable log level sysfs for MHI UCI
Enable log level sysfs attribute for MHI UCI
to enable different verbosity levels at runtime to the IPC log.

CRs-Fixed: 734010
Change-Id: I866b5bebb08257ac120de565a7b2a83b8e831a1a
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
2016-03-23 21:11:21 -07:00
Andrei Danaila
3e7a8cf8a8 mhi: core: Cleanup unused commands from MHI
Remove dead code from the MHI driver. Currently there is no
usecase for the MHI STOP and NOP commands and this codepath is not
being touched.

Change-Id: I6cd96e28b9f46aca8014bbe4d2f2aa701f40b08b
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
2016-03-23 21:11:20 -07:00
Andrei Danaila
7549998ce7 mhi: uci: Enable enlarged buffers for SAHARA
Enable large buffer sizes for SAHARA to reduce number
of data transfers by a factor of 12.

CRs-Fixed: 800039
Change-Id: Ica59ae4e3eae3b7c64222d36a8bc5033928ae631
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
2016-03-23 21:11:19 -07:00
Andrei Danaila
58e8588c92 msm: mhi: Flush pending writes on D3hot and M2
Flush pending PCIe writes after setting D3 hot and after
setting M2. This will ensure that no writes will bring the link
down as it is being turned off.

CRs-Fixed: 755658
Change-Id: If2ca4575f833ede77d6a14e1e2bf5a86d1c28218
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
2016-03-23 21:11:18 -07:00
Andrei Danaila
24d46af3ae mhi: core: Enable common queue TRE function
Enable queue TRE function for treating both command and transfer
TREs in the same codepath. This simplifies the flow of processing TREs
and facilitates debugging.

Change-Id: I8dc1dec4e0e23b7b36982cc0ace957a1b43aa6da
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
2016-03-23 21:11:17 -07:00
Andrei Danaila
132fb4c7af mhi: uci: Propagate transport readiness to UCI
Currently on UCI open, if the transport is not ready, the open
is succeeded in hopes that the transport becomes ready in the future.

Increase transparency between UCI clients and MHI such that
when the transport is not ready the UCI client is notified
and can react accordingly.

Change-Id: Iacc85e9aa68be9cde152a3fc2bfe9d0c6f6f6b62
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
2016-03-23 21:11:17 -07:00
Andrei Danaila
99ba40a4dc mhi: core: Assert on incorrect device events
Assert when an event is received for a channel which is empty.
This is a fatal transport error.

Change-Id: I0249f97480ebc3ca8d3e98c10e35a0eb040215a4
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
2016-03-23 21:11:16 -07:00
Andrei Danaila
30fc2b0436 Revert "msm: mhi: Stale doorebell in MHI Host"
This reverts commit e38c1ec36984945d60d02002eae5e615d1b9b6aa.

This commit can generate a link down in M2 state where the doorbell
is flushed while the link is down.

Change-Id: If29db648f0c6d2b0bd7a3d3a9b0f31ae5512c4eb
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
2016-03-23 21:11:15 -07:00
Andrei Danaila
9c1b21c4e3 mhi: core: Enable runtime PM
Enable runtime PM in the MHI driver to increase transparency
between kernel and device driver and synchronize runtime PM
actions with system wide power states.

Change-Id: I8b87c2ed7b0be8a4cf9568ac1fb772eebe416dc6
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
2016-03-23 21:11:14 -07:00
Andrei Danaila
c84885de9a mhi: core: Ring out pending doorbells
Ring out pending doorbells in the event of a cancelled M3 transition
attempt.

Change-Id: I83ffe0407618ea26768707fc6341d20947ef3ba2
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
2016-03-23 21:11:13 -07:00
Andrei Danaila
91fd082145 mhi: core: Resolve static analysis issues
Address static analysis issues.

Change-Id: I21e1d05cab2e8899c105ae2bc81d85ec62ec7df7
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
2016-03-23 21:11:12 -07:00
Andrei Danaila
16afef100f mhi: rmnet: Prevent NAPI disable during RX
When the netdev interface is released, NAPI is disabled.
This condition can occur while the device is still sending RX data
causing a potential kernel panic.

Wait for all incoming data to be received, before releasing
the interface.

Change-Id: If33ff721a581fdafb9712fe3cf9243996187f09d
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
2016-03-23 21:11:11 -07:00
Andrei Danaila
b37cf8619e mhi: rmnet: Enable support for overflow events
MHI RmNet will now wait for all packet fragments from MHI before
sending the received packet up the network stack.

Change-Id: I3f0958d029a5763e7e0b1e4ab43f17fd98583a48
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
2016-03-23 21:11:11 -07:00
Andrei Danaila
33483bec6e mhi: core: Enable client notification of overflow
Enable client notification of MHI overflow events.

Change-Id: I83a1c91b13b6c52501d4e639803f7638cf7cb3c1
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
2016-03-23 21:11:10 -07:00
Andrei Danaila
ecc230b434 mhi: core: Reduce interrupt moderation to 1ms
Reduce interrupt moderation for both inbound and outbound
hardware channels to 1ms, for improved latency response to
device acknowledgements.

CRs-Fixed: 782801
Change-Id: Id0717582d88dcfc12a8711f983da59a8f651b6d3
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
2016-03-23 21:11:09 -07:00
Andrei Danaila
04c4790c27 mhi: core: Enable NER support
Enable support for NER as part of the MHI REV E
specification. NER register will now be set to the
maximum number of channels supported by MHI.

Change-Id: Id868c04886af13cd34720c86a55ac64debc4ab31
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
2016-03-23 21:11:08 -07:00
Andrei Danaila
51627d18b3 mhi: core: Fix double increment on event counter
Prevent event counter from getting incremented twice and breaking
the modulo operation.

Change-Id: I472115a3d65a84904482455d00cee9de6d31043b
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
2016-03-23 21:11:07 -07:00
Andrei Danaila
c5af65b962 mhi: core: Enable additional MHI logging
Enable additional MHI logs for monitoring SSR flow.

CRs-Fixed: 773805
Change-Id: I579c083ad9ec0238ab3a6d51fec25b4ce5ccf62a
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
2016-03-23 21:11:06 -07:00
Andrei Danaila
85f8377784 mhi: rmnet: Resolve race condition during SSR
Resolve a race condition whereby a buffer could be freed
by the SSR handler while being operated upon by the transfer
callback.

Change-Id: I5e62b04166b2a8a9867047574c7232739229c911
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
2016-03-23 21:11:05 -07:00
Andrei Danaila
2834b84077 mhi: core: Remove useless atomic variables
Remove unused atomic variables in MHI.

CRs-Fixed: 734059
Change-Id: I052a9662c52ef88df0a5b8bcf37be1187a6b942e
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
2016-03-23 21:11:05 -07:00
Andrei Danaila
b4fae77237 mhi: uci: Fix race conditon in mhi_poll_inbound
A race condition exists in MHI_UCI whereby a client could receive
a buffer, inconsistent with the return code from MHI.

Change-Id: I4a932ea608ce967c1588f092c60d03747bad2064
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
2016-03-23 21:11:04 -07:00
Andrei Danaila
fd631cba6d mhi: core: Enable ftrace events in MHI
Enable ftrace events in MHI for the tracing of power
state transitions.

Change-Id: I74373b7429c6d7316c4a66db141cc09e2a4418dd
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
2016-03-23 21:11:03 -07:00
Andrei Danaila
05c228020f msm: mhi: Fix incorrect init of TRE iterator
The pending TRE iterator is not properly initialized
and checked against, leading to an incorrect number of
TREs getting processed.

CRs-Fixed: 748475
Change-Id: Ie8609edd1a89d8dc14bf781612357d7dc524f83a
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
2016-03-23 21:11:02 -07:00
Andrei Danaila
95f1be7792 mhi: rmnet: Enabled sanity check for LPM IOCTL
Enabled sanity check for LPM IOCTL in MHI. IOCTL should not
be called into MHI, if the device is not ready.

CRs-Fixed: 749894
Change-Id: I52627a94e70e3b17130653b7b73a86b417807842
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
2016-03-23 21:11:01 -07:00
Andrei Danaila
a71b10255d msm: mhi: Reorder operations on MHI TRE
Reorder operations on MHI TRE to prevent a race condition
of publishing the TRE to the device before the TRE is fully
populated.

CRs-Fixed: 726655
Change-Id: Ide208c77c93f0e68eee0c6c304eaebc451028341
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
2016-03-23 21:11:00 -07:00
Andrei Danaila
88473406f6 msm: mhi: Ensure db value is sampled in spinlock
The doorbell value for the event ring must be sampled within
spinlock context or the value could be stale when written.

CRs-Fixed: 746401
Change-Id: I4eb5095f34b890e02fee48c22206afcbfd70a454
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
2016-03-23 21:10:59 -07:00
Andrei Danaila
10f5acc38a msm: mhi: Stale doorebell in MHI Host
A timing window exists where M3 state transition is pending and
the doorbell does not get written out. The M3 process is then
cancelled, and no M0 event takes place to flush the doorbell out.

Remove setting the pending M3 flag until the transition is no
longer cancelable.

CRs-Fixed: 733632
Change-Id: I3b4dfe23d0ea4af69d2810a171c61dc60a6c2f8d
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
2016-03-23 21:10:59 -07:00
Andrei Danaila
1c092cebee msm: mhi: Enabled event ring context updates
Enabled event ring context updates regardless of MHI
power state.

Change-Id: I910d056d53f7c940caea48546c206d4603e8a4b9
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
2016-03-23 21:10:58 -07:00
Andrei Danaila
43558e8dff msm: mhi: Enable clearing outstanding acks in MHI
After a channel reset, any pending acks on that channel
will not be received from the device.
In this case they must be cleared in the channel reset
command handling.

CRs-Fixed: 733172
Change-Id: I5b7c525f7f532ed107caa020cde33ec1955ae618
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
2016-03-23 21:10:57 -07:00
Andrei Danaila
dd8cffb896 msm: mhi: Resolve deadlock in iface down
Resolve issue whereby a deadblock is encountered when trying
to put the interface down.

Change-Id: I757492fceff56014b28ec50307f6d84b1bb81889
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
2016-03-23 21:10:56 -07:00
Andrei Danaila
7cabb2be25 msm: mhi: Prevent IRQ mask race condition in MHI
Fixed a race condition in MHI RmNet where the RX interrupt
could remain masked forever.

CRs-Fixed: 723355
Change-Id: I9606963b8b2d6d1cb125c0bc7be8610b06f67be3
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
2016-03-23 21:10:55 -07:00
Andrei Danaila
c17dca1d42 msm: mhi: Fixed race condition in rmnet
Fix race condition in MHI RmNet whereby the outbound
MHI ring could be empty while the network stack believes
it is full. This leads to a non recoverable data stall.

Add rwlock to ensure checks for full and empty conditions
are atomic.

CRs-Fixed: 733646
Change-Id: If54baa4be762a976d64213d0ec52e969f2497036
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
2016-03-23 21:10:54 -07:00
Andrei Danaila
24d7f8a8d6 msm: mhi: Reset the pending packets counter in UCI
Reset the pending packets counter in UCI when a client releases
the character device node.

Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
Change-Id: Ic3d83873ae207e76acbb9f60683b43cb30ff7c5b
2016-03-23 21:10:54 -07:00
Andrei Danaila
9de41649cc msm: mhi: Fix issues regarding BHI img load
Resolve issue regarding BHI image load process.
Interface will no longer be published to userspace
before local initialization is complete.
Register masks and retry mechanism are also cleaned up.

Change-Id: I05d87d4be5e9c05c6beb2b7b0c0234757b93097d
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
2016-03-23 21:10:53 -07:00
Andrei Danaila
a7cbc2b96f msm: mhi: Enable MHI support for msmzirc
Add the msmzirc device in the list of supported PCI devices
by the MHI driver to enable to PCIe framework to probe MHI
in the event of discovering this device on the bus.

CRs-Fixed: 736039
Change-Id: I66eb5f67885d60c579c33c47ce696d66c6c428b5
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
2016-03-23 21:10:52 -07:00
Andrei Danaila
0e9efcc15b msm: mhi: Remove incorrect iomem operations
Remove the incorrect direct de-reference of device mapped
IO mememory and replace with kernel standard handlers.

CRs-Fixed: 728285
Change-Id: I0b3afe8a62369057b4a6b45b1a71bd9f5a52ce1d
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
2016-03-23 21:10:51 -07:00
Andrei Danaila
6f0be3c7a1 msm: mhi: Add MHI core driver
Enable the MHI core driver for communication
between host and device using PCIe as an interconnect
and supporting MHI as the communication protocol.

The driver exposes several kernel space APIs
for use by other kernel entities to interface to
the PCIe device over MHI.

APIs for read and write and other notifications
are supported by this MHI driver.

Support for full power management and device reset
is also included.

CRs-Fixed: 689329
Change-Id: Ibc2fd7c2d5689001485f71b1133ada2c4ca236a9
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
2016-03-23 21:10:50 -07:00
Andrei Danaila
fb5e040069 msm: mhi: Add MHI RmNet driver
Add MHI RmNet driver to support exposure of an
MHI device as a network interface to the Linux
networking stack.

The MHI channels are exposed as a standard network
interface which supports the NAPI framework.

IOCTLs for setting MTU/MRU and LPM are also enabled.

CRs-Fixed: 689329
Change-Id: I9540c78acccec35aff4ee4dc36241c6f08cdf04c
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
2016-03-23 21:10:49 -07:00
Andrei Danaila
c9a0e074ed msm: mhi: MHI Usperspace Control Interface driver
The MHI UCI driver exposes MHI core functionality to
userspace by means of device nodes.

The UCI driver exposes a device node for a pair of unidirectional
MHI channels.

The supported system calls on the device nodes are read, write,
select/poll and RS232 IOCTLs.

CRs-Fixed: 689329
Change-Id: Iceab97dba7c3bbb4eb7bf0c4ab0c1eac8c5417e9
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
2016-03-23 21:10:48 -07:00
Joonwoo Park
646bf5125d timer: make deferrable cpu unbound timers really not bound to a cpu
When a deferrable work (INIT_DEFERRABLE_WORK, etc.) is queued via
queue_delayed_work() it's probably intended to run the work item on any
CPU that isn't idle. However, we queue the work to run at a later time
by starting a deferrable timer that binds to whatever CPU the work is
queued on which is same with queue_delayed_work_on(smp_processor_id())
effectively.

As a result WORK_CPU_UNBOUND work items aren't really cpu unbound now.
In fact this is perfectly fine with UP kernel and also won't affect much a
system without dyntick with SMP kernel too as every cpus run timers
periodically.  But on SMP systems with dyntick current implementation leads
deferrable timers not very scalable because the timer's base which has
queued the deferrable timer won't wake up till next non-deferrable timer
expires even though there are possible other non idle cpus are running
which are able to run expired deferrable timers.

The deferrable work is a good example of the current implementation's
victim like below.

INIT_DEFERRABLE_WORK(&dwork, fn);
CPU 0                                 CPU 1
queue_delayed_work(wq, &dwork, HZ);
    queue_delayed_work_on(WORK_CPU_UNBOUND);
        ...
	__mod_timer() -> queues timer to the
			 current cpu's timer
			 base.
	...
tick_nohz_idle_enter() -> cpu enters idle.
A second later
cpu 0 is now in idle.                 cpu 1 exits idle or wasn't in idle so
                                      now it's in active but won't
cpu 0 won't wake up till next         handle cpu unbound deferrable timer
non-deferrable timer expires.         as it's in cpu 0's timer base.

To make all cpu unbound deferrable timers are scalable, introduce a common
timer base which is only for cpu unbound deferrable timers to make those
are indeed cpu unbound so that can be scheduled by tick_do_timer_cpu.
This common timer fixes scalability issue of delayed work and all other cpu
unbound deferrable timer using implementations.

Change-Id: I8b6c57d8b6445a76fa02a8cb598a8ef22aef7200
CC: Thomas Gleixner <tglx@linutronix.de>
CC: John Stultz <john.stultz@linaro.org>
CC: Tejun Heo <tj@kernel.org>
[joonwoop@codeaurora.org: timer->base replaced with CPU index so get
 the deferrable timer wheel from lock_timer_base() instead of
 do_init_timer().]
Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>
2016-03-23 21:10:48 -07:00
Trilok Soni
8b72bf241c defconfig: 8996: Enable Android recommended configurations
Enable Android recommended configurations for 8996 and msmcortex.

Signed-off-by: Trilok Soni <tsoni@codeaurora.org>
2016-03-23 21:10:47 -07:00
Trilok Soni
89fd208cc4 defconfig: 8996: Enable ADSP Loader and disable memlat
ADSP Loader is required for the audio probes and memlat governor
is crashing right now so we should keep it disabled for now.

Signed-off-by: Trilok Soni <tsoni@codeaurora.org>
2016-03-23 21:10:46 -07:00
Satya Durga Srinivasu Prabhala
8826ec9a9c arm64: defconfig: enable core control driver
Enable core control driver for different MSMs.

Signed-off-by: Satya Durga Srinivasu Prabhala <satyap@codeaurora.org>
2016-03-23 21:10:45 -07:00
Junjie Wu
f4c9a4a1f9 qcom: core_ctl_helper: Add wrapper for CPU hotplug
Different kernel version needs to use different kernel APIs for
hotplug. Add wrapper for CPU hotplug so that external module can be
used across different kernel releases.

Use device_online/offline() API for CPU hotplug.

Change-Id: Id21855f4ddc62bc9e9e6b45a856c245fd18d1514
Signed-off-by: Junjie Wu <junjiew@codeaurora.org>
2016-03-23 21:10:44 -07:00
Bryan Huntsman
bcbb9ead97 qcom: core_ctl: Add support functions for core control
Add support functions for core control driver. Also introduce
Kconfig for enabling core control.

Change-Id: Ic127b6ed7d9450338883b13d9c42abfe49ff8b35
Signed-off-by: Bryan Huntsman <bryanh@codeaurora.org>
[satyap: trivial merge conflict resolution]
Signed-off-by: Satya Durga Srinivasu Prabhala <satyap@codeaurora.org>
2016-03-23 21:10:43 -07:00
Satya Durga Srinivasu Prabhala
3165bb66bf uapi: export IPA & Media headers
IPA & Media headers need to go to userspace.

Signed-off-by: Satya Durga Srinivasu Prabhala <satyap@codeaurora.org>
2016-03-23 21:10:42 -07:00
Stephen Boyd
8570db60c0 Export android_pmem.h to keep userspace compiling
Some applications still include android_pmem.h although all the
functionality for it is gone from the kernel. Keep this header
file around until all such users have removed the include.

Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Abhimanyu Kapur <abhimany@codeaurora.org>
[satyap: trivial merge conflict resolution]
Signed-off-by: Satya Durga Srinivasu Prabhala <satyap@codeaurora.org>
2016-03-23 21:10:42 -07:00