Commit Graph

387 Commits

Author SHA1 Message Date
Jiani Liu
b458d07087 cnss2: Add wlan PCIe switch property
Add wlan dts property qcom,pcie_switch_type to mark the wlan chip
is attached on the PCIe switch NTN3. If it's PCIE_SWITCH_NTN3, cnss
driver will enable/disable accordingly PCIe switch dsp link when
power on and shutdown wlan chip.

Change-Id: I48bb56879d5c00f05d0b4e62888027c435f861ee
CRs-Fixed: 3878342
2024-08-06 16:17:33 -07:00
Shashank Reddy Vulupala
f69aced6b8 icnss2: Update ccflags in Makefile
Add -Wmissing-prototypes ccflag for platform driver.

Change-Id: Ia375eae383fa64d0f477f3a1e2c4444ff2884ef7
CRs-Fixed: 3844455
2024-08-01 03:11:00 -07:00
Mohammed Ahmed
234bc26709 cnss2: Fix mbox_msg size calculated
Current code passes in mbox_msg max buffer
size to mailbox api rather than actual string
length. Resulting in KASAN detecting an out of
bound issue. Fix this by calculating the string
length, and passing that in.

CRs-Fixed: 3876948
Change-Id: I7d9be5466ca5bec81e181f47e278205d6d9a64ce
2024-07-31 00:17:30 -07:00
Lin Bai
92b14cc478 cnss2: Return proper value when sending AOP msg
Positive return value from mbox_send_message() should be
treated as success, which indicate the index of
free mbox buffer obtained.

Change-Id: I59b47a3a711468ef233b43c1191217f1f6911c1f
CRs-Fixed: 3878630
2024-07-30 07:45:26 -07:00
Anuj Khera
acef017b76 cnss2: Add support to check if IPA and WLAN share common dma pool
Add support to check if IPA and WLAN share a common dma pool
and based on that take descision to map the rx buffers or not
in IPA use case scenarios

Change-Id: I5d684db1cffc9f04b962cf7bdf0305b7d5e1df23
CRs-Fixed: 3878739
2024-07-25 16:38:52 -07:00
Nijun Gong
bbf4e9cd00 cnss2: wait and cancel dms work before dms deinit
During cnss unload or error quit, cnss_dms_deinit() is called to
perform dms client deinit. When dms sever quit, modem also send event
to cnss to schedule dms client restart with dms_del_server(). The two
processes are asynchronous so qmi_handle_release() may be entered
twice and cause qmi->sock to be used after free.

To avoid this race condition, call cnss_cancel_dms_work() before
cnss_dms_deinit() to guarantee the two processes not run concurrently.

Change-Id: I291c1d0bdead190549dcbbb2c4b7aa65a68196d7
CRs-Fixed: 3875961
2024-07-25 04:09:49 -07:00
Gangadhar Kavalastramath
19a817e565 cnss2: Update the wlan fw name for Genoa
Since PCIE Genoa has separate wlan fw patch for
mission mode(amss.bin) and ftm mode(genoaftm.bin),
but cnss2 platform driver always try to load amss.bin,
which is not feasible. So add this new interface for
cnss2 to get correct driver mode and update the fw
patch name.

Change-Id: I00ef2586dbbf3f732026a0487d240950ccc0a0af
CRs-Fixed: 3864574
2024-07-19 05:24:15 -07:00
Yu Wang
08d917032c icnss2: reject icnss2 driver loading if no matching dt node
On some platforms, those with all of icnss, cnss
and the corresponding wlan drivers being present, but
only one dt node for wlan device, we only need one
platform driver which is compatible with the dt node.

To achieve this, return '-ENODEV' on icnss driver loading
if there is no matching dt node, just as cnss2 does.

This change can also fix the issue as below:
Background: icnss2 returns '-EAGAIN' when wlan driver
register request comes too early, to trigger the retry
mechanism in wlan driver.

Considering a device with drivers and dt node as
mentioned upon, and a wlan driver is trying to
register itself in icnss2 driver. But it will
definitely fail because icnss2 has not been probed
(due to no compatible dt node) and retry for up to
50 times with a 100ms interval due to the return
value '-EAGAIN'. This delays android bootup.

With this fix applied, wlan driver loading will fail
before registering itself to platform driver because
it depends on icnss2 that failed to load.

