]> Git Repo - qemu.git/log
qemu.git
10 years agoMerge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging
Peter Maydell [Fri, 29 Aug 2014 17:40:04 +0000 (18:40 +0100)]
Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging

Block pull request

# gpg: Signature made Fri 29 Aug 2014 17:25:58 BST using RSA key ID 81AB73C8
# gpg: Good signature from "Stefan Hajnoczi <[email protected]>"
# gpg:                 aka "Stefan Hajnoczi <[email protected]>"

* remotes/stefanha/tags/block-pull-request: (35 commits)
  quorum: Fix leak of opts in quorum_open
  blkverify: Fix leak of opts in blkverify_open
  nfs: Fix leak of opts in nfs_file_open
  curl: Don't deref NULL pointer in call to aio_poll.
  curl: Allow a cookie or cookies to be sent with http/https requests.
  virtio-blk: allow drive_del with dataplane
  block: acquire AioContext in do_drive_del()
  linux-aio: avoid deadlock in nested aio_poll() calls
  qemu-iotests: add multiwrite test cases
  block: fix overlapping multiwrite requests
  nbd: Follow the BDS' AIO context
  block: Add AIO context notifiers
  nbd: Drop nbd_can_read()
  sheepdog: fix a core dump while do auto-reconnecting
  aio-win32: add support for sockets
  qemu-coroutine-io: fix for Win32
  AioContext: introduce aio_prepare
  aio-win32: add aio_set_dispatching optimization
  test-aio: test timers on Windows too
  AioContext: export and use aio_dispatch
  ...

Signed-off-by: Peter Maydell <[email protected]>
10 years agoquorum: Fix leak of opts in quorum_open
Fam Zheng [Thu, 28 Aug 2014 05:56:12 +0000 (13:56 +0800)]
quorum: Fix leak of opts in quorum_open

Signed-off-by: Fam Zheng <[email protected]>
Reviewed-by: Benoît Canet <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
10 years agoblkverify: Fix leak of opts in blkverify_open
Fam Zheng [Thu, 28 Aug 2014 05:56:11 +0000 (13:56 +0800)]
blkverify: Fix leak of opts in blkverify_open

Signed-off-by: Fam Zheng <[email protected]>
Reviewed-by: Benoît Canet <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
10 years agonfs: Fix leak of opts in nfs_file_open
Fam Zheng [Thu, 28 Aug 2014 05:56:10 +0000 (13:56 +0800)]
nfs: Fix leak of opts in nfs_file_open

Signed-off-by: Fam Zheng <[email protected]>
Reviewed-by: Benoît Canet <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
10 years agocurl: Don't deref NULL pointer in call to aio_poll.
Richard W.M. Jones [Thu, 28 Aug 2014 08:04:21 +0000 (09:04 +0100)]
curl: Don't deref NULL pointer in call to aio_poll.

In commit 63f0f45f2e89b60ff8245fec81328ddfde42a303 the following
mechanical change was made:

         if (!state) {
-            qemu_aio_wait();
+            aio_poll(state->s->aio_context, true);
         }

The new code now checks if state is NULL and then dereferences it
('state->s') which is obviously incorrect.

This commit replaces state->s->aio_context with
bdrv_get_aio_context(bs), fixing this problem.  The two other hunks
are concerned with getting the BlockDriverState pointer bs to where it
is needed.

The original bug causes a segfault when using libguestfs to access a
VMware vCenter Server and doing any kind of complex read-heavy
operations.  With this commit the segfault goes away.

Signed-off-by: Richard W.M. Jones <[email protected]>
Reviewed-by: Paolo Bonzini <[email protected]>
Reviewed-by: Benoît Canet <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
10 years agocurl: Allow a cookie or cookies to be sent with http/https requests.
Richard W.M. Jones [Fri, 29 Aug 2014 15:03:12 +0000 (16:03 +0100)]
curl: Allow a cookie or cookies to be sent with http/https requests.

