[Qemu-devel] [RFC 7/9] hw/virtio-net.c: Add virtio-net device.

2012-04-25 Thread Evgeny Voevodin
Signed-off-by: Evgeny Voevodin e.voevo...@samsung.com
---
 hw/virtio-net.c |   46 ++
 hw/virtio-net.h |   11 +++
 2 files changed, 57 insertions(+), 0 deletions(-)

diff --git a/hw/virtio-net.c b/hw/virtio-net.c
index bc5e3a8..febf384 100644
--- a/hw/virtio-net.c
+++ b/hw/virtio-net.c
@@ -13,6 +13,7 @@
 
 #include iov.h
 #include virtio.h
+#include virtio-transport.h
 #include net.h
 #include net/checksum.h
 #include net/tap.h
@@ -1076,3 +1077,48 @@ void virtio_net_exit(VirtIODevice *vdev)
 qemu_del_vlan_client(n-nic-nc);
 virtio_cleanup(n-vdev);
 }
+
+/ VirtIONet Device **/
+
+static int virtio_netdev_init(DeviceState *dev)
+{
+VirtIODevice *vdev;
+VirtIONetState *proxy = VIRTIO_NET_FROM_QDEV(dev);
+vdev = virtio_net_init(dev, proxy-nic, proxy-net);
+if (!vdev) {
+return -1;
+}
+return virtio_init_transport(dev, vdev);
+}
+
+static Property virtio_net_properties[] = {
+DEFINE_NIC_PROPERTIES(VirtIONetState, nic),
+DEFINE_PROP_UINT32(x-txtimer, VirtIONetState,
+   net.txtimer, TX_TIMER_INTERVAL),
+DEFINE_PROP_INT32(x-txburst, VirtIONetState,
+  net.txburst, TX_BURST),
+DEFINE_PROP_STRING(tx, VirtIONetState, net.tx),
+DEFINE_PROP_END_OF_LIST(),
+};
+
+static void virtio_net_class_init(ObjectClass *klass, void *data)
+{
+DeviceClass *dc = DEVICE_CLASS(klass);
+dc-init = virtio_netdev_init;
+dc-props = virtio_net_properties;
+dc-bus_info = virtio_transport_bus_info;
+}
+
+static TypeInfo virtio_net_info = {
+.name = virtio-net,
+.parent = TYPE_DEVICE,
+.instance_size = sizeof(VirtIONetState),
+.class_init = virtio_net_class_init,
+};
+
+static void virtio_net_register_types(void)
+{
+type_register_static(virtio_net_info);
+}
+
+type_init(virtio_net_register_types)
diff --git a/hw/virtio-net.h b/hw/virtio-net.h
index 36aa463..74a55c8 100644
--- a/hw/virtio-net.h
+++ b/hw/virtio-net.h
@@ -14,6 +14,7 @@
 #ifndef _QEMU_VIRTIO_NET_H
 #define _QEMU_VIRTIO_NET_H
 
+#include sysbus.h
 #include virtio.h
 #include net.h
 #include pci.h
@@ -187,4 +188,14 @@ struct virtio_net_ctrl_mac {
 DEFINE_PROP_BIT(ctrl_rx, _state, _field, VIRTIO_NET_F_CTRL_RX, 
true), \
 DEFINE_PROP_BIT(ctrl_vlan, _state, _field, VIRTIO_NET_F_CTRL_VLAN, 
true), \
 DEFINE_PROP_BIT(ctrl_rx_extra, _state, _field, 
VIRTIO_NET_F_CTRL_RX_EXTRA, true)
+
+typedef struct {
+DeviceState qdev;
+/* virtio-net */
+NICConf nic;
+virtio_net_conf net;
+} VirtIONetState;
+
+#define VIRTIO_NET_FROM_QDEV(dev) DO_UPCAST(VirtIONetState, qdev, dev)
+
 #endif
-- 
1.7.5.4




[Qemu-devel] [RFC 6/9] hw/virtio-balloon.c: Add virtio-balloon device.

2012-04-25 Thread Evgeny Voevodin
Signed-off-by: Evgeny Voevodin e.voevo...@samsung.com
---
 hw/virtio-balloon.c |   34 ++
 hw/virtio-balloon.h |7 +++
 2 files changed, 41 insertions(+), 0 deletions(-)

diff --git a/hw/virtio-balloon.c b/hw/virtio-balloon.c
index ce9d2c9..5640e58 100644
--- a/hw/virtio-balloon.c
+++ b/hw/virtio-balloon.c
@@ -20,6 +20,7 @@
 #include cpu.h
 #include balloon.h
 #include virtio-balloon.h
+#include virtio-transport.h
 #include kvm.h
 #include exec-memory.h
 
@@ -263,3 +264,36 @@ void virtio_balloon_exit(VirtIODevice *vdev)
 unregister_savevm(s-qdev, virtio-balloon, s);
 virtio_cleanup(vdev);
 }
+
+/ VirtIOBaloon Device **/
+
+static int virtio_balloondev_init(DeviceState *dev)
+{
+VirtIODevice *vdev;
+vdev = virtio_balloon_init(dev);
+if (!vdev) {
+return -1;
+}
+return virtio_init_transport(dev, vdev);
+}
+
+static void virtio_balloon_class_init(ObjectClass *klass, void *data)
+{
+DeviceClass *dc = DEVICE_CLASS(klass);
+dc-init = virtio_balloondev_init;
+dc-bus_info = virtio_transport_bus_info;
+}
+
+static TypeInfo virtio_balloon_info = {
+.name = virtio-balloon,
+.parent = TYPE_DEVICE,
+.instance_size = sizeof(VirtIOBaloonState),
+.class_init = virtio_balloon_class_init,
+};
+
+static void virtio_baloon_register_types(void)
+{
+type_register_static(virtio_balloon_info);
+}
+
+type_init(virtio_baloon_register_types)
diff --git a/hw/virtio-balloon.h b/hw/virtio-balloon.h
index 73300dd..e134226 100644
--- a/hw/virtio-balloon.h
+++ b/hw/virtio-balloon.h
@@ -15,6 +15,7 @@
 #ifndef _QEMU_VIRTIO_BALLOON_H
 #define _QEMU_VIRTIO_BALLOON_H
 
+#include sysbus.h
 #include virtio.h
 #include pci.h
 
@@ -52,4 +53,10 @@ typedef struct VirtIOBalloonStat {
 uint64_t val;
 } QEMU_PACKED VirtIOBalloonStat;
 
+typedef struct {
+DeviceState qdev;
+} VirtIOBaloonState;
+
+#define VIRTIO_BALLOON_FROM_QDEV(dev) DO_UPCAST(VirtIOBaloonState, qdev, dev)
+
 #endif
-- 
1.7.5.4




Re: [Qemu-devel] [PATCH 11/12] Migrate 64bit entries to 64bit pci regions

2012-04-25 Thread Alexey Korolev
On 25/04/12 13:48, Kevin O'Connor wrote:
 On Tue, Apr 24, 2012 at 06:25:39PM +1200, Alexey Korolev wrote:
 Migrate 64bit entries to 64bit pci regions if they do
 not fit in 32bit range.
 [...]
 +static void pci_region_migrate_64bit_entries(struct pci_region *from,
 + struct pci_region *to)
 +{
 +struct pci_region_entry **pprev = from-list;
 +struct pci_region_entry **last = to-list;
 +while(*pprev) {
 +if ((*pprev)-is64) {
 +struct pci_region_entry *entry;
 +entry = *pprev;
 +/* Delete the entry and move next */
 +*pprev = (*pprev)-next;
 +/* Add entry at tail to keep a sorted order */
 +entry-next = NULL;
 +if (*last) {
 +   (*last)-next = entry;
 +last  = (*last)-next;
 +}
 +else
 +   (*last) = entry;
 +}
 +else
 +pprev = (*pprev)-next;
 +}
 +}
 It should be possible to simplify this - something like (untested):

 static void pci_region_migrate_64bit_entries(struct pci_region *from,
  struct pci_region *to)
 {
 struct pci_region_entry **pprev = from-list, **last = to-list;
 for (; *pprev; pprev = (*pprev)-next) {
 struct pci_region_entry *entry = *pprev;
 if (!entry-is64)
 continue;
 // Move from source list to dest list.
 *pprev = entry-next;
 entry-next = NULL;
 *last = entry;
 last = entry-next;
 }
 }
Sorry it's not working.
I agree it's possible to simplify code a bit.


static void pci_region_migrate_64bit_entries(struct pci_region *from,
 struct pci_region *to)
{
struct pci_region_entry **pprev = from-list;
struct pci_region_entry **last = to-list;
while(*pprev) {
if ((*pprev)-is64) {
struct pci_region_entry *entry;
entry = *pprev;
/* Delete the entry and move next */
*pprev = (*pprev)-next;
/* Add entry at tail to keep the order */
entry-next = NULL;
*last = entry;
last = entry-next;
}
else
pprev = (*pprev)-next;
}
}

That should work.
 [...]
  static void pci_bios_map_devices(struct pci_bus *busses)
  {
 +if (pci_bios_init_root_regions(busses)) {
 +struct pci_region r64_mem, r64_pref;
 +r64_mem.list = NULL;
 +r64_pref.list = NULL;
 +pci_region_migrate_64bit_entries(busses[0].r[PCI_REGION_TYPE_MEM],
 + r64_mem);
 +
 pci_region_migrate_64bit_entries(busses[0].r[PCI_REGION_TYPE_PREFMEM],
 + r64_pref);
 +
 +if (pci_bios_init_root_regions(busses))
 +panic(PCI: out of address space\n);
 +
 +r64_mem.base = BUILD_PCIMEM64_START;
 +r64_pref.base = ALIGN(r64_mem.base + pci_region_sum(r64_mem),
 +  pci_region_align(r64_pref));
 There should be a check to see if the regions fit.  Maybe pass
 start/end into pci_bios_init_root_regions() and call it again for the
 4g region?
Agree, I just ignored the check as 64bit range size is 2^39.
I will think how to make it better.
 +pci_region_map_entries(busses, r64_mem);
 +pci_region_map_entries(busses, r64_pref);
 +}
  // Map regions on each device.
 This doesn't look right to me.  This will map the devices on bus 0 to
 the proper 4g address, but devices on any subsequent bus will use
 busses[0].r[].base which will be reset to the 4gig address.  Perhaps
 pull base out of pci_region and make pci_region_map_entries()
 recursive?
No recursion is need here!
We map all entries which are 64bit on root bus.
If entry is a bridge region - a corresponding bus address will be updated.
Region won't be reseted to 4gig address as address is derived from parent 
region only.

Thanks,
Alexey




[Qemu-devel] [RFC 2/9] virtio: Support transports which can specify the vring alignment

2012-04-25 Thread Evgeny Voevodin
From: Peter Maydell peter.mayd...@linaro.org

Support virtio transports which can specify the vring alignment
(ie where the guest communicates this to the host) by providing
a new virtio_queue_set_align() function. (The default alignment
remains as before.)

FIXME save/load support for this new field!

Signed-off-by: Peter Maydell peter.mayd...@linaro.org
Signed-off-by: Evgeny Voevodin e.voevo...@samsung.com
---
 hw/virtio.c |   14 --
 hw/virtio.h |1 +
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/hw/virtio.c b/hw/virtio.c
index 71c4a10..3e2e264 100644
--- a/hw/virtio.c
+++ b/hw/virtio.c
@@ -19,7 +19,9 @@
 #include qemu-barrier.h
 
 /* The alignment to use between consumer and producer parts of vring.
- * x86 pagesize again. */
+ * x86 pagesize again. This is the default, used by transports like PCI
+ * which don't provide a means for the guest to tell the host the alignment.
+ */
 #define VIRTIO_PCI_VRING_ALIGN 4096
 
 typedef struct VRingDesc
@@ -53,6 +55,7 @@ typedef struct VRingUsed
 typedef struct VRing
 {
 unsigned int num;
+unsigned int align;
 target_phys_addr_t desc;
 target_phys_addr_t avail;
 target_phys_addr_t used;
@@ -90,7 +93,7 @@ static void virtqueue_init(VirtQueue *vq)
 vq-vring.avail = pa + vq-vring.num * sizeof(VRingDesc);
 vq-vring.used = vring_align(vq-vring.avail +
  offsetof(VRingAvail, ring[vq-vring.num]),
- VIRTIO_PCI_VRING_ALIGN);
+ vq-vring.align);
 }
 
 static inline uint64_t vring_desc_addr(target_phys_addr_t desc_pa, int i)
@@ -637,6 +640,12 @@ int virtio_queue_get_id(VirtQueue *vq)
 return vq - vdev-vq[0];
 }
 