Change-Id: I8dfe8821c0c8ec45e7e55913de26060a32ffce82
CRs-Fixed: 3867504
2024-07-18 00:35:40 -07:00
Yu Wang
cb5ce9c334 icnss2: return '-EAGAIN' when wlan driver load request comes too early
Sometimes wlan driver loading comes very early, icnss2
driver is not ready at that point and returns '-ENODEV',
which results in wlan failure.

To fix it, icnss2 returns '-EAGAIN' in such case to
trigger the retry mechanism in wlan driver.

Change-Id: Ia9f955622d052842ecd1fe1a752fd20d1e98804c
CRs-Fixed: 3851180
2024-07-01 12:30:17 -07:00
Yu Wang
4365c23bf2 icnss2: refine processing for restart level notification
It's possible that the 'rproc name' doesn't contain
'wpss' when 'rproc_restart_level_notifier()' gets called,
there are two issues in such case:

1. The fixed length 'ICNSS_RPROC_LEN(100)' for strnstr()
is too long for some cases, which may leads to
'slab-out-of-bounds' issue in strnstr().

To fix it, pass strlen of the rproc name instead.

2. It returns without freeing memory for the event data
and results in memory leak.

To fix it, allocate memory for the event only when
the notification is for 'wpss'.

Change-Id: Icf48f2f9cb8b8fcb4b766971169dd6dbeba9839d
CRs-Fixed: 3848536
2024-07-01 12:30:15 -07:00
Lin Bai
3a529ce131 icnss2: Use proper flag for kzalloc
Use proper flag to allocate memory.

Change-Id: Icf6a310c127264c09db8567f53372590cae0e81f
CRs-Fixed: 3838568
2024-06-12 14:19:33 -07:00
Prateek Patil
ae9e2e6bd5 icnss2: Do not send QMI_WLFW_WFC_CALL_STATUS_REQ_V01 msg post WLAN MODE_OFF
Do not send QMI_WLFW_WFC_CALL_STATUS_REQ_V01 msg post WLAN MODE_OFF to
avoid FW crash.

Change-Id: I756b2aeb4241385d4f64f398ca13c8dace78d1b3
CRs-Fixed: 3754244
2024-06-05 02:03:06 -07:00
Lin Bai
e60f66098e icnss2: Add chip serial id in wlfw cap resp
Add support to handle chip serial number in wlfw cap
respone message.

Change-Id: Icf6a310b127264c09db8567f53372590cae0e81f
CRs-Fixed: 3828289
2024-05-30 14:05:04 -07:00
Yu Ouyang
6fc69546c3 cnss2: Restore HSP PCIe link speed to Gen2 after enum
Because HSP may meet pcie link issue if working on Gen3 speed,
auto SPs decide to enum HSP using Gen1, and restore to Gen2 after
enum. We will not restore to default Gen3 speed.

Change-Id: I0d2a2189bcd55e2649d34e7a8d9c18ebbfab86f2
CRs-Fixed: 3821700
2024-05-24 03:08:34 -07:00
Vishal Miskin
0763e26d17 cnss2: Remove hardware secure disable feature for anorak61
Remove hardware secure disable feature for anorak61

Change-Id: I17e5cfeac5f66863292cdefbe605b446d1093b1b
CRs-Fixed: 3815352
2024-05-20 08:54:11 -07:00
Lin Bai
b10b901045 cnss2: Add smem-mailbox support for legacy compiler
Add smem-mailbox support for legacy compiler.

Change-Id: I854dc7d2b346f497cf88fb6e89f9e3b7096fd8d5
CRs-Fixed: 3808932
2024-05-10 14:07:07 -07:00
Yu Wang
11b4ce58de cnss2: Add support for additional regulator
Add support for regulator: 3.3V M.2, to enable
it based on the entry in device tree.

Change-Id: I4716b9ad6fb6d116342ef0aa9157989f9dfbf152
CRs-Fixed: 3795246
2024-05-08 03:33:52 -07:00
Lin Bai
9f7b3760d2 icnss2: Enable S1J for volcano
Enable S1J for volcano.

Change-Id: I6da9d1654607dd57e66b76f6925b424953ec8a3c
CRs-Fixed: 3754364
2024-05-07 20:10:06 -07:00
Jayachandran Sreekumaran
92d5d3faf6 cnss2: dump_enabled need to be checked before invoking qcom_dump
Dump_enabled need to be checked before invoking qcom_dump for
pushing the Wlan FW dump to file system. Otherwise SSR gets stuck.

