Commit Graph

4518 Commits

Author SHA1 Message Date
qctecmdr
83fd9e5ed1 Merge "msm: ipa: New APIs for PINE+PINE dual wifi support" 2022-01-12 23:54:15 -08:00
qctecmdr
04d97ea137 Merge "msm: mhi_dev: Fail start command if fails to allocate reqs" 2022-01-12 19:45:19 -08:00
Sivakanth Vaka
5148a422d8 msm: ipa: New APIs for PINE+PINE dual wifi support
Add per instance APIs to support dual wifi attach.

Change-Id: I9330382fde5e5c727dd5a619b863adbed9f0c661
Signed-off-by: Sivakanth Vaka <svaka@codeaurora.org>
Signed-off-by: Piyush Dhyani <<quic_pdhyani@quicinc.com>
2022-01-12 12:20:55 -08:00
Sai Chaitanya Kaveti
c8c5c7cf86 msm: mhi_dev: Added mutex lock in mhi_dev_write_channel
mhi_dev_write_channel is called by diag channel. While processing it,
reset interrupt is received from host. During the reset sequence the
work queue mhi_sm_wq is getting destroyed in mhi_dev_sm_exit API. When
the mhi_dev_write_channel is resumed, queuing of work is done as part of
mhi_dev_notify_sm_event. Here, as the work queue is destroyed, crash
occurred with a kernel null pointer deference error. This is a race
condition between reset sequence and mhi_dev_notify_sm_event.

To avoid this race condition added a mutex lock mhi_lock in
mhi_dev_write_channel before calling mhi_dev_notify_sm_event.

Change-Id: Idaf1c33c462b6d659f3e5ddb333afe9c6a967fac
Signed-off-by: Sai Chaitanya Kaveti <quic_skaveti@quicinc.com>
2022-01-06 02:04:21 -08:00
Veerabhadrarao Badiganti
2ff35a0185 msm: mhi_dev: Correct DMA checks during reset command processing
Correct DMA checks during reset command processing, ensure both IPA
and eDMA are taken care. Also use MHI_USE_DMA macro in all conditions
which are applicable to both IPA and eDMA.

Change-Id: Iac7afaea52881d9ed70637081dc37c3f8292a753
Signed-off-by: Veerabhadrarao Badiganti <quic_vbadigan@quicinc.com>
2021-12-30 13:11:17 +05:30
Veerabhadrarao Badiganti
480cc9bf6b msm: mhi_dev: Fail start command if fails to allocate reqs
Fail the start command if we fails to allocate buffer for event
requests.

Change-Id: I05e9acb093f53f1675a4f711182730ab420e0e5a
Signed-off-by: Veerabhadrarao Badiganti <quic_vbadigan@quicinc.com>
2021-12-12 21:44:27 -08:00
qctecmdr
67f28ccb18 Merge "msm: mhi_dev: Checking the out channel status directly" 2021-12-07 12:26:59 -08:00
Sai Chaitanya Kaveti
c994af004d msm: mhi_dev: Checking the out channel status directly
If the net dev init process is scheduled out in between registering
a callback for in-channel and out-channel and start command for these
channels gets processed at this time (after registering the callback
for out channel but before registeringthe callback for in-channel)
then with existing logic, we never register with the network interface.

Checking the out channel status directly rather than using local bool
variable out_channel_started before calling
mhi_dev_net_open_chan_create_netif API. If out channel status is
connected the mhi_dev_net_open_chan_create_netif API is called.

Change-Id: I69af6c49ee565ffd04c4d0ac22b686ff986b7bc7
Signed-off-by: Sai Chaitanya Kaveti <quic_skaveti@quicinc.com>
Signed-off-by: Lakshmi Prasanna Meka <quic_lmeka@quicinc.com>
2021-12-07 13:04:07 +05:30
Veerabhadrarao Badiganti
9f1d5b0fa4 msm: ep_pcie: Send pme from panic/reboot handler while in D3hot
Send pme from panic/reboot handler if the device is in D3hot to
bring device state back to D0. This helps PBL to take retrain
the link gracefully as PBL didn't have ability to bring the device
our of D3hot state. Also send MHI to syserr, so that MHI host
wont timeout on M0ack.