+void virtio_queue_set_align(VirtIODevice *vdev, int n, int align)
+{
+vdev-vq[n].vring.align = align;
+virtqueue_init(vdev-vq[n]);
+}
+
 void virtio_queue_notify_vq(VirtQueue *vq)
 {
 if (vq-vring.desc) {
@@ -677,6 +686,7 @@ VirtQueue *virtio_add_queue(VirtIODevice *vdev, int 
queue_size,
 abort();
 
 vdev-vq[i].vring.num = queue_size;
+vdev-vq[i].vring.align = VIRTIO_PCI_VRING_ALIGN;
 vdev-vq[i].handle_output = handle_output;
 
 return vdev-vq[i];
diff --git a/hw/virtio.h b/hw/virtio.h
index 72b56e3..c1f8666 100644
--- a/hw/virtio.h
+++ b/hw/virtio.h
@@ -180,6 +180,7 @@ void virtio_queue_set_addr(VirtIODevice *vdev, int n, 
target_phys_addr_t addr);
 target_phys_addr_t virtio_queue_get_addr(VirtIODevice *vdev, int n);
 void virtio_queue_set_num(VirtIODevice *vdev, int n, int num);
 int virtio_queue_get_num(VirtIODevice *vdev, int n);
+void virtio_queue_set_align(VirtIODevice *vdev, int n, int align);
 void virtio_queue_notify(VirtIODevice *vdev, int n);
 uint16_t virtio_queue_vector(VirtIODevice *vdev, int n);
 void virtio_queue_set_vector(VirtIODevice *vdev, int n, uint16_t vector);
-- 
1.7.5.4




[Qemu-devel] [RFC 0/9] Virtio-mmio refactoring.

2012-04-25 Thread Evgeny Voevodin
This patchset is derived from patchset provided by Peter Maydell 
peter.mayd...@linaro.org:
http://lists.gnu.org/archive/html/qemu-devel/2011-11/msg01870.html
Also this patchset includes some fixes for bugs spotted by Ying-Shiuan Pan 
ys...@itri.org.tw.
Still isue pointed by Peter presents here I think:
 * extra vring alignment field not saved/restored (because virtio
   layer isn't using VMState and doesn't allow the virtio base layer
   to specify a version for its data so back-compat would be tricky)
I've tested blk and net parts. Work good to me.

In this patchset refactoring of virtio-mmio layer is made.
Instead of creating virtio-blk-mmio, virtio-net-mmio, etc on the system bus
we create virtio-blk, virtio-net, etc devices on the virtio-transport bus.
To create virtio-transport bus virtio-mmio-transport device provided. 
Transport device plugs into virtio-mmio bus.
To create virtio-mmio bus virtio-mmio-bridge device provided. 
Bridge device is borrowed from s390 platform and plugs into system bus.
So, we have:

system bus |MMIO Bridge|virtio-mmio bus |MMIO 
Transport|virtio-transport-bus(name:virtio-mmio.0) |Virtio Backend 
(blk, net, etc)|
 |
 |--- |MMIO 
Transport|virtio-transport-bus(name:virtio-mmio.1) |Virtio Backend 
(blk, net, etc)|

The interface to platforms consists of:
 - create a virtio bus (at this time virtio-mmio only)
 - create a transport device (at this time virtio-mmio only)

Then from command line user can plug back-end (virtio-blk, net, etc) into 
desired bus (at this time virtio-mmio.x only).

The next step of refactoring will touch virtio-pci layer.
There PCI Transport device will be created which provides the same transport 
bus as MMIO transport device.
I guess that it will look like:

pci bus |PCI Bridge|virtio-pci bus |PCI 
Transport|virtio-transport-bus(name:virtio-pci.0) |Virtio Backend 
(blk, net, etc)|
|
|--- |PCI 
Transport|virtio-transport-bus(name:virtio-pci.1) |Virtio Backend 
(blk, net, etc)|

Also, there should be some back compatibility to keep pci backends able to be 
plugged into virtio bus as it done now 
(if I'm not wrong) and to not break present command lines.

Evgeny Voevodin (6):
  Virtio: Add transport bindings.
  hw/virtio-serial-bus.c: Add virtio-serial device.
  hw/virtio-balloon.c: Add virtio-balloon device.
  hw/virtio-net.c: Add virtio-net device.
  hw/virtio-blk.c: Add virtio-blk device.
  hw/exynos4210.c: Create two virtio-mmio transport instances.

Peter Maydell (3):
  virtio: Add support for guest setting of queue size
  virtio: Support transports which can specify the vring alignment
  Add MMIO based virtio transport

 Makefile.objs  |2 +
 hw/exynos4210.c|   12 ++
 hw/virtio-balloon.c|   34 
 hw/virtio-balloon.h|7 +
 hw/virtio-blk.c|   42 +
 hw/virtio-blk.h|   11 +
 hw/virtio-mmio.c   |  480 
 hw/virtio-mmio.h   |   31 +++
 hw/virtio-net.c|   46 +
 hw/virtio-net.h|   11 +
 hw/virtio-serial-bus.c |   42 +
 hw/virtio-serial.h |9 +
 hw/virtio-transport.c  |   46 +
 hw/virtio-transport.h  |   39 
 hw/virtio.c|   20 ++-
 hw/virtio.h|2 +
 16 files changed, 832 insertions(+), 2 deletions(-)
 create mode 100644 hw/virtio-mmio.c
 create mode 100644 hw/virtio-mmio.h
 create mode 100644 hw/virtio-transport.c
 create mode 100644 hw/virtio-transport.h

-- 
1.7.5.4




[Qemu-devel] [RFC 5/9] hw/virtio-serial-bus.c: Add virtio-serial device.

2012-04-25 Thread Evgeny Voevodin
Signed-off-by: Evgeny Voevodin e.voevo...@samsung.com
---
 hw/virtio-serial-bus.c |   42 ++
 hw/virtio-serial.h |9 +
 2 files changed, 51 insertions(+), 0 deletions(-)

diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c
index e22940e..52a5382 100644
--- a/hw/virtio-serial-bus.c
+++ b/hw/virtio-serial-bus.c
@@ -24,6 +24,7 @@
 #include sysbus.h
 #include trace.h
 #include virtio-serial.h
+#include virtio-transport.h
 
 /* The virtio-serial bus on top of which the ports will ride as devices */
 struct VirtIOSerialBus {
@@ -955,3 +956,44 @@ static void virtio_serial_register_types(void)
 }
 
 type_init(virtio_serial_register_types)
+
+/ VirtIOSer Device **/
+
+static int virtio_serialdev_init(DeviceState *dev)
+{
+VirtIODevice *vdev;
+VirtIOSerState *proxy = VIRTIO_SERIAL_FROM_QDEV(dev);
+vdev = virtio_serial_init(dev, proxy-serial);
+if (!vdev) {
+return -1;
+}
+return virtio_init_transport(dev, vdev);
+}
+
+static Property virtio_serial_properties[] = {
+DEFINE_PROP_UINT32(max_ports, VirtIOSerState,
+   serial.max_virtserial_ports, 31),
+DEFINE_PROP_END_OF_LIST(),
+};
+
+static void virtio_serial_class_init(ObjectClass *klass, void *data)
+{
+DeviceClass *dc = DEVICE_CLASS(klass);
+dc-init = virtio_serialdev_init;
+dc-props = virtio_serial_properties;
+dc-bus_info = virtio_transport_bus_info;
+}
+
+static TypeInfo virtio_serial_info = {
+.name = virtio-serial,
+.parent = TYPE_DEVICE,
+.instance_size = sizeof(VirtIOSerState),
+.class_init = virtio_serial_class_init,
+};
+
+static void virtio_ser_register_types(void)
+{
+type_register_static(virtio_serial_info);
+}
+
+type_init(virtio_ser_register_types)
diff --git a/hw/virtio-serial.h b/hw/virtio-serial.h
index 16e3982..2290aac 100644
--- a/hw/virtio-serial.h
+++ b/hw/virtio-serial.h
@@ -15,6 +15,7 @@
 #ifndef _QEMU_VIRTIO_SERIAL_H
 #define _QEMU_VIRTIO_SERIAL_H
 
+#include sysbus.h
 #include qdev.h
 #include virtio.h
 
@@ -173,6 +174,14 @@ struct VirtIOSerialPort {
 bool throttled;
 };
 
+typedef struct {
+DeviceState qdev;
+/* virtio-serial */
+virtio_serial_conf serial;
+} VirtIOSerState;
+
+#define VIRTIO_SERIAL_FROM_QDEV(dev) DO_UPCAST(VirtIOSerState, qdev, dev)
+
 /* Interface to the virtio-serial bus */
 
 /*
-- 
1.7.5.4




[Qemu-devel] [RFC 3/9] Virtio: Add transport bindings.

2012-04-25 Thread Evgeny Voevodin
Signed-off-by: Evgeny Voevodin e.voevo...@samsung.com
---
 Makefile.objs |1 +
 hw/virtio-transport.c |   46 ++
 hw/virtio-transport.h |   39 +++
 3 files changed, 86 insertions(+), 0 deletions(-)
 create mode 100644 hw/virtio-transport.c
 create mode 100644 hw/virtio-transport.h

diff --git a/Makefile.objs b/Makefile.objs
index 6d6f24d..5a648bc 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -212,6 +212,7 @@ hw-obj-y += vl.o loader.o
 hw-obj-$(CONFIG_VIRTIO) += virtio-console.o
 hw-obj-y += usb/libhw.o
 hw-obj-$(CONFIG_VIRTIO_PCI) += virtio-pci.o
+hw-obj-$(CONFIG_VIRTIO) += virtio-transport.o
 hw-obj-y += fw_cfg.o
 hw-obj-$(CONFIG_PCI) += pci.o pci_bridge.o pci_bridge_dev.o
 hw-obj-$(CONFIG_PCI) += msix.o msi.o
diff --git a/hw/virtio-transport.c b/hw/virtio-transport.c
new file mode 100644
index 000..4225a30
--- /dev/null
+++ b/hw/virtio-transport.c
@@ -0,0 +1,46 @@
+/*
+ * Virtio transport bindings
+ *
+ * Copyright (c) 2011 - 2012 Samsung Electronics Co., Ltd.
+ *
+ * Author:
+ *  Evgeny Voevodin e.voevo...@samsung.com
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, see http://www.gnu.org/licenses/.
+ */
+
+#include virtio-transport.h
+
+#define VIRTIO_TRANSPORT_BUS virtio-transport
+
+struct BusInfo virtio_transport_bus_info = {
+.name = VIRTIO_TRANSPORT_BUS,
+.size = sizeof(VirtIOTransportBusState),
+};
+
+int virtio_init_transport(DeviceState *dev, VirtIODevice *vdev)
+{
+DeviceState *transport_dev = qdev_get_parent_bus(dev)-parent;
+BusState *bus;
+VirtIOTransportBusState *virtio_transport_bus;
+
+/* transport device has single child bus */
+bus = QLIST_FIRST(transport_dev-child_bus);
+virtio_transport_bus = DO_UPCAST(VirtIOTransportBusState, bus, bus);
+
+if (virtio_transport_bus-init_fn) {
+return virtio_transport_bus-init_fn(dev, vdev);
+}
+
+return 0;
+}
diff --git a/hw/virtio-transport.h b/hw/virtio-transport.h
new file mode 100644
index 000..ff39bf7
--- /dev/null
+++ b/hw/virtio-transport.h
@@ -0,0 +1,39 @@
+/*
+ * Virtio transport header
+ *
+ * Copyright (c) 2011 - 2012 Samsung Electronics Co., Ltd.
+ *
+ * Author:
+ *  Evgeny Voevodin e.voevo...@samsung.com
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, see http://www.gnu.org/licenses/.
+ */
+
+#ifndef VIRTIO_TRANSPORT_H_
+#define VIRTIO_TRANSPORT_H_
+
+#include sysbus.h
+#include virtio.h
+
+extern struct BusInfo virtio_transport_bus_info;
+
+typedef int (*virtio_init_transport_fn)(DeviceState *dev, VirtIODevice *vdev);
+
+typedef struct VirtIOTransportBusState {
+BusState bus;
+virtio_init_transport_fn init_fn;
+} VirtIOTransportBusState;
+
+int virtio_init_transport(DeviceState *dev, VirtIODevice *vdev);
+
+#endif /* VIRTIO_TRANSPORT_H_ */
-- 
1.7.5.4




Re: [Qemu-devel] [PATCH v10 2/4] sockets: change inet_connect() to support nonblock socket

2012-04-25 Thread Orit Wasserman
On 04/25/2012 08:21 AM, Amos Kong wrote:
 Add a bool argument to inet_connect() to assign if set socket
 to block/nonblock, and delete original argument 'socktype'
 that is unused.
 Add a new argument to inet_connect()/inet_connect_opts(),
 to pass back connect error by error class.
 
 Retry to connect when -EINTR is got. Connect's successful
 for nonblock socket when following errors are got, user
 should wait for connecting by select():
   -EINPROGRESS
   -EWOULDBLOCK (win32)
   -WSAEALREADY (win32)
 
 Change nbd, vnc to use new interface.
 
 ---
 Changes from v7:
 - posix: let EWOULDBLOCK fall through to CONNECT_FAILED path
 - fix typo
 
 Changes from v8:
 - reuse rc variable
 - fix a NULL pointer dereference
 
 Changes from v9:
 - handle non-blocking correctly if errp is NULL
 
 Signed-off-by: Amos Kong ak...@redhat.com
 ---
  nbd.c  |2 +-
  qemu-char.c|2 +-
  qemu-sockets.c |   43 +--
  qemu_socket.h  |6 --
  ui/vnc.c   |2 +-
  5 files changed, 44 insertions(+), 11 deletions(-)
 
 diff --git a/nbd.c b/nbd.c
 index 406e555..bb71f00 100644
 --- a/nbd.c
 +++ b/nbd.c
 @@ -146,7 +146,7 @@ int tcp_socket_outgoing(const char *address, uint16_t 
 port)
  
  int tcp_socket_outgoing_spec(const char *address_and_port)
  {
 -return inet_connect(address_and_port, SOCK_STREAM);
 +return inet_connect(address_and_port, true, NULL);
  }
  
  int tcp_socket_incoming(const char *address, uint16_t port)
 diff --git a/qemu-char.c b/qemu-char.c
 index 74c60e1..aeee2e8 100644
 --- a/qemu-char.c
 +++ b/qemu-char.c
 @@ -2444,7 +2444,7 @@ static CharDriverState *qemu_chr_open_socket(QemuOpts 
 *opts)
  if (is_listen) {
  fd = inet_listen_opts(opts, 0);
  } else {
 -fd = inet_connect_opts(opts);
 +fd = inet_connect_opts(opts, NULL);
  }
  }
  if (fd  0) {
 diff --git a/qemu-sockets.c b/qemu-sockets.c
 index 6bcb8e3..ce3f06c 100644
 --- a/qemu-sockets.c
 +++ b/qemu-sockets.c
 @@ -51,6 +51,9 @@ static QemuOptsList dummy_opts = {
  },{
  .name = ipv6,
  .type = QEMU_OPT_BOOL,
 +},{
 +.name = block,
 +.type = QEMU_OPT_BOOL,
  },
  { /* end if list */ }
  },
 @@ -194,7 +197,7 @@ listen:
  return slisten;
  }
  
 -int inet_connect_opts(QemuOpts *opts)
 +int inet_connect_opts(QemuOpts *opts, Error **errp)
  {
  struct addrinfo ai,*res,*e;
  const char *addr;
 @@ -202,6 +205,7 @@ int inet_connect_opts(QemuOpts *opts)
  char uaddr[INET6_ADDRSTRLEN+1];
  char uport[33];
  int sock,rc;
 +bool block;
  
  memset(ai,0, sizeof(ai));
  ai.ai_flags = AI_CANONNAME | AI_ADDRCONFIG;
 @@ -210,8 +214,10 @@ int inet_connect_opts(QemuOpts *opts)
  
  addr = qemu_opt_get(opts, host);
  port = qemu_opt_get(opts, port);
 +block = qemu_opt_get_bool(opts, block, 0);
  if (addr == NULL || port == NULL) {
  fprintf(stderr, inet_connect: host and/or port not specified\n);
 +error_set(errp, QERR_SOCKET_CREATE_FAILED);
  return -1;
  }
  
 @@ -224,6 +230,7 @@ int inet_connect_opts(QemuOpts *opts)
  if (0 != (rc = getaddrinfo(addr, port, ai, res))) {
  fprintf(stderr,getaddrinfo(%s,%s): %s\n, addr, port,
  gai_strerror(rc));
 +error_set(errp, QERR_SOCKET_CREATE_FAILED);
   return -1;
  }
  
 @@ -241,19 +248,37 @@ int inet_connect_opts(QemuOpts *opts)
  continue;
  }
  setsockopt(sock,SOL_SOCKET,SO_REUSEADDR,(void*)on,sizeof(on));
 -
 +if (!block) {
 +socket_set_nonblock(sock);
 +}
  /* connect to peer */
 -if (connect(sock,e-ai_addr,e-ai_addrlen)  0) {
 +do {
 +rc = 0;
 +if (connect(sock, e-ai_addr, e-ai_addrlen)  0) {
 +rc = -socket_error();
 +}
 +} while (rc == -EINTR);
 +
 +  #ifdef _WIN32
 +if (!block  (rc == -EINPROGRESS || rc == -EWOULDBLOCK
 +   || rc == -WSAEALREADY)) {
 +  #else
 +if (!block  (rc == -EINPROGRESS)) {
 +  #endif
 +error_set(errp, QERR_SOCKET_CONNECT_IN_PROGRESS);
 +} else if (rc  0) {
  if (NULL == e-ai_next)
  fprintf(stderr, %s: connect(%s,%s,%s,%s): %s\n, 
 __FUNCTION__,
  inet_strfamily(e-ai_family),
  e-ai_canonname, uaddr, uport, strerror(errno));
  closesocket(sock);
 +sock = -1;
  continue;
  }
  freeaddrinfo(res);
  return sock;
  }
 +error_set(errp, QERR_SOCKET_CONNECT_FAILED);
  freeaddrinfo(res);
  return -1;
  }
 @@ -449,14 +474,20 @@ int inet_listen(const char *str, char *ostr, int olen,
  return sock;
  }
  
 -int inet_connect(const char *str, int socktype)
 +int inet_connect(const char *str, bool block, Error **errp)
  {
  

Re: [Qemu-devel] [PULL] QOM CPUState for cris and microblaze

2012-04-25 Thread Edgar E. Iglesias
On Mon, Apr 23, 2012 at 04:43:37PM +0200, Andreas Färber wrote:
 Hello Edgar,
 
 Ask and thou shall receive: Please pull the cris and microblaze QOM CPU 
 conversions.

Thanks, I've applied the series

Cheers


 
 Changes from v2:
 * Rebased onto master (all preceding targets got merged in the meantime).
 * target-cris/{cpu.c,cpu-qom.h}: Include cpu.h from cpu.c, not from cpu-qom.h.
 * target-microblaze/{cpu.c,cpu-qom.h}: Dito.
 * target-microblaze/{cpu.c,translate.c}: Do not move cpu_reset() into initfn.
   It should instead go into a realizefn once available.
 
 Cc: Edgar E. Iglesias edgar.igles...@gmail.com
 
 The following changes since commit 3c30dd5a68e9fee6af67cfd0d14ed7520820f36a:
 
   target-arm: Move reset handling to arm_cpu_reset (2012-04-21 18:13:22 +)
 
 are available in the git repository at:
   git://github.com/afaerber/qemu-cpu.git qom-cpu-cris+mb.v3
 
 Andreas Färber (6):
   target-cris: QOM'ify CPU
   target-cris: QOM'ify CPU reset
   target-cris: Start QOM'ifying CPU init
   target-microblaze: QOM'ify CPU
   target-microblaze: QOM'ify CPU reset
   target-microblaze: QOM'ify CPU init
 
  Makefile.target   |2 +
  target-cris/cpu-qom.h |   70 
  target-cris/cpu.c |   90 +++
  target-cris/cpu.h |2 +
  target-cris/translate.c   |   28 ++
  target-microblaze/cpu-qom.h   |   70 
  target-microblaze/cpu.c   |  119 
 +
  target-microblaze/cpu.h   |2 +
  target-microblaze/translate.c |   57 ++--
  9 files changed, 366 insertions(+), 74 deletions(-)
  create mode 100644 target-cris/cpu-qom.h
  create mode 100644 target-cris/cpu.c
  create mode 100644 target-microblaze/cpu-qom.h
  create mode 100644 target-microblaze/cpu.c



[Qemu-devel] [Bug 988125] Re: Generated smb.conf needs to declare state directory

2012-04-25 Thread Jan Kiszka
That may fix old complaints about the smb feature not working. Since
which smb version is this switch available? Maybe we need to make a
version check before injecting it.

In any case, please post such a change as proper patch (subject,
description, signed-off) to qemu-devel. Thanks!

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/988125

Title:
  Generated smb.conf needs to declare state directory

Status in QEMU:
  New

Bug description:
  The smb.conf generated by the userspace networking does not include a state 
directory
  directive. Samba therefore falls back to the default value. Since the user 
generally
  does not have write access to this path, smbd immediately crashes.

  I have attached a patch that adds the missing option.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/988125/+subscriptions



[Qemu-devel] [Bug 988128] Re: smbd crashes when called with smb ports = 0

2012-04-25 Thread Jan Kiszka
It communicates via standard input (just like inetd). Obviously newer
versions do not need this anymore, and smbd will detect in which mode it
is supposed to run.

That switch was once introduce in 15ef3e to add Samba 3 support.
Maybe you can check with the samba guys if that switch was actually ever
required or since when it became redundant.

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/988128

Title:
  smbd crashes when called with smb ports = 0

Status in QEMU:
  New

Bug description:
  The smb.conf generated by qemu-kvm contains a smb ports = 0 directive. This
  causes at least version 3.6.4 of Samba to crash with

  [0] vostro:/tmp/qemu-smb.6836-0# smbd -i -s smb.conf
  Unable to setup corepath for smbd: Operation not permitted
  smbd version 3.6.4 started.
  Copyright Andrew Tridgell and the Samba Team 1992-2011
  open_sockets_smbd: No sockets available to bind to.
  ===
  Abnormal server exit: open_sockets_smbd() failed
  ===
  BACKTRACE: 6 stack frames:
   #0 smbd(log_stack_trace+0x1a) [0x7fe50c14f8ba]
   #1 smbd(+0x6a0743) [0x7fe50c3bd743]
   #2 smbd(+0x6a0a41) [0x7fe50c3bda41]
   #3 smbd(main+0xa52) [0x7fe50be26d42]
   #4 /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xfd) [0x7fe508ac0ead]
   #5 smbd(+0x10a6b9) [0x7fe50be276b9]

  Changing smb ports to a non-privilileged port works around the
  issue.

  I'd like to help fix this, but I am not sure what qemu-kvm's intention is 
here.
  Zero is not a valid port, and the smb.conf manpage does not describe any
  special meaning of zero here. I found that previous versions of samba 
apparently
  did not bind to any port if zero was specified - but in that case, how is
  qemu communicating with samba?

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/988128/+subscriptions



Re: [Qemu-devel] [PATCH 1/7] e1000: introduce bits of PHY control register

2012-04-25 Thread Michael S. Tsirkin
On Thu, Mar 22, 2012 at 06:01:42PM +0800, Jason Wang wrote:
 This would be used be following patches.
 
 Signed-off-by: Jason Wang jasow...@redhat.com

Applied, thanks.

 ---
  hw/e1000_hw.h |   12 
  1 files changed, 12 insertions(+), 0 deletions(-)
 
 diff --git a/hw/e1000_hw.h b/hw/e1000_hw.h
 index 9e29af8..c9cb79e 100644
 --- a/hw/e1000_hw.h
 +++ b/hw/e1000_hw.h
 @@ -349,6 +349,18 @@
  #define M88E1000_PHY_VCO_REG_BIT8  0x100 /* Bits 8  11 are adjusted for */
  #define M88E1000_PHY_VCO_REG_BIT11 0x800/* improved BER performance */
  
 +/* PHY Control Register */
 +#define MII_CR_SPEED_SELECT_MSB 0x0040 /* bits 6,13: 10=1000, 01=100, 00=10 
 */
 +#define MII_CR_COLL_TEST_ENABLE 0x0080 /* Collision test enable */
 +#define MII_CR_FULL_DUPLEX  0x0100 /* FDX =1, half duplex =0 */
 +#define MII_CR_RESTART_AUTO_NEG 0x0200 /* Restart auto negotiation */
 +#define MII_CR_ISOLATE  0x0400 /* Isolate PHY from MII */
 +#define MII_CR_POWER_DOWN   0x0800 /* Power down */
 +#define MII_CR_AUTO_NEG_EN  0x1000 /* Auto Neg Enable */
 +#define MII_CR_SPEED_SELECT_LSB 0x2000 /* bits 6,13: 10=1000, 01=100, 00=10 
 */
 +#define MII_CR_LOOPBACK 0x4000 /* 0 = normal, 1 = loopback */
 +#define MII_CR_RESET0x8000 /* 0 = normal, 1 = PHY reset */
 +
  /* PHY Status Register */
  #define MII_SR_EXTENDED_CAPS 0x0001  /* Extended register 
 capabilities */
  #define MII_SR_JABBER_DETECT 0x0002  /* Jabber Detected */



Re: [Qemu-devel] [PATCHv2 1/3] virtio: add missing mb() on notification

2012-04-25 Thread David Gibson
On Tue, Apr 24, 2012 at 03:46:25PM +0200, Paolo Bonzini wrote:
 Il 23/04/2012 15:19, Michael S. Tsirkin ha scritto:
[snip]
   #elif defined(_ARCH_PPC)
   
   /*
  - * We use an eieio() for a wmb() on powerpc.  This assumes we don't
  + * We use an eieio() for wmb() and mb() on powerpc.  This assumes we don't
* need to order cacheable and non-cacheable stores with respect to
* each other
*/
   #define smp_wmb()   asm volatile(eieio ::: memory)
  +#define smp_mb()   asm volatile(eieio ::: memory)
 
 smp_mb() is hwsync under PPC, but I would just trust GCC.

I assume you mean 'lwsync', no such thing as 'hwsync', afaik.  And I
assume you're talking about the kernel here.

So, the situation in qemu is different from in the kernel, because as
far as I know there's no case in qemu where we need to synchronize
cacheable stores with non-cacheable (I/O) stores.  eieio won't do
that, but it will order cacheable stores w.r.t. other cacheable
stores.  I think __sync_synchronize() will be a 'sync', the most
heavyweight memory barrier on ppc.

-- 
David Gibson| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson




Re: [Qemu-devel] [PATCH v2] configure: Fix creation of symbolic links for MinGW toolchain

2012-04-25 Thread Stefan Hajnoczi
On Mon, Mar 19, 2012 at 01:20:47PM +0100, Stefan Weil wrote:
 The MinGW toolchain on w32/w64 hosts does not create symbolic links,
 but implements 'ln -s' similar to 'cp -r'.
 
 In incremental out of tree builds, this resulted in files which
 were not updated when their counterparts in the QEMU source tree
 changed. Especially for Makefile* this happened very often.
 
 With this patch, the 'symlinked' files are now always updated for
 out of tree builds. Similar code was already used for the symbolic
 link of libcacard/Makefile.
 
 The symlink macro always removes the target before it is created
 again, therefore the rm command for libcacard/Makefile was redundant
 and is removed now.
 
 Macro symlink is also used with directories. To remove them on w32
 hosts, a recursive rm is needed.
 
 v2:
 Quote arguments in shell function symlink, and also quote any argument
 which is passed to symlink and which contains macros. This should reduce
 the chance of accidents caused by rm -rf.
 
 Signed-off-by: Stefan Weil s...@weilnetz.de
 ---
  configure |   21 ++---
  1 files changed, 10 insertions(+), 11 deletions(-)

Sorry, this got lost in my inbox.  If you send patch revisions as
top-level emails then it's easier to notice them.  I probably marked it
as read and forgot about it because being part of the original email
thread made it appear like the discussion was still continuing.

Thanks, applied to the trivial patches tree:
https://github.com/stefanha/qemu/commits/trivial-patches

Stefan



Re: [Qemu-devel] [PATCH] xen_disk: implement BLKIF_OP_FLUSH_DISKCACHE, remove BLKIF_OP_WRITE_BARRIER

2012-04-25 Thread Christoph Hellwig
 -case BLKIF_OP_WRITE_BARRIER:
 +case BLKIF_OP_FLUSH_DISKCACHE:
  if (!ioreq-req.nr_segments) {
  ioreq-presync = 1;
  return 0;
  }
 -ioreq-presync = ioreq-postsync = 1;
 +ioreq-postsync = 1;
  /* fall through */

It might be worth documenting the semantics of BLKIF_OP_FLUSH_DISKCACHE
in a comment here.  I haven't found any spec for the xen_disk protocol,
but from looking at the Linux frontend it seems like the semantics
of REQ_FLUSH and REQ_FUA in the Linux block driver are overloaded into
BLKIF_OP_FLUSH_DISKCACHE, which is fairly confusing given that REQ_FLUSH
already overload functionality.

Even worse REQ_FLUSH with a payload implies a preflush, while REQ_FUA
implies a post flush, and it seems like Xen has no way to distinguish
the two, making thing like log writes very inefficient.

Independent of that the implementation should really use a state machine
around bdrv_aio_flush instead of doing guest-sychronous bdrv_flush calls.



Re: [Qemu-devel] How can I see the data for IDE DMA?

2012-04-25 Thread Stefan Hajnoczi
On Tue, Apr 24, 2012 at 10:25 AM, Sungchan Kim
sungchan@chonbuk.ac.kr wrote:
 I'm trying to integrate our custom SSD simulator by modifying the ide part
 of qemu.
[...]
 I need to monitor (and get) the actual IDE DMA data that is read
 from/written when using the raw disk image, /dev/sdb.

Can you explain a little bit more about what you're trying to do?

In QEMU a drive is represented by the BlockDriverState struct and the
block.h functions.  IDE uses
bdrv_aio_readv()/bdrv_aio_writev()/bdrv_aio_flush() to read data,
write data, and synchronize the write cache.  This interface gives you
access to LBA and length of requests, as well as the data buffers.  If
this is what you need, I suggest adding a block/ssdsim.c which works
similar to block/blkverify.c or block/blkdebug.c in intercepting block
I/O requests.

If you need IDE-level data then you should hook into
hw/ide/core.c:ide_exec_cmd() where ATA commands are executed.

Stefan



Re: [Qemu-devel] [PULL] xen patches

2012-04-25 Thread Christoph Hellwig
On Tue, Apr 24, 2012 at 12:28:35PM +0100, Stefano Stabellini wrote:
   xen_disk: use bdrv_aio_flush instead of bdrv_flush

This one seems completely broken, as it just queues up the flushes and
writes without any ordering between them.  Linux filesystems absolutely
rely on a REQ_FUA request which gets mapped to BLKIF_OP_FLUSH_DISKCACHE
to flush the data it actually sent.

I'm not sure who actually expects the preflush, but the only point
in ever doing it would be to sequence it properly vs the write.



Re: [Qemu-devel] [PATCH] pci: Remove partial overrun checking from pci_host_config_{read, write} common

2012-04-25 Thread Michael S. Tsirkin
On Mon, Apr 16, 2012 at 02:16:24PM +1000, David Gibson wrote:
 Currently the pci_host_config_{read,write}_common() functions clamp the
 given access size to prevent it from overruning the size of config space.
 This does not protect against total overruns (that is where the start
 address is outside config space), but given some correct but rather subtle
 assumptions does handle partial overruns (addr is within config space, but
 the access size overruns it) as a truncated read or write.
 
 A truncated read or write is vanishingly unlikely to be performed by real
 hardware, but more importantly, this code path will never be executed. The
 callers of pci_host_config_{read,write}_common() already check that the
 access is not a total overrun and is naturally aligned.

./hw/pcie_host.c does not do this.

  Together those
 mean that a partial overrun is not possible either.
 
 This patch, therefore, removes the size clamping and the associated 'limit'
 parameter to pci_host_config_{read,write}_common().  We do add an
 assert instead, which will catch cases where the caller doesn't
 properly handle overruns (either total or partial).
 
 Cc: Michael S. Tsirkin m...@redhat.com
 
 Signed-off-by: David Gibson da...@gibson.dropbear.id.au
 ---
  hw/pci_host.c  |   18 --
  hw/pci_host.h  |4 ++--
  hw/pcie_host.c |4 ++--
  hw/spapr_pci.c |8 +++-
  4 files changed, 15 insertions(+), 19 deletions(-)
 
 Michael, latest take on my attempt to clean up the bounds checking on
 config space access.  I'm hoping with the actual bug fix for pseries
 already applied, the innocuousness of this part of the cleanup will
 now be apparent.
 
 diff --git a/hw/pci_host.c b/hw/pci_host.c
 index 44c6c20..0c298dd 100644
 --- a/hw/pci_host.c
 +++ b/hw/pci_host.c
 @@ -48,17 +48,17 @@ static inline PCIDevice *pci_dev_find_by_addr(PCIBus 
 *bus, uint32_t addr)
  }
  
  void pci_host_config_write_common(PCIDevice *pci_dev, uint32_t addr,
 -  uint32_t limit, uint32_t val, uint32_t len)
 +  uint32_t val, uint32_t len)
  {
 -assert(len = 4);
 -pci_dev-config_write(pci_dev, addr, val, MIN(len, limit - addr));
 +assert((len = 4)  ((addr + len) = pci_config_size(pci_dev)));
 +pci_dev-config_write(pci_dev, addr, val, len);
  }
  
  uint32_t pci_host_config_read_common(PCIDevice *pci_dev, uint32_t addr,
 - uint32_t limit, uint32_t len)
 + uint32_t len)
  {
 -assert(len = 4);
 -return pci_dev-config_read(pci_dev, addr, MIN(len, limit - addr));
 +assert((len = 4)  ((addr + len) = pci_config_size(pci_dev)));
 +return pci_dev-config_read(pci_dev, addr, len);
  }
  
  void pci_data_write(PCIBus *s, uint32_t addr, uint32_t val, int len)
 @@ -72,8 +72,7 @@ void pci_data_write(PCIBus *s, uint32_t addr, uint32_t val, 
 int len)
  
  PCI_DPRINTF(%s: %s: addr=%02 PRIx32  val=%08 PRIx32  len=%d\n,
  __func__, pci_dev-name, config_addr, val, len);
 -pci_host_config_write_common(pci_dev, config_addr, PCI_CONFIG_SPACE_SIZE,
 - val, len);
 +pci_host_config_write_common(pci_dev, config_addr, val, len);
  }
  
  uint32_t pci_data_read(PCIBus *s, uint32_t addr, int len)
 @@ -86,8 +85,7 @@ uint32_t pci_data_read(PCIBus *s, uint32_t addr, int len)
  return ~0x0;
  }
  
 -val = pci_host_config_read_common(pci_dev, config_addr,
 -  PCI_CONFIG_SPACE_SIZE, len);
 +val = pci_host_config_read_common(pci_dev, config_addr, len);
  PCI_DPRINTF(%s: %s: addr=%02PRIx32 val=%08PRIx32 len=%d\n,
  __func__, pci_dev-name, config_addr, val, len);
  
 diff --git a/hw/pci_host.h b/hw/pci_host.h
 index 359e38f..4bb0838 100644
 --- a/hw/pci_host.h
 +++ b/hw/pci_host.h
 @@ -42,9 +42,9 @@ struct PCIHostState {
  
  /* common internal helpers for PCI/PCIe hosts, cut off overflows */
  void pci_host_config_write_common(PCIDevice *pci_dev, uint32_t addr,
 -  uint32_t limit, uint32_t val, uint32_t 
 len);
 +  uint32_t val, uint32_t len);
  uint32_t pci_host_config_read_common(PCIDevice *pci_dev, uint32_t addr,
 - uint32_t limit, uint32_t len);
 + uint32_t len);
  
  void pci_data_write(PCIBus *s, uint32_t addr, uint32_t val, int len);
  uint32_t pci_data_read(PCIBus *s, uint32_t addr, int len);
 diff --git a/hw/pcie_host.c b/hw/pcie_host.c
 index 28bbe72..1bdca34 100644
 --- a/hw/pcie_host.c
 +++ b/hw/pcie_host.c
 @@ -72,7 +72,7 @@ static void pcie_mmcfg_data_write(void *opaque, 
 target_phys_addr_t mmcfg_addr,
 256 = addr  4K has no effects. */
  return;
  }
 -pci_host_config_write_common(pci_dev, addr, limit, val, len);
 +pci_host_config_write_common(pci_dev, addr, val, len);
  }
  
  static uint64_t 

Re: [Qemu-devel] [Xen-devel] [PATCH] xen_disk: implement BLKIF_OP_FLUSH_DISKCACHE, remove BLKIF_OP_WRITE_BARRIER

2012-04-25 Thread Ian Campbell
On Wed, 2012-04-25 at 09:45 +0100, Christoph Hellwig wrote:
  -case BLKIF_OP_WRITE_BARRIER:
  +case BLKIF_OP_FLUSH_DISKCACHE:
   if (!ioreq-req.nr_segments) {
   ioreq-presync = 1;
   return 0;
   }
  -ioreq-presync = ioreq-postsync = 1;
  +ioreq-postsync = 1;
   /* fall through */
 
 It might be worth documenting the semantics of BLKIF_OP_FLUSH_DISKCACHE
 in a comment here.  I haven't found any spec for the xen_disk protocol,

The blkif spec was recently much improved, you can find it at
http://xenbits.xen.org/docs/unstable/hypercall/include,public,io,blkif.h.html

TBH I'm not sure it actually answers your questions wrt
BLKIF_OP_FLUSH_DISKCACHE, if not please let us know and we can see about
improving it.

Ian




[Qemu-devel] [PATCH 1/9] hw/qxl.c: qxl_phys2virt: replace panics with guest_bug

2012-04-25 Thread Alon Levy
Signed-off-by: Alon Levy al...@redhat.com
---
 hw/qxl.c |   25 +++--
 1 file changed, 19 insertions(+), 6 deletions(-)

diff --git a/hw/qxl.c b/hw/qxl.c
index c3540c3..9e8cdf3 100644
--- a/hw/qxl.c
+++ b/hw/qxl.c
@@ -1097,15 +1097,28 @@ void *qxl_phys2virt(PCIQXLDevice *qxl, QXLPHYSICAL 
pqxl, int group_id)
 case MEMSLOT_GROUP_HOST:
 return (void *)(intptr_t)offset;
 case MEMSLOT_GROUP_GUEST:
-PANIC_ON(slot = NUM_MEMSLOTS);
-PANIC_ON(!qxl-guest_slots[slot].active);
-PANIC_ON(offset  qxl-guest_slots[slot].delta);
+if (slot = NUM_MEMSLOTS) {
+qxl_guest_bug(qxl, slot too large %d = %d, slot, NUM_MEMSLOTS);
+return NULL;
+}
+if (!qxl-guest_slots[slot].active) {
+qxl_guest_bug(qxl, inactive slot %d\n, slot);
+return NULL;
+}
+if (offset  qxl-guest_slots[slot].delta) {
+qxl_guest_bug(qxl, slot %d offset %PRIu64  delta %PRIu64\n,
+  slot, offset, qxl-guest_slots[slot].delta);
+return NULL;
+}
 offset -= qxl-guest_slots[slot].delta;
-PANIC_ON(offset  qxl-guest_slots[slot].size)
+if (offset  qxl-guest_slots[slot].size) {
+qxl_guest_bug(qxl, slot %d offset %PRIu64  size %PRIu64\n,
+  slot, offset, qxl-guest_slots[slot].size);
+return NULL;
+}
 return qxl-guest_slots[slot].ptr + offset;
-default:
-PANIC_ON(1);
 }
+return NULL;
 }
 
 static void qxl_create_guest_primary_complete(PCIQXLDevice *qxl)
-- 
1.7.10




[Qemu-devel] [PATCH 3/9] qxl: replace panic with guest bug in qxl_track_command

2012-04-25 Thread Alon Levy
Signed-off-by: Alon Levy al...@redhat.com
---
 hw/qxl.c |6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/hw/qxl.c b/hw/qxl.c
index b6a738e..8b66cbb 100644
--- a/hw/qxl.c
+++ b/hw/qxl.c
@@ -394,7 +394,11 @@ static int qxl_track_command(PCIQXLDevice *qxl, struct 
QXLCommandExt *ext)
 return 1;
 }
 uint32_t id = le32_to_cpu(cmd-surface_id);
-PANIC_ON(id = NUM_SURFACES);
+
+if (id = NUM_SURFACES) {
+qxl_guest_bug(qxl, QXL_CMD_SURFACE id %d = %d, id, 
NUM_SURFACES);
+return 1;
+}
 qemu_mutex_lock(qxl-track_lock);
 if (cmd-type == QXL_SURFACE_CMD_CREATE) {
 qxl-guest_surfaces.cmds[id] = ext-cmd.data;
-- 
1.7.10




[Qemu-devel] [PATCH 2/9] qxl: check for NULL return from qxl_phys2virt

2012-04-25 Thread Alon Levy
Signed-off-by: Alon Levy al...@redhat.com
---
 hw/qxl-logger.c |   51 ++-
 hw/qxl-render.c |   14 +++---
 hw/qxl.c|   13 -
 hw/qxl.h|6 +++---
 4 files changed, 64 insertions(+), 20 deletions(-)

diff --git a/hw/qxl-logger.c b/hw/qxl-logger.c
index 367aad1..fe2878c 100644
--- a/hw/qxl-logger.c
+++ b/hw/qxl-logger.c
@@ -100,12 +100,15 @@ static const char *qxl_v2n(const char *n[], size_t l, int 
v)
 }
 #define qxl_name(_list, _value) qxl_v2n(_list, ARRAY_SIZE(_list), _value)
 
-static void qxl_log_image(PCIQXLDevice *qxl, QXLPHYSICAL addr, int group_id)
+static int qxl_log_image(PCIQXLDevice *qxl, QXLPHYSICAL addr, int group_id)
 {
 QXLImage *image;
 QXLImageDescriptor *desc;
 
 image = qxl_phys2virt(qxl, addr, group_id);
+if (!image) {
+return 1;
+}
 desc = image-descriptor;
 fprintf(stderr,  (id % PRIx64  type %d flags %d width %d height %d,
 desc-id, desc-type, desc-flags, desc-width, desc-height);
@@ -120,6 +123,7 @@ static void qxl_log_image(PCIQXLDevice *qxl, QXLPHYSICAL 
addr, int group_id)
 break;
 }
 fprintf(stderr, ));
+return 0;
 }
 
 static void qxl_log_rect(QXLRect *rect)
@@ -130,17 +134,24 @@ static void qxl_log_rect(QXLRect *rect)
 rect-left, rect-top);
 }
 
-static void qxl_log_cmd_draw_copy(PCIQXLDevice *qxl, QXLCopy *copy, int 
group_id)
+static int qxl_log_cmd_draw_copy(PCIQXLDevice *qxl, QXLCopy *copy,
+ int group_id)
 {
+int ret;
+
 fprintf(stderr,  src % PRIx64,
 copy-src_bitmap);
-qxl_log_image(qxl, copy-src_bitmap, group_id);
+ret = qxl_log_image(qxl, copy-src_bitmap, group_id);
+if (ret != 0) {
+return ret;
+}
 fprintf(stderr,  area);
 qxl_log_rect(copy-src_area);
 fprintf(stderr,  rop %d, copy-rop_descriptor);
+return 0;
 }
 
-static void qxl_log_cmd_draw(PCIQXLDevice *qxl, QXLDrawable *draw, int 
group_id)
+static int qxl_log_cmd_draw(PCIQXLDevice *qxl, QXLDrawable *draw, int group_id)
 {
 fprintf(stderr, : surface_id %d type %s effect %s,
 draw-surface_id,
@@ -148,13 +159,14 @@ static void qxl_log_cmd_draw(PCIQXLDevice *qxl, 
QXLDrawable *draw, int group_id)
 qxl_name(qxl_draw_effect, draw-effect));
 switch (draw-type) {
 case QXL_DRAW_COPY:
-qxl_log_cmd_draw_copy(qxl, draw-u.copy, group_id);
+return qxl_log_cmd_draw_copy(qxl, draw-u.copy, group_id);
 break;
 }
+return 0;
 }
 
-static void qxl_log_cmd_draw_compat(PCIQXLDevice *qxl, QXLCompatDrawable *draw,
-int group_id)
+static int qxl_log_cmd_draw_compat(PCIQXLDevice *qxl, QXLCompatDrawable *draw,
+   int group_id)
 {
 fprintf(stderr, : type %s effect %s,
 qxl_name(qxl_draw_type, draw-type),
@@ -166,9 +178,10 @@ static void qxl_log_cmd_draw_compat(PCIQXLDevice *qxl, 
QXLCompatDrawable *draw,
 }
 switch (draw-type) {
 case QXL_DRAW_COPY:
-qxl_log_cmd_draw_copy(qxl, draw-u.copy, group_id);
+return qxl_log_cmd_draw_copy(qxl, draw-u.copy, group_id);
 break;
 }
+return 0;
 }
 
 static void qxl_log_cmd_surface(PCIQXLDevice *qxl, QXLSurfaceCmd *cmd)
@@ -189,7 +202,7 @@ static void qxl_log_cmd_surface(PCIQXLDevice *qxl, 
QXLSurfaceCmd *cmd)
 }
 }
 
-void qxl_log_cmd_cursor(PCIQXLDevice *qxl, QXLCursorCmd *cmd, int group_id)
+int qxl_log_cmd_cursor(PCIQXLDevice *qxl, QXLCursorCmd *cmd, int group_id)
 {
 QXLCursor *cursor;
 
@@ -203,6 +216,9 @@ void qxl_log_cmd_cursor(PCIQXLDevice *qxl, QXLCursorCmd 
*cmd, int group_id)
 cmd-u.set.visible ? yes : no,
 cmd-u.set.shape);
 cursor = qxl_phys2virt(qxl, cmd-u.set.shape, group_id);
+if (!cursor) {
+return 1;
+}
 fprintf(stderr,  type %s size %dx%d hot-spot +%d+%d
  unique 0x% PRIx64  data-size %d,
 qxl_name(spice_cursor_type, cursor-header.type),
@@ -214,15 +230,17 @@ void qxl_log_cmd_cursor(PCIQXLDevice *qxl, QXLCursorCmd 
*cmd, int group_id)
 fprintf(stderr,  +%d+%d, cmd-u.position.x, cmd-u.position.y);
 break;
 }
+return 0;
 }
 
