Commit 68a5c91
nvmet: pci-epf: Correctly initialize CSTS when enabling the controller
The function nvmet_pci_epf_poll_cc_work() sets the NVME_CSTS_RDY bit of
the controller status register (CSTS) when nvmet_pci_epf_enable_ctrl()
returns success. However, since this function can be called several
times (e.g. if the host reboots), instead of setting the bit in
ctrl->csts, initialize this field to only have NVME_CSTS_RDY set.
Conversely, if nvmet_pci_epf_enable_ctrl() fails, make sure to clear all
bits from ctrl->csts.
To simplify nvmet_pci_epf_poll_cc_work(), initialize ctrl->csts to
NVME_CSTS_RDY directly inside nvmet_pci_epf_enable_ctrl() and clear this
field in that function as well in case of a failure. To be consistent,
move clearing the NVME_CSTS_RDY bit from ctrl->csts when the controller
is being disabled from nvmet_pci_epf_poll_cc_work() into
nvmet_pci_epf_disable_ctrl().
Fixes: 0faa0fe ("nvmet: New NVMe PCI endpoint function target driver")
Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Keith Busch <kbusch@kernel.org>1 parent 3988ac1 commit 68a5c91
1 file changed
Lines changed: 12 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1822 | 1822 | | |
1823 | 1823 | | |
1824 | 1824 | | |
1825 | | - | |
| 1825 | + | |
1826 | 1826 | | |
1827 | 1827 | | |
1828 | 1828 | | |
1829 | 1829 | | |
1830 | 1830 | | |
1831 | 1831 | | |
1832 | | - | |
| 1832 | + | |
1833 | 1833 | | |
1834 | 1834 | | |
1835 | 1835 | | |
| |||
1844 | 1844 | | |
1845 | 1845 | | |
1846 | 1846 | | |
1847 | | - | |
| 1847 | + | |
1848 | 1848 | | |
1849 | 1849 | | |
1850 | 1850 | | |
| |||
1854 | 1854 | | |
1855 | 1855 | | |
1856 | 1856 | | |
1857 | | - | |
| 1857 | + | |
1858 | 1858 | | |
1859 | 1859 | | |
1860 | 1860 | | |
1861 | 1861 | | |
1862 | 1862 | | |
| 1863 | + | |
1863 | 1864 | | |
1864 | 1865 | | |
1865 | 1866 | | |
1866 | 1867 | | |
1867 | 1868 | | |
| 1869 | + | |
| 1870 | + | |
| 1871 | + | |
| 1872 | + | |
1868 | 1873 | | |
1869 | 1874 | | |
1870 | 1875 | | |
| |||
1889 | 1894 | | |
1890 | 1895 | | |
1891 | 1896 | | |
| 1897 | + | |
| 1898 | + | |
1892 | 1899 | | |
1893 | 1900 | | |
1894 | 1901 | | |
| |||
1909 | 1916 | | |
1910 | 1917 | | |
1911 | 1918 | | |
1912 | | - | |
1913 | 1919 | | |
1914 | 1920 | | |
1915 | | - | |
| 1921 | + | |
1916 | 1922 | | |
1917 | | - | |
1918 | | - | |
1919 | 1923 | | |
1920 | 1924 | | |
1921 | 1925 | | |
| |||
0 commit comments