CRs-Fixed: 3805707
Change-Id: I7bd5d0579f71c1b3fa88fc41cd274bc8f432dab5
2024-05-07 06:47:47 -07:00
Vishal Miskin
8ac798203c cnss2: enable cnss2 for anorak target
- Add defconfigs for consoilidated and GKI variants.
- Add anorak target to wlan bazel config.

Change-Id: Ic5b4e156b6af63e5b46217fa9e917929c1521294
CRs-Fixed: 3792481
2024-04-29 14:40:50 -07:00
Yu Wang
0500077d51 cnss2: modify return value of API for resuming PCIe bus
PCI bus resuming should be treated as fail once MHI
resume fails, to avoid the following operations those
depend on the result.

Change-Id: If3d21abf95cc2816bf6c34cb950ff430eee022d3
CRs-Fixed: 3795957
2024-04-26 08:32:51 -07:00
Yu Wang
6368e826b3 icnss2: enlarge maximum length for filtering rproc name
The remote proc name for wpss on volcano is
'9bb00000.remoteproc-wpss', the restart level changing
on which will be ignored by icnss platform driver
unexpectedly due to the maximum length for filtering the
name is too short.

To fix it, enlarge this maximum length to 100 bytes
according to implementation of remote proc.

Change-Id: I42148cb2f8d0821521acf06e5f54d4ebaf439985
CRs-Fixed: 3794773
2024-04-25 03:10:07 -07:00
Nirav Shah
085c1c4748 cnss2: Add support for async data QMI indication
Add support for async data QMI indication from
firmware.

Change-Id: I957e5b219d19f7a531dd25133a05da64857d068d
CRs-Fixed: 3782100
2024-04-20 09:12:59 -07:00
Nirav Shah
6cb33ae73f cnss_utils: Add QMI indication to send async indication
Add QMI indication to send async data from wlan firmware
to wlan driver.

Change-Id: I769ba51890087e812f8d58b8d4f4143d4b8fd420
CRs-Fixed: 3781857
2024-04-20 09:12:58 -07:00
Yu Ouyang
e2eff914bc cnss2: Avoid to call NULL plat_env
For dual chip solution, first chip may fail to probe because of pcie
driver is not ready. During second chip probing, first chip may retry
to probe. So, second chip may set/get plat_env[0], first chip may
set/get plat_env[1].

If sencond chip not attached, plat_env[0] will be cleaned. When
cnss_pci_probe() is called by first chip, cnss_get_plat_priv_by_rc_num()
will call plat_env[0]. However it is already NULL.

Change-Id: Ib959b1a524bf777fc6a826b2771611cb28b8cb99
CRs-Fixed: 3778085
2024-04-17 00:02:46 -07:00
Dundi Raviteja
5ca3f8b383 icnss2: Add new API to validate smp2p state
Checking smp2p_state using IS_ERR_OR_NULL returns true every time
for Adrastea based targets.

So add a new API to validate smp2p state which returns true only
if the device id is WCN6750_DEVICE_ID or WCN6450_DEVICE_ID or
wpss_supported is enabled.

Change-Id: I01237d9e7b47dd666a4987920ca73a3f8f584c87
CRs-Fixed: 3758894
2024-04-03 14:52:39 -07:00
Prateek Patil
08ec0c895d icnss2: Collect msa0 ramdump only at the time of crash
This change will collect msa0 ramdump only at the time of crash.

Change-Id: I5dd9b039ea7696a0dcccb56a4a3133fb77a16d63
CRs-Fixed: 3767055
2024-04-03 05:22:41 -07:00
Lin Bai
ab727e3454 cnss2: Fix compilation failure due to u64 print format
Use %llx instead of %lx for u64 print.

Change-Id: Icf6a310a128264c09db8567f53372590cae0e81f
CRs-Fixed: 3754364
2024-04-02 00:19:22 -07:00
Sandeep Singh
561a25b797 cnss_utils: update platform side qmi service file
Add serial id, SW_CTRL_GPIO in platform driver side
qmi service file.

Change-Id: If94ea3333c564483e5dfbd79fbcb14d1e9f51a75
CRs-Fixed: 3762111
2024-04-01 09:04:43 -07:00
Sandeep Singh
f6e67cd993 icnss2: Add cmem support for wcn7750
Add cmem support for wcn7750 and pass the mem info
as part of soc info to wlan host driver.

