aboutsummaryrefslogtreecommitdiff
path: root/hw/block
diff options
context:
space:
mode:
Diffstat (limited to 'hw/block')
-rw-r--r--hw/block/nvme.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/hw/block/nvme.c b/hw/block/nvme.c
index 41a15da3f6..298b250199 100644
--- a/hw/block/nvme.c
+++ b/hw/block/nvme.c
@@ -1181,6 +1181,10 @@ static uint16_t nvme_set_feature(NvmeCtrl *n, NvmeCmd *cmd, NvmeRequest *req)
break;
case NVME_VOLATILE_WRITE_CACHE:
+ if (!(dw11 & 0x1) && blk_enable_write_cache(n->conf.blk)) {
+ blk_flush(n->conf.blk);
+ }
+
blk_set_enable_write_cache(n->conf.blk, dw11 & 1);
break;
case NVME_NUMBER_OF_QUEUES: