Commit grafiek

209 Commits

Auteur SHA1 Bericht Datum
Naman Padhiar
0e4171f329 cnss2: Initialize completion event at right place
CNSS2 registers PCI event callback for wake irq from
PCI driver. When callback is called CNSS2 completes
wake_event to notify the waiting threads. Currently,
initialization of wake_event completion is done after
PCI event callback registration causing issue when
PCI even callback for wake irq is called before wake_event
completion could initialize.

Initialize wake_event completion before PCIe event callback
registration.

Change-Id: If8c6ca5a5d5de5fc903b479d6d32ac0e5349f069
CRs-Fixed: 3648865
2023-11-12 15:22:29 -08:00
Yu Ouyang
34e74266d2 cnss2: Genoa window enable bit set wrong
Genoa window enable bit should be set before function writel_relaxed.

Change-Id: I7592e3975fad76c5232377cc51a9c4906a90aab6
CRs-Fixed: 3646876
2023-11-07 05:06:10 -08:00
Meng Yuan
6bb3f633f3 cnss2: Add PCIe's link resume failed event
Add BUS_EVENT_PCIE_LINK_RESUME_FAIL type to bus event type.

Change-Id: If13f53ed9f2c6968eed5e11343cc493e740d82bd
CRs-Fixed: 3646812
2023-11-04 04:41:19 -07:00
Xiaoning Ma
cd3b976590 cnss2: Fix compilation error when CONFIG_MSM_QMP is not enabled
'qmp' is not defined in 'struct cnss_plat_data' when CONFIG_MSM_QMP
is not set, use 'use_direct_qmp' to check if 'qmp' is configured
or not.

Change-Id: If8f822a3bb1acfe10ecf175f742f3f5abd5f7df7
CRs-Fixed: 3647012
2023-10-26 19:21:41 -07:00
Chaoli Zhou
3350d6f679 cnss2: Add logic to support hang data for GNO
Support hang data enabled for genoa.

Change-Id: I93ac07159cddf067aa5f74bd26c9420f48d31710
CRs-Fixed: 3646227
2023-10-26 19:21:40 -07:00
Naman Padhiar
d897e63881 cnss2: Remove wlan-connection-roaming INI download
Remove QMI message to download wlan-connection-roaming.ini
file to FW. This way, for all the OEMs, we would not download
any of this file. Separate change will be raised to download this
files with invalid character check in CNSS2 platform driver and
maintained as hot fix.

Change-Id: Id9f990751d30f28d2d1aac180c24cb6d673e1205
CRs-Fixed: 3640676
2023-10-20 03:45:02 -07:00
Yu Wang
da6fe13a18 cnss2: free host ramdump device properly
As per description of device_add(), never directly free
a device after calling device_add(), should always
use put_device() to give up the reference and free it
in callback function 'release' if it's required.

Change-Id: I5b07b49bcf2e2af6994c05ef038deebc92a825b7
CRs-Fixed: 3637349
2023-10-17 21:38:54 -07:00
Prateek Patil
20021f2826 cnss2: Print sw_ctrl_gpio value setting pci_link up fails
This change will print sw_ctrl_gpio value during pci_link up fails.

Change-Id: Ifc92f52911e64b69ba80787763de0b5d1e15c217
CRs-Fixed: 3641068
2023-10-17 21:38:53 -07:00
Naman Padhiar
b031b47122 cnss2: Release rddm_complete wait during default recovery
Currently Host driver calls cnss_force_collect_rddm API
to trigger RDDM and wait for dump collection. If device
fails to move to RDDM, CNSS driver initiate DEFAULT recovery
(which is recovery without RDDM dump collection) and return
failure to Host driver. Host driver sees error and again try
recovery which results in double recovery.
To avoid this issue, return success to Host driver if
CNSS driver has already initiated the DEFAULT recovery
and release rddm_complete wait event for DEFAULT recovery
cases also.

Change-Id: Ib4b324704d15b40ec98985745b1981522b3b4f2d
CRs-Fixed: 3627928
2023-09-29 23:47:19 -07:00
Naman Padhiar
b791c15d0c cnss2: Optimize link down recovery sequence
Remove unwanted delay from PCIe link down recovery sequence
1. Wait for wake event from PCIe driver instead of hardcoded wait.
2. After link recovers, wait for device to move to RDDM mode
   instead of starting rddm timer.
3. If device fails to move to RDDM, assert HOST SOL and initiate
   side band recovery.

