generic: replace simple AQR hack patch with upstream version
[openwrt/staging/jow.git] / package / kernel / mac80211 / patches / ath11k / 0017-wifi-ath11k-fix-boot-failure-with-one-MSI-vector.patch
1 From 39564b475ac5a589e6c22c43a08cbd283c295d2c Mon Sep 17 00:00:00 2001
2 From: Baochen Qiang <quic_bqiang@quicinc.com>
3 Date: Thu, 7 Sep 2023 09:56:06 +0800
4 Subject: [PATCH] wifi: ath11k: fix boot failure with one MSI vector
5
6 Commit 5b32b6dd96633 ("ath11k: Remove core PCI references from
7 PCI common code") breaks with one MSI vector because it moves
8 affinity setting after IRQ request, see below log:
9
10 [ 1417.278835] ath11k_pci 0000:02:00.0: failed to receive control response completion, polling..
11 [ 1418.302829] ath11k_pci 0000:02:00.0: Service connect timeout
12 [ 1418.302833] ath11k_pci 0000:02:00.0: failed to connect to HTT: -110
13 [ 1418.303669] ath11k_pci 0000:02:00.0: failed to start core: -110
14
15 The detail is, if do affinity request after IRQ activated,
16 which is done in request_irq(), kernel caches that request and
17 returns success directly. Later when a subsequent MHI interrupt is
18 fired, kernel will do the real affinity setting work, as a result,
19 changs the MSI vector. However at that time host has configured
20 old vector to hardware, so host never receives CE or DP interrupts.
21
22 Fix it by setting affinity before registering MHI controller
23 where host is, for the first time, doing IRQ request.
24
25 Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3
26 Tested-on: WCN6855 hw2.1 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3.6510.23
27 Tested-on: WCN6750 hw1.0 AHB WLAN.MSL.1.0.1-01160-QCAMSLSWPLZ-1
28
29 Fixes: 5b32b6dd9663 ("ath11k: Remove core PCI references from PCI common code")
30 Signed-off-by: Baochen Qiang <quic_bqiang@quicinc.com>
31 Acked-by: Jeff Johnson <quic_jjohnson@quicinc.com>
32 Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
33 Link: https://lore.kernel.org/r/20230907015606.16297-1-quic_bqiang@quicinc.com
34 ---
35 drivers/net/wireless/ath/ath11k/pci.c | 24 ++++++++++++------------
36 1 file changed, 12 insertions(+), 12 deletions(-)
37
38 --- a/drivers/net/wireless/ath/ath11k/pci.c
39 +++ b/drivers/net/wireless/ath/ath11k/pci.c
40 @@ -852,10 +852,16 @@ unsupported_wcn6855_soc:
41 if (ret)
42 goto err_pci_disable_msi;
43
44 + ret = ath11k_pci_set_irq_affinity_hint(ab_pci, cpumask_of(0));
45 + if (ret) {
46 + ath11k_err(ab, "failed to set irq affinity %d\n", ret);
47 + goto err_pci_disable_msi;
48 + }
49 +
50 ret = ath11k_mhi_register(ab_pci);
51 if (ret) {
52 ath11k_err(ab, "failed to register mhi: %d\n", ret);
53 - goto err_pci_disable_msi;
54 + goto err_irq_affinity_cleanup;
55 }
56
57 ret = ath11k_hal_srng_init(ab);
58 @@ -876,12 +882,6 @@ unsupported_wcn6855_soc:
59 goto err_ce_free;
60 }
61
62 - ret = ath11k_pci_set_irq_affinity_hint(ab_pci, cpumask_of(0));
63 - if (ret) {
64 - ath11k_err(ab, "failed to set irq affinity %d\n", ret);
65 - goto err_free_irq;
66 - }
67 -
68 /* kernel may allocate a dummy vector before request_irq and
69 * then allocate a real vector when request_irq is called.
70 * So get msi_data here again to avoid spurious interrupt
71 @@ -890,20 +890,17 @@ unsupported_wcn6855_soc:
72 ret = ath11k_pci_config_msi_data(ab_pci);
73 if (ret) {
74 ath11k_err(ab, "failed to config msi_data: %d\n", ret);
75 - goto err_irq_affinity_cleanup;
76 + goto err_free_irq;
77 }
78
79 ret = ath11k_core_init(ab);
80 if (ret) {
81 ath11k_err(ab, "failed to init core: %d\n", ret);
82 - goto err_irq_affinity_cleanup;
83 + goto err_free_irq;
84 }
85 ath11k_qmi_fwreset_from_cold_boot(ab);
86 return 0;
87
88 -err_irq_affinity_cleanup:
89 - ath11k_pci_set_irq_affinity_hint(ab_pci, NULL);
90 -
91 err_free_irq:
92 ath11k_pcic_free_irq(ab);
93
94 @@ -916,6 +913,9 @@ err_hal_srng_deinit:
95 err_mhi_unregister:
96 ath11k_mhi_unregister(ab_pci);
97
98 +err_irq_affinity_cleanup:
99 + ath11k_pci_set_irq_affinity_hint(ab_pci, NULL);
100 +
101 err_pci_disable_msi:
102 ath11k_pci_free_msi(ab_pci);
103