Commit Graph

949 Commits

Author SHA1 Message Date
Shashikala Prabhu
b87eec2b53 qcacmn: Correct the return types of HIF functions
A few functions in HIF component returns QDF status value with return
type as  non QDF STATUS. For such functions, update the return type as
QDF_STATUS.

Change-Id: I69644a2206266ffe2c2d105056f9fec452f5d972
CRs-Fixed: 2734818
2020-07-24 09:21:08 -07:00
Chaoli Zhou
81d4965369 qcacmn: Reduce the ce entries while disable pktlog
If disable pktlog for hasting/genoa, we need to
mark the ce5/ce7 not used separately to save
some memory. But currently, if set target ce
entries to 0, it has wlan fw crash issue,
so reduce it from 32 to 2 first. Once wlan
fw fix the crash issue, and then change to 0

Change-Id: I7ab11f202fe353737a4104e71fc79ee749b80fc8
2020-07-24 07:10:21 -07:00
Balamurugan Mahalingam
8aec8db9ac qcacmn: Avoid configuring mac1 WMI buffers for QCN9000 and IPQ5018
And avoid configuring PKTLOG buffers if REMOVE_PKT_LOG
is defined

Change-Id: I40276f1f1905137cef053f9e552effde05b0240d
CRs-Fixed: 2733547
2020-07-17 21:25:55 -07:00
Kiran Venkatappa
ec5ee77d84 qcacmn: Use QDF_STATUS error code in hif_ahb_enable_bus
hif_ahb_enable_bus returns -EIO, PTR_ERR and QDF_STATUS. PTR_ERR can
return zero for NULL. This will get interpreted as success resulting in
invalid access later. Fix return status to QDF_STATUS so that caller can
cosistently use error codes for error handling.

Change-Id: Ibd4d6e52c930272febf9a8b76bcfd2df4a4a4705
CRs-Fixed: 2726180
2020-07-10 05:38:54 -07:00
Vevek Venkatesan
0b06fc4e7e qcacmn: fix the pointer access before NULL check errors
Fixing the errors of accessing pointer before NULL check.

Change-Id: Idaa4348e2f40b14eb391826cda37b027360fad72
CRs-Fixed: 2726351
2020-07-09 13:43:38 -07:00
Lin Bai
21e9784822 qcacmn: Use sync method to wake device
Use sync wake when trying to awake device for register
accessing.
This can avoid device re-enter low power mode after
device_wake asserted.

Change-Id: Iba62f5753ccb7e11d9746a445db4cce48e5e3a14
CRs-Fixed: 2703609
2020-07-07 07:25:00 -07:00
Vevek Venkatesan
4196b69b64 qcacmn: add Runtime PM HIF changes for ipci interface
Add Runtime PM related HIF changes to enable it for
ipci interface.

Change-Id: I4af91c0e38130281cad3b39e555ec98716d027b8
CRs-Fixed: 2720823
2020-07-06 14:14:04 -07:00
Vevek Venkatesan
168fbbffe7 qcacmn: fix WOW wake up in suspend/resume for Moselle
Fix WOW wake up interrupt from WLAN FW, in system
suspend/resume for Moselle platform.

Change-Id: I5f71c65e0aa1eeef8225f3fcfae5410233df8b78
CRs-Fixed: 2724142
2020-07-03 04:28:26 -07:00
Rakesh Pillai
94c0917f49 qcacmn: Monitor mode improvements
Move the srng history to hif context.

Process the monitor ring only for the lmac
corresponding to the configured monitor channel.

Add the timer and srng history for monitor mode.

Change-Id: I4e5e49ad5e657b55bfafbb40ef5f59496277cb40
CRs-Fixed: 2690530
2020-07-01 07:50:55 -07:00
Debasis Das
a4ea8ba2ec qcacmn: Use 0 as pci_id for kernel version 4.18 and beyond
From kernel version 4.18 onward, the API to fetch pci_id
is deprecated.Assign "0" to pci_id for such case.

