qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL 0/3] pc, pci, vhost: fixes
@ 2017-06-08 19:36 Michael S. Tsirkin
  2017-06-08 19:36 ` [Qemu-devel] [PULL 1/3] vhost-user-bridge: fix iov_restore_front() warning Michael S. Tsirkin
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Michael S. Tsirkin @ 2017-06-08 19:36 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell

The following changes since commit 64175afc695c0672876fbbfc31b299c86d562cb4:

  arm_gicv3: Fix ICC_BPR1 reset value when EL3 not implemented (2017-06-07 17:21:44 +0100)

are available in the git repository at:

  git://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git tags/for_upstream

for you to fetch changes up to bc277a52fbea1532d1adf30ba0edf15ab3dcdead:

  hw/pcie: fix the generic pcie root port to support migration (2017-06-08 22:02:37 +0300)

----------------------------------------------------------------
pc, pci, vhost: fixes

Some fixes all over the place.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

----------------------------------------------------------------
Haozhong Zhang (1):
      nvdimm acpi: fix region format interface code

Marc-André Lureau (1):
      vhost-user-bridge: fix iov_restore_front() warning

Marcel Apfelbaum (1):
      hw/pcie: fix the generic pcie root port to support migration

 include/hw/compat.h                |  4 ++++
 hw/acpi/nvdimm.c                   |  7 ++++---
 hw/pci-bridge/gen_pcie_root_port.c | 25 +++++++++++++++++++++++++
 tests/vhost-user-bridge.c          | 11 +++++++++--
 4 files changed, 42 insertions(+), 5 deletions(-)

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

* [Qemu-devel] [PULL 1/3] vhost-user-bridge: fix iov_restore_front() warning
  2017-06-08 19:36 [Qemu-devel] [PULL 0/3] pc, pci, vhost: fixes Michael S. Tsirkin
@ 2017-06-08 19:36 ` Michael S. Tsirkin
  2017-06-08 19:36 ` [Qemu-devel] [PULL 2/3] nvdimm acpi: fix region format interface code Michael S. Tsirkin
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Michael S. Tsirkin @ 2017-06-08 19:36 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Marc-André Lureau, Dr . David Alan Gilbert,
	Jens Freimann, Victor Kaplansky, Yuanhan Liu

From: Marc-André Lureau <marcandre.lureau@redhat.com>

  CC      tests/vhost-user-bridge.o
/home/dgilbert/git/qemu-world3/tests/vhost-user-bridge.c:228:23: warning: variables 'front' and 'iov' used in loop condition not modified in loop body [-Wfor-loop-analysis]
    for (cur = front; front != iov; cur++) {
                      ^~~~~    ~~~
1 warning generated.

Fix the loop, document the function, and fix some related assert().

In practice, the loop bug was harmless because the front sg buffer is
enough to discard/restore the header size.

Reported-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Tested-by: Jens Freimann <jfreiman@redhat.com>
---
 tests/vhost-user-bridge.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/tests/vhost-user-bridge.c b/tests/vhost-user-bridge.c
index 8618c20..1e5b5ca 100644
--- a/tests/vhost-user-bridge.c
+++ b/tests/vhost-user-bridge.c
@@ -220,12 +220,18 @@ vubr_handle_tx(VuDev *dev, int qidx)
     free(elem);
 }
 
+
+/* this function reverse the effect of iov_discard_front() it must be
+ * called with 'front' being the original struct iovec and 'bytes'
+ * being the number of bytes you shaved off
+ */
 static void
 iov_restore_front(struct iovec *front, struct iovec *iov, size_t bytes)
 {
     struct iovec *cur;
 
-    for (cur = front; front != iov; cur++) {
+    for (cur = front; cur != iov; cur++) {
+        assert(bytes >= cur->iov_len);
         bytes -= cur->iov_len;
     }
 
@@ -302,7 +308,8 @@ vubr_backend_recv_cb(int sock, void *ctx)
             }
             iov_from_buf(sg, elem->in_num, 0, &hdr, sizeof hdr);
             total += hdrlen;
-            assert(iov_discard_front(&sg, &num, hdrlen) == hdrlen);
+            ret = iov_discard_front(&sg, &num, hdrlen);
+            assert(ret == hdrlen);
         }
 
         struct msghdr msg = {
-- 
MST

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

* [Qemu-devel] [PULL 2/3] nvdimm acpi: fix region format interface code
  2017-06-08 19:36 [Qemu-devel] [PULL 0/3] pc, pci, vhost: fixes Michael S. Tsirkin
  2017-06-08 19:36 ` [Qemu-devel] [PULL 1/3] vhost-user-bridge: fix iov_restore_front() warning Michael S. Tsirkin