In order to access VMware ESX efficiently, we need to send a session
cookie.  This patch is very simple and just allows you to send that
session cookie.  It punts on the question of how you get the session
cookie in the first place, but in practice you can just run a `curl'
command against the server and extract the cookie that way.

To use it, add file.cookie to the curl URL.  For example:

$ qemu-img info 'json: {
    "file.driver":"https",
    "file.url":"https://vcenter/folder/Windows%202003/Windows%202003-flat.vmdk?dcPath=Datacenter&dsName=datastore1",
    "file.sslverify":"off",
    "file.cookie":"vmware_soap_session=\"52a01262-bf93-ccce-d379-8dabb3e55560\""}'
image: [...]
file format: raw
virtual size: 8.0G (8589934592 bytes)
disk size: unavailable

Signed-off-by: Richard W.M. Jones <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
10 years agovirtio-blk: allow drive_del with dataplane
Stefan Hajnoczi [Mon, 18 Aug 2014 15:07:13 +0000 (16:07 +0100)]
virtio-blk: allow drive_del with dataplane

Now that drive_del acquires the AioContext we can safely allow deleting
the drive.  As with non-dataplane mode, all I/Os submitted by the guest
after drive_del will return EIO.

This patch makes hot unplug work with virtio-blk dataplane.  Previously
drive_del reported an error because the device was busy.

Signed-off-by: Stefan Hajnoczi <[email protected]>
10 years agoblock: acquire AioContext in do_drive_del()
Stefan Hajnoczi [Mon, 18 Aug 2014 15:07:12 +0000 (16:07 +0100)]
block: acquire AioContext in do_drive_del()

Make drive_del safe for dataplane where another thread may be running
the BlockDriverState's AioContext.

Note the assumption that AioContext's lifetime exceeds DriveInfo and
BlockDriverState.  We release AioContext after DriveInfo and
BlockDriverState are potentially freed.

This is clearly safe with the global AioContext but also with -object
iothread and implicit iothreads created by -device
virtio-blk-pci,x-data-plane=on (their lifetime is tied to DeviceState,
not BlockDriverState).

Signed-off-by: Stefan Hajnoczi <[email protected]>
10 years agolinux-aio: avoid deadlock in nested aio_poll() calls
Stefan Hajnoczi [Mon, 4 Aug 2014 15:56:33 +0000 (16:56 +0100)]
linux-aio: avoid deadlock in nested aio_poll() calls

If two Linux AIO request completions are fetched in the same
io_getevents() call, QEMU will deadlock if request A's callback waits
for request B to complete using an aio_poll() loop.  This was reported
to happen with the mirror blockjob.

This patch moves completion processing into a BH and makes it resumable.
Nested event loops can resume completion processing so that request B
will complete and the deadlock will not occur.

Cc: Kevin Wolf <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Cc: Ming Lei <[email protected]>
Cc: Marcin Gibuła <[email protected]>
Reported-by: Marcin Gibuła <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
Tested-by: Marcin Gibuła <[email protected]>
10 years agoMerge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20140829' into...
Peter Maydell [Fri, 29 Aug 2014 14:48:15 +0000 (15:48 +0100)]
Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20140829' into staging

target-arm queue:
 * support PMCCNTR in ARMv8
 * various GIC fixes and cleanups
 * Correct Cortex-A57 ISAR5 and AA64ISAR0 ID register values
 * Fix regression that disabled VFP for ARMv5 CPUs
 * Update to upstream VIXL 1.5

# gpg: Signature made Fri 29 Aug 2014 15:34:47 BST using RSA key ID 14360CDE
# gpg: Good signature from "Peter Maydell <[email protected]>"

* remotes/pmaydell/tags/pull-target-arm-20140829:
  target-arm: Implement pmccfiltr_write function
  target-arm: Remove old code and replace with new functions
  target-arm: Implement pmccntr_sync function
  target-arm: Add arm_ccnt_enabled function
  target-arm: Implement PMCCNTR_EL0 and related registers
  arm: Implement PMCCNTR 32b read-modify-write
  target-arm: Make the ARM PMCCNTR register 64-bit
  hw/intc/arm_gic: honor target mask in gic_update()
  aarch64: raise max_cpus to 8
  arm_gic: Use GIC_NR_SGIS constant
  arm_gic: Do not force PPIs to edge-triggered mode
  arm_gic: GICD_ICFGR: Write model only for pre v1 GICs
  arm_gic: Fix read of GICD_ICFGR
  target-arm: Correct Cortex-A57 ISAR5 and AA64ISAR0 ID register values
  target-arm: Fix regression that disabled VFP for ARMv5 CPUs
  disas/libvixl: Update to upstream VIXL 1.5

Signed-off-by: Peter Maydell <[email protected]>
10 years agotarget-arm: Implement pmccfiltr_write function
Alistair Francis [Fri, 29 Aug 2014 14:00:30 +0000 (15:00 +0100)]
target-arm: Implement pmccfiltr_write function

This is the function that is called when writing to the
PMCCFILTR_EL0 register

Signed-off-by: Alistair Francis <[email protected]>
Signed-off-by: Peter Crosthwaite <[email protected]>
Message-id: 73da3da6404855b17d5ae82975a32ff3a4dcae3d.1409025949[email protected]
Signed-off-by: Peter Maydell <[email protected]>
10 years agotarget-arm: Remove old code and replace with new functions
Alistair Francis [Fri, 29 Aug 2014 14:00:30 +0000 (15:00 +0100)]
target-arm: Remove old code and replace with new functions

Remove the old PMCCNTR code and replace it with calls to the new
pmccntr_sync() and arm_ccnt_enabled() functions.

Signed-off-by: Alistair Francis <[email protected]>
Signed-off-by: Peter Crosthwaite <[email protected]>
Message-id: 693a6e437d915c2195fd3dc7303f384ca538b7bf.1409025949[email protected]
Signed-off-by: Peter Maydell <[email protected]>
10 years agotarget-arm: Implement pmccntr_sync function
Alistair Francis [Fri, 29 Aug 2014 14:00:29 +0000 (15:00 +0100)]
target-arm: Implement pmccntr_sync function

This is used to synchronise the PMCCNTR counter and swap its
state between enabled and disabled if required. It must always
be called twice, both before and after any logic that could
change the state of the PMCCNTR counter.

Signed-off-by: Alistair Francis <[email protected]>
Signed-off-by: Peter Crosthwaite <[email protected]>
Message-id: 62811d4c0f7b1384f7aab62ea2fcfda3dcb0db50.1409025949[email protected]
[PMM: fixed minor typos in pmccntr_sync doc comment]
Signed-off-by: Peter Maydell <[email protected]>
10 years agotarget-arm: Add arm_ccnt_enabled function
Alistair Francis [Fri, 29 Aug 2014 14:00:29 +0000 (15:00 +0100)]
target-arm: Add arm_ccnt_enabled function

Include a helper function to determine if the CCNT counter
is enabled.

Signed-off-by: Alistair Francis <[email protected]>
Signed-off-by: Peter Crosthwaite <[email protected]>
Message-id: e1a64f17a756e06c8bda8238ad4826d705049f7a.1409025949[email protected]
[ PC changes
  * Remove EL based checks
]
Signed-off-by: Peter Crosthwaite <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
10 years agotarget-arm: Implement PMCCNTR_EL0 and related registers
Alistair Francis [Fri, 29 Aug 2014 14:00:29 +0000 (15:00 +0100)]
target-arm: Implement PMCCNTR_EL0 and related registers

This patch adds support for the ARMv8 version of the PMCCNTR and
related registers. It also starts to implement the PMCCFILTR_EL0
register.

Signed-off-by: Alistair Francis <[email protected]>
Signed-off-by: Peter Crosthwaite <[email protected]>
Message-id: b5d1094764a5416363ee95216799b394ecd011e8.1409025949[email protected]
Signed-off-by: Peter Maydell <[email protected]>
10 years agoarm: Implement PMCCNTR 32b read-modify-write
Peter Crosthwaite [Fri, 29 Aug 2014 14:00:29 +0000 (15:00 +0100)]
arm: Implement PMCCNTR 32b read-modify-write

The register is now 64bit, however a 32 bit write to the register
should leave the higher bits unchanged. The open coded write handler
does not implement this, so we need to read-modify-write accordingly.

Signed-off-by: Peter Crosthwaite <[email protected]>
Reviewed-by: Alistair Francis <[email protected]>
Message-id: ec350573424bb2adc1701c3b9278d26598e2f2d1.1409025949[email protected]
Signed-off-by: Peter Maydell <[email protected]>
10 years agotarget-arm: Make the ARM PMCCNTR register 64-bit
Alistair Francis [Fri, 29 Aug 2014 14:00:29 +0000 (15:00 +0100)]
target-arm: Make the ARM PMCCNTR register 64-bit

This makes the PMCCNTR register 64-bit to allow for the
64-bit ARMv8 version.

Signed-off-by: Peter Crosthwaite <[email protected]>
Signed-off-by: Alistair Francis <[email protected]>
Message-id: 6c5bac5fd0ea54963b1fc0e7f9464909f2e19a73.1409025949[email protected]
Signed-off-by: Peter Maydell <[email protected]>
10 years agohw/intc/arm_gic: honor target mask in gic_update()
Sergey Fedorov [Fri, 29 Aug 2014 14:00:29 +0000 (15:00 +0100)]
hw/intc/arm_gic: honor target mask in gic_update()

Take IRQ target mask into account when determining the highest priority
pending interrupt.

Signed-off-by: Sergey Fedorov <[email protected]>
Acked-by: Christoffer Dall <[email protected]>
Message-id: 1407947471[email protected]
Signed-off-by: Peter Maydell <[email protected]>
10 years agoaarch64: raise max_cpus to 8
Joel Schopp [Fri, 29 Aug 2014 14:00:29 +0000 (15:00 +0100)]
aarch64: raise max_cpus to 8

I'm running on a system with 8 cpus and it would be nice to have qemu
support all of them.  The attached patch does that and has been tested.

That said, I'm not sure if 8 is enough or if we want to bump this even higher
now before systems with many more cpus come along. 255 anyone?

Cc: Peter Maydell <[email protected]>
Signed-off-by: Joel Schopp <[email protected]>
Message-id: 20140819213304[email protected]
Signed-off-by: Peter Maydell <[email protected]>
10 years agoarm_gic: Use GIC_NR_SGIS constant
Adam Lackorzynski [Fri, 29 Aug 2014 14:00:29 +0000 (15:00 +0100)]
arm_gic: Use GIC_NR_SGIS constant

Use constant rather than a plain number.

Acked-by: Christoffer Dall <[email protected]>
Signed-off-by: Adam Lackorzynski <[email protected]>
Message-id: 1408372255[email protected]
Signed-off-by: Peter Maydell <[email protected]>
10 years agoarm_gic: Do not force PPIs to edge-triggered mode
Adam Lackorzynski [Fri, 29 Aug 2014 14:00:28 +0000 (15:00 +0100)]
arm_gic: Do not force PPIs to edge-triggered mode

Only SGIs must be WI, done by forcing them to their default
(edge-triggered).

Acked-by: Christoffer Dall <[email protected]>
Signed-off-by: Adam Lackorzynski <[email protected]>
Message-id: 1408372255[email protected]
Signed-off-by: Peter Maydell <[email protected]>
10 years agoarm_gic: GICD_ICFGR: Write model only for pre v1 GICs
Adam Lackorzynski [Fri, 29 Aug 2014 14:00:28 +0000 (15:00 +0100)]
arm_gic: GICD_ICFGR: Write model only for pre v1 GICs

Setting the model is only available in pre-v1 GIC models.

Acked-by: Christoffer Dall <[email protected]>
Signed-off-by: Adam Lackorzynski <[email protected]>
Message-id: 1408372255[email protected]
Signed-off-by: Peter Maydell <[email protected]>
10 years agoarm_gic: Fix read of GICD_ICFGR
Adam Lackorzynski [Fri, 29 Aug 2014 14:00:28 +0000 (15:00 +0100)]
arm_gic: Fix read of GICD_ICFGR

The GICD_ICFGR register covers 4 interrupts per byte.

Acked-by: Christoffer Dall <[email protected]>
Signed-off-by: Adam Lackorzynski <[email protected]>
Message-id: 1408372255[email protected]
Signed-off-by: Peter Maydell <[email protected]>
10 years agotarget-arm: Correct Cortex-A57 ISAR5 and AA64ISAR0 ID register values
Peter Maydell [Fri, 29 Aug 2014 14:00:28 +0000 (15:00 +0100)]
target-arm: Correct Cortex-A57 ISAR5 and AA64ISAR0 ID register values

We implement the crypto extensions but were incorrectly reporting
ID register values for the Cortex-A57 which did not advertise
crypto. Use the correct values as described in the TRM.
With this fix Linux correctly detects presence of the crypto
features and advertises them in /proc/cpuinfo.

Reported-by: Ard Biesheuvel <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
Message-id: 1408718660[email protected]
Cc: [email protected]
Signed-off-by: Peter Maydell <[email protected]>
10 years agotarget-arm: Fix regression that disabled VFP for ARMv5 CPUs
Peter Maydell [Fri, 29 Aug 2014 14:00:28 +0000 (15:00 +0100)]
target-arm: Fix regression that disabled VFP for ARMv5 CPUs

Commit 2c7ffc414 added support for honouring the CPACR coprocessor
access control register bits which may disable access to VFP
and Neon instructions. However it failed to account for the
fact that the CPACR is only present starting from the ARMv6
architecture version, so it accidentally disabled VFP completely
for ARMv5 CPUs like the ARM926. Linux would detect this as
"no VFP present" and probably fall back to its own emulation,
but other guest OSes might crash or misbehave.

This fixes bug LP:1359930.

Reported-by: Jakub Jermar <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
Message-id: 1408714940[email protected]
Cc: [email protected]
Signed-off-by: Peter Maydell <[email protected]>
10 years agodisas/libvixl: Update to upstream VIXL 1.5
Peter Maydell [Fri, 29 Aug 2014 14:00:27 +0000 (15:00 +0100)]
disas/libvixl: Update to upstream VIXL 1.5

Update our copy of libvixl to upstream's 1.5 release.
This includes the upstream versions of the fixes we
were carrying locally (commit ffebe899).

Signed-off-by: Peter Maydell <[email protected]>
Message-id: 1407162987[email protected]

10 years agoqemu-iotests: add multiwrite test cases
Stefan Hajnoczi [Wed, 30 Jul 2014 08:53:31 +0000 (09:53 +0100)]
qemu-iotests: add multiwrite test cases

This test case covers the basic bdrv_aio_multiwrite() scenarios:
1. Single request
2. Sequential requests (AABB)
3. Superset overlapping requests (AABBAA)
4. Subset overlapping requests (BBAABB)
5. Head overlapping requests (AABB)
6. Tail overlapping requests (BBAA)
7. Disjoint requests (AA BB)

Signed-off-by: Stefan Hajnoczi <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Reviewed-by: Benoit Canet <[email protected]>
10 years agoblock: fix overlapping multiwrite requests
Stefan Hajnoczi [Wed, 30 Jul 2014 08:53:30 +0000 (09:53 +0100)]
block: fix overlapping multiwrite requests

When request A is a strict superset of request B:

  AAAAAAAA
    BBBB

multiwrite_merge() merges them as follows:

  AABBBB

The tail of request A should have been included:

  AABBBBAA

This patch fixes data loss but this code path is probably rare.  Since
guests cannot assume ordering between in-flight requests, few
applications submit overlapping write requests.

Reported-by: Slava Pestov <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Reviewed-by: Benoit Canet <[email protected]>
10 years agoMerge remote-tracking branch 'remotes/kraxel/tags/pull-usb-20140829-1' into staging
Peter Maydell [Fri, 29 Aug 2014 12:08:04 +0000 (13:08 +0100)]
Merge remote-tracking branch 'remotes/kraxel/tags/pull-usb-20140829-1' into staging

usb: bugfix collection.
usb: add cleanup functions for host adapters,
     in preparation for hotplug support.
usb: add simple qtests for uhci,ohci,xhci.

# gpg: Signature made Fri 29 Aug 2014 12:56:20 BST using RSA key ID D3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <[email protected]>"
# gpg:                 aka "Gerd Hoffmann <[email protected]>"
# gpg:                 aka "Gerd Hoffmann (private) <[email protected]>"

* remotes/kraxel/tags/pull-usb-20140829-1:
  tests: add xHCI qtest
  tests: add UHCI qtest
  tests: add OHCI qtest
  usb: add usb host adapters exit trace
  usb-xhci: add exit function
  usb-ehci: add ehci-pci device exit function
  usb-ehci: add ehci unrealize funciton
  usb-ehci: add vmstate properity for EHCIState
  usb-uhci: clean up uhci resource when pci-uhci exit
  usb-ohci: add exit function
  usb-ohci: Fix memory leak for ohci timer
  usb: add usb_bus_release function
  Revert "xhci: Fix number of streams allocated when using streams"
  xhci: use (1u << i)
  Fix OHCI ISO TD state never being written back.
  xhci: fix debug print compiling error
  usb: Fix bootindex for portnr > 9

Signed-off-by: Peter Maydell <[email protected]>
10 years agotests: add xHCI qtest
Gonglei [Mon, 23 Jun 2014 11:53:53 +0000 (19:53 +0800)]
tests: add xHCI qtest

Signed-off-by: Gonglei <[email protected]>
Signed-off-by: Gerd Hoffmann <[email protected]>
10 years agotests: add UHCI qtest
Gonglei [Mon, 23 Jun 2014 11:53:52 +0000 (19:53 +0800)]
tests: add UHCI qtest

Signed-off-by: Gonglei <[email protected]>
Signed-off-by: Gerd Hoffmann <[email protected]>
10 years agotests: add OHCI qtest
Gonglei [Mon, 23 Jun 2014 11:53:51 +0000 (19:53 +0800)]
tests: add OHCI qtest

Signed-off-by: Gonglei <[email protected]>
Signed-off-by: Gerd Hoffmann <[email protected]>
10 years agousb: add usb host adapters exit trace
Gonglei [Wed, 4 Jun 2014 08:31:55 +0000 (16:31 +0800)]
usb: add usb host adapters exit trace

Signed-off-by: Gonglei <[email protected]>
Signed-off-by: Gerd Hoffmann <[email protected]>
10 years agousb-xhci: add exit function
Gonglei [Wed, 4 Jun 2014 08:31:53 +0000 (16:31 +0800)]
usb-xhci: add exit function

clean up xhci resource when xhci pci device exit.

Signed-off-by: Gonglei <[email protected]>
Signed-off-by: Gerd Hoffmann <[email protected]>
10 years agousb-ehci: add ehci-pci device exit function
Gonglei [Wed, 4 Jun 2014 08:31:52 +0000 (16:31 +0800)]
usb-ehci: add ehci-pci device exit function

clean up ehci resource when ehci pci device exit.

Signed-off-by: Gonglei <[email protected]>
Signed-off-by: Gerd Hoffmann <[email protected]>
10 years agousb-ehci: add ehci unrealize funciton
Gonglei [Wed, 4 Jun 2014 08:31:51 +0000 (16:31 +0800)]
usb-ehci: add ehci unrealize funciton

cleanup ehci controller resource, both pci and sysbus
if they're necessary.

Signed-off-by: Gonglei <[email protected]>
Signed-off-by: Gerd Hoffmann <[email protected]>
10 years agousb-ehci: add vmstate properity for EHCIState
Gonglei [Wed, 4 Jun 2014 08:31:50 +0000 (16:31 +0800)]
usb-ehci: add vmstate properity for EHCIState

since hotunplug the ehci host adapter, we should
delete vm_change_state_handler also, so the
VMChangeStateEntry should be saved in EHCIState.

Signed-off-by: Gonglei <[email protected]>
Signed-off-by: Gerd Hoffmann <[email protected]>
10 years agousb-uhci: clean up uhci resource when pci-uhci exit
Gonglei [Wed, 4 Jun 2014 08:31:49 +0000 (16:31 +0800)]
usb-uhci: clean up uhci resource when pci-uhci exit

clean up uhci resource when uhci pci device exit.

Signed-off-by: Gonglei <[email protected]>
Signed-off-by: Gerd Hoffmann <[email protected]>
10 years agousb-ohci: add exit function
Gonglei [Wed, 4 Jun 2014 08:31:48 +0000 (16:31 +0800)]
usb-ohci: add exit function

clean up ohci resource when ohci pci device exit.

Signed-off-by: Gonglei <[email protected]>
Signed-off-by: Gerd Hoffmann <[email protected]>
10 years agousb-ohci: Fix memory leak for ohci timer
Gonglei [Wed, 4 Jun 2014 08:31:47 +0000 (16:31 +0800)]
usb-ohci: Fix memory leak for ohci timer

Signed-off-by: Gonglei <[email protected]>
Signed-off-by: Gerd Hoffmann <[email protected]>
10 years agousb: add usb_bus_release function
Gonglei [Wed, 4 Jun 2014 08:31:46 +0000 (16:31 +0800)]
usb: add usb_bus_release function

add global variables releasing logic when the usb buses
were removed or hot-unpluged.

Signed-off-by: Gonglei <[email protected]>
Signed-off-by: Gerd Hoffmann <[email protected]>
10 years agoRevert "xhci: Fix number of streams allocated when using streams"
Gerd Hoffmann [Fri, 29 Aug 2014 10:40:55 +0000 (12:40 +0200)]
Revert "xhci: Fix number of streams allocated when using streams"

This reverts commit d063c3112c4cd23a479ee18720c2bd119da2d315.

"2 << x" is the same as "2 ^ (x + 1)", so the old code is correct.

Signed-off-by: Gerd Hoffmann <[email protected]>
10 years agoxhci: use (1u << i)
Gerd Hoffmann [Thu, 28 Aug 2014 08:51:35 +0000 (10:51 +0200)]
xhci: use (1u << i)

Signed-off-by: Gerd Hoffmann <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
10 years agoFix OHCI ISO TD state never being written back.
Jack Un [Sat, 9 Aug 2014 20:34:36 +0000 (23:34 +0300)]
Fix OHCI ISO TD state never being written back.

There appears to be typo in OHCI with isochronous transfers
resulting in isoch. transfer descriptor state never being written back.
The'put_words' function is in a OR statement hence it is never called.

Signed-off-by: Jack Un <[email protected]>
Signed-off-by: Gerd Hoffmann <[email protected]>
10 years agoxhci: fix debug print compiling error
Gonglei [Thu, 21 Aug 2014 12:48:58 +0000 (20:48 +0800)]
xhci: fix debug print compiling error

after commit 003e15a180373048f0c1f4df0bfe303746eb2676
the DPRINTF will broke compiling, adjust its location.

Signed-off-by: Gonglei <[email protected]>
Signed-off-by: Gerd Hoffmann <[email protected]>
10 years agousb: Fix bootindex for portnr > 9
Markus Armbruster [Fri, 15 Aug 2014 11:32:36 +0000 (13:32 +0200)]
usb: Fix bootindex for portnr > 9

We identify devices by their Open Firmware device paths.  The encoding
of the host controller and hub port numbers is incorrect:
usb_get_fw_dev_path() formats them in decimal, while SeaBIOS uses
hexadecimal.  When some port number > 9, SeaBIOS will miss the
bootindex (lucky case), or apply it to another device (unlucky case).

The relevant spec[*] agrees with SeaBIOS (and OVMF, for that matter).
Change %d to %x.

Bug can bite only with host controllers or hubs sporting more than ten
ports.  I'm not aware of any.

[*] Open Firmware Recommended Practice: Universal Serial Bus,
Version 1, Section 3.2.1 Device Node Address Representation
http://www.openfirmware.org/1275/bindings/usb/usb-1_0.ps

Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Laszlo Ersek <[email protected]>
Note: xhci can be configured with up to 15 ports (default is 4 ports).

Signed-off-by: Gerd Hoffmann <[email protected]>
10 years agonbd: Follow the BDS' AIO context
Max Reitz [Fri, 20 Jun 2014 19:57:34 +0000 (21:57 +0200)]
nbd: Follow the BDS' AIO context

Keep the NBD server always in the same AIO context as the exported BDS
by calling bdrv_add_aio_context_notifier() and implementing the required
callbacks.

Signed-off-by: Max Reitz <[email protected]>
Reviewed-by: Stefan Hajnoczi <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
10 years agoblock: Add AIO context notifiers
Max Reitz [Fri, 20 Jun 2014 19:57:33 +0000 (21:57 +0200)]
block: Add AIO context notifiers

If a long-running operation on a BDS wants to always remain in the same
AIO context, it somehow needs to keep track of the BDS changing its
context. This adds a function for registering callbacks on a BDS which
are called whenever the BDS is attached or detached from an AIO context.

Signed-off-by: Max Reitz <[email protected]>
Reviewed-by: Stefan Hajnoczi <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
10 years agonbd: Drop nbd_can_read()
Max Reitz [Fri, 20 Jun 2014 19:57:32 +0000 (21:57 +0200)]
nbd: Drop nbd_can_read()

There is no variant of aio_set_fd_handler() like qemu_set_fd_handler2(),
so we cannot give a can_read() callback function. Instead, unregister
the nbd_read() function whenever we cannot read and re-register it as
soon as we can read again.

All this is hidden behind the functions nbd_set_handlers() (which
registers all handlers for the AIO context and file descriptor belonging
to the given client), nbd_unset_handlers() (which unregisters them) and
nbd_update_can_read() (which checks whether NBD can read for the given
client and acts accordingly).

Signed-off-by: Max Reitz <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
10 years agosheepdog: fix a core dump while do auto-reconnecting
Liu Yuan [Thu, 28 Aug 2014 10:27:55 +0000 (18:27 +0800)]
sheepdog: fix a core dump while do auto-reconnecting

We should reinit local_err as NULL inside the while loop or g_free() will report
corrupption and abort the QEMU when sheepdog driver tries reconnecting.

This was broken in commit 356b4ca.

qemu-system-x86_64: failed to get the header, Resource temporarily unavailable
qemu-system-x86_64: Failed to connect to socket: Connection refused
qemu-system-x86_64: (null)
[xcb] Unknown sequence number while awaiting reply
[xcb] Most likely this is a multi-threaded client and XInitThreads has not been called
[xcb] Aborting, sorry about that.
qemu-system-x86_64: ../../src/xcb_io.c:298: poll_for_response: Assertion `!xcb_xlib_threads_sequence_lost' failed.
Aborted (core dumped)