-void qxl_log_command(PCIQXLDevice *qxl, const char *ring, QXLCommandExt *ext)
+int qxl_log_command(PCIQXLDevice *qxl, const char *ring, QXLCommandExt *ext)
 {
 bool compat = ext-flags  QXL_COMMAND_FLAG_COMPAT;
 void *data;
+int ret;
 
 if (!qxl-cmdlog) {
-return;
+return 0;
 }
 fprintf(stderr, % PRId64  qxl-%d/%s:, qemu_get_clock_ns(vm_clock),
 qxl-id, ring);
@@ -231,12 +249,18 @@ void qxl_log_command(PCIQXLDevice *qxl, const char *ring, 
QXLCommandExt *ext)
 compat ? (compat) : );
 
 data = qxl_phys2virt(qxl, ext-cmd.data, ext-group_id);
+if (!data) {
+return 1;
+}
 switch (ext-cmd.type) {
 

[Qemu-devel] [PATCH 8/9] qxl: qxl_add_memslot: remove guest trigerrable panics

2012-04-25 Thread Alon Levy
Signed-off-by: Alon Levy al...@redhat.com
---
 hw/qxl.c |   27 ---
 1 file changed, 20 insertions(+), 7 deletions(-)

diff --git a/hw/qxl.c b/hw/qxl.c
index 44ee495..44a167a 100644
--- a/hw/qxl.c
+++ b/hw/qxl.c
@@ -1038,8 +1038,8 @@ static const MemoryRegionPortio qxl_vga_portio_list[] = {
 PORTIO_END_OF_LIST(),
 };
 
-static void qxl_add_memslot(PCIQXLDevice *d, uint32_t slot_id, uint64_t delta,
-qxl_async_io async)
+static int qxl_add_memslot(PCIQXLDevice *d, uint32_t slot_id, uint64_t delta,
+   qxl_async_io async)
 {
 static const int regions[] = {
 QXL_RAM_RANGE_INDEX,
@@ -1060,8 +1060,16 @@ static void qxl_add_memslot(PCIQXLDevice *d, uint32_t 
slot_id, uint64_t delta,
 
 trace_qxl_memslot_add_guest(d-id, slot_id, guest_start, guest_end);
 
-PANIC_ON(slot_id = NUM_MEMSLOTS);
-PANIC_ON(guest_start  guest_end);
+if (slot_id = NUM_MEMSLOTS) {
+qxl_guest_bug(d, %s: slot_id = NUM_MEMSLOTS %d = %d, __func__,
+  slot_id, NUM_MEMSLOTS);
+return 1;
+}
+if (guest_start  guest_end) {
+qxl_guest_bug(d, %s: guest_start  guest_end 0x% PRIx64
+   0x% PRIx64, __func__, guest_start, guest_end);
+return 1;
+}
 
 for (i = 0; i  ARRAY_SIZE(regions); i++) {
 pci_region = regions[i];
@@ -1082,7 +1090,10 @@ static void qxl_add_memslot(PCIQXLDevice *d, uint32_t 
slot_id, uint64_t delta,
 /* passed */
 break;
 }
-PANIC_ON(i == ARRAY_SIZE(regions)); /* finished loop without match */
+if (i == ARRAY_SIZE(regions)) {
+qxl_guest_bug(d, %s: finished loop without match, __func__);
+return 1;
+}
 
 switch (pci_region) {
 case QXL_RAM_RANGE_INDEX:
@@ -1094,7 +1105,8 @@ static void qxl_add_memslot(PCIQXLDevice *d, uint32_t 
slot_id, uint64_t delta,
 break;
 default:
 /* should not happen */
-abort();
+qxl_guest_bug(d, %s: pci_region = %d, __func__, pci_region);
+return 1;
 }
 
 memslot.slot_id = slot_id;
@@ -1110,6 +1122,7 @@ static void qxl_add_memslot(PCIQXLDevice *d, uint32_t 
slot_id, uint64_t delta,
 d-guest_slots[slot_id].size = memslot.virt_end - memslot.virt_start;
 d-guest_slots[slot_id].delta = delta;
 d-guest_slots[slot_id].active = 1;
+return 0;
 }
 
 static void qxl_del_memslot(PCIQXLDevice *d, uint32_t slot_id)
@@ -1250,7 +1263,7 @@ static void qxl_set_mode(PCIQXLDevice *d, int modenr, int 
loadvm)
 }
 
 d-guest_slots[0].slot = slot;
-qxl_add_memslot(d, 0, devmem, QXL_SYNC);
+assert(qxl_add_memslot(d, 0, devmem, QXL_SYNC) == 0);
 
 d-guest_primary.surface = surface;
 qxl_create_guest_primary(d, 0, QXL_SYNC);
-- 
1.7.10




[Qemu-devel] [PATCH 9/9] qxl: ioport_write: remove guest trigerrable abort

2012-04-25 Thread Alon Levy
Signed-off-by: Alon Levy al...@redhat.com
---
 hw/qxl.c |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/hw/qxl.c b/hw/qxl.c
index 44a167a..c614c91 100644
--- a/hw/qxl.c
+++ b/hw/qxl.c
@@ -1464,8 +1464,7 @@ async_common:
 qxl_spice_destroy_surfaces(d, async);
 break;
 default:
-fprintf(stderr, %s: ioport=0x%x, abort()\n, __FUNCTION__, io_port);
-abort();
+qxl_guest_bug(d, %s: unexpected ioport=0x%x\n, __func__, io_port);
 }
 return;
 cancel_async:
-- 
1.7.10




[Qemu-devel] [PULL] QOM CPUState properties for x86

2012-04-25 Thread Andreas Färber
Hello Anthony,

Please pull the x86 QOM CPU properties.

Cc: Anthony Liguori anth...@codemonkey.ws

The following changes since commit cf36b31db209a261ee3bc2737e788e1ced0a1bec:

  Limit ptimer rate to something achievable (2012-04-24 09:50:31 -0500)

are available in the git repository at:
  git://github.com/afaerber/qemu-cpu.git qom-cpu-x86-prop.v3

Andreas Färber (15):
  target-i386: Fix x86_cpuid_set_model_id()
  target-i386: Pass X86CPU to cpu_x86_register()
  target-i386: Add range check for -cpu ,family=x
  target-i386: Add family property to X86CPU
  target-i386: Add model property to X86CPU
  target-i386: Add stepping property to X86CPU
  target-i386: Add model-id property to X86CPU
  target-i386: Add property getter for CPU family
  target-i386: Add property getter for CPU model
  target-i386: Add property getter for CPU stepping
  target-i386: Add property getter for CPU model-id
  target-i386: Introduce level property for X86CPU
  target-i386: Introduce xlevel property for X86CPU
  target-i386: Prepare vendor property for X86CPU
  target-i386: Introduce tsc-frequency property for X86CPU

 target-i386/cpu.c|  318 +++---
 target-i386/cpu.h|2 +-
 target-i386/helper.c |2 +-
 3 files changed, 302 insertions(+), 20 deletions(-)



[Qemu-devel] [PATCH v3 02/15] target-i386: Pass X86CPU to cpu_x86_register()

2012-04-25 Thread Andreas Färber
Avoids an x86_env_get_cpu() call there, to work with QOM properties.

Signed-off-by: Andreas Färber afaer...@suse.de
Reviewed-by: Eduardo Habkost ehabk...@redhat.com
Reviewed-by: Igor Mammedov imamm...@redhat.com
---
 target-i386/cpu.c|3 ++-
 target-i386/cpu.h|2 +-
 target-i386/helper.c |2 +-
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index e1517e6..3dc0f80 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -905,8 +905,9 @@ void x86_cpu_list(FILE *f, fprintf_function cpu_fprintf, 
const char *optarg)
 }
 }
 
-int cpu_x86_register (CPUX86State *env, const char *cpu_model)
+int cpu_x86_register(X86CPU *cpu, const char *cpu_model)
 {
+CPUX86State *env = cpu-env;
 x86_def_t def1, *def = def1;
 
 memset(def, 0, sizeof(*def));
diff --git a/target-i386/cpu.h b/target-i386/cpu.h
index 4bb4592..b5b9a50 100644
--- a/target-i386/cpu.h
+++ b/target-i386/cpu.h
@@ -901,7 +901,7 @@ int cpu_x86_signal_handler(int host_signum, void *pinfo,
 void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
uint32_t *eax, uint32_t *ebx,
uint32_t *ecx, uint32_t *edx);
-int cpu_x86_register (CPUX86State *env, const char *cpu_model);
+int cpu_x86_register(X86CPU *cpu, const char *cpu_model);
 void cpu_clear_apic_feature(CPUX86State *env);
 void host_cpuid(uint32_t function, uint32_t count,
 uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx);
diff --git a/target-i386/helper.c b/target-i386/helper.c
index 87954f0..0b22582 100644
--- a/target-i386/helper.c
+++ b/target-i386/helper.c
@@ -1176,7 +1176,7 @@ CPUX86State *cpu_x86_init(const char *cpu_model)
 cpu_set_debug_excp_handler(breakpoint_handler);
 #endif
 }
-if (cpu_x86_register(env, cpu_model)  0) {
+if (cpu_x86_register(cpu, cpu_model)  0) {
 object_delete(OBJECT(cpu));
 return NULL;
 }
-- 
1.7.7




[Qemu-devel] [PATCH v3 05/15] target-i386: Add model property to X86CPU

2012-04-25 Thread Andreas Färber
Signed-off-by: Andreas Färber afaer...@suse.de
Reviewed-by: Eduardo Habkost ehabk...@redhat.com
Reviewed-by: Igor Mammedov imamm...@redhat.com
---
 target-i386/cpu.c |   26 +++---
 1 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 9eb5738..ebee991 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -626,10 +626,27 @@ static void x86_cpuid_version_set_family(Object *obj, 
Visitor *v, void *opaque,
 }
 }
 
-static void x86_cpuid_version_set_model(CPUX86State *env, int model)
+static void x86_cpuid_version_set_model(Object *obj, Visitor *v, void *opaque,
+const char *name, Error **errp)
 {
+X86CPU *cpu = X86_CPU(obj);
+CPUX86State *env = cpu-env;
+const int64_t min = 0;
+const int64_t max = 0xff;
+int64_t value;
+
+visit_type_int(v, value, name, errp);
+if (error_is_set(errp)) {
+return;
+}
+if (value  min || value  max) {
+error_set(errp, QERR_PROPERTY_VALUE_OUT_OF_RANGE, ,
+  name ? name : null, value, min, max);
+return;
+}
+
 env-cpuid_version = ~0xf00f0;
-env-cpuid_version |= ((model  0xf)  4) | ((model  4)  16);
+env-cpuid_version |= ((value  0xf)  4) | ((value  4)  16);
 }
 
 static void x86_cpuid_version_set_stepping(CPUX86State *env, int stepping)
@@ -946,7 +963,7 @@ int cpu_x86_register(X86CPU *cpu, const char *cpu_model)
 env-cpuid_vendor_override = def-vendor_override;
 env-cpuid_level = def-level;
 object_property_set_int(OBJECT(cpu), def-family, family, error);
-x86_cpuid_version_set_model(env, def-model);
+object_property_set_int(OBJECT(cpu), def-model, model, error);
 x86_cpuid_version_set_stepping(env, def-stepping);
 env-cpuid_features = def-features;
 env-cpuid_ext_features = def-ext_features;
@@ -1502,6 +1519,9 @@ static void x86_cpu_initfn(Object *obj)
 object_property_add(obj, family, int,
 NULL,
 x86_cpuid_version_set_family, NULL, NULL, NULL);
+object_property_add(obj, model, int,
+NULL,
+x86_cpuid_version_set_model, NULL, NULL, NULL);
 
 env-cpuid_apic_id = env-cpu_index;
 mce_init(cpu);
-- 
1.7.7




[Qemu-devel] [PATCH 6/9] qxl: cleanup s/__FUNCTION__/__func__/

2012-04-25 Thread Alon Levy
Signed-off-by: Alon Levy al...@redhat.com
---
 hw/qxl.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/qxl.c b/hw/qxl.c
index 44a4c9b..6e7232c 100644
--- a/hw/qxl.c
+++ b/hw/qxl.c
@@ -1503,7 +1503,7 @@ static void qxl_send_events(PCIQXLDevice *d, uint32_t 
events)
 qxl_update_irq(d);
 } else {
 if (write(d-pipe[1], d, 1) != 1) {
-dprint(d, 1, %s: write to pipe failed\n, __FUNCTION__);
+dprint(d, 1, %s: write to pipe failed\n, __func__);
 }
 }
 }
-- 
1.7.10




Re: [Qemu-devel] [RFC PATCH 1/1] virtio-serial-bus: Unset guest_connected at reset and driver reset

2012-04-25 Thread Alon Levy
On Tue, Apr 24, 2012 at 07:39:27PM +0530, Amit Shah wrote:
 When a guest driver resets the virtio status to not ready, or when qemu
 is reset, reset the guest_connected bit and let ports know if they have
 the guest_close() callback registered.
 

Reviewed-by: Alon Levy al...@redhat.com

Looks like extra work for multiport aware drivers, or put another way it
would fix the guest_connected to be false if they forgot to use
VIRTIO_CONSOLE_PORT_OPEN.

 Signed-off-by: Amit Shah amit.s...@redhat.com
 ---
  hw/virtio-serial-bus.c |   28 
  1 files changed, 28 insertions(+), 0 deletions(-)
 
 diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c
 index 796224b..ffbdfc2 100644
 --- a/hw/virtio-serial-bus.c
 +++ b/hw/virtio-serial-bus.c
 @@ -528,6 +528,22 @@ static void set_config(VirtIODevice *vdev, const uint8_t 
 *config_data)
  memcpy(config, config_data, sizeof(config));
  }
  
 +static void guest_reset(VirtIOSerial *vser)
 +{
 +VirtIOSerialPort *port;
 +VirtIOSerialPortClass *vsc;
 +
 +QTAILQ_FOREACH(port, vser-ports, next) {
 +vsc = VIRTIO_SERIAL_PORT_GET_CLASS(port);
 +if (port-guest_connected) {
 +port-guest_connected = false;
 +
 +if (vsc-guest_close)
 +vsc-guest_close(port);
 +}
 +}
 +}
 +
  static void set_status(VirtIODevice *vdev, uint8_t status)
  {
  VirtIOSerial *vser;
 @@ -546,6 +562,17 @@ static void set_status(VirtIODevice *vdev, uint8_t 
 status)
   */
  port-guest_connected = true;
  }
 +if (!(status  VIRTIO_CONFIG_S_DRIVER_OK)) {
 +guest_reset(vser);
 +}
 +}
 +
 +static void vser_reset(VirtIODevice *vdev)
 +{
 +VirtIOSerial *vser;
 +
 +vser = DO_UPCAST(VirtIOSerial, vdev, vdev);
 +guest_reset(vser);
  }
  
  static void virtio_serial_save(QEMUFile *f, void *opaque)
 @@ -918,6 +945,7 @@ VirtIODevice *virtio_serial_init(DeviceState *dev, 
 virtio_serial_conf *conf)
  vser-vdev.get_config = get_config;
  vser-vdev.set_config = set_config;
  vser-vdev.set_status = set_status;
 +vser-vdev.reset = vser_reset;
  
  vser-qdev = dev;
  
 -- 
 1.7.7.6
 
 



[Qemu-devel] [PULL] e1000, eepro100, virtio

2012-04-25 Thread Michael S. Tsirkin
The following changes since commit cf36b31db209a261ee3bc2737e788e1ced0a1bec:

  Limit ptimer rate to something achievable (2012-04-24 09:50:31 -0500)

are available in the git repository at:

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

for you to fetch changes up to f1219091edd20e3b92544025c2b6dd5e4d98b61b:

  e1000: set E1000_ICR_INT_ASSERTED only for 8257x (2012-04-25 10:53:48 +0300)


e1000, eepro100, virtio

This pull includes virtio memory ordering fixes, finally
fixing bugs on which I have been working, on and off,
for several weeks.

There's a partial revert of Jason's eepro100 cleanup,
blessed by both Jason and Stefan since that broke multicast.

Additionally there are e1000 enhancements by Jason:
they have been on the list for a while and work fine for me.

Signed-off-by: Michael S. Tsirkin m...@redhat.com


Jason Wang (7):
  e1000: introduce bits of PHY control register
  e1000: conditionally raise irq at the end of MDI cycle
  e1000: PHY loopback mode support
  e1000: introduce helpers to manipulate link status
  e1000: introduce bit for debugging PHY emulation
  e1000: link auto-negotiation emulation
  e1000: set E1000_ICR_INT_ASSERTED only for 8257x

Michael S. Tsirkin (4):
  e1000: move reset function earlier in file
  virtio: add missing mb() on notification
  virtio: add missing mb() on enable notification
  virtio: order index/descriptor reads

Stefan Weil (1):
  eepro100: Fix multicast regression

 hw/e1000.c |  167 +++-
 hw/e1000_hw.h  |   12 
 hw/eepro100.c  |   28 +-
 hw/virtio.c|   11 
 qemu-barrier.h |   35 ++-
 5 files changed, 197 insertions(+), 56 deletions(-)



[Qemu-devel] [PATCH v3 09/15] target-i386: Add property getter for CPU model

2012-04-25 Thread Andreas Färber
Signed-off-by: Andreas Färber afaer...@suse.de
Reviewed-by: Igor Mammedov imamm...@redhat.com
Reviewed-by: Michael Roth mdr...@linux.vnet.ibm.com
---
 target-i386/cpu.c |   14 +-
 1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 90c1373..7f63afd 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -640,6 +640,18 @@ static void x86_cpuid_version_set_family(Object *obj, 
Visitor *v, void *opaque,
 }
 }
 
