QCN6432 uses MSI vectors, but although it is a PCIe device, it is attached to the WCSS Q6 processor and registered as an AHB platform device. As a result, it does not have a valid ab_pci context while still reusing PCI IRQ APIs. Move ATH12K_PCI_FLAG_MULTI_MSI_VECTORS from ath12k_pci_flags to ath12k_dev_flags so it can be used without relying on PCI-specific context. Rename it to ATH12K_FLAG_MULTI_MSI_VECTORS accordingly. Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.6-01243-QCAHKSWPL_SILICONZ-1 Tested-on: IPQ5332 hw1.0 AHB WLAN.WBE.1.6-01322-QCAHKSWPL_SILICONZ-1 Tested-on: QCN6432 hw1.0 AHB WLAN.WBE.1.6-01322-QCAHKSWPL_SILICONZ-1 Signed-off-by: Aaradhana Sahu --- drivers/net/wireless/ath/ath12k/core.h | 1 + drivers/net/wireless/ath/ath12k/mhi.c | 4 ++-- drivers/net/wireless/ath/ath12k/pci.c | 22 ++++++++++------------ drivers/net/wireless/ath/ath12k/pci.h | 1 - 4 files changed, 13 insertions(+), 15 deletions(-) diff --git a/drivers/net/wireless/ath/ath12k/core.h b/drivers/net/wireless/ath/ath12k/core.h index d87c59f68c12..eaea601ab32d 100644 --- a/drivers/net/wireless/ath/ath12k/core.h +++ b/drivers/net/wireless/ath/ath12k/core.h @@ -278,6 +278,7 @@ enum ath12k_dev_flags { ATH12K_FLAG_QMI_FW_READY_COMPLETE, ATH12K_FLAG_FTM_SEGMENTED, ATH12K_FLAG_FIXED_MEM_REGION, + ATH12K_FLAG_MULTI_MSI_VECTORS, }; struct ath12k_tx_conf { diff --git a/drivers/net/wireless/ath/ath12k/mhi.c b/drivers/net/wireless/ath/ath12k/mhi.c index ee87f00bc5de..56e697fbdad5 100644 --- a/drivers/net/wireless/ath/ath12k/mhi.c +++ b/drivers/net/wireless/ath/ath12k/mhi.c @@ -86,7 +86,7 @@ static int ath12k_mhi_get_msi(struct ath12k_pci *ab_pci) msi_data = base_vector; for (i = 0; i < num_vectors; i++) { - if (test_bit(ATH12K_PCI_FLAG_MULTI_MSI_VECTORS, &ab_pci->flags)) + if (test_bit(ATH12K_FLAG_MULTI_MSI_VECTORS, &ab->dev_flags)) irq[i] = ath12k_pci_get_msi_irq(ab->dev, msi_data++); else @@ -248,7 +248,7 @@ int ath12k_mhi_register(struct ath12k_pci *ab_pci) goto free_controller; } - if (!test_bit(ATH12K_PCI_FLAG_MULTI_MSI_VECTORS, &ab_pci->flags)) + if (!test_bit(ATH12K_FLAG_MULTI_MSI_VECTORS, &ab->dev_flags)) mhi_ctrl->irq_flags = IRQF_SHARED | IRQF_NOBALANCING; mhi_ctrl->iova_start = 0; diff --git a/drivers/net/wireless/ath/ath12k/pci.c b/drivers/net/wireless/ath/ath12k/pci.c index 736e40492b41..e6fe891e58b1 100644 --- a/drivers/net/wireless/ath/ath12k/pci.c +++ b/drivers/net/wireless/ath/ath12k/pci.c @@ -341,13 +341,12 @@ static void ath12k_pci_free_irq(struct ath12k_base *ab) static void ath12k_pci_ce_irq_enable(struct ath12k_base *ab, u16 ce_id) { - struct ath12k_pci *ab_pci = ath12k_pci_priv(ab); u32 irq_idx; /* In case of one MSI vector, we handle irq enable/disable in a * uniform way since we only have one irq */ - if (!test_bit(ATH12K_PCI_FLAG_MULTI_MSI_VECTORS, &ab_pci->flags)) + if (!test_bit(ATH12K_FLAG_MULTI_MSI_VECTORS, &ab->dev_flags)) return; irq_idx = ATH12K_MSI_IRQ_CE0_OFFSET + ce_id; @@ -356,13 +355,12 @@ static void ath12k_pci_ce_irq_enable(struct ath12k_base *ab, u16 ce_id) static void ath12k_pci_ce_irq_disable(struct ath12k_base *ab, u16 ce_id) { - struct ath12k_pci *ab_pci = ath12k_pci_priv(ab); u32 irq_idx; /* In case of one MSI vector, we handle irq enable/disable in a * uniform way since we only have one irq */ - if (!test_bit(ATH12K_PCI_FLAG_MULTI_MSI_VECTORS, &ab_pci->flags)) + if (!test_bit(ATH12K_FLAG_MULTI_MSI_VECTORS, &ab->dev_flags)) return; irq_idx = ATH12K_MSI_IRQ_CE0_OFFSET + ce_id; @@ -427,13 +425,13 @@ static irqreturn_t ath12k_pci_ce_interrupt_handler(int irq, void *arg) static void ath12k_pci_ext_grp_disable(struct ath12k_ext_irq_grp *irq_grp) { - struct ath12k_pci *ab_pci = ath12k_pci_priv(irq_grp->ab); + struct ath12k_base *ab = irq_grp->ab; int i; /* In case of one MSI vector, we handle irq enable/disable * in a uniform way since we only have one irq */ - if (!test_bit(ATH12K_PCI_FLAG_MULTI_MSI_VECTORS, &ab_pci->flags)) + if (!test_bit(ATH12K_FLAG_MULTI_MSI_VECTORS, &ab->dev_flags)) return; for (i = 0; i < irq_grp->num_irq; i++) @@ -462,13 +460,13 @@ static void __ath12k_pci_ext_irq_disable(struct ath12k_base *ab) static void ath12k_pci_ext_grp_enable(struct ath12k_ext_irq_grp *irq_grp) { - struct ath12k_pci *ab_pci = ath12k_pci_priv(irq_grp->ab); + struct ath12k_base *ab = irq_grp->ab; int i; /* In case of one MSI vector, we handle irq enable/disable in a * uniform way since we only have one irq */ - if (!test_bit(ATH12K_PCI_FLAG_MULTI_MSI_VECTORS, &ab_pci->flags)) + if (!test_bit(ATH12K_FLAG_MULTI_MSI_VECTORS, &ab->dev_flags)) return; for (i = 0; i < irq_grp->num_irq; i++) @@ -626,7 +624,7 @@ static int ath12k_pci_ext_irq_config(struct ath12k_base *ab) static int ath12k_pci_set_irq_affinity_hint(struct ath12k_pci *ab_pci, const struct cpumask *m) { - if (test_bit(ATH12K_PCI_FLAG_MULTI_MSI_VECTORS, &ab_pci->flags)) + if (test_bit(ATH12K_FLAG_MULTI_MSI_VECTORS, &ab_pci->ab->dev_flags)) return 0; return irq_set_affinity_and_hint(ab_pci->pdev->irq, m); @@ -762,7 +760,7 @@ static int ath12k_pci_msi_alloc(struct ath12k_pci *ab_pci) PCI_IRQ_MSI); if (num_vectors == msi_config->total_vectors) { - set_bit(ATH12K_PCI_FLAG_MULTI_MSI_VECTORS, &ab_pci->flags); + set_bit(ATH12K_FLAG_MULTI_MSI_VECTORS, &ab->dev_flags); ab_pci->irq_flags = IRQF_SHARED; } else { num_vectors = pci_alloc_irq_vectors(ab_pci->pdev, @@ -773,7 +771,7 @@ static int ath12k_pci_msi_alloc(struct ath12k_pci *ab_pci) ret = -EINVAL; goto reset_msi_config; } - clear_bit(ATH12K_PCI_FLAG_MULTI_MSI_VECTORS, &ab_pci->flags); + clear_bit(ATH12K_FLAG_MULTI_MSI_VECTORS, &ab->dev_flags); ab->msi.config = &msi_config_one_msi; ab_pci->irq_flags = IRQF_SHARED | IRQF_NOBALANCING; ath12k_dbg(ab, ATH12K_DBG_PCI, "request MSI one vector\n"); @@ -1152,7 +1150,7 @@ int ath12k_pci_start(struct ath12k_base *ab) set_bit(ATH12K_PCI_FLAG_INIT_DONE, &ab_pci->flags); - if (test_bit(ATH12K_PCI_FLAG_MULTI_MSI_VECTORS, &ab_pci->flags)) + if (test_bit(ATH12K_FLAG_MULTI_MSI_VECTORS, &ab->dev_flags)) ath12k_pci_aspm_restore(ab_pci); else ath12k_info(ab, "leaving PCI ASPM disabled to avoid MHI M2 problems\n"); diff --git a/drivers/net/wireless/ath/ath12k/pci.h b/drivers/net/wireless/ath/ath12k/pci.h index 47c8760536e4..3097afb03432 100644 --- a/drivers/net/wireless/ath/ath12k/pci.h +++ b/drivers/net/wireless/ath/ath12k/pci.h @@ -100,7 +100,6 @@ enum ath12k_pci_flags { ATH12K_PCI_FLAG_INIT_DONE, ATH12K_PCI_FLAG_IS_MSI_64, ATH12K_PCI_ASPM_RESTORE, - ATH12K_PCI_FLAG_MULTI_MSI_VECTORS, }; struct ath12k_pci_ops { -- 2.34.1