Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3625030pxb; Mon, 24 Jan 2022 13:48:27 -0800 (PST) X-Google-Smtp-Source: ABdhPJxm5PZ7IB9yqrbKxFzY4MVeEfVn6wUVIPLh0Kjoq7FVGoaR872jQfuof2GnQaWK86EFvLtf X-Received: by 2002:a17:902:ce8d:b0:14b:562d:2b3b with SMTP id f13-20020a170902ce8d00b0014b562d2b3bmr5389397plg.57.1643060786004; Mon, 24 Jan 2022 13:46:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643060785; cv=none; d=google.com; s=arc-20160816; b=P8ZdTfi49r7JA/fqlpjwjyz4EuCYwCkcgNyIZCdQnYRdz2F0StGyUCslnXcvpb10Xu G+SsJu4wr/EsaMLZq3MiUDUCTv9I4Jbv44xx/+okhYjtMLF/ktd5F60/Cx5uqpn2v+Gg Aq2YJ/lWbPlLMv6tv+/KFbq1svF3NYLliDHCV5ap4bC1ZcjoR3j1kfHDoABYqabXmwJC KWaaw6jpF/m46cb/2prT9QagzYrbxX4LCrMoPwunWE8CQs1mNxqbc7XIsBA83/1bkckD AaXuAcqf9fS3/xFJpd48MCZh/OneOKtE8kRh8icy4lPHhfcEwOvLfA6BypOwcv745a1j jPzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/I1xJGQVrj8r2gLfKp/DiLepGuLNJiaoKpuPNuCztcU=; b=yKBolCNowH//EITYnI/bqqjJXgOfPrXExEh13zhjRT9qyiuBp0CZ/JGmYdiFUg+njh RLaMj9Ub/posrDdS52OlRYhHvDp8tbAfrxt12uPKRZF2yqNVny4ixgivMmtW9UbnzNe4 HiFTc9BijGfS5fPIPQqMO9MzkVPVUpxDypFBnXei2OJuKzbPPk3q4NfJBF9/P0CKb9Ml C7BpjM9ze1YTMqaYQlV2bhbmyA1+5Fku8BjjZ0xcAMdbjOSx8sItT/SThe0lmbWEwxhO FgKpO11vH3qZ10G0GRHXnULswUdi2SH6P9+JNOqtRw3AMibGuDmNUvplPM+jROJmgOZw Yrkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zTpX4xML; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b6si373020pjo.182.2022.01.24.13.46.13; Mon, 24 Jan 2022 13:46:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zTpX4xML; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1452430AbiAXVZe (ORCPT + 99 others); Mon, 24 Jan 2022 16:25:34 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:50964 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344034AbiAXU6L (ORCPT ); Mon, 24 Jan 2022 15:58:11 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E10396135E; Mon, 24 Jan 2022 20:58:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BCB50C340FF; Mon, 24 Jan 2022 20:58:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057887; bh=87EGaLCvwwvOqdzfY5gZL3MVLBoAuuQp2zJygvRpI54=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zTpX4xMLHgrySUBp+NjNoDEqGWhfTn/tPEMsknUHSxFjQCKtA7KItE8PnLvfwwueS WubH2IP5o/CWmmYmR1BcAXKWaRsqE/6LhKLR72laltt4U3OfCCRNX4rhDVmvL3LGaZ YkqEq93NV5XTvBa/QE5f/+ob2NgFropkem1Rpheg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bryan ODonoghue , Kalle Valo , Sasha Levin Subject: [PATCH 5.16 0111/1039] wcn36xx: Fix DMA channel enable/disable cycle Date: Mon, 24 Jan 2022 19:31:40 +0100 Message-Id: <20220124184128.867009451@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Bryan O'Donoghue [ Upstream commit 89dcb1da611d9b3ff0728502d58372fdaae9ebff ] Right now we have a broken sequence where we enable DMA channel interrupts which can be left enabled and never disabled if we hit an error path. Worse still when we unload the driver, the DMA channel interrupt bits are left intact. About the only saving grace here is that we do remember to disable the wcnss interrupt when unload the driver. Fixes: 8e84c2582169 ("wcn36xx: mac80211 driver for Qualcomm WCN3660/WCN3680 hardware") Signed-off-by: Bryan O'Donoghue Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20211105122152.1580542-2-bryan.odonoghue@linaro.org Signed-off-by: Sasha Levin --- drivers/net/wireless/ath/wcn36xx/dxe.c | 38 ++++++++++++++++++-------- 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/drivers/net/wireless/ath/wcn36xx/dxe.c b/drivers/net/wireless/ath/wcn36xx/dxe.c index aff04ef662663..0c4f63f1312f8 100644 --- a/drivers/net/wireless/ath/wcn36xx/dxe.c +++ b/drivers/net/wireless/ath/wcn36xx/dxe.c @@ -272,6 +272,21 @@ static int wcn36xx_dxe_enable_ch_int(struct wcn36xx *wcn, u16 wcn_ch) return 0; } +static void wcn36xx_dxe_disable_ch_int(struct wcn36xx *wcn, u16 wcn_ch) +{ + int reg_data = 0; + + wcn36xx_dxe_read_register(wcn, + WCN36XX_DXE_INT_MASK_REG, + ®_data); + + reg_data &= ~wcn_ch; + + wcn36xx_dxe_write_register(wcn, + WCN36XX_DXE_INT_MASK_REG, + (int)reg_data); +} + static int wcn36xx_dxe_fill_skb(struct device *dev, struct wcn36xx_dxe_ctl *ctl, gfp_t gfp) @@ -869,7 +884,6 @@ int wcn36xx_dxe_init(struct wcn36xx *wcn) WCN36XX_DXE_WQ_TX_L); wcn36xx_dxe_read_register(wcn, WCN36XX_DXE_REG_CH_EN, ®_data); - wcn36xx_dxe_enable_ch_int(wcn, WCN36XX_INT_MASK_CHAN_TX_L); /***************************************/ /* Init descriptors for TX HIGH channel */ @@ -893,9 +907,6 @@ int wcn36xx_dxe_init(struct wcn36xx *wcn) wcn36xx_dxe_read_register(wcn, WCN36XX_DXE_REG_CH_EN, ®_data); - /* Enable channel interrupts */ - wcn36xx_dxe_enable_ch_int(wcn, WCN36XX_INT_MASK_CHAN_TX_H); - /***************************************/ /* Init descriptors for RX LOW channel */ /***************************************/ @@ -905,7 +916,6 @@ int wcn36xx_dxe_init(struct wcn36xx *wcn) goto out_err_rxl_ch; } - /* For RX we need to preallocated buffers */ wcn36xx_dxe_ch_alloc_skb(wcn, &wcn->dxe_rx_l_ch); @@ -928,9 +938,6 @@ int wcn36xx_dxe_init(struct wcn36xx *wcn) WCN36XX_DXE_REG_CTL_RX_L, WCN36XX_DXE_CH_DEFAULT_CTL_RX_L); - /* Enable channel interrupts */ - wcn36xx_dxe_enable_ch_int(wcn, WCN36XX_INT_MASK_CHAN_RX_L); - /***************************************/ /* Init descriptors for RX HIGH channel */ /***************************************/ @@ -962,15 +969,18 @@ int wcn36xx_dxe_init(struct wcn36xx *wcn) WCN36XX_DXE_REG_CTL_RX_H, WCN36XX_DXE_CH_DEFAULT_CTL_RX_H); - /* Enable channel interrupts */ - wcn36xx_dxe_enable_ch_int(wcn, WCN36XX_INT_MASK_CHAN_RX_H); - ret = wcn36xx_dxe_request_irqs(wcn); if (ret < 0) goto out_err_irq; timer_setup(&wcn->tx_ack_timer, wcn36xx_dxe_tx_timer, 0); + /* Enable channel interrupts */ + wcn36xx_dxe_enable_ch_int(wcn, WCN36XX_INT_MASK_CHAN_TX_L); + wcn36xx_dxe_enable_ch_int(wcn, WCN36XX_INT_MASK_CHAN_TX_H); + wcn36xx_dxe_enable_ch_int(wcn, WCN36XX_INT_MASK_CHAN_RX_L); + wcn36xx_dxe_enable_ch_int(wcn, WCN36XX_INT_MASK_CHAN_RX_H); + return 0; out_err_irq: @@ -987,6 +997,12 @@ out_err_txh_ch: void wcn36xx_dxe_deinit(struct wcn36xx *wcn) { + /* Disable channel interrupts */ + wcn36xx_dxe_disable_ch_int(wcn, WCN36XX_INT_MASK_CHAN_RX_H); + wcn36xx_dxe_disable_ch_int(wcn, WCN36XX_INT_MASK_CHAN_RX_L); + wcn36xx_dxe_disable_ch_int(wcn, WCN36XX_INT_MASK_CHAN_TX_H); + wcn36xx_dxe_disable_ch_int(wcn, WCN36XX_INT_MASK_CHAN_TX_L); + free_irq(wcn->tx_irq, wcn); free_irq(wcn->rx_irq, wcn); del_timer(&wcn->tx_ack_timer); -- 2.34.1