All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] Enable NVMe start controller for Windows guest.
@ 2015-04-24 18:55 Daniel Stekloff
  2015-04-24 19:19 ` Keith Busch
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Stekloff @ 2015-04-24 18:55 UTC (permalink / raw)
  To: qemu-devel; +Cc: keith.busch, kwolf, stefanha

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 <dan@wendan.org>

---
 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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] Enable NVMe start controller for Windows guest.
  2015-04-24 18:55 [Qemu-devel] [PATCH] Enable NVMe start controller for Windows guest Daniel Stekloff
@ 2015-04-24 19:19 ` Keith Busch
  2015-04-30 13:36   ` Kevin Wolf
  0 siblings, 1 reply; 3+ messages in thread
From: Keith Busch @ 2015-04-24 19:19 UTC (permalink / raw)
  To: Daniel Stekloff; +Cc: keith.busch, kwolf, qemu-devel, stefanha

On Fri, 24 Apr 2015, Daniel Stekloff wrote:
> 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.

Hm, Microsoft's driver must be issuing MMIO reads to mask in the enable
bit rather than keep the state known. Sounds odd, but thanks for the fix.

Acked-by: Keith Busch <keith.busch@intel.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] Enable NVMe start controller for Windows guest.
  2015-04-24 19:19 ` Keith Busch
@ 2015-04-30 13:36   ` Kevin Wolf
  0 siblings, 0 replies; 3+ messages in thread
From: Kevin Wolf @ 2015-04-30 13:36 UTC (permalink / raw)
  To: Keith Busch; +Cc: Daniel Stekloff, qemu-block, qemu-devel, stefanha

[Cc: qemu-block]

Am 24.04.2015 um 21:19 hat Keith Busch geschrieben:
> On Fri, 24 Apr 2015, Daniel Stekloff wrote:
> >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.
> 
> Hm, Microsoft's driver must be issuing MMIO reads to mask in the enable
> bit rather than keep the state known. Sounds odd, but thanks for the fix.
> 
> Acked-by: Keith Busch <keith.busch@intel.com>

Thanks, applied to the block branch.

Kevin

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-04-30 13:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-24 18:55 [Qemu-devel] [PATCH] Enable NVMe start controller for Windows guest Daniel Stekloff
2015-04-24 19:19 ` Keith Busch
2015-04-30 13:36   ` Kevin Wolf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.