Change-Id: Ifb370999402ddc0889d982e251a7f8dea877b17d
2020-06-29 04:59:55 -07:00
Debasis Das
72199d32de qcacmn: Use verion-appropriate kernel API
The API of_get_pci_domain_nr() is deprecated from
kernel version 4.8 onwards.Hence, alternate API should
be used.

Change-Id: I95decbd2a855ec16f013168c8678816c8a017c81
2020-06-24 15:04:48 -07:00
Vevek Venkatesan
f6f4cfc6f2 qcacmn: move runtime_pm related code to common section
Move all the Runtime PM related HIF code changes to the
common section, from if_pci.
So that, could be leveraged for other HIF interfaces
like if_ipci to use.

Change-Id: Id8303acd519ab07f307311971fb55c45476f30bf
CRs-Fixed: 2699419
2020-06-24 03:34:44 -07:00
Karthik Kantamneni
1c487473e3 qcacmn: Use hif_debug to print irq details in hif_pci_configure_grp_irq
Currently hif_info is used for printing irq details
in hif_pci_configure_grp_irq, this may cause excessive
logging so use hif_debug log type instead.

CRs-Fixed: 2696837
Change-Id: I75d79f6040ecb1fe30b2192ce3a34685af5370ab
2020-06-23 13:30:49 -07:00
Vevek Venkatesan
8fb42e2871 qcacmn: replace qdf with hif function for runtime_lock_deinit
Since cds hif context was already NULL at the time of
hif_pm_runtime_close and qdf_runtime_lock_deinit tries to get
cds hif context, replacing it with hif_runtime_lock_deinit
and corresponding hif_runtime_lock_init function.

Change-Id: I6226d15d2930978fdb178624cc0ffd807e9b256c
CRs-Fixed: 2714590
2020-06-23 09:11:18 -07:00
Radha Krishna Simha Jiguru
4aba278b4d qcacmn: Set IRQ_DISABLE_UNLAZY flag for DP interrupts on QCN9000
Since DP interrupts are not disabled at source, and enabled and
disabled only at GIC level, set IRQ_DISABLE_UNLAZY flag to avoid
spurious interrupt detection and avoid interrupt affinity failures.

Change-Id: Ie98d8cba6f93bccd4d508a28bebc216d2b74fe1f
2020-06-12 09:04:24 -07:00
Yeshwanth Sriram Guntuka
874f714a03 qcacmn: Schedule oom_allocation work for SRNG based CE
On nbuf allocation failure in hif_post_recv_buffers_for_pipe
for the last buffer in the CE destination ring, oom_allocation
work is not getting scheduled since there is a mismatch
between the recv_buffers_needed and the num_entries - 1 of the
destination ring.

Fix is to schedule the oom_allocation work for srng
based CE with appropriate check of recv_buffers_needed
and destination ring num_entries.

Change-Id: Ie20d5b21358a401e60776db8a3a8a8644279f1fe
CRs-Fixed: 2705475
2020-06-11 13:08:13 -07:00
Mahesh Kumar Kalikot Veetil
06a2ddeb87 qcacmn: explicitly print "WLAN_SOC_device_id"
The crashdump analysis tool needs a unique print to identify
WLAN SOC type.

Change-Id: I5d2a6f631298be868c3786043477e5d7eed4fe1a
CRs-Fixed: 2696340
2020-06-07 12:29:20 -07:00
Naga
30f07a9dc1 qcacmn: Fix data type for ic_irqnum
ic_irqnum saves the irq number given by platform,
existing max irq which can be saved per ce is 255,
if platform return irq greater than 255, value is
misinterpreted with that saved in a byte, this will
eventually have problem when host driver suspends/stop,
during which freeing irq will fail.

But in scenarios such as IPI mechanisms such as whunt,
since free irq fails, it would still assume irq is enabled
and call registered handlers, which will lead to
null pointer access.

Inorder to fix this changed data type to uint16_t.

