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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Refine the code change for this changeID:
I335a046a886ac3ce35cf96eb71231bfe75d33c60
CRs-Fixed: 2058348
Change-Id: I9a734c8bed284870562ff2d096e7316328f37e02
Signed-off-by: Paul Zhang <paulz@codeaurora.org>
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>