Change-Id: I5a4096ac781dd8f5011b07b0ffb669815a968570
CRs-Fixed: 3590419
2023-09-24 19:07:57 -07:00
Sai Kumar Kunchala
d0fbd9bae5 cnss2: enable cnss2 for Niobe target
- Add defconfigs for consoilidated and GKI variants.
 - Add Niobe target to wlan bazel config.

Change-Id: Id6f57de324bf1c89a521236373cdbc61e453b492
CRs-Fixed: 3614358
2023-09-20 20:10:50 -07:00
Amit Mehta
600b1dfc1c cnss2: Add DP rings to host SSR dump
Add DP rings to host SSR dump.

Change-Id: I6e2462085ee41e60cfd2e5772f03d081af86617f
CRs-Fixed: 3604908
2023-09-20 07:11:26 -07:00
Naman Padhiar
a883a8f321 cnss2: Protect PCI bus resume with mutex lock
Race condition seen between WAKE interrupt handler
and HOST triggered recovery. Due to the race PCI
link up is called back to back. Protect PCI bus
resume with bus_lock mutex.

Change-Id: Ifc140921bdf803bc2d46365b4e5a59cba34ee715
CRs-Fixed: 3614970
2023-09-16 14:13:57 -07:00
Mohammed Ahmed
e1dd6c2585 cnss2: cnss changes for sun compilation
Current code has compilation errors
when compiling for sun. sched_clock()
was moved to clock.h, and iommu_map API
was changed with new sun kernel. Fix
this by updating code for new kernel
apis.

Change-Id: I77029fcc74142f3f650dc289c8d19c121eba6445
CRs-Fixed: 3603129
2023-09-14 15:14:49 -07:00
Mohammed Ahmed
e144f654b8 cnss2: Add config files for sun compilation
Current code does not contain config files
required for sun compilation. Fix this
by adding sun config files.

Change-Id: I130e6d9f16e36335a0acc52f98715cab622ef8b4
CRs-Fixed: 3603141
2023-09-14 15:14:48 -07:00
Nijun Gong
e921bad259 cnss2: restore to gen2 speed for qca6490
There is known pcie linkdown issue for qca6490 if gen3 speed is used.
Previous solution is to downgrade to gen2 before enumeration, but it
doesn't work if platform support multiple wlan chips where device id
can't be determined until enumeration success.

The fix is:
1, Enumerate all devices with gen1 speed
2, When enumeration done, restore to gen2 if device is qca6490

Change-Id: I55d554c4dc7d01ed82fffe79f666b340b1004765
CRs-Fixed: 3612384
2023-09-13 04:22:26 -07:00
Nijun Gong
744c0f19d7 cnss2: use disable_irq_nosync for rome linkdown
When PCIE linkdown happen, IRQ handler will disable IRQ line then
trigger SSR. disable_irq() is used but it introduce sleep in IRQ
context(unexpected). Crash will happen if CONFIG_SCHED_WALT is set:
	android_rvh_schedule_bug+0x4/0x8
	__might_sleep+0x50/0x84
	synchronize_irq+0x48/0xc4
	disable_irq+0x70/0x9c
	cnss_pci_handle_linkdown+0x1a8/0x1c0 [cnss2]
	cnss_pci_event_cb+0x148/0x348 [cnss2]
	msm_pcie_notify_client+0x110/0x180
	msm_pcie_handle_linkdown+0x2d8/0x2f8
	handle_global_irq+0x464/0x5dc

To avoid this issue, should use disable_irq_nosync(), which doesn't
wait IRQ handler to finish. It should introduce no side effect, as
the whole device will be restated later by SSR.

Change-Id: I5ec96d41337a14280333ab9fea0c1f6132a532af
CRs-Fixed: 3548604
2023-09-08 04:11:00 -07:00
Alan Chen
696ac36d11 cnss2: Create new infrastructure for removing sysfs group
Up until kernel 6.1, devm_device_remove_group() was used when
removing sysfs group. From kernel 6.2 onwards,
devm_device_remove_group() is no longer supported. Thus, create
new functions that replicate original functionality of
devm_device_remove_group().

Change-Id: If3a7b380a03eec5a3f918b5a0813830c3136fd1f
CRs-Fixed: 3601923
2023-09-02 09:03:06 -07:00
Prateek Patil
5d5c769c28 cnss2: include qcom_aoss.h file at correct place
There may be multiple time inclusion of inline definition of the
APIs defined in the header file qcom_aoss.h if config
CONFIG_QCOM_AOSS_QMP is disabled for underlying target.
This may result in linking error. Move the header file to the correct
place in power.c.