Change-Id: Icb40d8cfe50cdd160471b8210a67ce9dc8dd3ad0
CRs-Fixed: 3750961
2024-03-29 19:07:07 -07:00
Yu Wang
b6c97a4162 cnss2: refine the code for AOP configuration
The Mbox interface requires structure 'qmp_pkt' which is defined
only when kernel config CONFIG_MSM_QMP is enabled, so add
conditional compilation for these interfaces (controlled by
config CONFIG_MSM_QMP).
While at the same time, qmp_get/qmp_put/qmp_send are controlled
by kernel config CONFIG_QCOM_AOSS_QMP, but they are defined
even when CONFIG_QCOM_AOSS_QMP is disabled, so conditional
compilation is not needed.

Change-Id: I0f793ae3661fb901edc857af0b1d4191d7c113f8
CRs-Fixed: 3712102
2024-03-27 03:10:20 -07:00
Yu Wang
6d219d7a90 cnss2: modify the checking for Secure HW feature disabled case
qcom_smem_get() returns 'ERR_PTR(ENODEV)' when Secure HW feature
is not enabled (related kernel config: CONFIG_QCOM_SMEM), add
the checking for this case.

Change-Id: Id3c6f8407a4eb4bc2124014503cc50bb99e90235
CRs-Fixed: 3769852
2024-03-27 03:10:17 -07:00
Yu Wang
f554c1a9b4 cnss2: Add wrapper to get SoC info before registering MHI controller
Add wrapper __cnss_get_mhi_soc_info() to get SoC info
before registering MHI controller.
It calls mhi_get_soc_info() if downstream MHI bus driver
is enabled(CONFIG_MHI_BUS_MISC is enabled), while reads
register for SoC hardware version directly if not.

Change-Id: I97e53bf0a7e28b2b1027d8de5eaf9fc82bcd5cee
CRs-Fixed: 3712133
2024-03-27 03:10:14 -07:00
Yu Ouyang
05dba07d27 Revert "cnss2: restore to gen2 speed for qca6490"
This reverts commit I55d554c4dc7d01ed82fffe79f666b340b1004765.
Default RC speed should be restored, shouldn't be restored to Gen2.

Change-Id: I23369aea1391c9e20c7aabe10506a7c9c37a4ba7
CRs-Fixed: 3702776
2024-03-26 08:57:24 -07:00
Lin Bai
7b9d7b465a cnss2: Add chip serial id in wlfw cap resp
Add support to handle chip serial number in wlfw cap
respone message.

Change-Id: Icf6a310a127264c09db8567f53372590cae0e81f
CRs-Fixed: 3754364
2024-03-26 08:57:22 -07:00
Lin Bai
7e31c686ad cnss2: Add memory type for seg CALDB DDR
When FW supports segment CALDB memory in memory request,
it will request memory with new type
QMI_WLFW_MEM_CALDB_SEG_V01.

Change-Id: I84b62436ea2616cb2d663c604ac4af8a8d9966b8
CRs-Fixed: 3763980
2024-03-22 04:17:04 -07:00
Prateek Patil
d346d95866 cnss2: Add usage for debug interfaces
The below debug interface usages are added:
1. assert_host_sol
2. deassert_host_sol
3. dev_check
4. dev_enable

Change-Id: I42aaca7f90239d67bb0c9317b5651751cec5f236
CRs-Fixed: 3758776
2024-03-20 08:31:46 -07:00
Prateek Patil
e409b8c5d2 icnss2: Remove __GFP_DIRECT_RECLAIM flag to claim memory faster
To avoid watchdog bark in 10s timeout due to compaction latency in very
bad fragmentation situation, Remove __GFP_DIRECT_RECLAIM flag to kzalloc
to avoid delay, which will help to claim memory faster.

Change-Id: I9d57e28c6e94dbd5cf02aaa9c6f84fe4b60fe36d
CRs-Fixed: 3746405
2024-03-08 05:57:00 -08:00
Dundi Raviteja
47ca780fca icnss2: Enable slate config for monaco
Enable SLATE_MODULE_ENABLED config for monaco.

Change-Id: Icb0b3f14d84a143bafe85fb5413a7406a087dfc5
CRs-Fixed: 3743739
2024-03-03 17:22:16 -08:00
Yeshwanth Sriram Guntuka
e488d6bdfb cnss2: Add support to determine Audio shared IOMMU group
Add support to determine if CNSS and Audio share
IOMMU group and do iommu_map/unmap only in the
case of distinct iommu groups for direct link
datapath.