Cc: [email protected]
Cc: Markus Armbruster <[email protected]>
Cc: Kevin Wolf <[email protected]>
Cc: Stefan Hajnoczi <[email protected]>
Reviewed-by: Markus Armbruster <[email protected]>
Signed-off-by: Liu Yuan <[email protected]>
Reviewed-by: Benoît Canet <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
10 years agoaio-win32: add support for sockets
Paolo Bonzini [Wed, 9 Jul 2014 09:53:10 +0000 (11:53 +0200)]
aio-win32: add support for sockets

Uses the same select/WSAEventSelect scheme as main-loop.c.
WSAEventSelect() is edge-triggered, so it cannot be used
directly, but it is still used as a way to exit from a
blocking g_poll().

Before g_poll() is called, we poll sockets with a non-blocking
select() to achieve the level-triggered semantics we require:
if a socket is ready, the g_poll() is made non-blocking too.

Based on a patch from Or Goshen.

Signed-off-by: Paolo Bonzini <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
10 years agoqemu-coroutine-io: fix for Win32
Paolo Bonzini [Wed, 9 Jul 2014 09:53:09 +0000 (11:53 +0200)]
qemu-coroutine-io: fix for Win32

Signed-off-by: Paolo Bonzini <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
10 years agoAioContext: introduce aio_prepare
Paolo Bonzini [Wed, 9 Jul 2014 09:53:08 +0000 (11:53 +0200)]
AioContext: introduce aio_prepare

