From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55541) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YlilG-0004rQ-S1 for qemu-devel@nongnu.org; Fri, 24 Apr 2015 14:55:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YlilD-0008Nx-Ju for qemu-devel@nongnu.org; Fri, 24 Apr 2015 14:55:38 -0400 Received: from mail-pd0-x22c.google.com ([2607:f8b0:400e:c02::22c]:34096) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YlilC-0008Mt-Sd for qemu-devel@nongnu.org; Fri, 24 Apr 2015 14:55:35 -0400 Received: by pdbqa5 with SMTP id qa5so56227206pdb.1 for ; Fri, 24 Apr 2015 11:55:33 -0700 (PDT) Sender: Daniel Stekloff Message-ID: <553A91AE.10708@wendan.org> Date: Fri, 24 Apr 2015 11:55:42 -0700 From: Daniel Stekloff MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] [PATCH] Enable NVMe start controller for Windows guest. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: keith.busch@intel.com, kwolf@redhat.com, stefanha@redhat.com 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 --- hw/block/nvme.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index 1e07166..ad988d7 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)) { -- 1.9.1