Commit graph

32 commits

Author SHA1 Message Date
Dhoat Harpal
cd5bd5f58a soc: qcom: glink: Change cleanup sequence in remote close
In function glink_core_remote_close_common, notify_state callback
is called before clearing wait queue. This leads to deadlock if client
want to synchronize tx and state notify function.

Complete_all is called before notify client about state change,
so that all pending requests from client will be cleared.

CRs-Fixed: 1107652
Change-Id: Ia6c4a305eb42c014a928bad36491e6e5f6eac9d5
Signed-off-by: Dhoat Harpal <hdhoat@codeaurora.org>
2017-01-05 14:48:19 +05:30
Linux Build Service Account
421c7867d1 Merge "soc: qcom: glink: Add pending remote done packets to intent purge" 2016-12-19 00:44:42 -08:00
Chris Lew
fbc3530d4f soc: qcom: glink: Add pending remote done packets to intent purge
Glink clients are not notified of tx transactions that are waiting
for remote rx done commands during SSR. This change adds a
notify_tx_abort call for any pending packets during intent purge.

Change-Id: I6a6ba17e2dffddc5cdc2de00da737fedf03c9476
Signed-off-by: Chris Lew <clew@codeaurora.org>
2016-11-30 18:03:18 -08:00
Dhoat Harpal
6bf0e69ea6 soc: qcom: glink: add NULL check for edge_ctx
In function edge_name_to_ctx_create, NULL check is missing after
kzalloc for edge_ctx variable.

NULL check validation is added.

CRs-Fixed: 1086686
Change-Id: Icbffbd9d02df97bda531353c41a7025b95a53991
Signed-off-by: Dhoat Harpal <hdhoat@codeaurora.org>
2016-11-28 18:12:44 +05:30
Dhoat Harpal
6998b685f2 soc: qcom: glink: Fix incorrect call to deinit function
In function glink_core_register_transport, deinit function for qos
configuration is called before initializing qos configuration.

Call to glink_core_deinit_xprt_qos_cfg function is removed.

CRs-Fixed: 1088375
Change-Id: Ifffab071efed56541e763e4f6f51aa45d7a6678b
Signed-off-by: Dhoat Harpal <hdhoat@codeaurora.org>
2016-11-10 20:24:36 +05:30
Linux Build Service Account
b2799f1e25 Merge "soc: qcom: glink: Fix ctx initialization with magic number" 2016-10-14 03:40:30 -07:00
Linux Build Service Account
cade0ea953 Merge "soc: qcom: glink: Fix uninitialzed return value" 2016-10-13 19:11:23 -07:00
Dhoat Harpal
28494e0862 soc: qcom: glink: Fix ctx initialization with magic number
Glink channel context is initialized with magic number after sending
open command to remote side.

Initialization is fixed and happen before sending open command.

CRs-Fixed: 1075481
Change-Id: Ia6b28a3b35a4093aea7af1cffea2a5e093d33ccd
Signed-off-by: Dhoat Harpal <hdhoat@codeaurora.org>
2016-10-07 16:52:56 +05:30
Dhoat Harpal
3cc9716866 soc: qcom: glink: Fix uninitialzed return value.
Initialize the return value in the glink tx scheduler
function.

CRs-Fixed: 1067981
Change-Id: I3f78196927501f582c36d5815096581185d797b4
Signed-off-by: Dhoat Harpal <hdhoat@codeaurora.org>
2016-09-23 18:29:06 +05:30
Chris Lew
1941719e78 soc: qcom: glink: Fix uninitialzed return value
Initialize the return value in the glink tx scheduler
function.

CRs-Fixed: 1067981
Change-Id: I7cad7a724666f34bce73d40e4975373604fb1e87
Signed-off-by: Chris Lew <clew@codeaurora.org>
2016-09-22 16:54:38 -07:00
Dhoat Harpal
9026b491f3 soc: qcom: glink: Fix list corruption for tx_info
Inside glink_scheduler_tx tx_info is not validated after tx operation
and taking spin lock, since there are two functions which can release
the reference for tx_info while glink_scheduler_tx thread is preempted.
These functions are ch_purge_intent_lists and
ch_remove_tx_pending_remote_done.

Validate tx_info from tx_active list after tx operation and taking
spin lock.

CRs-Fixed: 1061565
Change-Id: I80c64d66625b9fe9205e8ffaa7cfc851e06fcb94
Signed-off-by: Dhoat Harpal <hdhoat@codeaurora.org>
2016-09-14 17:02:45 +05:30
Linux Build Service Account
08223d34ed Merge "soc: qcom: glink: Reduce code under spinlock" 2016-09-09 11:53:08 -07:00
Linux Build Service Account
d95f7bea18 Merge "soc: qcom: glink: Validate ctx before using" 2016-09-02 13:52:25 -07:00
Dhoat Harpal
4f6f2d2a7b soc: qcom: glink: Reduce code under spinlock
Glink core channel cleanup has a lot of code under spinlock with
preemption disabled this leads to deadlock scenerio.

Spinklock is used only for critical section, rest of the code is
be without spinlock.

CRs-Fixed: 1060407
Change-Id: I577dbff1cf2ee3711e1879aaa6dc48c72f98b98c
Signed-off-by: Dhoat Harpal <hdhoat@codeaurora.org>
2016-09-02 18:01:10 +05:30
Dhoat Harpal
6111a89212 soc: qcom: glink: Validate ctx before using
Glink does not validate the received handle from client apis.
This leads to possibility of illegal memeory access.

Magic number is added along with rcu lock to validate handle
received from client.

CRs-Fixed: 1047743
Change-Id: I08c854d5885672cbe5410efe0736640b55de8bbb
Signed-off-by: Dhoat Harpal <hdhoat@codeaurora.org>
2016-08-24 18:29:47 +05:30
Dhoat Harpal
4669c62339 soc: qcom: glink: Best Fit approach to find intent
Using first fit algorithm to select the remote rx intent from the
list is not optimal way.

Optimize the selection of intent from list using the best fit algorithm.

CRs-Fixed: 1058750
Change-Id: I7b2a70188975b75a0fbcd2a6cb26f28cc0258532
Signed-off-by: Dhoat Harpal <hdhoat@codeaurora.org>
2016-08-24 17:47:16 +05:30
Karthikeyan Ramasubramanian
43c0652c76 soc: qcom: glink_spi_xprt: Add support for GLink SPI Transport
GLink SPI Transport enables point-to-point communication with an
external subsystem that uses SPI bus to interface. This enables
multiplexing multiple logical channels over the SPI bus.

CRs-Fixed: 1045916
Change-Id: I1936bb0542bcd531726bf987ef806969ce96d498
Signed-off-by: Karthikeyan Ramasubramanian <kramasub@codeaurora.org>
2016-08-04 10:29:52 -06:00
Karthikeyan Ramasubramanian
a1fa510e64 soc: qcom: glink: Receive remote rx_intent with a cookie
Currently the remote rx_intent is stored with the primary information.
The transport cannot provide a cookie to be retrieved and used later during
transmission.

Add support to receive a remote rx_intent with a cookie.

CRs-Fixed: 1045916
Change-Id: Id5f204647205b2fde9e5cb422a3ddc8cc4f3a5a0
Signed-off-by: Karthikeyan Ramasubramanian <kramasub@codeaurora.org>
2016-08-03 11:37:13 -06:00
Dhoat Harpal
05360211f8 soc: qcom: glink: Fix parallel migration issue
During parallel migration race conditions are seen in remote open
and local open ack function.

Edge based lock is introduced to avoid any race condition during
simultaneous migration. Edge lock is shared across multiple
transport of same edge and is stored in a global list.

CRs-Fixed: 1010920
Change-Id: I2b988d2a6112add06fa433c4b1deeec0b6e6bb58
Signed-off-by: Dhoat Harpal <hdhoat@codeaurora.org>
2016-06-08 15:20:06 -07:00
Chris Lew
7d7d65221b soc: qcom: glink: Fix race condition in dummy xprt cleanup
In glink_core_channel_cleaup there is a race condition while
traversing the channels list. This change holds the xprt
channel spinlock during the list manipulation.

CRs-Fixed: 988266
Change-Id: Idcff59ca1483fd98173255d6258e6771d91dec19
Signed-off-by: Chris Lew <clew@codeaurora.org>
2016-05-16 20:10:29 -07:00
Chris Lew
d7e810a2ce soc: qcom: glink: Fix ssr race condition in glink_close
Add else statement in glink_close for a race condition where the
xprt state is set to GLINK_XPRT_DOWN and glink_close runs before
the channel is migrated.

CRs-Fixed: 988266
Change-Id: I4de6530f1fbffd9f3acd1fa539cf756364ea32ac
Signed-off-by: Chris Lew <clew@codeaurora.org>
2016-05-10 13:20:19 -07:00
Dhoat Harpal
9763e34fbc soc: qcom: glink: Fix channel migration on fully open channel
If process_open_event is delayed and glink has migrated to new transport,
process open event will be treated as a new open event and migration will
happen on fully open channel.

If channel is fully, open migration will not be allowed as client might
already be using the channel for communication.

Change-Id: I6c1760bc19f52e7d0c1c9834a72e2304f0ae28c8
Signed-off-by: Dhoat Harpal <hdhoat@codeaurora.org>
2016-05-06 12:06:26 -07:00
Chris Lew
798f2438dd soc: qcom: glink: Refactor rwref lock mechanism
Add an option to rwref locks that allow the lock functions
to spin when acquiring the lock. Change completion variable
to use waitqueues for sleep functionality.

Change rwref reference function calls to use locking functions
where code reads or writes the context state.

CRs-Fixed: 988266
Change-Id: Ib2908b2495b1b01a6a130033143a7da8e5c0c231
Signed-off-by: Chris Lew <clew@codeaurora.org>
2016-04-27 19:04:49 -07:00
Chris Lew
4ac9a6bc2a soc: qcom: glink: Reorganize glink lock hierarchy
Update the locking hierarchy to reflect the current and
future use-cases. This helps in avoiding deadlock due
to out-of-order locking scenario.

