qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL 0/3] Block layer patches for 2.7.0-rc2
@ 2016-08-05  9:32 Kevin Wolf
  2016-08-05  9:32 ` [Qemu-devel] [PULL 1/3] block: Accept any target node for transactional blockdev-backup Kevin Wolf
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Kevin Wolf @ 2016-08-05  9:32 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, peter.maydell, qemu-devel

The following changes since commit 42e0d60f1615ef63d16e41bb1668805560c37870:

  Merge remote-tracking branch 'remotes/riku/tags/pull-linux-user-20160804' into staging (2016-08-04 18:36:05 +0100)

are available in the git repository at:


  git://repo.or.cz/qemu/kevin.git tags/for-upstream

for you to fetch changes up to 47989f14472262a289894058f7babf1db37edda5:

  nvme: bump PCI revision (2016-08-05 10:56:08 +0200)

----------------------------------------------------------------
Block layer patches for 2.7.0-rc2

----------------------------------------------------------------
Christoph Hellwig (2):
      nvme: fix identify to be NVMe 1.1 compliant
      nvme: bump PCI revision

Kevin Wolf (1):
      block: Accept any target node for transactional blockdev-backup

 blockdev.c           |  8 +++----
 hw/block/nvme.c      | 61 +++++++++++++++++++++++++++++++++++++++++++++-------
 qapi/block-core.json |  2 +-
 3 files changed, 58 insertions(+), 13 deletions(-)

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

* [Qemu-devel] [PULL 1/3] block: Accept any target node for transactional blockdev-backup
  2016-08-05  9:32 [Qemu-devel] [PULL 0/3] Block layer patches for 2.7.0-rc2 Kevin Wolf
@ 2016-08-05  9:32 ` Kevin Wolf
  2016-08-05  9:32 ` [Qemu-devel] [PULL 2/3] nvme: fix identify to be NVMe 1.1 compliant Kevin Wolf
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Kevin Wolf @ 2016-08-05  9:32 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, peter.maydell, qemu-devel

Commit 0d978913 changed blockdev-backup to accept arbitrary node names
instead of device names (i.e. root nodes) for the backup target.
However, it forgot to make the same change in transactions and to update
the documentation. This patch fixes these omissions.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 blockdev.c           | 8 ++++----
 qapi/block-core.json | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/blockdev.c b/blockdev.c
index eafeba9..2161400 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -1937,7 +1937,8 @@ static void blockdev_backup_prepare(BlkActionState *common, Error **errp)
 {
     BlockdevBackupState *state = DO_UPCAST(BlockdevBackupState, common, common);
     BlockdevBackup *backup;
-    BlockBackend *blk, *target;
+    BlockBackend *blk;
+    BlockDriverState *target;
     Error *local_err = NULL;
 
     assert(common->action->type == TRANSACTION_ACTION_KIND_BLOCKDEV_BACKUP);
@@ -1954,15 +1955,14 @@ static void blockdev_backup_prepare(BlkActionState *common, Error **errp)
         return;
     }
 
-    target = blk_by_name(backup->target);
+    target = bdrv_lookup_bs(backup->target, backup->target, errp);
     if (!target) {
-        error_setg(errp, "Device '%s' not found", backup->target);
         return;
     }
 
     /* AioContext is released in .clean() */
     state->aio_context = blk_get_aio_context(blk);
-    if (state->aio_context != blk_get_aio_context(target)) {
+    if (state->aio_context != bdrv_get_aio_context(target)) {
         state->aio_context = NULL;
         error_setg(errp, "Backup between two IO threads is not implemented");
         return;
diff --git a/qapi/block-core.json b/qapi/block-core.json
index 2bbc027..5e2d7d7 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
@@ -927,7 +927,7 @@
 #
 # @device: the name of the device which should be copied.
 #
-# @target: the name of the backup target device.
+# @target: the device name or node-name of the backup target node.
 #
 # @sync: what parts of the disk image should be copied to the destination
 #        (all the disk, only the sectors allocated in the topmost image, or
-- 
1.8.3.1

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

* [Qemu-devel] [PULL 2/3] nvme: fix identify to be NVMe 1.1 compliant
  2016-08-05  9:32 [Qemu-devel] [PULL 0/3] Block layer patches for 2.7.0-rc2 Kevin Wolf
  2016-08-05  9:32 ` [Qemu-devel] [PULL 1/3] block: Accept any target node for transactional blockdev-backup Kevin Wolf