Change-Id: I3de45cab30caa332bd00abe8b1ed1487d7889d5f
Signed-off-by: Veerabhadrarao Badiganti <quic_vbadigan@quicinc.com>
2021-12-06 20:28:12 -08:00
Veerabhadrarao Badiganti
7c8f76cfa2 msm: mhi_dev: Ensure event buffer size reflects the right size
We are setting event buffer size with the requested size and then
allocating the buffer for event requests (ereqs). But if the memory
allocation for ereq buffer fails, the event-buffer-size variable
is not getting set to zero.

Due to this, if a client calls open channel multiple times,
our logic proceeded without really allocating the buffer for ereqs.
And while processing completion events, we are observing null pointer
dereference issues.

Change-Id: I10bee8428d178ef5a7f0fe5fcd93fcce8dcbe27d
Signed-off-by: Veerabhadrarao Badiganti <quic_vbadigan@quicinc.com>
2021-12-05 20:49:03 -08:00
qctecmdr
84e30e3940 Merge "msm: mhi_dev: Adding mhi and pcie state change logs to console" 2021-12-03 02:44:49 -08:00
Pooja Kumari
3a5214422b msm: ipa3: Define socksv5 function in ipa_fmwk
Define socksv5 function in ipa_fmwk.

Change-Id: I8f1126632f0e2c61a8b2abf55ce29737527eeecb
Signed-off-by: Pooja Kumari <quic_kumarip@quicinc.com>
2021-12-02 09:47:03 -08:00
Sai Chaitanya Kaveti
c786e7b9e6 msm: mhi_dev: Adding mhi and pcie state change logs to console
Adding mhi and pcie state change logs to console to make testing and
debugging easier.

Change-Id: I1fe176fc532a99de9de862ad556df831b6db6bf6
Signed-off-by: Sai Chaitanya Kaveti <quic_skaveti@quicinc.com>
2021-12-02 02:22:24 -08:00
Subramanian Ananthanarayanan
c5d5dd2c47 msm: mhi_dev: Allocate ring element during M0
Device allocates ring memory during mmio initialization, this
causes 128 event ring elements to be created as MHICFG
register may not be updated by the host. This causes memory
to get exhausted leading to an MMIO init failure.

The Change is to allocate ring memory during M0, during which
MHICFG register is bound to be updated by the host.

Change-Id: I04a0e0ed79a46f16f96e2be4c5c68cba9ee2c99d
Signed-off-by: Subramanian Ananthanarayanan <skananth@codeaurora.org>
Signed-off-by: Gauri Joshi <gaurjosh@codeaurora.org>
Signed-off-by: Lakshmi Prasanna Meka <quic_lmeka@quicinc.com>
2021-11-30 14:12:31 +05:30
qctecmdr
26eda544f8 Merge "msm: mhi_dev: Disabling Ch Db Intr during MHI INIT phase" 2021-11-25 09:08:45 -08:00
Abhinab Abhinab
43eeb25995 msm: mhi_dev: Disabling Ch Db Intr during MHI INIT phase
In order to tackle the spurious interrupts coming from the host
on an invalid channel, the channel doorbell interrupts are
disabled during initialization phase. These are enabled after
receiving the start command for a particular channel.

Change-Id: I12bb315bcd249383ed442ad969e84c9eef25a324
Signed-off-by: Abhinab Abhinab <aabhinab@codeaurora.org>
Signed-off-by: Gauri Joshi <gaurjosh@codeaurora.org>
Signed-off-by: Lakshmi Prasanna Meka <quic_lmeka@quicinc.com>
2021-11-24 16:12:33 +05:30
Karthick Shanmugham
b69c594ba6 msm: ep-pcie: ipq: Enable global irq before link enum
Enabling global irq after link enumeration causes link
failure with IPQ host. Global irq is enabled before
enumeration for ipq host alone.