Change-Id: I5c79eff3be4c758db1ab313843b36a02ecccbef9
CRs-Fixed: 3603827
2023-09-01 07:02:24 -07:00
Naman Padhiar
e9066ddd35 cnss2: Add SMEM based Secure Peripheral check
Check secure peripheral HW state using SMEM APIs instead of
SCM APIs.

Change-Id: I3e652859189221d3b9d26bd2e71e254edf6843b0
CRs-Fixed: 3601121
2023-08-31 21:46:39 -07:00
Reut Zysman
0efc799a87 cnss2: Add securemsm-kernel uapi path
Add securemsm-kernel uapi path to
makefile, since smcinvoke.h is moving.

Change-Id: Ic44f31e2050bfd09400da312250029ab732ff0e1
CRs-Fixed: 3562598
2023-08-10 11:18:15 -07:00
Naman Padhiar
6f7e807fb9 cnss2: Move repetitive logs to cnss-long IPC logs
Move trivial repetitive logs from cnss IPC logs to
cnss-long IPC logs. This will reduce the chances of
losing important logs required for debug.

Change-Id: I9cfe76614603d5fb9b3e5d4a2f062abbb7fa754f
CRs-Fixed: 3580107
2023-08-09 01:01:30 -07:00
gaolez
ac9fb6837b cnss2: Refine the pci power setting log
In current implementation, the error log not record the
return value of setting pci power function, with this return
value we can know the reason of why setting pci power failed.

Change-Id: Icf1fdba16faf539334704ca1f8ce24fecd49aa94
2023-07-24 15:51:36 -07:00
Zhiwei Yang
f0a7661f00 cnss2: Dump event desc history when SSR occurs
Dump hif_event_desc_history and hif_ce_desc_history_buff
when SSR occurs.

Change-Id: I3c115e1d6b35107e4f97f442a51bd50f50bd79ae
CRs-Fixed: 3553092
2023-07-23 17:09:05 -07:00
Naman Padhiar
785ec89f2a cnss2: Add logs to identify request_firmware issue
Add logs to identify request_firmware issue while downloading
files to WLAN FW.

Change-Id: Iff09261513650ff3cd61381453c30616fd9b087a
CRs-Fixed: 3567760
2023-07-22 06:40:28 -07:00
Yu Ouyang
7de707a939 cnss2: Trigger pci link to retrain
When feature CNSS2_CONDITIONAL_POWEROFF enabled, wlan chip HST and
HSP will not power off in cnss probe. PCI link will not be triggered
to retrain once CNSS2_ENUM_WITH_LOW_SPEED enabled.

So, add API cnss_pci_link_retrain_trigger() to trigger pci link retrain
when HST and HSP not power off.

Change-Id: I2ba44837a03b09b1ef3cd0c23a780b89ff837740
CRs-Fixed: 3491396
2023-07-21 13:39:53 -07:00
Naman Padhiar
4561632548 cnss2: Complete power_up event on probe failure
Complete power_up event on probe failure to avoid timeout while
waiting for this event during unregister of host driver.

Change-Id: Ie262305ef960ab40cd38b4a695d409eb36fcf0d7
CRs-Fixed: 3565756
2023-07-21 01:16:38 -07:00
Naman Padhiar
1eb85173ef cnss2: Enable debug config only for debug build
Remove CONFIG_CNSS2_DEBUG from GKI config so that debug
config get enabled only for debug builds.

Change-Id: Iebe86b3b3969d7de5d5f65c372f7e6d6aa7aa126
CRs-Fixed: 3565145
2023-07-19 23:14:24 +05:30
Naman Padhiar
c4bc8cea33 cnss2: Add PCI link info to Host Cap QMI message
PCI link info contains maximum link speed and link width
supported by platform. WLAN FW will use supported link
speed to restrict link speed switch upto maximum
supported speed.

Change-Id: Icdf54c8729192faf4966514b57bd826f86652065
CRs-Fixed: 3535790
2023-07-14 03:57:54 -07:00
Naman Padhiar
3e85d50d6d cnss2: Correctly check for WCNSS_MEM_PRE_ALLOC macro
After CNSS2 switched to Bazel based compilation, conditional
compilation macros became same as configs and are enabled
directly from defconfig. Fix macro check in the code for
both 'y' or 'm' to enable code based on the that.

Change-Id: I12ca87c851a7b47af0255716ce1b9f59ad2eb70a
CRs-Fixed: 3553530
2023-07-12 15:39:07 -07:00
Naman Padhiar
c727c5eab9 cnss2: Resume PCI bus before reading registers
In some scenarios, during force FW assert,
cnss_pci_pm_runtime_get_sync might not resume bus.
Make sure PCI bus is resume before accessing.

