Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp22948422rwd; Fri, 30 Jun 2023 15:19:52 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6CYT9vT9R4AbxVNnpKgNwU7QNSfqbuz3mMl+Vm8gVuIf7BDkiRwJrDLev7S9evbVGW1v85 X-Received: by 2002:a05:6870:b6a5:b0:1ad:565f:df6c with SMTP id cy37-20020a056870b6a500b001ad565fdf6cmr5258718oab.46.1688163591868; Fri, 30 Jun 2023 15:19:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688163591; cv=none; d=google.com; s=arc-20160816; b=qiEsFbLNy9ae4NAOPk47PVQMrj31u4pqrVIgHBJupzdnm/YaO5ur3Zg8MK5HBgnQQ3 1zpJCUwvbMm79SBLQdzwNcY2DFOhDZFxt6yGDb8sGHRhlC1EwWctOsdpGEADeZOjEFol mL1Cl4JzV7kZePzFMcYQR2t21Xd+T/FCJZRRtYvjL/E2SrzL6A1wdcafaFXepX4iu/CV V4GZlPr9K+UmJvHWNtg1hV783esiUXtYBjUohcCvwAytQ2/2vcdE1CKpvnbNDhx+dEQJ JietGYhKM11aho1o+GFp+gDteUyWE5zSnkqQbePW+eBg2iOxkYXZ/VhVZp8+OtM0OXEE jOcQ== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=c4o3ZFseb13xRGcd/vSc40J69/E/2IGFhPuLqlwM6WM=; fh=T9Yan1P6PyP7E8LpxvbICxfboIxG2Nu7BcOZn1U2RyQ=; b=slMTXDJOC7tOJ4W3tGcP04BezqAYo8fw/3/W7h3W2AHiKQJAPvrI2/F9RgFtYseupO d1Hh7r4xqHiVJ2/dpHga73Ahp91YvSHFFT1oAG4Yg/wSOZxt5TacGCj1qlnHTnSoZ8K4 BeLZp3VEZSW1YgjgkhojqUQ2A5b1fF17he1FB+XDJZRzgfNK5+QEFCHtHktPJ6ZIq5Pc jxDsGNFwY5h6w24bTF9nFrC/IiPorTGJjxgEhs+M7ZGHww66zMOVy6IIXt4+lMhUDYmj 4bYmLpvaYrMLriyhfBlKOKqnTzmwaM2a//HQzbGo5DDbrtBncBff8AbFWJUFHiaXK0Ro EupQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=dKmcBva0; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pg18-20020a17090b1e1200b0025c1ff9cd67si14865074pjb.184.2023.06.30.15.19.38; Fri, 30 Jun 2023 15:19:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=dKmcBva0; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229897AbjF3WS7 (ORCPT + 60 others); Fri, 30 Jun 2023 18:18:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229503AbjF3WS6 (ORCPT ); Fri, 30 Jun 2023 18:18:58 -0400 Received: from mail-pf1-x432.google.com (mail-pf1-x432.google.com [IPv6:2607:f8b0:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12AA61BC for ; Fri, 30 Jun 2023 15:18:57 -0700 (PDT) Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-66869feb7d1so1408427b3a.3 for ; Fri, 30 Jun 2023 15:18:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1688163536; x=1690755536; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=c4o3ZFseb13xRGcd/vSc40J69/E/2IGFhPuLqlwM6WM=; b=dKmcBva0OfXgsyn4nQpgyo+dwwZZeAnKPUA9crG7kZIxfR7ngBVv3Vysn6FqjqTuKO D0egZDk+Y/RXo/h3c3qJZ7pkO7BYLkTiEx1xqfrRBsq9rYXgFhQ0dGrLbbO3ei1PVsUi 0YuKesC1cB2chTzjq87WlDtVOK7bVmVQ/XJkA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688163536; x=1690755536; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=c4o3ZFseb13xRGcd/vSc40J69/E/2IGFhPuLqlwM6WM=; b=O6BehisGfPLv+h0IxCVX63kvUG+H5Dad+9mEmtnYmcDUgDfBvWlzFBR3lEZIeBnGH1 pA7kb9m1IcmR2ko955iBFxUvFHbB/M1v3eGhdLP1MndPHkpxEqL57155uR25I4lzShiw whvcHFvP5D/Wk30l2ak4KaE4yc4PtHrpCAX1mJ0OTWFjE15duOhW/yj6wX6vTRyH9hFM AZvPg2jXrDyluRsTgyaMPvHPzJEbt4258Jqy5RjLSle24V7dDsW0YYJMLtvfeLbZTaiH Kr/t3FvqKo02gcx70nJJLClQa2eHII0l/etrGNcK60wqmsqHGB2w6DYHhEoAvD7ovsTt D/rA== X-Gm-Message-State: AC+VfDzKk7gfzTF/U3Q26p3SEXpy3nbOOtU9KYvFkMgqd97ZhIRVRwNk O4htnKvSWoS58xahGq7Cj0d6ZA== X-Received: by 2002:a05:6a20:948a:b0:12b:de8:929d with SMTP id hs10-20020a056a20948a00b0012b0de8929dmr2662683pzb.16.1688163536499; Fri, 30 Jun 2023 15:18:56 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:9d:2:e9c4:8375:7234:e6c2]) by smtp.gmail.com with ESMTPSA id u9-20020a170902e5c900b001b67a2896bdsm9653480plf.274.2023.06.30.15.18.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Jun 2023 15:18:55 -0700 (PDT) From: Douglas Anderson To: ath10k@lists.infradead.org Cc: Abhishek Kumar , Youghandhar Chintala , Douglas Anderson , Kalle Valo , linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org Subject: [PATCH] ath10k: Don't touch the CE interrupt registers after power up Date: Fri, 30 Jun 2023 15:18:43 -0700 Message-ID: <20230630151842.1.If764ede23c4e09a43a842771c2ddf99608f25f8e@changeid> X-Mailer: git-send-email 2.41.0.255.g8b1d071c50-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org As talked about in commit d66d24ac300c ("ath10k: Keep track of which interrupts fired, don't poll them"), if we access the copy engine register at a bad time then ath10k can go boom. However, it's not necessarily easy to know when it's safe to access them. The ChromeOS test labs saw a crash that looked like this at shutdown/reboot time (on a chromeos-5.15 kernel, but likely the problem could also reproduce upstream): Internal error: synchronous external abort: 96000010 [#1] PREEMPT SMP ... CPU: 4 PID: 6168 Comm: reboot Not tainted 5.15.111-lockdep-19350-g1d624fe6758f #1 010b9b233ab055c27c6dc88efb0be2f4e9e86f51 Hardware name: Google Kingoftown (DT) ... pc : ath10k_snoc_read32+0x50/0x74 [ath10k_snoc] lr : ath10k_snoc_read32+0x24/0x74 [ath10k_snoc] ... Call trace: ath10k_snoc_read32+0x50/0x74 [ath10k_snoc ...] ath10k_ce_disable_interrupt+0x190/0x65c [ath10k_core ...] ath10k_ce_disable_interrupts+0x8c/0x120 [ath10k_core ...] ath10k_snoc_hif_stop+0x78/0x660 [ath10k_snoc ...] ath10k_core_stop+0x13c/0x1ec [ath10k_core ...] ath10k_halt+0x398/0x5b0 [ath10k_core ...] ath10k_stop+0xfc/0x1a8 [ath10k_core ...] drv_stop+0x148/0x6b4 [mac80211 ...] ieee80211_stop_device+0x70/0x80 [mac80211 ...] ieee80211_do_stop+0x10d8/0x15b0 [mac80211 ...] ieee80211_stop+0x144/0x1a0 [mac80211 ...] __dev_close_many+0x1e8/0x2c0 dev_close_many+0x198/0x33c dev_close+0x140/0x210 cfg80211_shutdown_all_interfaces+0xc8/0x1e0 [cfg80211 ...] ieee80211_remove_interfaces+0x118/0x5c4 [mac80211 ...] ieee80211_unregister_hw+0x64/0x1f4 [mac80211 ...] ath10k_mac_unregister+0x4c/0xf0 [ath10k_core ...] ath10k_core_unregister+0x80/0xb0 [ath10k_core ...] ath10k_snoc_free_resources+0xb8/0x1ec [ath10k_snoc ...] ath10k_snoc_shutdown+0x98/0xd0 [ath10k_snoc ...] platform_shutdown+0x7c/0xa0 device_shutdown+0x3e0/0x58c kernel_restart_prepare+0x68/0xa0 kernel_restart+0x28/0x7c Though there's no known way to reproduce the problem, it makes sense that it would be the same issue where we're trying to access copy engine registers when it's not allowed. Let's fix this by changing how we "disable" the interrupts. Instead of tweaking the copy engine registers we'll just use disable_irq() and enable_irq(). Then we'll configure the interrupts once at power up time. Tested-on: WCN3990 hw1.0 SNOC WLAN.HL.3.2.2.c10-00754-QCAHLSWMTPL-1 Signed-off-by: Douglas Anderson --- drivers/net/wireless/ath/ath10k/snoc.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/snoc.c b/drivers/net/wireless/ath/ath10k/snoc.c index 26214c00cd0d..2c39bad7ebfb 100644 --- a/drivers/net/wireless/ath/ath10k/snoc.c +++ b/drivers/net/wireless/ath/ath10k/snoc.c @@ -828,12 +828,20 @@ static void ath10k_snoc_hif_get_default_pipe(struct ath10k *ar, static inline void ath10k_snoc_irq_disable(struct ath10k *ar) { - ath10k_ce_disable_interrupts(ar); + struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar); + int id; + + for (id = 0; id < CE_COUNT_MAX; id++) + disable_irq(ar_snoc->ce_irqs[id].irq_line); } static inline void ath10k_snoc_irq_enable(struct ath10k *ar) { - ath10k_ce_enable_interrupts(ar); + struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar); + int id; + + for (id = 0; id < CE_COUNT_MAX; id++) + enable_irq(ar_snoc->ce_irqs[id].irq_line); } static void ath10k_snoc_rx_pipe_cleanup(struct ath10k_snoc_pipe *snoc_pipe) @@ -1090,6 +1098,8 @@ static int ath10k_snoc_hif_power_up(struct ath10k *ar, goto err_free_rri; } + ath10k_ce_enable_interrupts(ar); + return 0; err_free_rri: @@ -1253,8 +1263,8 @@ static int ath10k_snoc_request_irq(struct ath10k *ar) for (id = 0; id < CE_COUNT_MAX; id++) { ret = request_irq(ar_snoc->ce_irqs[id].irq_line, - ath10k_snoc_per_engine_handler, 0, - ce_name[id], ar); + ath10k_snoc_per_engine_handler, + IRQF_NO_AUTOEN, ce_name[id], ar); if (ret) { ath10k_err(ar, "failed to register IRQ handler for CE %d: %d\n", -- 2.41.0.255.g8b1d071c50-goog