Change-Id: I20fa69c05bd3bc97fddea35e9e30833bca04c54b
Signed-off-by: Karthick Shanmugham <kartshan@codeaurora.org>
Signed-off-by: Lakshmi Prasanna Meka <quic_lmeka@quicinc.com>
2021-11-24 13:18:37 +05:30
qctecmdr
9ecf5a17c2 Merge "msm: ep_pcie: Allow L1 states while switching back to D0 from D3hot" 2021-11-23 21:47:44 -08:00
qctecmdr
e7d1e92587 Merge "msm: ep-pcie: Clear L23 READY after enumeration" 2021-11-23 05:25:59 -08:00
qctecmdr
314bad936b Merge "msm: mhi: Queue channel db only if channel is open" 2021-11-23 05:25:58 -08:00
qctecmdr
4b2e172235 Merge "msm: ep-pcie: Enable global IRQ after enumeration" 2021-11-23 05:25:57 -08:00
qctecmdr
043f4ebf83 Merge "msm: ep-pcie: Correct two CAP reg offsets" 2021-11-22 23:49:45 -08:00
qctecmdr
a44c4e5906 Merge "msm: ep-pcie: Allow device enter L1 right after BME is set" 2021-11-22 23:49:44 -08:00
Nitesh Gupta
f2ba8fff98 msm: mhi: Queue channel db only if channel is open
Channel interrupts are seen on device even before,
channel ring is initialized. Queuing pending work
without checking ring status can lead to processing
of spurious interrupts. Adding proper checks in place
before queuing channel doorbell.

Change-Id: I3ccd7302b535d2b8ef63eada9d7a1fe553dccdaa
Signed-off-by: Nitesh Gupta <nitegupt@codeaurora.org>
Signed-off-by: Gauri Joshi <gaurjosh@codeaurora.org>
Signed-off-by: Lakshmi Prasanna Meka <quic_lmeka@quicinc.com>
2021-11-23 11:04:26 +05:30
Gauri Joshi
e9b647b739 msm: ep-pcie: Enable global IRQ after enumeration
The global irqs are being enabled before EP driver has completed
successful link enumeration. This causes a race condition where
the BME IRQ is processed before link up causing the link up to
exit before updating the link status. Any further processing results
in LINK_DISABLED error. Avoid this scenario by enabling the global
interrupts after enumeration has finished.

Change-Id: I983a35f461da5d8966cadc9918b5529d16182b47
Signed-off-by: Gauri Joshi <gaurjosh@codeaurora.org>
2021-11-23 10:58:21 +05:30
Siva Kumar Akkireddi
d8f9f29196 msm: ep_pcie: Correct clkreq override value
Use unshifted value to set the clock req override value
and enable fields as the register write function already
shifts the values to the correct position.

Change-Id: I0b5dea0f6f8462363471910ffe93f8f8975e7929
Signed-off-by: Siva Kumar Akkireddi <sivaa@codeaurora.org>
Signed-off-by: Veerabhadrarao Badiganti <vbadigan@codeaurora.org>
2021-11-23 10:56:07 +05:30
Veerabhadrarao Badiganti
ebd7302b18 msm: ep_pcie: Allow L1 states while switching back to D0 from D3hot
During D3hot, we are explicitly blocking L1 state by setting
REQ_EXIT_L1 bit of PM_CTRL register. If we transitioning back to D0
from D3 (without D3cold), REQ_EXIT_L1 bit won't get cleared. And
L1 would get blocked till next D3cold. Clear this explicitly during
D0 to avoid this scenario.

