Received: by 2002:a05:6512:3d0e:0:0:0:0 with SMTP id d14csp48604lfv; Tue, 12 Apr 2022 16:47:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwf8cG7NPLLn8eB2myAd8/QfWVGIIWd/sQXZhH5uN0XY9WzmnWEe0spEVs071n1GqZfR5In X-Received: by 2002:a17:90b:1803:b0:1c7:24c4:ab52 with SMTP id lw3-20020a17090b180300b001c724c4ab52mr7570522pjb.240.1649807272600; Tue, 12 Apr 2022 16:47:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649807272; cv=none; d=google.com; s=arc-20160816; b=HOhKKbYmclzDMZp6XtYA5Ip7X9pQ04E3Fgu1S94tAmjJNFRUA7YiaS2bSc1+KAbzlS W7l7wCdwgFuEBjtmDQY+xkYx1PJH9V3LB0HLknSDumSzD0kv+M6HoILFhywxGPy+1Bud /IxSBKjIZ5KTXISD9ZcquOxTAtWdha5Wh4MeSGGaXArK4PNnSweSiB9PXUPRPfPCqr61 85HSTJQo2U3hrotTApK3Bpsm0T5AoTMj2ThA8GVN9QH3IZZGMm5VmQvSkItWYiemo92j 6/9WYiZXHG8vMG17UOWnhPpeaadnLTERly4vY11iNgTdTCOUR1cmYZu/nlkLPPu9vthA eb9g== 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=Bo2yEAaX/odDy1Js/JcQObSfAX1rbA+f0GbtX5+4yO8=; b=MJypKK45JhCQjI/41ZlbhpdeziCDPeemboL5RKEGPEqTOca6BmvD8iiXKzgYZrTOJY IYuqRPaQKUfS9xxrzkr78hznhcYuGVky/S3TtLCB18qpzV6QK8oyQrCf9oHv5dWh7H/d wL6MweQHdsisCJT5Z7r3DI2iqZSafkQHEBt1cwqutCEJeEtjAM5Hgyhzgyf4B/yGmq2t JO5Tuv1/8t6qg7a3cnYXIvH2Eefoa34Hm6XZzMWgae6VQ8o7yy8frgW8NK/BVoix2W/I bokJ08QLkRHcFEzvavtMlmKvWHJxM54YliZrNZByv9oX4eT7/2d9USd3skIrxACNbIe+ 4Lxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=b7A5k2vZ; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id d17-20020a056a0024d100b00505a42ba062si10435530pfv.287.2022.04.12.16.47.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Apr 2022 16:47:52 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=b7A5k2vZ; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5D46811C7DE; Tue, 12 Apr 2022 14:40:14 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351468AbiDLHD3 (ORCPT + 99 others); Tue, 12 Apr 2022 03:03:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351537AbiDLGx4 (ORCPT ); Tue, 12 Apr 2022 02:53:56 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5253837A8F; Mon, 11 Apr 2022 23:42:17 -0700 (PDT) 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 E4ACF60A21; Tue, 12 Apr 2022 06:42:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 03ECAC385A8; Tue, 12 Apr 2022 06:42:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649745736; bh=d8czgglyUrasRm//6UZrUC3YlUg2N418lotSj5pSSgg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b7A5k2vZ24c/AM3eUJENapDCC4XjBSWnT2XFJLoXhhQG9cn+tHWqB/3atiQEmQe5n yKJpreVwBCOiRALPZX1LWKZQna0sN//Y0llGxKI4eDysQsmGoV6Yu8jO54ct8Pdo+T zGw7JMoKQRgt4AdKf0TzopvYIngpcswBy1+OnPcg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mario Limonciello , Kalle Valo , Sasha Levin Subject: [PATCH 5.15 029/277] ath11k: pci: fix crash on suspend if board file is not found Date: Tue, 12 Apr 2022 08:27:12 +0200 Message-Id: <20220412062942.884846370@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220412062942.022903016@linuxfoundation.org> References: <20220412062942.022903016@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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-kernel@vger.kernel.org From: Kalle Valo [ Upstream commit b4f4c56459a5c744f7f066b9fc2b54ea995030c5 ] Mario reported that the kernel was crashing on suspend if ath11k was not able to find a board file: [ 473.693286] PM: Suspending system (s2idle) [ 473.693291] printk: Suspending console(s) (use no_console_suspend to debug) [ 474.407787] BUG: unable to handle page fault for address: 0000000000002070 [ 474.407791] #PF: supervisor read access in kernel mode [ 474.407794] #PF: error_code(0x0000) - not-present page [ 474.407798] PGD 0 P4D 0 [ 474.407801] Oops: 0000 [#1] PREEMPT SMP NOPTI [ 474.407805] CPU: 2 PID: 2350 Comm: kworker/u32:14 Tainted: G W 5.16.0 #248 [...] [ 474.407868] Call Trace: [ 474.407870] [ 474.407874] ? _raw_spin_lock_irqsave+0x2a/0x60 [ 474.407882] ? lock_timer_base+0x72/0xa0 [ 474.407889] ? _raw_spin_unlock_irqrestore+0x29/0x3d [ 474.407892] ? try_to_del_timer_sync+0x54/0x80 [ 474.407896] ath11k_dp_rx_pktlog_stop+0x49/0xc0 [ath11k] [ 474.407912] ath11k_core_suspend+0x34/0x130 [ath11k] [ 474.407923] ath11k_pci_pm_suspend+0x1b/0x50 [ath11k_pci] [ 474.407928] pci_pm_suspend+0x7e/0x170 [ 474.407935] ? pci_pm_freeze+0xc0/0xc0 [ 474.407939] dpm_run_callback+0x4e/0x150 [ 474.407947] __device_suspend+0x148/0x4c0 [ 474.407951] async_suspend+0x20/0x90 dmesg-efi-164255130401001: Oops#1 Part1 [ 474.407955] async_run_entry_fn+0x33/0x120 [ 474.407959] process_one_work+0x220/0x3f0 [ 474.407966] worker_thread+0x4a/0x3d0 [ 474.407971] kthread+0x17a/0x1a0 [ 474.407975] ? process_one_work+0x3f0/0x3f0 [ 474.407979] ? set_kthread_struct+0x40/0x40 [ 474.407983] ret_from_fork+0x22/0x30 [ 474.407991] The issue here is that board file loading happens after ath11k_pci_probe() succesfully returns (ath11k initialisation happends asynchronously) and the suspend handler is still enabled, of course failing as ath11k is not properly initialised. Fix this by checking ATH11K_FLAG_QMI_FAIL during both suspend and resume. Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03003-QCAHSPSWPL_V1_V2_SILICONZ_LITE-2 Reported-by: Mario Limonciello Link: https://bugzilla.kernel.org/show_bug.cgi?id=215504 Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220127090117.2024-1-kvalo@kernel.org Signed-off-by: Sasha Levin --- drivers/net/wireless/ath/ath11k/pci.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/net/wireless/ath/ath11k/pci.c b/drivers/net/wireless/ath/ath11k/pci.c index 54ce08f1c6e0..353a2d669fcd 100644 --- a/drivers/net/wireless/ath/ath11k/pci.c +++ b/drivers/net/wireless/ath/ath11k/pci.c @@ -1382,6 +1382,11 @@ static __maybe_unused int ath11k_pci_pm_suspend(struct device *dev) struct ath11k_base *ab = dev_get_drvdata(dev); int ret; + if (test_bit(ATH11K_FLAG_QMI_FAIL, &ab->dev_flags)) { + ath11k_dbg(ab, ATH11K_DBG_BOOT, "boot skipping pci suspend as qmi is not initialised\n"); + return 0; + } + ret = ath11k_core_suspend(ab); if (ret) ath11k_warn(ab, "failed to suspend core: %d\n", ret); @@ -1394,6 +1399,11 @@ static __maybe_unused int ath11k_pci_pm_resume(struct device *dev) struct ath11k_base *ab = dev_get_drvdata(dev); int ret; + if (test_bit(ATH11K_FLAG_QMI_FAIL, &ab->dev_flags)) { + ath11k_dbg(ab, ATH11K_DBG_BOOT, "boot skipping pci resume as qmi is not initialised\n"); + return 0; + } + ret = ath11k_core_resume(ab); if (ret) ath11k_warn(ab, "failed to resume core: %d\n", ret); -- 2.35.1