Change-Id: Ic5c17c3385318dbc739358ac7ccdb148aed1052a
CRs-Fixed: 3540601
2023-07-11 06:52:00 -07:00
Li Feng
4a3ea46b17 cnss2: Set irq vector affinity to CPU0 with VT-d disabled
With VT-d disabled on x86 platform, only one pci irq vector is allocated.
Due to the irq is not freed when suspend, the kernel will migrate irq to
CPU0 if it was affine to other CPU and then allocate a new MSI vector,
which cause the issue about no irq handler for vector once resume since
the driver only configure MSI data once during driver loading.

The fix is to set irq vector affinity to CPU0 before calling request_irq
to avoid the irq migration.

Change-Id: Id366e33113089f50899eb3631db66dcde0999d84
CRs-Fixed: 3550165
2023-07-11 06:52:00 -07:00
Naman Padhiar
4d274cd5af cnss2: Download QDSS config file based on build type
Add build type string to file name. "qdss_trace_config_debug_v<n>.cfg"
for debug build and "qdss_trace_config_perf_v<n>.cfg" for perf build.

Change-Id: I349a6524c7040d88d69ac329604ade9b9ba07318
CRs-Fixed: 3548322
2023-07-07 11:25:15 -07:00
Lin Bai
02c2d4f750 cnss2: Provide platform name if it is required
Provide platform name in host_cap message if
property platform-name-required specified in DTS.

Current platform name is same as device's model name.

Change-id: I8d427602bfc7e6bb5d732fa3e29ff66c965e153b
CRs-Fixed: 3540641
2023-07-05 17:19:30 -07:00
Naman Padhiar
bdd3c6bf67 cnss2: Send QMI message to download TME-L patch
Send QMI message with TME-L patch information to WLAN FW, to
download TME-L patch.

Change-Id: Ieae07c0f761ada45ffcb990b1412654b9c6862b1
CRs-Fixed: 3521187
2023-07-03 09:34:38 -07:00
Alan Chen
2ec2768bfc cnss2: Make changes to support WLAN DDK for all modules
To be in line with upstream changes on bazel, create separate defconfig
files for each module instead.

Change-Id: Ic2c24f8d8c207b51a0a5b4b9d1088601bc91765c
CRs-Fixed: 3539620
2023-06-30 15:26:33 -07:00
Shailendra Singh
6ce40d5c60 cnss2: Update time sync period based on tsf sync start/stop
Add cnss_update_time_sync_period and cnss_reset_time_sync_period to
update time sync period vote sent from wlan driver based on use-case.
CNSS driver stores both wlan driver and sys config time sync period
value and will apply the minimum value of all votes.

Change-Id: I46ad2866bd70aefe121c8a68a9c869e75ffd8345
CRs-Fixed: 3502060
2023-06-07 11:12:47 -07:00
Naman Padhiar
1f5d4ad661 cnss2: Get PM Runtime reference before RDDM trigger
Host triggered force assert can be called asynchronous.
As part of force assert, CNSS dumps few MHI registers and
trigger RDDM asynchronously. There are chances of race between
force assert and runtime suspend.
To fix that take runtime get reference before MHI operations and
runtime put later.

Change-Id: Icef23910587ff280270bdd7c60ad8eba392822e9
CRs-Fixed: 3464127
2023-06-02 16:51:28 -07:00
Chaoli Zhou
7cd9a66ccc cnss2: Change log level for non-critical cases
Change log level from cnss_pr_err to cnss_pr_vdbg for
some non-critial cases.

Change-Id: I66b16afe5327bab77d52a1ba1b5d72fb88c71715
CRs-Fixed: 3509919
2023-06-01 18:16:16 -07:00
Gangadhar Kavalastramath
5eaf0073cc cnss2: Downgrade RC speed to Gen1 for Genoa EP
Some platform PCIe RC impedance can't achieve the target defined in spec.
It will result to Genoa card link down. To WA the issue, downgrade RC speed
to Gen1 for auto Genoa EP. Because the linkdown issue may happen during
enum, and before enumunation we do not know EP device ID, so set init
speed to Gen1, and then restore speed to default for others wifi chip.

The change does not affect Genoa throughput, because Gen1 speed is enough
for Genoa.

Change-Id: Iffdbf8b98a82c200faf11edcdd180213366ed6ca
CRs-Fixed: 3479848
2023-05-25 19:54:57 -07:00
Alan Chen
f4e0145655 cnss2: Add AUX UC download functionality
Add support for AUX UC download functionality if aux support is
indicated by both host and fw.

