Commit graph

202 commits

Author SHA1 Message Date
codeworkx
15f81a19b5 Merge tag 'LA.UM.7.4.r1-05300-8x98.0' into lineage-16.0
"LA.UM.7.4.r1-05300-8x98.0"

Change-Id: I8e27939efccb7d0bda0ac7c4e32afdf3c6d62507
2019-06-16 08:15:21 +02:00
Naman Padhiar
1c16771a7b icnss: Add check on msa region
When icnss receive server arrive it send wlfw_msa_mem_info_send_sync_msg
QMI request to firmware and in response expect range of addresses and size
to be mapped. Add condition to check whether addresses in response falls
under valid range otherwise it asserts.

Change-Id: I9a8542cb6c3b3cefe112d1f08a76dd2eadf68d2f
Signed-off-by: Naman Padhiar <npadhiar@codeaurora.org>
2019-05-14 23:14:39 -07:00
Sandeep Singh
ab8f63420c icnss: Add Api to Block/Unblock modem shutdown
Add API to Block/Unblock modem graceful shutdown.

Change-Id: I69b061fc7d25762b2c36d9590802addfc170f91f
Signed-off-by: Sandeep Singh <sandsing@codeaurora.org>
2019-03-27 18:10:38 +05:30
Sandeep Singh
0fe53af862 icnss: Defer modem graceful shutdown until probe complete
In case WLAN driver probe is in progress and modem graceful
shutdown occurs and if modem shutdown request is sent just
before the mode on request sent to firmware, firmware may end up
in illegal memory access.
To address this issue, modem notifier needs to be blocked needs for
probe to complete or max 5 seconds timeout.

CRs-Fixed: 2381846
Change-Id: I9e13a11c56059cb29e161c34df11de484f87ac5e
Signed-off-by: Sandeep Singh <sandsing@codeaurora.org>
2019-03-27 17:08:56 +05:30
Sandeep Singh
14961ab5bb icnss: Add support for graceful shutdown
Add a QMI command to indicate graceful shutdown to the FW
and updating the QMI file.

Change-Id: I0360f6f5b49bc19ea4a7acbbd0e192e1596463d6
Signed-off-by: Sandeep Singh <sandsing@codeaurora.org>
2019-03-20 03:52:07 -07:00
codeworkx
6861312cbe Merge tag 'LA.UM.7.4.r1-04700-8x98.0' into auto
"LA.UM.7.4.r1-04700-8x98.0"

Change-Id: I777ab5e199fb463581fbfaf4750c8358d6f9e56f
2019-03-10 16:59:28 +01:00
Yuanyuan Liu
0185d5c847 icnss: NULL terminate the fw build timestamp string
If fw build timestamp passed by QMI is a non-NULL terminated string,
it might result in a out-of-bounds read in icnss_get_soc_info. Hence,
manually NULL terminate the string.

Change-Id: I252196cd12784d841b29303c42591efc59da64f1
CRs-Fixed: 2322317
Signed-off-by: Yuanyuan Liu <yuanliu@codeaurora.org>
2018-12-26 07:58:27 +01:00
Anurag Chouhan
b025cdfd53 icnss: Add check for rejuvenate in fw_down
Currently, fw_down is not getting set in case of rejuvenate
since the qmi server never exit or arrive in case of rejuvenate.
Add ICNSS_REJUVENATE flag to take care of rejuvenate.

Change-Id: If85e8048cbad9a15e1c94af1c8d0012e004e6150
Signed-off-by: Anurag Chouhan <achouhan@codeaurora.org>
2018-12-26 07:53:57 +01:00
liochen
8148b9d900 Synchronize codes for OnePlus5 & 5T OxygenOS 9.0.0
kernel device tree source code for OnePlus 5 & 5T P device

Change-Id: I84f40e66833ea1ce30eb1d9a710d6e1529e9e637
2018-12-26 11:02:39 +08:00
Hardik Kantilal Patel
e0ce9d1bb0 icnss: Remove WARN_ON during self recovery trigger
Remove WARN_ON during self recovery trigger to avoid
false positive while doing stress testing of self
recovery feature.

