All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL 00/24] SCSI, maintainers and more - 2014-10-17
@ 2014-10-23 13:33 Paolo Bonzini
  2014-10-23 13:33 ` [Qemu-devel] [PULL 01/24] virtio-scsi-dataplane: Add op blocker Paolo Bonzini
                   ` (24 more replies)
  0 siblings, 25 replies; 27+ messages in thread
From: Paolo Bonzini @ 2014-10-23 13:33 UTC (permalink / raw)
  To: qemu-devel

The following changes since commit 5f77ef69a195098baddfdc6d189f1b4a94587378:

  glib: add compatibility interface for g_strcmp0() (2014-10-16 23:02:31 +0100)

are available in the git repository at:

  git://github.com/bonzini/qemu.git tags/for-upstream

for you to fetch changes up to 6dad2b7b17ddfeb8276d2e359cb2383a8ae98d37:

  get_maintainer.pl: restrict cases where it falls back to --git (2014-10-22 15:56:34 +0200)

----------------------------------------------------------------
virtio-scsi-dataplane fixes and the first part of dynamic sysbus devices
Also MAINTAINERS updates, they are fancy these days. :)

----------------------------------------------------------------
Cornelia Huck (3):
      virtio-scsi: dataplane: print why starting failed
      virtio-scsi: dataplane: fail setup gracefully
      virtio-scsi: dataplane: stop trying on notifier error

Fam Zheng (1):
      virtio-scsi-dataplane: Add op blocker

Li Liu (1):
      qtest: fix qtest log fd should be initialized before qtest chardev

Paolo Bonzini (8):
      MAINTAINERS: grab more files from Anthony's pile
      MAINTAINERS: add Samuel Thibault as usb-serial.c and baum.c maintainer
      MAINTAINERS: add myself for X86
      MAINTAINERS: Add more TCG files
      MAINTAINERS: add some tests directories
      MAINTAINERS: avoid M entries that point to mailing lists
      get_maintainer.pl: move git loop under "if ($email) {"
      get_maintainer.pl: restrict cases where it falls back to --git

Peter Crosthwaite (10):
      qom: Allow clearing of a Link property
      qom: Demote already-has-a-parent to a regular error
      qdev: gpio: Re-implement qdev_connect_gpio QOM style
      qdev: gpio: Add API for intercepting a GPIO
      qtest/irq: Rework IRQ interception
      irq: Remove qemu_irq_intercept_out
      qdev: gpio: delete NamedGPIOList::out
      qdev: gpio: Remove qdev_init_gpio_out x1 restriction
      qdev: gpio: Define qdev_pass_gpios()
      sysbus: Use TYPE_DEVICE GPIO functionality

Wei Huang (1):
      target-i386: warns users when CPU threads>1 for non-Intel CPUs

 MAINTAINERS                     |  59 +++++++++++++++++++----
 hw/core/irq.c                   |   8 +---
 hw/core/qdev.c                  |  70 ++++++++++++++++++++++++---
 hw/core/sysbus.c                |  20 ++------
 hw/scsi/virtio-scsi-dataplane.c | 102 +++++++++++++++++++++++++++++++++++-----
 hw/scsi/virtio-scsi.c           |  19 +++++++-
 include/hw/irq.h                |   1 -
 include/hw/qdev-core.h          |   6 ++-
 include/hw/sysbus.h             |   7 ++-
 include/hw/virtio/virtio-scsi.h |   2 +
 qom/object.c                    |  16 +++++--
 qtest.c                         |  24 ++++++----
 scripts/get_maintainer.pl       |  28 +++++++----
 target-i386/cpu.c               |  26 ++++++++--
 14 files changed, 303 insertions(+), 85 deletions(-)
-- 
1.8.3.1

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

* [Qemu-devel] [PULL 01/24] virtio-scsi-dataplane: Add op blocker
  2014-10-23 13:33 [Qemu-devel] [PULL 00/24] SCSI, maintainers and more - 2014-10-17 Paolo Bonzini
@ 2014-10-23 13:33 ` Paolo Bonzini
  2014-10-23 13:33 ` [Qemu-devel] [PULL 02/24] virtio-scsi: dataplane: print why starting failed Paolo Bonzini
                   ` (23 subsequent siblings)
  24 siblings, 0 replies; 27+ messages in thread
From: Paolo Bonzini @ 2014-10-23 13:33 UTC (permalink / raw)
  To: qemu-devel; +Cc: Fam Zheng

From: Fam Zheng <famz@redhat.com>

We need this to protect dataplane thread from race conditions with block
jobs until the latter is made dataplane-safe.

Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/scsi/virtio-scsi-dataplane.c |  4 ++++
 hw/scsi/virtio-scsi.c           | 19 +++++++++++++++++--
 include/hw/virtio/virtio-scsi.h |  1 +
 3 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/hw/scsi/virtio-scsi-dataplane.c b/hw/scsi/virtio-scsi-dataplane.c
index b778e05..97c2a4f 100644
--- a/hw/scsi/virtio-scsi-dataplane.c
+++ b/hw/scsi/virtio-scsi-dataplane.c
@@ -154,6 +154,8 @@ void virtio_scsi_dataplane_start(VirtIOSCSI *s)
 
     s->dataplane_starting = true;
 
+    assert(!s->blocker);
+    error_setg(&s->blocker, "block device is in use by data plane");
     /* Set up guest notifier (irq) */
     rc = k->set_guest_notifiers(qbus->parent, vs->conf.num_queues + 2, true);
     if (rc != 0) {
@@ -194,6 +196,8 @@ void virtio_scsi_dataplane_stop(VirtIOSCSI *s)
     if (!s->dataplane_started || s->dataplane_stopping) {
         return;
     }
+    error_free(s->blocker);
+    s->blocker = NULL;
     s->dataplane_stopping = true;
     assert(s->ctx == iothread_get_aio_context(vs->conf.iothread));
 
diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c
index 8547ea0..99fddee 100644
--- a/hw/scsi/virtio-scsi.c
+++ b/hw/scsi/virtio-scsi.c
@@ -741,9 +741,18 @@ static void virtio_scsi_hotplug(HotplugHandler *hotplug_dev, DeviceState *dev,
                                 Error **errp)
 {
     VirtIODevice *vdev = VIRTIO_DEVICE(hotplug_dev);
+    VirtIOSCSI *s = VIRTIO_SCSI(vdev);
+    SCSIDevice *sd = SCSI_DEVICE(dev);
+
+    if (s->ctx && !s->dataplane_disabled) {
+        if (bdrv_op_is_blocked(sd->conf.bs, BLOCK_OP_TYPE_DATAPLANE, errp)) {
+            return;
+        }
+        bdrv_op_block_all(sd->conf.bs, s->blocker);
+    }
 
     if ((vdev->guest_features >> VIRTIO_SCSI_F_HOTPLUG) & 1) {
-        virtio_scsi_push_event(VIRTIO_SCSI(hotplug_dev), SCSI_DEVICE(dev),
+        virtio_scsi_push_event(s, sd,
                                VIRTIO_SCSI_T_TRANSPORT_RESET,
                                VIRTIO_SCSI_EVT_RESET_RESCAN);
     }
@@ -753,12 +762,18 @@ static void virtio_scsi_hotunplug(HotplugHandler *hotplug_dev, DeviceState *dev,
                                   Error **errp)
 {
     VirtIODevice *vdev = VIRTIO_DEVICE(hotplug_dev);
+    VirtIOSCSI *s = VIRTIO_SCSI(vdev);
+    SCSIDevice *sd = SCSI_DEVICE(dev);
 
     if ((vdev->guest_features >> VIRTIO_SCSI_F_HOTPLUG) & 1) {
-        virtio_scsi_push_event(VIRTIO_SCSI(hotplug_dev), SCSI_DEVICE(dev),
+        virtio_scsi_push_event(s, sd,
                                VIRTIO_SCSI_T_TRANSPORT_RESET,
                                VIRTIO_SCSI_EVT_RESET_REMOVED);
     }
+
+    if (s->ctx) {
+        bdrv_op_unblock_all(sd->conf.bs, s->blocker);
+    }
     qdev_simple_device_unplug_cb(hotplug_dev, dev, errp);
 }
 
diff --git a/include/hw/virtio/virtio-scsi.h b/include/hw/virtio/virtio-scsi.h
index d6e5e79..1ce0858 100644
--- a/include/hw/virtio/virtio-scsi.h
+++ b/include/hw/virtio/virtio-scsi.h
@@ -195,6 +195,7 @@ typedef struct VirtIOSCSI {
     bool dataplane_starting;
     bool dataplane_stopping;
     bool dataplane_disabled;
+    Error *blocker;
     Notifier migration_state_notifier;
 } VirtIOSCSI;
 
-- 
1.8.3.1

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

* [Qemu-devel] [PULL 02/24] virtio-scsi: dataplane: print why starting failed
  2014-10-23 13:33 [Qemu-devel] [PULL 00/24] SCSI, maintainers and more - 2014-10-17 Paolo Bonzini
  2014-10-23 13:33 ` [Qemu-devel] [PULL 01/24] virtio-scsi-dataplane: Add op blocker Paolo Bonzini
@ 2014-10-23 13:33 ` Paolo Bonzini
  2014-10-23 13:33 ` [Qemu-devel] [PULL 03/24] virtio-scsi: dataplane: fail setup gracefully Paolo Bonzini
                   ` (22 subsequent siblings)
  24 siblings, 0 replies; 27+ messages in thread
From: Paolo Bonzini @ 2014-10-23 13:33 UTC (permalink / raw)
  To: qemu-devel; +Cc: Cornelia Huck

From: Cornelia Huck <cornelia.huck@de.ibm.com>

Setting up guest or host notifiers may fail, but the user will have
no idea why: Let's print the error returned by the callback.

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/scsi/virtio-scsi-dataplane.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/hw/scsi/virtio-scsi-dataplane.c b/hw/scsi/virtio-scsi-dataplane.c
index 97c2a4f..ca9af13 100644
--- a/hw/scsi/virtio-scsi-dataplane.c
+++ b/hw/scsi/virtio-scsi-dataplane.c
@@ -45,10 +45,13 @@ static VirtIOSCSIVring *virtio_scsi_vring_init(VirtIOSCSI *s,
     BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(s)));
     VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus);
     VirtIOSCSIVring *r = g_slice_new(VirtIOSCSIVring);
+    int rc;
 
     /* Set up virtqueue notify */
-    if (k->set_host_notifier(qbus->parent, n, true) != 0) {
-        fprintf(stderr, "virtio-scsi: Failed to set host notifier\n");
+    rc = k->set_host_notifier(qbus->parent, n, true);
+    if (rc != 0) {
+        fprintf(stderr, "virtio-scsi: Failed to set host notifier (%d)\n",
+                rc);
         exit(1);
     }
     r->host_notifier = *virtio_queue_get_host_notifier(vq);
@@ -159,8 +162,8 @@ void virtio_scsi_dataplane_start(VirtIOSCSI *s)
     /* Set up guest notifier (irq) */
     rc = k->set_guest_notifiers(qbus->parent, vs->conf.num_queues + 2, true);
     if (rc != 0) {
-        fprintf(stderr, "virtio-scsi: Failed to set guest notifiers, "
-                "ensure -enable-kvm is set\n");
+        fprintf(stderr, "virtio-scsi: Failed to set guest notifiers (%d), "
+                "ensure -enable-kvm is set\n", rc);
         exit(1);
     }
 
-- 
1.8.3.1

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

* [Qemu-devel] [PULL 03/24] virtio-scsi: dataplane: fail setup gracefully
  2014-10-23 13:33 [Qemu-devel] [PULL 00/24] SCSI, maintainers and more - 2014-10-17 Paolo Bonzini
  2014-10-23 13:33 ` [Qemu-devel] [PULL 01/24] virtio-scsi-dataplane: Add op blocker Paolo Bonzini
  2014-10-23 13:33 ` [Qemu-devel] [PULL 02/24] virtio-scsi: dataplane: print why starting failed Paolo Bonzini
@ 2014-10-23 13:33 ` Paolo Bonzini
  2014-10-23 13:33 ` [Qemu-devel] [PULL 04/24] virtio-scsi: dataplane: stop trying on notifier error Paolo Bonzini
                   ` (21 subsequent siblings)
  24 siblings, 0 replies; 27+ messages in thread
