summaryrefslogtreecommitdiffstats
path: root/rust/helpers/helpers.c
diff options
context:
space:
mode:
authorDamien Le Moal <dlemoal@kernel.org>2025-04-11 10:42:10 +0900
committerChristoph Hellwig <hch@lst.de>2025-04-16 07:37:37 +0200
commitf8e01fa93f3e4fc255d240cfa0c045ce0b5c97ea (patch)
tree08ac1c51db18ebc456d9dacec94b461459d98fba /rust/helpers/helpers.c
parentffe0398c7d6a38af0584d4668d3762b7a97e2275 (diff)
downloadlinux-f8e01fa93f3e4fc255d240cfa0c045ce0b5c97ea.tar.gz
linux-f8e01fa93f3e4fc255d240cfa0c045ce0b5c97ea.tar.bz2
linux-f8e01fa93f3e4fc255d240cfa0c045ce0b5c97ea.zip
nvmet: pci-epf: clear CC and CSTS when disabling the controller
When a host shuts down the controller when shutting down but does so without first disabling the controller, the enable bit remains set in the controller configuration register. When the host restarts and attempts to enable the controller again, the nvmet_pci_epf_poll_cc_work() function is unable to detect the change from 0 to 1 of the enable bit, and thus the controller is not enabled again, which result in a device scan timeout on the host. This problem also occurs if the host shuts down uncleanly or if the PCIe link goes down: as the CC.EN value is not reset, the controller is not enabled again when the host restarts. Fix this by introducing the function nvmet_pci_epf_clear_ctrl_config() to clear the CC and CSTS registers of the controller when the PCIe link is lost (nvmet_pci_epf_stop_ctrl() function), or when starting the controller fails (nvmet_pci_epf_enable_ctrl() fails). Also use this function in nvmet_pci_epf_init_bar() to simplify the initialization of the CC and CSTS registers. Furthermore, modify the function nvmet_pci_epf_disable_ctrl() to clear the CC.EN bit and write this updated value to the BAR register when the controller is shutdown by the host, to ensure that upon restart, we can detect the host setting CC.EN. Fixes: 0faa0fe6f90e ("nvmet: New NVMe PCI endpoint function target driver") Signed-off-by: Damien Le Moal <dlemoal@kernel.org> Reviewed-by: Niklas Cassel <cassel@kernel.org> Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'rust/helpers/helpers.c')
0 files changed, 0 insertions, 0 deletions