[Spice-commits] 12 commits - configure hw/9pfs hw/tpm hw/usb hw/virtio include/sysemu po/tr.po tpm.c trace-events ui/gtk.c vl.c

Gerd Hoffmann kraxel at kemper.freedesktop.org
Wed Apr 24 01:27:17 PDT 2013


 configure                    |    2 
 hw/9pfs/virtio-9p-device.c   |   91 +++++++++++++++++++++++++++----------------
 hw/9pfs/virtio-9p.c          |    2 
 hw/9pfs/virtio-9p.h          |   12 ++++-
 hw/tpm/tpm_int.h             |    7 +++
 hw/tpm/tpm_passthrough.c     |   16 +++++++
 hw/usb/bus.c                 |   36 +++++++++++++++--
 hw/usb/desc.c                |    2 
 hw/usb/hcd-ehci.c            |   16 +++++--
 hw/usb/hcd-xhci.c            |    4 -
 hw/usb/host-libusb.c         |    5 --
 hw/virtio/virtio-pci.c       |   61 ++++++++++++++++------------
 hw/virtio/virtio-pci.h       |   23 +++++++++-
 include/sysemu/tpm_backend.h |    1 
 po/tr.po                     |   62 +++++++++++++++++++++++++++++
 tpm.c                        |    8 +++
 trace-events                 |    2 
 ui/gtk.c                     |    4 -
 vl.c                         |   16 -------
 19 files changed, 266 insertions(+), 104 deletions(-)

New commits:
commit bb71623811686ce3c34ce724f073f5c5dd95f51b
Author: Stefan Berger <stefanb at linux.vnet.ibm.com>
Date:   Mon Apr 22 10:41:39 2013 -0400

    Move TPM passthrough specific command line options to backend structure
    
    Move the TPM passthrough specific command line options to the passthrough
    backend implementation and attach them to the backend's interface structure.
    
    Add code to tpm.c for validating the TPM command line options.
    
    Signed-off-by: Stefan Berger <stefanb at linux.vnet.ibm.com>
    Reviewed-by: Corey Bryan <coreyb at linux.vnet.ibm.com>
    Message-id: 1366641699-21420-1-git-send-email-stefanb at linux.vnet.ibm.com
    Signed-off-by: Anthony Liguori <aliguori at us.ibm.com>