This will be used to implement socket polling on Windows.
On Windows, select() and g_poll() are completely different;
sockets are polled with select() before calling g_poll,
and the g_poll must be nonblocking if select() says a
socket is ready.

Signed-off-by: Paolo Bonzini <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
10 years agoaio-win32: add aio_set_dispatching optimization
Paolo Bonzini [Wed, 9 Jul 2014 09:53:07 +0000 (11:53 +0200)]
aio-win32: add aio_set_dispatching optimization

Signed-off-by: Paolo Bonzini <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
10 years agotest-aio: test timers on Windows too
Paolo Bonzini [Wed, 9 Jul 2014 09:53:06 +0000 (11:53 +0200)]
test-aio: test timers on Windows too

Use EventNotifier instead of a pipe, which makes it trivial to test
timers on Windows.

Signed-off-by: Paolo Bonzini <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
10 years agoAioContext: export and use aio_dispatch
Paolo Bonzini [Wed, 9 Jul 2014 09:53:05 +0000 (11:53 +0200)]
AioContext: export and use aio_dispatch

So far, aio_poll's scheme was dispatch/poll/dispatch, where
the first dispatch phase was used only in the GSource case in
order to avoid a blocking poll.  Earlier patches changed it to
dispatch/prepare/poll/dispatch, where prepare is aio_compute_timeout.