Change-Id: Ib168dee255f29832600ebca14eea1ac2ea393985
Signed-off-by: Veerabhadrarao Badiganti <vbadigan@codeaurora.org>
2021-11-23 10:53:47 +05:30
Gauri Joshi
08e155ece0 msm: ep-pcie: Clear L23 READY after enumeration
L23_READY bit in the PARF_PM_CTRL register is set coming
out of PBL. Clear it once PCIe enumerates. This will avoid
the corner case where L23_READY is sent to the host causing
the link to be disable before the EP PCIe driver has had a
chance to disable the endpoint cleanly.

Change-Id: I2159cf88c4ec5f2b38b7134e42c6a069a9738d6c
Signed-off-by: Gauri Joshi <gaurjosh@codeaurora.org>
2021-11-23 10:51:24 +05:30
Can Guo
18afbf4da4 msm: ep-pcie: Correct two CAP reg offsets
Correct the offsets of L1SUB_CAPABILITY_REG and L1SUB_CONTROL1_REG.

Change-Id: I6130a7eab50d85e34d87c28bde3a48c058ee9eee
Signed-off-by: Can Guo <cang@codeaurora.org>
2021-11-23 10:43:56 +05:30
Can Guo
0aae96cfb3 msm: ep-pcie: Allow device enter L1 right after BME is set
Allow device enter L1, i.e. clear PCIE_0_PCIE_PARF_PM_CTRL[REQ_NOT_ENTR_L1]
once we find out BME is set.

Change-Id: I8aca816446a286d02ef51724d157cb7c75057250
Signed-off-by: Can Guo <cang@codeaurora.org>
2021-11-22 20:51:50 -08:00
qctecmdr
085b994fc4 Merge "msm: mhi: Handle PCIe events from the common work queue" 2021-11-22 07:25:29 -08:00
qctecmdr
4be7c16fe9 Merge "msm: mhi-dev: Flush ereqs from dev close to avoid OOS transfers" 2021-11-19 09:08:32 -08:00
qctecmdr
607a15511b Merge "msm: mhi_dev: Handle potential deadlock situation" 2021-11-19 09:08:31 -08:00
qctecmdr
48df15b6c9 Merge "msm: mhi_dev: Serialize UCI open and close file node operations" 2021-11-19 07:21:33 -08:00
qctecmdr
d7879bfe0b Merge "msm: ep-pcie: Fix icc bus vote and add icc bus unvote" 2021-11-19 07:21:31 -08:00
qctecmdr
9551ae8f2a Merge "msm: mhi: Queue pending_ring WQ post channel DB check" 2021-11-19 05:21:33 -08:00
qctecmdr
c02a77a5ae Merge "msm: mhi_dev: check for error during ring processing" 2021-11-19 05:21:32 -08:00
qctecmdr
39e1e20d6c Merge "msm: mhi_dev: Ensure the flush list is empty for a stopped channel" 2021-11-19 05:21:31 -08:00
qctecmdr
b1b618e1ab Merge "msm: mhi_dev: Check to prevent in_use_list access" 2021-11-19 05:21:31 -08:00
Nitesh Gupta
d491e8d909 msm: mhi_dev: Handle potential deadlock situation
With the current logic, MHI driver will hold channel
lock while processing the ring element and triggers
callback for the clients. Some clients are issuing
read requests for the channel in the callback context.
MHI driver will try to acquire the same channel lock
in read api leading to a deadlock situation.

Modify the logic to avoid holding channel lock
while processing the ring elements.

Change-Id: I62ac28d5eb06e3c9b12437f02288cfe1cdb2bea2
Signed-off-by: Nitesh Gupta <nitegupt@codeaurora.org>
Signed-off-by: Gauri Joshi <gaurjosh@codeaurora.org>
2021-11-19 13:00:57 +05:30
Subramanian Ananthanarayanan
9a6e61c425 msm: mhi_dev: Check to prevent in_use_list access
Added a check for accessing in_use_list only in async case.