CRs-Fixed: 2296234
Change-Id: Ibe858f74ccb78565c98ba249a244f6bceb0ca1e5
Signed-off-by: Hardik Kantilal Patel <hkpatel@codeaurora.org>
2018-11-28 02:08:27 -08:00
Yuanyuan Liu
b97feb8274 icnss: NULL terminate the fw build timestamp string
If fw build timestamp passed by QMI is a non-NULL terminated string,
it might result in a out-of-bounds read in icnss_get_soc_info. Hence,
manually NULL terminate the string.

Change-Id: I252196cd12784d841b29303c42591efc59da64f1
CRs-Fixed: 2322317
Signed-off-by: Yuanyuan Liu <yuanliu@codeaurora.org>
2018-10-29 17:44:15 -07:00
Anurag Chouhan
6aa022f4eb icnss: Add check for rejuvenate in fw_down
Currently, fw_down is not getting set in case of rejuvenate
since the qmi server never exit or arrive in case of rejuvenate.
Add ICNSS_REJUVENATE flag to take care of rejuvenate.

Change-Id: If85e8048cbad9a15e1c94af1c8d0012e004e6150
Signed-off-by: Anurag Chouhan <achouhan@codeaurora.org>
2018-09-30 22:53:57 -07:00
Anurag Chouhan
e7ad20af9a icnss: Add a flag to indicare FW rejuvenate
Add a flag to maintain fw rejuvenate state,
set if fw rejuvenate happens and reset at fw ready.
export an API to the wlan host driver to distinguish the
case of ssr or pdr with the FW rejuventae.

Change-Id: I7a01cc4996f68f78aa13eacf36648331a701882a
Signed-off-by: Anurag Chouhan <achouhan@codeaurora.org>
2018-08-30 02:21:41 -07:00
Hardik Kantilal Patel
60e1b7e682 icnss: Clear ICNSS_MSA0_ASSIGNED flag in cap failure case
During capability qmi message failure ICNSS_MSA0_ASSIGNED
flag is not getting clear. Due to this after PDR/SSR next
time it is not configuring the MSA0 permission to q6 which
result into NOC error as q6 is not having access permission.

To address above issue clear ICNSS_MSA0_ASSIGNED bit in
failure case.

CRs-Fixed: 2300877
Change-Id: I6aeaedb5a394b843c4f1c8ef1e0be47a6947b331
Signed-off-by: Hardik Kantilal Patel <hkpatel@codeaurora.org>
2018-08-24 14:19:26 +05:30
Linux Build Service Account
e8848a7c8e Merge "icnss: Remove sending uevent after FW ready" 2018-07-31 09:34:22 -07:00
Sameer Thalappil
9b96f692c0 icnss: Consider recovery as FW down
When WLAN driver encounters FW timeout scenarios, it may check if the
FW is down by calling icnss_is_fw_down() API. Recovery should also be
considered as FW down, as FW has not completely recovered and ready
for WLAN communication.

Change-Id: I4c9e15aacc5605dca823e2cfcbf6f87152aaa78e
CRs-Fixed: 2218795
Signed-off-by: Sameer Thalappil <sameert@codeaurora.org>
2018-04-04 18:24:29 -07:00
Linux Build Service Account
38edeeedb5 Merge "icnss: Remove vote for hardware resources when FW is not down" 2018-02-15 12:21:04 -08:00
Hardik Kantilal Patel
7311ff92a3 icnss: Avoid wlan driver remove during modem graceful shutdown
In case of modem graceful shutdown case during wlan driver
remove it delete the wlan interface and later probe time
create the new interface. some time new interface may get
different interface index. Android wificond framework module
is not aware about this interface index change due to this
after recovery it try to do scan with old interface index
which result into scan failure.

To address above issue avoid wlan driver remove during modem
graceful shutdown.