@ 2016-08-05  9:32 ` Kevin Wolf
  2016-08-05  9:32 ` [Qemu-devel] [PULL 3/3] nvme: bump PCI revision Kevin Wolf
  2016-08-05 13:09 ` [Qemu-devel] [PULL 0/3] Block layer patches for 2.7.0-rc2 Peter Maydell
  3 siblings, 0 replies; 5+ messages in thread
From: Kevin Wolf @ 2016-08-05  9:32 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, peter.maydell, qemu-devel

From: Christoph Hellwig <hch@lst.de>

NVMe 1.1 requires devices to implement a Namespace List subcommand of
the identify command.  Qemu not only not implements this features, but
also misinterprets it as an Identify Controller request.  Due to this
any OS trying to use the Namespace List will fail the probe.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 hw/block/nvme.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++-------
 1 file changed, 52 insertions(+), 7 deletions(-)

diff --git a/hw/block/nvme.c b/hw/block/nvme.c
index 2ded247..a0655a3 100644
--- a/hw/block/nvme.c
+++ b/hw/block/nvme.c
@@ -469,19 +469,22 @@ static uint16_t nvme_create_cq(NvmeCtrl *n, NvmeCmd *cmd)
     return NVME_SUCCESS;
 }
 
-static uint16_t nvme_identify(NvmeCtrl *n, NvmeCmd *cmd)
+static uint16_t nvme_identify_ctrl(NvmeCtrl *n, NvmeIdentify *c)
+{
+    uint64_t prp1 = le64_to_cpu(c->prp1);
+    uint64_t prp2 = le64_to_cpu(c->prp2);
+
+    return nvme_dma_read_prp(n, (uint8_t *)&n->id_ctrl, sizeof(n->id_ctrl),
+        prp1, prp2);
+}
+
+static uint16_t nvme_identify_ns(NvmeCtrl *n, NvmeIdentify *c)
 {
     NvmeNamespace *ns;
-    NvmeIdentify *c = (NvmeIdentify *)cmd;
-    uint32_t cns  = le32_to_cpu(c->cns);
     uint32_t nsid = le32_to_cpu(c->nsid);
     uint64_t prp1 = le64_to_cpu(c->prp1);
     uint64_t prp2 = le64_to_cpu(c->prp2);
 
-    if (cns) {
-        return nvme_dma_read_prp(n, (uint8_t *)&n->id_ctrl, sizeof(n->id_ctrl),
-            prp1, prp2);
-    }
     if (nsid == 0 || nsid > n->num_namespaces) {
         return NVME_INVALID_NSID | NVME_DNR;
     }
@@ -491,6 +494,48 @@ static uint16_t nvme_identify(NvmeCtrl *n, NvmeCmd *cmd)
         prp1, prp2);
 }
 
+static uint16_t nvme_identify_nslist(NvmeCtrl *n, NvmeIdentify *c)
+{
+    static const int data_len = 4096;
+    uint32_t min_nsid = le32_to_cpu(c->nsid);
+    uint64_t prp1 = le64_to_cpu(c->prp1);
+    uint64_t prp2 = le64_to_cpu(c->prp2);
+    uint32_t *list;
+    uint16_t ret;
+    int i, j = 0;
+
+    list = g_malloc0(data_len);
+    for (i = 0; i < n->num_namespaces; i++) {
+        if (i < min_nsid) {
+            continue;
+        }
+        list[j++] = cpu_to_le32(i + 1);
+        if (j == data_len / sizeof(uint32_t)) {
+            break;
+        }
+    }
+    ret = nvme_dma_read_prp(n, (uint8_t *)list, data_len, prp1, prp2);
+    g_free(list);
+    return ret;
+}
+
+
+static uint16_t nvme_identify(NvmeCtrl *n, NvmeCmd *cmd)
+{
+    NvmeIdentify *c = (NvmeIdentify *)cmd;
+
+    switch (le32_to_cpu(c->cns)) {
+    case 0x00:
+        return nvme_identify_ns(n, c);
+    case 0x01:
+        return nvme_identify_ctrl(n, c);
+    case 0x02:
+        return nvme_identify_nslist(n, c);
+    default:
+        return NVME_INVALID_FIELD | NVME_DNR;
+    }
+}
+
 static uint16_t nvme_get_feature(NvmeCtrl *n, NvmeCmd *cmd, NvmeRequest *req)
 {
     uint32_t dw10 = le32_to_cpu(cmd->cdw10);
-- 
1.8.3.1

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

* [Qemu-devel] [PULL 3/3] nvme: bump PCI revision
  2016-08-05  9:32 [Qemu-devel] [PULL 0/3] Block layer patches for 2.7.0-rc2 Kevin Wolf
  2016-08-05  9:32 ` [Qemu-devel] [PULL 1/3] block: Accept any target node for transactional blockdev-backup Kevin Wolf
  2016-08-05  9:32 ` [Qemu-devel] [PULL 2/3] nvme: fix identify to be NVMe 1.1 compliant Kevin Wolf
@ 2016-08-05  9:32 ` Kevin Wolf
  2016-08-05 13:09 ` [Qemu-devel] [PULL 0/3] Block layer patches for 2.7.0-rc2 Peter Maydell
  3 siblings, 0 replies; 5+ messages in thread
From: Kevin Wolf @ 2016-08-05  9:32 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, peter.maydell, qemu-devel

From: Christoph Hellwig <hch@lst.de>

The broken Identify implementation in earlier Qemu versions means we
need to blacklist it from issueing the NVMe 1.1 Identify Namespace List
command.  As we want to be able to use it in newer Qemu versions we need
a way to identify those.  Bump the PCI revision as a guest visible
indicator of this bug fix.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 hw/block/nvme.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/block/nvme.c b/hw/block/nvme.c
index a0655a3..cef3bb4 100644
--- a/hw/block/nvme.c
+++ b/hw/block/nvme.c
@@ -954,7 +954,7 @@ static void nvme_class_init(ObjectClass *oc, void *data)
     pc->class_id = PCI_CLASS_STORAGE_EXPRESS;
     pc->vendor_id = PCI_VENDOR_ID_INTEL;
     pc->device_id = 0x5845;
-    pc->revision = 1;
+    pc->revision = 2;
     pc->is_express = 1;
 
     set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
-- 
1.8.3.1

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

* Re: [Qemu-devel] [PULL 0/3] Block layer patches for 2.7.0-rc2
  2016-08-05  9:32 [Qemu-devel] [PULL 0/3] Block layer patches for 2.7.0-rc2 Kevin Wolf
                   ` (2 preceding siblings ...)
  2016-08-05  9:32 ` [Qemu-devel] [PULL 3/3] nvme: bump PCI revision Kevin Wolf
@ 2016-08-05 13:09 ` Peter Maydell
  3 siblings, 0 replies; 5+ messages in thread