Change-Id: I842f9b9feb688d75152f7b2639c17c25c3376236
Signed-off-by: Subramanian Ananthanarayanan <skananth@codeaurora.org>
Signed-off-by: Gauri Joshi <gaurjosh@codeaurora.org>
2021-11-18 23:29:28 -08:00
Subramanian Ananthanarayanan
029cf97f28 msm: mhi_dev: Use req_lock spinlock during client release
The change is to use req_lock spinlock during client release
and to use the same spinlock while checking for is_stale
during read/write completion callbacks.

Change-Id: I7ebafecb7503fa8521fa8f849cabf4b82bbc2f53
Signed-off-by: Subramanian Ananthanarayanan <skananth@codeaurora.org>
Signed-off-by: Gauri Joshi <gaurjosh@codeaurora.org>
2021-11-19 12:53:40 +05:30
Subramanian Ananthanarayanan
df2f032c5f msm: mhi_dev: Serialize UCI open and close file node operations
Multiple clients might perform open and close file operations
simultaneously on the same file node created by UCI. To avoid
race conditions which might result in invalid accesses or crashes,
the open and close operations are serialized.

Change-Id: Ic6a290a2c6af25bcd60983a7b531bf1287201821
Signed-off-by: Subramanian Ananthanarayanan <skananth@codeaurora.org>
Signed-off-by: Gauri Joshi <gaurjosh@codeaurora.org>
2021-11-18 23:19:15 -08:00
qctecmdr
896e302db9 Merge "msm: mhi_dev: free allocated memory in reverse order of allocation" 2021-11-18 22:21:29 -08:00
Veerabhadrarao Badiganti
43bbd74eb9 msm: mhi_dev: Ensure the flush list is empty for a stopped channel
If a channel gets stopped, while there are some outstanding requests/
transfers with IPA, then we simply ignore the completion from IPA.
But we must have already added the transfer-completion-event to the
flush list before submitting the transfer to IPA.

There is a possibility that we flush these stale events along with new
flush events (for new requests) when the channel gets re-started.
This un-intentional completion event can lead to out-of-sequence
events at the host.

So while stopping a channel, ensure all elements in the flush list
of that channel are discarded and the flush list is empty.

Change-Id: I04445b1f9f4d2d4fce0b8a96277517de14481ead
Signed-off-by: Veerabhadrarao Badiganti <vbadigan@codeaurora.org>
2021-11-19 10:45:05 +05:30
Gauri Joshi
40821f01e9 msm: mhi-dev: Flush ereqs from dev close to avoid OOS transfers
Currently there is a race condition where during the flushing of ereqs
the channel is closed from the client on the EP side, which is causing
the flush function to access null memory. To avoid that call the flush
from dev close which ensures all the pending ereqs are closed before
closing the channel and freeing the memory.

Change-Id: Id81d8cb8b326340d28f6cfe9d48dcd685a8038f9
Signed-off-by: Gauri Joshi <gaurjosh@codeaurora.org>
2021-11-19 10:40:58 +05:30
Subramanian Ananthanarayanan
d697c9681a msm: mhi_dev: check for error during ring processing
The change is to check for error code from cmd processing in case
of db pending cases, to avoid rd_offset increment.

Change-Id: If213297fe02ec1087bfab572f5af97b1e7bb5791
Signed-off-by: Subramanian Ananthanarayanan <skananth@codeaurora.org>
Signed-off-by: Gauri Joshi <gaurjosh@codeaurora.org>
2021-11-19 10:22:34 +05:30
qctecmdr
f1de19f142 Merge "msm: mhi-dev: Check to avoid null pointer dereference" 2021-11-18 18:33:10 -08:00
qctecmdr
16affeb5a6 Merge "msm: mhi: Prevent flush queue if channel is closed" 2021-11-18 14:26:42 -08:00
qctecmdr
d23e4be453 Merge "msm: mhi-dev: Add support for AIO write API" 2021-11-18 08:30:27 -08:00