From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.224.48 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796001113; b=oHB2EcNvzUMh61h+jablnNEw2OzMcdhFX6Yhpw7Sx8rw0s8V1L9EJnDO5HOKIRzlZzpa OzBvkSUjj+7fIH7rSFBSOKtgRlEmVvZPQW/aRJY0zBxpYHxqrt/+vV0THVpDx8lvbkUDl rqDfI8HsfxWD28iZoAj6gIoMVheSeUKTDmP9vwD2HcL0wsQrrTw8mTijcPpLPbqistKgl tkqgNWOHc35uMDP2/PXFq3qHiCtwVh/VNIr0rVPNlBr3RfT/UYWVE7AebXcH2+RuVKRPy njgQwfJ4mh/zhhyaZuAdwa9xwJ/5HrG+uVfkgfVgPWBofDPor8ue1dyjjk2PLo1vNwA== 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=DSDUBKpqlxOvCZjIsssbRUPpbUO80WQ2nN2tLp03+mDAeKVfgJ/GCylAz22I37E4D5fd mpDYxV+c7U1VDMPjcitraAVgXunhsd0OT/G+3K3gNlA1dMiv7LDt94KVxlRQQNLH8ZRAX apructslQ2dS4AeLitR28byn+Nt6FMRXDn0iVq5zuVIIRQEp7mCl0XdcH2FhEyLl5GUu5 lISqG1Z6+A7Xv5PSLhSCzzVcOvMgolKrJ9zmQoidt7C+Y5F3SmPbmEvVdv+XjAxe1IVCt kYG3RaZVX6WupId0kfn2t1PixBUPVuseSgFXwmyynSahm0B+fRra2HSGgGOpYjcGcRA== 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.48 Received: from mail-yx1-f48.google.com (mail-yx1-f48.google.com [74.125.224.48]) (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 8F77C606A325 for ; Mon, 30 Nov 2026 01:11:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 8F77C606A325 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-f48.google.com with SMTP id 956f58d0204a3-67db0791748so11100168d50.1 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=x/F+bsTxD+j54qJgY9vke82GTnWgBQya0cd9gb43c0eYCDjXYkwPlWzWnXZB8aWl9f Qk3r4qWYzD37CIlUhepiA136HcJF30yVKtKzGKS8nhVdAttQ6vJjuBvIC+p/E4g6WKCq SRN5YCx8saJMLC5HG/Vu+a30Mznf6FbSGu4Jgod5wRXB6ibjiGBeGLp8N7vlNUsQyhVT XMsRTDa3RvxQnIeEYGmu0F1w/qGrRzdf2ZPdW1asDRWlG4D4lifuHMb+yIw6Dw3xtuwX 3c2ED/Z8sKDLTHOhkMtMdJr0oD5J3TbYi+S/KScGFMo1QuJR/qd9fIduF/V57WGQPLR5 cCDA== X-Forwarded-Encrypted: i=1; AL+hErF2dTdzgsJhbJ1JiCxfoukyb0zr3ZCBe1PlpPDqgl2hNaEaAviF4dr3anBa2QLEXfWkC/sO7hoAfqOphr5RXw==@vger.kernel.org X-Gm-Message-State: APuU4Z9eV0QJ1jRmljkoBiEvZYNKZFV1h5A0q0sMhokCS76rI29ueUQv boZsVfAN2Fz0HNrh1ZFVnUb6ItJuGG0xgibtctrI5cG0D6IPgrnv7REL X-Gm-Gg: AZFdTZc+R11/bswRA0sVWGbK16jqbNPs5pgUI1K3atfCSWjaWAvGpDOFrGpA14g+fYf EsnVTuHmlSkxdSlBwyDHyj+OOiJIAlXPO48z3IvS7FuchY4nCYWhxZROr6JXskeRjZdks0h9ils w5bfBHgh/Vs14TTvHgp6Mxzpe0cDWnZBjSGjcDD85vUocOkdhWHWKsf5g9UtBNBJQiYp5pLLyNn 1uP/+1FMK5TBbYDg+ZFh/4iGpRpWB0kuLeNRmUi/fh9FfxSZUxkFw7m+M5ift8WAcU1L8awLRKC Dydla1X5Ecih8xNb6lT7STjeAO19NlsVT+BdvLlLDOpiN3LR1uhECzpsFgeX1VjyuJSwrzgd7Uw +JtxbRVdPaINNMm75ar/UaOXehw6WJtSVdHzKCVq/ga8Fqh305wP6R71ouFx/sJGn9xSc+NktgV HEPHbE3ThsWQHNY5z80JSmSvvoHfhZnJl+chRUIXB+TzDrnRj4Jf78mz1Fbl2tlAFhrZNK4rZaM a0o8hnXRAFHj5as4bVSZqIQwdjLpKbLYHFJyAh0TTty5LZER7IEiKCnRzBiYRNXl2vpzdlP+eO/ bDbE0ER9LmiBCdugm7YNdnXNFFOBlHAVXfGzZ4vMM7MwaMxzOjW7WzOTDnhwHvV+PGjnI/cY8+G IMr51UQ5FvZ5Z3mhZ7gSORl6vOnYfbBJ5L+BQC+fb98LefoJAPLoJOlyWa66HaAceEUiNyiGXJF rdjT2TH5NWDFhLGEsFBCEYz5S+YjnM6ix71mK+yCHSVdnaMJrORjrdJTyxYkxVfuyHzGl/zyo= 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-wireless@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