By making aio_dispatch public, we can remove the first dispatch
phase altogether, so that both aio_poll and the GSource use the same
prepare/poll/dispatch scheme.

This patch breaks the invariant that aio_poll(..., true) will not block
the first time it returns false.  This used to be fundamental for
qemu_aio_flush's implementation as "while (qemu_aio_wait()) {}" but
no code in QEMU relies on this invariant anymore.  The return value
of aio_poll() is now comparable with that of g_main_context_iteration.

Signed-off-by: Paolo Bonzini <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
10 years agoAioContext: run bottom halves after polling
Paolo Bonzini [Wed, 9 Jul 2014 09:53:04 +0000 (11:53 +0200)]
AioContext: run bottom halves after polling

Make the dispatching phase the same before blocking and afterwards.
The next patch will make aio_dispatch public and use it directly
for the GSource case, instead of aio_poll.  aio_poll can then be
simplified heavily.

Signed-off-by: Paolo Bonzini <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
10 years agoaio-win32: Factor out duplicate code into aio_dispatch_handlers
Paolo Bonzini [Wed, 9 Jul 2014 09:53:03 +0000 (11:53 +0200)]
aio-win32: Factor out duplicate code into aio_dispatch_handlers

Later, the call to aio_dispatch will move int the GSource wrapper, while the
standalone case will still be call the component functions aio_bh_poll,
aio_dispatch_handlers and timerlistgroup_run_timers.

Signed-off-by: Paolo Bonzini <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
10 years agoaio-win32: Evaluate timers after handles
Paolo Bonzini [Wed, 9 Jul 2014 09:53:02 +0000 (11:53 +0200)]
aio-win32: Evaluate timers after handles

This is similar to what aio_poll does in the stand-alone case.

Signed-off-by: Paolo Bonzini <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
10 years agoAioContext: take bottom halves into account when computing aio_poll timeout
Paolo Bonzini [Wed, 9 Jul 2014 09:53:01 +0000 (11:53 +0200)]
AioContext: take bottom halves into account when computing aio_poll timeout

Right now, QEMU invokes aio_bh_poll before the "poll" phase
of aio_poll.  It is simpler to do it afterwards and skip the
"poll" phase altogether when the OS-dependent parts of AioContext
are invoked from GSource.  This way, AioContext behaves more
similarly when used as a GSource vs. when used as stand-alone.

As a start, take bottom halves into account when computing the
poll timeout.  If a bottom half is ready, do a non-blocking
poll.  As a side effect, this makes idle bottom halves work
with aio_poll; an improvement, but not really an important
one since they are deprecated.

Signed-off-by: Paolo Bonzini <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
10 years agoblockdev: fix drive-mirror 'granularity' error message
Stefan Hajnoczi [Wed, 27 Aug 2014 13:29:59 +0000 (14:29 +0100)]
blockdev: fix drive-mirror 'granularity' error message

Name the 'granularity' parameter and give its expected value range.
Previously the device name was mistakenly reported as the parameter
name.

Note that the error class is unchanged from ERROR_CLASS_GENERIC_ERROR.

Reported-by: Eric Blake <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Reviewed-by: Benoît Canet <[email protected]>
10 years agocoroutine: Drop co_sleep_ns
Fam Zheng [Tue, 26 Aug 2014 07:15:43 +0000 (15:15 +0800)]
coroutine: Drop co_sleep_ns

block_job_sleep_ns is the only user. Since we are moving towards
AioContext aware code, it's better to use the explicit version and drop
the old one.

Signed-off-by: Fam Zheng <[email protected]>
Reviewed-by: Benoît Canet <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
10 years agoblock/quorum: add simple read pattern support
Liu Yuan [Mon, 18 Aug 2014 09:41:05 +0000 (17:41 +0800)]
block/quorum: add simple read pattern support

This patch adds single read pattern to quorum driver and quorum vote is default
pattern.

For now we do a quorum vote on all the reads, it is designed for unreliable
underlying storage such as non-redundant NFS to make sure data integrity at the
cost of the read performance.

For some use cases as following:

        VM
  --------------
  |            |
  v            v
  A            B

Both A and B has hardware raid storage to justify the data integrity on its own.
So it would help performance if we do a single read instead of on all the nodes.
Further, if we run VM on either of the storage node, we can make a local read
request for better performance.

This patch generalize the above 2 nodes case in the N nodes. That is,

vm -> write to all the N nodes, read just one of them. If single read fails, we
try to read next node in FIFO order specified by the startup command.

The 2 nodes case is very similar to DRBD[1] though lack of auto-sync
functionality in the single device/node failure for now. But compared with DRBD
we still have some advantages over it:

- Suppose we have 20 VMs running on one(assume A) of 2 nodes' DRBD backed
storage. And if A crashes, we need to restart all the VMs on node B. But for
practice case, we can't because B might not have enough resources to setup 20 VMs
at once. So if we run our 20 VMs with quorum driver, and scatter the replicated
images over the data center, we can very likely restart 20 VMs without any
resource problem.

After all, I think we can build a more powerful replicated image functionality
on quorum and block jobs(block mirror) to meet various High Availibility needs.

E.g, Enable single read pattern on 2 children,

-drive driver=quorum,children.0.file.filename=0.qcow2,\
children.1.file.filename=1.qcow2,read-pattern=fifo,vote-threshold=1

[1] http://en.wikipedia.org/wiki/Distributed_Replicated_Block_Device

[Dropped \n from an error_setg() error message
--Stefan]

Cc: Benoit Canet <[email protected]>
Cc: Eric Blake <[email protected]>
Cc: Kevin Wolf <[email protected]>
Cc: Stefan Hajnoczi <[email protected]>
Signed-off-by: Liu Yuan <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
10 years agoqapi: add read-pattern enum for quorum
Liu Yuan [Mon, 18 Aug 2014 09:41:04 +0000 (17:41 +0800)]
qapi: add read-pattern enum for quorum

Cc: Eric Blake <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Reviewed-by: Benoît Canet <[email protected]>
Signed-off-by: Liu Yuan <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
10 years agosheepdog: improve error handling for a case of failed lock
Hitoshi Mitake [Mon, 11 Aug 2014 05:43:46 +0000 (14:43 +0900)]
sheepdog: improve error handling for a case of failed lock

Recently, sheepdog revived its VDI locking functionality. This patch
updates sheepdog driver of QEMU for this feature. It changes an error
code for a case of failed locking. -EBUSY is a suitable one.