CRs-Fixed: 988266
Change-Id: Ib40da2ecd413e7712cacc9663394e725ebd64a0a
Signed-off-by: Chris Lew <clew@codeaurora.org>
2016-04-27 19:04:49 -07:00
Karthikeyan Ramasubramanian
8266c2d117 soc: qcom: glink: Fix channel migration logic
Channel migration logic assumes that the remote & local channel contexts
are always different and exist in different transports. If the remote
& local channel contexts exist in the same transport, then it leads to
a use-after-free scenario.

Fix the channel migration logic by not freeing the channel context if
the local & remote side opens in the same initial transport.

Change-Id: I319a93c49022b08e5c33b561d982a751d5223a58
Signed-off-by: Karthikeyan Ramasubramanian <kramasub@codeaurora.org>
2016-04-18 17:06:16 -07:00
Dhoat Harpal
8876c65ca7 soc: qcom: glink: Use tasklet/kworker for TX and RX path
Currently, Rx an Tx is based on workqueue and it is taking significant
time to schedule a workqueue which is hampering performance.

Use tasklet if underlying transport supports atomic context, otherwise
kworker is used.

CRs-Fixed: 978296
Change-Id: I736d2b90730ec10f9dff21944c4ad50e4d87da5c
Signed-off-by: Dhoat Harpal <hdhoat@codeaurora.org>
2016-04-12 15:49:53 -07:00
Karthikeyan Ramasubramanian
243a901e21 soc: qcom: glink: Signal the waiter for rx_intent ack under error
During subsystem restart, if a transmit operation is waiting for a remote
receive intent acknowledgment, signal the waiter that the receive intent
request will not be acknowledged. Also check the transport and channel
state before waiting for the acknowledgment. This will prevent the
transmit operation from blocking indefinitely under error scenario.

CRs-Fixed: 952184
Change-Id: I29b8215841f7dcca52137f451665eaf339a6f78e
Signed-off-by: Karthikeyan Ramasubramanian <kramasub@codeaurora.org>
2016-03-23 21:15:35 -07:00
Karthikeyan Ramasubramanian
6abda44581 soc: qcom: glink: Fix race condition between tx and close operation
The channel is closed locally by the client either as part of SSR or normal
working scenario. The transmit operation does not check the transport or
channel states before queuing the packet for transmit operation. This
causes the transmit operation to access stale transport or channel context.

Check the transport and channel state before queuing the packet for
transmission.

CRs-Fixed: 947627
Change-Id: Ic6f8350b6b5e51b641794255f8520ff4616343bb
Signed-off-by: Karthikeyan Ramasubramanian <kramasub@codeaurora.org>
2016-03-23 21:15:04 -07:00
Steven Cahail
ea74beeae9 soc: qcom: glink: Add RX intent request timeout to G-Link channels
During glink_tx(), G-Link can wait for an unlimited amount of time for
the remote side to queue an RX intent. In some cases, e.g. SSR, the wait
must be restricted to a short time, but in the current implementation,
glink_tx() can continue to block indefinitely.

Add a configurable timeout value to the G-Link channel context, which is
set in the channel open configuration. If the value is set to 0, treat
it as an infinite timeout. This allows a timeout to be put in place by
the client for sensitive cases such as SSR where a very limited amount of
time can be spent waiting for an intent.

Change-Id: I1e480fac286d285f871fe3059de7ae761fc4581e
Signed-off-by: Steven Cahail <scahail@codeaurora.org>
2016-03-23 21:13:25 -07:00
Arun Kumar Neelakantam
9188869e03 soc: qcom: glink: Add support for transport based logging
All Transports debug logs are captured in one logging context
which makes the debugging difficult and has a chance to miss
the important logs due to other high traffic transports like RPM.

Create separate logging context for each transports for better
debugging.

Change-Id: If2d00966a186dc48badc8a9a2e017eec6895dcad
Signed-off-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
2016-03-23 21:12:17 -07:00
Mahesh Sivasubramanian
8cbe96494f soc: qcom: Use arch_counter_get_cntvct instead of arch_counter_get_cntpct
Kernel version 4.4 has deprecated the use of *pct versions for 64 bit
targets. Hence moving to vct as recommended.

Change-Id: Ibabf3eb28f58daccd58cde207262b34ed3b1c04f

Use vct instead of pct()

Change-Id: Ibabf3eb28f58daccd58cde207262b34ed3b1c04f
Signed-off-by: Mahesh Sivasubramanian <msivasub@codeaurora.org>
2016-03-22 11:07:27 -07:00
Karthikeyan Ramasubramanian
987bbebd9a soc: qcom: Add snapshot of G-Link driver
This snapshot is taken as of msm-3.18 commit e70ad0cd (Promotion of
kernel.lnx.3.18-151201.)

Signed-off-by: Karthikeyan Ramasubramanian <kramasub@codeaurora.org>
2016-03-01 12:22:29 -08:00