Change-Id: I0d92f965462a0a6416ee3dce880c4218e5ab09e8
CRs-Fixed: 2700577
2020-06-03 08:08:11 -07:00
bings
e3fe6fc3c0 qcacmn: proc_create_data support for 5.6+ kernel
One parameter of proc_create_data is changed from struct
file_operations to struct proc_ops.
Add support for it under the kernel version compilation flag.

Change-Id: Ic87222f9c267debef56dcc66fc629854058ffabd
CRs-Fixed: 2666492
2020-06-01 00:04:11 -07:00
Ke Huang
b404458d20 qcacmn: Add NULL pointer check for KW issues
Add NULL pointer check in function hif_send_single() and
htc_dump_counter_info() for KW issues.

Change-Id: I4b020c566b14b28a825c13752dccf67b5f8bb837
CRs-Fixed: 2675205
2020-05-29 03:13:53 -07:00
Jianmin Zhu
0818b326b1 qcacmn: Enable firmware dump when kernel panic for Rome
Firmware dump is necessary to debug host panic issues because
host and firmware are out of sync.
MACRO DEBUG is undefined by default, after remove it,
hif_crash_shutdown->ol_copy_ramdump is called to collect firmware
dump.
Since dump depend on functions in bmi, add MACRO
WLAN_FEATURE_BMI check.

TargetFailure event wont't be received after inject assert due to
irqs disabled, so can't set target RESET state which is checked
when dump IRAM

Change-Id: Ia75f5032a2817e35e4c7e777857b137ba3998ebd
CRs-Fixed: 2682677
2020-05-27 07:04:53 -07:00
Baowei Liu
68487f9c5c qcacmn: Don't destroy uncreated completion_freeq_lock
Sometimes, BMI download FW fail, cause destroy this uncreated spinlock.

Because fw download fail, hif_start() not called, so 
&pipe_info->completion_freeq_lock not be created.But hif_ce_stop() call
qdf_spinlock_destroy(&pipe_info->completion_freeq_lock);Cause WLAN Panic 
@ qdf_lock_stats_cookie_destroy:824: Lock destroyed twice or never created

hif_state->started be set to true in hif_start( )This fixes use 
hif_state->started to judge hif_start() be called or not.If false, 
hif_start() not be called, so needn’t destroy  uncreated 
completion_freeq_lock

Change-Id: Id6aae8024fe9df2ac6cf7976047ebd7a850438e4
2020-05-26 01:40:47 -07:00
Tiger Yu
7d8cf5af55 qcacmn: Fix compiling error when enable HIF_CE_DEBUG_DATA_BUF
Use %zu instead of %lu for type size_t to fix the compiling error
on 32bit system when enable the HIF_CE_DEBUG_DATA_BUF.

Change-Id: Ib11cf7a798514bf654141269b2cafc6fc198a48c
CRs-Fixed: 2688568
2020-05-25 12:34:38 -07:00
Basamma Yakkanahalli
c0b1d0ebf0 qcacmn: use distinct I/O remap to access CE register for ipq5018
In ipq5018 CE registers(0x08400000)  kept outside WCSS(0x0C000000) block.
As both regions are more than 60MB apart, not feasible to allocate
single resource which include both.
So, using a separate I/O region to access CE registers.

Change-Id: I67bb6d5ac82a1c0ed1d3e13f7776f9d69ee19956
2020-05-18 22:33:42 -07:00
Yue Ma
876cc3786b qcacmn: Remove runtime PM usage count check from host driver
There may be a race between the usage count check and pending MHI
activity which may result false panic. Remove this check from host
driver and add it back to platform driver after powering off MHI.

Change-Id: I9a87c596dc1eea5d2242099b870361a62494abcc
CRs-fixed: 2687834
2020-05-17 17:16:16 -07:00
Nandha Kishore Easwaran
18bbaf7484 qcacmn: Add unique irq name per pci slot
Added unique irq name per pci slot so that affinity settings
can be altered as needed. Pci id will be read from dts, and
when there is no entry in dts, default value 0 will be used.
Also for all other target types except qcn9000, default value
0 will be used.