@ 2017-06-08 19:36 ` Michael S. Tsirkin
  2017-06-08 19:36 ` [Qemu-devel] [PULL 3/3] hw/pcie: fix the generic pcie root port to support migration Michael S. Tsirkin
  2017-06-13 10:55 ` [Qemu-devel] [PULL 0/3] pc, pci, vhost: fixes Peter Maydell
  3 siblings, 0 replies; 5+ messages in thread
From: Michael S. Tsirkin @ 2017-06-08 19:36 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Haozhong Zhang, Stefan Hajnoczi, Igor Mammedov,
	Xiao Guangrong

From: Haozhong Zhang <haozhong.zhang@intel.com>

Per ACPI 6.2, section 5.2.25.6 and JEDEC Annex L Release 3, the
current region format interface code 0x201 indicates the block
addressed function interface 1, rather than a byte addressable
interface. Fix it by using 0x301 which indicates the byte addressable
no energy backed function interface 1.

Signed-off-by: Haozhong Zhang <haozhong.zhang@intel.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 hw/acpi/nvdimm.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/hw/acpi/nvdimm.c b/hw/acpi/nvdimm.c
index 8e7d6ec..b5734f5 100644
--- a/hw/acpi/nvdimm.c
+++ b/hw/acpi/nvdimm.c
@@ -338,9 +338,10 @@ static void nvdimm_build_structure_dcr(GArray *structures, DeviceState *dev)
     nfit_dcr->revision_id = cpu_to_le16(1 /* Current Revision supported
                                              in ACPI 6.0 is 1. */);
     nfit_dcr->serial_number = cpu_to_le32(sn);
-    nfit_dcr->fic = cpu_to_le16(0x201 /* Format Interface Code. See Chapter
-                                         2: NVDIMM Device Specific Method
-                                         (DSM) in DSM Spec Rev1.*/);
+    nfit_dcr->fic = cpu_to_le16(0x301 /* Format Interface Code:
+                                         Byte addressable, no energy backed.
+                                         See ACPI 6.2, sect 5.2.25.6 and
+                                         JEDEC Annex L Release 3. */);
 }
 
 static GArray *nvdimm_build_device_structure(void)
-- 
MST

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

* [Qemu-devel] [PULL 3/3] hw/pcie: fix the generic pcie root port to support migration
  2017-06-08 19:36 [Qemu-devel] [PULL 0/3] pc, pci, vhost: fixes Michael S. Tsirkin
  2017-06-08 19:36 ` [Qemu-devel] [PULL 1/3] vhost-user-bridge: fix iov_restore_front() warning Michael S. Tsirkin
  2017-06-08 19:36 ` [Qemu-devel] [PULL 2/3] nvdimm acpi: fix region format interface code Michael S. Tsirkin
@ 2017-06-08 19:36 ` Michael S. Tsirkin
  2017-06-13 10:55 ` [Qemu-devel] [PULL 0/3] pc, pci, vhost: fixes Peter Maydell
  3 siblings, 0 replies; 5+ messages in thread
From: Michael S. Tsirkin @ 2017-06-08 19:36 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Marcel Apfelbaum, Dr . David Alan Gilbert

From: Marcel Apfelbaum <marcel@redhat.com>

Add msix state to pcie-root-ports's vmstate
in order to support migration.

Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 include/hw/compat.h                |  4 ++++
 hw/pci-bridge/gen_pcie_root_port.c | 25 +++++++++++++++++++++++++
 2 files changed, 29 insertions(+)

diff --git a/include/hw/compat.h b/include/hw/compat.h
index 400c64b..26cd585 100644
--- a/include/hw/compat.h
+++ b/include/hw/compat.h
@@ -14,6 +14,10 @@
         .driver   = "virtio-net-device",\
         .property = "x-mtu-bypass-backend",\
         .value    = "off",\
+    },{\
+        .driver   = "pcie-root-port",\
+        .property = "x-migrate-msix",\
+        .value    = "false",\
     },
 
 #define HW_COMPAT_2_8 \
diff --git a/hw/pci-bridge/gen_pcie_root_port.c b/hw/pci-bridge/gen_pcie_root_port.c
index 8ebffa8..cb694d6 100644
--- a/hw/pci-bridge/gen_pcie_root_port.c
+++ b/hw/pci-bridge/gen_pcie_root_port.c
@@ -20,6 +20,14 @@
 #define GEN_PCIE_ROOT_PORT_AER_OFFSET           0x100
 #define GEN_PCIE_ROOT_PORT_MSIX_NR_VECTOR       1
 
+typedef struct GenPCIERootPort {
+    /*< private >*/
+    PCIESlot parent_obj;
+    /*< public >*/
+
+    bool migrate_msix;
+} GenPCIERootPort;
+
 static uint8_t gen_rp_aer_vector(const PCIDevice *d)
 {
     return 0;
@@ -45,6 +53,13 @@ static void gen_rp_interrupts_uninit(PCIDevice *d)
     msix_uninit_exclusive_bar(d);
 }
 
+static bool gen_rp_test_migrate_msix(void *opaque, int version_id)
+{
+    GenPCIERootPort *rp = opaque;
+
+    return rp->migrate_msix;
+}
+
 static const VMStateDescription vmstate_rp_dev = {
     .name = "pcie-root-port",
     .version_id = 1,
@@ -54,10 +69,18 @@ static const VMStateDescription vmstate_rp_dev = {
         VMSTATE_PCI_DEVICE(parent_obj.parent_obj.parent_obj, PCIESlot),
         VMSTATE_STRUCT(parent_obj.parent_obj.parent_obj.exp.aer_log,
                        PCIESlot, 0, vmstate_pcie_aer_log, PCIEAERLog),
+        VMSTATE_MSIX_TEST(parent_obj.parent_obj.parent_obj.parent_obj,
+                          GenPCIERootPort,
+                          gen_rp_test_migrate_msix),
         VMSTATE_END_OF_LIST()
     }
 };
 
+static Property gen_rp_props[] = {
+    DEFINE_PROP_BOOL("x-migrate-msix", GenPCIERootPort, migrate_msix, true),
+    DEFINE_PROP_END_OF_LIST()
+};
+
 static void gen_rp_dev_class_init(ObjectClass *klass, void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
@@ -68,6 +91,7 @@ static void gen_rp_dev_class_init(ObjectClass *klass, void *data)
     k->device_id = PCI_DEVICE_ID_REDHAT_PCIE_RP;
     dc->desc = "PCI Express Root Port";
     dc->vmsd = &vmstate_rp_dev;
+    dc->props = gen_rp_props;
     rpc->aer_vector = gen_rp_aer_vector;
     rpc->interrupts_init = gen_rp_interrupts_init;
     rpc->interrupts_uninit = gen_rp_interrupts_uninit;
@@ -77,6 +101,7 @@ static void gen_rp_dev_class_init(ObjectClass *klass, void *data)
 static const TypeInfo gen_rp_dev_info = {
     .name          = TYPE_GEN_PCIE_ROOT_PORT,
     .parent        = TYPE_PCIE_ROOT_PORT,
+    .instance_size = sizeof(GenPCIERootPort),
     .class_init    = gen_rp_dev_class_init,
 };
 
-- 
MST

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

* Re: [Qemu-devel] [PULL 0/3] pc, pci, vhost: fixes
  2017-06-08 19:36 [Qemu-devel] [PULL 0/3] pc, pci, vhost: fixes Michael S. Tsirkin
                   ` (2 preceding siblings ...)
  2017-06-08 19:36 ` [Qemu-devel] [PULL 3/3] hw/pcie: fix the generic pcie root port to support migration Michael S. Tsirkin
@ 2017-06-13 10:55 ` Peter Maydell
  3 siblings, 0 replies; 5+ messages in thread
