From: Daniel Stekloff Date: Fri, 24 Apr 2015 18:55:42 +0000 (-0700) Subject: Enable NVMe start controller for Windows guest. X-Git-Tag: v2.4.0-rc0~152^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4a4d614ff56b4cf15e83629946afe51dc116053f;p=thirdparty%2Fqemu.git Enable NVMe start controller for Windows guest. Windows seems to send two separate calls to NVMe controller configuration. The first sends configuration info and the second the enable bit. I couldn't enable the Windows 8.1 in-box NVMe driver with base Qemu. I made the following change to store the configuration data and then handle enable and NVMe driver works on Windows 8.1. I am not a Windows expert and I'm not entirely sure this is the correct approach. I'm offering it for anyone who wishes to use NVMe on Windows 8.1 using Qemu. I have tested this change with Linux and Windows guests with NVMe devices. Signed-off-by: Daniel Stekloff Acked-by: Keith Busch Signed-off-by: Kevin Wolf --- diff --git a/hw/block/nvme.c b/hw/block/nvme.c index 1e071662d20..ad988d7c24e 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -615,6 +615,13 @@ static void nvme_write_bar(NvmeCtrl *n, hwaddr offset, uint64_t data, n->bar.intmc = n->bar.intms; break; case 0x14: + /* Windows first sends data, then sends enable bit */ + if (!NVME_CC_EN(data) && !NVME_CC_EN(n->bar.cc) && + !NVME_CC_SHN(data) && !NVME_CC_SHN(n->bar.cc)) + { + n->bar.cc = data; + } + if (NVME_CC_EN(data) && !NVME_CC_EN(n->bar.cc)) { n->bar.cc = data; if (nvme_start_ctrl(n)) {