CRs-Fixed: 2157835
Change-Id: I8b828bef8b5f43cc39ba8ee578dcafc6afaa98d6
Signed-off-by: Hardik Kantilal Patel <hkpatel@codeaurora.org>
2018-01-31 21:47:15 -08:00
Yuanyuan Liu
8d7bc77acd icnss: Remove sending uevent after FW ready
FW ready indication doesn't mean it is safe to access HW register.
FW ready only means that WLAN FW is initialized. The HW register
is safe to access only after FW ack the wlan enable mode request.
Hence removing uevent in FW ready indication handler. WLAN driver
will responsible for setting FW ready state once wlan enable mode
request is return success.

CRs-Fixed: 2168628
Change-Id: I769d848efb9dd427da0d71494090fcbf9514cfb2
Signed-off-by: Yuanyuan Liu <yuanliu@codeaurora.org>
2018-01-25 10:23:36 -08:00
Anurag Chouhan
0c89a0b5b2 icnss: Avoid qmi exchange when fw is down
Currently wlan Host driver call exported API's which
invoke qmi exchanges irrespective of the firmware status
which leads to QMI timeouts.
To address this issue avoid sending qmi request to
firmware when firmware is down.

CRs-Fixed: 2175302
Change-Id: Ie5e340cebf7ee7f6143472e7dca0dfd9600d1b7d
Signed-off-by: Anurag Chouhan <achouhan@codeaurora.org>
2018-01-24 21:30:57 -08:00
Yuanyuan Liu
00d56be680 icnss: Remove vote for hardware resources when FW is not down
There's a race condition that could happen between PDR and driver
unloading, where platform removes its hardware resources vote
at the end of driver de-initialization in between the 2 stages
of WLAN FW reset recipe, which led to a bad state in WLAN HW.
To avoid this, check WLAN FW state before removing hardware
resources vote. Do not remove vote during driver unloading if
WLAN FW is in down state. The vote will be released within FW
ready indication handler once WLAN FW is recovered.

Change-Id: Ic45c42c4d05676e60a8fb7a8b5cae306b1c3344e
CRs-Fixed: 2158466
Signed-off-by: Yuanyuan Liu <yuanliu@codeaurora.org>
2018-01-22 10:41:43 -08:00
Yuanyuan Liu
d49bcf2440 icnss: Add size check before assigning msa permission
While assigning msa permission, number of memory region is passed
as an argument within platform private data. This number could
exceed the range of memory region buffer that preallocated. Hence
add size check before accessing region buffer.

Change-Id: I45f4efc7edaa636c861458dab74b1956767d2019
CRs-Fixed: 2101134
Signed-off-by: Yuanyuan Liu <yuanliu@codeaurora.org>
2018-01-09 17:04:11 -08:00
Yuanyuan Liu
daee03cd52 icnss: Do not send uevent when driver is unloading
If modem crashed during wlan driver unloading, icnss driver
will call driver uevent callback to send FW down uevent when
it receives BEFORE_SHUTDOWN notification. If wlan driver is
de-initialized just before the callback is called, kernel will
panic as driver's context is freed. This can be avoid by not
sending uevent when wlan host driver is unloading. Instead,
icnss driver will provide an API to host driver to check if
WLAN FW is down or not.

CRs-Fixed: 2161425
Change-Id: I569fd85366522606ececeda74df85c51b9b2fc28
Signed-off-by: Yuanyuan Liu <yuanliu@codeaurora.org>
2017-12-20 10:53:14 -08:00
Yuanyuan Liu
8a23ecb418 icnss: Reject driver reinit request when FW is down
Reject driver reinit request when WLAN FW is down as FW
is in a bad state and can't communicate with host driver.

CRs-Fixed: 2153375
Change-Id: Id16cbfc05984091d61b18c98f7397baa871f82b4
Signed-off-by: Yuanyuan Liu <yuanliu@codeaurora.org>
2017-12-05 10:19:25 -08:00
Yuanyuan Liu
554899595c icnss: Reject register_driver request when WLAN FW is down
Reject regsiter_driver request when WLAN FW is already down as
WLAN FW is in a bad state and can't communicate with host driver.

Change-Id: I57ba839101f5c0a361e74060b18b45f87c71634c
CRs-Fixed: 2151726
Signed-off-by: Yuanyuan Liu <yuanliu@codeaurora.org>
2017-12-04 11:18:42 -08:00
Linux Build Service Account
de7627fc2a Merge "icnss: Add dev to all export APIs in ICNSS" 2017-11-29 15:24:41 -08:00
Linux Build Service Account
e648f8c78b Merge "icnss: Remove MSA0 permission only when modem is crashed" 2017-11-29 04:26:03 -08:00
Sarada Prasanna Garnayak
f89e708410 icnss: Add dev to all export APIs in ICNSS
Add device pointer in all export symbol to
add support for numerous WLAN module.

CRs-Fixed: 2138446
Change-Id: I981155c165e4e5c2794b778afe647f8a588dd860
Signed-off-by: Sarada Prasanna Garnayak <sgarna@codeaurora.org>
2017-11-29 01:33:36 -08:00
Yuanyuan Liu
935a684aa6 icnss: Remove MSA0 permission only when modem is crashed
For modem restart and device power off cases, there's no
need to remove MSA0 permission and collect ramdump as these
are normal behavior. Hence only collecting ramdump when
modem is crashed.

CRs-Fixed: 2141678
Change-Id: I42b44da3f08e62c8e375ae1749563d918e68be9d
Signed-off-by: Yuanyuan Liu <yuanliu@codeaurora.org>
2017-11-20 14:33:10 -08:00
Yuanyuan Liu
f5b51b1f49 icnss: Send early modem crash notification to wlan driver
When SSR happending during WLAN interface up, a deadlock will happen
in many places where it waits for FW response. When wlan module starts,
it will hold a rtnl_lock and wait for FW response. If SSR happened at
this point, it will send ssr notification to all the registed modules
one by one. It will send notification to IPA first, which will also
tried to get a hold of rtnl_lock. Since ssr notification is synchronized,
IPA won't be able to return because of failing to acquire the lock and
wlan driver won't release the rtnl_lock until it timeout and crash.
Only graceful to avoid this deadlock is to get early modem
crash notification from platform via a path which does not acquire
RTNL lock and this way once driver has received early crash
notification it can reject interface up.

Modem notification comes to icnss before IPA, hence send
early crash notification in modem SSR handler so that wlan driver
can release RTNL lock as soon as possible.

CRs-Fixed: 2141970
Change-Id: If77c54a2a39ce5cf0e129eb5c6599cd3fd722886
Signed-off-by: Yuanyuan Liu <yuanliu@codeaurora.org>
2017-11-20 14:25:20 -08:00
Anurag Chouhan
fd554860f0 icnss: Check for FW_READY state before sending uevent in PD notifier
The existing state check will create a corner case that when FW
crashed during driver probe, platform driver won't send early
uevent notification to host driver, which create a small window where
host can communicate with FW when FW is crashed. This case can be
covered by checking FW_READY state instead.

CRs-Fixed: 2122702
Change-Id: I0bde9cb5a526ccd9fe81cd38bd4c27cf2e95042b
Signed-off-by: Yuanyuan Liu <yuanliu@codeaurora.org>
Signed-off-by: Anurag Chouhan <achouhan@codeaurora.org>
2017-11-01 23:50:26 -07:00
Sameer Thalappil
9fccd743a2 icnss: Do not assert if reboot requested during PDR
When icnss driver sees a PD down, and if the recovery is already in
progress, it forces an assert in debug builds. That is to detect any
Modem failures during PDR or to catch any instance of recursive PDRs.
When system goes thru a reboot or shutdown, and if the recovery is in
progress then avoid calling this assert.

CRs-Fixed: 2135071
Change-Id: I28f5c79a4cd8b83f60a62111535b11c2fba6000b
Signed-off-by: Sameer Thalappil <sameert@codeaurora.org>
2017-10-31 10:19:55 -07:00
Yuanyuan Liu
818cdc63ce icnss: Re-probe if driver probe returns error of defer
If wlan driver probe returns error of defer, platform driver will
try to recover by calling probe again. The maximun probe count
is 2.

CRs-Fixed: 2124152
Change-Id: Ic973d0f1d76fc59ce5950397d42a9e778cacaa5a
Signed-off-by: Yuanyuan Liu <yuanliu@codeaurora.org>
2017-10-12 11:12:45 -07:00
Linux Build Service Account
e53deedd20 Merge "icnss: Fix uninitialized variable" 2017-08-29 21:19:34 -07:00
Sameer Thalappil
1b2a982b4f icnss: Do not process FW messages after Modem shutdown
During Modem graceful shutdown, QMI messages from WLAN FW can
still be delivered to host even after icnss receives Modem
shutdown notification from SSR framework. So prevent processing
any such messages from FW after Modem shutdown.

CRs-Fixed: 2095386
Change-Id: Ice21d043393b0f7b97aaccd68e1b28702cc9e393
Signed-off-by: Sameer Thalappil <sameert@codeaurora.org>
2017-08-23 12:57:39 -07:00
Anurag Chouhan
123604f4fd icnss: Fix uninitialized variable
As part of optimization in msa permissions assignment
source and destination vmids are introduced as uninitialized
arrays.
The fix is for initialization of the array as zero initially
so that variables doesnot have the garbage value from the stack.

Change-Id: Ie30d61f3be9ed5a5a2cef2e63348d987e894c22a
CRs-fixed: 2096940
Signed-off-by: Anurag Chouhan <achouhan@codeaurora.org>
2017-08-22 23:09:10 -07:00
Anurag Chouhan
6c6fb7901e icnss: Add support to validate the result and error code
Add support to validate the result and error code
received from the WLAN firmware service.

CRs-fixed: 2095184
Change-Id: I454df58e293fbf2d99601d1c6820e67b5cae370c
Signed-off-by: Anurag Chouhan <achouhan@codeaurora.org>
2017-08-18 17:01:19 +05:30
Anurag Chouhan
21d31ab5eb icnss: Delay Shutdown/reinit sequence for all cases
PD down notifications reaches APPS only after WLAN HW is
reset. Because of this, there is a small window of time
in which APPS may try to access WLAN HW Copy Engine
registers and get into exception. To avoid this, FW has
implemented 2 stage reset sequence in which first HW is
halted rather than reset and then when FW PD is started
again, reset sequence is executed. Because of the 2
stage reset sequence, WLAN shutdown call back also needs
to be delayed as there may be some buffers submitted to
hardware and if they are freed then again HW exception
may be seen. Delay the shutdown call back till FW ready
happens at this time HW should be reset and clean state.

CRs-fixed: 2056443
Change-Id: Ie587f98d574f7c0a49a8480449fed44c1f4ab816
Signed-off-by: Anurag Chouhan <achouhan@codeaurora.org>
2017-08-07 04:27:56 -07:00
Linux Build Service Account
15d76668b0 Merge "icnss: Set crash state for PDR" 2017-07-26 19:22:54 -07:00
Sameer Thalappil
ddbc617f58 icnss: Set crash state for PDR
For PDR, the crashed state should be set to invoke driver's
PDR/SSR routine rather than the remove routine.

CRs-Fixed: 2082279
Change-Id: I5f5d51c530c563d93eeaf183ee10ac558f5d5a1a
Signed-off-by: Sameer Thalappil <sameert@codeaurora.org>
2017-07-25 13:45:32 -07:00
Yuanyuan Liu
2e16671480 icnss: Consolidate logging message
Currently the code makes liberal use of macros that print a log message
(with pr_err or pr_debug) and then passes the same string on to the
IPC logging mechanism. The problem is that it doesn't actually end up
being the same string in the binary. Using pr_err or one of its friends
appends the KERN_* code to the front of the string with the pre-processor
and the IPC logger just uses the passed in string. Every string used by
the macros ends up appearing twice in the binary, once with KERN_*
prepended and the other not.

This change fix this duplication issue by appending KERN_* to the front
of the IPC logger.

