hw/block/nvme: Process controller reset and shutdown differently
commitba69f224817437b5280f4c8ef511d09f17ab1305
authorDmitry Fomichev <dmitry.fomichev@wdc.com>
Tue, 8 Dec 2020 20:03:58 +0000 (9 05:03 +0900)
committerKlaus Jensen <k.jensen@samsung.com>
Mon, 8 Feb 2021 17:55:48 +0000 (8 18:55 +0100)
tree02ac926e221582024affbfff566d12dfe7ac09c6
parente1f81c1478398713f14c1b6ba011d4bb841dea27
hw/block/nvme: Process controller reset and shutdown differently

Controller reset ans subsystem shutdown are handled very much the same
in the current code, but some of the steps should be different in these
two cases.

Introduce two new functions, nvme_reset_ctrl() and nvme_shutdown_ctrl(),
to separate some portions of the code from nvme_clear_ctrl(). The steps
that are made different between reset and shutdown are that BAR.CC is not
reset to zero upon the shutdown and namespace data is flushed to
backing storage as a part of shutdown handling, but not upon reset.

Suggested-by: Klaus Jensen <k.jensen@samsung.com>
Signed-off-by: Dmitry Fomichev <dmitry.fomichev@wdc.com>
Reviewed-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
hw/block/nvme-ns.c
hw/block/nvme-ns.h
hw/block/nvme.c