Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp1942896rwo; Thu, 3 Aug 2023 02:10:41 -0700 (PDT) X-Google-Smtp-Source: APBJJlGpLHjOZHghn3UqCCEBlXXBvmP3Kc9Ywse1ka2ywdEeYpTEEUvwiGQbCNCCVuCUxlVsErOf X-Received: by 2002:a17:906:224b:b0:96f:d780:5734 with SMTP id 11-20020a170906224b00b0096fd7805734mr7753245ejr.65.1691053841382; Thu, 03 Aug 2023 02:10:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691053841; cv=none; d=google.com; s=arc-20160816; b=zJi+nQbfGA5wjhPzK8mtDlK6bhSsglVrL3ty7HdP2OBNlTha9GkXmuNDAYbUApweyP +2X8VFLrEM0fV7o+gIPe/yd9K8mPPT2V5HpysLhrjGuvpLA9j2D4kZvrnxe37hJXW+3Y tg6fcXM92XdtgFCQW+alm3dRDdcEo0n/LkrDakqSfh5h15XfU7pxmB+k+efju8j3MiBk jJ2poA0KUq+JltFZvMXoOcX6w81jPDMm1UK5V1kgt+cz6a4RmDz+aOL49TVpjeeHeq8z hitJOyaloaYz3bi3r337W6YN4r6lRcz/JyfHck4BOr+SRYcmjkPqj6r01D8pxrcXoUNR 7cMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=3WTtwxEW9Hl3Gp8FLgTwQrit/9PDxNQU5Gp9J/hakRU=; fh=wEFb25yjCkEHmo3qqVZ9qavG0QtPh1WgLp4lK39OLXA=; b=y8mlVg2zNIpXhT1E+34C8kEG6cXQt5a5QoMutQ5Nf/9GlRCpGfu5QbLPYxE0h6ZPsn OLQ4+hcsRn9qr9RBztah0Y6QdXg/XFBxMGpsEMQD2kpohTfR1yAIYxFTm36cMDb63bgM FTXcaUQwl6LPBVho5iDMidtJ+ovL8SIOi6UW+6OybbvnlxexcBBMPr54jW9GwxLx9dr0 wgewSUZKnREUlQTlc44mh93SY+nz+D0fqgx7LTtuTvww2B/g8ByZTlkNPJmJAiB+QdUV DPBH4UgZjKmGrJ3AwmafMZd3tUvqTHqvFyeq5H1kLOqX/JJ65SEy93T2mCyRkvI7NtGy L/QA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Y+fslikF; 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=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ja1-20020a170907988100b00992d0de8760si10692524ejc.911.2023.08.03.02.10.22; Thu, 03 Aug 2023 02:10:41 -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=@redhat.com header.s=mimecast20190719 header.b=Y+fslikF; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234846AbjHCIqt (ORCPT + 58 others); Thu, 3 Aug 2023 04:46:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234839AbjHCIqc (ORCPT ); Thu, 3 Aug 2023 04:46:32 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0C83106 for ; Thu, 3 Aug 2023 01:45:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1691052342; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3WTtwxEW9Hl3Gp8FLgTwQrit/9PDxNQU5Gp9J/hakRU=; b=Y+fslikFbKoLfOi76DMFrhvF7HaoROKeDEokTC1kz+mv8+Tn/f0sH0aniQ5XOGxQ2HmNZ4 qK1ZyfdCLTeVzNNWhdX7wcI/0icXDs1/jSR2vwftOzBf82z1hPlmErwHFYE25JZOTgsgw2 DMgoZCKm4Noq7a2x+vKTWwEH0KRODyw= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-695-ppZQEppmO-a6r7d84wxi-g-1; Thu, 03 Aug 2023 04:45:41 -0400 X-MC-Unique: ppZQEppmO-a6r7d84wxi-g-1 Received: by mail-ed1-f69.google.com with SMTP id 4fb4d7f45d1cf-52227ea05a9so503232a12.1 for ; Thu, 03 Aug 2023 01:45:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691052340; x=1691657140; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3WTtwxEW9Hl3Gp8FLgTwQrit/9PDxNQU5Gp9J/hakRU=; b=MV7Q6hBShbkdPCA2Yfklzi5hsnYGxFbJl8buIb0nIIjorlyhkvP0IkQdgM5FNp3E+t vx59JzcQ0gk8jktgOSMZZqF6ZWHuLdhbTHXMfysLP9Gu+zbLliM+7uNIwV4XBQxhUC8B XZxRBNxeaA/SWPv4hQ6cUvaP28fsPhuxR3qnPF06FXpmAFl8GoCoWmlFB4fVOkLW2CCc Tgl0jBY6JDtj1+FJKzI4hO/41DOmNdoOT+dpEHTP7ZmsVYcYEMY/m6Fs8b5tYtvJQAtZ Q4HjUdR0egtCXM8F8HL5JMloOQzD/SvZnwmeLPMCVNVpjzgqUS7kdfwidZDlRUTxkI1C bogA== X-Gm-Message-State: ABy/qLbOTbMfRPK+MagkwyfkYyLyr/AIYw4uGPsWso3omBn7y+C/8Bq+ htrIVYboR2oZd6wL05cyYx01DQEHdNGWZcUTtLepR0OpHaCgf9aacmL2EV0AoqjPkIgCG3Uamfh 59JG4iPnPS8CCzsAsH/rpI/eDEg/EZO8PBYQie6yX/2Y= X-Received: by 2002:a05:6402:8cc:b0:522:b86f:a22b with SMTP id d12-20020a05640208cc00b00522b86fa22bmr8253564edz.1.1691052340457; Thu, 03 Aug 2023 01:45:40 -0700 (PDT) X-Received: by 2002:a05:6402:8cc:b0:522:b86f:a22b with SMTP id d12-20020a05640208cc00b00522b86fa22bmr8253549edz.1.1691052340222; Thu, 03 Aug 2023 01:45:40 -0700 (PDT) MIME-Version: 1.0 References: <20230803023257.9260-1-ltao@redhat.com> In-Reply-To: <20230803023257.9260-1-ltao@redhat.com> From: Tao Liu Date: Thu, 3 Aug 2023 16:45:04 +0800 Message-ID: Subject: Re: [RFC][PATCH] iwlwifi: Add pci .shutdown() hook for iwlwifi driver To: gregory.greenman@intel.com, kvalo@kernel.org, johannes.berg@intel.com, mukesh.sisodiya@intel.com Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, kexec@lists.infradead.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham 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 Add kexec to the CC list so kexec people can know this. On Thu, Aug 3, 2023 at 10:55=E2=80=AFAM Tao Liu wrote: > > Previously no .shutdown() hook is implemented for iwlwifi driver, a > ETIMEDOUT error will occur during the kexec kernel bootup. As a > consequence, wifi is unusable after kexec into the new kernel. > > This issue is observed and patch tested on the following wireless cards: > > 1) Network controller: Intel Corporation Comet Lake PCH-LP CNVi WiFi, > Subsystem: Intel Corporation Wi-Fi 6 AX201 160MHz > 2) Network controller: Intel Corporation Wireless-AC 9260, > Subsystem: Intel Corporation Device e014 > > Signed-off-by: Tao Liu > --- > > Hi folks, > > This is a RFC patch and I'm not sure about the correctness of the code, > especially about the pci_clear_master() part. What I want is to stop any > ongoing DMA access, in case if the memory overwritting during kexec > kernel bootup. But there is already pci_clear_master(pci_dev) in > drivers/pci/pci-driver.c:pci_device_shutdown(), so I'm not sure if it is > still needed in the driver side. And I only tested the patch against the > above 2 wireless cards and worked OK, not sure if it can work for others. > Please review the patch, thanks in advance! > > Thanks, > Tao Liu > > --- > drivers/net/wireless/intel/iwlwifi/pcie/drv.c | 13 +++++++++++++ > 1 file changed, 13 insertions(+) > > diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c b/drivers/net/= wireless/intel/iwlwifi/pcie/drv.c > index 73c1fb3c0c5e..24c4c2dd7cb0 100644 > --- a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c > +++ b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c > @@ -1513,6 +1513,18 @@ static void iwl_pci_remove(struct pci_dev *pdev) > iwl_trans_pcie_free(trans); > } > > +static void iwl_pci_shutdown(struct pci_dev *pdev) > +{ > + struct iwl_trans *trans =3D pci_get_drvdata(pdev); > + > + if (!trans) > + return; > + > + iwl_drv_stop(trans->drv); > + > + pci_clear_master(pdev); > +} > + > #ifdef CONFIG_PM_SLEEP > > static int iwl_pci_suspend(struct device *device) > @@ -1583,6 +1595,7 @@ static struct pci_driver iwl_pci_driver =3D { > .id_table =3D iwl_hw_card_ids, > .probe =3D iwl_pci_probe, > .remove =3D iwl_pci_remove, > + .shutdown =3D iwl_pci_shutdown, > .driver.pm =3D IWL_PM_OPS, > }; > > -- > 2.40.1 >