Change-Id: Ibfdf9edf6e243d13cacf1a45838a88e287a684be
Signed-off-by: Yuanyuan Liu <yuanliu@codeaurora.org>
2017-07-21 15:06:46 -07:00
Linux Build Service Account
3ec8bfc9bb Merge "icnss: Use fixed memory region for WLAN MSA0 memory" 2017-07-07 17:45:54 -07:00
Hardik Kantilal Patel
cc193eec69 icnss: Use fixed memory region for WLAN MSA0 memory
During first time boot up WLAN Platform driver allocate
1 MB MSA0 Memory region. This region may be adjacent to
other regions that also requires access control, due to
that TZ will merge the two sections into one single resource
group. During this Q6 will lose access to memory region causing
a NOC Error. To avoid use fixed memory region for WLAN MSA0
memory.

CRs-Fixed: 2066025
Change-Id: Ie878e010954524bbe48a29d6ad6f2f53848ab25e
Signed-off-by: Hardik Kantilal Patel <hkpatel@codeaurora.org>
2017-07-07 16:55:07 +05:30
Yuanyuan Liu
e7cf674bc9 icnss: Show rejuvenation info in ICNSS stats report
This is a debug enhance feature. It shows rejuvenation
info in ICNSS stats report, which makes it easier to
track the reason for every rejuvenation.

CRs-Fixed: 2072253
Change-Id: I6d133b4b182943ed745d7587bd1ec23858c29750
Signed-off-by: Yuanyuan Liu <yuanliu@codeaurora.org>
2017-07-06 22:48:44 -07:00
Sameer Thalappil
e71a1f26c5 icnss: Fix incorrect clean-up of stats
Fix the copy paste error of clearing the statistics
as part of the fw_debug debugfs write interface.

CRs-Fixed: 2066394
Change-Id: I4ca848a05af06c2a9e6ce1efeb3bfa3b77c2f8d8
Signed-off-by: Sameer Thalappil <sameert@codeaurora.org>
2017-06-26 13:44:53 -07:00
Sameer Thalappil
6a7013d43d icnss: Add specific statistics for PDR
Maintain separate statistics to track the number of PDR instances
from FW crash, host error, root PD crash and root PD shutdown cases.
Also add support to announce the PDR cause in the log.

CRs-Fixed: 2066366
Change-Id: I33995d694e3aae47dfcc9f249528a7f1815ee12f
Signed-off-by: Sameer Thalappil <sameert@codeaurora.org>
2017-06-26 13:24:51 -07:00
Sarada Prasanna Garnayak
470cbd2aea icnss: fix the memory and kernel info leak due to the race condition
The icnss register read/write debugfs entry can be  accessed by
multiple user space thread. Memory allocation and deallocation
in the register read/write file operation leads to potential memory
leak during concurrency access of debugfs device file.

Add protection to avoid the memory leak and kernel information
leak due to the race condition in the register read/write ops.

CRs-Fixed: 2012572
Change-Id: I22c6af9a396c0df4e68f75702fc68a5dff5af032
Signed-off-by: Sarada Prasanna Garnayak <sgarna@codeaurora.org>
2017-06-22 00:35:59 -07:00
Linux Build Service Account
63c0d4a4b6 Merge "icnss: change the cnss name to icnss" 2017-06-15 16:10:55 -07:00
Paul Zhang
8510e2c28b icnss: change the cnss name to icnss
Refine the code change for this changeID:
I335a046a886ac3ce35cf96eb71231bfe75d33c60

CRs-Fixed: 2058348
Change-Id: I9a734c8bed284870562ff2d096e7316328f37e02
Signed-off-by: Paul Zhang <paulz@codeaurora.org>
2017-06-14 17:38:43 +08:00
Anurag Chouhan
92dc4179ca icnss: Change MSA permissions to collect dump
With certain senarios such as error FATAL, WBOG Bite in modem
WLAN hardware is still alive, while trying to collect the dump
platform driver is removing the MSA permissions from MSS
and WLAN Hardware to HLOS, at the same time if WLAN Hardware
is trying to access the MSA region which results into SNOC error
To avoid such senarios instead of removing MSS and WLAN permissions
MSA is assigned HLOS permissions as well and once the ramdump is collected
HLOS permissions will be removed.

Change-Id: Ic71e0fa8c064fd70dad9958187244909cbb80c0a
CRs-fixed: 2048531
Signed-off-by: Anurag Chouhan <achouhan@qti.qualcomm.com>
2017-06-13 22:51:19 -07:00