CRs-Fixed: 3714345
Change-Id: I6134e9d732052fd492e0f20d538e86ba96c14c4d
2024-02-26 04:21:10 -08:00
Naman Padhiar
a7e715c312 cnss_utils: Add QMI message Soft SKU information
Add QMI request containing Soft SKU license address
and size. WLAN FW gets this request and downloads
license from host memory to FW memory.

Change-Id: Ice3fcf99806232669f89c44603caa2fa4c89e076
CRs-Fixed: 3735666
2024-02-19 12:46:45 -08:00
Jia Ding
fbe33f423c cnss2: Fix potential TME NULL pointer dereference
Fix potential NULL pointer dereference for tme_lite_mem
and tme_opt_file_mem, which are captured by static
analysis tool.

Change-Id: Ib2540669c55e771598dd21d8c2ae3eb297ffa67f
CRs-Fixed: 3716873
2024-02-18 03:25:47 -08:00
Sandeep Singh
33c6ef08af icnss2: add null check in icnss driver code
Add null check in icnss driver code.

Change-Id: Ic15e76f9c8dc09d76f2786aaa374698228cb6134
CRs-Fixed: 3718108
2024-02-12 18:56:49 -08:00
Naman Padhiar
36aaccd887 cnss2: Clear DRV last connected flag at right place
DRV last connected flag is cleared based on return from
host driver runtime_resume callback. In host triggered
SSR case runtime_resume callback return success without
actually resuming the bus and clearing DRV last connected
flag. When CNSS driver actually tries to resume the bus,
based on DRV last connected flag it calls MHI resume instead
of MHI DRV resume and fail to resume the bus. Bus resume
failure results in MHI driver go to bad state and fail to
trigger RDDM in device using SYS_ERR.
Fix this issue by clearing DRV last connected flag only after
bus resume is success.

Change-Id: Ia904f6965c2a2cbe0a483cf02ced91a09775ca62
CRs-Fixed: 3720847
2024-02-12 15:09:19 -08:00
Mohammed Ahmed
b02f8575e8 cnss_utils: add smem-mailbox APIs
Add smem_mailbox start, stop, and write API usage.

Change-Id: Ie284b0df439bb3181168b3bdb2e532daf593a951
CRs-Fixed: 3723643
2024-02-11 09:43:56 -08:00
Sandeep Singh
26a92221c3 icnss2: enable rproc_recovery_set vendor hook compilation
Enable rproc_recovery_set vendor hook compilation for
icnss2 platform driver with 6.5 kernel.

Change-Id: Iaf1cb736af410ef61fc83d1c9da5fe7ab419b9f1
CRs-Fixed: 3718268
2024-02-11 09:43:55 -08:00
Naman Padhiar
8f70367411 cnss2: Start Device RDDM timer after Host REQ
For the cases where SOL is not enabled, Host REQ
reset will be used for second RDDM entry. If Host
REQ reset is success, start RDDM timer to wait for
RDDM status callback from MHI. If RDDM timer get
timedout read EE register to check for RDDM state
and schedule recovery.

Change-Id: I34253526ff4b20aedf8ab8f1f49831f68a3e0a35
CRs-Fixed: 3727389
2024-02-10 11:46:14 -08:00
Naman Padhiar
e38803e8a0 Revert "cnss2: loads different fw binary per running mode"
This reverts Change-Id I848309440fdffd6517463e18190c03c1b7ed9269.

Reason for revert: Separate FW Binary not required

Change-Id: Ib694d38922f81895ce6bc01f4e38f95813625730
CRs-Fixed: 3726340
2024-02-10 11:46:13 -08:00
Sandeep Singh
d63fcc180d icnss2: refractor chain1 regulator voting
Refractor chain1 regulator voting.

Change-Id: I151de783bdc8518290b7069432f5b71d626d5e3e
CRs-Fixed: 3715778
2024-02-01 13:11:25 -08:00
Karthik Kantamneni
0df07c1ee9 cnss2: Add API to get Audio dev direct link cap
Currently cnss_get_fw_cap is checking both FW and Audio cap
to enable direct link, add new API to check audio node available
for direct link. So that this API can be queried when direct link
is being used.

Change-Id: Ic2032b338da74021f2b6c483c9480f185554f2d5
CRs-Fixed: 3711887
2024-01-31 11:57:58 -08:00