]> git.proxmox.com Git - qemu.git/log
qemu.git
11 years agosysbus: Remove sysbus_add_memory and sysbus_del_memory
Peter Maydell [Fri, 15 Mar 2013 14:34:23 +0000 (14:34 +0000)]
sysbus: Remove sysbus_add_memory and sysbus_del_memory

Remove the sysbus_add_memory and sysbus_del_memory functions. These
are trivial wrappers for mapping a memory region into the system
memory space, and have no users now.  Sysbus devices should never map
their own memory regions anyway; the correct API for mapping an mmio
region is for the creator of the device to use sysbus_mmio_map.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Message-id: 1363358063-23973-6-git-send-email-peter.maydell@linaro.org
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agohw/milkymist-softusb: set buffer in softusb_read_{dmem, pmem} error path
Peter Maydell [Thu, 28 Mar 2013 18:43:04 +0000 (18:43 +0000)]
hw/milkymist-softusb: set buffer in softusb_read_{dmem, pmem} error path

Make sure we set the buffer to something in the softusb_read_{dmem,pmem}
error paths, since the caller will use the buffer unconditionally.
(Newer gcc is smart enough to spot this and complain about 'may be
used uninitialized'.)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1364496184-11994-1-git-send-email-peter.maydell@linaro.org
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agomilkymist-softusb: Don't map RAM memory regions in the device itself
Peter Maydell [Fri, 15 Mar 2013 14:34:22 +0000 (14:34 +0000)]
milkymist-softusb: Don't map RAM memory regions in the device itself

Don't map the pmem and dmem RAM memory regions in the milkymist-softusb
device itself. Instead just expose them as sysbus mmio regions which
the device creator can map appropriately. This allows us to drop the
pmem_base and dmem_base properties. Instead of going via
cpu_physical_memory_read/_write when the device wants to access the
RAMs, we just keep a host pointer to the memory and use that.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Acked-by: Michael Walle <michael@walle.cc>
Message-id: 1363358063-23973-5-git-send-email-peter.maydell@linaro.org
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agomilkymist-minimac2: Just expose buffers as a sysbus mmio region
Peter Maydell [Fri, 15 Mar 2013 14:34:21 +0000 (14:34 +0000)]
milkymist-minimac2: Just expose buffers as a sysbus mmio region

Just expose the register buffers memory as a standard sysbus mmio
region which the creator of the device can map, rather than
providing a qdev property which the creator has to set to the
base address and then doing the mapping in the device's own
init function.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Acked-by: Michael Walle <michael@walle.cc>
Message-id: 1363358063-23973-4-git-send-email-peter.maydell@linaro.org
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agomusicpal: qdevify musicpal-misc
Peter Maydell [Fri, 15 Mar 2013 14:34:20 +0000 (14:34 +0000)]
musicpal: qdevify musicpal-misc

Make musicpal-misc into its own (trivial) qdev device, so we
can get rid of the abuse of sysbus_add_memory().

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Message-id: 1363358063-23973-3-git-send-email-peter.maydell@linaro.org
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agosysbus: make SysBusDeviceClass::init optional
Peter Maydell [Fri, 15 Mar 2013 14:34:19 +0000 (14:34 +0000)]
sysbus: make SysBusDeviceClass::init optional

Make the SysBusDeviceClass::init optional, for devices which
genuinely don't need to do anything here. In particular, simple
devices which can do all their initialization in their
instance_init method don't need either a DeviceClass::realize
or SysBusDeviceClass::init method.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Acked-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Message-id: 1363358063-23973-2-git-send-email-peter.maydell@linaro.org
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agotarget-moxie: set do_interrupt to a target-specific helper function
Dunrong Huang [Sun, 31 Mar 2013 01:35:53 +0000 (09:35 +0800)]
target-moxie: set do_interrupt to a target-specific helper function

The value of "do_interrupt" member of CPUClass shoule be set to a
target-specific function, or it will lead to a segfault like below:

$ moxie-softmmu/qemu-system-moxie -M moxiesim
Segmentation fault

Cc: Anthony Green <green@moxielogic.com>
Cc: Blue Swirl <blauwirbel@gmail.com>
Cc: Andreas Färber <afaerber@suse.de>
Signed-off-by: Dunrong Huang <huangdr@cloud-times.com>
Signed-of-by: Anthony Green <green@moxielogic.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agow32: Fix build with older gcc (unresolved symbol)
Stefan Weil [Fri, 29 Mar 2013 17:20:20 +0000 (18:20 +0100)]
w32: Fix build with older gcc (unresolved symbol)

The cross i586-mingw32msvc-gcc 4.4.4 from Debian Squeeze does not support
__sync_val_compare_and_swap by default.

Using -march=i686 fixes that and should also result in better code.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotarget-moxie: Fix pointer-to-integer conversion (MinGW-w64)
Stefan Weil [Sun, 24 Mar 2013 08:04:48 +0000 (09:04 +0100)]
target-moxie: Fix pointer-to-integer conversion (MinGW-w64)

The type cast must use tcg_target_long instead of long.
This makes a difference for hosts where sizeof(long) != sizeof(void *).

Cc: Anthony Green <green@moxielogic.com>
Cc: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Anthony Green <green@moxielogic.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agopiix_pci: Fix C99 comments
David Woodhouse [Sat, 23 Feb 2013 00:40:39 +0000 (00:40 +0000)]
piix_pci: Fix C99 comments

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Message-id: 1361580039-4459-4-git-send-email-dwmw2@infradead.org
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agopiix_pci: Use DEVICE() and ISA_BUS()
David Woodhouse [Sat, 23 Feb 2013 00:40:38 +0000 (00:40 +0000)]
piix_pci: Use DEVICE() and ISA_BUS()

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Message-id: 1361580039-4459-3-git-send-email-dwmw2@infradead.org
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agopiix_pci: Clean up i440FX object handling
David Woodhouse [Sat, 23 Feb 2013 00:40:37 +0000 (00:40 +0000)]
piix_pci: Clean up i440FX object handling

Define and use I440FX_PCI_DEVICE() instead of using DO_UPCAST().

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Message-id: 1361580039-4459-2-git-send-email-dwmw2@infradead.org
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoqemu-bridge-helper: force usage of a very high MAC address for the bridge
Paolo Bonzini [Fri, 22 Mar 2013 16:57:48 +0000 (17:57 +0100)]
qemu-bridge-helper: force usage of a very high MAC address for the bridge

Linux uses the lowest enslaved MAC address as the MAC address of
the bridge.  Set MAC address to a high value so that it does not
affect the MAC address of the bridge.

Changing the MAC address of the bridge could cause a few seconds
of network downtime.

Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 1363971468-21154-1-git-send-email-pbonzini@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovirtio-balloon: cleanup: remove qdev field.
KONRAD Frederic [Wed, 27 Mar 2013 09:49:15 +0000 (10:49 +0100)]
virtio-balloon: cleanup: remove qdev field.

The qdev field is no longer needed, just drop it.

Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Tested-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Message-id: 1364377755-15508-7-git-send-email-fred.konrad@greensocs.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovirtio-balloon: cleanup: QOM casts.
KONRAD Frederic [Wed, 27 Mar 2013 09:49:14 +0000 (10:49 +0100)]
virtio-balloon: cleanup: QOM casts.

As the virtio-balloon-pci is switched to the new API, we can use QOM
casts.

Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Tested-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Message-id: 1364377755-15508-6-git-send-email-fred.konrad@greensocs.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovirtio-balloon: cleanup: init and exit function.
KONRAD Frederic [Wed, 27 Mar 2013 09:49:13 +0000 (10:49 +0100)]
virtio-balloon: cleanup: init and exit function.

This remove old init and exit function as they are no longer needed.

Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Tested-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Message-id: 1364377755-15508-5-git-send-email-fred.konrad@greensocs.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovirtio-balloon-ccw: switch to the new API.
KONRAD Frederic [Wed, 27 Mar 2013 09:49:12 +0000 (10:49 +0100)]
virtio-balloon-ccw: switch to the new API.

Here the virtio-balloon-ccw is modified for the new API. The device
virtio-balloon-ccw extends virtio-ccw-device as before. It creates and
connects a virtio-balloon during the init. The properties are not modified.

Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Tested-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Message-id: 1364377755-15508-4-git-send-email-fred.konrad@greensocs.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovirtio-balloon-pci: switch to the new API.
KONRAD Frederic [Wed, 27 Mar 2013 09:49:11 +0000 (10:49 +0100)]
virtio-balloon-pci: switch to the new API.

Here the virtio-balloon-pci is modified for the new API. The device
virtio-balloon-pci extends virtio-pci. It creates and connects a
virtio-balloon during the init. The properties are not changed.

Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Tested-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Message-id: 1364377755-15508-3-git-send-email-fred.konrad@greensocs.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovirtio-balloon: add the virtio-balloon device.
KONRAD Frederic [Wed, 27 Mar 2013 09:49:10 +0000 (10:49 +0100)]
virtio-balloon: add the virtio-balloon device.

Create virtio-balloon which extends virtio-device, so it can be connected on
virtio-bus.

Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Tested-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Message-id: 1364377755-15508-2-git-send-email-fred.konrad@greensocs.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge remote-tracking branch 'stefanha/block' into staging
Anthony Liguori [Thu, 28 Mar 2013 17:57:37 +0000 (12:57 -0500)]
Merge remote-tracking branch 'stefanha/block' into staging

# By Kevin Wolf (22) and Peter Lieven (1)
# Via Stefan Hajnoczi
* stefanha/block: (23 commits)
  block: Fix direct use of protocols as driver for bdrv_open()
  qcow2: Gather clusters in a looping loop
  qcow2: Move cluster gathering to a non-looping loop
  qcow2: Allow requests with multiple l2metas
  qcow2: Use byte granularity in qcow2_alloc_cluster_offset()
  qcow2: Prepare handle_alloc/copied() for byte granularity
  qcow2: handle_copied(): Implement non-zero host_offset
  qcow2: handle_copied(): Get rid of keep_clusters parameter
  qcow2: handle_copied(): Get rid of nb_clusters parameter
  qcow2: Factor out handle_copied()
  qcow2: Clean up handle_alloc()
  qcow2: Finalise interface of handle_alloc()
  qcow2: handle_alloc(): Get rid of keep_clusters parameter
  qcow2: handle_alloc(): Get rid of nb_clusters parameter
  qcow2: Factor out handle_alloc()
  qcow2: Decouple cluster allocation from cluster reuse code
  qcow2: Change handle_dependency to byte granularity
  qcow2: Improve check for overlapping allocations
  qcow2: Handle dependencies earlier
  qcow2: Remove bogus unlock of s->lock
  ...

11 years agoMerge remote-tracking branch 'stefanha/tracing' into staging
Anthony Liguori [Thu, 28 Mar 2013 17:57:32 +0000 (12:57 -0500)]
Merge remote-tracking branch 'stefanha/tracing' into staging

# By Lluís Vilanova (7) and others
# Via Stefan Hajnoczi
* stefanha/tracing:
  vl: add runstate_set tracepoint
  .gitignore: rename trace/generated-tracers.dtrace
  .gitignore: add trace/generated-events.[ch]
  trace: rebuild generated-events.o when configuration changes
  trace: [stderr] Port to generic event information and new control interface
  trace: [simple] Port to generic event information and new control interface
  trace: [default] Port to generic event information and new control interface
  trace: [monitor] Use new event control interface
  trace: Provide a detailed event control interface
  trace: Provide a generic tracing event descriptor
  trace: [tracetool] Explicitly identify public backends

11 years agovl: add runstate_set tracepoint
Kazuya Saito [Fri, 22 Mar 2013 08:26:59 +0000 (17:26 +0900)]
vl: add runstate_set tracepoint

This patch enables us to know RunState transition. It will be userful
for investigation when the trouble occured in special event such like
live migration, shutdown, suspend, and so on.

Signed-off-by: Kazuya Saito <saito.kazuya@jp.fujitsu.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years ago.gitignore: rename trace/generated-tracers.dtrace
Stefan Hajnoczi [Fri, 8 Mar 2013 15:10:12 +0000 (16:10 +0100)]
.gitignore: rename trace/generated-tracers.dtrace

For a while the file was called trace/generated-tracers-dtrace.dtrace
but today it's called trace/generated-tracers.dtrace.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years ago.gitignore: add trace/generated-events.[ch]
Stefan Hajnoczi [Fri, 8 Mar 2013 15:10:11 +0000 (16:10 +0100)]
.gitignore: add trace/generated-events.[ch]

Don't display autogenerated files in git-status(1).

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agotrace: rebuild generated-events.o when configuration changes
Stefan Hajnoczi [Fri, 8 Mar 2013 14:52:15 +0000 (15:52 +0100)]
trace: rebuild generated-events.o when configuration changes

Make sure to rebuild generated-events.o when ./configure options change.
This prevents linker errors when a stale generated-events.o gets linked
with code compiled against fresh headers.  For example, try building
with ./configure --enable-trace-backend=stderr followed by ./configure
--enable-trace-backend=dtrace.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agotrace: [stderr] Port to generic event information and new control interface
Lluís Vilanova [Tue, 5 Mar 2013 13:48:00 +0000 (14:48 +0100)]
trace: [stderr] Port to generic event information and new control interface

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agotrace: [simple] Port to generic event information and new control interface
Lluís Vilanova [Tue, 5 Mar 2013 13:47:55 +0000 (14:47 +0100)]
trace: [simple] Port to generic event information and new control interface

The backend is forced to dump event numbers using 64 bits, as TraceEventID is
an enum.

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agotrace: [default] Port to generic event information and new control interface
Lluís Vilanova [Tue, 5 Mar 2013 13:47:49 +0000 (14:47 +0100)]
trace: [default] Port to generic event information and new control interface

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agotrace: [monitor] Use new event control interface
Lluís Vilanova [Tue, 5 Mar 2013 13:47:43 +0000 (14:47 +0100)]
trace: [monitor] Use new event control interface

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agotrace: Provide a detailed event control interface
Lluís Vilanova [Tue, 5 Mar 2013 13:47:38 +0000 (14:47 +0100)]
trace: Provide a detailed event control interface

This interface decouples event obtaining from interaction.

Events can be obtained through three different methods:

* identifier
* name
* simple wildcard pattern

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agotrace: Provide a generic tracing event descriptor
Lluís Vilanova [Tue, 5 Mar 2013 13:47:32 +0000 (14:47 +0100)]
trace: Provide a generic tracing event descriptor

Uses tracetool to generate a backend-independent tracing event description
(struct TraceEvent).

The values for such structure are generated with the non-public "events"
backend ("events-c" frontend).

The generation of the defines to check if an event is statically enabled is also
moved to the "events" backend ("events-h" frontend).

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agotrace: [tracetool] Explicitly identify public backends
Lluís Vilanova [Tue, 5 Mar 2013 13:47:26 +0000 (14:47 +0100)]
trace: [tracetool] Explicitly identify public backends

Public backends are those printed by "--list-backends" and thus considered valid
by the configure script.

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoblock: Fix direct use of protocols as driver for bdrv_open()
Kevin Wolf [Wed, 27 Mar 2013 16:28:18 +0000 (17:28 +0100)]
block: Fix direct use of protocols as driver for bdrv_open()

bdrv_open_common() implements direct use of protocols by copying the
pre-opened BlockDriverStates to bs using bdrv_swap(). It did however
first set some fields in bs, which end up in file after the swap. When
bdrv_open() destroys file, it appears to be open, and because it isn't,
qemu could segfault while trying to close it.

Reorder the operations to return immediately in such cases so that file
is correctly detected as closed.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoqcow2: Gather clusters in a looping loop
Kevin Wolf [Wed, 27 Mar 2013 10:43:49 +0000 (11:43 +0100)]
qcow2: Gather clusters in a looping loop

Instead of just checking once in exactly this order if there are
dependendies, non-COW clusters and new allocation, this starts looping
around these. This way we can, for example, gather non-COW clusters after
new allocations as long as the host cluster offsets stay contiguous.

Once handle_dependencies() is extended so that COW areas of in-flight
allocations can be overwritten, this allows to continue with gathering
other clusters (we wouldn't be able to do that without this change
because we would have missed a possible second dependency in one of the
next clusters).

This means that in the typical sequential write case, we can combine the
COW overwrite of one cluster with the allocation of the next cluster as
soon as something like Delayed COW gets actually implemented. It is only
by avoiding splitting requests this way that Delayed COW actually starts
improving performance noticably.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoqcow2: Move cluster gathering to a non-looping loop
Kevin Wolf [Tue, 26 Mar 2013 16:50:12 +0000 (17:50 +0100)]
qcow2: Move cluster gathering to a non-looping loop

This patch is mainly to separate the indentation change from the
semantic changes. All that really changes here is that everything moves
into a while loop, all 'goto done' become 'break' and at the end of the
loop a new 'break is inserted.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoqcow2: Allow requests with multiple l2metas
Kevin Wolf [Tue, 26 Mar 2013 16:50:11 +0000 (17:50 +0100)]
qcow2: Allow requests with multiple l2metas

Instead of expecting a single l2meta, have a list of them. This allows
to still have a single I/O request for the guest data, even though
multiple l2meta may be needed in order to describe both a COW overwrite
and a new cluster allocation (typical sequential write case).

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoqcow2: Use byte granularity in qcow2_alloc_cluster_offset()
Kevin Wolf [Tue, 26 Mar 2013 16:50:10 +0000 (17:50 +0100)]
qcow2: Use byte granularity in qcow2_alloc_cluster_offset()

This gets rid of the nb_clusters and keep_clusters and the associated
complicated calculations. Just advance the number of bytes that have
been processed and everything is fine.

This patch advances the variables even after the last operation even
though they aren't used any more afterwards to make things look more
uniform. A later patch will turn the whole thing into a loop and then
it actually starts making sense.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoqcow2: Prepare handle_alloc/copied() for byte granularity
Kevin Wolf [Tue, 26 Mar 2013 16:50:09 +0000 (17:50 +0100)]
qcow2: Prepare handle_alloc/copied() for byte granularity

This makes handle_alloc() and handle_copied() return byte-granularity
host offsets instead of returning always the cluster start. This is
required so that qcow2_alloc_cluster_offset() can stop aligning
everything to cluster boundaries.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoqcow2: handle_copied(): Implement non-zero host_offset
Kevin Wolf [Tue, 26 Mar 2013 16:50:08 +0000 (17:50 +0100)]
qcow2: handle_copied(): Implement non-zero host_offset

Look only for clusters that start at a given physical offset.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoqcow2: handle_copied(): Get rid of keep_clusters parameter
Kevin Wolf [Tue, 26 Mar 2013 16:50:07 +0000 (17:50 +0100)]
qcow2: handle_copied(): Get rid of keep_clusters parameter

Now *bytes is used to return the length of the area that can be written
to without performing an allocation or COW.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoqcow2: handle_copied(): Get rid of nb_clusters parameter
Kevin Wolf [Tue, 26 Mar 2013 16:50:06 +0000 (17:50 +0100)]
qcow2: handle_copied(): Get rid of nb_clusters parameter

handle_copied() uses its bytes parameter now to determine how many
clusters it should try to find.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoqcow2: Factor out handle_copied()
Kevin Wolf [Tue, 26 Mar 2013 16:50:05 +0000 (17:50 +0100)]
qcow2: Factor out handle_copied()

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoqcow2: Clean up handle_alloc()
Kevin Wolf [Tue, 26 Mar 2013 16:50:04 +0000 (17:50 +0100)]
qcow2: Clean up handle_alloc()

Things can be simplified a bit now. No semantic changes.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoqcow2: Finalise interface of handle_alloc()
Kevin Wolf [Tue, 26 Mar 2013 16:50:03 +0000 (17:50 +0100)]
qcow2: Finalise interface of handle_alloc()

The interface works completely on a byte granularity now and duplicated
parameters are removed.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoqcow2: handle_alloc(): Get rid of keep_clusters parameter
Kevin Wolf [Tue, 26 Mar 2013 16:50:02 +0000 (17:50 +0100)]
qcow2: handle_alloc(): Get rid of keep_clusters parameter

handle_alloc() is now called with the offset at which the actual new
allocation starts instead of the offset at which the whole write request
starts, part of which may already be processed.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoqcow2: handle_alloc(): Get rid of nb_clusters parameter
Kevin Wolf [Tue, 26 Mar 2013 16:50:01 +0000 (17:50 +0100)]
qcow2: handle_alloc(): Get rid of nb_clusters parameter

We already communicate the same information in *bytes.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoqcow2: Factor out handle_alloc()
Kevin Wolf [Tue, 26 Mar 2013 16:50:00 +0000 (17:50 +0100)]
qcow2: Factor out handle_alloc()

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoqcow2: Decouple cluster allocation from cluster reuse code
Kevin Wolf [Tue, 26 Mar 2013 16:49:59 +0000 (17:49 +0100)]
qcow2: Decouple cluster allocation from cluster reuse code

This moves some code that prepares the allocation of new clusters to
where the actual allocation happens. This is the minimum required to be
able to move it to a separate function in the next patch.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoqcow2: Change handle_dependency to byte granularity
Kevin Wolf [Tue, 26 Mar 2013 16:49:58 +0000 (17:49 +0100)]
qcow2: Change handle_dependency to byte granularity

This is a more precise description of what really constitutes a
dependency. The behaviour doesn't change at this point because the COW
area of the old request is still aligned to cluster boundaries and
therefore an overlap is detected wheneven the requests touch any part of
the same cluster.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoqcow2: Improve check for overlapping allocations
Kevin Wolf [Tue, 26 Mar 2013 16:49:57 +0000 (17:49 +0100)]
qcow2: Improve check for overlapping allocations

The old code detected an overlapping allocation even when the
allocations didn't actually overlap, but were only adjacent.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoqcow2: Handle dependencies earlier
Kevin Wolf [Tue, 26 Mar 2013 16:49:56 +0000 (17:49 +0100)]
qcow2: Handle dependencies earlier

Handling overlapping allocations isn't just a detail of cluster
allocation. It is rather one of three ways to get the host cluster
offset for a write request:

1. If a request overlaps an in-flight allocations, the cluster offset
   can be taken from there (this is what handle_dependencies will evolve
   into) or the request must just wait until the allocation has
   completed. Accessing the L2 is not valid in this case, it has
   outdated information.

2. Outside overlapping areas, check the clusters that can be written to
   as they are, with no COW involved.

3. If a COW is required, allocate new clusters

Changing the code to reflect this doesn't change the behaviour because
overlaps cannot exist for clusters that are kept in step 2. It does
however make it easier for later patches to work on clusters that belong
to an allocation that is still in flight.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoqcow2: Remove bogus unlock of s->lock
Kevin Wolf [Tue, 26 Mar 2013 16:49:55 +0000 (17:49 +0100)]
qcow2: Remove bogus unlock of s->lock

The unlock wakes up the next coroutine, but the currently running
coroutine will lock it again before it yields, so this doesn't make a
lot of sense.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoqcow2: Fix "total clusters" number in bdrv_check
Kevin Wolf [Tue, 26 Mar 2013 16:49:54 +0000 (17:49 +0100)]
qcow2: Fix "total clusters" number in bdrv_check

This should be based on the virtual disk size, not on the size of the
image.

Interesting observation: With some VM state stored in the image file,
percentages higher than 100% are possible, even though snapshots
themselves are ignored. This is a qcow2 bug to be fixed another day: The
VM state should be discarded in the active L2 tables after completing
the snapshot creation.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoqemu-iotests: More concurrent allocation scenarios
Kevin Wolf [Tue, 26 Mar 2013 16:49:53 +0000 (17:49 +0100)]
qemu-iotests: More concurrent allocation scenarios

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agovl.c: call bdrv_init_with_whitelist() before cmdline parsing
Peter Lieven [Thu, 21 Mar 2013 12:07:10 +0000 (13:07 +0100)]
vl.c: call bdrv_init_with_whitelist() before cmdline parsing

commit 4d454574 "qemu-option: move standard option definitions
out of qemu-config.c" broke support for commandline option
groups that where registered during bdrv_init(). In particular
support for -iscsi options was broken since that commit.

Fix by moving the bdrv_init_with_whitelist() before command
line argument parsing.

Signed-off-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agospice-qemu-char: Drop hackish vmc_register on spice_chr_write
Hans de Goede [Tue, 26 Mar 2013 10:08:03 +0000 (11:08 +0100)]
spice-qemu-char: Drop hackish vmc_register on spice_chr_write

Now that the core takes care of fe_open tracking we no longer need this hack.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Message-id: 1364292483-16564-12-git-send-email-hdegoede@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovirtio-serial: propagate guest_connected to the port on post_load
Alon Levy [Tue, 26 Mar 2013 10:08:02 +0000 (11:08 +0100)]
virtio-serial: propagate guest_connected to the port on post_load

When migrating a host with with a spice agent running the mouse becomes
non operational after the migration due to the agent state being
inconsistent between the guest and the client.

After migration the spicevmc backend on the destination has never been notified
of the (non 0) guest_connected state. Virtio-serial holds this state
information and migrates it, this patch properly propagates this information
to virtio-console and through that to interested chardev backends.

rhbz #725965

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Message-id: 1364292483-16564-11-git-send-email-hdegoede@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovirtio-serial: Consolidate guest_open/guest_close into set_guest_connected
Hans de Goede [Tue, 26 Mar 2013 10:08:01 +0000 (11:08 +0100)]
virtio-serial: Consolidate guest_open/guest_close into set_guest_connected

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Message-id: 1364292483-16564-10-git-send-email-hdegoede@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoqemu-char: add_handlers: Don't re-send the be_open event on unregister
Hans de Goede [Tue, 26 Mar 2013 10:08:00 +0000 (11:08 +0100)]
qemu-char: add_handlers: Don't re-send the be_open event on unregister

Resending the be_open event only is useful when a frontend is registering, not
when it is unregistering.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Message-id: 1364292483-16564-9-git-send-email-hdegoede@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoqemu-char: Move incrementing of avail_connections to qdev-properties-system
Hans de Goede [Tue, 26 Mar 2013 10:07:59 +0000 (11:07 +0100)]
qemu-char: Move incrementing of avail_connections to qdev-properties-system

The decrement of avail_connections is done in qdev-properties-system move
the increment there too for proper balancing of the calls.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Message-id: 1364292483-16564-8-git-send-email-hdegoede@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoqemu-char: Consolidate guest_close/guest_open into a set_fe_open callback
Hans de Goede [Tue, 26 Mar 2013 10:07:58 +0000 (11:07 +0100)]
qemu-char: Consolidate guest_close/guest_open into a set_fe_open callback

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Message-id: 1364292483-16564-7-git-send-email-hdegoede@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoqemu-char: Cleanup: consolidate fe_open/fe_close into fe_set_open
Hans de Goede [Tue, 26 Mar 2013 10:07:57 +0000 (11:07 +0100)]
qemu-char: Cleanup: consolidate fe_open/fe_close into fe_set_open

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Message-id: 1364292483-16564-6-git-send-email-hdegoede@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoqemu-char: Automatically do fe_open / fe_close on qemu_chr_add_handlers
Hans de Goede [Tue, 26 Mar 2013 10:07:56 +0000 (11:07 +0100)]
qemu-char: Automatically do fe_open / fe_close on qemu_chr_add_handlers

Most frontends can't really determine if the guest actually has the frontend
side open. So lets automatically generate fe_open / fe_close as soon as a
frontend becomes ready (as signalled by calling qemu_chr_add_handlers) /
becomes non ready (as signalled by setting all handlers to NULL).

And allow frontends which can actually determine if the guest is listening to
opt-out of this.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Message-id: 1364292483-16564-5-git-send-email-hdegoede@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoqemu-char: Add fe_open tracking
Hans de Goede [Tue, 26 Mar 2013 10:07:55 +0000 (11:07 +0100)]
qemu-char: Add fe_open tracking

Add tracking of the fe_open state to struct CharDriverState.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Message-id: 1364292483-16564-4-git-send-email-hdegoede@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoqemu-char: Rename qemu_chr_generic_open to qemu_chr_be_generic_open
Hans de Goede [Tue, 26 Mar 2013 10:07:54 +0000 (11:07 +0100)]
qemu-char: Rename qemu_chr_generic_open to qemu_chr_be_generic_open

To better reflect that it is for handling a backend being opened.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Message-id: 1364292483-16564-3-git-send-email-hdegoede@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoqemu-char: Rename opened to be_open
Hans de Goede [Tue, 26 Mar 2013 10:07:53 +0000 (11:07 +0100)]
qemu-char: Rename opened to be_open

Rename the opened variable to be_open to reflect that it contains the
opened state of the backend.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Message-id: 1364292483-16564-2-git-send-email-hdegoede@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agocompiler: fix warning with GCC 4.8.0
Paolo Bonzini [Wed, 27 Mar 2013 13:34:32 +0000 (14:34 +0100)]
compiler: fix warning with GCC 4.8.0

GCC 4.8.0 introduces a new warning:

    block/qcow2-snapshot.c: In function 'qcow2_write_snapshots’:
    block/qcow2-snapshot.c:252:18: error: typedef 'qemu_build_bug_on__253'
              locally defined but not used [-Werror=unused-local-typedefs]
         QEMU_BUILD_BUG_ON(offsetof(QCowHeader, snapshots_offset) !=
                  ^
    cc1: all warnings being treated as errors

(Caret diagnostics aren't perfect yet with macros... :)) Work around it
with __attribute__((unused)).

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 1364391272-1128-1-git-send-email-pbonzini@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge remote-tracking branch 'mst/tags/for_anthony' into staging
Anthony Liguori [Tue, 26 Mar 2013 21:16:43 +0000 (16:16 -0500)]
Merge remote-tracking branch 'mst/tags/for_anthony' into staging

virtio,pci,qom

Work by Alex to support VGA assignment,
pci and virtio fixes by Stefan, Jason and myself, and a
new qmp event for hotplug support by myself.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
# gpg: Signature made Tue 26 Mar 2013 02:02:24 PM CDT using RSA key ID D28D5469
# gpg: Can't check signature: public key not found

# By Alex Williamson (13) and others
# Via Michael S. Tsirkin
* mst/tags/for_anthony: (23 commits)
  pcie: Add endpoint capability initialization wrapper
  roms: switch oldnoconfig to olddefconfig
  pcie: Mangle types to match topology
  pci: Create and use API to determine root buses
  pci: Create pci_bus_is_express helper
  pci: Q35, Root Ports, and Switches create PCI Express buses
  pci: Allow PCI bus creation interfaces to specify the type of bus
  pci: Move PCI and PCIE type defines
  pci: Create and register a new PCI Express TypeInfo
  exec: assert that RAMBlock size is non-zero
  pci: refuse empty ROM files
  pci_bridge: Remove duplicate IRQ swizzle function
  pci_bridge: Use a default map_irq function
  pci: Fix INTx routing notifier recursion
  pci_bridge: drop formatting from source
  pci_bridge: factor out common code
  pci: Teach PCI Bridges about VGA routing
  pci: Add PCI VGA helpers
  virtio-pci: guest notifier mask without non-irqfd
  virtio-net: remove layout assumptions for mq ctrl
  ...

11 years agopcie: Add endpoint capability initialization wrapper
Alex Williamson [Tue, 19 Mar 2013 18:11:24 +0000 (12:11 -0600)]
pcie: Add endpoint capability initialization wrapper

Fix the awkward API of mangling the caller specified PCIe type and
just provide an interface to initialize an endpoint device.  This
will pick either a regular endpoint or integrated endpoint based on
the bus and return pcie_cap_init to doing exactly what is asked.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
11 years agoroms: switch oldnoconfig to olddefconfig
Michael S. Tsirkin [Thu, 21 Mar 2013 12:04:21 +0000 (14:04 +0200)]
roms: switch oldnoconfig to olddefconfig

When a new option is added that qemu does not know
about, the prudent thing is to use the default not
force it to "no".

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
11 years agopcie: Mangle types to match topology
Alex Williamson [Thu, 14 Mar 2013 22:01:35 +0000 (16:01 -0600)]
pcie: Mangle types to match topology

Windows will fail to start drivers for devices with an Endpoint type
PCIe capability attached to a Root Complex (code 10 - Device cannot
start).  The proper type for such a device is Root Complex Integrated
Endpoint.  Devices don't care which they are, so do this conversion
automatically.

This allows the Windows driver to load for nec-usb-xhci when attached
to pcie.0 of a q35 machine.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
11 years agopci: Create and use API to determine root buses
Alex Williamson [Thu, 14 Mar 2013 22:01:29 +0000 (16:01 -0600)]
pci: Create and use API to determine root buses

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
11 years agopci: Create pci_bus_is_express helper
Alex Williamson [Thu, 14 Mar 2013 22:01:23 +0000 (16:01 -0600)]
pci: Create pci_bus_is_express helper

For testing the bus type.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
11 years agopci: Q35, Root Ports, and Switches create PCI Express buses
Alex Williamson [Thu, 14 Mar 2013 22:01:17 +0000 (16:01 -0600)]
pci: Q35, Root Ports, and Switches create PCI Express buses

Convert q35, ioh3420, xio3130_upstream, and xio3130_downstream to
use the new TYPE_PCIE_BUS.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
11 years agopci: Allow PCI bus creation interfaces to specify the type of bus
Alex Williamson [Thu, 14 Mar 2013 22:01:11 +0000 (16:01 -0600)]
pci: Allow PCI bus creation interfaces to specify the type of bus

No change to any types.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
11 years agopci: Move PCI and PCIE type defines
Alex Williamson [Thu, 14 Mar 2013 22:01:05 +0000 (16:01 -0600)]
pci: Move PCI and PCIE type defines

Move these so that we can reference them from a more common header
instead of including pci_bus.h everywhere.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
11 years agopci: Create and register a new PCI Express TypeInfo
Alex Williamson [Thu, 14 Mar 2013 22:00:59 +0000 (16:00 -0600)]
pci: Create and register a new PCI Express TypeInfo

This will allow us to differentiate Express and Legacy buses.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
11 years agoexec: assert that RAMBlock size is non-zero
Stefan Hajnoczi [Mon, 11 Mar 2013 09:20:21 +0000 (10:20 +0100)]
exec: assert that RAMBlock size is non-zero

find_ram_offset() does not handle size=0 gracefully.  It hands out the
same RAMBlock offset multiple times, leading to obscure failures later
on.

Add an assert to warn early if something is incorrectly allocating a
zero size RAMBlock.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
11 years agopci: refuse empty ROM files
Stefan Hajnoczi [Mon, 11 Mar 2013 09:20:20 +0000 (10:20 +0100)]
pci: refuse empty ROM files

A zero size ROM file is invalid and should produce a warning.
Attempting to use a zero size file ends up hitting an assertion
qemu_ram_set_idstr() because RAMBlocks with duplicate addresses are
allocated - due to zero size the allocator doesn't increment the next
available RAMBlock offset.

Also convert __FUNCTION__ to __func__ while we're touching this code.
There are no other __FUNCTION__ instances in pci.c anymore.

Reported-by: Milos Ivanovic <milosivanovic@orcon.net.nz>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
11 years agopci_bridge: Remove duplicate IRQ swizzle function
Alex Williamson [Thu, 7 Mar 2013 23:17:00 +0000 (16:17 -0700)]
pci_bridge: Remove duplicate IRQ swizzle function

pci_bridge_dev_map_irq_fn() is identical to pci_swizzle_map_irq_fn(),
which is now the default for all PCI bridges.  We can therefore remove
this function and the pci_bridge_map_irq() call that used it.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
11 years agopci_bridge: Use a default map_irq function
Alex Williamson [Thu, 7 Mar 2013 23:16:54 +0000 (16:16 -0700)]
pci_bridge: Use a default map_irq function

The PCI bridge spec defines a default swizzle for translating INTx
IRQs from secondary bus to primary.  Use this by default for any
bridge that doesn't set a function.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
11 years agopci: Fix INTx routing notifier recursion
Alex Williamson [Thu, 7 Mar 2013 18:29:19 +0000 (11:29 -0700)]
pci: Fix INTx routing notifier recursion

For some reason we recurse to fire the INTx routing notifier for each
child of a bus, for each possible device of a bus.  That means that if
we add a root port, the notifier gets called for that bridge 256
times.  If we add an upstream switch behind that root port, 256^2.  But
of course we need a downstream switch, 256^3.  This starts to be
noticeable.  Stop the insanity.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
11 years agopci_bridge: drop formatting from source
Michael S. Tsirkin [Mon, 4 Mar 2013 09:31:21 +0000 (11:31 +0200)]
pci_bridge: drop formatting from source

We use the same formatting for all files, it
doesn't make sense to have formatting directives only
in pci bridge header.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
11 years agopci_bridge: factor out common code
Michael S. Tsirkin [Mon, 4 Mar 2013 09:23:49 +0000 (11:23 +0200)]
pci_bridge: factor out common code

Reuse common code in pcie_port, override the hardwired-to-0
bits per PCI Express spec.
No functional change but makes the code easier to follow.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
11 years agopci: Teach PCI Bridges about VGA routing
Alex Williamson [Sun, 3 Mar 2013 17:21:32 +0000 (10:21 -0700)]
pci: Teach PCI Bridges about VGA routing

Each PCI Bridge has a set of implied VGA regions that are enabled when
the VGA bit is set in the bridge control register.  This allows VGA
devices behind bridges.  Unfortunately with VGA Enable, which we
formerly allowed but didn't back, comes along some required VGA
baggage.  VGA Palette Snooping is required, along with VGA 16-bit
decoding.  We don't yet have support for palette snooping.
We also don't have support for 10-bit VGA aliases, the default mode, but
we enable the register, even on root ports, to avoid confusing guests.
Fortunately there's likely nothing from this century that requires these
features, so the missing bits are noted with TODOs.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
11 years agopci: Add PCI VGA helpers
Alex Williamson [Sun, 3 Mar 2013 17:21:26 +0000 (10:21 -0700)]
pci: Add PCI VGA helpers

Allow devices to register VGA memory regions for handling PCI spec
defined VGA I/O port and MMIO areas.  PCI will attach these to the
bus address spaces and enable them according to the device command
register value.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
11 years agovirtio-pci: guest notifier mask without non-irqfd
Michael S. Tsirkin [Wed, 13 Mar 2013 19:37:08 +0000 (21:37 +0200)]
virtio-pci: guest notifier mask without non-irqfd

non-irqfd setups are currently broken with vhost:
we start up masked and nothing unmasks the interrupts.
Fix by using mask notifiers, same as the irqfd path.

Sharing irqchip/non irqchip code is always a good thing,
in this case it will help non irqchip benefit
from backend masking optimization.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
11 years agovirtio-net: remove layout assumptions for mq ctrl
Jason Wang [Wed, 6 Mar 2013 05:50:27 +0000 (13:50 +0800)]
virtio-net: remove layout assumptions for mq ctrl

Following commit 921ac5d0f3a0df869db5ce4edf752f51d8b1596a (virtio-net:
remove layout assumptions for ctrl vq), this patch makes multiqueue ctrl
handling not rely on the layout of descriptors.

Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
11 years agoqmp: add path to device_deleted event
Michael S. Tsirkin [Mon, 11 Mar 2013 13:11:04 +0000 (15:11 +0200)]
qmp: add path to device_deleted event

Add QOM path to device deleted event.  It now becomes useful to report
it for devices which don't have an ID assigned.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
11 years agoqom: call class destructor before unparent
Michael S. Tsirkin [Mon, 18 Mar 2013 19:01:37 +0000 (21:01 +0200)]
qom: call class destructor before unparent

It seems more logical to have destruction flow start with the subclass
and move up to the base class.  This ensures object has a valid
canonical path when destructor is called.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
11 years agoMerge remote-tracking branch 'quintela/migration.next' into staging
Anthony Liguori [Tue, 26 Mar 2013 18:38:00 +0000 (13:38 -0500)]
Merge remote-tracking branch 'quintela/migration.next' into staging

# By Peter Lieven (9) and others
# Via Juan Quintela
* quintela/migration.next: (22 commits)
  Use qemu_put_buffer_async for guest memory pages
  Add qemu_put_buffer_async
  Use writev ops if available
  Store the data to send also in iovec
  Update bytes_xfer in qemu_put_byte
  Add socket_writev_buffer function
  Add QemuFileWritevBuffer QemuFileOps
  migration: use XBZRLE only after bulk stage
  migration: do not search dirty pages in bulk stage
  migration: do not sent zero pages in bulk stage
  migration: add an indicator for bulk state of ram migration
  migration: search for zero instead of dup pages
  bitops: unroll while loop in find_next_bit()
  buffer_is_zero: use vector optimizations if possible
  cutils: add a function to find non-zero content in a buffer
  move vector definitions to qemu-common.h
  savevm: Fix bugs in the VMSTATE_VBUFFER_MULTIPLY definition
  savevm: Add VMSTATE_STRUCT_VARRAY_POINTER_UINT32
  savevm: Add VMSTATE_FLOAT64 helpers
  savevm: Add VMSTATE_UINTTL_EQUAL helper
  ...

11 years agoMerge remote-tracking branch 'cohuck/virtio-ccw-upstr' into staging
Anthony Liguori [Tue, 26 Mar 2013 18:34:38 +0000 (13:34 -0500)]
Merge remote-tracking branch 'cohuck/virtio-ccw-upstr' into staging

# By Cornelia Huck
# Via Cornelia Huck
* cohuck/virtio-ccw-upstr:
  virtio-ccw: Queue sanity check for notify hypercall.

11 years agovirtio-ccw: Queue sanity check for notify hypercall.
Cornelia Huck [Tue, 26 Mar 2013 16:32:44 +0000 (17:32 +0100)]
virtio-ccw: Queue sanity check for notify hypercall.

Verify that the virtio-ccw notify hypercall passed a reasonable
value for queue.

Cc: qemu-stable@nongnu.org
Reported-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
11 years agoqtest: use synchronous I/O for char device
Anthony Liguori [Tue, 26 Mar 2013 15:04:43 +0000 (10:04 -0500)]
qtest: use synchronous I/O for char device

Peter reported that rtc-test would periodically hang.  It turns out
this was due to an EAGAIN occurring on qemu_chr_fe_write.

Instead of heavily refactoring qtest, just use a synchronous version
of the write operation for qemu_chr_fe_write to address this problem.

Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agochar: introduce a blocking version of qemu_chr_fe_write
Anthony Liguori [Tue, 26 Mar 2013 15:04:17 +0000 (10:04 -0500)]
char: introduce a blocking version of qemu_chr_fe_write

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agohw/qdev: Abort rather than ignoring errors adding device properties
Peter Maydell [Mon, 25 Mar 2013 13:15:14 +0000 (13:15 +0000)]
hw/qdev: Abort rather than ignoring errors adding device properties

Instead of ignoring any errors that occur when adding properties
to a new device in device_initfn(), check for them and abort if any
occur. The most likely cause is accidentally adding a duplicate
property, which is a programming error by the device author.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 1364217314-7400-3-git-send-email-peter.maydell@linaro.org
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoqom: Detect attempts to add a property that already exists
Peter Maydell [Mon, 25 Mar 2013 13:15:13 +0000 (13:15 +0000)]
qom: Detect attempts to add a property that already exists

Detect attempts to add a property to an object if one of
that name already exists, and report them as errors.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 1364217314-7400-2-git-send-email-peter.maydell@linaro.org
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agohw/qdev-properties.c: Improve diagnostic for setting property after realize
Peter Maydell [Mon, 25 Mar 2013 13:40:44 +0000 (13:40 +0000)]
hw/qdev-properties.c: Improve diagnostic for setting property after realize

Now we have error_setg() we can improve the error message emitted if
you attempt to set a property of a device after the device is realized
(the previous message was "permission denied" which was not very
informative).

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1364218844-7509-1-git-send-email-peter.maydell@linaro.org
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovirtio-scsi: cleanup: remove qdev field.
KONRAD Frederic [Thu, 21 Mar 2013 14:15:20 +0000 (15:15 +0100)]
virtio-scsi: cleanup: remove qdev field.

The qdev field is no longer needed. Just drop it.

Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Tested-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Message-id: 1363875320-7985-11-git-send-email-fred.konrad@greensocs.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovirtio-scsi: cleanup: init and exit functions.
KONRAD Frederic [Thu, 21 Mar 2013 14:15:19 +0000 (15:15 +0100)]
virtio-scsi: cleanup: init and exit functions.

This remove old init and exit function as they are no longer needed.

Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Tested-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Message-id: 1363875320-7985-10-git-send-email-fred.konrad@greensocs.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>