From: Peter Maydell @ 2016-08-05 13:09 UTC (permalink / raw)
  To: Kevin Wolf; +Cc: Qemu-block, QEMU Developers

On 5 August 2016 at 10:32, Kevin Wolf <kwolf@redhat.com> wrote:
> The following changes since commit 42e0d60f1615ef63d16e41bb1668805560c37870:
>
>   Merge remote-tracking branch 'remotes/riku/tags/pull-linux-user-20160804' into staging (2016-08-04 18:36:05 +0100)
>
> are available in the git repository at:
>
>
>   git://repo.or.cz/qemu/kevin.git tags/for-upstream
>
> for you to fetch changes up to 47989f14472262a289894058f7babf1db37edda5:
>
>   nvme: bump PCI revision (2016-08-05 10:56:08 +0200)
>
> ----------------------------------------------------------------
> Block layer patches for 2.7.0-rc2
>
> ----------------------------------------------------------------
> Christoph Hellwig (2):
>       nvme: fix identify to be NVMe 1.1 compliant
>       nvme: bump PCI revision
>
> Kevin Wolf (1):
>       block: Accept any target node for transactional blockdev-backup

Applied, thanks.

-- PMM

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

end of thread, other threads:[~2016-08-05 13:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-05  9:32 [Qemu-devel] [PULL 0/3] Block layer patches for 2.7.0-rc2 Kevin Wolf
2016-08-05  9:32 ` [Qemu-devel] [PULL 1/3] block: Accept any target node for transactional blockdev-backup Kevin Wolf
2016-08-05  9:32 ` [Qemu-devel] [PULL 2/3] nvme: fix identify to be NVMe 1.1 compliant Kevin Wolf
2016-08-05  9:32 ` [Qemu-devel] [PULL 3/3] nvme: bump PCI revision Kevin Wolf
2016-08-05 13:09 ` [Qemu-devel] [PULL 0/3] Block layer patches for 2.7.0-rc2 Peter Maydell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).