From: Paolo Bonzini @ 2014-10-23 13:33 UTC (permalink / raw)
  To: qemu-devel; +Cc: Cornelia Huck

From: Cornelia Huck <cornelia.huck@de.ibm.com>

The dataplane code is currently doing a hard exit on various setup
failures. In practice, this may mean that a guest suddenly dies after
a dataplane device failed to come up (e.g., when a file descriptor
limit is hit for the nth device).

Let's just try to unwind the setup instead and return.

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/scsi/virtio-scsi-dataplane.c | 79 ++++++++++++++++++++++++++++++++++++-----
 1 file changed, 70 insertions(+), 9 deletions(-)

diff --git a/hw/scsi/virtio-scsi-dataplane.c b/hw/scsi/virtio-scsi-dataplane.c
index ca9af13..c8e63b9 100644
--- a/hw/scsi/virtio-scsi-dataplane.c
+++ b/hw/scsi/virtio-scsi-dataplane.c
@@ -52,7 +52,7 @@ static VirtIOSCSIVring *virtio_scsi_vring_init(VirtIOSCSI *s,
     if (rc != 0) {
         fprintf(stderr, "virtio-scsi: Failed to set host notifier (%d)\n",
                 rc);
-        exit(1);
+        return NULL;
     }
     r->host_notifier = *virtio_queue_get_host_notifier(vq);
     r->guest_notifier = *virtio_queue_get_guest_notifier(vq);
@@ -62,9 +62,15 @@ static VirtIOSCSIVring *virtio_scsi_vring_init(VirtIOSCSI *s,
 
     if (!vring_setup(&r->vring, VIRTIO_DEVICE(s), n)) {
         fprintf(stderr, "virtio-scsi: VRing setup failed\n");
-        exit(1);
+        goto fail_vring;
     }
     return r;
+
+fail_vring:
+    aio_set_event_notifier(s->ctx, &r->host_notifier, NULL);
+    k->set_host_notifier(qbus->parent, n, false);
+    g_slice_free(VirtIOSCSIVring, r);
+    return NULL;
 }
 
 VirtIOSCSIReq *virtio_scsi_pop_req_vring(VirtIOSCSI *s,
@@ -140,6 +146,46 @@ static void virtio_scsi_iothread_handle_cmd(EventNotifier *notifier)
     }
 }
 
+/* assumes s->ctx held */
+static void virtio_scsi_clear_aio(VirtIOSCSI *s)
+{
+    VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(s);
+    int i;
+
+    if (s->ctrl_vring) {
+        aio_set_event_notifier(s->ctx, &s->ctrl_vring->host_notifier, NULL);
+    }
+    if (s->event_vring) {
+        aio_set_event_notifier(s->ctx, &s->event_vring->host_notifier, NULL);
+    }
+    if (s->cmd_vrings) {
+        for (i = 0; i < vs->conf.num_queues && s->cmd_vrings[i]; i++) {
+            aio_set_event_notifier(s->ctx, &s->cmd_vrings[i]->host_notifier, NULL);
+        }
+    }
+}
+
+static void virtio_scsi_vring_teardown(VirtIOSCSI *s)
+{
+    VirtIODevice *vdev = VIRTIO_DEVICE(s);
+    VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(s);
+    int i;
+
+    if (s->ctrl_vring) {
+        vring_teardown(&s->ctrl_vring->vring, vdev, 0);
+    }
+    if (s->event_vring) {
+        vring_teardown(&s->event_vring->vring, vdev, 1);
+    }
+    if (s->cmd_vrings) {
+        for (i = 0; i < vs->conf.num_queues && s->cmd_vrings[i]; i++) {
+            vring_teardown(&s->cmd_vrings[i]->vring, vdev, 2 + i);
+        }
+        free(s->cmd_vrings);
+        s->cmd_vrings = NULL;
+    }
+}
+
 /* Context: QEMU global mutex held */
 void virtio_scsi_dataplane_start(VirtIOSCSI *s)
 {
@@ -164,27 +210,47 @@ void virtio_scsi_dataplane_start(VirtIOSCSI *s)
     if (rc != 0) {
         fprintf(stderr, "virtio-scsi: Failed to set guest notifiers (%d), "
                 "ensure -enable-kvm is set\n", rc);
-        exit(1);
+        goto fail_guest_notifiers;
     }
 
     aio_context_acquire(s->ctx);
     s->ctrl_vring = virtio_scsi_vring_init(s, vs->ctrl_vq,
                                            virtio_scsi_iothread_handle_ctrl,
                                            0);
+    if (!s->ctrl_vring) {
+        goto fail_vrings;
+    }
     s->event_vring = virtio_scsi_vring_init(s, vs->event_vq,
                                             virtio_scsi_iothread_handle_event,
                                             1);
+    if (!s->event_vring) {
+        goto fail_vrings;
+    }
     s->cmd_vrings = g_malloc0(sizeof(VirtIOSCSIVring) * vs->conf.num_queues);
     for (i = 0; i < vs->conf.num_queues; i++) {
         s->cmd_vrings[i] =
             virtio_scsi_vring_init(s, vs->cmd_vqs[i],
                                    virtio_scsi_iothread_handle_cmd,
                                    i + 2);
+        if (!s->cmd_vrings[i]) {
+            goto fail_vrings;
+        }
     }
 
     aio_context_release(s->ctx);
     s->dataplane_starting = false;
     s->dataplane_started = true;
+
+fail_vrings:
+    virtio_scsi_clear_aio(s);
+    aio_context_release(s->ctx);
+    virtio_scsi_vring_teardown(s);
+    for (i = 0; i < vs->conf.num_queues + 2; i++) {
+        k->set_host_notifier(qbus->parent, i, false);
+    }
+    k->set_guest_notifiers(qbus->parent, vs->conf.num_queues + 2, false);
+fail_guest_notifiers:
+    s->dataplane_starting = false;
 }
 
 /* Context: QEMU global mutex held */
@@ -192,7 +258,6 @@ void virtio_scsi_dataplane_stop(VirtIOSCSI *s)
 {
     BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(s)));
     VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus);
-    VirtIODevice *vdev = VIRTIO_DEVICE(s);
     VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(s);
     int i;
 
@@ -219,11 +284,7 @@ void virtio_scsi_dataplane_stop(VirtIOSCSI *s)
     /* Sync vring state back to virtqueue so that non-dataplane request
      * processing can continue when we disable the host notifier below.
      */
-    vring_teardown(&s->ctrl_vring->vring, vdev, 0);
-    vring_teardown(&s->event_vring->vring, vdev, 1);
-    for (i = 0; i < vs->conf.num_queues; i++) {
-        vring_teardown(&s->cmd_vrings[i]->vring, vdev, 2 + i);
-    }
+    virtio_scsi_vring_teardown(s);
 
     for (i = 0; i < vs->conf.num_queues + 2; i++) {
         k->set_host_notifier(qbus->parent, i, false);
-- 
1.8.3.1

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

* [Qemu-devel] [PULL 04/24] virtio-scsi: dataplane: stop trying on notifier error
  2014-10-23 13:33 [Qemu-devel] [PULL 00/24] SCSI, maintainers and more - 2014-10-17 Paolo Bonzini
                   ` (2 preceding siblings ...)
  2014-10-23 13:33 ` [Qemu-devel] [PULL 03/24] virtio-scsi: dataplane: fail setup gracefully Paolo Bonzini
@ 2014-10-23 13:33 ` Paolo Bonzini
  2014-10-23 13:33 ` [Qemu-devel] [PULL 05/24] qom: Allow clearing of a Link property Paolo Bonzini
                   ` (20 subsequent siblings)
  24 siblings, 0 replies; 27+ messages in thread
From: Paolo Bonzini @ 2014-10-23 13:33 UTC (permalink / raw)
  To: qemu-devel; +Cc: Cornelia Huck

From: Cornelia Huck <cornelia.huck@de.ibm.com>

There's no use to constantly trying to enable dataplane if we failed
to set up guest or host notifiers, so fence it off in that case.
We'll try again if the device is reinitialized.

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/scsi/virtio-scsi-dataplane.c | 8 ++++++++
 include/hw/virtio/virtio-scsi.h | 1 +
 2 files changed, 9 insertions(+)

diff --git a/hw/scsi/virtio-scsi-dataplane.c b/hw/scsi/virtio-scsi-dataplane.c
index c8e63b9..b2399b2 100644
--- a/hw/scsi/virtio-scsi-dataplane.c
+++ b/hw/scsi/virtio-scsi-dataplane.c
@@ -52,6 +52,7 @@ static VirtIOSCSIVring *virtio_scsi_vring_init(VirtIOSCSI *s,
     if (rc != 0) {
         fprintf(stderr, "virtio-scsi: Failed to set host notifier (%d)\n",
                 rc);
+        s->dataplane_fenced = true;
         return NULL;
     }
     r->host_notifier = *virtio_queue_get_host_notifier(vq);
@@ -197,6 +198,7 @@ void virtio_scsi_dataplane_start(VirtIOSCSI *s)
 
     if (s->dataplane_started ||
         s->dataplane_starting ||
+        s->dataplane_fenced ||
         s->ctx != iothread_get_aio_context(vs->conf.iothread)) {
         return;
     }
@@ -210,6 +212,7 @@ void virtio_scsi_dataplane_start(VirtIOSCSI *s)
     if (rc != 0) {
         fprintf(stderr, "virtio-scsi: Failed to set guest notifiers (%d), "
                 "ensure -enable-kvm is set\n", rc);
+        s->dataplane_fenced = true;
         goto fail_guest_notifiers;
     }
 
@@ -261,6 +264,11 @@ void virtio_scsi_dataplane_stop(VirtIOSCSI *s)
     VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(s);
     int i;
 
+    /* Better luck next time. */
+    if (s->dataplane_fenced) {
+        s->dataplane_fenced = false;
+        return;
+    }
     if (!s->dataplane_started || s->dataplane_stopping) {
         return;
     }
diff --git a/include/hw/virtio/virtio-scsi.h b/include/hw/virtio/virtio-scsi.h
index 1ce0858..9e1a49c 100644
--- a/include/hw/virtio/virtio-scsi.h
+++ b/include/hw/virtio/virtio-scsi.h
@@ -195,6 +195,7 @@ typedef struct VirtIOSCSI {
     bool dataplane_starting;
     bool dataplane_stopping;
     bool dataplane_disabled;
+    bool dataplane_fenced;
     Error *blocker;
     Notifier migration_state_notifier;
 } VirtIOSCSI;
-- 
1.8.3.1

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

* [Qemu-devel] [PULL 05/24] qom: Allow clearing of a Link property
  2014-10-23 13:33 [Qemu-devel] [PULL 00/24] SCSI, maintainers and more - 2014-10-17 Paolo Bonzini
                   ` (3 preceding siblings ...)
  2014-10-23 13:33 ` [Qemu-devel] [PULL 04/24] virtio-scsi: dataplane: stop trying on notifier error Paolo Bonzini
@ 2014-10-23 13:33 ` Paolo Bonzini
  2014-10-23 13:33 ` [Qemu-devel] [PULL 06/24] qom: Demote already-has-a-parent to a regular error Paolo Bonzini
                   ` (19 subsequent siblings)
  24 siblings, 0 replies; 27+ messages in thread
From: Paolo Bonzini @ 2014-10-23 13:33 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Crosthwaite

From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>

By passing in "" to object_property_set_link.

The lead user of this is the QDEV GPIO framework which will implement
GPIO disconnects via an "unlink".  GPIO disconnection is used by
qtest's irq_intercept_out command.

Reviewed-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 qom/object.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/qom/object.c b/qom/object.c
index a751367..c7ef776 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -872,9 +872,13 @@ char *object_property_get_str(Object *obj, const char *name,
 void object_property_set_link(Object *obj, Object *value,
                               const char *name, Error **errp)
 {
-    gchar *path = object_get_canonical_path(value);
-    object_property_set_str(obj, path, name, errp);
-    g_free(path);
+    if (value) {
+        gchar *path = object_get_canonical_path(value);
+        object_property_set_str(obj, path, name, errp);
+        g_free(path);
+    } else {
+        object_property_set_str(obj, "", name, errp);
+    }
 }
 
 Object *object_property_get_link(Object *obj, const char *name,
-- 
1.8.3.1

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

* [Qemu-devel] [PULL 06/24] qom: Demote already-has-a-parent to a regular error
  2014-10-23 13:33 [Qemu-devel] [PULL 00/24] SCSI, maintainers and more - 2014-10-17 Paolo Bonzini
                   ` (4 preceding siblings ...)
  2014-10-23 13:33 ` [Qemu-devel] [PULL 05/24] qom: Allow clearing of a Link property Paolo Bonzini
@ 2014-10-23 13:33 ` Paolo Bonzini
  2014-10-23 13:33 ` [Qemu-devel] [PULL 07/24] qdev: gpio: Re-implement qdev_connect_gpio QOM style Paolo Bonzini
                   ` (18 subsequent siblings)
  24 siblings, 0 replies; 27+ messages in thread
From: Paolo Bonzini @ 2014-10-23 13:33 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Crosthwaite

From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>

Rather than an abort(). This allows callers to decide whether parenting
an already-parented object is a fatal error condition.

Useful for providing a default value for an object's parent in the case
where you want to set one iff it doesn't already have one.

Reviewed-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 qom/object.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/qom/object.c b/qom/object.c
index c7ef776..1812c73 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -1089,6 +1089,11 @@ void object_property_add_child(Object *obj, const char *name,
     gchar *type;
     ObjectProperty *op;
 
+    if (child->parent != NULL) {
+        error_setg(errp, "child object is already parented");
+        return;
+    }
+
     type = g_strdup_printf("child<%s>", object_get_typename(OBJECT(child)));
 
     op = object_property_add(obj, name, type, object_get_child_property, NULL,
@@ -1100,7 +1105,6 @@ void object_property_add_child(Object *obj, const char *name,
 
     op->resolve = object_resolve_child_property;
     object_ref(child);
-    g_assert(child->parent == NULL);
     child->parent = obj;
 
 out:
-- 
1.8.3.1

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

* [Qemu-devel] [PULL 07/24] qdev: gpio: Re-implement qdev_connect_gpio QOM style
  2014-10-23 13:33 [Qemu-devel] [PULL 00/24] SCSI, maintainers and more - 2014-10-17 Paolo Bonzini
                   ` (5 preceding siblings ...)
  2014-10-23 13:33 ` [Qemu-devel] [PULL 06/24] qom: Demote already-has-a-parent to a regular error Paolo Bonzini
@ 2014-10-23 13:33 ` Paolo Bonzini
  2014-10-23 13:33 ` [Qemu-devel] [PULL 08/24] qdev: gpio: Add API for intercepting a GPIO Paolo Bonzini
                   ` (17 subsequent siblings)
  24 siblings, 0 replies; 27+ messages in thread
From: Paolo Bonzini @ 2014-10-23 13:33 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Crosthwaite

From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>

Re-implement as a link setter. This should allow the QOM framework to
keep track of ref counts properly etc.

We need to add a default parent for the connecting input incase it's
coming from a non-qdev source. We simply parent the IRQ to the machine
in this case.

Reviewed-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/core/qdev.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index a1e9247..fc7860f 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -440,10 +440,19 @@ qemu_irq qdev_get_gpio_in(DeviceState *dev, int n)
 void qdev_connect_gpio_out_named(DeviceState *dev, const char *name, int n,
                                  qemu_irq pin)
 {
-    NamedGPIOList *gpio_list = qdev_get_named_gpio_list(dev, name);
-
-    assert(n >= 0 && n < gpio_list->num_out);
-    gpio_list->out[n] = pin;
+    char *propname = g_strdup_printf("%s[%d]",
+                                     name ? name : "unnamed-gpio-out", n);
+    if (pin) {
+        /* We need a name for object_property_set_link to work.  If the
+         * object has a parent, object_property_add_child will come back
+         * with an error without doing anything.  If it has none, it will
+         * never fail.  So we can just call it with a NULL Error pointer.
+         */
+        object_property_add_child(qdev_get_machine(), "non-qdev-gpio[*]",
+                                  OBJECT(pin), NULL);
+    }
+    object_property_set_link(OBJECT(dev), OBJECT(pin), propname, &error_abort);
+    g_free(propname);
 }
 
 void qdev_connect_gpio_out(DeviceState * dev, int n, qemu_irq pin)
-- 
1.8.3.1

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

* [Qemu-devel] [PULL 08/24] qdev: gpio: Add API for intercepting a GPIO
  2014-10-23 13:33 [Qemu-devel] [PULL 00/24] SCSI, maintainers and more - 2014-10-17 Paolo Bonzini
                   ` (6 preceding siblings ...)
  2014-10-23 13:33 ` [Qemu-devel] [PULL 07/24] qdev: gpio: Re-implement qdev_connect_gpio QOM style Paolo Bonzini
@ 2014-10-23 13:33 ` Paolo Bonzini
  2014-10-23 13:33 ` [Qemu-devel] [PULL 09/24] qtest/irq: Rework IRQ interception Paolo Bonzini
                   ` (16 subsequent siblings)
  24 siblings, 0 replies; 27+ messages in thread
From: Paolo Bonzini @ 2014-10-23 13:33 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Crosthwaite

From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>

To replace the old qemu_irq intercept API (which had users reaching
into qdev private state for GPIOs).

Reviewed-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/core/qdev.c         | 25 +++++++++++++++++++++++++
 include/hw/qdev-core.h |  2 ++
 2 files changed, 27 insertions(+)

diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index fc7860f..92f88f6 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -455,6 +455,31 @@ void qdev_connect_gpio_out_named(DeviceState *dev, const char *name, int n,
     g_free(propname);
 }
 
+/* disconnect a GPIO ouput, returning the disconnected input (if any) */
+
+static qemu_irq qdev_disconnect_gpio_out_named(DeviceState *dev,
+                                               const char *name, int n)
+{
+    char *propname = g_strdup_printf("%s[%d]",
+                                     name ? name : "unnamed-gpio-out", n);
+
+    qemu_irq ret = (qemu_irq)object_property_get_link(OBJECT(dev), propname,
+                                                      NULL);
+    if (ret) {
+        object_property_set_link(OBJECT(dev), NULL, propname, NULL);
+    }
+    g_free(propname);
+    return ret;
+}
+
+qemu_irq qdev_intercept_gpio_out(DeviceState *dev, qemu_irq icpt,
+                                 const char *name, int n)
+{
+    qemu_irq disconnected = qdev_disconnect_gpio_out_named(dev, name, n);
+    qdev_connect_gpio_out_named(dev, name, n, icpt);
+    return disconnected;
+}
+
 void qdev_connect_gpio_out(DeviceState * dev, int n, qemu_irq pin)
 {
     qdev_connect_gpio_out_named(dev, NULL, n, pin);
diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
index 1fca75c..cf27e65 100644
--- a/include/hw/qdev-core.h
+++ b/include/hw/qdev-core.h
@@ -273,6 +273,8 @@ qemu_irq qdev_get_gpio_in_named(DeviceState *dev, const char *name, int n);
 void qdev_connect_gpio_out(DeviceState *dev, int n, qemu_irq pin);
 void qdev_connect_gpio_out_named(DeviceState *dev, const char *name, int n,
                                  qemu_irq pin);
+qemu_irq qdev_intercept_gpio_out(DeviceState *dev, qemu_irq icpt,
+                                 const char *name, int n);
 
 BusState *qdev_get_child_bus(DeviceState *dev, const char *name);
 
-- 
1.8.3.1

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

* [Qemu-devel] [PULL 09/24] qtest/irq: Rework IRQ interception
  2014-10-23 13:33 [Qemu-devel] [PULL 00/24] SCSI, maintainers and more - 2014-10-17 Paolo Bonzini
                   ` (7 preceding siblings ...)
  2014-10-23 13:33 ` [Qemu-devel] [PULL 08/24] qdev: gpio: Add API for intercepting a GPIO Paolo Bonzini
@ 2014-10-23 13:33 ` Paolo Bonzini
  2014-10-23 13:33 ` [Qemu-devel] [PULL 10/24] irq: Remove qemu_irq_intercept_out Paolo Bonzini
                   ` (15 subsequent siblings)
  24 siblings, 0 replies; 27+ messages in thread
From: Paolo Bonzini @ 2014-10-23 13:33 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Crosthwaite

From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>

Change the qtest intercept handler to accept just the individual IRQ
being intercepted as opaque. n is still expected to be correctly set
as for the original intercepted irq. qemu_intercept_irq_in is updated
accordingly.

Then covert the qemu_irq_intercept_out call to use qdev intercept
version. This stops qtest from having to mess with the raw IRQ pointers
(still has to mess with names and counts but a step in the right
direction).

Reviewed-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/core/irq.c |  2 +-
 qtest.c       | 15 +++++++++++----
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/hw/core/irq.c b/hw/core/irq.c
index cffced0..4a580a2 100644
--- a/hw/core/irq.c
+++ b/hw/core/irq.c
@@ -140,7 +140,7 @@ void qemu_irq_intercept_in(qemu_irq *gpio_in, qemu_irq_handler handler, int n)
     for (i = 0; i < n; i++) {
         *old_irqs[i] = *gpio_in[i];
         gpio_in[i]->handler = handler;
-        gpio_in[i]->opaque = old_irqs;
+        gpio_in[i]->opaque = &old_irqs[i];
     }
 }
 
diff --git a/qtest.c b/qtest.c
index 4b85995..946b560 100644
--- a/qtest.c
+++ b/qtest.c
@@ -201,8 +201,8 @@ static void GCC_FMT_ATTR(2, 3) qtest_send(CharDriverState *chr,
 
 static void qtest_irq_handler(void *opaque, int n, int level)
 {
-    qemu_irq *old_irqs = opaque;
-    qemu_set_irq(old_irqs[n], level);
+    qemu_irq old_irq = *(qemu_irq *)opaque;
+    qemu_set_irq(old_irq, level);
 
     if (irq_levels[n] != level) {
         CharDriverState *chr = qtest_chr;
@@ -264,8 +264,15 @@ static void qtest_process_command(CharDriverState *chr, gchar **words)
                 continue;
             }
             if (words[0][14] == 'o') {
-                qemu_irq_intercept_out(&ngl->out, qtest_irq_handler,
-                                       ngl->num_out);
+                int i;
+                for (i = 0; i < ngl->num_out; ++i) {
+                    qemu_irq *disconnected = g_new0(qemu_irq, 1);
+                    qemu_irq icpt = qemu_allocate_irq(qtest_irq_handler,
+                                                      disconnected, i);
+
+                    *disconnected = qdev_intercept_gpio_out(dev, icpt,
+                                                            ngl->name, i);
+                }
             } else {
                 qemu_irq_intercept_in(ngl->in, qtest_irq_handler,
                                       ngl->num_in);
-- 
1.8.3.1

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

* [Qemu-devel] [PULL 10/24] irq: Remove qemu_irq_intercept_out
  2014-10-23 13:33 [Qemu-devel] [PULL 00/24] SCSI, maintainers and more - 2014-10-17 Paolo Bonzini
                   ` (8 preceding siblings ...)
  2014-10-23 13:33 ` [Qemu-devel] [PULL 09/24] qtest/irq: Rework IRQ interception Paolo Bonzini
@ 2014-10-23 13:33 ` Paolo Bonzini
  2014-10-23 13:33 ` [Qemu-devel] [PULL 11/24] qdev: gpio: delete NamedGPIOList::out Paolo Bonzini
                   ` (14 subsequent siblings)
  24 siblings, 0 replies; 27+ messages in thread
From: Paolo Bonzini @ 2014-10-23 13:33 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Crosthwaite

From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>

No more users left and obsoleted by qdev_intercept_gpio_out.

Reviewed-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/core/irq.c    | 6 ------
 include/hw/irq.h | 1 -
 2 files changed, 7 deletions(-)

diff --git a/hw/core/irq.c b/hw/core/irq.c
index 4a580a2..8a62a36 100644
--- a/hw/core/irq.c
+++ b/hw/core/irq.c
@@ -144,12 +144,6 @@ void qemu_irq_intercept_in(qemu_irq *gpio_in, qemu_irq_handler handler, int n)
     }
 }
 
-void qemu_irq_intercept_out(qemu_irq **gpio_out, qemu_irq_handler handler, int n)
-{
-    qemu_irq *old_irqs = *gpio_out;
-    *gpio_out = qemu_allocate_irqs(handler, old_irqs, n);
-}
-
 static const TypeInfo irq_type_info = {
    .name = TYPE_IRQ,
    .parent = TYPE_OBJECT,
diff --git a/include/hw/irq.h b/include/hw/irq.h
index 6f874f5..4c4c2ea 100644
--- a/include/hw/irq.h
+++ b/include/hw/irq.h
@@ -61,6 +61,5 @@ qemu_irq *qemu_irq_proxy(qemu_irq **target, int n);
 /* For internal use in qtest.  Similar to qemu_irq_split, but operating
    on an existing vector of qemu_irq.  */
 void qemu_irq_intercept_in(qemu_irq *gpio_in, qemu_irq_handler handler, int n);
-void qemu_irq_intercept_out(qemu_irq **gpio_out, qemu_irq_handler handler, int n);
 
 #endif
-- 
1.8.3.1

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

* [Qemu-devel] [PULL 11/24] qdev: gpio: delete NamedGPIOList::out
  2014-10-23 13:33 [Qemu-devel] [PULL 00/24] SCSI, maintainers and more - 2014-10-17 Paolo Bonzini
                   ` (9 preceding siblings ...)
  2014-10-23 13:33 ` [Qemu-devel] [PULL 10/24] irq: Remove qemu_irq_intercept_out Paolo Bonzini
@ 2014-10-23 13:33 ` Paolo Bonzini
  2014-10-23 13:34 ` [Qemu-devel] [PULL 12/24] qdev: gpio: Remove qdev_init_gpio_out x1 restriction Paolo Bonzini
                   ` (13 subsequent siblings)
  24 siblings, 0 replies; 27+ messages in thread
From: Paolo Bonzini @ 2014-10-23 13:33 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Crosthwaite

From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>

All users of GPIO outputs are fully QOMified, using QOM properties to
access the GPIO data. Delete.

Reviewed-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/core/qdev.c         | 1 -
 include/hw/qdev-core.h | 1 -
 2 files changed, 2 deletions(-)

diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index 92f88f6..efbaa99 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -406,7 +406,6 @@ void qdev_init_gpio_out_named(DeviceState *dev, qemu_irq *pins,
     assert(gpio_list->num_in == 0 || !name);
     assert(gpio_list->num_out == 0);
     gpio_list->num_out = n;
-    gpio_list->out = pins;
 
     for (i = 0; i < n; ++i) {
         memset(&pins[i], 0, sizeof(*pins));
diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
index cf27e65..86d341f 100644
--- a/include/hw/qdev-core.h
+++ b/include/hw/qdev-core.h
@@ -136,7 +136,6 @@ struct NamedGPIOList {
     char *name;
     qemu_irq *in;
     int num_in;
-    qemu_irq *out;
     int num_out;
     QLIST_ENTRY(NamedGPIOList) node;
 };
-- 
1.8.3.1

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

* [Qemu-devel] [PULL 12/24] qdev: gpio: Remove qdev_init_gpio_out x1 restriction
  2014-10-23 13:33 [Qemu-devel] [PULL 00/24] SCSI, maintainers and more - 2014-10-17 Paolo Bonzini
                   ` (10 preceding siblings ...)
  2014-10-23 13:33 ` [Qemu-devel] [PULL 11/24] qdev: gpio: delete NamedGPIOList::out Paolo Bonzini
@ 2014-10-23 13:34 ` Paolo Bonzini
  2014-10-23 13:34 ` [Qemu-devel] [PULL 13/24] qdev: gpio: Define qdev_pass_gpios() Paolo Bonzini
                   ` (12 subsequent siblings)
  24 siblings, 0 replies; 27+ messages in thread
From: Paolo Bonzini @ 2014-10-23 13:34 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Crosthwaite

From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>

Previously this was restricted to a single call per-dev/per-name. With
the conversion of the GPIO output state to QOM the implementation can
now handle repeated calls. Remove the restriction.

Reviewed-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/core/qdev.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index efbaa99..31014e8 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -404,8 +404,7 @@ void qdev_init_gpio_out_named(DeviceState *dev, qemu_irq *pins,
     char *propname = g_strdup_printf("%s[*]", name ? name : "unnamed-gpio-out");
 
     assert(gpio_list->num_in == 0 || !name);
-    assert(gpio_list->num_out == 0);
-    gpio_list->num_out = n;
+    gpio_list->num_out += n;
 
     for (i = 0; i < n; ++i) {
         memset(&pins[i], 0, sizeof(*pins));
-- 
1.8.3.1

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

* [Qemu-devel] [PULL 13/24] qdev: gpio: Define qdev_pass_gpios()
  2014-10-23 13:33 [Qemu-devel] [PULL 00/24] SCSI, maintainers and more - 2014-10-17 Paolo Bonzini
                   ` (11 preceding siblings ...)
  2014-10-23 13:34 ` [Qemu-devel] [PULL 12/24] qdev: gpio: Remove qdev_init_gpio_out x1 restriction Paolo Bonzini
@ 2014-10-23 13:34 ` Paolo Bonzini
  2014-10-23 13:34 ` [Qemu-devel] [PULL 14/24] sysbus: Use TYPE_DEVICE GPIO functionality Paolo Bonzini
                   ` (11 subsequent siblings)
  24 siblings, 0 replies; 27+ messages in thread
From: Paolo Bonzini @ 2014-10-23 13:34 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Crosthwaite

From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>

Allows a container to take ownership of GPIOs in a contained
device and automatically connect them as GPIOs to the container.

This prepares for deprecation of the SYSBUS IRQ functionality, which
has this feature. We push it up to the device level instead of sysbus
level. There's nothing sysbus specific about passing GPIOs to
containers so its a legitimate device-level generic feature.

Reviewed-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/core/qdev.c         | 26 ++++++++++++++++++++++++++
 include/hw/qdev-core.h |  3 +++
 2 files changed, 29 insertions(+)

diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index 31014e8..c247fff 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -483,6 +483,32 @@ void qdev_connect_gpio_out(DeviceState * dev, int n, qemu_irq pin)
     qdev_connect_gpio_out_named(dev, NULL, n, pin);
 }
 
+void qdev_pass_gpios(DeviceState *dev, DeviceState *container,
+                     const char *name)
+{
+    int i;
+    NamedGPIOList *ngl = qdev_get_named_gpio_list(dev, name);
+
+    for (i = 0; i < ngl->num_in; i++) {
+        const char *nm = ngl->name ? ngl->name : "unnamed-gpio-in";
+        char *propname = g_strdup_printf("%s[%d]", nm, i);
+
+        object_property_add_alias(OBJECT(container), propname,
+                                  OBJECT(dev), propname,
+                                  &error_abort);
+    }
+    for (i = 0; i < ngl->num_out; i++) {
+        const char *nm = ngl->name ? ngl->name : "unnamed-gpio-out";
+        char *propname = g_strdup_printf("%s[%d]", nm, i);
+
+        object_property_add_alias(OBJECT(container), propname,
+                                  OBJECT(dev), propname,
+                                  &error_abort);
+    }
+    QLIST_REMOVE(ngl, node);
+    QLIST_INSERT_HEAD(&container->gpios, ngl, node);
+}
+
 BusState *qdev_get_child_bus(DeviceState *dev, const char *name)
 {
     BusState *bus;
diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
index 86d341f..a7327fd 100644
--- a/include/hw/qdev-core.h
+++ b/include/hw/qdev-core.h
@@ -288,6 +288,9 @@ void qdev_init_gpio_in_named(DeviceState *dev, qemu_irq_handler handler,
 void qdev_init_gpio_out_named(DeviceState *dev, qemu_irq *pins,
                               const char *name, int n);
 
+void qdev_pass_gpios(DeviceState *dev, DeviceState *container,
+                     const char *name);
+
 BusState *qdev_get_parent_bus(DeviceState *dev);
 
 /*** BUS API. ***/
-- 
1.8.3.1

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

* [Qemu-devel] [PULL 14/24] sysbus: Use TYPE_DEVICE GPIO functionality
  2014-10-23 13:33 [Qemu-devel] [PULL 00/24] SCSI, maintainers and more - 2014-10-17 Paolo Bonzini
                   ` (12 preceding siblings ...)
  2014-10-23 13:34 ` [Qemu-devel] [PULL 13/24] qdev: gpio: Define qdev_pass_gpios() Paolo Bonzini
@ 2014-10-23 13:34 ` Paolo Bonzini
  2014-10-23 13:34 ` [Qemu-devel] [PULL 15/24] target-i386: warns users when CPU threads>1 for non-Intel CPUs Paolo Bonzini
                   ` (10 subsequent siblings)
  24 siblings, 0 replies; 27+ messages in thread
From: Paolo Bonzini @ 2014-10-23 13:34 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Crosthwaite

From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>

Re-implement the Sysbus GPIOs to use the existing TYPE_DEVICE
GPIO named framework. A constant string name is chosen to avoid
conflicts with existing unnamed GPIOs.

This unifies GPIOs are IRQs for sysbus devices and allows removal
of all Sysbus state for GPIOs.

Any existing and future-added functionality for GPIOs is now
also available for sysbus IRQs.

Reviewed-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/core/sysbus.c    | 20 +++-----------------
 include/hw/sysbus.h |  7 +++----
 2 files changed, 6 insertions(+), 21 deletions(-)

diff --git a/hw/core/sysbus.c b/hw/core/sysbus.c
index 414e2a1..e55c3c1 100644
--- a/hw/core/sysbus.c
+++ b/hw/core/sysbus.c
@@ -41,11 +41,7 @@ static const TypeInfo system_bus_info = {
 
 void sysbus_connect_irq(SysBusDevice *dev, int n, qemu_irq irq)
 {
-    assert(n >= 0 && n < dev->num_irq);
-    dev->irqs[n] = NULL;
-    if (dev->irqp[n]) {
-        *dev->irqp[n] = irq;
-    }
+    qdev_connect_gpio_out_named(DEVICE(dev), SYSBUS_DEVICE_GPIO_IRQ, n, irq);
 }
 
 static void sysbus_mmio_map_common(SysBusDevice *dev, int n, hwaddr addr,
@@ -89,22 +85,13 @@ void sysbus_mmio_map_overlap(SysBusDevice *dev, int n, hwaddr addr,
 /* Request an IRQ source.  The actual IRQ object may be populated later.  */
 void sysbus_init_irq(SysBusDevice *dev, qemu_irq *p)
 {
-    int n;
-
-    assert(dev->num_irq < QDEV_MAX_IRQ);
-    n = dev->num_irq++;
-    dev->irqp[n] = p;
+    qdev_init_gpio_out_named(DEVICE(dev), p, SYSBUS_DEVICE_GPIO_IRQ, 1);
 }
 
 /* Pass IRQs from a target device.  */
 void sysbus_pass_irq(SysBusDevice *dev, SysBusDevice *target)
 {
-    int i;
-    assert(dev->num_irq == 0);
-    dev->num_irq = target->num_irq;
-    for (i = 0; i < dev->num_irq; i++) {
-        dev->irqp[i] = target->irqp[i];
-    }
+    qdev_pass_gpios(DEVICE(target), DEVICE(dev), SYSBUS_DEVICE_GPIO_IRQ);
 }
 
 void sysbus_init_mmio(SysBusDevice *dev, MemoryRegion *memory)
@@ -210,7 +197,6 @@ static void sysbus_dev_print(Monitor *mon, DeviceState *dev, int indent)
     hwaddr size;
     int i;
 
-    monitor_printf(mon, "%*sirq %d\n", indent, "", s->num_irq);
     for (i = 0; i < s->num_mmio; i++) {
         size = memory_region_size(s->mmio[i].memory);
         monitor_printf(mon, "%*smmio " TARGET_FMT_plx "/" TARGET_FMT_plx "\n",
diff --git a/include/hw/sysbus.h b/include/hw/sysbus.h
index 0bb91a8..9fb1782 100644
--- a/include/hw/sysbus.h
+++ b/include/hw/sysbus.h
@@ -8,7 +8,6 @@
 
 #define QDEV_MAX_MMIO 32
 #define QDEV_MAX_PIO 32
-#define QDEV_MAX_IRQ 512
 
 #define TYPE_SYSTEM_BUS "System"
 #define SYSTEM_BUS(obj) OBJECT_CHECK(IDEBus, (obj), TYPE_IDE_BUS)
@@ -33,6 +32,9 @@ typedef struct SysBusDevice SysBusDevice;
  * SysBusDeviceClass is not overriding #DeviceClass.realize, so derived
  * classes overriding it are not required to invoke its implementation.
  */
+
+#define SYSBUS_DEVICE_GPIO_IRQ "sysbus-irq"
+
 typedef struct SysBusDeviceClass {
     /*< private >*/
     DeviceClass parent_class;
@@ -46,9 +48,6 @@ struct SysBusDevice {
     DeviceState parent_obj;
     /*< public >*/
 
-    int num_irq;
-    qemu_irq irqs[QDEV_MAX_IRQ];
-    qemu_irq *irqp[QDEV_MAX_IRQ];
     int num_mmio;
     struct {
         hwaddr addr;
-- 
1.8.3.1

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

* [Qemu-devel] [PULL 15/24] target-i386: warns users when CPU threads>1 for non-Intel CPUs
  2014-10-23 13:33 [Qemu-devel] [PULL 00/24] SCSI, maintainers and more - 2014-10-17 Paolo Bonzini
                   ` (13 preceding siblings ...)
  2014-10-23 13:34 ` [Qemu-devel] [PULL 14/24] sysbus: Use TYPE_DEVICE GPIO functionality Paolo Bonzini
@ 2014-10-23 13:34 ` Paolo Bonzini
  2014-10-23 13:34 ` [Qemu-devel] [PULL 16/24] MAINTAINERS: grab more files from Anthony's pile Paolo Bonzini
                   ` (9 subsequent siblings)
  24 siblings, 0 replies; 27+ messages in thread
From: Paolo Bonzini @ 2014-10-23 13:34 UTC (permalink / raw)
  To: qemu-devel; +Cc: Wei Huang

From: Wei Huang <wei@redhat.com>

Only Intel CPUs support hyperthreading. When users select threads>1 in
-smp option, QEMU fixes it by adjusting CPUID_0000_0001_EBX and
CPUID_8000_0008_ECX based on inputs (sockets, cores, threads);
so guest VM can boot correctly. However it is still better to gives
users a warning when such case happens.

Signed-off-by: Wei Huang <wei@redhat.com>
[As suggested by Eduardo, check for !IS_INTEL instead of AMD. - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 target-i386/cpu.c | 26 +++++++++++++++++++++++---
 1 file changed, 23 insertions(+), 3 deletions(-)

diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index e7bf9de..69a2bd3 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -2696,6 +2696,13 @@ static void x86_cpu_apic_realize(X86CPU *cpu, Error **errp)
 }
 #endif
 
+
+#define IS_INTEL_CPU(env) ((env)->cpuid_vendor1 == CPUID_VENDOR_INTEL_1 && \
+                           (env)->cpuid_vendor2 == CPUID_VENDOR_INTEL_2 && \
+                           (env)->cpuid_vendor3 == CPUID_VENDOR_INTEL_3)
+#define IS_AMD_CPU(env) ((env)->cpuid_vendor1 == CPUID_VENDOR_AMD_1 && \
+                         (env)->cpuid_vendor2 == CPUID_VENDOR_AMD_2 && \
+                         (env)->cpuid_vendor3 == CPUID_VENDOR_AMD_3)
 static void x86_cpu_realizefn(DeviceState *dev, Error **errp)
 {
     CPUState *cs = CPU(dev);
@@ -2703,6 +2710,7 @@ static void x86_cpu_realizefn(DeviceState *dev, Error **errp)
     X86CPUClass *xcc = X86_CPU_GET_CLASS(dev);
     CPUX86State *env = &cpu->env;
     Error *local_err = NULL;
+    static bool ht_warned;
 
     if (env->features[FEAT_7_0_EBX] && env->cpuid_level < 7) {
         env->cpuid_level = 7;
@@ -2711,9 +2719,7 @@ static void x86_cpu_realizefn(DeviceState *dev, Error **errp)
     /* On AMD CPUs, some CPUID[8000_0001].EDX bits must match the bits on
      * CPUID[1].EDX.
      */
-    if (env->cpuid_vendor1 == CPUID_VENDOR_AMD_1 &&
-        env->cpuid_vendor2 == CPUID_VENDOR_AMD_2 &&
-        env->cpuid_vendor3 == CPUID_VENDOR_AMD_3) {
+    if (IS_AMD_CPU(env)) {
         env->features[FEAT_8000_0001_EDX] &= ~CPUID_EXT2_AMD_ALIASES;
         env->features[FEAT_8000_0001_EDX] |= (env->features[FEAT_1_EDX]
            & CPUID_EXT2_AMD_ALIASES);
@@ -2742,6 +2748,20 @@ static void x86_cpu_realizefn(DeviceState *dev, Error **errp)
     mce_init(cpu);
     qemu_init_vcpu(cs);
 
+    /* Only Intel CPUs support hyperthreading. Even though QEMU fixes this
+     * issue by adjusting CPUID_0000_0001_EBX and CPUID_8000_0008_ECX
+     * based on inputs (sockets,cores,threads), it is still better to gives
+     * users a warning.
+     *
+     * NOTE: the following code has to follow qemu_init_vcpu(). Otherwise
+     * cs->nr_threads hasn't be populated yet and the checking is incorrect.
+     */
+    if (!IS_INTEL_CPU(env) && cs->nr_threads > 1 && !ht_warned) {
+        error_report("AMD CPU doesn't support hyperthreading. Please configure"
+                     " -smp options properly.");
+        ht_warned = true;
+    }
+
     x86_cpu_apic_realize(cpu, &local_err);
     if (local_err != NULL) {
         goto out;
-- 
1.8.3.1

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

* [Qemu-devel] [PULL 16/24] MAINTAINERS: grab more files from Anthony's pile
  2014-10-23 13:33 [Qemu-devel] [PULL 00/24] SCSI, maintainers and more - 2014-10-17 Paolo Bonzini
                   ` (14 preceding siblings ...)
  2014-10-23 13:34 ` [Qemu-devel] [PULL 15/24] target-i386: warns users when CPU threads>1 for non-Intel CPUs Paolo Bonzini
@ 2014-10-23 13:34 ` Paolo Bonzini
  2014-10-23 13:34 ` [Qemu-devel] [PULL 17/24] MAINTAINERS: add Samuel Thibault as usb-serial.c and baum.c maintainer Paolo Bonzini
                   ` (8 subsequent siblings)
  24 siblings, 0 replies; 27+ messages in thread
From: Paolo Bonzini @ 2014-10-23 13:34 UTC (permalink / raw)
  To: qemu-devel

I am picking up character devices and the main loop, as agreed during
QEMU Summit.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 MAINTAINERS | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 206bf7e..a3b8e90 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -716,8 +716,12 @@ T: git git://github.com/stefanha/qemu.git block
 
 Character Devices
 M: Anthony Liguori <aliguori@amazon.com>
+M: Paolo Bonzini <pbonzini@redhat.com>
 S: Maintained
 F: qemu-char.c
+F: backends/baum.c
+F: backends/msmouse.c
+F: backends/testdev.c
 
 CPU
 M: Andreas Färber <afaerber@suse.de>
@@ -776,7 +780,11 @@ F: ui/cocoa.m
 
 Main loop
 M: Anthony Liguori <aliguori@amazon.com>
-S: Supported
+M: Paolo Bonzini <pbonzini@redhat.com>
+S: Maintained
+F: cpus.c
+F: main-loop.c
+F: qemu-timer.c
 F: vl.c
 
 Human Monitor (HMP)
-- 
1.8.3.1

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

* [Qemu-devel] [PULL 17/24] MAINTAINERS: add Samuel Thibault as usb-serial.c and baum.c maintainer
  2014-10-23 13:33 [Qemu-devel] [PULL 00/24] SCSI, maintainers and more - 2014-10-17 Paolo Bonzini
                   ` (15 preceding siblings ...)
  2014-10-23 13:34 ` [Qemu-devel] [PULL 16/24] MAINTAINERS: grab more files from Anthony's pile Paolo Bonzini
@ 2014-10-23 13:34 ` Paolo Bonzini
  2014-10-23 13:34 ` [Qemu-devel] [PULL 18/24] MAINTAINERS: add myself for X86 Paolo Bonzini
                   ` (7 subsequent siblings)
  24 siblings, 0 replies; 27+ messages in thread
From: Paolo Bonzini @ 2014-10-23 13:34 UTC (permalink / raw)
  To: qemu-devel; +Cc: Samuel Thibault

He wrote "I've written mostly all of usb-serial.c and baum.c, and keep
maintaining them, since I use them regularly."

Cc: Samuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 MAINTAINERS | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index a3b8e90..99cdab1 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -622,6 +622,12 @@ S: Maintained
 F: hw/usb/*
 F: tests/usb-*-test.c
 
+USB (serial adapter)
+M: Gerd Hoffmann <kraxel@redhat.com>
+M: Samuel Thibault <samuel.thibault@ens-lyon.org>
+S: Maintained
+F: hw/usb/dev-serial.c
+
 VFIO
 M: Alex Williamson <alex.williamson@redhat.com>
 S: Supported
@@ -719,10 +725,14 @@ M: Anthony Liguori <aliguori@amazon.com>
 M: Paolo Bonzini <pbonzini@redhat.com>
 S: Maintained
 F: qemu-char.c
-F: backends/baum.c
 F: backends/msmouse.c
 F: backends/testdev.c
 
+Character Devices (Braille)
+M: Samuel Thibault <samuel.thibault@ens-lyon.org>
+S: Maintained
+F: backends/baum.c
+
 CPU
 M: Andreas Färber <afaerber@suse.de>
 S: Supported
-- 
1.8.3.1

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

* [Qemu-devel] [PULL 18/24] MAINTAINERS: add myself for X86
  2014-10-23 13:33 [Qemu-devel] [PULL 00/24] SCSI, maintainers and more - 2014-10-17 Paolo Bonzini
                   ` (16 preceding siblings ...)
  2014-10-23 13:34 ` [Qemu-devel] [PULL 17/24] MAINTAINERS: add Samuel Thibault as usb-serial.c and baum.c maintainer Paolo Bonzini
@ 2014-10-23 13:34 ` Paolo Bonzini
  2014-10-23 13:34 ` [Qemu-devel] [PULL 19/24] MAINTAINERS: Add more TCG files Paolo Bonzini
                   ` (6 subsequent siblings)
  24 siblings, 0 replies; 27+ messages in thread
From: Paolo Bonzini @ 2014-10-23 13:34 UTC (permalink / raw)
  To: qemu-devel

Still not moving it beyond "Odd fixes".  Richard Henderson also has
reviewed a bunch of X86 TCG patches, so add him as well.  All we want
is to avoid that patches fall on the floor.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 MAINTAINERS | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 99cdab1..1227ba3 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -149,7 +149,8 @@ F: target-unicore32/
 F: hw/unicore32/
 
 X86
-M: qemu-devel@nongnu.org
+M: Paolo Bonzini <pbonzini@redhat.com>
+M: Richard Henderson <rth@twiddle.net>
 S: Odd Fixes
 F: target-i386/
 F: hw/i386/
@@ -201,6 +202,7 @@ F: target-s390x/kvm.c
 F: hw/intc/s390_flic.[hc]
 
 X86
+M: Paolo Bonzini <pbonzini@redhat.com>
 M: Marcelo Tosatti <mtosatti@redhat.com>
 L: kvm@vger.kernel.org
 S: Supported
-- 
1.8.3.1

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

* [Qemu-devel] [PULL 19/24] MAINTAINERS: Add more TCG files
  2014-10-23 13:33 [Qemu-devel] [PULL 00/24] SCSI, maintainers and more - 2014-10-17 Paolo Bonzini
                   ` (17 preceding siblings ...)
  2014-10-23 13:34 ` [Qemu-devel] [PULL 18/24] MAINTAINERS: add myself for X86 Paolo Bonzini
@ 2014-10-23 13:34 ` Paolo Bonzini
  2014-10-23 13:34 ` [Qemu-devel] [PULL 20/24] MAINTAINERS: add some tests directories Paolo Bonzini
                   ` (5 subsequent siblings)
  24 siblings, 0 replies; 27+ messages in thread
From: Paolo Bonzini @ 2014-10-23 13:34 UTC (permalink / raw)
  To: qemu-devel

Unfortunately, TCG files do not really have a maintainer yet.
But at least there will be fewer unmaintained files.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 MAINTAINERS | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 1227ba3..3f6a45e 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -61,6 +61,17 @@ L: secalert@redhat.com
 
 Guest CPU cores (TCG):
 ----------------------
+Overall
+M: qemu-devel@nongnu.org
+S: Odd fixes
+F: cpu-exec.c
+F: cputlb.c
+F: softmmu_template.h
+F: translate-all.c
+F: include/exec/cpu_ldst.h
+F: include/exec/cpu_ldst_template.h
+F: include/exec/helper*.h
+
 Alpha
 M: Richard Henderson <rth@twiddle.net>
 S: Maintained
@@ -893,6 +904,12 @@ F: include/sysemu/seccomp.h
 
 Usermode Emulation
 ------------------
+Overall
+M: Riku Voipio <riku.voipio@iki.fi>
+S: Maintained
+F: thunk.c
+F: user-exec.c
+
 BSD user
 M: Blue Swirl <blauwirbel@gmail.com>
 S: Maintained
-- 
1.8.3.1

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

* [Qemu-devel] [PULL 20/24] MAINTAINERS: add some tests directories
  2014-10-23 13:33 [Qemu-devel] [PULL 00/24] SCSI, maintainers and more - 2014-10-17 Paolo Bonzini
                   ` (18 preceding siblings ...)
  2014-10-23 13:34 ` [Qemu-devel] [PULL 19/24] MAINTAINERS: Add more TCG files Paolo Bonzini
@ 2014-10-23 13:34 ` Paolo Bonzini
  2014-10-23 13:34 ` [Qemu-devel] [PULL 21/24] MAINTAINERS: avoid M entries that point to mailing lists Paolo Bonzini
                   ` (4 subsequent siblings)
  24 siblings, 0 replies; 27+ messages in thread
From: Paolo Bonzini @ 2014-10-23 13:34 UTC (permalink / raw)
  To: qemu-devel

Low-hanging fruit...

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 MAINTAINERS | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 3f6a45e..a1b8d57 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -77,6 +77,7 @@ M: Richard Henderson <rth@twiddle.net>
 S: Maintained
 F: target-alpha/
 F: hw/alpha/
+F: tests/tcg/alpha/
 
 ARM
 M: Peter Maydell <peter.maydell@linaro.org>
@@ -90,6 +91,7 @@ M: Edgar E. Iglesias <edgar.iglesias@gmail.com>
 S: Maintained
 F: target-cris/
 F: hw/cris/
+F: tests/tcg/cris/
 
 LM32
 M: Michael Walle <michael@walle.cc>
@@ -97,6 +99,7 @@ S: Maintained
 F: target-lm32/
 F: hw/lm32/
 F: hw/char/lm32_*
+F: tests/tcg/lm32/
 
 M68K
 S: Orphan
@@ -114,6 +117,7 @@ M: Aurelien Jarno <aurelien@aurel32.net>
 S: Odd Fixes
 F: target-mips/
 F: hw/mips/
+F: tests/tcg/mips/
 
 Moxie
 M: Anthony Green <green@moxielogic.com>
@@ -125,6 +129,7 @@ M: Jia Liu <proljc@gmail.com>
 S: Maintained
 F: target-openrisc/
 F: hw/openrisc/
+F: tests/tcg/openrisc/
 
 PowerPC
 M: Alexander Graf <agraf@suse.de>
@@ -172,6 +177,7 @@ W: http://wiki.osll.spb.ru/doku.php?id=etc:users:jcmvbkbc:qemu-target-xtensa
 S: Maintained
 F: target-xtensa/
 F: hw/xtensa/
+F: tests/tcg/xtensa/
 
 TriCore
 M: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
@@ -846,6 +852,7 @@ M: Luiz Capitulino <lcapitulino@redhat.com>
 M: Michael Roth <mdroth@linux.vnet.ibm.com>
 S: Maintained
 F: qapi/
+F: tests/qapi-schema/
 T: git git://repo.or.cz/qemu/qmp-unstable.git queue/qmp
 
 QAPI Schema
-- 
1.8.3.1

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

* [Qemu-devel] [PULL 21/24] MAINTAINERS: avoid M entries that point to mailing lists
  2014-10-23 13:33 [Qemu-devel] [PULL 00/24] SCSI, maintainers and more - 2014-10-17 Paolo Bonzini
                   ` (19 preceding siblings ...)
  2014-10-23 13:34 ` [Qemu-devel] [PULL 20/24] MAINTAINERS: add some tests directories Paolo Bonzini
@ 2014-10-23 13:34 ` Paolo Bonzini
  2014-10-23 13:34 ` [Qemu-devel] [PULL 22/24] qtest: fix qtest log fd should be initialized before qtest chardev Paolo Bonzini
                   ` (3 subsequent siblings)
  24 siblings, 0 replies; 27+ messages in thread
From: Paolo Bonzini @ 2014-10-23 13:34 UTC (permalink / raw)
  To: qemu-devel

"L" entries that point to qemu-devel are not much better either, but at least
the get_maintainer.pl output is clearer.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 MAINTAINERS | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index a1b8d57..0d60754 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -62,7 +62,7 @@ L: secalert@redhat.com
 Guest CPU cores (TCG):
 ----------------------
 Overall
-M: qemu-devel@nongnu.org
+L: qemu-devel@nongnu.org
 S: Odd fixes
 F: cpu-exec.c
 F: cputlb.c
@@ -285,7 +285,7 @@ F: include/hw/arm/digic.h
 F: hw/*/digic*
 
 Gumstix
-M: qemu-devel@nongnu.org
+L: qemu-devel@nongnu.org
 S: Orphan
 F: hw/arm/gumstix.c
 
@@ -301,7 +301,7 @@ S: Maintained
 F: hw/arm/integratorcp.c
 
 Mainstone
-M: qemu-devel@nongnu.org
+L: qemu-devel@nongnu.org
 S: Orphan
 F: hw/arm/mainstone.c
 
@@ -407,7 +407,7 @@ S: Maintained
 F: hw/mips/mips_malta.c
 
 Mipssim
-M: qemu-devel@nongnu.org
+L: qemu-devel@nongnu.org
 S: Orphan
 F: hw/mips/mips_mipssim.c
 
@@ -772,7 +772,7 @@ S: Maintained
 F: device_tree.[ch]
 
 GDB stub
-M: qemu-devel@nongnu.org
+L: qemu-devel@nongnu.org
 S: Odd Fixes
 F: gdbstub*
 F: gdb-xml/
@@ -930,7 +930,6 @@ F: linux-user/
 Tiny Code Generator (TCG)
 -------------------------
 Common code
-M: qemu-devel@nongnu.org
 M: Richard Henderson <rth@twiddle.net>
 S: Maintained
 F: tcg/
@@ -947,7 +946,7 @@ S: Maintained
 F: tcg/arm/
 
 i386 target
-M: qemu-devel@nongnu.org
+L: qemu-devel@nongnu.org
 S: Maintained
 F: tcg/i386/
 
-- 
1.8.3.1

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

* [Qemu-devel] [PULL 22/24] qtest: fix qtest log fd should be initialized before qtest chardev
  2014-10-23 13:33 [Qemu-devel] [PULL 00/24] SCSI, maintainers and more - 2014-10-17 Paolo Bonzini
                   ` (20 preceding siblings ...)
  2014-10-23 13:34 ` [Qemu-devel] [PULL 21/24] MAINTAINERS: avoid M entries that point to mailing lists Paolo Bonzini
@ 2014-10-23 13:34 ` Paolo Bonzini
  2014-10-23 13:34 ` [Qemu-devel] [PULL 23/24] get_maintainer.pl: move git loop under "if ($email) {" Paolo Bonzini
                   ` (2 subsequent siblings)
  24 siblings, 0 replies; 27+ messages in thread
From: Paolo Bonzini @ 2014-10-23 13:34 UTC (permalink / raw)
  To: qemu-devel; +Cc: Li Liu

From: Li Liu <john.liuli@huawei.com>

qtest_log_fp should be inited before qemu_chr_add_handlers.
If not the log dumped from callback functions may be lost.

easy to reproduce it by command:
"QTEST_LOG=1 QTEST_QEMU_BINARY=x86_64-softmmu/qemu-system-x86_64
gtester -k --verbose -m=quick tests/qdev-monitor-test"

The log "[I xxxxxx] OPENED" should be printed out by
qtest_event, but does not.

Signed-off-by: Li Liu <john.liuli@huawei.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 qtest.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/qtest.c b/qtest.c
index 946b560..2bca04e 100644
--- a/qtest.c
+++ b/qtest.c
@@ -545,11 +545,6 @@ void qtest_init(const char *qtest_chrdev, const char *qtest_log, Error **errp)
         return;
     }
 
-    qemu_chr_add_handlers(chr, qtest_can_read, qtest_read, qtest_event, chr);
-    qemu_chr_fe_set_echo(chr, true);
-
-    inbuf = g_string_new("");
-
     if (qtest_log) {
         if (strcmp(qtest_log, "none") != 0) {
             qtest_log_fp = fopen(qtest_log, "w+");
@@ -558,6 +553,10 @@ void qtest_init(const char *qtest_chrdev, const char *qtest_log, Error **errp)
         qtest_log_fp = stderr;
     }
 
+    qemu_chr_add_handlers(chr, qtest_can_read, qtest_read, qtest_event, chr);
+    qemu_chr_fe_set_echo(chr, true);
+
+    inbuf = g_string_new("");
     qtest_chr = chr;
 }
 
-- 
1.8.3.1

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

* [Qemu-devel] [PULL 23/24] get_maintainer.pl: move git loop under "if ($email) {"
  2014-10-23 13:33 [Qemu-devel] [PULL 00/24] SCSI, maintainers and more - 2014-10-17 Paolo Bonzini
                   ` (21 preceding siblings ...)
  2014-10-23 13:34 ` [Qemu-devel] [PULL 22/24] qtest: fix qtest log fd should be initialized before qtest chardev Paolo Bonzini
@ 2014-10-23 13:34 ` Paolo Bonzini
  2014-10-23 13:34 ` [Qemu-devel] [PULL 24/24] get_maintainer.pl: restrict cases where it falls back to --git Paolo Bonzini
  2014-10-23 14:32 ` [Qemu-devel] [PULL 00/24] SCSI, maintainers and more - 2014-10-17 Peter Maydell
  24 siblings, 0 replies; 27+ messages in thread
From: Paolo Bonzini @ 2014-10-23 13:34 UTC (permalink / raw)
  To: qemu-devel

All checks in the loop are guarded by that condition, and there is a
handy "if" just below.  Simplify the code.

Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 scripts/get_maintainer.pl | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl
index 38334de..906dcbe 100755
--- a/scripts/get_maintainer.pl
+++ b/scripts/get_maintainer.pl
@@ -651,18 +651,17 @@ sub get_maintainers {
 	$email->[0] = deduplicate_email($email->[0]);
     }
 
-    foreach my $file (@files) {
-	if ($email &&
-	    ($email_git || ($email_git_fallback &&
-			    !$exact_pattern_match_hash{$file}))) {
-	    vcs_file_signoffs($file);
-	}
-	if ($email && $email_git_blame) {
-	    vcs_file_blame($file);
+    if ($email) {
+	foreach my $file (@files) {
+	    if ($email_git || ($email_git_fallback &&
+			       !$exact_pattern_match_hash{$file})) {
+	        vcs_file_signoffs($file);
+	    }
+	    if ($email_git_blame) {
+	        vcs_file_blame($file);
+	    }
 	}
-    }
 
-    if ($email) {
 	foreach my $chief (@penguin_chief) {
 	    if ($chief =~ m/^(.*):(.*)/) {
 		my $email_address;
-- 
1.8.3.1

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

* [Qemu-devel] [PULL 24/24] get_maintainer.pl: restrict cases where it falls back to --git
  2014-10-23 13:33 [Qemu-devel] [PULL 00/24] SCSI, maintainers and more - 2014-10-17 Paolo Bonzini
                   ` (22 preceding siblings ...)
  2014-10-23 13:34 ` [Qemu-devel] [PULL 23/24] get_maintainer.pl: move git loop under "if ($email) {" Paolo Bonzini
@ 2014-10-23 13:34 ` Paolo Bonzini
  2014-10-23 14:32 ` [Qemu-devel] [PULL 00/24] SCSI, maintainers and more - 2014-10-17 Peter Maydell
  24 siblings, 0 replies; 27+ messages in thread
From: Paolo Bonzini @ 2014-10-23 13:34 UTC (permalink / raw)
  To: qemu-devel

The list emitted by --git-fallback often leads inexperienced contributors
to add pointless CCs.  While not discouraging usage of --git-fallback,
we want to:

1) disable the fallback if only some files lack a maintainer

    $ scripts/get_maintainer.pl -f util/cutils.c hw/ide/core.c
    Kevin Wolf <kwolf@redhat.com> (odd fixer:IDE)
    Stefan Hajnoczi <stefanha@redhat.com> (odd fixer:IDE)

This behavior is taken even if --git-fallback is specified.

2) warn the contributors about what we're doing, asking them to use their
common sense:

    $ scripts/get_maintainer.pl -f util/cutils.c
    get_maintainer.pl: No maintainers found, printing recent contributors.
    get_maintainer.pl: Do not blindly cc: them on patches!  Use common sense.

    Luiz Capitulino <lcapitulino@redhat.com> (commit_signer:1/2=50%)
    ...
    $

Explicitly disabling the fallback will not result in the warning message:

    $ scripts/get_maintainer.pl -f util/cutils.c   --no-git-fallback
    $ echo $?
    0

(Returning 1 would break usage of scripts/get_maintainer.pl as a cccmd
for git-send-email).

Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 scripts/get_maintainer.pl | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl
index 906dcbe..af68c6c 100755
--- a/scripts/get_maintainer.pl
+++ b/scripts/get_maintainer.pl
@@ -652,6 +652,15 @@ sub get_maintainers {
     }
 
     if ($email) {
+	if (! $interactive) {
+	    $email_git_fallback = 0 if @email_to > 0 || @list_to > 0 || $email_git || $email_git_blame;
+	    if ($email_git_fallback) {
+	        print STDERR "get_maintainer.pl: No maintainers found, printing recent contributors.\n";
+	        print STDERR "get_maintainer.pl: Do not blindly cc: them on patches!  Use common sense.\n";
+	        print STDERR "\n";
+            }
+        }
+
 	foreach my $file (@files) {
 	    if ($email_git || ($email_git_fallback &&
 			       !$exact_pattern_match_hash{$file})) {
-- 
1.8.3.1

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

* Re: [Qemu-devel] [PULL 00/24] SCSI, maintainers and more - 2014-10-17
  2014-10-23 13:33 [Qemu-devel] [PULL 00/24] SCSI, maintainers and more - 2014-10-17 Paolo Bonzini
                   ` (23 preceding siblings ...)
  2014-10-23 13:34 ` [Qemu-devel] [PULL 24/24] get_maintainer.pl: restrict cases where it falls back to --git Paolo Bonzini
@ 2014-10-23 14:32 ` Peter Maydell
  2014-10-23 14:39   ` Paolo Bonzini
  24 siblings, 1 reply; 27+ messages in thread
From: Peter Maydell @ 2014-10-23 14:32 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: QEMU Developers

On 23 October 2014 14:33, Paolo Bonzini <pbonzini@redhat.com> wrote:
> The following changes since commit 5f77ef69a195098baddfdc6d189f1b4a94587378:
>
>   glib: add compatibility interface for g_strcmp0() (2014-10-16 23:02:31 +0100)
>
> are available in the git repository at:
>
>   git://github.com/bonzini/qemu.git tags/for-upstream
>
> for you to fetch changes up to 6dad2b7b17ddfeb8276d2e359cb2383a8ae98d37:
>
>   get_maintainer.pl: restrict cases where it falls back to --git (2014-10-22 15:56:34 +0200)
>
> ----------------------------------------------------------------
> virtio-scsi-dataplane fixes and the first part of dynamic sysbus devices
> Also MAINTAINERS updates, they are fancy these days. :)
>
> ----------------------------------------------------------------

Hi. I'm afraid this doesn't compile:

/home/petmay01/linaro/qemu-for-merges/hw/scsi/virtio-scsi.c: In
function ‘virtio_scsi_hotplug’:
/home/petmay01/linaro/qemu-for-merges/hw/scsi/virtio-scsi.c:749:40:
error: ‘BlockConf’ has no member named ‘bs’
         if (bdrv_op_is_blocked(sd->conf.bs, BLOCK_OP_TYPE_DATAPLANE, errp)) {
                                        ^
/home/petmay01/linaro/qemu-for-merges/hw/scsi/virtio-scsi.c:752:35:
error: ‘BlockConf’ has no member named ‘bs’
         bdrv_op_block_all(sd->conf.bs, s->blocker);
                                   ^
/home/petmay01/linaro/qemu-for-merges/hw/scsi/virtio-scsi.c: In
function ‘virtio_scsi_hotunplug’:
/home/petmay01/linaro/qemu-for-merges/hw/scsi/virtio-scsi.c:776:37:
error: ‘BlockConf’ has no member named ‘bs’
         bdrv_op_unblock_all(sd->conf.bs, s->blocker);
                                     ^
make[1]: *** [hw/scsi/virtio-scsi.o] Error 1

thanks
-- PMM

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

* Re: [Qemu-devel] [PULL 00/24] SCSI, maintainers and more - 2014-10-17
  2014-10-23 14:32 ` [Qemu-devel] [PULL 00/24] SCSI, maintainers and more - 2014-10-17 Peter Maydell
@ 2014-10-23 14:39   ` Paolo Bonzini
  0 siblings, 0 replies; 27+ messages in thread
From: Paolo Bonzini @ 2014-10-23 14:39 UTC (permalink / raw)
  To: Peter Maydell; +Cc: QEMU Developers



On 10/23/2014 04:32 PM, Peter Maydell wrote:
> On 23 October 2014 14:33, Paolo Bonzini <pbonzini@redhat.com> wrote:
>> The following changes since commit 5f77ef69a195098baddfdc6d189f1b4a94587378:
>>
>>   glib: add compatibility interface for g_strcmp0() (2014-10-16 23:02:31 +0100)
>>
>> are available in the git repository at:
>>
>>   git://github.com/bonzini/qemu.git tags/for-upstream
>>
>> for you to fetch changes up to 6dad2b7b17ddfeb8276d2e359cb2383a8ae98d37:
>>
>>   get_maintainer.pl: restrict cases where it falls back to --git (2014-10-22 15:56:34 +0200)
>>
>> ----------------------------------------------------------------
>> virtio-scsi-dataplane fixes and the first part of dynamic sysbus devices
>> Also MAINTAINERS updates, they are fancy these days. :)
>>
>> ----------------------------------------------------------------
> 
> Hi. I'm afraid this doesn't compile:
> 
> /home/petmay01/linaro/qemu-for-merges/hw/scsi/virtio-scsi.c: In
> function ‘virtio_scsi_hotplug’:
> /home/petmay01/linaro/qemu-for-merges/hw/scsi/virtio-scsi.c:749:40:
> error: ‘BlockConf’ has no member named ‘bs’
>          if (bdrv_op_is_blocked(sd->conf.bs, BLOCK_OP_TYPE_DATAPLANE, errp)) {
>                                         ^
> /home/petmay01/linaro/qemu-for-merges/hw/scsi/virtio-scsi.c:752:35:
> error: ‘BlockConf’ has no member named ‘bs’
>          bdrv_op_block_all(sd->conf.bs, s->blocker);
>                                    ^
> /home/petmay01/linaro/qemu-for-merges/hw/scsi/virtio-scsi.c: In
> function ‘virtio_scsi_hotunplug’:
> /home/petmay01/linaro/qemu-for-merges/hw/scsi/virtio-scsi.c:776:37:
> error: ‘BlockConf’ has no member named ‘bs’
>          bdrv_op_unblock_all(sd->conf.bs, s->blocker);
>                                      ^
> make[1]: *** [hw/scsi/virtio-scsi.o] Error 1

Semantic conflict:

diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c
index 3f540ad..2d2612b 100644
--- a/hw/scsi/virtio-scsi.c
+++ b/hw/scsi/virtio-scsi.c
@@ -746,10 +746,10 @@ static void virtio_scsi_hotplug(HotplugHandler *hotplug_dev, DeviceState *dev,
     SCSIDevice *sd = SCSI_DEVICE(dev);
 
     if (s->ctx && !s->dataplane_disabled) {
-        if (bdrv_op_is_blocked(sd->conf.bs, BLOCK_OP_TYPE_DATAPLANE, errp)) {
+        if (blk_op_is_blocked(sd->conf.blk, BLOCK_OP_TYPE_DATAPLANE, errp)) {
             return;
         }
-        bdrv_op_block_all(sd->conf.bs, s->blocker);
+        blk_op_block_all(sd->conf.blk, s->blocker);
     }
 
     if ((vdev->guest_features >> VIRTIO_SCSI_F_HOTPLUG) & 1) {
@@ -773,7 +773,7 @@ static void virtio_scsi_hotunplug(HotplugHandler *hotplug_dev, DeviceState *dev,
     }
 
     if (s->ctx) {
-        bdrv_op_unblock_all(sd->conf.bs, s->blocker);
+        blk_op_unblock_all(sd->conf.blk, s->blocker);
     }
     qdev_simple_device_unplug_cb(hotplug_dev, dev, errp);
 }


will send v2.

Paolo

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

end of thread, other threads:[~2014-10-23 14:39 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-23 13:33 [Qemu-devel] [PULL 00/24] SCSI, maintainers and more - 2014-10-17 Paolo Bonzini
2014-10-23 13:33 ` [Qemu-devel] [PULL 01/24] virtio-scsi-dataplane: Add op blocker Paolo Bonzini
2014-10-23 13:33 ` [Qemu-devel] [PULL 02/24] virtio-scsi: dataplane: print why starting failed Paolo Bonzini
2014-10-23 13:33 ` [Qemu-devel] [PULL 03/24] virtio-scsi: dataplane: fail setup gracefully Paolo Bonzini
2014-10-23 13:33 ` [Qemu-devel] [PULL 04/24] virtio-scsi: dataplane: stop trying on notifier error Paolo Bonzini
2014-10-23 13:33 ` [Qemu-devel] [PULL 05/24] qom: Allow clearing of a Link property Paolo Bonzini
2014-10-23 13:33 ` [Qemu-devel] [PULL 06/24] qom: Demote already-has-a-parent to a regular error Paolo Bonzini
2014-10-23 13:33 ` [Qemu-devel] [PULL 07/24] qdev: gpio: Re-implement qdev_connect_gpio QOM style Paolo Bonzini
2014-10-23 13:33 ` [Qemu-devel] [PULL 08/24] qdev: gpio: Add API for intercepting a GPIO Paolo Bonzini
2014-10-23 13:33 ` [Qemu-devel] [PULL 09/24] qtest/irq: Rework IRQ interception Paolo Bonzini
2014-10-23 13:33 ` [Qemu-devel] [PULL 10/24] irq: Remove qemu_irq_intercept_out Paolo Bonzini
2014-10-23 13:33 ` [Qemu-devel] [PULL 11/24] qdev: gpio: delete NamedGPIOList::out Paolo Bonzini
2014-10-23 13:34 ` [Qemu-devel] [PULL 12/24] qdev: gpio: Remove qdev_init_gpio_out x1 restriction Paolo Bonzini
2014-10-23 13:34 ` [Qemu-devel] [PULL 13/24] qdev: gpio: Define qdev_pass_gpios() Paolo Bonzini
2014-10-23 13:34 ` [Qemu-devel] [PULL 14/24] sysbus: Use TYPE_DEVICE GPIO functionality Paolo Bonzini
2014-10-23 13:34 ` [Qemu-devel] [PULL 15/24] target-i386: warns users when CPU threads>1 for non-Intel CPUs Paolo Bonzini
2014-10-23 13:34 ` [Qemu-devel] [PULL 16/24] MAINTAINERS: grab more files from Anthony's pile Paolo Bonzini
2014-10-23 13:34 ` [Qemu-devel] [PULL 17/24] MAINTAINERS: add Samuel Thibault as usb-serial.c and baum.c maintainer Paolo Bonzini
2014-10-23 13:34 ` [Qemu-devel] [PULL 18/24] MAINTAINERS: add myself for X86 Paolo Bonzini
2014-10-23 13:34 ` [Qemu-devel] [PULL 19/24] MAINTAINERS: Add more TCG files Paolo Bonzini
2014-10-23 13:34 ` [Qemu-devel] [PULL 20/24] MAINTAINERS: add some tests directories Paolo Bonzini
2014-10-23 13:34 ` [Qemu-devel] [PULL 21/24] MAINTAINERS: avoid M entries that point to mailing lists Paolo Bonzini
2014-10-23 13:34 ` [Qemu-devel] [PULL 22/24] qtest: fix qtest log fd should be initialized before qtest chardev Paolo Bonzini
2014-10-23 13:34 ` [Qemu-devel] [PULL 23/24] get_maintainer.pl: move git loop under "if ($email) {" Paolo Bonzini
2014-10-23 13:34 ` [Qemu-devel] [PULL 24/24] get_maintainer.pl: restrict cases where it falls back to --git Paolo Bonzini
2014-10-23 14:32 ` [Qemu-devel] [PULL 00/24] SCSI, maintainers and more - 2014-10-17 Peter Maydell
2014-10-23 14:39   ` Paolo Bonzini

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.