Change-Id: I3bfbebbb5cdfbbaa350a34378ab2f0809f27affb
CRs-Fixed: 3402104
2023-05-25 19:54:56 -07:00
Sandeep Singh
c32955295b cnss2: move reboot notifier registration after initializing completion
Currently, power_up_complete and cal_complete are getting initialized
after registering for cnss reboot notifier and in cnss reboot
notifier callback we are completing power_up_complete and cal_complete.
In certain cases cnss_reboot_notifier cb getting called before
power_up_complete and cal_complete are getting initialized which
is leading to crash. To avoid these crashes move reboot notifier
registration after initializing completion variables.

Change-Id: Iaf9e925489f4faea621ea40836dcd7330c7b98d2
CRs-Fixed: 3503651
2023-05-22 15:02:57 -07:00
Jeff Johnson
6b432e8d56 cnss_prealloc: Update DDK for cnss_prealloc dependencies
Commit 97303bf330 ("cnss_prealloc: update prealloc mem pool based on
device type") introduced several new dependencies:
- cnss_prealloc has a dependency upon a new header file
  cnss_utils/cnss_common.h
- cnss2 has a dependency upon cnss_prealloc
- icnss2 has a dependency upon cnss_prealloc
- icnss2 has dependency upon cnss_utils and wlan_firmware_service

Add those dependencies to the DDK build rules.
Also add CNSS_OUT_OF_TREE config in icnss2/Kconfig file.

Change-Id: If00eb7623cffb82e02ed0f8001254082f2a19b93
CRs-Fixed: 3495407
2023-05-20 22:20:39 -07:00
Nirav Shah
ac734e4b27 cnss2: Reduce cnss logs as part of QDSS logging
Reduce cnss logs as part of QDSS logging

Change-Id: I851146c482253d8776b762c1d27ffb0f7bc62157
CRs-Fixed: 3499978
2023-05-18 18:53:15 -07:00
Nirav Shah
1e15d131ea cnss2: Add support to configure log level
Add support to configure log level for dmesg and
ipc logging. Default log level is set to DEBUG
for ipc logging and INFO for dmesg logging.
Change default behavior of cnss_pr_dbg and
cnss_pr_vdbg API to not print in dmesg.

Change-Id: I6bb9d0bd297be20e66f563c16bb2f3f9d39d2be6
CRs-Fixed: 3499975
2023-05-19 07:21:53 +05:30
Rajesh Chauhan
90e0212ecc cnss2: Add support for direct QMP to communicate with AOP
Add support for direct QMP to communicate with AOP. There
are two ways to communicate with AOP: mailbox, and direct
QMP. Based on property set in the device tree use either
direct QMP or mailbox to send messages to AOP.

Change-Id: I9fc24f8a483abb3084cda4d85acf2d53e43d9ad8
CRs-Fixed: 3488507
2023-05-11 18:02:05 -07:00
Sandeep Singh
ff9d11362f cnss_prealloc: add wrapper APIs if MEM_PRE_ALLOC flag not enabled
Add wrapper api to avoid compilaton failure if
CONFIG_WCNSS_MEM_PRE_ALLOC flag is not enabled.

Change-Id: Ic0625d68f587c79f38f33495b53645f1d7582144
CRs-Fixed: 3492092
2023-05-11 15:36:42 -07:00
Naman Padhiar
a232234d41 cnss2: Fix MHI state mismatch for MHI INIT
MHI INIT called during host driver registration leads to MHI state
mismatch because MHI is already in INIT state due to power up of
device as part of ongoing self recovery.
To fix this issue, avoid powering up device during recovery if host
driver is not registered. Device would be powered up later during
host driver registration.

Change-Id: I534dfc0e389ba97a6e2c4869d42be5ecff9609b3
CRs-Fixed: 3476947
2023-05-11 15:36:41 -07:00
Naman Padhiar
693e91a938 cnss2: Add support for MSIX interrupts
Read MSI-X address from device tree file and initialize
MSI-X address and data to support MSI-X interrupts.

Change-Id: I7cc43ca4d3e4c937f09facf12dd02437ddc2e039
CRs-Fixed: 3488821
2023-05-11 13:09:23 -07:00
Sandeep Singh
2dee0837c9 cnss2: record timestamps in smmu fault cb handler
Record timestamps in smmu fault cb handler.

Change-Id: I96042ffdc81fcca8069d16bf74899412cf04183c
CRs-Fixed: 3487738
2023-05-08 20:37:48 -07:00