+static void x86_cpuid_version_get_model(Object *obj, Visitor *v, void *opaque,
+const char *name, Error **errp)
+{
+X86CPU *cpu = X86_CPU(obj);
+CPUX86State *env = cpu-env;
+int64_t value;
+
+value = (env-cpuid_version  4)  0xf;
+value |= ((env-cpuid_version  16)  0xf)  4;
+visit_type_int(v, value, name, errp);
+}
+
 static void x86_cpuid_version_set_model(Object *obj, Visitor *v, void *opaque,
 const char *name, Error **errp)
 {
@@ -1555,7 +1567,7 @@ static void x86_cpu_initfn(Object *obj)
 x86_cpuid_version_get_family,
 x86_cpuid_version_set_family, NULL, NULL, NULL);
 object_property_add(obj, model, int,
-NULL,
+x86_cpuid_version_get_model,
 x86_cpuid_version_set_model, NULL, NULL, NULL);
 object_property_add(obj, stepping, int,
 NULL,
-- 
1.7.7




[Qemu-devel] [PATCH v3 10/15] target-i386: Add property getter for CPU stepping

2012-04-25 Thread Andreas Färber
Signed-off-by: Andreas Färber afaer...@suse.de
Reviewed-by: Eduardo Habkost ehabk...@redhat.com
Reviewed-by: Igor Mammedov imamm...@redhat.com
---
 target-i386/cpu.c |   14 +-
 1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 7f63afd..2ff5142 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -675,6 +675,18 @@ static void x86_cpuid_version_set_model(Object *obj, 
Visitor *v, void *opaque,
 env-cpuid_version |= ((value  0xf)  4) | ((value  4)  16);
 }
 
+static void x86_cpuid_version_get_stepping(Object *obj, Visitor *v,
+   void *opaque, const char *name,
+   Error **errp)
+{
+X86CPU *cpu = X86_CPU(obj);
+CPUX86State *env = cpu-env;
+int64_t value;
+
+value = env-cpuid_version  0xf;
+visit_type_int(v, value, name, errp);
+}
+
 static void x86_cpuid_version_set_stepping(Object *obj, Visitor *v,
void *opaque, const char *name,
Error **errp)
@@ -1570,7 +1582,7 @@ static void x86_cpu_initfn(Object *obj)
 x86_cpuid_version_get_model,
 x86_cpuid_version_set_model, NULL, NULL, NULL);
 object_property_add(obj, stepping, int,
-NULL,
+x86_cpuid_version_get_stepping,
 x86_cpuid_version_set_stepping, NULL, NULL, NULL);
 object_property_add_str(obj, model-id,
 NULL,
-- 
1.7.7




[Qemu-devel] [PATCH] tracetool: use Python 2.5-compatible exception handling syntax

2012-04-25 Thread Stefan Hajnoczi
The newer except exception-type as exception: syntax is not
supported by Python 2.5, we need to use except exception-type,
exception:.

Tested all trace backends with Python 2.5.6.

Reported-by: Andreas Färber afaer...@suse.de
Signed-off-by: Stefan Hajnoczi stefa...@linux.vnet.ibm.com
---
 scripts/tracetool.py |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/tracetool.py b/scripts/tracetool.py
index cacfd99..c003cf6 100755
--- a/scripts/tracetool.py
+++ b/scripts/tracetool.py
@@ -70,7 +70,7 @@ def main(args):
 
 try:
 opts, args = getopt.getopt(args[1:], , long_opts)
-except getopt.GetoptError as err:
+except getopt.GetoptError, err:
 error_opt(str(err))
 
 check_backend = False
@@ -131,7 +131,7 @@ def main(args):
 try:
 tracetool.generate(sys.stdin, arg_format, arg_backend,
binary = binary, probe_prefix = probe_prefix)
-except tracetool.TracetoolError as e:
+except tracetool.TracetoolError, e:
 error_opt(str(e))
 
 if __name__ == __main__:
-- 
1.7.10




Re: [Qemu-devel] [PULL 0/9] Tracing patches

2012-04-25 Thread Stefan Hajnoczi
On Tue, Apr 24, 2012 at 7:00 PM, Andreas Färber afaer...@suse.de wrote:
 Am 18.04.2012 16:07, schrieb Stefan Hajnoczi:
 The last tracing pull for 1.1 before we merge only fixes.

 The following changes since commit 6e7a7f3d9bc2031b4c93c05400b18775ba1b1f55:

   Allow controlling volume with PulseAudio backend (2012-04-17 16:57:58 
 +0400)

 are available in the git repository at:

   git://github.com/stefanha/qemu.git tracing

 for you to fetch changes up to 256a721d46a112d8807a488ec0176985c09bbbf1:

   tracetool: handle DTrace keywords 'in', 'next', 'self' (2012-04-18 
 14:03:00 +0100)

 
 Lluís Vilanova (8):
       tracetool: Rewrite infrastructure as python modules
       tracetool: Add module for the 'c' format
       tracetool: Add module for the 'h' format
       tracetool: Add support for the 'stderr' backend
       tracetool: Add support for the 'simple' backend
       tracetool: Add support for the 'ust' backend
       tracetool: Add support for the 'dtrace' backend
       tracetool: Add MAINTAINERS info

 Stefan Hajnoczi (1):
       tracetool: handle DTrace keywords 'in', 'next', 'self'

 While the thought of not having to deal with oldish Sun shells was
 certainly compelling, tracetool.py seems to require Python 2.6 and
 breaks with Python 2.5.1 on Mac OS X v10.5 (the last version to support
 ppc). Any chance you can fix this?

 What I'm seeing when the command line options are correct is this:

 Error: invalid trace backend
 Please choose a supported trace backend.

Thanks for reporting this.  I have sent a fix and tested that all
backends now work with Python 2.5.6.

Please let me know if this fixes the issue for you.

Stefan



[Qemu-devel] [PATCH v2] qxl: don't assert on guest create_guest_primary

2012-04-25 Thread Alon Levy
Signed-off-by: Alon Levy al...@redhat.com
---
 hw/qxl.c |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/hw/qxl.c b/hw/qxl.c
index c614c91..6c11e70 100644
--- a/hw/qxl.c
+++ b/hw/qxl.c
@@ -1191,7 +1191,10 @@ static void qxl_create_guest_primary(PCIQXLDevice *qxl, 
int loadvm,
 QXLDevSurfaceCreate surface;
 QXLSurfaceCreate *sc = qxl-guest_primary.surface;
 
-assert(qxl-mode != QXL_MODE_NATIVE);
+if (qxl-mode == QXL_MODE_NATIVE) {
+qxl_guest_bug(qxl, %s: nop since already in QXL_MODE_NATIVE,
+  __func__);
+}
 qxl_exit_vga_mode(qxl);
 
 surface.format = le32_to_cpu(sc-format);
-- 
1.7.10




[Qemu-devel] [PATCH v3 12/15] target-i386: Introduce level property for X86CPU

2012-04-25 Thread Andreas Färber
Signed-off-by: Andreas Färber afaer...@suse.de
Reviewed-by: Eduardo Habkost ehabk...@redhat.com
Reviewed-by: Igor Mammedov imamm...@redhat.com
---
 target-i386/cpu.c |   38 +-
 1 files changed, 37 insertions(+), 1 deletions(-)

diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 8b5c47d..5b03c47 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -711,6 +711,39 @@ static void x86_cpuid_version_set_stepping(Object *obj, 
Visitor *v,
 env-cpuid_version |= value  0xf;
 }
 
+static void x86_cpuid_get_level(Object *obj, Visitor *v, void *opaque,
+const char *name, Error **errp)
+{
+X86CPU *cpu = X86_CPU(obj);
+int64_t value;
+
+value = cpu-env.cpuid_level;
+/* TODO Use visit_type_uint32() once available */
+visit_type_int(v, value, name, errp);
+}
+
+static void x86_cpuid_set_level(Object *obj, Visitor *v, void *opaque,
+const char *name, Error **errp)
+{
+X86CPU *cpu = X86_CPU(obj);
+const int64_t min = 0;
+const int64_t max = UINT32_MAX;
+int64_t value;
+
+/* TODO Use visit_type_uint32() once available */
+visit_type_int(v, value, name, errp);
+if (error_is_set(errp)) {
+return;
+}
+if (value  min || value  max) {
+error_set(errp, QERR_PROPERTY_VALUE_OUT_OF_RANGE, ,
+  name ? name : null, value, min, max);
+return;
+}
+
+cpu-env.cpuid_level = value;
+}
+
 static char *x86_cpuid_get_model_id(Object *obj, Error **errp)
 {
 X86CPU *cpu = X86_CPU(obj);
@@ -1035,7 +1068,7 @@ int cpu_x86_register(X86CPU *cpu, const char *cpu_model)
 env-cpuid_vendor3 = CPUID_VENDOR_INTEL_3;
 }
 env-cpuid_vendor_override = def-vendor_override;
-env-cpuid_level = def-level;
+object_property_set_int(OBJECT(cpu), def-level, level, error);
 object_property_set_int(OBJECT(cpu), def-family, family, error);
 object_property_set_int(OBJECT(cpu), def-model, model, error);
 object_property_set_int(OBJECT(cpu), def-stepping, stepping, error);
@@ -1599,6 +1632,9 @@ static void x86_cpu_initfn(Object *obj)
 object_property_add(obj, stepping, int,
 x86_cpuid_version_get_stepping,
 x86_cpuid_version_set_stepping, NULL, NULL, NULL);
+object_property_add(obj, level, int,
+x86_cpuid_get_level,
+x86_cpuid_set_level, NULL, NULL, NULL);
 object_property_add_str(obj, model-id,
 x86_cpuid_get_model_id,
 x86_cpuid_set_model_id, NULL);
-- 
1.7.7




[Qemu-devel] [PATCH v3 03/15] target-i386: Add range check for -cpu , family=x

2012-04-25 Thread Andreas Färber
A family field value of 0xf and extended family field value of 0xff is
the maximum representable unsigned family number.
All other CPUID property values are bounds-checked, so add a check here
for symmetry before we adopt it in a property setter.

Signed-off-by: Andreas Färber afaer...@suse.de
Reviewed-by: Eduardo Habkost ehabk...@redhat.com
Reviewed-by: Igor Mammedov imamm...@redhat.com
---
 target-i386/cpu.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 3dc0f80..5cebb3d 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -691,7 +691,7 @@ static int cpu_x86_find_by_name(x86_def_t *x86_cpu_def, 
const char *cpu_model)
 if (!strcmp(featurestr, family)) {
 char *err;
 numvalue = strtoul(val, err, 0);
-if (!*val || *err) {
+if (!*val || *err || numvalue  0xff + 0xf) {
 fprintf(stderr, bad numerical value %s\n, val);
 goto error;
 }
-- 
1.7.7




[Qemu-devel] [PATCH v3 14/15] target-i386: Prepare vendor property for X86CPU

2012-04-25 Thread Andreas Färber
Using it now would incur converting the three x86_def_t vendor words
into a string for object_property_set_str(), then back to three words
in the vendor setter.
The built-in CPU definitions use numeric preprocessor defines to
initialize the three words in a charset-safe way, so do not change the
fields to char[12] just to use the setter.

Signed-off-by: Andreas Färber afaer...@suse.de
Reviewed-by: Eduardo Habkost ehabk...@redhat.com
Reviewed-by: Igor Mammedov imamm...@redhat.com
---
 target-i386/cpu.c |   44 
 1 files changed, 44 insertions(+), 0 deletions(-)

diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index deac4a7..0ff79a5 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -777,6 +777,47 @@ static void x86_cpuid_set_xlevel(Object *obj, Visitor *v, 
void *opaque,
 cpu-env.cpuid_xlevel = value;
 }
 
+static char *x86_cpuid_get_vendor(Object *obj, Error **errp)
+{
+X86CPU *cpu = X86_CPU(obj);
+CPUX86State *env = cpu-env;
+char *value;
+int i;
+
+value = (char *)g_malloc(12 + 1);
+for (i = 0; i  4; i++) {
+value[i] = env-cpuid_vendor1  (8 * i);
+value[i + 4] = env-cpuid_vendor2  (8 * i);
+value[i + 8] = env-cpuid_vendor3  (8 * i);
+}
+value[12] = '\0';
+return value;
+}
+
+static void x86_cpuid_set_vendor(Object *obj, const char *value,
+ Error **errp)
+{
+X86CPU *cpu = X86_CPU(obj);
+CPUX86State *env = cpu-env;
+int i;
+
+if (strlen(value) != 12) {
+error_set(errp, QERR_PROPERTY_VALUE_BAD, ,
+  vendor, value);
+return;
+}
+
+env-cpuid_vendor1 = 0;
+env-cpuid_vendor2 = 0;
+env-cpuid_vendor3 = 0;
+for (i = 0; i  4; i++) {
+env-cpuid_vendor1 |= ((uint8_t)value[i])  (8 * i);
+env-cpuid_vendor2 |= ((uint8_t)value[i + 4])  (8 * i);
+env-cpuid_vendor3 |= ((uint8_t)value[i + 8])  (8 * i);
+}
+env-cpuid_vendor_override = 1;
+}
+
 static char *x86_cpuid_get_model_id(Object *obj, Error **errp)
 {
 X86CPU *cpu = X86_CPU(obj);
@@ -1671,6 +1712,9 @@ static void x86_cpu_initfn(Object *obj)
 object_property_add(obj, xlevel, int,
 x86_cpuid_get_xlevel,
 x86_cpuid_set_xlevel, NULL, NULL, NULL);
+object_property_add_str(obj, vendor,
+x86_cpuid_get_vendor,
+x86_cpuid_set_vendor, NULL);
 object_property_add_str(obj, model-id,
 x86_cpuid_get_model_id,
 x86_cpuid_set_model_id, NULL);
-- 
1.7.7




[Qemu-devel] [PATCH v3 15/15] target-i386: Introduce tsc-frequency property for X86CPU

2012-04-25 Thread Andreas Färber
Use Hz as unit.

Signed-off-by: Andreas Färber afaer...@suse.de
Reviewed-by: Eduardo Habkost ehabk...@redhat.com
Reviewed-by: Igor Mammedov imamm...@redhat.com
---
 target-i386/cpu.c |   37 -
 1 files changed, 36 insertions(+), 1 deletions(-)

diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 0ff79a5..65d9af6 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -855,6 +855,37 @@ static void x86_cpuid_set_model_id(Object *obj, const char 
*model_id,
 }
 }
 
+static void x86_cpuid_get_tsc_freq(Object *obj, Visitor *v, void *opaque,
+   const char *name, Error **errp)
+{
+X86CPU *cpu = X86_CPU(obj);
+int64_t value;
+
+value = cpu-env.tsc_khz * 1000;
+visit_type_int(v, value, name, errp);
+}
+
+static void x86_cpuid_set_tsc_freq(Object *obj, Visitor *v, void *opaque,
+   const char *name, Error **errp)
+{
+X86CPU *cpu = X86_CPU(obj);
+const int64_t min = 0;
+const int64_t max = INT_MAX;
+int64_t value;
+
+visit_type_int(v, value, name, errp);
+if (error_is_set(errp)) {
+return;
+}
+if (value  min || value  max) {
+error_set(errp, QERR_PROPERTY_VALUE_OUT_OF_RANGE, ,
+  name ? name : null, value, min, max);
+return;
+}
+
+cpu-env.tsc_khz = value / 1000;
+}
+
 static int cpu_x86_find_by_name(x86_def_t *x86_cpu_def, const char *cpu_model)
 {
 unsigned int i;
@@ -1155,7 +1186,8 @@ int cpu_x86_register(X86CPU *cpu, const char *cpu_model)
 env-cpuid_svm_features = def-svm_features;
 env-cpuid_ext4_features = def-ext4_features;
 env-cpuid_xlevel2 = def-xlevel2;
-env-tsc_khz = def-tsc_khz;
+object_property_set_int(OBJECT(cpu), (int64_t)def-tsc_khz * 1000,
+tsc-frequency, error);
 if (!kvm_enabled()) {
 env-cpuid_features = TCG_FEATURES;
 env-cpuid_ext_features = TCG_EXT_FEATURES;
@@ -1718,6 +1750,9 @@ static void x86_cpu_initfn(Object *obj)
 object_property_add_str(obj, model-id,
 x86_cpuid_get_model_id,
 x86_cpuid_set_model_id, NULL);
+object_property_add(obj, tsc-frequency, int,
+x86_cpuid_get_tsc_freq,
+x86_cpuid_set_tsc_freq, NULL, NULL, NULL);
 
 env-cpuid_apic_id = env-cpu_index;
 mce_init(cpu);
-- 
1.7.7




[Qemu-devel] [PATCH v3 01/15] target-i386: Fix x86_cpuid_set_model_id()

2012-04-25 Thread Andreas Färber
Don't assume zeroed cpuid_model[] fields.

This didn't break anything yet but QOM properties should be able to set
the value to something else without setting an intermediate zero string.

Reviewed-by: Eduardo Habhost ehabk...@redhat.com
Reviewed-by: Igor Mammedov imamm...@redhat.com
[AF: Use memset() instead of for loop, suggested by Igor]
Signed-off-by: Andreas Färber afaer...@suse.de
---
 target-i386/cpu.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 3df53ca..e1517e6 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -627,6 +627,7 @@ static void x86_cpuid_set_model_id(CPUX86State *env, const 
char *model_id)
 model_id = ;
 }
 len = strlen(model_id);
+memset(env-cpuid_model, 0, 48);
 for (i = 0; i  48; i++) {
 if (i = len) {
 c = '\0';
-- 
1.7.7




[Qemu-devel] [PATCH v3 08/15] target-i386: Add property getter for CPU family

2012-04-25 Thread Andreas Färber
Signed-off-by: Andreas Färber afaer...@suse.de
Reviewed-by: Eduardo Habkost ehabk...@redhat.com
Reviewed-by: Igor Mammedov imamm...@redhat.com
---
 target-i386/cpu.c |   16 +++-
 1 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index bb57345..90c1373 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -599,6 +599,20 @@ static int check_features_against_host(x86_def_t 
*guest_def)
 return rv;
 }
 
+static void x86_cpuid_version_get_family(Object *obj, Visitor *v, void *opaque,
+ const char *name, Error **errp)
+{
+X86CPU *cpu = X86_CPU(obj);
+CPUX86State *env = cpu-env;
+int64_t value;
+
+value = (env-cpuid_version  8)  0xf;
+if (value == 0xf) {
+value += (env-cpuid_version  20)  0xff;
+}
+visit_type_int(v, value, name, errp);
+}
+
 static void x86_cpuid_version_set_family(Object *obj, Visitor *v, void *opaque,
  const char *name, Error **errp)
 {
@@ -1538,7 +1552,7 @@ static void x86_cpu_initfn(Object *obj)
 cpu_exec_init(env);
 
 object_property_add(obj, family, int,
-NULL,
+x86_cpuid_version_get_family,
 x86_cpuid_version_set_family, NULL, NULL, NULL);
 object_property_add(obj, model, int,
 NULL,
-- 
1.7.7




[Qemu-devel] [PATCH v3 06/15] target-i386: Add stepping property to X86CPU

2012-04-25 Thread Andreas Färber
Signed-off-by: Andreas Färber afaer...@suse.de
Reviewed-by: Eduardo Habkost ehabk...@redhat.com
Reviewed-by: Igor Mammedov imamm...@redhat.com
---
 target-i386/cpu.c |   27 ---
 1 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index ebee991..82194dd 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -649,10 +649,28 @@ static void x86_cpuid_version_set_model(Object *obj, 
Visitor *v, void *opaque,
 env-cpuid_version |= ((value  0xf)  4) | ((value  4)  16);
 }
 
-static void x86_cpuid_version_set_stepping(CPUX86State *env, int stepping)
+static void x86_cpuid_version_set_stepping(Object *obj, Visitor *v,
+   void *opaque, const char *name,
+   Error **errp)
 {
+X86CPU *cpu = X86_CPU(obj);
+CPUX86State *env = cpu-env;
+const int64_t min = 0;
+const int64_t max = 0xf;
+int64_t value;
+
+visit_type_int(v, value, name, errp);
+if (error_is_set(errp)) {
+return;
+}
+if (value  min || value  max) {
+error_set(errp, QERR_PROPERTY_VALUE_OUT_OF_RANGE, ,
+  name ? name : null, value, min, max);
+return;
+}
+
 env-cpuid_version = ~0xf;
-env-cpuid_version |= stepping  0xf;
+env-cpuid_version |= value  0xf;
 }
 
 static void x86_cpuid_set_model_id(CPUX86State *env, const char *model_id)
@@ -964,7 +982,7 @@ int cpu_x86_register(X86CPU *cpu, const char *cpu_model)
 env-cpuid_level = def-level;
 object_property_set_int(OBJECT(cpu), def-family, family, error);
 object_property_set_int(OBJECT(cpu), def-model, model, error);
-x86_cpuid_version_set_stepping(env, def-stepping);
+object_property_set_int(OBJECT(cpu), def-stepping, stepping, error);
 env-cpuid_features = def-features;
 env-cpuid_ext_features = def-ext_features;
 env-cpuid_ext2_features = def-ext2_features;
@@ -1522,6 +1540,9 @@ static void x86_cpu_initfn(Object *obj)
 object_property_add(obj, model, int,
 NULL,
 x86_cpuid_version_set_model, NULL, NULL, NULL);
+object_property_add(obj, stepping, int,
+NULL,
+x86_cpuid_version_set_stepping, NULL, NULL, NULL);
 
 env-cpuid_apic_id = env-cpu_index;
 mce_init(cpu);
-- 
1.7.7




Re: [Qemu-devel] [Xen-devel] [PATCH] xen_disk: implement BLKIF_OP_FLUSH_DISKCACHE, remove BLKIF_OP_WRITE_BARRIER

2012-04-25 Thread Christoph Hellwig
On Wed, Apr 25, 2012 at 10:02:45AM +0100, Ian Campbell wrote:
 The blkif spec was recently much improved, you can find it at
 http://xenbits.xen.org/docs/unstable/hypercall/include,public,io,blkif.h.html
 
 TBH I'm not sure it actually answers your questions wrt
 BLKIF_OP_FLUSH_DISKCACHE, if not please let us know and we can see about
 improving it.

That description in there is overly simple, and does not match any of the
implementations known to me on either end.

Talking about those: the mainline Linux blkback backend also implements
different semantics from what mainline Linux blkfront seems to expect,
as well as different from qemu.  Looking at these three alone I can't see
how Xen ever managed to get data to disk reliably if using the paravirt
interface.
with the implementations in qemu and the Linux kernel frontend and backends,
which

 
 Ian
 
---end quoted text---



[Qemu-devel] [PATCH v3 07/15] target-i386: Add model-id property to X86CPU

2012-04-25 Thread Andreas Färber
Signed-off-by: Andreas Färber afaer...@suse.de
Reviewed-by: Eduardo Habkost ehabk...@redhat.com
Reviewed-by: Igor Mammedov imamm...@redhat.com
---
 target-i386/cpu.c |   10 --
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 82194dd..bb57345 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -673,8 +673,11 @@ static void x86_cpuid_version_set_stepping(Object *obj, 
Visitor *v,
 env-cpuid_version |= value  0xf;
 }
 
-static void x86_cpuid_set_model_id(CPUX86State *env, const char *model_id)
+static void x86_cpuid_set_model_id(Object *obj, const char *model_id,
+   Error **errp)
 {
+X86CPU *cpu = X86_CPU(obj);
+CPUX86State *env = cpu-env;
 int c, len, i;
 
 if (model_id == NULL) {
@@ -1004,7 +1007,7 @@ int cpu_x86_register(X86CPU *cpu, const char *cpu_model)
 env-cpuid_ext3_features = TCG_EXT3_FEATURES;
 env-cpuid_svm_features = TCG_SVM_FEATURES;
 }
-x86_cpuid_set_model_id(env, def-model_id);
+object_property_set_str(OBJECT(cpu), def-model_id, model-id, error);
 if (error_is_set(error)) {
 error_free(error);
 return -1;
@@ -1543,6 +1546,9 @@ static void x86_cpu_initfn(Object *obj)
 object_property_add(obj, stepping, int,
 NULL,
 x86_cpuid_version_set_stepping, NULL, NULL, NULL);
+object_property_add_str(obj, model-id,
+NULL,
+x86_cpuid_set_model_id, NULL);
 
 env-cpuid_apic_id = env-cpu_index;
 mce_init(cpu);
-- 
1.7.7




[Qemu-devel] [PATCH 4/9] qxl: fix 80 chars line

2012-04-25 Thread Alon Levy
Signed-off-by: Alon Levy al...@redhat.com
---
 hw/qxl.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/qxl.c b/hw/qxl.c
index 8b66cbb..b22f86e 100644
--- a/hw/qxl.c
+++ b/hw/qxl.c
@@ -777,8 +777,8 @@ static void interface_async_complete_io(PCIQXLDevice *qxl, 
QXLCookie *cookie)
 }
 if (cookie  current_async != cookie-io) {
 fprintf(stderr,
-qxl: %s: error: current_async = %d != % PRId64  = 
cookie-io\n,
-__func__, current_async, cookie-io);
+qxl: %s: error: current_async = %d != %
+PRId64  = cookie-io\n, __func__, current_async, cookie-io);
 }
 switch (current_async) {
 case QXL_IO_MEMSLOT_ADD_ASYNC:
-- 
1.7.10




[Qemu-devel] [PATCH 5/9] qxl: don't abort on guest trigerrable ring indices mismatch

2012-04-25 Thread Alon Levy
Signed-off-by: Alon Levy al...@redhat.com
---
 hw/qxl.c |   51 +++
 1 file changed, 39 insertions(+), 12 deletions(-)

diff --git a/hw/qxl.c b/hw/qxl.c
index b22f86e..44a4c9b 100644
--- a/hw/qxl.c
+++ b/hw/qxl.c
@@ -27,28 +27,42 @@
 
 #include qxl.h
 
+/*
+ * NOTE: SPICE_RING_PROD_ITEM accesses memory on the pci bar and as
+ * such can be changed by the guest, so to avoid a guest trigerrable
+ * abort we just set qxl_guest_bug and set the return to NULL. Still
+ * it may happen as a result of emulator bug as well.
+ */
 #undef SPICE_RING_PROD_ITEM
-#define SPICE_RING_PROD_ITEM(r, ret) {  \
+#define SPICE_RING_PROD_ITEM(qxl, r, ret) { \
 typeof(r) start = r;\
 typeof(r) end = r + 1;  \
 uint32_t prod = (r)-prod  SPICE_RING_INDEX_MASK(r);   \
 typeof((r)-items[prod]) m_item = (r)-items[prod];   \
 if (!((uint8_t*)m_item = (uint8_t*)(start)  (uint8_t*)(m_item + 1) 
= (uint8_t*)(end))) { \
-abort();\
+qxl_guest_bug(qxl, SPICE_RING_PROD_ITEM indices mismatch  \
+  ! %p = %p  %p, (uint8_t *)start,  \
+  (uint8_t *)m_item, (uint8_t *)end);   \
+ret = NULL; \
+} else {\
+ret = m_item-el;  \
 }   \
-ret = m_item-el;  \
 }
 
 #undef SPICE_RING_CONS_ITEM
-#define SPICE_RING_CONS_ITEM(r, ret) {  \
+#define SPICE_RING_CONS_ITEM(qxl, r, ret) { \
 typeof(r) start = r;\
 typeof(r) end = r + 1;  \
 uint32_t cons = (r)-cons  SPICE_RING_INDEX_MASK(r);   \
 typeof((r)-items[cons]) m_item = (r)-items[cons];   \
 if (!((uint8_t*)m_item = (uint8_t*)(start)  (uint8_t*)(m_item + 1) 
= (uint8_t*)(end))) { \
-abort();\
+qxl_guest_bug(qxl, SPICE_RING_CONS_ITEM indices mismatch  \
+  ! %p = %p  %p, (uint8_t *)start,  \
+  (uint8_t *)m_item, (uint8_t *)end);   \
+ret = NULL; \
+} else {\
+ret = m_item-el;  \
 }   \
-ret = m_item-el;  \
 }
 
 #undef ALIGN
@@ -343,7 +357,8 @@ static void init_qxl_ram(PCIQXLDevice *d)
 SPICE_RING_INIT(d-ram-cmd_ring);
 SPICE_RING_INIT(d-ram-cursor_ring);
 SPICE_RING_INIT(d-ram-release_ring);
-SPICE_RING_PROD_ITEM(d-ram-release_ring, item);
+SPICE_RING_PROD_ITEM(d, d-ram-release_ring, item);
+assert(item);
 *item = 0;
 qxl_ring_set_dirty(d);
 }
@@ -559,8 +574,10 @@ static int interface_get_command(QXLInstance *sin, struct 
QXLCommandExt *ext)
 if (SPICE_RING_IS_EMPTY(ring)) {
 return false;
 }
-trace_qxl_ring_command_get(qxl-id, qxl_mode_to_string(qxl-mode));
-SPICE_RING_CONS_ITEM(ring, cmd);
+SPICE_RING_CONS_ITEM(qxl, ring, cmd);
+if (!cmd) {
+return false;
+}
 ext-cmd  = *cmd;
 ext-group_id = MEMSLOT_GROUP_GUEST;
 ext-flags= qxl-cmdflags;
@@ -572,6 +589,7 @@ static int interface_get_command(QXLInstance *sin, struct 
QXLCommandExt *ext)
 qxl-guest_primary.commands++;
 qxl_track_command(qxl, ext);
 qxl_log_command(qxl, cmd, ext);
+trace_qxl_ring_command_get(qxl-id, qxl_mode_to_string(qxl-mode));
 return true;
 default:
 return false;
@@ -630,7 +648,10 @@ static inline void qxl_push_free_res(PCIQXLDevice *d, int 
flush)
 if (notify) {
 qxl_send_events(d, QXL_INTERRUPT_DISPLAY);
 }
-SPICE_RING_PROD_ITEM(ring, item);
+SPICE_RING_PROD_ITEM(d, ring, item);
+if (!item) {
+return;
+}
 *item = 0;
 d-num_free_res = 0;
 d-last_release = NULL;
@@ -656,7 +677,10 @@ static void interface_release_resource(QXLInstance *sin,
  * pci bar 0, $command.release_info
  */
 ring = qxl-ram-release_ring;
-SPICE_RING_PROD_ITEM(ring, item);
+SPICE_RING_PROD_ITEM(qxl, ring, item);
+if (!item) {
+return;
+}
 if (*item == 0) {
 /* stick head 

Re: [Qemu-devel] [PATCHv2 1/3] virtio: add missing mb() on notification

2012-04-25 Thread Michael S. Tsirkin
On Wed, Apr 25, 2012 at 04:38:50PM +1000, David Gibson wrote:
 On Tue, Apr 24, 2012 at 03:46:25PM +0200, Paolo Bonzini wrote:
  Il 23/04/2012 15:19, Michael S. Tsirkin ha scritto:
 [snip]
#elif defined(_ARCH_PPC)

/*
   - * We use an eieio() for a wmb() on powerpc.  This assumes we don't
   + * We use an eieio() for wmb() and mb() on powerpc.  This assumes we 
   don't
 * need to order cacheable and non-cacheable stores with respect to
 * each other
 */
#define smp_wmb()   asm volatile(eieio ::: memory)
   +#define smp_mb()   asm volatile(eieio ::: memory)
  
  smp_mb() is hwsync under PPC, but I would just trust GCC.
 
 I assume you mean 'lwsync', no such thing as 'hwsync', afaik.  And I
 assume you're talking about the kernel here.
 
 So, the situation in qemu is different from in the kernel, because as
 far as I know there's no case in qemu where we need to synchronize
 cacheable stores with non-cacheable (I/O) stores.  eieio won't do
 that, but it will order cacheable stores w.r.t. other cacheable
 stores.  I think __sync_synchronize() will be a 'sync', the most
 heavyweight memory barrier on ppc.

kernel actually seems to make smp_wmb() an eieio as well.
that does not order reads so smp_rmb() is an lwsync if
supported and sync if not.

 -- 
 David Gibson  | I'll have my music baroque, and my code
 david AT gibson.dropbear.id.au| minimalist, thank you.  NOT _the_ 
 _other_
   | _way_ _around_!
 http://www.ozlabs.org/~dgibson



[Qemu-devel] [PATCH 7/9] qxl: interface_notify_update: remove guest trigerrable abort

2012-04-25 Thread Alon Levy
Signed-off-by: Alon Levy al...@redhat.com
---
 hw/qxl.c |9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/hw/qxl.c b/hw/qxl.c
index 6e7232c..44ee495 100644
--- a/hw/qxl.c
+++ b/hw/qxl.c
@@ -768,8 +768,13 @@ static int interface_req_cursor_notification(QXLInstance 
*sin)
 /* called from spice server thread context */
 static void interface_notify_update(QXLInstance *sin, uint32_t update_id)
 {
-fprintf(stderr, %s: abort()\n, __FUNCTION__);
-abort();
+/*
+ * Called by spice-server as a result of a QXL_CMD_UPDATE which is not in
+ * use by xf86-video-qxl and is defined out in the qxl windows driver.
+ * Probably was at some earlier version that is prior to git start (2009),
+ * and is still guest trigerrable.
+ */
+fprintf(stderr, %s: deprecated\n, __func__);
 }
 
 /* called from spice server thread context only */
-- 
1.7.10




[Qemu-devel] [PATCH v3 13/15] target-i386: Introduce xlevel property for X86CPU

2012-04-25 Thread Andreas Färber
Signed-off-by: Andreas Färber afaer...@suse.de
Reviewed-by: Eduardo Habkost ehabk...@redhat.com
Reviewed-by: Igor Mammedov imamm...@redhat.com
---
 target-i386/cpu.c |   38 +-
 1 files changed, 37 insertions(+), 1 deletions(-)

diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 5b03c47..deac4a7 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -744,6 +744,39 @@ static void x86_cpuid_set_level(Object *obj, Visitor *v, 
void *opaque,
 cpu-env.cpuid_level = value;
 }
 
+static void x86_cpuid_get_xlevel(Object *obj, Visitor *v, void *opaque,
+ const char *name, Error **errp)
+{
+X86CPU *cpu = X86_CPU(obj);
+int64_t value;
+
+value = cpu-env.cpuid_xlevel;
+/* TODO Use visit_type_uint32() once available */
+visit_type_int(v, value, name, errp);
+}
+
+static void x86_cpuid_set_xlevel(Object *obj, Visitor *v, void *opaque,
+ const char *name, Error **errp)
+{
+X86CPU *cpu = X86_CPU(obj);
+const int64_t min = 0;
+const int64_t max = UINT32_MAX;
+int64_t value;
+
+/* TODO Use visit_type_uint32() once available */
+visit_type_int(v, value, name, errp);
+if (error_is_set(errp)) {
+return;
+}
+if (value  min || value  max) {
+error_set(errp, QERR_PROPERTY_VALUE_OUT_OF_RANGE, ,
+  name ? name : null, value, min, max);
+return;
+}
+
+cpu-env.cpuid_xlevel = value;
+}
+
 static char *x86_cpuid_get_model_id(Object *obj, Error **errp)
 {
 X86CPU *cpu = X86_CPU(obj);
@@ -1076,7 +1109,7 @@ int cpu_x86_register(X86CPU *cpu, const char *cpu_model)
 env-cpuid_ext_features = def-ext_features;
 env-cpuid_ext2_features = def-ext2_features;
 env-cpuid_ext3_features = def-ext3_features;
-env-cpuid_xlevel = def-xlevel;
+object_property_set_int(OBJECT(cpu), def-xlevel, xlevel, error);
 env-cpuid_kvm_features = def-kvm_features;
 env-cpuid_svm_features = def-svm_features;
 env-cpuid_ext4_features = def-ext4_features;
@@ -1635,6 +1668,9 @@ static void x86_cpu_initfn(Object *obj)
 object_property_add(obj, level, int,
 x86_cpuid_get_level,
 x86_cpuid_set_level, NULL, NULL, NULL);
+object_property_add(obj, xlevel, int,
+x86_cpuid_get_xlevel,
+x86_cpuid_set_xlevel, NULL, NULL, NULL);
 object_property_add_str(obj, model-id,
 x86_cpuid_get_model_id,
 x86_cpuid_set_model_id, NULL);
-- 
1.7.7




[Qemu-devel] [PATCH v3 04/15] target-i386: Add family property to X86CPU

2012-04-25 Thread Andreas Färber
Add the property early in the initfn so that it can be used in helpers
such as mce_init().

Signed-off-by: Andreas Färber afaer...@suse.de
Reviewed-by: Eduardo Habkost ehabk...@redhat.com
[AF: Add an error_free(), spotted by Michael Roth]
Reviewed-by: Igor Mammedov imamm...@redhat.com
---
 target-i386/cpu.c |   39 ++-
 1 files changed, 34 insertions(+), 5 deletions(-)

diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 5cebb3d..9eb5738 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -27,6 +27,8 @@
 #include qemu-option.h
 #include qemu-config.h
 
+#include qapi/qapi-visit-core.h
+
 #include hyperv.h
 
 /* feature flags taken from Intel Processor Identification and the CPUID
@@ -597,13 +599,30 @@ static int check_features_against_host(x86_def_t 
*guest_def)
 return rv;
 }
 
-static void x86_cpuid_version_set_family(CPUX86State *env, int family)
+static void x86_cpuid_version_set_family(Object *obj, Visitor *v, void *opaque,
+ const char *name, Error **errp)
 {
+X86CPU *cpu = X86_CPU(obj);
+CPUX86State *env = cpu-env;
+const int64_t min = 0;
+const int64_t max = 0xff + 0xf;
+int64_t value;
+
+visit_type_int(v, value, name, errp);
+if (error_is_set(errp)) {
+return;
+}
+if (value  min || value  max) {
+error_set(errp, QERR_PROPERTY_VALUE_OUT_OF_RANGE, ,
+  name ? name : null, value, min, max);
+return;
+}
+
 env-cpuid_version = ~0xff00f00;
-if (family  0x0f) {
-env-cpuid_version |= 0xf00 | ((family - 0x0f)  20);
+if (value  0x0f) {
+env-cpuid_version |= 0xf00 | ((value - 0x0f)  20);
 } else {
-env-cpuid_version |= family  8;
+env-cpuid_version |= value  8;
 }
 }
 
@@ -909,6 +928,7 @@ int cpu_x86_register(X86CPU *cpu, const char *cpu_model)
 {
 CPUX86State *env = cpu-env;
 x86_def_t def1, *def = def1;
+Error *error = NULL;
 
 memset(def, 0, sizeof(*def));
 
@@ -925,7 +945,7 @@ int cpu_x86_register(X86CPU *cpu, const char *cpu_model)
 }
 env-cpuid_vendor_override = def-vendor_override;
 env-cpuid_level = def-level;
-x86_cpuid_version_set_family(env, def-family);
+object_property_set_int(OBJECT(cpu), def-family, family, error);
 x86_cpuid_version_set_model(env, def-model);
 x86_cpuid_version_set_stepping(env, def-stepping);
 env-cpuid_features = def-features;
@@ -950,6 +970,10 @@ int cpu_x86_register(X86CPU *cpu, const char *cpu_model)
 env-cpuid_svm_features = TCG_SVM_FEATURES;
 }
 x86_cpuid_set_model_id(env, def-model_id);
+if (error_is_set(error)) {
+error_free(error);
+return -1;
+}
 return 0;
 }
 
@@ -1474,6 +1498,11 @@ static void x86_cpu_initfn(Object *obj)
 CPUX86State *env = cpu-env;
 
 cpu_exec_init(env);
+
+object_property_add(obj, family, int,
+NULL,
+x86_cpuid_version_set_family, NULL, NULL, NULL);
+
 env-cpuid_apic_id = env-cpu_index;
 mce_init(cpu);
 }
-- 
1.7.7




[Qemu-devel] [PATCH v3 11/15] target-i386: Add property getter for CPU model-id

2012-04-25 Thread Andreas Färber
Signed-off-by: Andreas Färber afaer...@suse.de
Reviewed-by: Eduardo Habkost ehabk...@redhat.com
Reviewed-by: Igor Mammedov imamm...@redhat.com
---
 target-i386/cpu.c |   17 -
 1 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 2ff5142..8b5c47d 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -711,6 +711,21 @@ static void x86_cpuid_version_set_stepping(Object *obj, 
Visitor *v,
 env-cpuid_version |= value  0xf;
 }
 
+static char *x86_cpuid_get_model_id(Object *obj, Error **errp)
+{
+X86CPU *cpu = X86_CPU(obj);
+CPUX86State *env = cpu-env;
+char *value;
+int i;
+
+value = g_malloc(48 + 1);
+for (i = 0; i  48; i++) {
+value[i] = env-cpuid_model[i  2]  (8 * (i  3));
+}
+value[48] = '\0';
+return value;
+}
+
 static void x86_cpuid_set_model_id(Object *obj, const char *model_id,
Error **errp)
 {
@@ -1585,7 +1600,7 @@ static void x86_cpu_initfn(Object *obj)
 x86_cpuid_version_get_stepping,
 x86_cpuid_version_set_stepping, NULL, NULL, NULL);
 object_property_add_str(obj, model-id,
-NULL,
+x86_cpuid_get_model_id,
 x86_cpuid_set_model_id, NULL);
 
 env-cpuid_apic_id = env-cpu_index;
-- 
1.7.7




Re: [Qemu-devel] [PATCH v2 1/6] block: use Error mechanism instead of -errno for block_job_create()

2012-04-25 Thread Stefan Hajnoczi
On Tue, Apr 24, 2012 at 7:35 PM, Luiz Capitulino lcapitul...@redhat.com wrote:
 On Tue, 24 Apr 2012 14:53:55 +0100
 Stefan Hajnoczi stefa...@linux.vnet.ibm.com wrote:

 The block job API uses -errno return values internally and we convert
 these to Error in the QMP functions.  This is ugly because the Error
 should be created at the point where we still have all the relevant
 information.  More importantly, it is hard to add new error cases to
 this case since we quickly run out of -errno values without losing
 information.

 Go ahead an use Error directly and don't convert later.

 Signed-off-by: Stefan Hajnoczi stefa...@linux.vnet.ibm.com
 ---
  block.c        |    4 +++-
  block/stream.c |   11 +--
  block_int.h    |   11 +++
  blockdev.c     |   16 +---
  4 files changed, 20 insertions(+), 22 deletions(-)

 diff --git a/block.c b/block.c
 index fe74ddd..2b72a0f 100644
 --- a/block.c
 +++ b/block.c
 @@ -4083,11 +4083,13 @@ out:
  }

  void *block_job_create(const BlockJobType *job_type, BlockDriverState *bs,
 -                       BlockDriverCompletionFunc *cb, void *opaque)
 +                       BlockDriverCompletionFunc *cb, void *opaque,
 +                       Error **errp)
  {
      BlockJob *job;

      if (bs-job || bdrv_in_use(bs)) {
 +        error_set(errp, QERR_DEVICE_IN_USE, bdrv_get_device_name(bs));
          return NULL;
      }
      bdrv_set_in_use(bs, 1);
 diff --git a/block/stream.c b/block/stream.c
 index 0efe1ad..7002dc8 100644
 --- a/block/stream.c
 +++ b/block/stream.c
 @@ -280,16 +280,16 @@ static BlockJobType stream_job_type = {
      .set_speed     = stream_set_speed,
  };

 -int stream_start(BlockDriverState *bs, BlockDriverState *base,
 -                 const char *base_id, BlockDriverCompletionFunc *cb,
 -                 void *opaque)
 +void stream_start(BlockDriverState *bs, BlockDriverState *base,
 +                  const char *base_id, BlockDriverCompletionFunc *cb,
 +                  void *opaque, Error **errp)
  {
      StreamBlockJob *s;
      Coroutine *co;

 -    s = block_job_create(stream_job_type, bs, cb, opaque);
 +    s = block_job_create(stream_job_type, bs, cb, opaque, errp);
      if (!s) {
 -        return -EBUSY; /* bs must already be in use */
 +        return;
      }

      s-base = base;
 @@ -300,5 +300,4 @@ int stream_start(BlockDriverState *bs, BlockDriverState 
 *base,
      co = qemu_coroutine_create(stream_run);
      trace_stream_start(bs, base, s, co, opaque);
      qemu_coroutine_enter(co, s);
 -    return 0;
  }
 diff --git a/block_int.h b/block_int.h
 index 0acb49f..8cf6ce9 100644
 --- a/block_int.h
 +++ b/block_int.h
 @@ -346,6 +346,7 @@ int is_windows_drive(const char *filename);
   * @bs: The block
   * @cb: Completion function for the job.
   * @opaque: Opaque pointer value passed to @cb.
 + * @errp: A location to return DeviceInUse.

 Quite minor, but this is not a good description. I'd say just Error object.

I followed the style of the glib documentation for GError** arguments.
 I'm happy to change to just Error object.


   *
   * Create a new long-running block device job and return it.  The job
   * will call @cb asynchronously when the job completes.  Note that
 @@ -357,7 +358,8 @@ int is_windows_drive(const char *filename);
   * called from a wrapper that is specific to the job type.
   */
  void *block_job_create(const BlockJobType *job_type, BlockDriverState *bs,
 -                       BlockDriverCompletionFunc *cb, void *opaque);
 +                       BlockDriverCompletionFunc *cb, void *opaque,
 +                       Error **errp);

  /**
   * block_job_complete:
 @@ -417,6 +419,7 @@ void block_job_cancel_sync(BlockJob *job);
   * backing file if the job completes.  Ignored if @base is %NULL.
   * @cb: Completion function for the job.
   * @opaque: Opaque pointer value passed to @cb.
 + * @errp: A location to return DeviceInUse.
   *
   * Start a streaming operation on @bs.  Clusters that are unallocated
   * in @bs, but allocated in any image between @base and @bs (both
 @@ -424,8 +427,8 @@ void block_job_cancel_sync(BlockJob *job);
   * streaming job, the backing file of @bs will be changed to
   * @base_id in the written image and to @base in the live BlockDriverState.
   */
 -int stream_start(BlockDriverState *bs, BlockDriverState *base,
 -                 const char *base_id, BlockDriverCompletionFunc *cb,
 -                 void *opaque);
 +void stream_start(BlockDriverState *bs, BlockDriverState *base,
 +                  const char *base_id, BlockDriverCompletionFunc *cb,
 +                  void *opaque, Error **errp);

  #endif /* BLOCK_INT_H */
 diff --git a/blockdev.c b/blockdev.c
 index 0c2440e..a411477 100644
 --- a/blockdev.c
 +++ b/blockdev.c
 @@ -1095,7 +1095,7 @@ void qmp_block_stream(const char *device, bool 
 has_base,
  {
      BlockDriverState *bs;
      BlockDriverState *base_bs = NULL;
 -    int ret;
 +    Error *local_err = NULL;

      bs = 

Re: [Qemu-devel] [PATCH v2 4/6] block: add 'speed' optional parameter to block-stream

2012-04-25 Thread Stefan Hajnoczi
On Tue, Apr 24, 2012 at 8:14 PM, Luiz Capitulino lcapitul...@redhat.com wrote:
  # Returns: Nothing on success
  #          If streaming is already active on this device, DeviceInUse
  #          If @device does not exist, DeviceNotFound
  #          If image streaming is not supported by this device, NotSupported
  #          If @base does not exist, BaseNotFound
 +#          If @speed is invalid, BlockJobSpeedInvalid

 This should be InvalidParameter, right?

You are right.  Thanks for pointing this out.

Stefan



Re: [Qemu-devel] [PATCH 3/4] block: add 'speed' optional parameter to block-stream

2012-04-25 Thread Stefan Hajnoczi
On Tue, Apr 24, 2012 at 8:31 PM, Luiz Capitulino lcapitul...@redhat.com wrote:
 On Mon, 23 Apr 2012 16:39:48 +0100
 Stefan Hajnoczi stefa...@linux.vnet.ibm.com wrote:

 Allow streaming operations to be started with an initial speed limit.
 This eliminates the window of time between starting streaming and
 issuing block-job-set-speed.  Users should use the new optional 'speed'
 parameter instead so that speed limits are in effect immediately when
 the job starts.

 Signed-off-by: Stefan Hajnoczi stefa...@linux.vnet.ibm.com
 ---
  block.c          |   18 --
  block/stream.c   |    5 +++--
  block_int.h      |    9 ++---
  blockdev.c       |    6 --
  hmp-commands.hx  |    4 ++--
  hmp.c            |    4 +++-
  qapi-schema.json |    6 +-
  qmp-commands.hx  |    2 +-
  8 files changed, 40 insertions(+), 14 deletions(-)

 diff --git a/block.c b/block.c
 index 7056d8c..e3c1483 100644
 --- a/block.c
 +++ b/block.c
 @@ -4072,8 +4072,8 @@ out:
  }

  void *block_job_create(const BlockJobType *job_type, BlockDriverState *bs,
 -                       BlockDriverCompletionFunc *cb, void *opaque,
 -                       Error **errp)
 +                       int64_t speed, BlockDriverCompletionFunc *cb,
 +                       void *opaque, Error **errp)
  {
      BlockJob *job;

 @@ -4089,6 +4089,20 @@ void *block_job_create(const BlockJobType *job_type, 
 BlockDriverState *bs,
      job-cb            = cb;
      job-opaque        = opaque;
      bs-job = job;
 +
 +    /* Only set speed when necessary to avoid NotSupported error */
 +    if (speed != 0) {

 Missed this small detail. Ideally, you should test against has_speed, but
 I think that there are only two possibilities for a false negativehere:
 1. the client/user expects speed=0 to work 2. 'speed' is (probably
 incorrectly) initialized to some value != 0.

By the time we get here we've already checked has_speed and set
speed=0 when has_speed=false.  (The qmp marshaller generated code does
indeed leave the int64_t uninitialized.)

Stefan



Re: [Qemu-devel] [PATCH v2 0/6] block: add optional 'speed' parameter to block-stream

2012-04-25 Thread Stefan Hajnoczi
On Tue, Apr 24, 2012 at 8:31 PM, Luiz Capitulino lcapitul...@redhat.com wrote:
 On Tue, 24 Apr 2012 14:53:54 +0100
 Stefan Hajnoczi stefa...@linux.vnet.ibm.com wrote:

 Eric Blake raised concerns about the inability to start block jobs with a 
 speed
 limit.  Current the user needs to follow up the block-stream command with
 block-job-set-speed.  There is a window of time while the new block job is
 running but block-job-set-speed has not been processed yet.

 This series adds an optional 'speed' parameter to block-stream so streaming 
 can
 be started with a speed limit that takes effect immediately.

 For consistency it also renames the block-job-set-speed parameter from 
 'value'
 to 'speed'.  This is externally visible, but this API has not been in a QEMU
 release yet so we can still do this.

 I considered several other approaches, including adding a
 default_block_job_speed field to BlockDriverState but ultimately the cleanest
 solution is to pass in a speed parameter on job creation.  This way we do not
 change semantics of existing commands, we only add an optional parameter.  We
 also do not need to add state to BlockDriverState, which is already huge and
 messy.

 The last patch fixes a small bug I found in qemu-iotests 030.

 Looks good to me. Is this expected to go through my tree?

It probably should.  The block: prefix to this series would probably
best be qmp: :).

I will send out a v3 including the cleanups that have been suggested.

Stefan



[Qemu-devel] [HACK] hda: expose microphone instead of line-in

2012-04-25 Thread Jan Kiszka
Hi Gerd,

I had problems with Windows LiveMeeting expecting a microphone as
input. But the HDA model only exposes a line-in port. The following hack
works for me, but I bet there is a cleaner solution. Any suggestions?

BTW, sound output quality of a Win7 guest on my Linux hosts sucks while
it's fine for a Linux guest. I vaguely recall that Windows requests a
too small DAC buffer, is that true? Is there anything one can do about
this?

Jan


diff --git a/hw/hda-audio.c b/hw/hda-audio.c
index 8995519..bf28969 100644
--- a/hw/hda-audio.c
+++ b/hw/hda-audio.c
@@ -411,7 +411,7 @@ static const desc_node duplex_nodes[] = {
 .params  = duplex_params_audio_linein,
 .nparams = ARRAY_SIZE(duplex_params_audio_linein),
 .config  = ((AC_JACK_PORT_COMPLEX  AC_DEFCFG_PORT_CONN_SHIFT) |
-(AC_JACK_LINE_IN   AC_DEFCFG_DEVICE_SHIFT)|
+(AC_JACK_MIC_INAC_DEFCFG_DEVICE_SHIFT)|
 (AC_JACK_CONN_UNKNOWN  AC_DEFCFG_CONN_TYPE_SHIFT) |
 (AC_JACK_COLOR_RED AC_DEFCFG_COLOR_SHIFT) |
 0x20),

-- 
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux



Re: [Qemu-devel] [PATCH v2 4/6] block: add 'speed' optional parameter to block-stream

2012-04-25 Thread Kevin Wolf
Am 24.04.2012 15:53, schrieb Stefan Hajnoczi:
 diff --git a/qapi-schema.json b/qapi-schema.json
 index d56fcb6..b1e349f 100644
 --- a/qapi-schema.json
 +++ b/qapi-schema.json
 @@ -1571,15 +1571,19 @@
  #
  # @base:   #optional the common backing file name
  #
 +# @speed:  #optional the maximum speed, in bytes per second

Should mention that 0 means unlimited and is the default if the argument
is not specified.

That an explicit 0 (rather than leaving the argument out) is possible is
actually important for HMP, because there it's the only way to have a
base image, but no speed limit.

 +#
  # Returns: Nothing on success
  #  If streaming is already active on this device, DeviceInUse
  #  If @device does not exist, DeviceNotFound
  #  If image streaming is not supported by this device, NotSupported
  #  If @base does not exist, BaseNotFound
 +#  If @speed is invalid, BlockJobSpeedInvalid
  #
  # Since: 1.1
  ##
 -{ 'command': 'block-stream', 'data': { 'device': 'str', '*base': 'str' } }
 +{ 'command': 'block-stream', 'data': { 'device': 'str', '*base': 'str',
 +   '*speed': 'int' } }

Kevin



Re: [Qemu-devel] [Xen-devel] [PATCH] xen_disk: implement BLKIF_OP_FLUSH_DISKCACHE, remove BLKIF_OP_WRITE_BARRIER

2012-04-25 Thread Stefano Stabellini
On Wed, 25 Apr 2012, Christoph Hellwig wrote:
 On Wed, Apr 25, 2012 at 10:02:45AM +0100, Ian Campbell wrote:
  The blkif spec was recently much improved, you can find it at
  http://xenbits.xen.org/docs/unstable/hypercall/include,public,io,blkif.h.html
  
  TBH I'm not sure it actually answers your questions wrt
  BLKIF_OP_FLUSH_DISKCACHE, if not please let us know and we can see about
  improving it.
 
 That description in there is overly simple, and does not match any of the
 implementations known to me on either end.

That is true, in fact I couldn't figure out what I had to implement just
reading the comment. So I went through the blkback code and tried to
understand what I had to do, but I got it wrong.

Reading the code again it seems to me that BLKIF_OP_FLUSH_DISKCACHE
is supposed to have the same semantics as REQ_FLUSH, that implies a
preflush if nr_segments  0, not a postflush like I did.

Konrad, can you please confirm this?



Re: [Qemu-devel] [PATCH v2 0/6] block: add optional 'speed' parameter to block-stream

2012-04-25 Thread Kevin Wolf
Am 25.04.2012 12:57, schrieb Stefan Hajnoczi:
 On Tue, Apr 24, 2012 at 8:31 PM, Luiz Capitulino lcapitul...@redhat.com 
 wrote:
 On Tue, 24 Apr 2012 14:53:54 +0100
 Stefan Hajnoczi stefa...@linux.vnet.ibm.com wrote:

 Eric Blake raised concerns about the inability to start block jobs with a 
 speed
 limit.  Current the user needs to follow up the block-stream command with
 block-job-set-speed.  There is a window of time while the new block job is
 running but block-job-set-speed has not been processed yet.

 This series adds an optional 'speed' parameter to block-stream so streaming 
 can
 be started with a speed limit that takes effect immediately.

 For consistency it also renames the block-job-set-speed parameter from 
 'value'
 to 'speed'.  This is externally visible, but this API has not been in a QEMU
 release yet so we can still do this.

 I considered several other approaches, including adding a
 default_block_job_speed field to BlockDriverState but ultimately the 
 cleanest
 solution is to pass in a speed parameter on job creation.  This way we do 
 not
 change semantics of existing commands, we only add an optional parameter.  
 We
 also do not need to add state to BlockDriverState, which is already huge and
 messy.

 The last patch fixes a small bug I found in qemu-iotests 030.

 Looks good to me. Is this expected to go through my tree?
 
 It probably should.  The block: prefix to this series would probably
 best be qmp: :).
 
 I will send out a v3 including the cleanups that have been suggested.

If this is going to be merged through Luiz' tree, you can add an:

Acked-by: Kevin Wolf kw...@redhat.com



Re: [Qemu-devel] [Xen-devel] [PATCH] xen_disk: implement BLKIF_OP_FLUSH_DISKCACHE, remove BLKIF_OP_WRITE_BARRIER

2012-04-25 Thread Ian Campbell
On Wed, 2012-04-25 at 12:21 +0100, Stefano Stabellini wrote:
 On Wed, 25 Apr 2012, Christoph Hellwig wrote:
  On Wed, Apr 25, 2012 at 10:02:45AM +0100, Ian Campbell wrote:
   The blkif spec was recently much improved, you can find it at
   http://xenbits.xen.org/docs/unstable/hypercall/include,public,io,blkif.h.html
   
   TBH I'm not sure it actually answers your questions wrt
   BLKIF_OP_FLUSH_DISKCACHE, if not please let us know and we can see about
   improving it.
  
  That description in there is overly simple, and does not match any of the
  implementations known to me on either end.
 
 That is true, in fact I couldn't figure out what I had to implement just
 reading the comment. So I went through the blkback code and tried to
 understand what I had to do, but I got it wrong.
 
 Reading the code again it seems to me that BLKIF_OP_FLUSH_DISKCACHE
 is supposed to have the same semantics as REQ_FLUSH, that implies a
 preflush if nr_segments  0, not a postflush like I did.
 
 Konrad, can you please confirm this?

... and then provide a patch to blkif.h.

Thanks,

Ian.





Re: [Qemu-devel] [Xen-devel] [PATCH] xen_disk: implement BLKIF_OP_FLUSH_DISKCACHE, remove BLKIF_OP_WRITE_BARRIER

2012-04-25 Thread Christoph Hellwig
On Wed, Apr 25, 2012 at 12:21:53PM +0100, Stefano Stabellini wrote:
 That is true, in fact I couldn't figure out what I had to implement just
 reading the comment. So I went through the blkback code and tried to
 understand what I had to do, but I got it wrong.
 
 Reading the code again it seems to me that BLKIF_OP_FLUSH_DISKCACHE
 is supposed to have the same semantics as REQ_FLUSH, that implies a
 preflush if nr_segments  0, not a postflush like I did.

It's worse - blkfront translates both a REQ_FLUSH or a REQ_FUA
into BLKIF_OP_FLUSH_DISKCACHE.

REQ_FLUSH either is a pre flush or a pure flush without a data transfer,
and REQ_FUA is a post flush.  So to get the proper semantics you'll have
to do both, _and_ sequence it so that no operation starts before the
previous one finished.




Re: [Qemu-devel] [PULL] xen patches

2012-04-25 Thread Stefano Stabellini
Anthony,
please ignore this pull request, I'll rework and resubmit later.


On Wed, 25 Apr 2012, Christoph Hellwig wrote:
 On Tue, Apr 24, 2012 at 12:28:35PM +0100, Stefano Stabellini wrote:
xen_disk: use bdrv_aio_flush instead of bdrv_flush
 
 This one seems completely broken, as it just queues up the flushes and
 writes without any ordering between them.  Linux filesystems absolutely
 rely on a REQ_FUA request which gets mapped to BLKIF_OP_FLUSH_DISKCACHE
 to flush the data it actually sent.
 
 I'm not sure who actually expects the preflush, but the only point
 in ever doing it would be to sequence it properly vs the write.

I see.. I need to make sure that the bdrv_aio_flush is fully completed
before issuing any reads or writes, not just ordered correctly: calling
bdrv_aio_flush before bdrv_aio_readv/writev is not enough.



Re: [Qemu-devel] [HACK] hda: expose microphone instead of line-in

2012-04-25 Thread Gerd Hoffmann
On 04/25/12 13:03, Jan Kiszka wrote:
 Hi Gerd,
 
 I had problems with Windows LiveMeeting expecting a microphone as
 input. But the HDA model only exposes a line-in port. The following hack
 works for me, but I bet there is a cleaner solution. Any suggestions?

Good to know this works.  /me has patches ready to go, was just waiting
for testing feedback ...

Pushed to git://git.kraxel.org/qemu audio.1

They do essentially the same, except that they leave the existing
hda-duplex code as-is and add a new hda-micro codec instead which
advertises the input as micro to the guest.

 BTW, sound output quality of a Win7 guest on my Linux hosts sucks while
 it's fine for a Linux guest. I vaguely recall that Windows requests a
 too small DAC buffer, is that true? Is there anything one can do about
 this?

Yes.  The buffer is ~ one page and can hold 20 ms of sound data, so
considering buffer flipping intel-hda has to shuffle data every 10ms,
and the windows guest needs to be scheduled too so it can re-fill the
other half of the buffer.  Which obviously makes sound playback *very*
sensitive to latencies anywhere in the qemu.

What you can do about it?  Dunno whenever windows allows to tweak the
buffer size somehow.  When I looked deeper at that a while back the
biggest latency issues in qemu used to be qxl, ide/qcow2 and vnc.  qcow2
should be fixed now with the switch to coroutines and full async i/o.
Likewise qxl, although this depends on recent guest drivers.  For vnc
enabling the threaded vnc server helps alot (without it moving around
windows leads to sound dropouts).

cheers,
  Gerd




Re: [Qemu-devel] [PATCH 3/4] block: add 'speed' optional parameter to block-stream

2012-04-25 Thread Luiz Capitulino
On Wed, 25 Apr 2012 11:56:51 +0100
Stefan Hajnoczi stefa...@gmail.com wrote:

 On Tue, Apr 24, 2012 at 8:31 PM, Luiz Capitulino lcapitul...@redhat.com 
 wrote:
  On Mon, 23 Apr 2012 16:39:48 +0100
  Stefan Hajnoczi stefa...@linux.vnet.ibm.com wrote:
 
  Allow streaming operations to be started with an initial speed limit.
  This eliminates the window of time between starting streaming and
  issuing block-job-set-speed.  Users should use the new optional 'speed'
  parameter instead so that speed limits are in effect immediately when
  the job starts.
 
  Signed-off-by: Stefan Hajnoczi stefa...@linux.vnet.ibm.com
  ---
   block.c          |   18 --
   block/stream.c   |    5 +++--
   block_int.h      |    9 ++---
   blockdev.c       |    6 --
   hmp-commands.hx  |    4 ++--
   hmp.c            |    4 +++-
   qapi-schema.json |    6 +-
   qmp-commands.hx  |    2 +-
   8 files changed, 40 insertions(+), 14 deletions(-)
 
  diff --git a/block.c b/block.c
  index 7056d8c..e3c1483 100644
  --- a/block.c
  +++ b/block.c
  @@ -4072,8 +4072,8 @@ out:
   }
 
   void *block_job_create(const BlockJobType *job_type, BlockDriverState *bs,
  -                       BlockDriverCompletionFunc *cb, void *opaque,
  -                       Error **errp)
  +                       int64_t speed, BlockDriverCompletionFunc *cb,
  +                       void *opaque, Error **errp)
   {
       BlockJob *job;
 
  @@ -4089,6 +4089,20 @@ void *block_job_create(const BlockJobType 
  *job_type, BlockDriverState *bs,
       job-cb            = cb;
       job-opaque        = opaque;
       bs-job = job;
  +
  +    /* Only set speed when necessary to avoid NotSupported error */
  +    if (speed != 0) {
 
  Missed this small detail. Ideally, you should test against has_speed, but
  I think that there are only two possibilities for a false negativehere:
  1. the client/user expects speed=0 to work 2. 'speed' is (probably
  incorrectly) initialized to some value != 0.
 
 By the time we get here we've already checked has_speed and set
 speed=0 when has_speed=false. 

Ah, true, but speed=0 is just ignored. In practice doesn't matter, in
theory would be good to be consistent.

 (The qmp marshaller generated code does
 indeed leave the int64_t uninitialized.)

I didn't know that. We could change that, but maybe it's a good idea to
force people to rely on the has_ bool.



Re: [Qemu-devel] [PATCH] tracetool: use Python 2.5-compatible exception handling syntax

2012-04-25 Thread Andreas Färber
Am 25.04.2012 11:42, schrieb Stefan Hajnoczi:
 The newer except exception-type as exception: syntax is not
 supported by Python 2.5, we need to use except exception-type,
 exception:.
 
 Tested all trace backends with Python 2.5.6.
 
 Reported-by: Andreas Färber afaer...@suse.de
 Signed-off-by: Stefan Hajnoczi stefa...@linux.vnet.ibm.com

Lightly

Tested-by: Andreas Färber andreas.faer...@web.de

Works with:
2.5.1 (Mac OS X v10.5.8),
2.6.1 (Mac OS X v10.6.8) and
2.6.4 (OpenIndiana oi_151a).

Thanks a lot!

However, it still breaks with different errors on Python 2.3.3 and 2.4.6
(Solaris 10 U9).

$ python scripts/tracetool.py --list-backends
Traceback (most recent call last):
  File scritps/tracetool.py, line 19, in ?
from tracetool import error_writem out
  File /export/home/andreas/QEMU/qemu/scripts/tracetool/__init__.py,
line 55
@staticmethod
^

$ python2.4 scripts/tracetool.py --list-backends
Traceback (most recent call last):
  File scripts/tracetool.py, line 138, in ?
main(sys.argv)
  File scripts/tracetool.py, line 93, in main
backends = tracetool.backend.get_list()
  File
/export/home/andreas/QEMU/qemu/scripts/tracetool/backend/__init__.py,
line 48, in get_list
for _, modname, _ in pkgutil.iter_modules(tracetool.backend.__path__):
AttributeError: 'module' object has no attribute 'iter_modules'

Seems like Python is not the ultimate better-than-POSIX compatibility
solution after all... :-/

Andreas

 ---
  scripts/tracetool.py |4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
 
 diff --git a/scripts/tracetool.py b/scripts/tracetool.py
 index cacfd99..c003cf6 100755
 --- a/scripts/tracetool.py
 +++ b/scripts/tracetool.py
 @@ -70,7 +70,7 @@ def main(args):
  
  try:
  opts, args = getopt.getopt(args[1:], , long_opts)
 -except getopt.GetoptError as err:
 +except getopt.GetoptError, err:
  error_opt(str(err))
  
  check_backend = False
 @@ -131,7 +131,7 @@ def main(args):
  try:
  tracetool.generate(sys.stdin, arg_format, arg_backend,
 binary = binary, probe_prefix = probe_prefix)
 -except tracetool.TracetoolError as e:
 +except tracetool.TracetoolError, e:
  error_opt(str(e))
  
  if __name__ == __main__:




[Qemu-devel] [PATCH] qemu-iotests: fix missing 'result' variable assignment in 030

2012-04-25 Thread Stefan Hajnoczi
We test this value after block-job-cancel but forget to actually assign
it.

Signed-off-by: Stefan Hajnoczi stefa...@linux.vnet.ibm.com
Acked-by: Kevin Wolf kw...@redhat.com
---
 tests/qemu-iotests/030 |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/qemu-iotests/030 b/tests/qemu-iotests/030
index 978fd82..8422d66 100755
--- a/tests/qemu-iotests/030
+++ b/tests/qemu-iotests/030
@@ -97,7 +97,7 @@ class TestStreamStop(ImageStreamingTestCase):
 events = self.vm.get_qmp_events(wait=False)
 self.assertEqual(events, [], 'unexpected QMP event: %s' % events)
 
-self.vm.qmp('block-job-cancel', device='drive0')
+result = self.vm.qmp('block-job-cancel', device='drive0')
 self.assert_qmp(result, 'return', {})
 
 cancelled = False
-- 
1.7.10




[Qemu-devel] [PATCH] Declare state directory in smb.conf

2012-04-25 Thread Nikolaus Rath
The smb.conf generated by the userspace networking does not include a state 
directory
directive. Samba therefore falls back to the default value. Since the user 
generally
does not have write access to this path, smbd immediately crashes.

The state directory option was added in Samba 3.4.0 (commit
http://gitweb.samba.org/?p=samba.git;a=commit;h=7b02e05eb64f3ffd7aa1cf027d10a7343c0da757).

This patch adds the missing option.

Signed-off-by:  Nikolaus Rath nikol...@rath.org
---
diff -r -u qemu-kvm-1.0.1.old/net/slirp.c qemu-kvm-1.0.1/net/slirp.c
--- qemu-kvm-1.0.1.old/net/slirp.c  2012-04-16 22:15:17.0 -0400
+++ qemu-kvm-1.0.1/net/slirp.c  2012-04-24 21:56:41.835745642 -0400
@@ -511,6 +511,7 @@
 socket address=127.0.0.1\n
 pid directory=%s\n
 lock directory=%s\n
+state directory=%s\n
 log file=%s/log.smbd\n
 smb passwd file=%s/smbpasswd\n
 security = share\n
@@ -521,6 +522,7 @@
 s-smb_dir,
 s-smb_dir,
 s-smb_dir,
+s-smb_dir,
 s-smb_dir,
 s-smb_dir,
 exported_dir

Best,

   -Nikolaus

-- 
 »Time flies like an arrow, fruit flies like a Banana.«

  PGP fingerprint: 5B93 61F8 4EA2 E279 ABF6  02CF A9AD B7F8 AE4E 425C



Re: [Qemu-devel] [PATCH 11/12] Migrate 64bit entries to 64bit pci regions

2012-04-25 Thread Kevin O'Connor
On Wed, Apr 25, 2012 at 06:25:07PM +1200, Alexey Korolev wrote:
 On 25/04/12 13:48, Kevin O'Connor wrote:
  On Tue, Apr 24, 2012 at 06:25:39PM +1200, Alexey Korolev wrote:
  +pci_region_map_entries(busses, r64_mem);
  +pci_region_map_entries(busses, r64_pref);
  +}
   // Map regions on each device.
  This doesn't look right to me.  This will map the devices on bus 0 to
  the proper 4g address, but devices on any subsequent bus will use
  busses[0].r[].base which will be reset to the 4gig address.  Perhaps
  pull base out of pci_region and make pci_region_map_entries()
  recursive?
 No recursion is need here!
 We map all entries which are 64bit on root bus.
 If entry is a bridge region - a corresponding bus address will be updated.
 Region won't be reseted to 4gig address as address is derived from parent 
 region only.

Okay - I missed that.  I think the patches look okay to be committed -
any additional changes can be made on top.  Gerd - do you have any
comments?

-Kevin



[Qemu-devel] Fwd: buildbot failure in qemu on ubuntu-default

2012-04-25 Thread Gerd Hoffmann


 Original Message 
Subject: buildbot failure in qemu on ubuntu-default
Date: Tue, 24 Apr 2012 21:28:11 +0200
From: build...@spunk.home.kraxel.org
To: kra...@gmail.com

The Buildbot has detected a failed build on builder ubuntu-default while
building qemu.
Full details are available at:
 http://spunk.home.kraxel.org/bb/builders/ubuntu-default/builds/52

Buildbot URL: http://spunk.home.kraxel.org/bb/

Buildslave for this Build: ubuntu-32

Build Reason: scheduler
Build Source Stamp: [branch master] cf36b31db209a261ee3bc2737e788e1ced0a1bec
Blamelist: Andreas Färber afaer...@suse.de,Eduardo Habkost
ehabk...@redhat.com,Kusanagi Kouichi sl...@ac.auone-net.jp,Peter
Chubb peter.ch...@nicta.com.au,Peter Portante
peter.porta...@redhat.com,Richard Henderson r...@twiddle.net,Stefan
Weil s...@weilnetz.de

BUILD FAILED: failed compile

sincerely,
 -The Buildbot


== log tail ==
  CClibhw64/mipsnet.o
  CClibhw64/qtest.o
  CClibhw64/sb16.o
  CClibhw64/es1370.o
  CClibhw64/ac97.o
  CClibhw64/intel-hda.o
  CClibhw64/hda-audio.o
  CClibhw64/9pfs/virtio-9p.o
  CClibhw64/9pfs/virtio-9p-local.o
  CClibhw64/9pfs/virtio-9p-xattr.o
  CClibhw64/9pfs/virtio-9p-xattr-user.o
  CClibhw64/9pfs/virtio-9p-posix-acl.o
  CClibhw64/9pfs/virtio-9p-coth.o
  CClibhw64/9pfs/cofs.o
  CClibhw64/9pfs/codir.o
  CClibhw64/9pfs/cofile.o
  CClibhw64/9pfs/coxattr.o
  CClibhw64/9pfs/virtio-9p-synth.o
  CClibhw64/9pfs/virtio-9p-handle.o
/var/lib/buildbot/slaves/spunk/ubuntu-default/build/hw/9pfs/virtio-9p-handle.c:
In function ‘handle_update_file_cred’:
/var/lib/buildbot/slaves/spunk/ubuntu-default/build/hw/9pfs/virtio-9p-handle.c:66:58:
error: ‘AT_EMPTY_PATH’ undeclared (first use in this function)
/var/lib/buildbot/slaves/spunk/ubuntu-default/build/hw/9pfs/virtio-9p-handle.c:66:58:
note: each undeclared identifier is reported only once for each function
it appears in
/var/lib/buildbot/slaves/spunk/ubuntu-default/build/hw/9pfs/virtio-9p-handle.c:
In function ‘handle_lstat’:
/var/lib/buildbot/slaves/spunk/ubuntu-default/build/hw/9pfs/virtio-9p-handle.c:87:34:
error: ‘AT_EMPTY_PATH’ undeclared (first use in this function)
/var/lib/buildbot/slaves/spunk/ubuntu-default/build/hw/9pfs/virtio-9p-handle.c:
In function ‘handle_symlink’:
/var/lib/buildbot/slaves/spunk/ubuntu-default/build/hw/9pfs/virtio-9p-handle.c:314:62:
error: ‘AT_EMPTY_PATH’ undeclared (first use in this function)
/var/lib/buildbot/slaves/spunk/ubuntu-default/build/hw/9pfs/virtio-9p-handle.c:
In function ‘handle_link’:
/var/lib/buildbot/slaves/spunk/ubuntu-default/build/hw/9pfs/virtio-9p-handle.c:337:45:
error: ‘AT_EMPTY_PATH’ undeclared (first use in this function)
/var/lib/buildbot/slaves/spunk/ubuntu-default/build/hw/9pfs/virtio-9p-handle.c:
In function ‘handle_chown’:
/var/lib/buildbot/slaves/spunk/ubuntu-default/build/hw/9pfs/virtio-9p-handle.c:373:58:
error: ‘AT_EMPTY_PATH’ undeclared (first use in this function)
make[1]: *** [9pfs/virtio-9p-handle.o] Error 1
make: *** [subdir-libhw64] Error 2

== full log ==
[ Note: IPv6 connectivity needed to access this ]
http://spunk.home.kraxel.org/bb/builders/ubuntu-default/builds/52/steps/compile/logs/stdio




Re: [Qemu-devel] [PATCH v2 0/2] [trivial] More concise handling of tracetool-generated files

2012-04-25 Thread Stefan Hajnoczi
On Wed, Apr 18, 2012 at 08:15:34PM +0200, Lluís Vilanova wrote:
 Some trivial changes to handle tracetool-generated files more concisely.
 
 Signed-off-by: Lluís Vilanova vilan...@ac.upc.edu
 ---
 NOTE: Applies on top of the tracetool rewrite.
 
 Changes in v2:
 
 * Only remove tracetool-generated files that were actually produced by the
   top-level makefile.
 * Dropped tracetool-gen and tracetool-ci makefile functions in favour of a
   'TRACETOOL' variable to invoke the script.
 * Slightly reorganize command formatting to make it more readable.
 
 Lluís Vilanova (2):
   [trivial] Generic elimination of auto-generated files
   [trivial] Beautify makefile commands for generation of files with 
 tracetool
 
 
  Makefile|8 
  Makefile.objs   |   22 +++---
  Makefile.target |4 ++--
  rules.mak   |3 +++
  4 files changed, 24 insertions(+), 13 deletions(-)
 

Thanks, applied to the tracing tree:
https://github.com/stefanha/qemu/commits/tracing

Stefan



Re: [Qemu-devel] [PATCH v3 5/5] qemu-iotests: add block-stream speed value test case

2012-04-25 Thread Eric Blake
On 04/25/2012 07:17 AM, Stefan Hajnoczi wrote:
 Add tests to exercise the InvalidParameter 'speed' error code path, as
 well as the regular success case for setting the speed.  The
 block-stream 'speed' parameter allows the speed limit of the job to be
 applied immediately when the job starts instead of issuing a separate
 block-job-set-speed command later.  If the parameter has an invalid
 value we expect to get an error and the job is not created.
 
 It turns out that cancelling a block job is a common operation in these
 test cases, let's extract a cancel_and_wait() function instead of
 duplicating the QMP commands.
 
 Signed-off-by: Stefan Hajnoczi stefa...@linux.vnet.ibm.com
 Acked-by: Kevin Wolf kw...@redhat.com
 ---

 +
 +def test_set_speed_invalid(self):
  self.assert_no_active_streams()
  
 +result = self.vm.qmp('block-stream', device='drive0', speed=2 * 1024 
 * 1024)
 +self.assert_qmp(result, {})
 +
 +self.assert_no_active_streams()
 +
 +result = self.vm.qmp('block-stream', device='drive0')
 +self.assert_qmp(result, 'return', {})
 +
 +result = self.vm.qmp('block-job-set-speed', device='drive0', 
 speed=-1)
 +self.assert_qmp(result, 'error/class', 'InvalidParameter')
 +self.assert_qmp(result, 'error/data/name', 'speed')
 +
 +self.cancel_and_wait()
 +
 +def test_set_speed_invalid(self):

Duplicate def test_set_speed_invalid.  Bad copy-and-paste issue?  The
first one looks bogus, the second one looks correct.

-- 
Eric Blake   ebl...@redhat.com+1-919-301-3266
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature


[Qemu-devel] [PULL] QOM CPUState for sh4, m68k and mips

2012-04-25 Thread Andreas Färber
Hello Anthony, Blue,

Please pull the remainder of the QOM CPU conversions: sh4, m68k and mips.

There was no reaction from the listed maintainers to my patches for weeks
nor to the MAINTAINERS RFC for one week, so please apply to let us proceed.

Cc: Anthony Liguori anth...@codemonkey.ws
Cc: Blue Swirl blauwir...@gmail.com

Cc: Aurélien Jarno aurel...@aurel32.net
Cc: Paul Brook p...@codesourcery.com

The following changes since commit cf36b31db209a261ee3bc2737e788e1ced0a1bec:

  Limit ptimer rate to something achievable (2012-04-24 09:50:31 -0500)

are available in the git repository at:
  git://github.com/afaerber/qemu-cpu.git qom-cpu-rest.v1

Andreas Färber (12):
  MAINTAINERS: Downgrade target-m68k to Odd Fixes
  MAINTAINERS: Downgrade target-mips and target-sh4 to Odd Fixes
  target-sh4: QOM'ify CPU
  target-sh4: QOM'ify CPU reset
  target-sh4: Start QOM'ifying CPU init
  target-m68k: QOM'ify CPU
  target-m68k: QOM'ify CPU reset
  target-m68k: Start QOM'ifying CPU init
  target-m68k: Add QOM CPU subclasses
  target-mips: QOM'ify CPU
  target-mips: Start QOM'ifying CPU init
  Makefile: Simplify compilation of target-*/cpu.c

 MAINTAINERS |6 +-
 Makefile.target |   11 +---
 target-m68k/cpu-qom.h   |   70 +++
 target-m68k/cpu.c   |  170 +++
 target-m68k/cpu.h   |3 +-
 target-m68k/helper.c|  159 ++--
 target-mips/cpu-qom.h   |   74 
 target-mips/cpu.c   |   69 +++
 target-mips/cpu.h   |2 +
 target-mips/translate.c |5 +-
 target-sh4/cpu-qom.h|   70 +++
 target-sh4/cpu.c|   90 +
 target-sh4/cpu.h|2 +
 target-sh4/translate.c  |   28 ++--
 14 files changed, 612 insertions(+), 147 deletions(-)
 create mode 100644 target-m68k/cpu-qom.h
 create mode 100644 target-m68k/cpu.c
 create mode 100644 target-mips/cpu-qom.h
 create mode 100644 target-mips/cpu.c
 create mode 100644 target-sh4/cpu-qom.h
 create mode 100644 target-sh4/cpu.c



[Qemu-devel] [PATCH 03/12] target-sh4: QOM'ify CPU

2012-04-25 Thread Andreas Färber
Embed CPUSH4State as first member of SuperHCPU.

Let CPUClass::reset() call cpu_state_reset() for now.

Signed-off-by: Andreas Färber afaer...@suse.de
Reviewed-by: Peter Maydell peter.mayd...@linaro.org
---
 Makefile.target|1 +
 target-sh4/cpu-qom.h   |   70 
 target-sh4/cpu.c   |   60 +
 target-sh4/cpu.h   |2 +
 target-sh4/translate.c |4 ++-
 5 files changed, 136 insertions(+), 1 deletions(-)
 create mode 100644 target-sh4/cpu-qom.h
 create mode 100644 target-sh4/cpu.c

diff --git a/Makefile.target b/Makefile.target
index 4fbbabf..ace1182 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -98,6 +98,7 @@ libobj-$(TARGET_CRIS) += cpu.o
 libobj-$(TARGET_LM32) += cpu.o
 libobj-$(TARGET_MICROBLAZE) += cpu.o
 libobj-$(TARGET_S390X) += cpu.o
+libobj-$(TARGET_SH4) += cpu.o
 ifeq ($(TARGET_BASE_ARCH), sparc)
 libobj-y += fop_helper.o cc_helper.o win_helper.o mmu_helper.o ldst_helper.o
 libobj-y += cpu.o
diff --git a/target-sh4/cpu-qom.h b/target-sh4/cpu-qom.h
new file mode 100644
index 000..c41164a
--- /dev/null
+++ b/target-sh4/cpu-qom.h
@@ -0,0 +1,70 @@
+/*
+ * QEMU SuperH CPU
+ *
+ * Copyright (c) 2012 SUSE LINUX Products GmbH
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see
+ * http://www.gnu.org/licenses/lgpl-2.1.html
+ */
+#ifndef QEMU_SUPERH_CPU_QOM_H
+#define QEMU_SUPERH_CPU_QOM_H
+
+#include qemu/cpu.h
+
+#define TYPE_SUPERH_CPU superh-cpu
+
+#define SUPERH_CPU_CLASS(klass) \
+OBJECT_CLASS_CHECK(SuperHCPUClass, (klass), TYPE_SUPERH_CPU)
+#define SUPERH_CPU(obj) \
+OBJECT_CHECK(SuperHCPU, (obj), TYPE_SUPERH_CPU)
+#define SUPERH_CPU_GET_CLASS(obj) \
+OBJECT_GET_CLASS(SuperHCPUClass, (obj), TYPE_SUPERH_CPU)
+
+/**
+ * SuperHCPUClass:
+ * @parent_reset: The parent class' reset handler.
+ *
+ * A SuperH CPU model.
+ */
+typedef struct SuperHCPUClass {
+/* private */
+CPUClass parent_class;
+/* public */
+
+void (*parent_reset)(CPUState *cpu);
+} SuperHCPUClass;
+
+/**
+ * SuperHCPU:
+ * @env: #CPUSH4State
+ *
+ * A SuperH CPU.
+ */
+typedef struct SuperHCPU {
+/* private */
+CPUState parent_obj;
+/* public */
+
+CPUSH4State env;
+} SuperHCPU;
+
+static inline SuperHCPU *sh_env_get_cpu(CPUSH4State *env)
+{
+return SUPERH_CPU(container_of(env, SuperHCPU, env));
+}
+
+#define ENV_GET_CPU(e) CPU(sh_env_get_cpu(e))
+
+
+#endif
diff --git a/target-sh4/cpu.c b/target-sh4/cpu.c
new file mode 100644
index 000..e110f98
--- /dev/null
+++ b/target-sh4/cpu.c
@@ -0,0 +1,60 @@
+/*
+ * QEMU SuperH CPU
+ *
+ * Copyright (c) 2012 SUSE LINUX Products GmbH
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see
+ * http://www.gnu.org/licenses/lgpl-2.1.html
+ */
+
+#include cpu.h
+#include qemu-common.h
+
+
+/* CPUClass::reset() */
+static void superh_cpu_reset(CPUState *s)
+{
+SuperHCPU *cpu = SUPERH_CPU(s);
+SuperHCPUClass *scc = SUPERH_CPU_GET_CLASS(cpu);
+CPUSH4State *env = cpu-env;
+
+scc-parent_reset(s);
+
+cpu_state_reset(env);
+}
+
+static void superh_cpu_class_init(ObjectClass *oc, void *data)
+{
+CPUClass *cc = CPU_CLASS(oc);
+SuperHCPUClass *scc = SUPERH_CPU_CLASS(oc);
+
+scc-parent_reset = cc-reset;
+cc-reset = superh_cpu_reset;
+}
+
+static const TypeInfo superh_cpu_type_info = {
+.name = TYPE_SUPERH_CPU,
+.parent = TYPE_CPU,
+.instance_size = sizeof(SuperHCPU),
+.abstract = false,
+.class_size = sizeof(SuperHCPUClass),
+.class_init = superh_cpu_class_init,
+};
+
+static void superh_cpu_register_types(void)
+{
+type_register_static(superh_cpu_type_info);
+}
+
+type_init(superh_cpu_register_types)
diff --git a/target-sh4/cpu.h b/target-sh4/cpu.h
index 965536d..b6768f1 100644
--- a/target-sh4/cpu.h
+++ 

[Qemu-devel] [PATCH 1/3] exynos4210: drop All rights reserved line from files license

2012-04-25 Thread Igor Mitsyanko
It has been noted that All rights reserved statement conflicts with GPL,
remove it.

Signed-off-by: Igor Mitsyanko i.mitsya...@samsung.com
---
 hw/exynos4210.c  |2 +-
 hw/exynos4210.h  |2 +-
 hw/exynos4210_combiner.c |3 +--
 hw/exynos4210_fimd.c |3 +--
 hw/exynos4210_gic.c  |3 +--
 hw/exynos4210_mct.c  |3 +--
 hw/exynos4210_pwm.c  |3 +--
 hw/exynos4_boards.c  |2 +-
 8 files changed, 8 insertions(+), 13 deletions(-)

diff --git a/hw/exynos4210.c b/hw/exynos4210.c
index afc4bdc..a3a06f7 100644
--- a/hw/exynos4210.c
+++ b/hw/exynos4210.c
@@ -1,7 +1,7 @@
 /*
  *  Samsung exynos4210 SoC emulation
  *
- *  Copyright (c) 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *  Copyright (c) 2011 Samsung Electronics Co., Ltd.
  *Maksim Kozlov m.koz...@samsung.com
  *Evgeny Voevodin e.voevo...@samsung.com
  *Igor Mitsyanko  i.mitsya...@samsung.com
diff --git a/hw/exynos4210.h b/hw/exynos4210.h
index f7c7027..79c1b78 100644
--- a/hw/exynos4210.h
+++ b/hw/exynos4210.h
@@ -1,7 +1,7 @@
 /*
  *  Samsung exynos4210 SoC emulation
  *
- *  Copyright (c) 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *  Copyright (c) 2011 Samsung Electronics Co., Ltd.
  *Maksim Kozlov m.koz...@samsung.com
  *Evgeny Voevodin e.voevo...@samsung.com
  *Igor Mitsyanko i.mitsya...@samsung.com
diff --git a/hw/exynos4210_combiner.c b/hw/exynos4210_combiner.c
index 80af22c..a4a159a 100644
--- a/hw/exynos4210_combiner.c
+++ b/hw/exynos4210_combiner.c
@@ -1,8 +1,7 @@
 /*
  * Samsung exynos4210 Interrupt Combiner
  *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd.
- * All rights reserved.
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd.
  *
  * Evgeny Voevodin e.voevo...@samsung.com
  *
diff --git a/hw/exynos4210_fimd.c b/hw/exynos4210_fimd.c
index 3313f00..0cedf6b 100644
--- a/hw/exynos4210_fimd.c
+++ b/hw/exynos4210_fimd.c
@@ -1,8 +1,7 @@
 /*
  * Samsung exynos4210 Display Controller (FIMD)
  *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd.
- * All rights reserved.
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd.
  * Based on LCD controller for Samsung S5PC1xx-based board emulation
  * by Kirill Batuzov batuz...@ispras.ru
  *
diff --git a/hw/exynos4210_gic.c b/hw/exynos4210_gic.c
index e1b215e..3bd4f3e 100644
--- a/hw/exynos4210_gic.c
+++ b/hw/exynos4210_gic.c
@@ -1,8 +1,7 @@
 /*
  * Samsung exynos4210 GIC implementation. Based on hw/arm_gic.c
  *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd.
- * All rights reserved.
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd.
  *
  * Evgeny Voevodin e.voevo...@samsung.com
  *
diff --git a/hw/exynos4210_mct.c b/hw/exynos4210_mct.c
index 7474fcf..8838126 100644
--- a/hw/exynos4210_mct.c
+++ b/hw/exynos4210_mct.c
@@ -1,8 +1,7 @@
 /*
  * Samsung exynos4210 Multi Core timer
  *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd.
- * All rights reserved.
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd.
  *
  * Evgeny Voevodin e.voevo...@samsung.com
  *
diff --git a/hw/exynos4210_pwm.c b/hw/exynos4210_pwm.c
index 6243e59..98227e5 100644
--- a/hw/exynos4210_pwm.c
+++ b/hw/exynos4210_pwm.c
@@ -1,8 +1,7 @@
 /*
  * Samsung exynos4210 Pulse Width Modulation Timer
  *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd.
- * All rights reserved.
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd.
  *
  * Evgeny Voevodin e.voevo...@samsung.com
  *
diff --git a/hw/exynos4_boards.c b/hw/exynos4_boards.c
index ea32c51..b794fa8 100644
--- a/hw/exynos4_boards.c
+++ b/hw/exynos4_boards.c
@@ -1,7 +1,7 @@
 /*
  *  Samsung exynos4 SoC based boards emulation
  *
- *  Copyright (c) 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *  Copyright (c) 2011 Samsung Electronics Co.
  *Maksim Kozlov m.koz...@samsung.com
  *Evgeny Voevodin e.voevo...@samsung.com
  *Igor Mitsyanko  i.mitsya...@samsung.com
-- 
1.7.4.1




[Qemu-devel] [PATCH 09/12] target-m68k: Add QOM CPU subclasses

2012-04-25 Thread Andreas Färber
Move code from cpu_m68k_set_model() into model-specific initfns
and inline the remaining parts into cpu_m68k_init().

Let m68k_cpu_list() print CPU classes alphabetically except for any.

Signed-off-by: Andreas Färber afaer...@suse.de
Reviewed-by: Laurent Vivier laur...@vivier.eu
Tested-by: Laurent Vivier laur...@vivier.eu
---
 target-m68k/cpu.c|   89 +-
 target-m68k/helper.c |  132 +
 2 files changed, 134 insertions(+), 87 deletions(-)

diff --git a/target-m68k/cpu.c b/target-m68k/cpu.c
index 0bb1b2c..3e70bb0 100644
--- a/target-m68k/cpu.c
+++ b/target-m68k/cpu.c
@@ -22,6 +22,11 @@
 #include qemu-common.h
 
 
+static void m68k_set_feature(CPUM68KState *env, int feature)
+{
+env-features |= (1u  feature);
+}
+
 /* CPUClass::reset() */
 static void m68k_cpu_reset(CPUState *s)
 {
@@ -48,6 +53,72 @@ static void m68k_cpu_reset(CPUState *s)
 tlb_flush(env, 1);
 }
 
+/* CPU models */
+
+static void m5206_cpu_initfn(Object *obj)
+{
+M68kCPU *cpu = M68K_CPU(obj);
+CPUM68KState *env = cpu-env;
+
+m68k_set_feature(env, M68K_FEATURE_CF_ISA_A);
+}
+
+static void m5208_cpu_initfn(Object *obj)
+{
+M68kCPU *cpu = M68K_CPU(obj);
+CPUM68KState *env = cpu-env;
+
+m68k_set_feature(env, M68K_FEATURE_CF_ISA_A);
+m68k_set_feature(env, M68K_FEATURE_CF_ISA_APLUSC);
+m68k_set_feature(env, M68K_FEATURE_BRAL);
+m68k_set_feature(env, M68K_FEATURE_CF_EMAC);
+m68k_set_feature(env, M68K_FEATURE_USP);
+}
+
+static void cfv4e_cpu_initfn(Object *obj)
+{
+M68kCPU *cpu = M68K_CPU(obj);
+CPUM68KState *env = cpu-env;
+
+m68k_set_feature(env, M68K_FEATURE_CF_ISA_A);
+m68k_set_feature(env, M68K_FEATURE_CF_ISA_B);
+m68k_set_feature(env, M68K_FEATURE_BRAL);
+m68k_set_feature(env, M68K_FEATURE_CF_FPU);
+m68k_set_feature(env, M68K_FEATURE_CF_EMAC);
+m68k_set_feature(env, M68K_FEATURE_USP);
+}
+
+static void any_cpu_initfn(Object *obj)
+{
+M68kCPU *cpu = M68K_CPU(obj);
+CPUM68KState *env = cpu-env;
+
+m68k_set_feature(env, M68K_FEATURE_CF_ISA_A);
+m68k_set_feature(env, M68K_FEATURE_CF_ISA_B);
+m68k_set_feature(env, M68K_FEATURE_CF_ISA_APLUSC);
+m68k_set_feature(env, M68K_FEATURE_BRAL);
+m68k_set_feature(env, M68K_FEATURE_CF_FPU);
+/* MAC and EMAC are mututally exclusive, so pick EMAC.
+   It's mostly backwards compatible.  */
+m68k_set_feature(env, M68K_FEATURE_CF_EMAC);
+m68k_set_feature(env, M68K_FEATURE_CF_EMAC_B);
+m68k_set_feature(env, M68K_FEATURE_USP);
+m68k_set_feature(env, M68K_FEATURE_EXT_FULL);
+m68k_set_feature(env, M68K_FEATURE_WORD_INDEX);
+}
+
+typedef struct M68kCPUInfo {
+const char *name;
+void (*instance_init)(Object *obj);
+} M68kCPUInfo;
+
+static const M68kCPUInfo m68k_cpus[] = {
+{ .name = m5206, .instance_init = m5206_cpu_initfn },
+{ .name = m5208, .instance_init = m5208_cpu_initfn },
+{ .name = cfv4e, .instance_init = cfv4e_cpu_initfn },
+{ .name = any,   .instance_init = any_cpu_initfn },
+};
+
 static void m68k_cpu_initfn(Object *obj)
 {
 M68kCPU *cpu = M68K_CPU(obj);
@@ -65,19 +136,35 @@ static void m68k_cpu_class_init(ObjectClass *c, void *data)
 cc-reset = m68k_cpu_reset;
 }
 
+static void register_cpu_type(const M68kCPUInfo *info)
+{
+TypeInfo type_info = {
+.name = info-name,
+.parent = TYPE_M68K_CPU,
+.instance_init = info-instance_init,
+};
+
+type_register_static(type_info);
+}
+
 static const TypeInfo m68k_cpu_type_info = {
 .name = TYPE_M68K_CPU,
 .parent = TYPE_CPU,
 .instance_size = sizeof(M68kCPU),
 .instance_init = m68k_cpu_initfn,
-.abstract = false,
+.abstract = true,
 .class_size = sizeof(M68kCPUClass),
 .class_init = m68k_cpu_class_init,
 };
 
 static void m68k_cpu_register_types(void)
 {
+int i;
+
 type_register_static(m68k_cpu_type_info);
+for (i = 0; i  ARRAY_SIZE(m68k_cpus); i++) {
+register_cpu_type(m68k_cpus[i]);
+}
 }
 
 type_init(m68k_cpu_register_types)
diff --git a/target-m68k/helper.c b/target-m68k/helper.c
index e850d53..f428375 100644
--- a/target-m68k/helper.c
+++ b/target-m68k/helper.c
@@ -25,35 +25,50 @@
 
 #define SIGNBIT (1u  31)
 
-enum m68k_cpuid {
-M68K_CPUID_M5206,
-M68K_CPUID_M5208,
-M68K_CPUID_CFV4E,
-M68K_CPUID_ANY,
-};
+typedef struct M68kCPUListState {
+fprintf_function cpu_fprintf;
+FILE *file;
+} M68kCPUListState;
 
-typedef struct m68k_def_t m68k_def_t;
+/* Sort alphabetically, except for any. */
+static gint m68k_cpu_list_compare(gconstpointer a, gconstpointer b)
+{
+ObjectClass *class_a = (ObjectClass *)a;
+ObjectClass *class_b = (ObjectClass *)b;
+const char *name_a, *name_b;
+
+name_a = object_class_get_name(class_a);
+name_b = object_class_get_name(class_b);
+if (strcmp(name_a, any) == 0) {
+return 1;
+} else if (strcmp(name_b, any) == 0) {
+return -1;
+} else {

[Qemu-devel] [PATCH v3 0/5] block: add optional 'speed' parameter to block-stream

2012-04-25 Thread Stefan Hajnoczi
Eric Blake raised concerns about the inability to start block jobs with a speed
limit.  Current the user needs to follow up the block-stream command with
block-job-set-speed.  There is a window of time while the new block job is
running but block-job-set-speed has not been processed yet.

This series adds an optional 'speed' parameter to block-stream so streaming can
be started with a speed limit that takes effect immediately.

For consistency it also renames the block-job-set-speed parameter from 'value'
to 'speed'.  This is externally visible, but this API has not been in a QEMU
release yet so we can still do this.

I considered several other approaches, including adding a
default_block_job_speed field to BlockDriverState but ultimately the cleanest
solution is to pass in a speed parameter on job creation.  This way we do not
change semantics of existing commands, we only add an optional parameter.  We
also do not need to add state to BlockDriverState, which is already huge and
messy.

v3:
 * Fix 'an' - 'and' typo in Patch 1 description [Eric]
 * Document block-stream @speed parameter fully [Kevin]
 * Rephrase error argument doc comment [Luiz]
 * Fix block_stream [speed [base]] options doc [Eric]
 * Fix BlockJobSpeedInvalid - InvalidParameter [Luiz]
 * Add test for block job speed setting success case [Eric]
 * Drop unrelated qemu-iotests 030 fix from this series

Stefan Hajnoczi (5):
  block: use Error mechanism instead of -errno for block_job_create()
  block: use Error mechanism instead of -errno for
block_job_set_speed()
  block: change block-job-set-speed argument from 'value' to 'speed'
  block: add 'speed' optional parameter to block-stream
  qemu-iotests: add block-stream speed value test case

 block.c|   35 +
 block/stream.c |   22 +--
 block_int.h|   19 ++---
 blockdev.c |   26 +
 hmp-commands.hx|8 ++--
 hmp.c  |4 +-
 qapi-schema.json   |   12 --
 qmp-commands.hx|4 +-
 tests/qemu-iotests/030 |   91 ++--
 tests/qemu-iotests/030.out |4 +-
 10 files changed, 151 insertions(+), 74 deletions(-)

-- 
1.7.10




[Qemu-devel] [PATCH v3 2/5] block: use Error mechanism instead of -errno for block_job_set_speed()

2012-04-25 Thread Stefan Hajnoczi
There are at least two different errors that can occur in
block_job_set_speed(): the job might not support setting speeds or the
value might be invalid.

Use the Error mechanism to report the error where it occurs.

Signed-off-by: Stefan Hajnoczi stefa...@linux.vnet.ibm.com
Acked-by: Kevin Wolf kw...@redhat.com
---
 block.c  |   17 ++---
 block/stream.c   |6 +++---
 block_int.h  |5 +++--
 blockdev.c   |4 +---
 qapi-schema.json |1 +
 5 files changed, 18 insertions(+), 15 deletions(-)

diff --git a/block.c b/block.c
index 2b72a0f..dc02736 100644
--- a/block.c
+++ b/block.c
@@ -4114,18 +4114,21 @@ void block_job_complete(BlockJob *job, int ret)
 bdrv_set_in_use(bs, 0);
 }
 
-int block_job_set_speed(BlockJob *job, int64_t value)
+void block_job_set_speed(BlockJob *job, int64_t value, Error **errp)
 {
-int rc;
+Error *local_err = NULL;
 
 if (!job-job_type-set_speed) {
-return -ENOTSUP;
+error_set(errp, QERR_NOT_SUPPORTED);
+return;
 }
-rc = job-job_type-set_speed(job, value);
-if (rc == 0) {
-job-speed = value;
+job-job_type-set_speed(job, value, local_err);
+if (error_is_set(local_err)) {
+error_propagate(errp, local_err);
+return;
 }
-return rc;
+
+job-speed = value;
 }
 
 void block_job_cancel(BlockJob *job)
diff --git a/block/stream.c b/block/stream.c
index 7002dc8..06bc70a 100644
--- a/block/stream.c
+++ b/block/stream.c
@@ -263,15 +263,15 @@ retry:
 block_job_complete(s-common, ret);
 }
 
-static int stream_set_speed(BlockJob *job, int64_t value)
+static void stream_set_speed(BlockJob *job, int64_t value, Error **errp)
 {
 StreamBlockJob *s = container_of(job, StreamBlockJob, common);
 
 if (value  0) {
-return -EINVAL;
+error_set(errp, QERR_INVALID_PARAMETER, value);
+return;
 }
 ratelimit_set_speed(s-limit, value / BDRV_SECTOR_SIZE);
-return 0;
 }
 
 static BlockJobType stream_job_type = {
diff --git a/block_int.h b/block_int.h
index e70a33e..e042676 100644
--- a/block_int.h
+++ b/block_int.h
@@ -79,7 +79,7 @@ typedef struct BlockJobType {
 const char *job_type;
 
 /** Optional callback for job types that support setting a speed limit */
-int (*set_speed)(BlockJob *job, int64_t value);
+void (*set_speed)(BlockJob *job, int64_t value, Error **errp);
 } BlockJobType;
 
 /**
@@ -375,11 +375,12 @@ void block_job_complete(BlockJob *job, int ret);
  * block_job_set_speed:
  * @job: The job to set the speed for.
  * @speed: The new value
+ * @errp: Error object.
  *
  * Set a rate-limiting parameter for the job; the actual meaning may
  * vary depending on the job type.
  */
-int block_job_set_speed(BlockJob *job, int64_t value);
+void block_job_set_speed(BlockJob *job, int64_t value, Error **errp);
 
 /**
  * block_job_cancel:
diff --git a/blockdev.c b/blockdev.c
index a411477..7073330 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -1145,9 +1145,7 @@ void qmp_block_job_set_speed(const char *device, int64_t 
value, Error **errp)
 return;
 }
 
-if (block_job_set_speed(job, value)  0) {
-error_set(errp, QERR_NOT_SUPPORTED);
-}
+block_job_set_speed(job, value, errp);
 }
 
 void qmp_block_job_cancel(const char *device, Error **errp)
diff --git a/qapi-schema.json b/qapi-schema.json
index 6499895..49f1e16 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -1596,6 +1596,7 @@
 #
 # Returns: Nothing on success
 #  If the job type does not support throttling, NotSupported
+#  If the speed value is invalid, InvalidParameter
 #  If streaming is not active on this device, DeviceNotActive
 #
 # Since: 1.1
-- 
1.7.10




Re: [Qemu-devel] [PATCH] tracetool: use Python 2.5-compatible exception handling syntax

2012-04-25 Thread Lluís Vilanova
Stefan Hajnoczi writes:

 The newer except exception-type as exception: syntax is not
 supported by Python 2.5, we need to use except exception-type,
 exception:.

 Tested all trace backends with Python 2.5.6.

 Reported-by: Andreas Färber afaer...@suse.de
 Signed-off-by: Stefan Hajnoczi stefa...@linux.vnet.ibm.com

Reviewed-by: Lluís Vilanova vilan...@ac.upc.edu

 ---
  scripts/tracetool.py |4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

 diff --git a/scripts/tracetool.py b/scripts/tracetool.py
 index cacfd99..c003cf6 100755
 --- a/scripts/tracetool.py
 +++ b/scripts/tracetool.py
 @@ -70,7 +70,7 @@ def main(args):
 
  try:
  opts, args = getopt.getopt(args[1:], , long_opts)
 -except getopt.GetoptError as err:
 +except getopt.GetoptError, err:
  error_opt(str(err))
 
  check_backend = False
 @@ -131,7 +131,7 @@ def main(args):
  try:
  tracetool.generate(sys.stdin, arg_format, arg_backend,
 binary = binary, probe_prefix = probe_prefix)
 -except tracetool.TracetoolError as e:
 +except tracetool.TracetoolError, e:
  error_opt(str(e))
 
  if __name__ == __main__:
 -- 
 1.7.10


-- 
 And it's much the same thing with knowledge, for whenever you learn
 something new, the whole world becomes that much richer.
 -- The Princess of Pure Reason, as told by Norton Juster in The Phantom
 Tollbooth



Re: [Qemu-devel] Fwd: buildbot failure in qemu on ubuntu-default

2012-04-25 Thread Anthony Liguori

On 04/25/2012 08:56 AM, Gerd Hoffmann wrote:



 Original Message 
Subject: buildbot failure in qemu on ubuntu-default
Date: Tue, 24 Apr 2012 21:28:11 +0200
From: build...@spunk.home.kraxel.org
To: kra...@gmail.com

The Buildbot has detected a failed build on builder ubuntu-default while
building qemu.
Full details are available at:
  http://spunk.home.kraxel.org/bb/builders/ubuntu-default/builds/52

Buildbot URL: http://spunk.home.kraxel.org/bb/

Buildslave for this Build: ubuntu-32

Build Reason: scheduler
Build Source Stamp: [branch master] cf36b31db209a261ee3bc2737e788e1ced0a1bec
Blamelist: Andreas Färberafaer...@suse.de,Eduardo Habkost
ehabk...@redhat.com,Kusanagi Kouichisl...@ac.auone-net.jp,Peter
Chubbpeter.ch...@nicta.com.au,Peter Portante
peter.porta...@redhat.com,Richard Hendersonr...@twiddle.net,Stefan
Weils...@weilnetz.de

BUILD FAILED: failed compile


Could you bisect or at least test if reverting:

d10f9056bacf7991fd6a5f63ac2e0190e84ea3a7

or:

e3c56761b465a4253871c32b06ebbc2d8b3fc3e1

Fixes the problem?

Regards,

Anthony Liguori



sincerely,
  -The Buildbot


== log tail ==
   CClibhw64/mipsnet.o
   CClibhw64/qtest.o
   CClibhw64/sb16.o
   CClibhw64/es1370.o
   CClibhw64/ac97.o
   CClibhw64/intel-hda.o
   CClibhw64/hda-audio.o
   CClibhw64/9pfs/virtio-9p.o
   CClibhw64/9pfs/virtio-9p-local.o
   CClibhw64/9pfs/virtio-9p-xattr.o
   CClibhw64/9pfs/virtio-9p-xattr-user.o
   CClibhw64/9pfs/virtio-9p-posix-acl.o
   CClibhw64/9pfs/virtio-9p-coth.o
   CClibhw64/9pfs/cofs.o
   CClibhw64/9pfs/codir.o
   CClibhw64/9pfs/cofile.o
   CClibhw64/9pfs/coxattr.o
   CClibhw64/9pfs/virtio-9p-synth.o
   CClibhw64/9pfs/virtio-9p-handle.o
/var/lib/buildbot/slaves/spunk/ubuntu-default/build/hw/9pfs/virtio-9p-handle.c:
In function ‘handle_update_file_cred’:
/var/lib/buildbot/slaves/spunk/ubuntu-default/build/hw/9pfs/virtio-9p-handle.c:66:58:
error: ‘AT_EMPTY_PATH’ undeclared (first use in this function)
/var/lib/buildbot/slaves/spunk/ubuntu-default/build/hw/9pfs/virtio-9p-handle.c:66:58:
note: each undeclared identifier is reported only once for each function
it appears in
/var/lib/buildbot/slaves/spunk/ubuntu-default/build/hw/9pfs/virtio-9p-handle.c:
In function ‘handle_lstat’:
/var/lib/buildbot/slaves/spunk/ubuntu-default/build/hw/9pfs/virtio-9p-handle.c:87:34:
error: ‘AT_EMPTY_PATH’ undeclared (first use in this function)
/var/lib/buildbot/slaves/spunk/ubuntu-default/build/hw/9pfs/virtio-9p-handle.c:
In function ‘handle_symlink’:
/var/lib/buildbot/slaves/spunk/ubuntu-default/build/hw/9pfs/virtio-9p-handle.c:314:62:
error: ‘AT_EMPTY_PATH’ undeclared (first use in this function)
/var/lib/buildbot/slaves/spunk/ubuntu-default/build/hw/9pfs/virtio-9p-handle.c:
In function ‘handle_link’:
/var/lib/buildbot/slaves/spunk/ubuntu-default/build/hw/9pfs/virtio-9p-handle.c:337:45:
error: ‘AT_EMPTY_PATH’ undeclared (first use in this function)
/var/lib/buildbot/slaves/spunk/ubuntu-default/build/hw/9pfs/virtio-9p-handle.c:
In function ‘handle_chown’:
/var/lib/buildbot/slaves/spunk/ubuntu-default/build/hw/9pfs/virtio-9p-handle.c:373:58:
error: ‘AT_EMPTY_PATH’ undeclared (first use in this function)
make[1]: *** [9pfs/virtio-9p-handle.o] Error 1
make: *** [subdir-libhw64] Error 2

== full log ==
[ Note: IPv6 connectivity needed to access this ]
http://spunk.home.kraxel.org/bb/builders/ubuntu-default/builds/52/steps/compile/logs/stdio







Re: [Qemu-devel] [PATCH] pci: Remove partial overrun checking from pci_host_config_{read, write} common

2012-04-25 Thread David Gibson
On Wed, Apr 25, 2012 at 11:08:12AM +0300, Michael S. Tsirkin wrote:
 On Mon, Apr 16, 2012 at 02:16:24PM +1000, David Gibson wrote:
  Currently the pci_host_config_{read,write}_common() functions clamp the
  given access size to prevent it from overruning the size of config space.
  This does not protect against total overruns (that is where the start
  address is outside config space), but given some correct but rather subtle
  assumptions does handle partial overruns (addr is within config space, but
  the access size overruns it) as a truncated read or write.
  
  A truncated read or write is vanishingly unlikely to be performed by real
  hardware, but more importantly, this code path will never be executed. The
  callers of pci_host_config_{read,write}_common() already check that the
  access is not a total overrun and is naturally aligned.
 
 ./hw/pcie_host.c does not do this.

Uh, yes.  I had assumed that the alignment checking was done in the
general MMIO accessor paths, but it looks like it isn't.

-- 
David Gibson| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson



Re: [Qemu-devel] [PATCH v6 5/5] FreeSCALE i.MX31 support: KZM-ARM11-01 evaluation board

2012-04-25 Thread Paul Brook
 On 23 April 2012 23:21, Peter Chubb peter.ch...@nicta.com.au wrote:
  Peter Are these two devices really on the same IRQ?
  
  Yes.  A single interrupt line comes from the FPGA into the AVIC.
  Inside the FPGA the interrupts for the UARTs, SD card and NAND flash
  are connected to that single interrupt line.
  The non-touchscreen FPGA UART isn't mentioned in the KZM manual, but
  is available on the board as a debug port.
  
  To avoid confusion I think I'll just get rid of it.
 
 Up to you. A comment would be fine if you'd rather keep the device.

No it's not.  You must never connect multiple devices to the same IRQ.  You 
need an explicit mux in between.

Paul



[Qemu-devel] [PATCH v3 3/5] block: change block-job-set-speed argument from 'value' to 'speed'

2012-04-25 Thread Stefan Hajnoczi
Signed-off-by: Stefan Hajnoczi stefa...@linux.vnet.ibm.com
Acked-by: Kevin Wolf kw...@redhat.com
---
 block.c  |6 +++---
 block/stream.c   |8 
 block_int.h  |4 ++--
 blockdev.c   |4 ++--
 hmp-commands.hx  |4 ++--
 qapi-schema.json |4 ++--
 qmp-commands.hx  |2 +-
 7 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/block.c b/block.c
index dc02736..1ab6e52 100644
--- a/block.c
+++ b/block.c
@@ -4114,7 +4114,7 @@ void block_job_complete(BlockJob *job, int ret)
 bdrv_set_in_use(bs, 0);
 }
 
-void block_job_set_speed(BlockJob *job, int64_t value, Error **errp)
+void block_job_set_speed(BlockJob *job, int64_t speed, Error **errp)
 {
 Error *local_err = NULL;
 
@@ -4122,13 +4122,13 @@ void block_job_set_speed(BlockJob *job, int64_t value, 
Error **errp)
 error_set(errp, QERR_NOT_SUPPORTED);
 return;
 }
-job-job_type-set_speed(job, value, local_err);
+job-job_type-set_speed(job, speed, local_err);
 if (error_is_set(local_err)) {
 error_propagate(errp, local_err);
 return;
 }
 
-job-speed = value;
+job-speed = speed;
 }
 
 void block_job_cancel(BlockJob *job)
diff --git a/block/stream.c b/block/stream.c
index 06bc70a..b66242a 100644
--- a/block/stream.c
+++ b/block/stream.c
@@ -263,15 +263,15 @@ retry:
 block_job_complete(s-common, ret);
 }
 
-static void stream_set_speed(BlockJob *job, int64_t value, Error **errp)
+static void stream_set_speed(BlockJob *job, int64_t speed, Error **errp)
 {
 StreamBlockJob *s = container_of(job, StreamBlockJob, common);
 
-if (value  0) {
-error_set(errp, QERR_INVALID_PARAMETER, value);
+if (speed  0) {
+error_set(errp, QERR_INVALID_PARAMETER, speed);
 return;
 }
-ratelimit_set_speed(s-limit, value / BDRV_SECTOR_SIZE);
+ratelimit_set_speed(s-limit, speed / BDRV_SECTOR_SIZE);
 }
 
 static BlockJobType stream_job_type = {
diff --git a/block_int.h b/block_int.h
index e042676..624b2e6 100644
--- a/block_int.h
+++ b/block_int.h
@@ -79,7 +79,7 @@ typedef struct BlockJobType {
 const char *job_type;
 
 /** Optional callback for job types that support setting a speed limit */
-void (*set_speed)(BlockJob *job, int64_t value, Error **errp);
+void (*set_speed)(BlockJob *job, int64_t speed, Error **errp);
 } BlockJobType;
 
 /**
@@ -380,7 +380,7 @@ void block_job_complete(BlockJob *job, int ret);
  * Set a rate-limiting parameter for the job; the actual meaning may
  * vary depending on the job type.
  */
-void block_job_set_speed(BlockJob *job, int64_t value, Error **errp);
+void block_job_set_speed(BlockJob *job, int64_t speed, Error **errp);
 
 /**
  * block_job_cancel:
diff --git a/blockdev.c b/blockdev.c
index 7073330..80b62c3 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -1136,7 +1136,7 @@ static BlockJob *find_block_job(const char *device)
 return bs-job;
 }
 
-void qmp_block_job_set_speed(const char *device, int64_t value, Error **errp)
+void qmp_block_job_set_speed(const char *device, int64_t speed, Error **errp)
 {
 BlockJob *job = find_block_job(device);
 
@@ -1145,7 +1145,7 @@ void qmp_block_job_set_speed(const char *device, int64_t 
value, Error **errp)
 return;
 }
 
-block_job_set_speed(job, value, errp);
+block_job_set_speed(job, speed, errp);
 }
 
 void qmp_block_job_cancel(const char *device, Error **errp)
diff --git a/hmp-commands.hx b/hmp-commands.hx
index 461fa59..8a929f0 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -85,8 +85,8 @@ ETEXI
 
 {
 .name   = block_job_set_speed,
-.args_type  = device:B,value:o,
-.params = device value,
+.args_type  = device:B,speed:o,
+.params = device speed,
 .help   = set maximum speed for a background block operation,
 .mhandler.cmd = hmp_block_job_set_speed,
 },
diff --git a/qapi-schema.json b/qapi-schema.json
index 49f1e16..d56fcb6 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -1592,7 +1592,7 @@
 #
 # @device: the device name
 #
-# @value:  the maximum speed, in bytes per second
+# @speed:  the maximum speed, in bytes per second
 #
 # Returns: Nothing on success
 #  If the job type does not support throttling, NotSupported
@@ -1602,7 +1602,7 @@
 # Since: 1.1
 ##
 { 'command': 'block-job-set-speed',
-  'data': { 'device': 'str', 'value': 'int' } }
+  'data': { 'device': 'str', 'speed': 'int' } }
 
 ##
 # @block-job-cancel:
diff --git a/qmp-commands.hx b/qmp-commands.hx
index f972332..b07ed59 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -694,7 +694,7 @@ EQMP
 
 {
 .name   = block-job-set-speed,
-.args_type  = device:B,value:o,
+.args_type  = device:B,speed:o,
 .mhandler.cmd_new = qmp_marshal_input_block_job_set_speed,
 },
 
-- 
1.7.10




[Qemu-devel] [PATCH 0/3] Exynos4210: license and RAM vmstate fixes

2012-04-25 Thread Igor Mitsyanko
PATCH1 drops All rights reserved from all exynos-related file's licenses.

PATCH2 registers RO MemoryRegions for live migration. This is needed because
ram_save_live saves all MemoryRegions no matter if they were registered or not.
This is probably a bug in QEMU because It's not written anywhere that 
vmstate_register_ram_global()
is mandatory for every created MemoryRegion.

PATCH3 sets chipid_and_omr static array size to TARGET_PAGE_SIZE because 
memory_region_init_ram_ptr()
implicitly assumes that its size argument is a multiple of TARGET_PAGE_SIZE. 
This is probably a bug too,
but still..

Igor Mitsyanko (3):
  exynos4210: drop All rights reserved line from files license
  exynos4210.c: register chipid_mem and rom_mem with vmstate
  hw/exynos4210.c: set chipid_and_omr array size to TARGET_PAGE_SIZE

 hw/exynos4210.c  |6 --
 hw/exynos4210.h  |2 +-
 hw/exynos4210_combiner.c |3 +--
 hw/exynos4210_fimd.c |3 +--
 hw/exynos4210_gic.c  |3 +--
 hw/exynos4210_mct.c  |3 +--
 hw/exynos4210_pwm.c  |3 +--
 hw/exynos4_boards.c  |2 +-
 8 files changed, 11 insertions(+), 14 deletions(-)

-- 
1.7.4.1




[Qemu-devel] [PATCH 10/12] target-mips: QOM'ify CPU

2012-04-25 Thread Andreas Färber
Embed CPUMIPSState as first member of QOM MIPSCPU.

Let CPUClass::reset() call cpu_state_reset() for now.

Signed-off-by: Andreas Färber afaer...@suse.de
Reviewed-by: Richard Henderson r...@twiddle.net
---
 Makefile.target |3 ++
 target-mips/cpu-qom.h   |   74 +++
 target-mips/cpu.c   |   60 ++
 target-mips/cpu.h   |2 +
 target-mips/translate.c |4 ++-
 5 files changed, 142 insertions(+), 1 deletions(-)
 create mode 100644 target-mips/cpu-qom.h
 create mode 100644 target-mips/cpu.c

diff --git a/Makefile.target b/Makefile.target
index e735064..f7b2e71 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -98,6 +98,9 @@ libobj-$(TARGET_CRIS) += cpu.o
 libobj-$(TARGET_LM32) += cpu.o
 libobj-$(TARGET_M68K) += cpu.o
 libobj-$(TARGET_MICROBLAZE) += cpu.o
+ifeq ($(TARGET_BASE_ARCH), mips)
+libobj-y += cpu.o
+endif
 libobj-$(TARGET_S390X) += cpu.o
 libobj-$(TARGET_SH4) += cpu.o
 ifeq ($(TARGET_BASE_ARCH), sparc)
diff --git a/target-mips/cpu-qom.h b/target-mips/cpu-qom.h
new file mode 100644
index 000..6e22371
--- /dev/null
+++ b/target-mips/cpu-qom.h
@@ -0,0 +1,74 @@
+/*
+ * QEMU MIPS CPU
+ *
+ * Copyright (c) 2012 SUSE LINUX Products GmbH
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see
+ * http://www.gnu.org/licenses/lgpl-2.1.html
+ */
+#ifndef QEMU_MIPS_CPU_QOM_H
+#define QEMU_MIPS_CPU_QOM_H
+
+#include qemu/cpu.h
+
+#ifdef TARGET_MIPS64
+#define TYPE_MIPS_CPU mips64-cpu
+#else
+#define TYPE_MIPS_CPU mips-cpu
+#endif
+
+#define MIPS_CPU_CLASS(klass) \
+OBJECT_CLASS_CHECK(MIPSCPUClass, (klass), TYPE_MIPS_CPU)
+#define MIPS_CPU(obj) \
+OBJECT_CHECK(MIPSCPU, (obj), TYPE_MIPS_CPU)
+#define MIPS_CPU_GET_CLASS(obj) \
+OBJECT_GET_CLASS(MIPSCPUClass, (obj), TYPE_MIPS_CPU)
+
+/**
+ * MIPSCPUClass:
+ * @parent_reset: The parent class' reset handler.
+ *
+ * A MIPS CPU model.
+ */
+typedef struct MIPSCPUClass {
+/* private */
+CPUClass parent_class;
+/* public */
+
+void (*parent_reset)(CPUState *cpu);
+} MIPSCPUClass;
+
+/**
+ * MIPSCPU:
+ * @env: #CPUMIPSState
+ *
+ * A MIPS CPU.
+ */
+typedef struct MIPSCPU {
+/* private */
+CPUState parent_obj;
+/* public */
+
+CPUMIPSState env;
+} MIPSCPU;
+
+static inline MIPSCPU *mips_env_get_cpu(CPUMIPSState *env)
+{
+return MIPS_CPU(container_of(env, MIPSCPU, env));
+}
+
+#define ENV_GET_CPU(e) CPU(mips_env_get_cpu(e))
+
+
+#endif
diff --git a/target-mips/cpu.c b/target-mips/cpu.c
new file mode 100644
index 000..d573ec8
--- /dev/null
+++ b/target-mips/cpu.c
@@ -0,0 +1,60 @@
+/*
+ * QEMU MIPS CPU
+ *
+ * Copyright (c) 2012 SUSE LINUX Products GmbH
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see
+ * http://www.gnu.org/licenses/lgpl-2.1.html
+ */
+
+#include cpu.h
+#include qemu-common.h
+
+
+/* CPUClass::reset() */
+static void mips_cpu_reset(CPUState *s)
+{
+MIPSCPU *cpu = MIPS_CPU(s);
+MIPSCPUClass *mcc = MIPS_CPU_GET_CLASS(cpu);
+CPUMIPSState *env = cpu-env;
+
+mcc-parent_reset(s);
+
+cpu_state_reset(env);
+}
+
+static void mips_cpu_class_init(ObjectClass *c, void *data)
+{
+MIPSCPUClass *mcc = MIPS_CPU_CLASS(c);
+CPUClass *cc = CPU_CLASS(c);
+
+mcc-parent_reset = cc-reset;
+cc-reset = mips_cpu_reset;
+}
+
+static const TypeInfo mips_cpu_type_info = {
+.name = TYPE_MIPS_CPU,
+.parent = TYPE_CPU,
+.instance_size = sizeof(MIPSCPU),
+.abstract = false,
+.class_size = sizeof(MIPSCPUClass),
+.class_init = mips_cpu_class_init,
+};
+
+static void mips_cpu_register_types(void)
+{
+type_register_static(mips_cpu_type_info);
+}
+
+type_init(mips_cpu_register_types)
diff --git a/target-mips/cpu.h b/target-mips/cpu.h
index 257c4c4..99b416c 100644
--- a/target-mips/cpu.h
+++ 

[Qemu-devel] [PATCH 2/6] MAINTAINERS: Fix virtio-9p file pattern

2012-04-25 Thread Andreas Färber
Only one pattern is allowed per F: line, split in two.

Signed-off-by: Andreas Färber afaer...@suse.de
Acked-by: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com
---
 MAINTAINERS |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 83d3568..ea32786 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -462,7 +462,8 @@ F: hw/virtio*
 virtio-9p
 M: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com
 S: Supported
-F: hw/9pfs/ fsdev/
+F: hw/9pfs/
+F: fsdev/
 T: https://github.com/kvaneesh/QEMU
 
 
-- 
1.7.7




[Qemu-devel] [PATCH 3/6] MAINTAINERS: Fix TCI file pattern

2012-04-25 Thread Andreas Färber
tcg/tci is a directory, so for recursive semantics add a trailing slash.

Signed-off-by: Andreas Färber afaer...@suse.de
Acked-by: Stefan Weil s...@weilnetz.de
---
 MAINTAINERS |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index ea32786..7781023 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -638,4 +638,4 @@ F: tcg/sparc/
 TCI target
 M: Stefan Weil s...@weilnetz.de
 S: Maintained
-F: tcg/tci
+F: tcg/tci/
-- 
1.7.7




[Qemu-devel] [PATCH 6/6] MAINTAINERS: Document all stable trees

2012-04-25 Thread Andreas Färber
We currently host stable trees for 0.10, 0.14, 0.15 and 1.0.
Sort in descending order. It is expected that further non-stable
sections will be added above these so this order avoids scrolling
through an ever-growing list of stable trees.

Signed-off-by: Andreas Färber afaer...@suse.de
---
 MAINTAINERS |   22 ++
 1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 9d58828..90fe022 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -638,3 +638,25 @@ TCI target
 M: Stefan Weil s...@weilnetz.de
 S: Maintained
 F: tcg/tci/
+
+Stable branches
+---
+Stable 1.0
+L: qemu-sta...@nongnu.org
+T: git git://git.qemu.org/qemu-stable-1.0.git
+S: Orphan
+
+Stable 0.15
+L: qemu-sta...@nongnu.org
+T: git git://git.qemu.org/qemu-stable-0.15.git
+S: Orphan
+
+Stable 0.14
+L: qemu-sta...@nongnu.org
+T: git git://git.qemu.org/qemu-stable-0.14.git
+S: Orphan
+
+Stable 0.10
+L: qemu-sta...@nongnu.org
+T: git git://git.qemu.org/qemu-stable-0.10.git
+S: Orphan
-- 
1.7.7




[Qemu-devel] [PATCH 5/6] MAINTAINERS: Fix SCM tree for virtio-9p

2012-04-25 Thread Andreas Färber
Instead of a Web link, T: is supposed to indicate type of SCM and
pullable URL, so switch to the git:// URL.
Also harmonize the spacing between sections while at it.

Signed-off-by: Andreas Färber afaer...@suse.de
Acked-by: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com
---
 MAINTAINERS |3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 305dbf9..9d58828 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -464,8 +464,7 @@ M: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com
 S: Supported
 F: hw/9pfs/
 F: fsdev/
-T: https://github.com/kvaneesh/QEMU
-
+T: git git://github.com/kvaneesh/QEMU.git
 
 virtio-blk
 M: Kevin Wolf kw...@redhat.com
-- 
1.7.7




[Qemu-devel] [PULL] MAINTAINERS tidying and stable trees

2012-04-25 Thread Andreas Färber
Hello Anthony,

Please pull the uncontroversial parts of MAINTAINERS updates.

I'm leaving out the Maintained upgrades and would ask you to apply the 0.15
patch once we've figured that out. For darwin-user I'll send a separate PULL.

Cc: Anthony Liguori anth...@codemonkey.ws

The following changes since commit cf36b31db209a261ee3bc2737e788e1ced0a1bec:

  Limit ptimer rate to something achievable (2012-04-24 09:50:31 -0500)

are available in the git repository at:
  git://repo.or.cz/qemu/afaerber.git maintainers-up

Andreas Färber (6):
  MAINTAINERS: Fix PC file pattern
  MAINTAINERS: Fix virtio-9p file pattern
  MAINTAINERS: Fix TCI file pattern
  MAINTAINERS: Indicate type of SCM
  MAINTAINERS: Fix SCM tree for virtio-9p
  MAINTAINERS: Document all stable trees

 MAINTAINERS |   41 -
 1 files changed, 32 insertions(+), 9 deletions(-)



Re: [Qemu-devel] [PATCH] tracetool: use Python 2.5-compatible exception handling syntax

2012-04-25 Thread Stefan Hajnoczi
On Wed, Apr 25, 2012 at 2:35 PM, Andreas Färber andreas.faer...@web.de wrote:
 Am 25.04.2012 11:42, schrieb Stefan Hajnoczi:
 The newer except exception-type as exception: syntax is not
 supported by Python 2.5, we need to use except exception-type,
 exception:.

 Tested all trace backends with Python 2.5.6.

 Reported-by: Andreas Färber afaer...@suse.de
 Signed-off-by: Stefan Hajnoczi stefa...@linux.vnet.ibm.com

 Lightly

 Tested-by: Andreas Färber andreas.faer...@web.de

 Works with:
 2.5.1 (Mac OS X v10.5.8),
 2.6.1 (Mac OS X v10.6.8) and
 2.6.4 (OpenIndiana oi_151a).

 Thanks a lot!

 However, it still breaks with different errors on Python 2.3.3 and 2.4.6
 (Solaris 10 U9).

Solaris releases tend to be supported for a very long time.  I don't
think we should restrict ourselves to glib, python, and other
dependencies from the Solaris 10 era (actually Solaris 9 is still
supported too!).

We need to draw the line somewhere.  Python 2.5 was released on
September 19, 2006.  It's available for Mac ppc and Solaris.

Here is the latest blastwave Python package which supposedly works for
Solaris 8+ on i386:

http://www.blastwave.org/jir/pkgcontents.ftd?software=pythonstyle=briefstate=5arch=i386

Stefan



Re: [Qemu-devel] [SeaBIOS] [PATCH 11/12] Migrate 64bit entries to 64bit pci regions

2012-04-25 Thread Gerd Hoffmann
On 04/25/12 14:51, Kevin O'Connor wrote:
 On Wed, Apr 25, 2012 at 06:25:07PM +1200, Alexey Korolev wrote:
 On 25/04/12 13:48, Kevin O'Connor wrote:
 On Tue, Apr 24, 2012 at 06:25:39PM +1200, Alexey Korolev wrote:
 +pci_region_map_entries(busses, r64_mem);
 +pci_region_map_entries(busses, r64_pref);
 +}
  // Map regions on each device.
 This doesn't look right to me.  This will map the devices on bus 0 to
 the proper 4g address, but devices on any subsequent bus will use
 busses[0].r[].base which will be reset to the 4gig address.  Perhaps
 pull base out of pci_region and make pci_region_map_entries()
 recursive?
 No recursion is need here!
 We map all entries which are 64bit on root bus.
 If entry is a bridge region - a corresponding bus address will be updated.
 Region won't be reseted to 4gig address as address is derived from parent 
 region only.
 
 Okay - I missed that.  I think the patches look okay to be committed -
 any additional changes can be made on top.  Gerd - do you have any
 comments?

Great job overall.  Can't spot issues in the code.  And the patches do
fine in testing too.  Some minor issues poped up:

Issue #1:  seabios can't boot from a virtio-scsi disk if the controller
is behind a pci bridge.  I think the reason simply is that (according to
the seabios log) only root bus pci devices are initialized.  Probably
even isn't related to this patch set, just trapped into this while
testing the bridge mapping code of the patch series.

Issue #2: root bus (non-pref) memory regions are mapped above 4G if they
are 64bit capable.  That happened to include the xhci usb controller.  I
don't think we want that.  Some day seabios will get xhci support, and
having the bar above 4G makes it unreachable in 32bit mode.  So this
needs some refinement.  Options I can think of:

  (1) Don't bother mapping non-prefmem bars above 4G.
  (2) Only map them above 4G if they are larger than a certain limit.
  (3) Allow devices to be excluded on certain conditions, for example
  when seabios has a driver, when they have an option rom, when
  they have a specific pci id, ...

These are certainly no blockers and can be discussed and solved after
committing this series.

cheers,
  Gerd



[Qemu-devel] [PATCH 1/6] MAINTAINERS: Fix PC file pattern

2012-04-25 Thread Andreas Färber
Only one pattern is allowed per F: line, split it in two.

Signed-off-by: Andreas Färber afaer...@suse.de
Cc: Anthony Liguori aligu...@us.ibm.com
---
 MAINTAINERS |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index cce37e7..83d3568 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -399,7 +399,8 @@ X86 Machines
 PC
 M: Anthony Liguori aligu...@us.ibm.com
 S: Supported
-F: hw/pc.[ch] hw/pc_piix.c
+F: hw/pc.[ch]
+F: hw/pc_piix.c
 
 Xtensa Machines
 ---
-- 
1.7.7




[Qemu-devel] [PATCH 02/12] MAINTAINERS: Downgrade target-mips and target-sh4 to Odd Fixes

2012-04-25 Thread Andreas Färber
Patches are not being handled, so let's downgrade to Odd Fixes.

Signed-off-by: Andreas Färber afaer...@suse.de
Cc: Aurélien Jarno aurel...@aurel32.net
---
 MAINTAINERS |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 8ae9158..32d8dc7 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -88,7 +88,7 @@ F: target-microblaze/
 
 MIPS
 M: Aurelien Jarno aurel...@aurel32.net
-S: Maintained
+S: Odd Fixes
 F: target-mips/
 
 PowerPC
@@ -104,7 +104,7 @@ F: target-s390x/
 
 SH4
 M: Aurelien Jarno aurel...@aurel32.net
-S: Maintained
+S: Odd Fixes
 F: target-sh4/
 
 SPARC
-- 
1.7.7




[Qemu-devel] [PATCH 4/6] MAINTAINERS: Indicate type of SCM

2012-04-25 Thread Andreas Färber
T: lines are supposed to indicate whether it's git.

Signed-off-by: Andreas Färber afaer...@suse.de
---
 MAINTAINERS |8 
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 7781023..305dbf9 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -437,7 +437,7 @@ M: Paolo Bonzini pbonz...@redhat.com
 S: Supported
 F: hw/virtio-scsi.*
 F: hw/scsi*
-T: git://github.com/bonzini/qemu.git scsi-next
+T: git git://github.com/bonzini/qemu.git scsi-next
 
 LSI53C895A
 M: Paul Brook p...@codesourcery.com
@@ -543,13 +543,13 @@ S: Odd Fixes
 F: block/nbd.c
 F: nbd.*
 F: qemu-nbd.c
-T: git://github.com/bonzini/qemu.git nbd-next
+T: git git://github.com/bonzini/qemu.git nbd-next
 
 SLIRP
 M: Jan Kiszka jan.kis...@siemens.com
 S: Maintained
 F: slirp/
-T: git://git.kiszka.org/qemu.git queues/slirp
+T: git git://git.kiszka.org/qemu.git queues/slirp
 
 Tracing
 M: Stefan Hajnoczi stefa...@linux.vnet.ibm.com
@@ -558,7 +558,7 @@ F: trace/
 F: scripts/tracetool.py
 F: scripts/tracetool/
 F: docs/tracing.txt
-T: git://github.com/stefanha/qemu.git tracing
+T: git git://github.com/stefanha/qemu.git tracing
 
 Checkpatch
 M: Blue Swirl blauwir...@gmail.com
-- 
1.7.7




[Qemu-devel] [PATCH 06/12] target-m68k: QOM'ify CPU

2012-04-25 Thread Andreas Färber
Embed CPUM68KState as first member of QOM M68kCPU.
Drop cpu_m68k_close() in favor of object_delete().

Let CPUClass::reset() call cpu_state_reset() for now.

Signed-off-by: Andreas Färber afaer...@suse.de
Reviewed-by: Laurent Vivier laur...@vivier.eu
Tested-by: Laurent Vivier laur...@vivier.eu
---
 Makefile.target   |1 +
 target-m68k/cpu-qom.h |   70 +
 target-m68k/cpu.c |   60 ++
 target-m68k/cpu.h |3 +-
 target-m68k/helper.c  |   11 +++-
 5 files changed, 137 insertions(+), 8 deletions(-)
 create mode 100644 target-m68k/cpu-qom.h
 create mode 100644 target-m68k/cpu.c

diff --git a/Makefile.target b/Makefile.target
index ace1182..e735064 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -96,6 +96,7 @@ libobj-$(TARGET_ARM) += neon_helper.o iwmmxt_helper.o
 libobj-$(TARGET_ARM) += cpu.o
 libobj-$(TARGET_CRIS) += cpu.o
 libobj-$(TARGET_LM32) += cpu.o
+libobj-$(TARGET_M68K) += cpu.o
 libobj-$(TARGET_MICROBLAZE) += cpu.o
 libobj-$(TARGET_S390X) += cpu.o
 libobj-$(TARGET_SH4) += cpu.o
diff --git a/target-m68k/cpu-qom.h b/target-m68k/cpu-qom.h
new file mode 100644
index 000..805786b
--- /dev/null
+++ b/target-m68k/cpu-qom.h
@@ -0,0 +1,70 @@
+/*
+ * QEMU Motorola 68k CPU
+ *
+ * Copyright (c) 2012 SUSE LINUX Products GmbH
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see
+ * http://www.gnu.org/licenses/lgpl-2.1.html
+ */
+#ifndef QEMU_M68K_CPU_QOM_H
+#define QEMU_M68K_CPU_QOM_H
+
+#include qemu/cpu.h
+
+#define TYPE_M68K_CPU m68k-cpu
+
+#define M68K_CPU_CLASS(klass) \
+OBJECT_CLASS_CHECK(M68kCPUClass, (klass), TYPE_M68K_CPU)
+#define M68K_CPU(obj) \
+OBJECT_CHECK(M68kCPU, (obj), TYPE_M68K_CPU)
+#define M68K_CPU_GET_CLASS(obj) \
+OBJECT_GET_CLASS(M68kCPUClass, (obj), TYPE_M68K_CPU)
+
+/**
+ * M68kCPUClass:
+ * @parent_reset: The parent class' reset handler.
+ *
+ * A Motorola 68k CPU model.
+ */
+typedef struct M68kCPUClass {
+/* private */
+CPUClass parent_class;
+/* public */
+
+void (*parent_reset)(CPUState *cpu);
+} M68kCPUClass;
+
+/**
+ * M68kCPU:
+ * @env: #CPUM68KState
+ *
+ * A Motorola 68k CPU.
+ */
+typedef struct M68kCPU {
+/* private */
+CPUState parent_obj;
+/* public */
+
+CPUM68KState env;
+} M68kCPU;
+
+static inline M68kCPU *m68k_env_get_cpu(CPUM68KState *env)
+{
+return M68K_CPU(container_of(env, M68kCPU, env));
+}
+
+#define ENV_GET_CPU(e) CPU(m68k_env_get_cpu(e))
+
+
+#endif
diff --git a/target-m68k/cpu.c b/target-m68k/cpu.c
new file mode 100644
index 000..457c5c1
--- /dev/null
+++ b/target-m68k/cpu.c
@@ -0,0 +1,60 @@
+/*
+ * QEMU Motorola 68k CPU
+ *
+ * Copyright (c) 2012 SUSE LINUX Products GmbH
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see
+ * http://www.gnu.org/licenses/lgpl-2.1.html
+ */
+
+#include cpu.h
+#include qemu-common.h
+
+
+/* CPUClass::reset() */
+static void m68k_cpu_reset(CPUState *s)
+{
+M68kCPU *cpu = M68K_CPU(s);
+M68kCPUClass *mcc = M68K_CPU_GET_CLASS(cpu);
+CPUM68KState *env = cpu-env;
+
+mcc-parent_reset(s);
+
+cpu_state_reset(env);
+}
+
+static void m68k_cpu_class_init(ObjectClass *c, void *data)
+{
+M68kCPUClass *mcc = M68K_CPU_CLASS(c);
+CPUClass *cc = CPU_CLASS(c);
+
+mcc-parent_reset = cc-reset;
+cc-reset = m68k_cpu_reset;
+}
+
+static const TypeInfo m68k_cpu_type_info = {
+.name = TYPE_M68K_CPU,
+.parent = TYPE_CPU,
+.instance_size = sizeof(M68kCPU),
+.abstract = false,
+.class_size = sizeof(M68kCPUClass),
+.class_init = m68k_cpu_class_init,
+};
+
+static void m68k_cpu_register_types(void)
+{
+type_register_static(m68k_cpu_type_info);
+}
+
+type_init(m68k_cpu_register_types)
diff --git a/target-m68k/cpu.h b/target-m68k/cpu.h
index 

Re: [Qemu-devel] [PATCH v3 5/5] qemu-iotests: add block-stream speed value test case

2012-04-25 Thread Stefan Hajnoczi
On Wed, Apr 25, 2012 at 3:21 PM, Eric Blake ebl...@redhat.com wrote:
 On 04/25/2012 07:17 AM, Stefan Hajnoczi wrote:
 Add tests to exercise the InvalidParameter 'speed' error code path, as
 well as the regular success case for setting the speed.  The
 block-stream 'speed' parameter allows the speed limit of the job to be
 applied immediately when the job starts instead of issuing a separate
 block-job-set-speed command later.  If the parameter has an invalid
 value we expect to get an error and the job is not created.

 It turns out that cancelling a block job is a common operation in these
 test cases, let's extract a cancel_and_wait() function instead of
 duplicating the QMP commands.

 Signed-off-by: Stefan Hajnoczi stefa...@linux.vnet.ibm.com
 Acked-by: Kevin Wolf kw...@redhat.com
 ---

 +
 +    def test_set_speed_invalid(self):
          self.assert_no_active_streams()

 +        result = self.vm.qmp('block-stream', device='drive0', speed=2 * 
 1024 * 1024)
 +        self.assert_qmp(result, {})
 +
 +        self.assert_no_active_streams()
 +
 +        result = self.vm.qmp('block-stream', device='drive0')
 +        self.assert_qmp(result, 'return', {})
 +
 +        result = self.vm.qmp('block-job-set-speed', device='drive0', 
 speed=-1)
 +        self.assert_qmp(result, 'error/class', 'InvalidParameter')
 +        self.assert_qmp(result, 'error/data/name', 'speed')
 +
 +        self.cancel_and_wait()
 +
 +    def test_set_speed_invalid(self):

 Duplicate def test_set_speed_invalid.  Bad copy-and-paste issue?  The
 first one looks bogus, the second one looks correct.

Hmm...not my finest patch series.  I made a mess, it was indeed a copy
paste error.  Interestingly the tests still passed :).

I'm sending a new revision that fixes this.  There are three cases for
set speed:
1. A throughput performance test which is not automatically run
(because it takes several seconds to complete and is really only good
for testing throttling).
2. A success case test that makes sure query-block-jobs reports the
speed that we set.
3. A failure case for InvalidParameter.

Stefan



[Qemu-devel] [PATCH v4 0/5] block: add optional 'speed' parameter to block-stream

2012-04-25 Thread Stefan Hajnoczi
Eric Blake raised concerns about the inability to start block jobs with a speed
limit.  Current the user needs to follow up the block-stream command with
block-job-set-speed.  There is a window of time while the new block job is
running but block-job-set-speed has not been processed yet.

This series adds an optional 'speed' parameter to block-stream so streaming can
be started with a speed limit that takes effect immediately.

For consistency it also renames the block-job-set-speed parameter from 'value'
to 'speed'.  This is externally visible, but this API has not been in a QEMU
release yet so we can still do this.

I considered several other approaches, including adding a
default_block_job_speed field to BlockDriverState but ultimately the cleanest
solution is to pass in a speed parameter on job creation.  This way we do not
change semantics of existing commands, we only add an optional parameter.  We
also do not need to add state to BlockDriverState, which is already huge and
messy.

v4:
 * Fix copy-paste error in 030 qemu-iotest [Eric]

v3:
 * Fix 'an' - 'and' typo in Patch 1 description [Eric]
 * Document block-stream @speed parameter fully [Kevin]
 * Rephrase error argument doc comment [Luiz]
 * Fix block_stream [speed [base]] options doc [Eric]
 * Fix BlockJobSpeedInvalid - InvalidParameter [Luiz]
 * Add test for block job speed setting success case [Eric]
 * Drop unrelated qemu-iotests 030 fix from this series

Stefan Hajnoczi (5):
  block: use Error mechanism instead of -errno for block_job_create()
  block: use Error mechanism instead of -errno for
block_job_set_speed()
  block: change block-job-set-speed argument from 'value' to 'speed'
  block: add 'speed' optional parameter to block-stream
  qemu-iotests: add block-stream speed value test case

 block.c|   35 +-
 block/stream.c |   22 ++--
 block_int.h|   19 ++
 blockdev.c |   26 ++
 hmp-commands.hx|8 ++---
 hmp.c  |4 ++-
 qapi-schema.json   |   12 +--
 qmp-commands.hx|4 +--
 tests/qemu-iotests/030 |   85 +++-
 tests/qemu-iotests/030.out |4 +--
 10 files changed, 150 insertions(+), 69 deletions(-)

-- 
1.7.10




[Qemu-devel] [PATCH v4 1/5] block: use Error mechanism instead of -errno for block_job_create()

2012-04-25 Thread Stefan Hajnoczi
The block job API uses -errno return values internally and we convert
these to Error in the QMP functions.  This is ugly because the Error
should be created at the point where we still have all the relevant
information.  More importantly, it is hard to add new error cases to
this case since we quickly run out of -errno values without losing
information.

Go ahead and use Error directly and don't convert later.

Signed-off-by: Stefan Hajnoczi stefa...@linux.vnet.ibm.com
Acked-by: Kevin Wolf kw...@redhat.com
---
 block.c|4 +++-
 block/stream.c |   11 +--
 block_int.h|   11 +++
 blockdev.c |   16 +---
 4 files changed, 20 insertions(+), 22 deletions(-)

diff --git a/block.c b/block.c
index fe74ddd..2b72a0f 100644
--- a/block.c
+++ b/block.c
@@ -4083,11 +4083,13 @@ out:
 }
 
 void *block_job_create(const BlockJobType *job_type, BlockDriverState *bs,
-   BlockDriverCompletionFunc *cb, void *opaque)
+   BlockDriverCompletionFunc *cb, void *opaque,
+   Error **errp)
 {
 BlockJob *job;
 
 if (bs-job || bdrv_in_use(bs)) {
+error_set(errp, QERR_DEVICE_IN_USE, bdrv_get_device_name(bs));
 return NULL;
 }
 bdrv_set_in_use(bs, 1);
diff --git a/block/stream.c b/block/stream.c
index 0efe1ad..7002dc8 100644
--- a/block/stream.c
+++ b/block/stream.c
@@ -280,16 +280,16 @@ static BlockJobType stream_job_type = {
 .set_speed = stream_set_speed,
 };
 
-int stream_start(BlockDriverState *bs, BlockDriverState *base,
- const char *base_id, BlockDriverCompletionFunc *cb,
- void *opaque)
+void stream_start(BlockDriverState *bs, BlockDriverState *base,
+  const char *base_id, BlockDriverCompletionFunc *cb,
+  void *opaque, Error **errp)
 {
 StreamBlockJob *s;
 Coroutine *co;
 
-s = block_job_create(stream_job_type, bs, cb, opaque);
+s = block_job_create(stream_job_type, bs, cb, opaque, errp);
 if (!s) {
-return -EBUSY; /* bs must already be in use */
+return;
 }
 
 s-base = base;
@@ -300,5 +300,4 @@ int stream_start(BlockDriverState *bs, BlockDriverState 
*base,
 co = qemu_coroutine_create(stream_run);
 trace_stream_start(bs, base, s, co, opaque);
 qemu_coroutine_enter(co, s);
-return 0;
 }
diff --git a/block_int.h b/block_int.h
index 0acb49f..e70a33e 100644
--- a/block_int.h
+++ b/block_int.h
@@ -346,6 +346,7 @@ int is_windows_drive(const char *filename);
  * @bs: The block
  * @cb: Completion function for the job.
  * @opaque: Opaque pointer value passed to @cb.
+ * @errp: Error object.
  *
  * Create a new long-running block device job and return it.  The job
  * will call @cb asynchronously when the job completes.  Note that
@@ -357,7 +358,8 @@ int is_windows_drive(const char *filename);
  * called from a wrapper that is specific to the job type.
  */
 void *block_job_create(const BlockJobType *job_type, BlockDriverState *bs,
-   BlockDriverCompletionFunc *cb, void *opaque);
+   BlockDriverCompletionFunc *cb, void *opaque,
+   Error **errp);
 
 /**
  * block_job_complete:
@@ -417,6 +419,7 @@ void block_job_cancel_sync(BlockJob *job);
  * backing file if the job completes.  Ignored if @base is %NULL.
  * @cb: Completion function for the job.
  * @opaque: Opaque pointer value passed to @cb.
+ * @errp: Error object.
  *
  * Start a streaming operation on @bs.  Clusters that are unallocated
  * in @bs, but allocated in any image between @base and @bs (both
@@ -424,8 +427,8 @@ void block_job_cancel_sync(BlockJob *job);
  * streaming job, the backing file of @bs will be changed to
  * @base_id in the written image and to @base in the live BlockDriverState.
  */
-int stream_start(BlockDriverState *bs, BlockDriverState *base,
- const char *base_id, BlockDriverCompletionFunc *cb,
- void *opaque);
+void stream_start(BlockDriverState *bs, BlockDriverState *base,
+  const char *base_id, BlockDriverCompletionFunc *cb,
+  void *opaque, Error **errp);
 
 #endif /* BLOCK_INT_H */
diff --git a/blockdev.c b/blockdev.c
index 0c2440e..a411477 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -1095,7 +1095,7 @@ void qmp_block_stream(const char *device, bool has_base,
 {
 BlockDriverState *bs;
 BlockDriverState *base_bs = NULL;
-int ret;
+Error *local_err = NULL;
 
 bs = bdrv_find(device);
 if (!bs) {
@@ -,16 +,10 @@ void qmp_block_stream(const char *device, bool has_base,
 }
 }
 
-ret = stream_start(bs, base_bs, base, block_stream_cb, bs);
-if (ret  0) {
-switch (ret) {
-case -EBUSY:
-error_set(errp, QERR_DEVICE_IN_USE, device);
-return;
-default:
-error_set(errp, QERR_NOT_SUPPORTED);
-return;
-}
+stream_start(bs, base_bs, base, 

[Qemu-devel] [PATCH v4 2/5] block: use Error mechanism instead of -errno for block_job_set_speed()

2012-04-25 Thread Stefan Hajnoczi
There are at least two different errors that can occur in
block_job_set_speed(): the job might not support setting speeds or the
value might be invalid.

Use the Error mechanism to report the error where it occurs.

Signed-off-by: Stefan Hajnoczi stefa...@linux.vnet.ibm.com
Acked-by: Kevin Wolf kw...@redhat.com
---
 block.c  |   17 ++---
 block/stream.c   |6 +++---
 block_int.h  |5 +++--
 blockdev.c   |4 +---
 qapi-schema.json |1 +
 5 files changed, 18 insertions(+), 15 deletions(-)

diff --git a/block.c b/block.c
index 2b72a0f..dc02736 100644
--- a/block.c
+++ b/block.c
@@ -4114,18 +4114,21 @@ void block_job_complete(BlockJob *job, int ret)
 bdrv_set_in_use(bs, 0);
 }
 
-int block_job_set_speed(BlockJob *job, int64_t value)
+void block_job_set_speed(BlockJob *job, int64_t value, Error **errp)
 {
-int rc;
+Error *local_err = NULL;
 
 if (!job-job_type-set_speed) {
-return -ENOTSUP;
+error_set(errp, QERR_NOT_SUPPORTED);
+return;
 }
-rc = job-job_type-set_speed(job, value);
-if (rc == 0) {
-job-speed = value;
+job-job_type-set_speed(job, value, local_err);
+if (error_is_set(local_err)) {
+error_propagate(errp, local_err);
+return;
 }
-return rc;
+
+job-speed = value;
 }
 
 void block_job_cancel(BlockJob *job)
diff --git a/block/stream.c b/block/stream.c
index 7002dc8..06bc70a 100644
--- a/block/stream.c
+++ b/block/stream.c
@@ -263,15 +263,15 @@ retry:
 block_job_complete(s-common, ret);
 }
 
-static int stream_set_speed(BlockJob *job, int64_t value)
+static void stream_set_speed(BlockJob *job, int64_t value, Error **errp)
 {
 StreamBlockJob *s = container_of(job, StreamBlockJob, common);
 
 if (value  0) {
-return -EINVAL;
+error_set(errp, QERR_INVALID_PARAMETER, value);
+return;
 }
 ratelimit_set_speed(s-limit, value / BDRV_SECTOR_SIZE);
-return 0;
 }
 
 static BlockJobType stream_job_type = {
diff --git a/block_int.h b/block_int.h
index e70a33e..e042676 100644
--- a/block_int.h
+++ b/block_int.h
@@ -79,7 +79,7 @@ typedef struct BlockJobType {
 const char *job_type;
 
 /** Optional callback for job types that support setting a speed limit */
-int (*set_speed)(BlockJob *job, int64_t value);
+void (*set_speed)(BlockJob *job, int64_t value, Error **errp);
 } BlockJobType;
 
 /**
@@ -375,11 +375,12 @@ void block_job_complete(BlockJob *job, int ret);
  * block_job_set_speed:
  * @job: The job to set the speed for.
  * @speed: The new value
+ * @errp: Error object.
  *
  * Set a rate-limiting parameter for the job; the actual meaning may
  * vary depending on the job type.
  */
-int block_job_set_speed(BlockJob *job, int64_t value);
+void block_job_set_speed(BlockJob *job, int64_t value, Error **errp);
 
 /**
  * block_job_cancel:
diff --git a/blockdev.c b/blockdev.c
index a411477..7073330 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -1145,9 +1145,7 @@ void qmp_block_job_set_speed(const char *device, int64_t 
value, Error **errp)
 return;
 }
 
-if (block_job_set_speed(job, value)  0) {
-error_set(errp, QERR_NOT_SUPPORTED);
-}
+block_job_set_speed(job, value, errp);
 }
 
 void qmp_block_job_cancel(const char *device, Error **errp)
diff --git a/qapi-schema.json b/qapi-schema.json
index 6499895..49f1e16 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -1596,6 +1596,7 @@
 #
 # Returns: Nothing on success
 #  If the job type does not support throttling, NotSupported
+#  If the speed value is invalid, InvalidParameter
 #  If streaming is not active on this device, DeviceNotActive
 #
 # Since: 1.1
-- 
1.7.10




[Qemu-devel] [PATCH v4 3/5] block: change block-job-set-speed argument from 'value' to 'speed'

2012-04-25 Thread Stefan Hajnoczi
Signed-off-by: Stefan Hajnoczi stefa...@linux.vnet.ibm.com
Acked-by: Kevin Wolf kw...@redhat.com
---
 block.c  |6 +++---
 block/stream.c   |8 
 block_int.h  |4 ++--
 blockdev.c   |4 ++--
 hmp-commands.hx  |4 ++--
 qapi-schema.json |4 ++--
 qmp-commands.hx  |2 +-
 7 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/block.c b/block.c
index dc02736..1ab6e52 100644
--- a/block.c
+++ b/block.c
@@ -4114,7 +4114,7 @@ void block_job_complete(BlockJob *job, int ret)
 bdrv_set_in_use(bs, 0);
 }
 
-void block_job_set_speed(BlockJob *job, int64_t value, Error **errp)
+void block_job_set_speed(BlockJob *job, int64_t speed, Error **errp)
 {
 Error *local_err = NULL;
 
@@ -4122,13 +4122,13 @@ void block_job_set_speed(BlockJob *job, int64_t value, 
Error **errp)
 error_set(errp, QERR_NOT_SUPPORTED);
 return;
 }
-job-job_type-set_speed(job, value, local_err);
+job-job_type-set_speed(job, speed, local_err);
 if (error_is_set(local_err)) {
 error_propagate(errp, local_err);
 return;
 }
 
-job-speed = value;
+job-speed = speed;
 }
 
 void block_job_cancel(BlockJob *job)
diff --git a/block/stream.c b/block/stream.c
index 06bc70a..b66242a 100644
--- a/block/stream.c
+++ b/block/stream.c
@@ -263,15 +263,15 @@ retry:
 block_job_complete(s-common, ret);
 }
 
-static void stream_set_speed(BlockJob *job, int64_t value, Error **errp)
+static void stream_set_speed(BlockJob *job, int64_t speed, Error **errp)
 {
 StreamBlockJob *s = container_of(job, StreamBlockJob, common);
 
-if (value  0) {
-error_set(errp, QERR_INVALID_PARAMETER, value);
+if (speed  0) {
+error_set(errp, QERR_INVALID_PARAMETER, speed);
 return;
 }
-ratelimit_set_speed(s-limit, value / BDRV_SECTOR_SIZE);
+ratelimit_set_speed(s-limit, speed / BDRV_SECTOR_SIZE);
 }
 
 static BlockJobType stream_job_type = {
diff --git a/block_int.h b/block_int.h
index e042676..624b2e6 100644
--- a/block_int.h
+++ b/block_int.h
@@ -79,7 +79,7 @@ typedef struct BlockJobType {
 const char *job_type;
 
 /** Optional callback for job types that support setting a speed limit */
-void (*set_speed)(BlockJob *job, int64_t value, Error **errp);
+void (*set_speed)(BlockJob *job, int64_t speed, Error **errp);
 } BlockJobType;
 
 /**
@@ -380,7 +380,7 @@ void block_job_complete(BlockJob *job, int ret);
  * Set a rate-limiting parameter for the job; the actual meaning may
  * vary depending on the job type.
  */
-void block_job_set_speed(BlockJob *job, int64_t value, Error **errp);
+void block_job_set_speed(BlockJob *job, int64_t speed, Error **errp);
 
 /**
  * block_job_cancel:
diff --git a/blockdev.c b/blockdev.c
index 7073330..80b62c3 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -1136,7 +1136,7 @@ static BlockJob *find_block_job(const char *device)
 return bs-job;
 }
 
-void qmp_block_job_set_speed(const char *device, int64_t value, Error **errp)
+void qmp_block_job_set_speed(const char *device, int64_t speed, Error **errp)
 {
 BlockJob *job = find_block_job(device);
 
@@ -1145,7 +1145,7 @@ void qmp_block_job_set_speed(const char *device, int64_t 
value, Error **errp)
 return;
 }
 
-block_job_set_speed(job, value, errp);
+block_job_set_speed(job, speed, errp);
 }
 
 void qmp_block_job_cancel(const char *device, Error **errp)
diff --git a/hmp-commands.hx b/hmp-commands.hx
index 461fa59..8a929f0 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -85,8 +85,8 @@ ETEXI
 
 {
 .name   = block_job_set_speed,
-.args_type  = device:B,value:o,
-.params = device value,
+.args_type  = device:B,speed:o,
+.params = device speed,
 .help   = set maximum speed for a background block operation,
 .mhandler.cmd = hmp_block_job_set_speed,
 },
diff --git a/qapi-schema.json b/qapi-schema.json
index 49f1e16..d56fcb6 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -1592,7 +1592,7 @@
 #
 # @device: the device name
 #
-# @value:  the maximum speed, in bytes per second
+# @speed:  the maximum speed, in bytes per second
 #
 # Returns: Nothing on success
 #  If the job type does not support throttling, NotSupported
@@ -1602,7 +1602,7 @@
 # Since: 1.1
 ##
 { 'command': 'block-job-set-speed',
-  'data': { 'device': 'str', 'value': 'int' } }
+  'data': { 'device': 'str', 'speed': 'int' } }
 
 ##
 # @block-job-cancel:
diff --git a/qmp-commands.hx b/qmp-commands.hx
index f972332..b07ed59 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -694,7 +694,7 @@ EQMP
 
 {
 .name   = block-job-set-speed,
-.args_type  = device:B,value:o,
+.args_type  = device:B,speed:o,
 .mhandler.cmd_new = qmp_marshal_input_block_job_set_speed,
 },
 
-- 
1.7.10




  1   2   >