If WLAN_MAX_PDEVS is defined to 1, then always return pci id as
0 since there is only one pdev present

Change-Id: I8159ec8d8daecae687fcc286d620bfe9861dff98
2020-05-13 01:30:37 -07:00
Vevek Venkatesan
516abea104 qcacmn: add HW version and name support for Hastings
Add support for HW version soc id and HW name string
for Hastings and HastingsPrime platform.

Change-Id: I1ba57339b2f9afd425e1ecc9f312ad484340d226
CRs-Fixed: 2681134
2020-05-11 11:44:11 -07:00
Rakesh Pillai
37cc4255e2 qcacmn: Drain group tasklets and reg write work for runtime PM
Currently as part of runtime PM, only the active
tasklets are being drained. For chips eg. QCA6390,
QCA6490 etc, there are grp_tasklets and delayed reg
write work which has to be drained before entering
runtime PM.

Add the logic to drain all the possible tasks
before entering runtime PM.

Change-Id: Ieb486f00fffd7346dcdc1faea6fed5850ef6daf7
CRs-Fixed: 2676000
2020-05-08 20:27:43 -07:00
Basamma Yakkanahalli
b8396604b4 qcacmn: Reduce number of CE to 6 for IPQ5018
Reduce the number of CEs used in IPQ5018 to 6 since it has only
one mac and requires only 6 CEs. CE7 and CE8 are reserved for FW
and not needed to be configured from host.