Reported-by: Valerio Pachera <[email protected]>
Cc: Kevin Wolf <[email protected]>
Cc: Stefan Hajnoczi <[email protected]>
Cc: Liu Yuan <[email protected]>
Cc: MORITA Kazutaka <[email protected]>
Signed-off-by: Hitoshi Mitake <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
10 years agosheepdog: adopting protocol update for VDI locking
Hitoshi Mitake [Mon, 11 Aug 2014 05:43:45 +0000 (14:43 +0900)]
sheepdog: adopting protocol update for VDI locking

The update is required for supporting iSCSI multipath. It doesn't
affect behavior of QEMU driver but adding a new field to vdi request
struct is required.

Cc: Kevin Wolf <[email protected]>
Cc: Stefan Hajnoczi <[email protected]>
Cc: Liu Yuan <[email protected]>
Cc: MORITA Kazutaka <[email protected]>
Signed-off-by: Hitoshi Mitake <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
10 years agoqemu-img: always goto out in img_snapshot() error paths
Stefan Hajnoczi [Tue, 26 Aug 2014 18:17:56 +0000 (19:17 +0100)]
qemu-img: always goto out in img_snapshot() error paths

The out label has the qemu_progress_end() and other cleanup calls.
Always goto out in error paths so the cleanup happens.  These error
paths now return 1 instead of -1.

Note that bdrv_unref(NULL) is safe.  We just need to initialize bs to
NULL at the top of the function.

