From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.224.42 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796001113; b=E1/QAB/8Zw8kQpOSJ14Ay/pYI9A5bBdi8zvQi7SyEFkrH4xNw01DNVN0olLmxPJZwxaD hcxG3DYBRM8XG/GhHmw3lcFbZEAgcxrLLk+Jx/AZ1TNnqyi4FixAy/RFQC3+16hyqJeCV VsyOBPlDSe0PYWMES6mBHS93A7JXeFzSSCl7ZZfYZUxRnrhfcCO+qGvp0JYn2J9mqRNrs WdJHU8doPIsx60uqA62fMxIXMCi/sRUPRcUJHbBaDWz+Hcd0g402D5shW+LmbeOJ3a7TL NKQrqGsojEYZv2yOjqlalKnGzBHQo1b18HlTkoysLddLs1ePzJ+5/INMjsSRwfOdlgA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796001113; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding; bh=/h5P1TVsLFB4iU0Dh6O25zBVXz8yRMzW3S2juMPOANw=; b=HdjjqqAreTCgmgHRnKgG93vxrCVm9PDIK5KPK8j+Mg/2QAclH+GouOpDj9JeJQ4UrLIB 5qNZnh95N1cEeBHzh/FVTq02bHr/ds2jyFsOJs3yDBsZh/CGLbA5X5KN/s3bkGKviH5sU zxbl4EMmG5q/9cVWuK+SFo6+NGbYq4GMz5krwXMWXQTUNaHbv785ZlzNkzaMEM08PtRux o4r7/RPEMzMkb94/ZffCyYCgQSpIBJ9Iyl+q0t6QJZEvzoIdkJ/SlabYgrnZbUrKjolzC an9oxYYBk2XxYJ3MU5MYTNn5vmYkRAHUiG7IxsVx4OZGpqPaxcWY9ordcM2HuDVgvWg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=qbbBNe8b; arc=none smtp.remote-ip=74.125.224.42 Received: from mail-yx1-f42.google.com (mail-yx1-f42.google.com [74.125.224.42]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 82FFA606A31C for ; Mon, 30 Nov 2026 01:11:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 82FFA606A31C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=qbbBNe8b Received: by mail-yx1-f42.google.com with SMTP id 956f58d0204a3-6767d92cde6so10587891d50.0 for ; Sun, 29 Nov 2026 17:11:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796001111; x=1796605911; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=/h5P1TVsLFB4iU0Dh6O25zBVXz8yRMzW3S2juMPOANw=; b=qbbBNe8bv36NBL5tDYGT+V8nkUf/B5EekXy+1BRv4cYrKTJKG1Otq55HnmzLkNO36R oMUmaw3a3c4fsVgWj/yX+p2sWM6tsfp/IoSsPwrfaiNTnpZM2+/oAik+4Jkyde/RxIGX l1g/BDz5kKM7iidpbPCbasS8ubwbmDLIJn/w6erpbbszugfl0+ShCCL/DlefW0nnOmTE cbf06Hb/GlJ4Vaa/KJ2XRtMERhLG/rAgT9SnpQdVeWtlcL4HmM8SRY3vb5CyKqlodr37 ObmEO28h8jUWDr8MxGhdpz+K1nJF1sqaWxm9SPSbasLgZhmXROziyLgXs9AqEelwYHwb z5JQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796001111; x=1796605911; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=/h5P1TVsLFB4iU0Dh6O25zBVXz8yRMzW3S2juMPOANw=; b=SkZ/y5xCLQ7pLdP3rk+jDebekKMSfWJph4a2JTtLlgn0nnhnR+2YebrNVopvvMrZlQ 8eqRlF4FhJUQbTi4v4cy83kxM5MKtrQcX1HefsKs5Mzln6BuMuuB/MKwE1/CMyKwjaQI 3o96b/WQBm9+byGQEnNwO8SPOu+afooYPU6YIITsiDk2KmpEufymtX5xAxpuZuqUx7fG OvUqAO+LECQK6IUQ0qfQFWuDzYPxC0r/DEX4cQqeb2XECdRZpoyUydEOzJ61Ae8y2ins HYESh36MPrZ+6+/HoXHmmqZeVcxZSm6rGfzpj9XaCzDyaCfj02WTSggQhy/sGJ3EfIn7 8Vag== X-Forwarded-Encrypted: i=1; AL+hErGL5hxsWWZf8L+lz/zrVH/Ht6rqlRGFlk7LEHP4hBMJut+/52WAcJXRBXOqvRoy0ig7ZCjfm3X9lRu7ldo=@vger.kernel.org X-Gm-Message-State: APuU4Z+NKiLss2qKmB5RbFE5RhD96W+4mk+Tv91v8S0WFzSppXbHcOOx 60g2/aBt9lv8HQBiLRgfQ4JryDM62hMsgMmS11Wns9G1i/T+BT+fOYrr X-Gm-Gg: AZFdTZdkjfngvJjL4snpXd0QuZta0LfhWcmMtVE4DXgXEgwxgqSxXrRj1lmJk5cNAVh z3xYKuO/VIx0osbiG/kn0Dib3gD2epE+a3Ag4ImAOB5K8xkP9SDVOAJoEW7gIwHLXUKXJsKoUEC c5u59KH+7h6fnjUF8POkHlWi3WFbG29Lx0B3Q7n0FTfOZZVXlxC09jmi3URlR2hKoCdqlL0Dklz IpllUQkgH6ydDsuFk4uU0rxe5b0arHSHVecNkZSdW6wZNU2mSHsGITNffIYkaEj+GAXdI1z3LTW 6DvmAG4nUMYMII23BckTE2k4UeClxCPSKEaNt0EXoDbgtFfI6b6E6BRKcVxEbPLn8rfTmKWiAoj rna3lfMdiglJkXGBa2l7DGv8Kzqs7FSRnZcyhsw8ZCZRKckeeHSxPba6VxP9Jrhf+FPOV3jzeCl kl6p77BqC/WTgzVAhDcBYeg6uDp8W5g/ZW9UBgOrU+AZAkHgExsBjPbag1OS6MG4p2lbJpdYDdf 1PMuL5CvDKTN4XPFW8T0GpQYUl9XSrDm6OfZLV1auabUjj6p6XMA3u6hshi2WOXg9GCz5ofawsB knkPs5K+1EwfJUiSPB3mJy0hmGB9Yj1O1LCzcv7A3BnpK/KL2k8nVgMztaKeQe1hKAsaDe4vbQ4 sAuq4yQt9cU3yfTPmmVHPoVTW0HP0Kn0hJ/LEkDh3UQ7P0jW7WMBNSzcwVNgPRT7Cw3HTW1yZ8B bk4gEBUtO9lJiedOArdADr5QksDESdsswgpZp2Uuk9d9E/jq7hbiinGo0CbIHLl27FWsB1WR0= X-Received: by 2002:a05:690e:4807:b0:67d:c255:9c0e with SMTP id 956f58d0204a3-67df43f8305mr7446984d50.44.1796001111444; Sun, 29 Nov 2026 17:11:51 -0800 (PST) Received: from localhost.localdomain (104-12-105-135.lightspeed.miamfl.sbcglobal.net. [104.12.105.135]) by smtp.gmail.com with ESMTPSA id 956f58d0204a3-67df3353258sm14881888d50.9.2026.11.29.17.11.49 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 29 Nov 2026 17:11:50 -0800 (PST) From: Jason Perlow To: Miri Korenblit , Johannes Berg , Emmanuel Grumbach , Yedidya Benshimol Cc: Li Chen , Emil Williams , linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3] wifi: iwlwifi: pcie: support shutdown operation Date: Sun, 29 Nov 2026 20:11:48 -0500 Message-ID: <20261130011148.92938-1-jperlow@gmail.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260121113940.113145-1-me@linux.beauty> References: <20260121113940.113145-1-me@linux.beauty> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Li Chen Kexec reboot does not reset PCI devices. If iwlwifi is left running, the next kernel can time out during probe, breaking networking after kexec: kernel: iwlwifi 0000:06:00.0: Host monitor block 0x22 vector 0x0 kernel: iwlwifi 0000:06:00.0: value [iter 0]: 0x00000000 kernel: iwlwifi 0000:06:00.0: probe with driver iwlwifi failed with error -110 Register a dedicated PCI shutdown callback: run the normal teardown path and then disable the PCI function and transition it to D3hot so the next kernel can re-initialize it reliably. Signed-off-by: Li Chen [jperlow: rebased onto wireless-next; the teardown is now iwl_pci_remove()] Tested-by: Jason Perlow Signed-off-by: Jason Perlow --- Changes since v2 (posted 2026-01-21, no replies that I could find): - rebased onto wireless-next; the teardown is now iwl_pci_remove() instead of the removed iwl_pcie_gen1_2_remove() I am sending this on behalf of Li Chen, whose v1 and v2 I found no reply to. Li Chen, please say if you would rather resend it yourself. Testing: ASUS GU502LV, Intel AX201 (8086:06f0), v7.4-rc5, where pcie/drv.c is identical to wireless-next. The module was loaded into the running kernel so the shutdown callback ran on the way out. Without the callback, kexec lost the device: either probe failed with -110 ("CSR_RESET = 0x10" and the host monitor dump), or an error interrupt arrived before an op mode was attached and hit the WARN_ON_ONCE(!trans->op_mode) in iwl_trans_fw_error(). A plain reboot did not recover it, only a power cycle did. A control run with the stock module lost the device on the first kexec. With this patch, associated to an AP with sustained ping traffic, 3 kexec and 2 reboot cycles were all clean: no iwlwifi errors, and no warnings or traces in the log of the kernel being shut down. The v1 form (.shutdown = iwl_pci_remove) passed the same tests, plus 5 kexec cycles with the interface down, so I could not tell the two forms apart on this device. Only this one chip was tested. The same failure was reported on an AX211 (8086:7a70) on 14 Oct: <87a4og34vi.fsf@chud.cyou>. drivers/net/wireless/intel/iwlwifi/pcie/drv.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c index 2401200..e07d0c6 100644 --- a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c +++ b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c @@ -1206,6 +1206,21 @@ 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 = pci_get_drvdata(pdev); + + if (trans) { + iwl_pci_remove(pdev); + pci_set_drvdata(pdev, NULL); + } + + pci_save_state(pdev); + pci_clear_master(pdev); + pci_disable_device(pdev); + pci_set_power_state(pdev, PCI_D3hot); +} + #ifdef CONFIG_PM_SLEEP static int iwl_pci_suspend(struct device *device) @@ -1347,6 +1362,7 @@ static struct pci_driver iwl_pci_driver = { .id_table = iwl_hw_card_ids, .probe = iwl_pci_probe, .remove = iwl_pci_remove, + .shutdown = iwl_pci_shutdown, .driver.pm = IWL_PM_OPS, .driver.coredump = iwl_pci_dump, }; -- 2.39.5