Change-Id: Ibe262c32d8b3234873391559d939bc198c658c60
2020-05-06 03:10:23 -07:00
Yue Ma
41890f9647 qcacmn: Refine runtime PM usage count checking logic
Commit c81a71e488 ("qcacmn: Cleanup and refine runtime PM open/close
logic") addes the change to align default usage count for both runtime
PM enabled and disabled cases. So active usage count for runtime PM
enable case is 0 and for disabled case is 2. Refine the usage count
checking logic based on that change.

Change-Id: I4e78089760a28d10e6b37bb1a7b2d5242de6c111
CRs-fixed: 2676761
2020-05-06 01:26:48 -07:00
Nirav Shah
e2d6e92a68 qcacmn: Do not vote for PCIe link for QCN7605
Do not vote for PCIe link for QCN7605 to allow PCIe
bus to go to low power mode.

Change-Id: I14e1a5d142497e3cbe8ed12874a428ab7d90afed
CRs-Fixed: 2649897
2020-05-04 00:32:53 -07:00
Vevek Venkatesan
e4a31a803d qcacmn: change logging with spin_lock held to debug level
Change the error level logging which are called by holding
the spin_lock to debug level to avoid printing to console.

Change-Id: If057087e808ed49000eba8b9795397a0cf35a357
CRs-Fixed: 2676235
2020-05-02 15:50:31 -07:00
Alok Kumar
25a79eb0f4 qcacmn: Register WAKE IRQ for QCA6750
Register CE2 IRQ as WAKE IRQ for qca6750

Change-Id: I62517ed09aef6662960c427e075dd3c1c4922783
CRs-Fixed: 2675316
2020-05-02 11:10:13 -07:00
Rajeev Kumar
0dffbe0845 qcacmn: Add validation assert for runtime pm get/put out of sync
As part of HIF runtime PM close add assert to make sure no runtime
PM user has missed any put which may lead to runtime PM getting
disabled at runtime. This assert ensures all runtime PM users
have get and put in sync.

Change-Id: I6663be013e85b8a262ccc0f60c8bd9c59bac25ef
CRs-Fixed: 2665231
2020-05-01 12:49:24 -07:00
Yue Ma
c81a71e488 qcacmn: Cleanup and refine runtime PM open/close logic
Runtime PM code has been refactoring multiple times so some open/close
logic may be duplicated and messed up. Cleanup and refine the logic.
In other to align both runtime PM enable and disable cases, make sure
default usage count is always 2 and sanitize the same when runtime PM
exit. hif_pm_runtime_stop() should always happen from HDD disable power
management APIs so clean it up from hif_pm_runtime_close().

Change-Id: I3b64369608c2d9aa4b3353503c12e0d05a57b592
CRs-fixed: 2666196
2020-04-29 16:03:38 -07:00
Vevek Venkatesan
9043089a40 qcacmn: Add prefetch_timer config for CE rings
Add prefetch_timer configuration for CE rings.
Set prefetch_timer=1 configuration for qca6490 destination CEs,
prefetch_timer=0 configuration for other targets CEs.

Basically setting to 1us asking CE hw to update ring tail pointer to
update within 1us. FW side CE SW sets all rings to 1us already.
Idea behind this change  is, we have seen pre-silicon issue where SRC
ring TP read by SW was not seen updated value when prefetch was set
to 8us. Changing prefetch timer value to 1us helps to resolve
pre-silicon issue.
So host side rings need to update the prefetch timer to 1us.

Change-Id: I0830c73517c29cf39e6b2974bf3faa44e5673741
CRs-Fixed: 2669762
2020-04-28 03:59:18 -07:00
Yeshwanth Sriram Guntuka
ac0322cce9 qcacmn: Set runtime pm state prior to runtime_init
During initialization of driver, the runtime pm usage
count is incremented to 1 when the pm state is NONE.
Runtime get is done as part of htc send packet for
a wmi command in scheduler thread context. In kworker,
runtime_start is processed as part of driver load and
runtime put is done prior to updating the pm state to
ON. Runtime put triggered as part of htc send packet
causes a panic since the state is NONE and usage
count is 1.

Fix is to set runtime pm state to ON prior to doing
a runtime put as part of initialization.

Change-Id: I52cca5240f2f0872c681aab3a58a382f3fa1df0e
CRs-Fixed: 2669029
2020-04-23 14:50:58 -07:00
Nirav Shah
eb3405c26a qcacmn: Disable copy complete interrupt for HTT copy engine
Disable copy complete interrupt for HTT copy engine.

Change-Id: I09510298f873a3bc4ca802a6fed3b7b0e103fd65
CRs-Fixed: 2649845
2020-04-22 14:03:40 -07:00
Alan Chen
528d6ccd70 qcacmn: Add check to avoid panic if FW is down
In order to avoid panic in hif_pci_runtime_pm_warn(), call
qdf_is_fw_down() to check if fw is down. If fw is down, return without
panicking.

Change-Id: I3fd3e0334220c1cf3ae6b3ec3fd5b1ede1705013
CRs-Fixed: 2664133
2020-04-18 13:50:35 -07:00
Nandha Kishore Easwaran
a8c046d68b qcacmn: Change DP interrupt names
Change DP interrupt names to unique values so that
interrupt affinity can be adjusted based on this. This is
similar to what is being done for Copy Engine interrupts.

Change-Id: I7f1789c8c0103e7c01b0a2956a7a37149c7462d1
2020-04-18 05:01:46 -07:00
Hong Shi
5312595f75 qcacmn: enable athdiag access for QCN7605
Currently, athdiag can't work with QCN7605.

Thus made below change to make it work:
1. Skip pci address boundary check for QCN7605 as QCA6390.
2. Make QCN7605 access target memory via QMI.

Change-Id: Ibfcccb57486c99d78c02e322c4e2ae1a7c8dab81
CRs-Fixed: 2653814
2020-04-16 05:37:55 -07:00
Rakesh Pillai
e0464a106c qcacmn: Do not increment tail pointer if no data in CE DST ring
Currently there are cases where the CE status ring
head pointer is incremented, but the corresponding
buffer in the CE DST ring has nbytes as zero. This
can be a possible case where the head pointer was
updated before the DMA copy was completed and before
the nbytes could be updated with the number of bytes
copied to the CE DST ring buffer.In such cases we
haven't processed this entry, and hence should not
increment the tail pointer.

Hence we do not increment the tail pointer if
there was no data in the CE DST ring. Also
enable the logging of CE STATUS RING REAP
even if the CE DST reap was not successful.
This will help identify the cases where the reap
was not successful because of nbytes being zero.

In Success case, the CE desc history will show
STATUS_RING_REAP and DST_RING_REAP events.
In nbytes=0 failure case, the CE desc history will
show STATUS_RING_REAP event with HP moving ahead,
but the TP will not have moved.

Change-Id: Ibc3145142b6c88f6da3e12748d0ac8090486e8e3
CRs-Fixed: 2657285
2020-04-10 00:45:11 -07:00
Nisha Menon
046f3623de qcacmn: Back pressure in REO2SW1 ring resulting in REO panic
Update QCA_NAPI_DEF_SCALE_BIN_SHIFT for defconfig builds to
the same value as the perf build.
Move the WLAN ext irqs to gold cores for defconfig builds.
Disable cpu isolation before moving the IRQs to gold cores.
Add the ability to move IRQs to gold cores when the cpus
hotplug in.

Change-Id: I4cfecd02a1a2200dc99adee9a324b90c877c13fd
CRs-Fixed: 2638820
2020-04-09 05:21:20 -07:00
Jingxiang Ge
55e387e16d qcacmn: Refine description for rtpm function
This is to refine description for some rtpm
function.

Change-Id: I24e078804491203e8a256d80c7b3b14dca8794c7
CRs-Fixed: 2658698
2020-04-08 09:58:43 -07:00
Jingxiang Ge
e7d41574f3 qcacmn: Add dbgid for each runtime put/get
This is to enhance statics for runtime put/get, which is
to detect if there is mismatch for usage_count.

Change-Id: I24cddb9d10e4cb675c8375cbd0f589c7718bd680
CRs-Fixed: 2647972
2020-04-07 01:20:41 -07:00
Yeshwanth Sriram Guntuka
8cf020f44a qcacmn: Add support to register hif recovery notifier
Add support to register hif recovery notifier to log
hang event data.

Change-Id: I7e7ce2bacc88f00e68c2c347c3a578f377f8214f
CRs-Fixed: 2649147
2020-04-03 03:43:06 -07:00
Karthik Kantamneni
765d5e27ed qcacmn: Make DMA coherent mask macro independent of IPA offload
Macro DMA_COHERENT_MASK_IPA_VER_3_AND_ABOVE is used in non
IPA offload case also so bring this macro definition out of
IPA offload feature and change it to DMA_COHERENT_MASK_DEFAULT.

Change-Id: Ib03aa8ae2938e1de1a957660923a711d452a9337
CRs-Fixed: 2649909
2020-04-02 22:16:38 -07:00
Aditya Kodukula
6a4676ec03 qcacmn: HIF_INFO to log the linkstate_vote in hif_main.c
Add HIF_INFO to log the linkstate_vote value in the hif_vote_link_up()
and hif_vote_link_down() functions in order to log the occurences of
the rare event when we vote for link up/down.

Change-Id: I7549b3400977583bd2cd4ec4fcb3f16dd0865ce7
CRs-Fixed: 2648860
2020-04-01 07:36:25 -07:00
Yue Ma
e3c95fdc04 qcacmn: Enhance runtime PM enablement check
Currently HIF runtime PM APIs will check runtime PM enablement using
pm_runtime_enabled() by checking for disable_depth which can be changed
at any time. This may cause usage count imbalance since the HIF API may
skip calling the corresponding runtime PM framework API to increase or
decrease usage count. Enhance runtime PM enablement check so that it
will always honor WLAN ini config first.

Change-Id: I4b2863ef7fa0dcd6fd61b776e6cb0ab109ffb3ec
CRs-fixed: 2647986
2020-03-31 21:03:38 -07:00
Yeshwanth Sriram Guntuka
d3db10ec5b qcacmn: Add support to log ce hang event info
Add hif APIs to support logging of ce hang event
data.

Change-Id: I9b930d5f983d57a7359ba9f97ea65050c4f54a8a
CRs-Fixed: 2649148
2020-03-30 17:11:00 -07:00