diff --git a/hw/tpm/tpm_int.h b/hw/tpm/tpm_int.h
index 08f87cb..2f582ca 100644
--- a/hw/tpm/tpm_int.h
+++ b/hw/tpm/tpm_int.h
@@ -33,6 +33,13 @@ struct TPMState {
 
 #define TPM(obj) OBJECT_CHECK(TPMState, (obj), TYPE_TPM_TIS)
 
+#define TPM_STANDARD_CMDLINE_OPTS \
+    { \
+        .name = "type", \
+        .type = QEMU_OPT_STRING, \
+        .help = "Type of TPM backend", \
+    }
+
 struct tpm_req_hdr {
     uint16_t tag;
     uint32_t len;
diff --git a/hw/tpm/tpm_passthrough.c b/hw/tpm/tpm_passthrough.c
index ce74e97..56e9e0f 100644
--- a/hw/tpm/tpm_passthrough.c
+++ b/hw/tpm/tpm_passthrough.c
@@ -488,8 +488,24 @@ static void tpm_passthrough_destroy(TPMBackend *tb)
     g_free(tpm_pt->tpm_dev);
 }
 
+static const QemuOptDesc tpm_passthrough_cmdline_opts[] = {
+    TPM_STANDARD_CMDLINE_OPTS,
+    {
+        .name = "cancel-path",
+        .type = QEMU_OPT_STRING,
+        .help = "Sysfs file entry for canceling TPM commands",
+    },
+    {
+        .name = "path",
+        .type = QEMU_OPT_STRING,
+        .help = "Path to TPM device on the host",
+    },
+    { /* end of list */ },
+};
+
 static const TPMDriverOps tpm_passthrough_driver = {
     .type                     = TPM_TYPE_PASSTHROUGH,
+    .opts                     = tpm_passthrough_cmdline_opts,
     .desc                     = tpm_passthrough_create_desc,
     .create                   = tpm_passthrough_create,
     .destroy                  = tpm_passthrough_destroy,
diff --git a/include/sysemu/tpm_backend.h b/include/sysemu/tpm_backend.h
index 4667874..825f33b 100644
--- a/include/sysemu/tpm_backend.h
+++ b/include/sysemu/tpm_backend.h
@@ -65,6 +65,7 @@ typedef struct TPMSizedBuffer {
 
 struct TPMDriverOps {
     enum TpmType type;
+    const QemuOptDesc *opts;
     /* get a descriptive text of the backend to display to the user */
     const char *(*desc)(void);
 
diff --git a/tpm.c b/tpm.c
index c91da43..f13c9bc 100644
--- a/tpm.c
+++ b/tpm.c
@@ -159,6 +159,14 @@ static int configure_tpm(QemuOpts *opts)
         return 1;
     }
 
+    /* validate backend specific opts */
+    qemu_opts_validate(opts, be->opts, &local_err);
+    if (error_is_set(&local_err)) {
+        qerror_report_err(local_err);
+        error_free(local_err);
+        return 1;
+    }
+
     drv = be->create(opts, id);
     if (!drv) {
         return 1;
diff --git a/vl.c b/vl.c
index 6caa5f4..2e0d1a7 100644
--- a/vl.c
+++ b/vl.c
@@ -502,21 +502,7 @@ static QemuOptsList qemu_tpmdev_opts = {
     .implied_opt_name = "type",
     .head = QTAILQ_HEAD_INITIALIZER(qemu_tpmdev_opts.head),
     .desc = {
-        {
-            .name = "type",
-            .type = QEMU_OPT_STRING,
-            .help = "Type of TPM backend",
-        },
-        {
-            .name = "cancel-path",
-            .type = QEMU_OPT_STRING,
-            .help = "Sysfs file entry for canceling TPM commands",
-        },
-        {
-            .name = "path",
-            .type = QEMU_OPT_STRING,
-            .help = "Path to TPM device on the host",
-        },
+        /* options are defined in the TPM backends */
         { /* end of list */ }
     },
 };
commit 13daf6cad05a65970381cd8b876426d55133aadf
Author: KONRAD Frederic <fred.konrad at greensocs.com>
Date:   Tue Apr 23 11:08:43 2013 +0200

    virtio-9p: cleanup: QOM casts.
    
    As the virtio-9p-pci is switched to the new API, we can use QOM casts.
    
    Signed-off-by: KONRAD Frederic <fred.konrad at greensocs.com>
    Message-id: 1366708123-19626-5-git-send-email-fred.konrad at greensocs.com
    Signed-off-by: Anthony Liguori <aliguori at us.ibm.com>

diff --git a/hw/9pfs/virtio-9p-device.c b/hw/9pfs/virtio-9p-device.c
index 29a639e..62a291b 100644
--- a/hw/9pfs/virtio-9p-device.c
+++ b/hw/9pfs/virtio-9p-device.c
@@ -26,16 +26,11 @@ static uint32_t virtio_9p_get_features(VirtIODevice *vdev, uint32_t features)
     return features;
 }
 
-static V9fsState *to_virtio_9p(VirtIODevice *vdev)
-{
-    return (V9fsState *)vdev;
-}
-
 static void virtio_9p_get_config(VirtIODevice *vdev, uint8_t *config)
 {
     int len;
     struct virtio_9p_config *cfg;
-    V9fsState *s = to_virtio_9p(vdev);
+    V9fsState *s = VIRTIO_9P(vdev);
 
     len = strlen(s->tag);
     cfg = g_malloc0(sizeof(struct virtio_9p_config) + len);
@@ -97,9 +92,9 @@ static int virtio_9p_device_init(VirtIODevice *vdev)
     s->ctx.uid = -1;
 
     s->ops = fse->ops;
-    s->vdev.get_features = virtio_9p_get_features;
+    vdev->get_features = virtio_9p_get_features;
     s->config_size = sizeof(struct virtio_9p_config) + len;
-    s->vdev.get_config = virtio_9p_get_config;
+    vdev->get_config = virtio_9p_get_config;
     s->fid_list = NULL;
     qemu_co_rwlock_init(&s->rename_lock);
 
diff --git a/hw/9pfs/virtio-9p.c b/hw/9pfs/virtio-9p.c
index db2ae32..296f66f 100644
--- a/hw/9pfs/virtio-9p.c
+++ b/hw/9pfs/virtio-9p.c
@@ -631,7 +631,7 @@ static void complete_pdu(V9fsState *s, V9fsPDU *pdu, ssize_t len)
     virtqueue_push(s->vq, &pdu->elem, len);
 
     /* FIXME: we should batch these completions */
-    virtio_notify(&s->vdev, s->vq);
+    virtio_notify(VIRTIO_DEVICE(s), s->vq);
 
     /* Now wakeup anybody waiting in flush for this request */
     qemu_co_queue_next(&pdu->complete);
diff --git a/hw/9pfs/virtio-9p.h b/hw/9pfs/virtio-9p.h
index e1fa506..1d6eedb 100644
--- a/hw/9pfs/virtio-9p.h
+++ b/hw/9pfs/virtio-9p.h
@@ -205,7 +205,7 @@ struct V9fsFidState
 
 typedef struct V9fsState
 {
-    VirtIODevice vdev;
+    VirtIODevice parent_obj;
     VirtQueue *vq;
     V9fsPDU pdus[MAX_REQ];
     QLIST_HEAD(, V9fsPDU) free_list;
commit e8111e50557761b0d86cd5c90fe7a272aeddd7a3
Author: KONRAD Frederic <fred.konrad at greensocs.com>
Date:   Tue Apr 23 11:08:42 2013 +0200

    virtio-9p: cleanup: init function.
    
    This remove old init function as it is no longer needed.
    
    Signed-off-by: KONRAD Frederic <fred.konrad at greensocs.com>
    Message-id: 1366708123-19626-4-git-send-email-fred.konrad at greensocs.com
    Signed-off-by: Anthony Liguori <aliguori at us.ibm.com>

diff --git a/hw/9pfs/virtio-9p-device.c b/hw/9pfs/virtio-9p-device.c
index 7f00a45..29a639e 100644
--- a/hw/9pfs/virtio-9p-device.c
+++ b/hw/9pfs/virtio-9p-device.c
@@ -46,30 +46,17 @@ static void virtio_9p_get_config(VirtIODevice *vdev, uint8_t *config)
     g_free(cfg);
 }
 
-static VirtIODevice *virtio_9p_common_init(DeviceState *dev, V9fsConf *conf,
-                                           V9fsState **ps)
+static int virtio_9p_device_init(VirtIODevice *vdev)
 {
-    V9fsState *s = *ps;
+    V9fsState *s = VIRTIO_9P(vdev);
     int i, len;
     struct stat stat;
     FsDriverEntry *fse;
     V9fsPath path;
 
-    /*
-     * We have two cases here: the old virtio-9p-pci device, and the
-     * refactored virtio-9p.
-     */
+    virtio_init(VIRTIO_DEVICE(s), "virtio-9p", VIRTIO_ID_9P,
+                sizeof(struct virtio_9p_config) + MAX_TAG_LEN);
 
-    if (s == NULL) {
-        s = (V9fsState *)virtio_common_init("virtio-9p",
-                                        VIRTIO_ID_9P,
-                                        sizeof(struct virtio_9p_config)+
-                                        MAX_TAG_LEN,
-                                        sizeof(V9fsState));
-    } else {
-        virtio_init(VIRTIO_DEVICE(s), "virtio-9p", VIRTIO_ID_9P,
-                    sizeof(struct virtio_9p_config) + MAX_TAG_LEN);
-    }
     /* initialize pdu allocator */
     QLIST_INIT(&s->free_list);
     QLIST_INIT(&s->active_list);
@@ -77,35 +64,36 @@ static VirtIODevice *virtio_9p_common_init(DeviceState *dev, V9fsConf *conf,
         QLIST_INSERT_HEAD(&s->free_list, &s->pdus[i], next);
     }
 
-    s->vq = virtio_add_queue(&s->vdev, MAX_REQ, handle_9p_output);
+    s->vq = virtio_add_queue(vdev, MAX_REQ, handle_9p_output);
 
-    fse = get_fsdev_fsentry(conf->fsdev_id);
+    fse = get_fsdev_fsentry(s->fsconf.fsdev_id);
 
     if (!fse) {
         /* We don't have a fsdev identified by fsdev_id */
         fprintf(stderr, "Virtio-9p device couldn't find fsdev with the "
-                "id = %s\n", conf->fsdev_id ? conf->fsdev_id : "NULL");
-        exit(1);
+                "id = %s\n",
+                s->fsconf.fsdev_id ? s->fsconf.fsdev_id : "NULL");
+        return -1;
     }
 
-    if (!conf->tag) {
+    if (!s->fsconf.tag) {
         /* we haven't specified a mount_tag */
         fprintf(stderr, "fsdev with id %s needs mount_tag arguments\n",
-                conf->fsdev_id);
-        exit(1);
+                s->fsconf.fsdev_id);
+        return -1;
     }
 
     s->ctx.export_flags = fse->export_flags;
     s->ctx.fs_root = g_strdup(fse->path);
     s->ctx.exops.get_st_gen = NULL;
-    len = strlen(conf->tag);
+    len = strlen(s->fsconf.tag);
     if (len > MAX_TAG_LEN - 1) {
         fprintf(stderr, "mount tag '%s' (%d bytes) is longer than "
-                "maximum (%d bytes)", conf->tag, len, MAX_TAG_LEN - 1);
-        exit(1);
+                "maximum (%d bytes)", s->fsconf.tag, len, MAX_TAG_LEN - 1);
+        return -1;
     }
 
-    s->tag = g_strdup(conf->tag);
+    s->tag = strdup(s->fsconf.tag);
     s->ctx.uid = -1;
 
     s->ops = fse->ops;
@@ -117,12 +105,12 @@ static VirtIODevice *virtio_9p_common_init(DeviceState *dev, V9fsConf *conf,
 
     if (s->ops->init(&s->ctx) < 0) {
         fprintf(stderr, "Virtio-9p Failed to initialize fs-driver with id:%s"
-                " and export path:%s\n", conf->fsdev_id, s->ctx.fs_root);
-        exit(1);
+                " and export path:%s\n", s->fsconf.fsdev_id, s->ctx.fs_root);
+        return -1;
     }
     if (v9fs_init_worker_threads() < 0) {
         fprintf(stderr, "worker thread initialization failed\n");
-        exit(1);
+        return -1;
     }
 
     /*
@@ -134,39 +122,22 @@ static VirtIODevice *virtio_9p_common_init(DeviceState *dev, V9fsConf *conf,
     if (s->ops->name_to_path(&s->ctx, NULL, "/", &path) < 0) {
         fprintf(stderr,
                 "error in converting name to path %s", strerror(errno));
-        exit(1);
+        return -1;
     }
     if (s->ops->lstat(&s->ctx, &path, &stat)) {
         fprintf(stderr, "share path %s does not exist\n", fse->path);
-        exit(1);
+        return -1;
     } else if (!S_ISDIR(stat.st_mode)) {
         fprintf(stderr, "share path %s is not a directory\n", fse->path);
-        exit(1);
+        return -1;
     }
     v9fs_path_free(&path);
 
-    return &s->vdev;
-}
-
-VirtIODevice *virtio_9p_init(DeviceState *dev, V9fsConf *conf)
-{
-    V9fsState *s = NULL;
-    return virtio_9p_common_init(dev, conf, &s);
+    return 0;
 }
 
 /* virtio-9p device */
 
-static int virtio_9p_device_init(VirtIODevice *vdev)
-{
-    DeviceState *qdev = DEVICE(vdev);
-    V9fsState *s = VIRTIO_9P(vdev);
-    V9fsConf *fsconf = &(s->fsconf);
-    if (virtio_9p_common_init(qdev, fsconf, &s) == NULL) {
-        return -1;
-    }
-    return 0;
-}
-
 static Property virtio_9p_properties[] = {
     DEFINE_VIRTIO_9P_PROPERTIES(V9fsState, fsconf),
     DEFINE_PROP_END_OF_LIST(),
commit 234a336f9e308ae60ad8ef8f2662eb0a93d7ff00
Author: KONRAD Frederic <fred.konrad at greensocs.com>
Date:   Tue Apr 23 11:08:41 2013 +0200

    virtio-9p-pci: switch to the new API.
    
    Here the virtio-9p-pci is modified for the new API. The device
    virtio-9p-pci extends virtio-pci. It creates and connects a
    virtio-9p-device during the init. The properties are not changed.
    
    Signed-off-by: KONRAD Frederic <fred.konrad at greensocs.com>
    Message-id: 1366708123-19626-3-git-send-email-fred.konrad at greensocs.com
    Signed-off-by: Anthony Liguori <aliguori at us.ibm.com>

diff --git a/hw/9pfs/virtio-9p.h b/hw/9pfs/virtio-9p.h
index 767f7e6..e1fa506 100644
--- a/hw/9pfs/virtio-9p.h
+++ b/hw/9pfs/virtio-9p.h
@@ -12,7 +12,6 @@
 #include "qemu/thread.h"
 #include "block/coroutine.h"
 
-
 /* The feature bitmap for virtio 9P */
 /* The mount point is specified in a config variable */
 #define VIRTIO_9P_MOUNT_TAG 0
diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
index 787f5fd..a1f15a8 100644
--- a/hw/virtio/virtio-pci.c
+++ b/hw/virtio/virtio-pci.c
@@ -1023,48 +1023,56 @@ static const TypeInfo virtio_rng_info = {
 };
 
 #ifdef CONFIG_VIRTFS
-static int virtio_9p_init_pci(PCIDevice *pci_dev)
+static int virtio_9p_init_pci(VirtIOPCIProxy *vpci_dev)
 {
-    VirtIOPCIProxy *proxy = DO_UPCAST(VirtIOPCIProxy, pci_dev, pci_dev);
-    VirtIODevice *vdev;
+    V9fsPCIState *dev = VIRTIO_9P_PCI(vpci_dev);
+    DeviceState *vdev = DEVICE(&dev->vdev);
 
-    vdev = virtio_9p_init(&pci_dev->qdev, &proxy->fsconf);
-    vdev->nvectors = proxy->nvectors;
-    virtio_init_pci(proxy, vdev);
-    /* make the actual value visible */
-    proxy->nvectors = vdev->nvectors;
+    qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus));
+    if (qdev_init(vdev) < 0) {
+        return -1;
+    }
     return 0;
 }
 
-static Property virtio_9p_properties[] = {
-    DEFINE_PROP_BIT("ioeventfd", VirtIOPCIProxy, flags, VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT, true),
+static Property virtio_9p_pci_properties[] = {
+    DEFINE_PROP_BIT("ioeventfd", VirtIOPCIProxy, flags,
+                    VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT, true),
     DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, 2),
     DEFINE_VIRTIO_COMMON_FEATURES(VirtIOPCIProxy, host_features),
-    DEFINE_VIRTIO_9P_PROPERTIES(VirtIOPCIProxy, fsconf),
+    DEFINE_VIRTIO_9P_PROPERTIES(V9fsPCIState, vdev.fsconf),
     DEFINE_PROP_END_OF_LIST(),
 };
 
-static void virtio_9p_class_init(ObjectClass *klass, void *data)
+static void virtio_9p_pci_class_init(ObjectClass *klass, void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
-    PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
+    PCIDeviceClass *pcidev_k = PCI_DEVICE_CLASS(klass);
+    VirtioPCIClass *k = VIRTIO_PCI_CLASS(klass);
 
     k->init = virtio_9p_init_pci;
-    k->vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET;
-    k->device_id = PCI_DEVICE_ID_VIRTIO_9P;
-    k->revision = VIRTIO_PCI_ABI_VERSION;
-    k->class_id = 0x2;
-    dc->props = virtio_9p_properties;
-    dc->reset = virtio_pci_reset;
+    pcidev_k->vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET;
+    pcidev_k->device_id = PCI_DEVICE_ID_VIRTIO_9P;
+    pcidev_k->revision = VIRTIO_PCI_ABI_VERSION;
+    pcidev_k->class_id = 0x2;
+    dc->props = virtio_9p_pci_properties;
 }
 
-static const TypeInfo virtio_9p_info = {
-    .name          = "virtio-9p-pci",
-    .parent        = TYPE_PCI_DEVICE,
-    .instance_size = sizeof(VirtIOPCIProxy),
-    .class_init    = virtio_9p_class_init,
+static void virtio_9p_pci_instance_init(Object *obj)
+{
+    V9fsPCIState *dev = VIRTIO_9P_PCI(obj);
+    object_initialize(OBJECT(&dev->vdev), TYPE_VIRTIO_9P);
+    object_property_add_child(obj, "virtio-backend", OBJECT(&dev->vdev), NULL);
+}
+
+static const TypeInfo virtio_9p_pci_info = {
+    .name          = TYPE_VIRTIO_9P_PCI,
+    .parent        = TYPE_VIRTIO_PCI,
+    .instance_size = sizeof(V9fsPCIState),
+    .instance_init = virtio_9p_pci_instance_init,
+    .class_init    = virtio_9p_pci_class_init,
 };
-#endif
+#endif /* CONFIG_VIRTFS */
 
 /*
  * virtio-pci: This is the PCIDevice which has a virtio-pci-bus.
@@ -1590,7 +1598,7 @@ static void virtio_pci_register_types(void)
     type_register_static(&virtio_pci_bus_info);
     type_register_static(&virtio_pci_info);
 #ifdef CONFIG_VIRTFS
-    type_register_static(&virtio_9p_info);
+    type_register_static(&virtio_9p_pci_info);
 #endif
     type_register_static(&virtio_blk_pci_info);
     type_register_static(&virtio_scsi_pci_info);
diff --git a/hw/virtio/virtio-pci.h b/hw/virtio/virtio-pci.h
index 1b66e46..db0185c 100644
--- a/hw/virtio/virtio-pci.h
+++ b/hw/virtio/virtio-pci.h
@@ -24,6 +24,9 @@
 #include "hw/virtio/virtio-balloon.h"
 #include "hw/virtio/virtio-bus.h"
 #include "hw/virtio/virtio-9p.h"
+#ifdef CONFIG_VIRTFS
+#include "hw/9pfs/virtio-9p.h"
+#endif
 #ifdef CONFIG_VHOST_SCSI
 #include "hw/virtio/vhost-scsi.h"
 #endif
@@ -84,9 +87,6 @@ struct VirtIOPCIProxy {
     uint32_t class_code;
     uint32_t nvectors;
     uint32_t host_features;
-#ifdef CONFIG_VIRTFS
-    V9fsConf fsconf;
-#endif
     VirtIORNGConf rng;
     bool ioeventfd_disabled;
     bool ioeventfd_started;
@@ -171,6 +171,23 @@ struct VirtIONetPCI {
     VirtIONet vdev;
 };
 
+/*
+ * virtio-9p-pci: This extends VirtioPCIProxy.
+ */
+
+#ifdef CONFIG_VIRTFS
+
+#define TYPE_VIRTIO_9P_PCI "virtio-9p-pci"
+#define VIRTIO_9P_PCI(obj) \
+        OBJECT_CHECK(V9fsPCIState, (obj), TYPE_VIRTIO_9P_PCI)
+
+typedef struct V9fsPCIState {
+    VirtIOPCIProxy parent_obj;
+    V9fsState vdev;
+} V9fsPCIState;
+
+#endif
+
 void virtio_init_pci(VirtIOPCIProxy *proxy, VirtIODevice *vdev);
 void virtio_pci_bus_new(VirtioBusState *bus, VirtIOPCIProxy *dev);
 
commit e7303c43031302279ee7b5d6ea7031bf81e2e2d9
Author: KONRAD Frederic <fred.konrad at greensocs.com>
Date:   Tue Apr 23 11:08:40 2013 +0200

    virtio-9p: add the virtio-9p device.
    
    Create virtio-9p-device which extends virtio-device, so it can be connected on
    virtio-bus.
    
    Signed-off-by: KONRAD Frederic <fred.konrad at greensocs.com>
    Message-id: 1366708123-19626-2-git-send-email-fred.konrad at greensocs.com
    Signed-off-by: Anthony Liguori <aliguori at us.ibm.com>

diff --git a/hw/9pfs/virtio-9p-device.c b/hw/9pfs/virtio-9p-device.c
index b476b81..7f00a45 100644
--- a/hw/9pfs/virtio-9p-device.c
+++ b/hw/9pfs/virtio-9p-device.c
@@ -46,19 +46,30 @@ static void virtio_9p_get_config(VirtIODevice *vdev, uint8_t *config)
     g_free(cfg);
 }
 
-VirtIODevice *virtio_9p_init(DeviceState *dev, V9fsConf *conf)
+static VirtIODevice *virtio_9p_common_init(DeviceState *dev, V9fsConf *conf,
+                                           V9fsState **ps)
 {
-    V9fsState *s;
+    V9fsState *s = *ps;
     int i, len;
     struct stat stat;
     FsDriverEntry *fse;
     V9fsPath path;
 
-    s = (V9fsState *)virtio_common_init("virtio-9p",
-                                    VIRTIO_ID_9P,
-                                    sizeof(struct virtio_9p_config)+
-                                    MAX_TAG_LEN,
-                                    sizeof(V9fsState));
+    /*
+     * We have two cases here: the old virtio-9p-pci device, and the
+     * refactored virtio-9p.
+     */
+
+    if (s == NULL) {
+        s = (V9fsState *)virtio_common_init("virtio-9p",
+                                        VIRTIO_ID_9P,
+                                        sizeof(struct virtio_9p_config)+
+                                        MAX_TAG_LEN,
+                                        sizeof(V9fsState));
+    } else {
+        virtio_init(VIRTIO_DEVICE(s), "virtio-9p", VIRTIO_ID_9P,
+                    sizeof(struct virtio_9p_config) + MAX_TAG_LEN);
+    }
     /* initialize pdu allocator */
     QLIST_INIT(&s->free_list);
     QLIST_INIT(&s->active_list);
@@ -136,3 +147,51 @@ VirtIODevice *virtio_9p_init(DeviceState *dev, V9fsConf *conf)
 
     return &s->vdev;
 }
+
+VirtIODevice *virtio_9p_init(DeviceState *dev, V9fsConf *conf)
+{
+    V9fsState *s = NULL;
+    return virtio_9p_common_init(dev, conf, &s);
+}
+
+/* virtio-9p device */
+
+static int virtio_9p_device_init(VirtIODevice *vdev)
+{
+    DeviceState *qdev = DEVICE(vdev);
+    V9fsState *s = VIRTIO_9P(vdev);
+    V9fsConf *fsconf = &(s->fsconf);
+    if (virtio_9p_common_init(qdev, fsconf, &s) == NULL) {
+        return -1;
+    }
+    return 0;
+}
+
+static Property virtio_9p_properties[] = {
+    DEFINE_VIRTIO_9P_PROPERTIES(V9fsState, fsconf),
+    DEFINE_PROP_END_OF_LIST(),
+};
+
+static void virtio_9p_class_init(ObjectClass *klass, void *data)
+{
+    DeviceClass *dc = DEVICE_CLASS(klass);
+    VirtioDeviceClass *vdc = VIRTIO_DEVICE_CLASS(klass);
+    dc->props = virtio_9p_properties;
+    vdc->init = virtio_9p_device_init;
+    vdc->get_features = virtio_9p_get_features;
+    vdc->get_config = virtio_9p_get_config;
+}
+
+static const TypeInfo virtio_device_info = {
+    .name = TYPE_VIRTIO_9P,
+    .parent = TYPE_VIRTIO_DEVICE,
+    .instance_size = sizeof(V9fsState),
+    .class_init = virtio_9p_class_init,
+};
+
+static void virtio_9p_register_types(void)
+{
+    type_register_static(&virtio_device_info);
+}
+
+type_init(virtio_9p_register_types)
diff --git a/hw/9pfs/virtio-9p.h b/hw/9pfs/virtio-9p.h
index 95a8ec3..767f7e6 100644
--- a/hw/9pfs/virtio-9p.h
+++ b/hw/9pfs/virtio-9p.h
@@ -225,6 +225,7 @@ typedef struct V9fsState
     CoRwlock rename_lock;
     int32_t root_fid;
     Error *migration_blocker;
+    V9fsConf fsconf;
 } V9fsState;
 
 typedef struct V9fsStatState {
@@ -401,4 +402,12 @@ extern int v9fs_name_to_path(V9fsState *s, V9fsPath *dirpath,
 #define pdu_unmarshal(pdu, offset, fmt, args...)  \
     v9fs_unmarshal(pdu->elem.out_sg, pdu->elem.out_num, offset, 1, fmt, ##args)
 
+#define TYPE_VIRTIO_9P "virtio-9p-device"
+#define VIRTIO_9P(obj) \
+        OBJECT_CHECK(V9fsState, (obj), TYPE_VIRTIO_9P)
+
+#define DEFINE_VIRTIO_9P_PROPERTIES(_state, _field)             \
+        DEFINE_PROP_STRING("mount_tag", _state, _field.tag),    \
+        DEFINE_PROP_STRING("fsdev", _state, _field.fsdev_id)
+
 #endif
diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
index c1e9a60..787f5fd 100644
--- a/hw/virtio/virtio-pci.c
+++ b/hw/virtio/virtio-pci.c
@@ -1040,8 +1040,7 @@ static Property virtio_9p_properties[] = {
     DEFINE_PROP_BIT("ioeventfd", VirtIOPCIProxy, flags, VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT, true),
     DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, 2),
     DEFINE_VIRTIO_COMMON_FEATURES(VirtIOPCIProxy, host_features),
-    DEFINE_PROP_STRING("mount_tag", VirtIOPCIProxy, fsconf.tag),
-    DEFINE_PROP_STRING("fsdev", VirtIOPCIProxy, fsconf.fsdev_id),
+    DEFINE_VIRTIO_9P_PROPERTIES(VirtIOPCIProxy, fsconf),
     DEFINE_PROP_END_OF_LIST(),
 };
 
commit 93b971c4ff0881349d4fa5a1394cc3d6faf351c3
Author: Ozan Çağlayan <ozancag at gmail.com>
Date:   Tue Apr 23 13:04:16 2013 +0300

    ui/gtk: Add Turkish translations
    
    Signed-off-by: Ozan Çağlayan <ozancag at gmail.com>
    Message-id: 1366711456-1935-1-git-send-email-ozancag at gmail.com
    Signed-off-by: Anthony Liguori <aliguori at us.ibm.com>

diff --git a/po/tr.po b/po/tr.po
new file mode 100644
index 0000000..4faefbd
--- /dev/null
+++ b/po/tr.po
@@ -0,0 +1,62 @@
+# Turkish translation for QEMU.
+# This file is put in the public domain.
+# Ozan Çağlayan <ozancag at gmail.com>, 2013.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: QEMU 1.4.50\n"
+"Report-Msgid-Bugs-To: qemu-devel at nongnu.org\n"
+"POT-Creation-Date: 2013-04-22 18:33+0300\n"
+"PO-Revision-Date: 2013-04-22 18:35+0300\n"
+"Last-Translator: Ozan Çağlayan <ozancag at gmail.com>\n"
+"Language-Team: Türkçe <>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=1; plural=0;\n"
+"X-Generator: Gtranslator 2.91.6\n"
+
+#: ../ui/gtk.c:214
+msgid " - Press Ctrl+Alt+G to release grab"
+msgstr " - Yakalamayı durdurmak için Ctrl+Alt+G tuşlarına basın"
+
+#: ../ui/gtk.c:218
+msgid " [Paused]"
+msgstr " [Duraklatıldı]"
+
+#: ../ui/gtk.c:1282
+msgid "_Machine"
+msgstr "_Makine"
+
+#: ../ui/gtk.c:1284
+msgid "_Pause"
+msgstr "_Duraklat"
+
+#: ../ui/gtk.c:1290
+msgid "_Reset"
+msgstr "_Sıfırla"
+
+#: ../ui/gtk.c:1293
+msgid "Power _Down"
+msgstr "_Kapat"
+
+#: ../ui/gtk.c:1308
+msgid "_View"
+msgstr "_Görüntüle"
+
+#: ../ui/gtk.c:1338
+msgid "Zoom To _Fit"
+msgstr "Yakınlaş ve Sığ_dır"
+
+#: ../ui/gtk.c:1344
+msgid "Grab On _Hover"
+msgstr "Ü_zerindeyken Yakala"
+
+#: ../ui/gtk.c:1347
+msgid "_Grab Input"
+msgstr "Girdiyi _Yakala"
+
+#: ../ui/gtk.c:1373
+msgid "Show _Tabs"
+msgstr "Se_kmeleri Göster"
commit 571253d410d6050637ccd3b6c122a3ad61e2ab25
Author: Ozan Çağlayan <ozancag at gmail.com>
Date:   Tue Apr 23 13:03:22 2013 +0300

    ui/gtk: Use gtk_widget_get_window() to support both gtk2 and gtk3
    
    This fixes build with gtk+-3.0.
    
    Signed-off-by: Ozan Çağlayan <ozancag at gmail.com>
    Message-id: 1366711402-1750-1-git-send-email-ozancag at gmail.com
    Signed-off-by: Anthony Liguori <aliguori at us.ibm.com>

diff --git a/ui/gtk.c b/ui/gtk.c
index b46997a..4110342 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -337,7 +337,7 @@ static void gd_mouse_set(DisplayChangeListener *dcl,
     GtkDisplayState *s = container_of(dcl, GtkDisplayState, dcl);
     gint x_root, y_root;
 
-    gdk_window_get_root_coords(s->drawing_area->window,
+    gdk_window_get_root_coords(gtk_widget_get_window(s->drawing_area),
                                x, y, &x_root, &y_root);
     gdk_display_warp_pointer(gtk_widget_get_display(s->drawing_area),
                              gtk_widget_get_screen(s->drawing_area),
@@ -357,7 +357,7 @@ static void gd_cursor_define(DisplayChangeListener *dcl,
                                       NULL, NULL);
     cursor = gdk_cursor_new_from_pixbuf(gtk_widget_get_display(s->drawing_area),
                                         pixbuf, c->hot_x, c->hot_y);
-    gdk_window_set_cursor(s->drawing_area->window, cursor);
+    gdk_window_set_cursor(gtk_widget_get_window(s->drawing_area), cursor);
     g_object_unref(pixbuf);
     g_object_unref(cursor);
 }
commit 2cfd5cc06ab14879964c8bbd5595d416490605ea
Merge: 4567367 3f5cc97
Author: Anthony Liguori <aliguori at us.ibm.com>
Date:   Tue Apr 23 10:33:45 2013 -0500

    Merge remote-tracking branch 'kraxel/usb.81' into staging
    
    # By Gerd Hoffmann (3) and Hans de Goede (1)
    # Via Gerd Hoffmann
    * kraxel/usb.81:
      usb-host: raise libusbx minimum version to 1.0.13
      usb: better speed mismatch error reporting
      ehci_free_packet: Discard finished packets when the queue is halted
      xhci: remove XHCIRing->base (unused)
    
    Message-id: 1366705929-11251-1-git-send-email-kraxel at redhat.com
    Signed-off-by: Anthony Liguori <aliguori at us.ibm.com>

commit 3f5cc97e2ba00b34fd20a5553ed9d2fecf32f7e3
Author: Gerd Hoffmann <kraxel at redhat.com>
Date:   Thu Apr 18 12:16:44 2013 +0200

    usb-host: raise libusbx minimum version to 1.0.13
    
    Allows to remove one FIXME.  Makes LIBUSB_LOG_LEVEL_WARNING build errors
    go away.  And starting with that version libusb has a LIBUSBX_API_VERSION
    define which allows to easily #ifdef version dependencies should that
    need arrive in the future.
    
    Signed-off-by: Gerd Hoffmann <kraxel at redhat.com>

diff --git a/configure b/configure
index 51a6c56..33d3354 100755
--- a/configure
+++ b/configure
@@ -3060,7 +3060,7 @@ fi
 
 # check for libusb
 if test "$libusb" != "no" ; then
-    if $pkg_config libusb-1.0 >/dev/null 2>&1 ; then
+    if $pkg_config --atleast-version=1.0.13 libusb-1.0 >/dev/null 2>&1 ; then
         libusb="yes"
 	usb="libusb"
         libusb_cflags=$($pkg_config --cflags libusb-1.0 2>/dev/null)
diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c
index 29f35b3..d1186b8 100644
--- a/hw/usb/host-libusb.c
+++ b/hw/usb/host-libusb.c
@@ -236,8 +236,6 @@ static int usb_host_init(void)
 
 static int usb_host_get_port(libusb_device *dev, char *port, size_t len)
 {
-#if defined(LIBUSBX_API_VERSION) && (LIBUSBX_API_VERSION >= 0x010000ff)
-    /* have libusb_get_port_path() */
     uint8_t path[7];
     size_t off;
     int rc, i;
@@ -251,9 +249,6 @@ static int usb_host_get_port(libusb_device *dev, char *port, size_t len)
         off += snprintf(port+off, len-off, ".%d", path[i]);
     }
     return off;
-#else
-    return snprintf(port, len, "FIXME");
-#endif
 }
 
 static void usb_host_libusb_error(const char *func, int rc)
commit 3b7e759a4110690c9617b1ffa6a7c96a343a330d
Author: Gerd Hoffmann <kraxel at redhat.com>
Date:   Thu Apr 18 11:57:21 2013 +0200

    usb: better speed mismatch error reporting
    
    Report the supported speeds for device and port in the error message.
    Also add the speeds to the tracepoint.  And while being at it drop
    the redundant error message in usb_desc_attach, usb_device_attach will
    report the error anyway.
    
    Signed-off-by: Gerd Hoffmann <kraxel at redhat.com>

diff --git a/hw/usb/bus.c b/hw/usb/bus.c
index b10c290..d1827be 100644
--- a/hw/usb/bus.c
+++ b/hw/usb/bus.c
@@ -417,19 +417,47 @@ void usb_release_port(USBDevice *dev)
     bus->nfree++;
 }
 
+static void usb_mask_to_str(char *dest, size_t size,
+                            unsigned int speedmask)
+{
+    static const struct {
+        unsigned int mask;
+        const char *name;
+    } speeds[] = {
+        { .mask = USB_SPEED_MASK_FULL,  .name = "full"  },
+        { .mask = USB_SPEED_MASK_HIGH,  .name = "high"  },
+        { .mask = USB_SPEED_MASK_SUPER, .name = "super" },
+    };
+    int i, pos = 0;
+
+    for (i = 0; i < ARRAY_SIZE(speeds); i++) {
+        if (speeds[i].mask & speedmask) {
+            pos += snprintf(dest + pos, size - pos, "%s%s",
+                            pos ? "+" : "",
+                            speeds[i].name);
+        }
+    }
+}
+
 int usb_device_attach(USBDevice *dev)
 {
     USBBus *bus = usb_bus_from_device(dev);
     USBPort *port = dev->port;
+    char devspeed[32], portspeed[32];
 
     assert(port != NULL);
     assert(!dev->attached);
-    trace_usb_port_attach(bus->busnr, port->path);
+    usb_mask_to_str(devspeed, sizeof(devspeed), dev->speedmask);
+    usb_mask_to_str(portspeed, sizeof(portspeed), port->speedmask);
+    trace_usb_port_attach(bus->busnr, port->path,
+                          devspeed, portspeed);
 
     if (!(port->speedmask & dev->speedmask)) {
-        error_report("Warning: speed mismatch trying to attach "
-                     "usb device %s to bus %s",
-                     dev->product_desc, bus->qbus.name);
+        error_report("Warning: speed mismatch trying to attach"
+                     " usb device \"%s\" (%s speed)"
+                     " to bus \"%s\", port \"%s\" (%s speed)",
+                     dev->product_desc, devspeed,
+                     bus->qbus.name, port->path, portspeed);
         return -1;
     }
 
diff --git a/hw/usb/desc.c b/hw/usb/desc.c
index b389381..fce303e 100644
--- a/hw/usb/desc.c
+++ b/hw/usb/desc.c
@@ -522,8 +522,6 @@ void usb_desc_attach(USBDevice *dev)
     } else if (desc->full && (dev->port->speedmask & USB_SPEED_MASK_FULL)) {
         dev->speed = USB_SPEED_FULL;
     } else {
-        fprintf(stderr, "usb: port/device speed mismatch for \"%s\"\n",
-                usb_device_get_product_desc(dev));
         return;
     }
     usb_desc_setdefaults(dev);
diff --git a/trace-events b/trace-events
index e587487..ffaa3f4 100644
--- a/trace-events
+++ b/trace-events
@@ -277,7 +277,7 @@ usb_packet_state_fault(int bus, const char *port, int ep, void *p, const char *o
 
 # hw/usb/bus.c
 usb_port_claim(int bus, const char *port) "bus %d, port %s"
-usb_port_attach(int bus, const char *port) "bus %d, port %s"
+usb_port_attach(int bus, const char *port, const char *devspeed, const char *portspeed) "bus %d, port %s, devspeed %s, portspeed %s"
 usb_port_detach(int bus, const char *port) "bus %d, port %s"
 usb_port_release(int bus, const char *port) "bus %d, port %s"
 
commit e449f26bed42b1d8c6efefcd8dc768f23f19458f
Author: Hans de Goede <hdegoede at redhat.com>
Date:   Tue Apr 9 10:24:22 2013 +0200

    ehci_free_packet: Discard finished packets when the queue is halted
    
    With pipelining it is possible to encounter a finished packet when cleaning
    the queue due to a halt. This happens when a non stall error happens while
    talking to a real device. In this case the queue on the usb-host side will
    continue processing packets, and we can have completed packets waiting in
    the queue after an error condition packet causing a halt.
    
    There are 2 reasons to discard the completed packets at this point, rather
    then trying to writing them back to the guest:
    
    1) The guest expect to be able to cancel and/or change packets after the
    packet with the error without doing an unlink, so writing them back may
    confuse the guest.
    
    2) Since the queue does not advance when halted, the writing back of these
    packets will fail anyways since p->qtdaddr != q->qtdaddr, so the
    ehci_verify_qtd call in ehci_writeback_async_complete_packet will fail.
    
    Note that 2) means that then only functional change this patch introduces
    is the printing of a warning when this scenario happens.
    
    Note that discarding these packets means that the guest driver and the device
    will get out of sync! This is unfortunate, but should not be a problem since
    with a non stall error (iow an io-error) the 2 are out of sync already anyways.
    Still this patch adds a warning to signal this happening.
    
    Note that sofar this has only been seen with a DVB-T receiver, which gives
    of a MPEG-2 stream, which allows for recovering from lost packets, see:
    https://bugzilla.redhat.com/show_bug.cgi?id=890320
    
    Signed-off-by: Hans de Goede <hdegoede at redhat.com>
    Signed-off-by: Gerd Hoffmann <kraxel at redhat.com>

diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c
index 5176251..0d3799d 100644
--- a/hw/usb/hcd-ehci.c
+++ b/hw/usb/hcd-ehci.c
@@ -586,17 +586,23 @@ static EHCIPacket *ehci_alloc_packet(EHCIQueue *q)
 
 static void ehci_free_packet(EHCIPacket *p)
 {
-    if (p->async == EHCI_ASYNC_FINISHED) {
+    if (p->async == EHCI_ASYNC_FINISHED &&
+            !(p->queue->qh.token & QTD_TOKEN_HALT)) {
         ehci_writeback_async_complete_packet(p);
         return;
     }
     trace_usb_ehci_packet_action(p->queue, p, "free");
-    if (p->async == EHCI_ASYNC_INITIALIZED) {
-        usb_packet_unmap(&p->packet, &p->sgl);
-        qemu_sglist_destroy(&p->sgl);
-    }
     if (p->async == EHCI_ASYNC_INFLIGHT) {
         usb_cancel_packet(&p->packet);
+    }
+    if (p->async == EHCI_ASYNC_FINISHED &&
+            p->packet.status == USB_RET_SUCCESS) {
+        fprintf(stderr,
+                "EHCI: Dropping completed packet from halted %s ep %02X\n",
+                (p->pid == USB_TOKEN_IN) ? "in" : "out",
+                get_field(p->queue->qh.epchar, QH_EPCHAR_EP));
+    }
+    if (p->async != EHCI_ASYNC_NONE) {
         usb_packet_unmap(&p->packet, &p->sgl);
         qemu_sglist_destroy(&p->sgl);
     }
commit 7d04c2b75562664a28612d7481f328ee4ec51dda
Author: Gerd Hoffmann <kraxel at redhat.com>
Date:   Fri Apr 5 13:03:08 2013 +0200

    xhci: remove XHCIRing->base (unused)
    
    Signed-off-by: Gerd Hoffmann <kraxel at redhat.com>

diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
index a26b78e..2c90e56 100644
--- a/hw/usb/hcd-xhci.c
+++ b/hw/usb/hcd-xhci.c
@@ -326,7 +326,6 @@ typedef enum EPType {
 } EPType;
 
 typedef struct XHCIRing {
-    dma_addr_t base;
     dma_addr_t dequeue;
     bool ccs;
 } XHCIRing;
@@ -943,7 +942,6 @@ static void xhci_event(XHCIState *xhci, XHCIEvent *event, int v)
 static void xhci_ring_init(XHCIState *xhci, XHCIRing *ring,
                            dma_addr_t base)
 {
-    ring->base = base;
     ring->dequeue = base;
     ring->ccs = 1;
 }
@@ -1948,7 +1946,7 @@ static void xhci_kick_ep(XHCIState *xhci, unsigned int slotid,
         streamid = 0;
         xhci_set_ep_state(xhci, epctx, NULL, EP_RUNNING);
     }
-    assert(ring->base != 0);
+    assert(ring->dequeue != 0);
 
     while (1) {
         XHCITransfer *xfer = &epctx->transfers[epctx->next_xfer];


More information about the Spice-commits mailing list