We can now remove the obsolete bs_old_backing = NULL and bs_new_backing
= NULL for safe mode.  Originally it was necessary in commit 3e85c6fd
("qemu-img rebase") but became useless in commit c2abcce ("qemu-img:
avoid calling exit(1) to release resources properly") because the
variables are already initialized during declaration.

Reported-by: John Snow <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
Reviewed-by: Max Reitz <[email protected]>
10 years agoqemu-img: fix img_compare() flags error path
Stefan Hajnoczi [Tue, 26 Aug 2014 18:17:55 +0000 (19:17 +0100)]
qemu-img: fix img_compare() flags error path

If img_compare() fails to parse the cache flags the goto out3 code path
will call qemu_progress_end().  Make sure we actually call
qemu_progress_init() first.

Reported-by: Markus Armbruster <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
Reviewed-by: Max Reitz <[email protected]>
10 years agoqemu-img: fix img_commit() error return value
Stefan Hajnoczi [Tue, 26 Aug 2014 18:17:54 +0000 (19:17 +0100)]
qemu-img: fix img_commit() error return value

The img_commit() return value is a process exit code.  Use 1 for failure
instead of -1.  The other failure paths in this function already use 1.

Signed-off-by: Stefan Hajnoczi <[email protected]>
Reviewed-by: Max Reitz <[email protected]>
10 years agoblock.curl: adding 'timeout' option
Daniel Henrique Barboza [Wed, 13 Aug 2014 15:44:27 +0000 (12:44 -0300)]
block.curl: adding 'timeout' option

The curl hardcoded timeout (5 seconds) sometimes is not long
enough depending on the remote server configuration and network
traffic. The user should be able to set how much long he is
willing to wait for the connection.

Adding a new option to set this timeout gives the user this
flexibility. The previous default timeout of 5 seconds will be
used if this option is not present.

Reviewed-by: Fam Zheng <[email protected]>
Signed-off-by: Daniel Henrique Barboza <[email protected]>
Reviewed-by: Benoit Canet <[email protected]>
Tested-by: Richard W.M. Jones <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
10 years agoide: Fix bootindex for bus_id > 9
Markus Armbruster [Fri, 15 Aug 2014 11:32:37 +0000 (13:32 +0200)]
ide: Fix bootindex for bus_id > 9

We identify devices by their Open Firmware device paths.  The encoding
of bus numbers is incorrect: idebus_get_fw_dev_path() formats them in
decimal, while SeaBIOS uses hexadecimal.  With bus number > 9, SeaBIOS
will miss the bootindex (lucky case), or apply it to another device
(unlucky case).

Bug can't bite right now: ich9-ahci has six ports, and the sysbus-ahci
created by Calxeda Highbank has just one.

Fix it anyway, by changing %d to %x.

I couldn't find an Open Firmware spec covering this.  For what it's
worth, OVMF agrees with SeaBIOS.

Signed-off-by: Markus Armbruster <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
10 years agoMerge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging
Peter Maydell [Thu, 28 Aug 2014 16:08:13 +0000 (17:08 +0100)]
Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging

SCSI patches include bug fixes from Fam and Peter, improved error
reporting from Fam and a fix for DPRINTF bitrot.  Memory patches try
again to initialize name from the QOM name.

# gpg: Signature made Thu 28 Aug 2014 15:10:31 BST using RSA key ID 9B4D86F2
# gpg: Good signature from "Paolo Bonzini <[email protected]>"
# gpg:                 aka "Paolo Bonzini <[email protected]>"

* remotes/bonzini/tags/for-upstream:
  memory: Lazy init name from QOM name as needed
  xen: hvm: Abstract away memory region name ref
  xen-hvm: Constify string
  virtio-scsi: Report error if num_queues is 0 or too large
  scsi-generic: remove superfluous DPRINTF avoid to break compiling
  block/iscsi: fix memory corruption on iscsi resize
  scsi-bus: Convert DeviceClass init to realize
  block: Pass errp in blkconf_geometry

Signed-off-by: Peter Maydell <[email protected]>
10 years agoMerge remote-tracking branch 'remotes/kvm/tags/for-upstream' into staging
Peter Maydell [Thu, 28 Aug 2014 15:07:23 +0000 (16:07 +0100)]
Merge remote-tracking branch 'remotes/kvm/tags/for-upstream' into staging

Mostly bugfixes + Alexey's interface-based implementation
of the NMI monitor command.

# gpg: Signature made Thu 28 Aug 2014 15:07:22 BST using RSA key ID 9B4D86F2
# gpg: Good signature from "Paolo Bonzini <[email protected]>"
# gpg:                 aka "Paolo Bonzini <[email protected]>"

* remotes/kvm/tags/for-upstream:
  mc146818rtc: reinitialize irq_reinject_on_ack_count on reset
  target-i386: Add "tsc_adjust" CPU feature name
  target-i386: Add "mpx" CPU feature name
  vl: process -object after other backend options
  checkpatch.pl: adjust typedef definition to QEMU coding style
  x86: Clear MTRRs on vCPU reset
  x86: kvm: Add MTRR support for kvm_get|put_msrs()
  x86: Use common variable range MTRR counts
  target-i386: Don't forbid NX bit on PAE PDEs and PTEs
  spapr: Add support for new NMI interface
  s390x: Migrate to new NMI interface
  s390x: Convert QEMUMachine to MachineClass
  cpus: Define callback for QEMU "nmi" command
  kvm: run cpu state synchronization on target vcpu thread

Signed-off-by: Peter Maydell <[email protected]>
10 years agomemory: Lazy init name from QOM name as needed
Peter Crosthwaite [Tue, 26 Aug 2014 03:10:24 +0000 (20:10 -0700)]
memory: Lazy init name from QOM name as needed

To support name retrieval of MemoryRegions that were created
dynamically (that is, not via memory_region_init and friends). We
cache the name in MemoryRegion's state as
object_get_canonical_path_component mallocs the returned value
so it's not suitable for direct return to callers. Memory already
frees the name field, so this will be garbage collected along with
the MR object.

Signed-off-by: Peter Crosthwaite <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
10 years agoxen: hvm: Abstract away memory region name ref
Peter Crosthwaite [Tue, 26 Aug 2014 03:09:48 +0000 (20:09 -0700)]
xen: hvm: Abstract away memory region name ref

The mr->name field is removed. This slipped through compile testing.
Fix.

Reviewed-by: Stefan Weil <[email protected]>
Signed-off-by: Peter Crosthwaite <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
10 years agoxen-hvm: Constify string
Peter Crosthwaite [Tue, 26 Aug 2014 03:09:13 +0000 (20:09 -0700)]
xen-hvm: Constify string

It's constant, and sourced from existing const strings. Avoid dodgy
casts by converting to const.

Signed-off-by: Peter Crosthwaite <[email protected]>
Reviewed-by: Stefan Weil <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
10 years agoMerge remote-tracking branch 'remotes/stefanha/tags/fix-buildbot-12082014-pull-reques...
Peter Maydell [Thu, 28 Aug 2014 13:51:12 +0000 (14:51 +0100)]
Merge remote-tracking branch 'remotes/stefanha/tags/fix-buildbot-12082014-pull-request' into staging

Pull request

# gpg: Signature made Thu 28 Aug 2014 13:43:00 BST using RSA key ID 81AB73C8
# gpg: Good signature from "Stefan Hajnoczi <[email protected]>"
# gpg:                 aka "Stefan Hajnoczi <[email protected]>"

* remotes/stefanha/tags/fix-buildbot-12082014-pull-request:
  Revert "qemu-img: sort block formats in help message"
  block: sort formats alphabetically in bdrv_iterate_format()
  mirror: fix uninitialized variable delay_ns warnings
  trace: avoid Python 2.5 all() in tracetool
  libqtest: launch QEMU with QEMU_AUDIO_DRV=none
  qapi.py: avoid Python 2.5+ any() function

Signed-off-by: Peter Maydell <[email protected]>
10 years agoRevert "qemu-img: sort block formats in help message"
Stefan Hajnoczi [Wed, 27 Aug 2014 11:08:56 +0000 (12:08 +0100)]
Revert "qemu-img: sort block formats in help message"

This reverts commit 1a443c1b8b4314d365e82bddeb1de5b4b1c15fb3 and the
later commit 395071a76328189f50c778f4dee6dabb90503dd9.

GSequence was introduced in glib 2.14.  RHEL 5 fails to compile since it
uses glib 2.12.3.

Now that bdrv_iterate_format() invokes the iteration callback in sorted
order these commits are unnecessary.

Signed-off-by: Stefan Hajnoczi <[email protected]>
Reviewed-by: Benoît Canet <[email protected]>
10 years agoblock: sort formats alphabetically in bdrv_iterate_format()
Stefan Hajnoczi [Wed, 27 Aug 2014 11:08:55 +0000 (12:08 +0100)]
block: sort formats alphabetically in bdrv_iterate_format()

Format names are best consumed in alphabetical order.  This makes
human-readable output easy to produce.

bdrv_iterate_format() already has an array of format strings.  Sort them
before invoking the iteration callback.

Signed-off-by: Stefan Hajnoczi <[email protected]>
Reviewed-by: Benoît Canet <[email protected]>
10 years agomirror: fix uninitialized variable delay_ns warnings
Stefan Hajnoczi [Wed, 27 Aug 2014 11:08:54 +0000 (12:08 +0100)]
mirror: fix uninitialized variable delay_ns warnings

The gcc 4.1.2 compiler warns that delay_ns may be uninitialized in
mirror_iteration().

There are two break statements in the do ... while loop that skip over
the delay_ns assignment.  These are probably the cause of the warning.

Signed-off-by: Stefan Hajnoczi <[email protected]>
Reviewed-by: Benoît Canet <[email protected]>
10 years agotrace: avoid Python 2.5 all() in tracetool
Stefan Hajnoczi [Wed, 27 Aug 2014 11:08:53 +0000 (12:08 +0100)]
trace: avoid Python 2.5 all() in tracetool

Red Hat Enterprise Linux 5 ships Python 2.4.3.  The all() function was
added in Python 2.5 so we cannot use it.

Signed-off-by: Stefan Hajnoczi <[email protected]>
Reviewed-by: Benoît Canet <[email protected]>
10 years agolibqtest: launch QEMU with QEMU_AUDIO_DRV=none
Stefan Hajnoczi [Wed, 27 Aug 2014 11:08:52 +0000 (12:08 +0100)]
libqtest: launch QEMU with QEMU_AUDIO_DRV=none

No test case actually uses the audio backend.  Disable audio to prevent
warnings on hosts with no sound hardware present:

  GTESTER check-qtest-aarch64
  sdl: SDL_OpenAudio failed
  sdl: Reason: No available audio device
  sdl: SDL_OpenAudio failed
  sdl: Reason: No available audio device
  audio: Failed to create voice `lm4549.out'

Signed-off-by: Stefan Hajnoczi <[email protected]>
Reviewed-by: Gerd Hoffmann <[email protected]>
10 years agoqapi.py: avoid Python 2.5+ any() function
Stefan Hajnoczi [Wed, 27 Aug 2014 11:08:51 +0000 (12:08 +0100)]
qapi.py: avoid Python 2.5+ any() function

There is one instance of any() in qapi.py that breaks builds on older
distros that ship Python 2.4 (like RHEL5):

  GEN   qmp-commands.h
Traceback (most recent call last):
  File "build/scripts/qapi-commands.py", line 445, in ?
    exprs = parse_schema(input_file)
  File "build/scripts/qapi.py", line 329, in parse_schema
    schema = QAPISchema(open(input_file, "r"))
  File "build/scripts/qapi.py", line 110, in __init__
    if any(include_path == elem[1]
NameError: global name 'any' is not defined

Signed-off-by: Stefan Hajnoczi <[email protected]>
Reviewed-by: Benoît Canet <[email protected]>
10 years agomc146818rtc: reinitialize irq_reinject_on_ack_count on reset
Paolo Bonzini [Wed, 27 Aug 2014 15:54:52 +0000 (17:54 +0200)]
mc146818rtc: reinitialize irq_reinject_on_ack_count on reset

This field was forgotten, and it makes the state after reset
non-deterministic.

Signed-off-by: Paolo Bonzini <[email protected]>
10 years agoMerge remote-tracking branch 'remotes/mcayland/qemu-openbios' into staging
Peter Maydell [Tue, 26 Aug 2014 13:18:40 +0000 (14:18 +0100)]
Merge remote-tracking branch 'remotes/mcayland/qemu-openbios' into staging

* remotes/mcayland/qemu-openbios:
  Update OpenBIOS images

Signed-off-by: Peter Maydell <[email protected]>
10 years agotarget-i386: Add "tsc_adjust" CPU feature name
Eduardo Habkost [Mon, 25 Aug 2014 20:02:13 +0000 (17:02 -0300)]
target-i386: Add "tsc_adjust" CPU feature name

tsc_adjust migration support is already implemented (commit
f28558d3d37ad3bc4e35e8ac93f7bf81a0d5622c), so we can add it to the list
of known feature names.

Signed-off-by: Eduardo Habkost <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
10 years agotarget-i386: Add "mpx" CPU feature name
Eduardo Habkost [Mon, 25 Aug 2014 20:02:12 +0000 (17:02 -0300)]
target-i386: Add "mpx" CPU feature name

Migration support for MPX is already implemented (commit
79e9ebebbf2a00c46fcedb6dc7dd5e12bbd30216), so we can add it to the list
of known feature names.

Signed-off-by: Eduardo Habkost <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
10 years agoUpdate OpenBIOS images
Mark Cave-Ayland [Tue, 26 Aug 2014 12:52:15 +0000 (13:52 +0100)]
Update OpenBIOS images

Update OpenBIOS images to SVN r1316 built from submodule.

Signed-off-by: Mark Cave-Ayland <[email protected]>
10 years agovl: process -object after other backend options
Paolo Bonzini [Mon, 25 Aug 2014 11:47:00 +0000 (13:47 +0200)]
vl: process -object after other backend options

QOM backends can refer to chardevs, but not vice versa.  So
process -chardev and -fsdev options before -object

This fixes the rng-egd backend to virtio-rng.

Reported-by: Amos Kong <[email protected]>
Cc: [email protected]
Signed-off-by: Paolo Bonzini <[email protected]>
10 years agocheckpatch.pl: adjust typedef definition to QEMU coding style
Paolo Bonzini [Tue, 10 Jun 2014 08:52:02 +0000 (10:52 +0200)]
checkpatch.pl: adjust typedef definition to QEMU coding style

Most QEMU typedefs are camelcase, starting with one uppercase letter
and containing at least one lowercase letter.  There are a few
all-uppercase types, add the most common too.

This fixes recognition of types in lines such as

    static __attribute__((unused)) inline void tcg_out8(TCGContext *s, uint8_t v)

(Example provided by Peter Maydell).

Reported-by: Alexey Kardashevskiy <[email protected]>
Reviewed-by: Markus Armbruster <[email protected]>
Cc: Peter Maydell <[email protected]>
Cc: Stefan Weil <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
10 years agovirtio-scsi: Report error if num_queues is 0 or too large
Fam Zheng [Tue, 26 Aug 2014 06:30:30 +0000 (14:30 +0800)]
virtio-scsi: Report error if num_queues is 0 or too large

No cmd vq surprises guest (Linux panics in virtscsi_probe), too many
queues abort qemu (in the following virtio_add_queue).

Signed-off-by: Fam Zheng <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
10 years agoscsi-generic: remove superfluous DPRINTF avoid to break compiling
Gonglei [Fri, 22 Aug 2014 02:01:50 +0000 (10:01 +0800)]
scsi-generic: remove superfluous DPRINTF avoid to break compiling

variables lun and tag had been eliminated, break compiling
when enable debug switch. Meanwhile traces provide the same
information with this DPRINTF, so remove it.

Signed-off-by: Gonglei <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
10 years agoblock/iscsi: fix memory corruption on iscsi resize
Peter Lieven [Fri, 22 Aug 2014 08:08:49 +0000 (10:08 +0200)]
block/iscsi: fix memory corruption on iscsi resize

bs->total_sectors is not yet updated at this point. resulting
in memory corruption if the volume has grown and data is written
to the newly availble areas.

CC: [email protected]
Signed-off-by: Peter Lieven <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
10 years agoscsi-bus: Convert DeviceClass init to realize
Fam Zheng [Tue, 12 Aug 2014 02:12:55 +0000 (10:12 +0800)]
scsi-bus: Convert DeviceClass init to realize

Replace "init/destroy" with "realize/unrealize" in SCSIDeviceClass,
which has errp as a parameter. So all the implementations now use
error_setg instead of error_report for reporting error.

Also in scsi_bus_legacy_handle_cmdline, report the error when
initializing the if=scsi devices, before returning it, because in the
callee, error_report is changed to error_setg. And the callers don't
have the right locations (e.g. "-drive if=scsi").

Reviewed-by: Stefan Hajnoczi <[email protected]>
Signed-off-by: Fam Zheng <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
10 years agoblock: Pass errp in blkconf_geometry
Fam Zheng [Tue, 12 Aug 2014 02:12:54 +0000 (10:12 +0800)]
block: Pass errp in blkconf_geometry

This allows us to pass error information to caller.

Reviewed-by: Andreas Färber <[email protected]>
Reviewed-by: Stefan Hajnoczi <[email protected]>
Signed-off-by: Fam Zheng <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
10 years agoMerge remote-tracking branch 'remotes/awilliam/tags/vfio-pci-for-qemu-20140825.0...
Peter Maydell [Tue, 26 Aug 2014 09:42:06 +0000 (10:42 +0100)]
Merge remote-tracking branch 'remotes/awilliam/tags/vfio-pci-for-qemu-20140825.0' into staging

VFIO: Enable primary NVIDIA quirk regardless of VGA support

# gpg: Signature made Mon 25 Aug 2014 20:29:37 BST using RSA key ID 3BB08B22
# gpg: Can't check signature: public key not found

* remotes/awilliam/tags/vfio-pci-for-qemu-20140825.0:
  vfio: Enable NVIDIA 88000 region quirk regardless of VGA

Signed-off-by: Peter Maydell <[email protected]>
10 years agovfio: Enable NVIDIA 88000 region quirk regardless of VGA
Alex Williamson [Mon, 25 Aug 2014 18:10:15 +0000 (12:10 -0600)]
vfio: Enable NVIDIA 88000 region quirk regardless of VGA

If we make use of OVMF for the BIOS then we can use GPUs without VGA
space access, but we still need this quirk.  Disassociate it from the
x-vga option and enable it on all NVIDIA VGA display class devices.

Signed-off-by: Alex Williamson <[email protected]>
10 years agoMerge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging
Peter Maydell [Mon, 25 Aug 2014 17:49:25 +0000 (18:49 +0100)]
Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging

pci, pc fixes, features

A bunch of bugfixes - these will make sense for 2.1.1

ACPI support for TPM and partial ARI support for PCIE.

Signed-off-by: Michael S. Tsirkin <[email protected]>
# gpg: Signature made Sun 24 Aug 2014 23:16:35 BST using RSA key ID D28D5469
# gpg: Good signature from "Michael S. Tsirkin <[email protected]>"
# gpg:                 aka "Michael S. Tsirkin <[email protected]>"

* remotes/mst/tags/for_upstream:
  pcie: fix trailing whitespace
  ioh3420: Enable ARI forwarding
  ioh3420: Remove obsoleted, unused ioh3420_init function
  pcie: Rename the pcie_cap_ari_* functions to pcie_cap_arifwd_*
  pcie: Fix incorrect write to the ari capability next function field
  ssdt-tpm: add generated hex file to git
  Add ACPI tables for TPM
  pc: reserve more memory for ACPI for new machine types
  pcihp: fix possible array out of bounds
  pci_bridge: manually destroy memory regions within PCIBridgeWindows
  hostmem: set MPOL_MF_MOVE

Signed-off-by: Peter Maydell <[email protected]>
10 years agox86: Clear MTRRs on vCPU reset
Alex Williamson [Thu, 14 Aug 2014 21:39:39 +0000 (15:39 -0600)]
x86: Clear MTRRs on vCPU reset

The SDM specifies (June 2014 Vol3 11.11.5):

    On a hardware reset, the P6 and more recent processors clear the
    valid flags in variable-range MTRRs and clear the E flag in the
    IA32_MTRR_DEF_TYPE MSR to disable all MTRRs. All other bits in the
    MTRRs are undefined.

We currently do none of that, so whatever MTRR settings you had prior
to reset is what you have after reset.  Usually this doesn't matter
because KVM often ignores the guest mappings and uses write-back
anyway.  However, if you have an assigned device and an IOMMU that
allows NoSnoop for that device, KVM defers to the guest memory
mappings which are now stale after reset.  The result is that OVMF
rebooting on such a configuration takes a full minute to LZMA
decompress the firmware volume, a process that is nearly instant on
the initial boot.

Signed-off-by: Alex Williamson <[email protected]>
Reviewed-by: Laszlo Ersek <[email protected]>
Cc: [email protected]
Signed-off-by: Paolo Bonzini <[email protected]>
10 years agox86: kvm: Add MTRR support for kvm_get|put_msrs()
Alex Williamson [Thu, 14 Aug 2014 21:39:33 +0000 (15:39 -0600)]
x86: kvm: Add MTRR support for kvm_get|put_msrs()

The MTRR state in KVM currently runs completely independent of the
QEMU state in CPUX86State.mtrr_*.  This means that on migration, the
target loses MTRR state from the source.  Generally that's ok though
because KVM ignores it and maps everything as write-back anyway.  The
exception to this rule is when we have an assigned device and an IOMMU
that doesn't promote NoSnoop transactions from that device to be cache
coherent.  In that case KVM trusts the guest mapping of memory as
configured in the MTRR.

This patch updates kvm_get|put_msrs() so that we retrieve the actual
vCPU MTRR settings and therefore keep CPUX86State synchronized for
migration.  kvm_put_msrs() is also used on vCPU reset and therefore
allows future modificaitons of MTRR state at reset to be realized.

Note that the entries array used by both functions was already
slightly undersized for holding every possible MSR, so this patch
increases it beyond the 28 new entries necessary for MTRR state.

Signed-off-by: Alex Williamson <[email protected]>
Reviewed-by: Laszlo Ersek <[email protected]>
Cc: [email protected]
Signed-off-by: Paolo Bonzini <[email protected]>
This page took 0.123619 seconds and 4 git commands to generate.