From: Peter Maydell @ 2017-06-13 10:55 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: QEMU Developers

On 8 June 2017 at 20:36, Michael S. Tsirkin <mst@redhat.com> wrote:
> The following changes since commit 64175afc695c0672876fbbfc31b299c86d562cb4:
>
>   arm_gicv3: Fix ICC_BPR1 reset value when EL3 not implemented (2017-06-07 17:21:44 +0100)
>
> are available in the git repository at:
>
>   git://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git tags/for_upstream
>
> for you to fetch changes up to bc277a52fbea1532d1adf30ba0edf15ab3dcdead:
>
>   hw/pcie: fix the generic pcie root port to support migration (2017-06-08 22:02:37 +0300)
>
> ----------------------------------------------------------------
> pc, pci, vhost: fixes
>
> Some fixes all over the place.
>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
>

Applied, thanks.

-- PMM

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

end of thread, other threads:[~2017-06-13 10:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-08 19:36 [Qemu-devel] [PULL 0/3] pc, pci, vhost: fixes Michael S. Tsirkin
2017-06-08 19:36 ` [Qemu-devel] [PULL 1/3] vhost-user-bridge: fix iov_restore_front() warning Michael S. Tsirkin
2017-06-08 19:36 ` [Qemu-devel] [PULL 2/3] nvdimm acpi: fix region format interface code Michael S. Tsirkin
2017-06-08 19:36 ` [Qemu-devel] [PULL 3/3] hw/pcie: fix the generic pcie root port to support migration Michael S. Tsirkin
2017-06-13 10:55 ` [Qemu-devel] [PULL 0/3] pc, pci, vhost: fixes 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).