hw/block/nvme: fix shutdown/reset logic
A shutdown is only about flushing stuff. It is the host that should
delete any queues, so do not perform a reset here.
Also, on shutdown, make sure that the PMR is flushed if in use.
Fixes: 368f4e752cf9 ("hw/block/nvme: Process controller reset and shutdown differently")
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
Reviewed-by: Keith Busch <kbusch@kernel.org>
Tested-by: Dmitry Fomichev <dmitry.fomichev@wdc.com>
Reviewed-by: Dmitry Fomichev <dmitry.fomichev@wdc.com>
This commit is contained in:
parent
1b5804a80d
commit
165f134f3d
1 changed files with 5 additions and 7 deletions
|
|
@ -3419,7 +3419,7 @@ static void nvme_process_sq(void *opaque)
|
|||
}
|
||||
}
|
||||
|
||||
static void nvme_clear_ctrl(NvmeCtrl *n)
|
||||
static void nvme_ctrl_reset(NvmeCtrl *n)
|
||||
{
|
||||
NvmeNamespace *ns;
|
||||
int i;
|
||||
|
|
@ -3453,11 +3453,7 @@ static void nvme_clear_ctrl(NvmeCtrl *n)
|
|||
n->aer_queued = 0;
|
||||
n->outstanding_aers = 0;
|
||||
n->qs_created = false;
|
||||
}
|
||||
|
||||
static void nvme_ctrl_reset(NvmeCtrl *n)
|
||||
{
|
||||
nvme_clear_ctrl(n);
|
||||
n->bar.cc = 0;
|
||||
}
|
||||
|
||||
|
|
@ -3466,7 +3462,9 @@ static void nvme_ctrl_shutdown(NvmeCtrl *n)
|
|||
NvmeNamespace *ns;
|
||||
int i;
|
||||
|
||||
nvme_clear_ctrl(n);
|
||||
if (n->pmrdev) {
|
||||
memory_region_msync(&n->pmrdev->mr, 0, n->pmrdev->size);
|
||||
}
|
||||
|
||||
for (i = 1; i <= n->num_namespaces; i++) {
|
||||
ns = nvme_ns(n, i);
|
||||
|
|
@ -4318,7 +4316,7 @@ static void nvme_exit(PCIDevice *pci_dev)
|
|||
NvmeNamespace *ns;
|
||||
int i;
|
||||
|
||||
nvme_ctrl_shutdown(n);
|
||||
nvme_ctrl_reset(n);
|
||||
|
||||
for (i = 1; i <= n->num_namespaces; i++) {
|
||||
ns = nvme_ns(n, i);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue