sdk/emulator/qemu.git
11 years agoaudio/audio_pt_int: Clarify licensing
malc [Mon, 19 Nov 2012 18:26:13 +0000 (22:26 +0400)]
audio/audio_pt_int: Clarify licensing

Signed-off-by: malc <av1474@comtv.ru>
11 years agoaudio/wavcapture: Clarify licensing
malc [Mon, 19 Nov 2012 18:23:17 +0000 (22:23 +0400)]
audio/wavcapture: Clarify licensing

Signed-off-by: malc <av1474@comtv.ru>
11 years agotcg/ppc: Remove unused s_bits variable
malc [Mon, 19 Nov 2012 18:22:24 +0000 (22:22 +0400)]
tcg/ppc: Remove unused s_bits variable

Thanks to Alexander Graf for heads up.

Signed-off-by: malc <av1474@comtv.ru>
11 years agoMerge remote-tracking branch 'kiszka/queues/slirp' into staging
Anthony Liguori [Mon, 19 Nov 2012 15:27:24 +0000 (09:27 -0600)]
Merge remote-tracking branch 'kiszka/queues/slirp' into staging

* kiszka/queues/slirp:
  slirp: Add domain-search option to slirp's DHCP server
  slirp: Don't crash on packets from 0.0.0.0/8.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge remote-tracking branch 'bonzini/build-urgent' into staging
Anthony Liguori [Mon, 19 Nov 2012 15:27:13 +0000 (09:27 -0600)]
Merge remote-tracking branch 'bonzini/build-urgent' into staging

* bonzini/build-urgent:
  Makefile: Add missing dependency (fix parallel builds)
  tests: link in stubs
  libcacard: link in stubs
  libcacard: make unnesting rules available to Makefile.objs

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge remote-tracking branch 'kwolf/for-anthony' into staging
Anthony Liguori [Mon, 19 Nov 2012 15:27:00 +0000 (09:27 -0600)]
Merge remote-tracking branch 'kwolf/for-anthony' into staging

* kwolf/for-anthony: (26 commits)
  qemu-io: Use bdrv_drain_all instead of qemu_aio_flush
  megasas: Use bdrv_drain_all instead of qemu_aio_flush
  vmdk: Fix data corruption bug in WRITE and READ handling
  fdc: remove last usage of FD_STATE_SEEK
  fdc: fix typo in zero constant
  fdc: remove double affectation of FD_MSR_CMDBUSY flag
  fdc-tests: add tests for VERIFY command
  fdc: implement VERIFY command
  fdc-test: Check READ ID
  fdc: fix false FD_SR0_SEEK
  fdc: fix FD_SR0_SEEK for initial seek on DMA transfers
  fdc: fix FD_SR0_SEEK for non-DMA transfers and multi sectors transfers
  fdc: use status0 field instead of a local variable
  fdc-test: add tests for non-DMA READ command
  fdc-test: insert media before fuzzing registers
  fdc-test: split test_media_change() test, so insert part can be reused
  fdc: Remove status0 parameter from fdctrl_set_fifo()
  aio: rename AIOPool to AIOCBInfo
  aio: use g_slice_alloc() for AIOCB pooling
  aio: switch aiocb_size type int -> size_t
  ...

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge remote-tracking branch 'kraxel/usb.71' into staging
Anthony Liguori [Mon, 19 Nov 2012 15:26:48 +0000 (09:26 -0600)]
Merge remote-tracking branch 'kraxel/usb.71' into staging

* kraxel/usb.71:
  usb-host: fix splitted transfers
  usb-host: update tracing
  usb-redir: Set default debug level to warning
  usb-redir: Only add actually in flight packets to the in flight queue
  ehci: handle dma errors
  ehci: keep the frame timer running in case the guest asked for frame list rollover interrupts
  ehci: Don't verify the next pointer for periodic qh-s and qtd-s
  ehci: Better detection for qtd-s linked in circles
  ehci: Fixup q->qtdaddr after cancelling an already completed packet
  ehci: Don't access packet after freeing it
  usb: host-linux: Ignore parsing errors of the device descriptors
  usb-host: scan for usb devices when the vm starts
  usb: Fix (another) bug in usb_packet_map() for IOMMU handling
  fix live migration

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge remote-tracking branch 'stefanha/tracing' into staging
Anthony Liguori [Mon, 19 Nov 2012 14:32:03 +0000 (08:32 -0600)]
Merge remote-tracking branch 'stefanha/tracing' into staging

* stefanha/tracing:
  trace: Remove "info trace" from documents
  trace: document '-' syntax for disabling events
  trace: allow disabling events in events file
  Avoid all systemtap reserved words

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge remote-tracking branch 'amit/loadvm-irq-inj-fix' into staging
Anthony Liguori [Mon, 19 Nov 2012 14:31:48 +0000 (08:31 -0600)]
Merge remote-tracking branch 'amit/loadvm-irq-inj-fix' into staging

* amit/loadvm-irq-inj-fix:
  virtio-serial-bus: post_load send_event when vm is running

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge remote-tracking branch 'afaerber/qom-cpu' into staging
Anthony Liguori [Mon, 19 Nov 2012 14:31:24 +0000 (08:31 -0600)]
Merge remote-tracking branch 'afaerber/qom-cpu' into staging

* afaerber/qom-cpu:
  target-i386: Add Haswell CPU model
  target-i386/cpu: Add new Opteron CPU model
  target-i386/cpu: Name new CPUID bits
  qapi-types.h: Don't include qemu-common.h
  osdep: Move qemu_{open,close}() prototypes
  qemu-config.h: Include headers it needs
  vnc-palette.h: Include <stdbool.h>
  qemu-fsdev-dummy.c: Include module.h
  qdev: Split up header so it can be used in cpu.h
  Move qemu_irq typedef out of qemu-common.h
  qemu-common.h: Comment about usage rules

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge remote-tracking branch 'qemu-kvm/uq/master' into staging
Anthony Liguori [Mon, 19 Nov 2012 14:30:45 +0000 (08:30 -0600)]
Merge remote-tracking branch 'qemu-kvm/uq/master' into staging

* qemu-kvm/uq/master:
  kvm: Actually remove software breakpoints from list on cleanup
  acpi_piix4: fix migration of gpe fields

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agorng-random: only build on POSIX platforms
Anthony Liguori [Sat, 17 Nov 2012 13:40:47 +0000 (07:40 -0600)]
rng-random: only build on POSIX platforms

There is no /dev/random on win32.

Cc: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMakefile: Add missing dependency (fix parallel builds)
Stefan Weil [Sun, 18 Nov 2012 22:09:51 +0000 (23:09 +0100)]
Makefile: Add missing dependency (fix parallel builds)

The executables in i386-softmmu, i386-linux-user, ...
depend on the recently added libqemustub.a.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agotests: link in stubs
Paolo Bonzini [Mon, 19 Nov 2012 08:45:34 +0000 (09:45 +0100)]
tests: link in stubs

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agolibcacard: link in stubs
Paolo Bonzini [Mon, 19 Nov 2012 08:45:20 +0000 (09:45 +0100)]
libcacard: link in stubs

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agolibcacard: make unnesting rules available to Makefile.objs
Paolo Bonzini [Mon, 19 Nov 2012 08:45:06 +0000 (09:45 +0100)]
libcacard: make unnesting rules available to Makefile.objs

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agotci: Support deposit operations
Stefan Weil [Tue, 18 Sep 2012 20:52:14 +0000 (22:52 +0200)]
tci: Support deposit operations

The operations for INDEX_op_deposit_i32 and INDEX_op_deposit_i64
are now supported and enabled by default.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotci: Fix build breakage (unresolved symbol tcg_out_tb_finalize)
Stefan Weil [Sun, 18 Nov 2012 19:16:26 +0000 (20:16 +0100)]
tci: Fix build breakage (unresolved symbol tcg_out_tb_finalize)

Commit 32761257c0b9fa7ee04d2871a6e48a41f119c469 enabled
qemu_ld/st optimization unconditionally for some hosts.

The TCG interpreter still does not support this kind of
optimization. Therefore builds with TCI fail with an
unresolved symbol tcg_out_tb_finalize. This is fixed here.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotci: fix build breakage for target MIPS
Stefan Weil [Sun, 18 Nov 2012 19:06:19 +0000 (20:06 +0100)]
tci: fix build breakage for target MIPS

commit 5f7319cd introduced GETPC() usage for MIPS, which is currently
not defined when building with --enable-tcg-interpreter. Add MIPS to
the list of targets we selectively define GETPC() for.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agobuild: replace weak symbols with a static library
Paolo Bonzini [Fri, 16 Nov 2012 17:35:27 +0000 (18:35 +0100)]
build: replace weak symbols with a static library

Weak symbols were a nice idea, but they turned out not to be a good one.
Toolchain support is just too sparse, in particular llvm-gcc is totally
broken.

This patch uses a surprisingly low-tech approach: a static library.
Symbols in a static library are always overridden by symbols in an
object file.  Furthermore, if you place each function in a separate
source file, object files for unused functions will not be taken in.
This means that each function can use all the dependencies that it needs
(especially QAPI stuff such as error_setg).

Thus, all stubs are placed in separate object files and put together in
a static library.  The library then is linked to all programs.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Tested-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Tested-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agolibseccomp: require version 1.0.0
Blue Swirl [Sat, 3 Nov 2012 15:42:21 +0000 (15:42 +0000)]
libseccomp: require version 1.0.0

Debian Wheezy has version 0.1.0 which is not compatible, avoid it.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agoMerge branch 'vga.1' of git://git.kraxel.org/qemu
Blue Swirl [Sat, 17 Nov 2012 16:38:05 +0000 (16:38 +0000)]
Merge branch 'vga.1' of git://git.kraxel.org/qemu

* 'vga.1' of git://git.kraxel.org/qemu:
  vga: fix mmio vga register mapping
  vga: fix bochs alignment issue

11 years agoTCG: Remove unused global variables
Evgeny Voevodin [Mon, 12 Nov 2012 09:27:49 +0000 (13:27 +0400)]
TCG: Remove unused global variables

Signed-off-by: Evgeny Voevodin <e.voevodin@samsung.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agoTCG: Use gen_opparam_buf from context instead of global variable.
Evgeny Voevodin [Mon, 12 Nov 2012 09:27:48 +0000 (13:27 +0400)]
TCG: Use gen_opparam_buf from context instead of global variable.

Signed-off-by: Evgeny Voevodin <e.voevodin@samsung.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agoTCG: Use gen_opc_buf from context instead of global variable.
Evgeny Voevodin [Mon, 12 Nov 2012 09:27:47 +0000 (13:27 +0400)]
TCG: Use gen_opc_buf from context instead of global variable.

Signed-off-by: Evgeny Voevodin <e.voevodin@samsung.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agoTCG: Use gen_opparam_ptr from context instead of global variable.
Evgeny Voevodin [Mon, 12 Nov 2012 09:27:46 +0000 (13:27 +0400)]
TCG: Use gen_opparam_ptr from context instead of global variable.

Signed-off-by: Evgeny Voevodin <e.voevodin@samsung.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agoTCG: Use gen_opc_ptr from context instead of global variable.
Evgeny Voevodin [Mon, 12 Nov 2012 09:27:45 +0000 (13:27 +0400)]
TCG: Use gen_opc_ptr from context instead of global variable.

Signed-off-by: Evgeny Voevodin <e.voevodin@samsung.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotcg/tcg.h: Duplicate global TCG variables in TCGContext
Evgeny Voevodin [Mon, 12 Nov 2012 09:27:44 +0000 (13:27 +0400)]
tcg/tcg.h: Duplicate global TCG variables in TCGContext

Signed-off-by: Evgeny Voevodin <e.voevodin@samsung.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotarget-cris/translate.c: Code style clean-up
Evgeny Voevodin [Mon, 12 Nov 2012 09:27:43 +0000 (13:27 +0400)]
target-cris/translate.c: Code style clean-up

Signed-off-by: Evgeny Voevodin <e.voevodin@samsung.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agorng-egd: don't use gslist_free_full
Anthony Liguori [Fri, 16 Nov 2012 19:09:34 +0000 (13:09 -0600)]
rng-egd: don't use gslist_free_full

This function was only introduced in glib 2.28.0.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovirtio-rng-pci: create a default backend if none exists
Anthony Liguori [Fri, 26 Oct 2012 17:05:49 +0000 (12:05 -0500)]
virtio-rng-pci: create a default backend if none exists

This allows you to specify:

  $ qemu -device virtio-rng-pci

And things will Just Work with a reasonable default.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovirtio-rng: add rate limiting support
Anthony Liguori [Tue, 30 Oct 2012 22:45:05 +0000 (17:45 -0500)]
virtio-rng: add rate limiting support

This adds parameters to virtio-rng-pci to allow rate limiting the entropy a
guest receives.  An example command line:

$ qemu -device virtio-rng-pci,max-bytes=1024,period=1000

Would limit entropy collection to 1Kb/s.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovirtio-rng: hardware random number generator device
Amit Shah [Wed, 20 Jun 2012 06:59:32 +0000 (12:29 +0530)]
virtio-rng: hardware random number generator device

The Linux kernel already has a virtio-rng driver, this is the device
implementation.

When the guest asks for entropy from the virtio hwrng, it puts a buffer
in the vq.  We then put entropy into that buffer, and push it back to
the guest.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
aliguori: converted to new RngBackend interface
aliguori: remove entropy needed event
aliguori: fix migration

11 years agorng-egd: introduce EGD compliant RNG backend
Anthony Liguori [Mon, 25 Jun 2012 18:13:31 +0000 (13:13 -0500)]
rng-egd: introduce EGD compliant RNG backend

This backend talks EGD to a CharDriverState.  A typical way to invoke this would
be:

qemu -chardev socket,host=localhost,port=1024,id=chr0 \
     -object rng-egd,chardev=chr0,id=egd0 \
     -device virtio-rng-pci,rng=egd0

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agorng-random: add an RNG backend that uses /dev/random (v3)
Anthony Liguori [Mon, 25 Jun 2012 15:34:09 +0000 (10:34 -0500)]
rng-random: add an RNG backend that uses /dev/random (v3)

The filename can be overridden but it expects a non-blocking source of entropy.
A typical invocation would be:

qemu -object rng-random,id=rng0 -device virtio-rng-pci,rng=rng0

This can also be used with /dev/urandom by using the command line:

qemu -object rng-random,filename=/dev/urandom,id=rng0 \
     -device virtio-rng-pci,rng=rng0

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
v1 -> v2
 - merged header split patch into this one
v2 -> v3
 - bug fix in rng-random (Paolo)

11 years agorng: add RndBackend abstract object class
Anthony Liguori [Mon, 25 Jun 2012 15:03:47 +0000 (10:03 -0500)]
rng: add RndBackend abstract object class

This is the backend used by devices that need to request entropy.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoobject: add object_property_add_bool (v2)
Anthony Liguori [Mon, 25 Jun 2012 15:32:46 +0000 (10:32 -0500)]
object: add object_property_add_bool (v2)

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
v1 -> v2
 - Fix whitespace (Andreas Faerber)

11 years agovl: add -object option to create QOM objects from the command line
Anthony Liguori [Mon, 25 Jun 2012 19:36:33 +0000 (14:36 -0500)]
vl: add -object option to create QOM objects from the command line

This will create a new QOM object in the '/objects' path.  Note that properties
are set in order which allows for simple objects to be initialized entirely
with this option and then realized.

This option is roughly equivalent to -device but for things that are not
devices.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agotrace: Remove "info trace" from documents
Liming Wang [Fri, 16 Nov 2012 07:10:49 +0000 (15:10 +0800)]
trace: Remove "info trace" from documents

commit 88affa1c monitor: remove unused do_info_trace

has removed "info trace" function from monitor, so remove it from documents.

Signed-off-by: Liming Wang <walimisdev@gmail.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agotrace: document '-' syntax for disabling events
Stefan Hajnoczi [Mon, 5 Nov 2012 07:48:29 +0000 (08:48 +0100)]
trace: document '-' syntax for disabling events

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agotrace: allow disabling events in events file
Gerd Hoffmann [Fri, 26 Oct 2012 11:46:34 +0000 (13:46 +0200)]
trace: allow disabling events in events file

Disable trace events prefixed with a '-'.  Useful
to enable a group of tracepoints with exceptions,
like this:

  usb_xhci_port_*
  -usb_xhci_port_read

which will enable all xhci port tracepoints except reads.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoAvoid all systemtap reserved words
Daniel P. Berrange [Fri, 2 Nov 2012 12:00:53 +0000 (12:00 +0000)]
Avoid all systemtap reserved words

Over time various systemtap reserved words have been blacklisted
in the trace backend generator. The list is not complete though,
so there is continued risk of problems in the future. Preempt
such problems by specifying the full list of systemtap keywords
listed in its parser as identified here:

  http://sourceware.org/ml/systemtap/2012-q4/msg00157.html

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agousb-host: fix splitted transfers
Gerd Hoffmann [Thu, 15 Nov 2012 15:11:49 +0000 (16:11 +0100)]
usb-host: fix splitted transfers

USBPacket->actual_length wasn't updated correctly for USBPackets
splitted into multiple urbs.  Fix it.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agousb-host: update tracing
Gerd Hoffmann [Thu, 15 Nov 2012 15:11:20 +0000 (16:11 +0100)]
usb-host: update tracing

Now that we have separate status and length fields in USBPacket
update the completion tracepoint to log both.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agousb-redir: Set default debug level to warning
Hans de Goede [Thu, 15 Nov 2012 13:15:00 +0000 (14:15 +0100)]
usb-redir: Set default debug level to warning

The previous default of 0 means that even errors and warnings would not
get printed, which is really not a good default.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agousb-redir: Only add actually in flight packets to the in flight queue
Hans de Goede [Thu, 15 Nov 2012 13:14:59 +0000 (14:14 +0100)]
usb-redir: Only add actually in flight packets to the in flight queue

Packets which are queued up, but not yet handed over to the device, are
*not* in flight.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoehci: handle dma errors
Gerd Hoffmann [Thu, 15 Nov 2012 12:07:49 +0000 (13:07 +0100)]
ehci: handle dma errors

Starting with commit 1c380f9460522f32c8dd2577b2a53d518ec91c6d dma
transfers can actually fail.  This patch makes ehci keep track
of the busmaster bit in pci config space, by setting/clearing the
dma_context pointer.  Attempts to dma without context will result
in raising HSE (Host System Error) interrupt and stopping the host
controller.

This patch fixes WinXP not booting with a usb stick attached to ehci.
Root cause is seabios activating ehci so you can boot from the stick,
and WinXP clearing the busmaster bit before resetting the host
controller, leading to ehci actually trying dma while it is disabled.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoehci: keep the frame timer running in case the guest asked for frame list rollover...
Gerd Hoffmann [Tue, 13 Nov 2012 16:20:05 +0000 (17:20 +0100)]
ehci: keep the frame timer running in case the guest asked for frame list rollover interrupts

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoehci: Don't verify the next pointer for periodic qh-s and qtd-s
Hans de Goede [Thu, 15 Nov 2012 13:14:58 +0000 (14:14 +0100)]
ehci: Don't verify the next pointer for periodic qh-s and qtd-s

While testing the move to async packet handling for interrupt endpoints I
noticed that Windows-XP likes to play tricks with the next pointer for
periodic qh-s, so we should not fail qh / qtd verification when it changes.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoehci: Better detection for qtd-s linked in circles
Hans de Goede [Wed, 14 Nov 2012 16:21:38 +0000 (17:21 +0100)]
ehci: Better detection for qtd-s linked in circles

Windows links interrupt qtd-s in circles, which means that when interrupt
endpoints return USB_RET_ASYNC, combined with the recent
"ehci: Retry to fill the queue while waiting for td completion" patch,
we keep adding the tds to the queue over and over again, as we detect the
circle from fill_queue, but we call it over and over again ...

This patch fixes this by changing the circle detection to also detect
circling into tds already queued up previously.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoehci: Fixup q->qtdaddr after cancelling an already completed packet
Hans de Goede [Wed, 14 Nov 2012 16:21:37 +0000 (17:21 +0100)]
ehci: Fixup q->qtdaddr after cancelling an already completed packet

This avoids the q->qtdaddr == p->qtdaddr asserts we have triggering, when
a queue contains multiple completed packages when we cancel the queue.

I triggered this with windows7 + async interrupt endpoint handling (*)
+ not detecting circles in ehci_fill_queue() properly, which makes the qtd
validation in ehci_fill_queue fail, causing cancellation of the queue on every
mouse event ...

*) Which is not going upstream as it will cause loss of interrupt events on
migration.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoehci: Don't access packet after freeing it
Hans de Goede [Wed, 14 Nov 2012 16:21:36 +0000 (17:21 +0100)]
ehci: Don't access packet after freeing it

ehci_state_writeback() will free the packet, so we should not access
the packet after calling ehci_state_writeback().

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agousb: host-linux: Ignore parsing errors of the device descriptors
Jan Kiszka [Thu, 15 Nov 2012 08:23:30 +0000 (09:23 +0100)]
usb: host-linux: Ignore parsing errors of the device descriptors

The Linux is more tolerant here as well: Just stop parsing the device
descriptors when an error is detected but do not reset what was found
so far. This allows to run buggy devices with partially invalid
descriptors.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agovga: fix mmio vga register mapping
Gerd Hoffmann [Mon, 12 Nov 2012 21:33:21 +0000 (22:33 +0100)]
vga: fix mmio vga register mapping

11 years agovga: fix bochs alignment issue
Gerd Hoffmann [Mon, 12 Nov 2012 11:40:46 +0000 (12:40 +0100)]
vga: fix bochs alignment issue

The bochs dispi interface traditionally uses port 0x1ce as 16bit index
register and port 0x1cf as 16bit data register.  The later is unaligned,
and probably for that reason the the data register was moved to 0x1d0
for non-x86 archs.

This patch makes the data register available at 0x1d0 on x86 too.  The
old x86 location is kept for compatibility reasons, so both 0x1cf and
0x1d0 can be used as data register on x86.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agousb-host: scan for usb devices when the vm starts
Gerd Hoffmann [Wed, 14 Nov 2012 14:51:18 +0000 (15:51 +0100)]
usb-host: scan for usb devices when the vm starts

Commit a844ed842d9a9d929645c09ae0f52f753d7a02e0 leads to usb-host
detecting devices not right after qemu startup because the guest
isn't running yet.  Instead they are found on the first of the
regular usb device poll runs.  Which is too late for seabios to see
them, so booting from usb sticks fails.

Fix this by adding a vm state change handler which triggers a device
scan when the vm is started.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agousb: Fix (another) bug in usb_packet_map() for IOMMU handling
David Gibson [Wed, 14 Nov 2012 05:23:50 +0000 (16:23 +1100)]
usb: Fix (another) bug in usb_packet_map() for IOMMU handling

Elements in qemu SGLists can cross IOMMU page boundaries.  So, in commit
39c138c8420f51a7da7b35233a8d7400a0b589ac "usb: Fix usb_packet_map() in the
presence of IOMMUs", I changed usb_packet_map() to split up each SGList
element on IOMMU page boundaries and each resulting piece of qemu's memory
space separately to the iovec the usb code uses internally.

That was correct in concept, but the patch has a bug.  The 'base' variable
correctly steps through the dma address of each piece, but then we call
the dma_memory_map() function on the base address of the whole SGList
element every time.

This patch fixes at least one problem using XHCI on the pseries guest
machine.  It didn't affect OHCI because that doesn't use usb_packet_map().
In theory it also affects EHCI, but we haven't observed that in practice.
I think the transfers were small enough on EHCI that they never crossed an
IOMMU page boundary in practice.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agofix live migration
Gerd Hoffmann [Thu, 8 Nov 2012 14:54:05 +0000 (15:54 +0100)]
fix live migration

Commit 1c380f9460522f32c8dd2577b2a53d518ec91c6d breaks live migration.
DMA stops working for ehci (and probably for any pci device) after
restoring the guest because the bus master region never gets enabled.
Add code doing that after loading the pci config space from vmstate.

Cc: Avi Kivity <avi@redhat.com>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agovirtio-serial-bus: post_load send_event when vm is running
Alon Levy [Wed, 14 Nov 2012 13:09:07 +0000 (15:09 +0200)]
virtio-serial-bus: post_load send_event when vm is running

Alexander Larsson found irq injection to Windows guests stopped after a
migration.  The symptom was the mouse stopped working.

Reproduction steps are:
1. On src, start qemu with a virtio-serial port without any backend
2. On dest, start qemu with a virtio-serial port with a backend
3. Migrate.

Upon migration, the older code detected the change in backend connection
status, and sent a notification to the guest.  However, it's not
guaranteed that the apic is ready to inject irqs into the guest, and the
irq line remained high, resulting in any future interrupts going
unnoticed by the guest as well.

Add a new timer based on vm_clock for 1 ns in the future from post_load
to do the event send in case host_connected differs between migration
source and target.

RHBZ: 867366

Signed-off-by: Alon Levy <alevy@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com> # verbose commit log
11 years agotarget-mips: fix wrong microMIPS opcode encoding
陳韋任 (Wei-Ren Chen) [Wed, 14 Nov 2012 02:49:55 +0000 (10:49 +0800)]
target-mips: fix wrong microMIPS opcode encoding

While reading microMIPS decoding, I found a possible wrong opcode
encoding. According to [1] page 166, the bits 13..12 for MULTU is
0x01 rather than 0x00. Please review, thanks.

[1] MIPS Architecture for Programmers VolumeIV-e: The MIPS DSP
    Application-Specific Extension to the microMIPS32 Architecture

Signed-off-by: Chen Wei-Ren <chenwj@iis.sinica.edu.tw>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
11 years agomips/malta: fix CBUS UART interrupt pin
Aurelien Jarno [Wed, 14 Nov 2012 14:04:42 +0000 (15:04 +0100)]
mips/malta: fix CBUS UART interrupt pin

According to the MIPS Malta Developement Platform User's Manual, the
i8259 interrupt controller is supposed to be connected to the hardware
IRQ0, and the CBUS UART to the hardware interrupt 2.

In QEMU they are both connected to hardware interrupt 0, the CBUS UART
interrupt being wrong. This patch fixes that. It should be noted that
the irq array in QEMU includes the software interrupts, hence
env->irq[2] is the first hardware interrupt.

Cc: Ralf Baechle <ralf@linux-mips.org>
Reviewed-by: Eric Johnson <ericj@mips.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
11 years agoslirp: Add domain-search option to slirp's DHCP server
Klaus Stengel [Sat, 27 Oct 2012 17:53:39 +0000 (19:53 +0200)]
slirp: Add domain-search option to slirp's DHCP server

This patch will allow the user to include the domain-search option in
replies from the built-in DHCP server. The domain suffixes can be
specified by adding dnssearch= entries to the "-net user" parameter.

[Jan: tiny style adjustments]

Signed-off-by: Klaus Stengel <Klaus.Stengel@asamnet.de>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
11 years agoslirp: Don't crash on packets from 0.0.0.0/8.
Nickolai Zeldovich [Mon, 12 Nov 2012 16:59:49 +0000 (17:59 +0100)]
slirp: Don't crash on packets from 0.0.0.0/8.

LWIP can generate packets with a source of 0.0.0.0, which triggers an
assertion failure in arp_table_add().  Instead of crashing, simply return
to avoid adding an invalid ARP table entry.

Signed-off-by: Nickolai Zeldovich <nickolai@csail.mit.edu>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
11 years agotarget-i386: Add Haswell CPU model
Eduardo Habkost [Wed, 14 Nov 2012 18:28:54 +0000 (16:28 -0200)]
target-i386: Add Haswell CPU model

Features added to the model, in relation to SandyBridge:

fma       CPUID[1].ECX[12]
pcid      CPUID[1].ECX[17]
movbe     CPUID[1].ECX[22]
fsgsbase  CPUID[EAX=7,ECX=0].EBX[0]
bmi1      CPUID[EAX=7,ECX=0].EBX[3]
hle       CPUID[EAX=7,ECX=0].EBX[4]
avx2      CPUID[EAX=7,ECX=0].EBX[5]
smep      CPUID[EAX=7,ECX=0].EBX[7]
bmi2      CPUID[EAX=7,ECX=0].EBX[8]
erms      CPUID[EAX=7,ECX=0].EBX[9]
invpcid   CPUID[EAX=7,ECX=0].EBX[10]
rtm       CPUID[EAX=7,ECX=0].EBX[11]

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agotarget-i386/cpu: Add new Opteron CPU model
Andre Przywara [Wed, 14 Nov 2012 18:28:53 +0000 (16:28 -0200)]
target-i386/cpu: Add new Opteron CPU model

Add a new base CPU model called Opteron_G5 to model the latest
Opteron CPUs. This increases the model value and model numbers and
adds TBM, F16C and FMA over the latest G4 model.

Signed-off-by: Andre Przywara <osp@andrep.de>
Signed-off-by: Boris Ostrovsky <boris.ostrovsky@amd.com>
[ehabkost: edited commit message]
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agotarget-i386/cpu: Name new CPUID bits
Andre Przywara [Wed, 14 Nov 2012 18:28:52 +0000 (16:28 -0200)]
target-i386/cpu: Name new CPUID bits

Update QEMU's knowledge of CPUID bit names. This allows to
enable/disable those new features on QEMU's command line when
using KVM and prepares future feature enablement in QEMU.

This adds F16C, RDRAND, LWP, TBM, TopoExt, PerfCtr_Core, PerfCtr_NB,
FSGSBASE, BMI1, AVX2, BMI2, ERMS, PCID, InvPCID, RTM, RDSeed and ADX.

Sources where the AMD BKDG for Family 15h/Model 10h, Intel Software
Developer Manual, and the Linux kernel for the leaf 7 bits.

Signed-off-by: Andre Przywara <osp@andrep.de>
Signed-off-by: Boris Ostrovsky <boris.ostrovsky@amd.com>
[ehabkost: added CPUID_EXT_PCID]
[ehabkost: edited commit message]
[ehabkost: rebased against latest qemu.git master]
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agoqapi-types.h: Don't include qemu-common.h
Igor Mammedov [Sun, 19 Aug 2012 23:39:37 +0000 (01:39 +0200)]
qapi-types.h: Don't include qemu-common.h

Needed to prevent build breakage when CPUState becomes a child of
DeviceState.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
[ehabkost: include <stdbool.h> too]
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agoosdep: Move qemu_{open,close}() prototypes
Andreas Färber [Wed, 14 Nov 2012 15:42:39 +0000 (16:42 +0100)]
osdep: Move qemu_{open,close}() prototypes

They are implemented in osdep.c, so keep the prototypes in osdep.h.

Suggested-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Eduardo Habkost <ehabkost@redhat.com>
11 years agoqemu-config.h: Include headers it needs
Eduardo Habkost [Tue, 23 Oct 2012 23:29:38 +0000 (21:29 -0200)]
qemu-config.h: Include headers it needs

Include:
- <stdio.h> for FILE
- qemu-option.h for QemuOptsList

Some of those headers were probably being included by accident because
some other headers were including qemu-common.h, but those headers
should eventually stop including qemu-common.h.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agovnc-palette.h: Include <stdbool.h>
Eduardo Habkost [Tue, 23 Oct 2012 23:01:36 +0000 (21:01 -0200)]
vnc-palette.h: Include <stdbool.h>

<stdbool.h> is needed for the 'bool' type, used in the header.

The header is probably being included by accident because some other
headers are including qemu-common.h, but those headers should eventually
stop including qemu-common.h.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agoqemu-fsdev-dummy.c: Include module.h
Eduardo Habkost [Tue, 23 Oct 2012 21:43:01 +0000 (19:43 -0200)]
qemu-fsdev-dummy.c: Include module.h

module.h is where machine_init() is defined, but qemu-fsdev-dummy.c
doesn't include it.

The header is probably being included by accident because some other
headers are including qemu-common.h, but those headers should eventually
stop including qemu-common.h.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agoqdev: Split up header so it can be used in cpu.h
Anthony Liguori [Fri, 10 Aug 2012 17:00:43 +0000 (12:00 -0500)]
qdev: Split up header so it can be used in cpu.h

Header file dependency is a frickin' nightmare right now.  cpu.h tends
to get included in our 'include everything' header files but qdev also
needs to include those headers mainly for qdev-properties since it knows
about CharDriverState and friends.

We can solve this for now by splitting out qdev.h along the same lines
that we previously split the C file.  Then cpu.h just needs to include
qdev-core.h.

hw/qdev.h is split into following new headers:
    hw/qdev-core.h
    hw/qdev-properties.h
    hw/qdev-monitor.h

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
[ehabkost: re-add DEFINE_PROP_PCI_HOST_DEVADDR, that was removed on the
 original patch (by mistake, I guess)]
[ehabkost: kill qdev_prop_set_vlan() declaration]
[ehabkost: moved get_fw_dev_path() comment to the original location
 (I don't know why it was moved)]
[ehabkost: removed qdev_exists() declaration]
[ehabkost: keep using 'QemuOpts' instead of 'struct QemuOpts', as
 qdev-core.h includes qemu-option.h]

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agoMove qemu_irq typedef out of qemu-common.h
Igor Mammedov [Tue, 16 Oct 2012 01:57:21 +0000 (03:57 +0200)]
Move qemu_irq typedef out of qemu-common.h

It's necessary for making CPU child of DEVICE without
causing circular header deps.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
[ehabkost: re-added the typedef to hw/irq.h after rebasing]
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agoqemu-common.h: Comment about usage rules
Eduardo Habkost [Tue, 23 Oct 2012 21:44:02 +0000 (19:44 -0200)]
qemu-common.h: Comment about usage rules

Every time we make a tiny change on a header file, we often find
circular header dependency problems. To avoid this nightmare, we need to
stop including qemu-common.h from other headers, and we should gradually
move the declarations from the catch-all qemu-common.h header to their
specific headers.

This simply adds a comment documenting the rules about qemu-common.h,
hoping that people will see it before including qemu-common.h from other
header files, and before adding more declarations to qemu-common.h.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agokvm: Actually remove software breakpoints from list on cleanup
Jan Kiszka [Mon, 12 Nov 2012 14:04:35 +0000 (15:04 +0100)]
kvm: Actually remove software breakpoints from list on cleanup

So far we only removed them from the guest, leaving its states in the
list. This made it impossible for gdb to re-enable breakpoints on the
same address after re-attaching.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
11 years agoacpi_piix4: fix migration of gpe fields
Marcelo Tosatti [Tue, 30 Oct 2012 23:14:19 +0000 (21:14 -0200)]
acpi_piix4: fix migration of gpe fields

Migrate 16 bytes for en/sts fields (which is the correct size),
increase version to 3, and document how to support incoming
migration from qemu-kvm 1.2.

Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
12 years agoqemu-io: Use bdrv_drain_all instead of qemu_aio_flush
Kevin Wolf [Tue, 13 Nov 2012 15:41:22 +0000 (16:41 +0100)]
qemu-io: Use bdrv_drain_all instead of qemu_aio_flush

This is harmless as of today because I/O throttling is not used in
qemu-io, however as soon as .bdrv_drain handlers will be introduced,
qemu-io must be sure to call bdrv_drain_all().

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agomegasas: Use bdrv_drain_all instead of qemu_aio_flush
Kevin Wolf [Tue, 13 Nov 2012 15:39:48 +0000 (16:39 +0100)]
megasas: Use bdrv_drain_all instead of qemu_aio_flush

Calling qemu_aio_flush() directly can hang when combined with I/O
throttling.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agovmdk: Fix data corruption bug in WRITE and READ handling
Gerhard Wiesinger [Sat, 10 Nov 2012 08:22:18 +0000 (09:22 +0100)]
vmdk: Fix data corruption bug in WRITE and READ handling

Fixed a MAJOR BUG in VMDK files on file boundaries on reads
and ALSO ON WRITES WHICH MIGHT CORRUPT THE IMAGE AND DATA!!!!!!

Triggered for example with the following VMDK file (partly listed):
RW 4193792 FLAT "XP-W1-f001.vmdk" 0
RW 2097664 FLAT "XP-W1-f002.vmdk" 0
RW 4193792 FLAT "XP-W1-f003.vmdk" 0
RW 512 FLAT "XP-W1-f004.vmdk" 0
RW 4193792 FLAT "XP-W1-f005.vmdk" 0
RW 2097664 FLAT "XP-W1-f006.vmdk" 0
RW 4193792 FLAT "XP-W1-f007.vmdk" 0
RW 512 FLAT "XP-W1-f008.vmdk" 0

Patch includes:
1.) Patch fixes wrong calculation on extent boundaries. Especially it
fixes the relativeness of the sector number to the current extent.

Verfied correctness with:
1.) Converted either with Virtualbox to VDI and then with qemu-img and
    then with qemu-img only:

    VBoxManage clonehd --format vdi /VM/XP-W/new/XP-W1.vmdk ~/.VirtualBox/Harddisks/XP-W1-new-test.vdi
    ./qemu-img convert -O raw ~/.VirtualBox/Harddisks/XP-W1-new-test.vdi /root/QEMU/VM-XP-W1/XP-W1-via-VBOX.img
    md5sum /root/QEMU/VM-XP-W/XP-W1-direct.img
    md5sum /root/QEMU/VM-XP-W/XP-W1-via-VBOX.img
    => same MD5 hash

2.) Verified debug log files
3.) Run Windows XP successfully
4.) chkdsk run successfully without any errors

Signed-off-by: Gerhard Wiesinger <lists@wiesinger.com>
Acked-by: Fam Zheng <famcool@gmail.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agofdc: remove last usage of FD_STATE_SEEK
Hervé Poussineau [Thu, 20 Sep 2012 21:11:58 +0000 (23:11 +0200)]
fdc: remove last usage of FD_STATE_SEEK

Replace it by directly setting FD_SR0_SEEK if required

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agofdc: fix typo in zero constant
Hervé Poussineau [Mon, 20 Aug 2012 11:50:34 +0000 (13:50 +0200)]
fdc: fix typo in zero constant

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agofdc: remove double affectation of FD_MSR_CMDBUSY flag
Hervé Poussineau [Sun, 19 Aug 2012 20:04:43 +0000 (22:04 +0200)]
fdc: remove double affectation of FD_MSR_CMDBUSY flag

FD_MSR_CMDBUSY flag is already set in fdctrl_write_data(), just
before calling the command handler (fdctrl_start_transfer() here).

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agofdc-tests: add tests for VERIFY command
Hervé Poussineau [Tue, 18 Sep 2012 21:04:56 +0000 (23:04 +0200)]
fdc-tests: add tests for VERIFY command

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agofdc: implement VERIFY command
Hervé Poussineau [Tue, 18 Sep 2012 21:04:10 +0000 (23:04 +0200)]
fdc: implement VERIFY command

VERIFY command is like a READ command, except that read data is not
transfered by DMA.
As DMA engine is not used, so we have to start data transfer ourselves.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agofdc-test: Check READ ID
Kevin Wolf [Thu, 20 Sep 2012 21:20:07 +0000 (23:20 +0200)]
fdc-test: Check READ ID

ST0 shouldn't include 0x20 (FD_SR0_SEEK) after READ ID.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Tested-by: Hervé Poussineau <hpoussin@reactos.org>
12 years agofdc: fix false FD_SR0_SEEK
Hervé Poussineau [Thu, 20 Sep 2012 21:07:53 +0000 (23:07 +0200)]
fdc: fix false FD_SR0_SEEK

Do not always set FD_SR0_SEEK, as callers already set it if needed.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agofdc: fix FD_SR0_SEEK for initial seek on DMA transfers
Hervé Poussineau [Thu, 20 Sep 2012 21:01:58 +0000 (23:01 +0200)]
fdc: fix FD_SR0_SEEK for initial seek on DMA transfers

fdctrl_start_transfer() used to set FD_SR0_SEEK no matter if
there actually was a seek or not. This is obviously wrong.

fdctrl_start_transfer() has this information because it performs
the initial seek itself.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agofdc: fix FD_SR0_SEEK for non-DMA transfers and multi sectors transfers
Hervé Poussineau [Thu, 20 Sep 2012 20:50:17 +0000 (22:50 +0200)]
fdc: fix FD_SR0_SEEK for non-DMA transfers and multi sectors transfers

On non-DMA transfers, fdctrl_stop_transfer() used to set FD_SR0_SEEK
no matter if there actually was a seek or not. This is obviously wrong.

fdctrl_seek_to_next_sect() has this information because it performs
the seek itself.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agofdc: use status0 field instead of a local variable
Hervé Poussineau [Sun, 19 Aug 2012 08:21:14 +0000 (10:21 +0200)]
fdc: use status0 field instead of a local variable

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agofdc-test: add tests for non-DMA READ command
Hervé Poussineau [Tue, 18 Sep 2012 21:02:59 +0000 (23:02 +0200)]
fdc-test: add tests for non-DMA READ command

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agofdc-test: insert media before fuzzing registers
Hervé Poussineau [Tue, 18 Sep 2012 20:49:30 +0000 (22:49 +0200)]
fdc-test: insert media before fuzzing registers

A media will be required for future fdc tests.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agofdc-test: split test_media_change() test, so insert part can be reused
Hervé Poussineau [Tue, 18 Sep 2012 20:48:48 +0000 (22:48 +0200)]
fdc-test: split test_media_change() test, so insert part can be reused

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agofdc: Remove status0 parameter from fdctrl_set_fifo()
Kevin Wolf [Mon, 3 Sep 2012 23:46:54 +0000 (23:46 +0000)]
fdc: Remove status0 parameter from fdctrl_set_fifo()

It decided whether an interrupt is triggered. Only one caller made use
of this functionality, so move the code there.

In this one caller, the interrupt must actually be triggered
unconditionally, like it was before commit 2fee0088. For example, a
successful read without an implied seek can result in st0 = 0, but still
triggers the interrupt.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Tested-by: Hervé Poussineau <hpoussin@reactos.org>
12 years agoaio: rename AIOPool to AIOCBInfo
Stefan Hajnoczi [Wed, 31 Oct 2012 15:34:37 +0000 (16:34 +0100)]
aio: rename AIOPool to AIOCBInfo

Now that AIOPool no longer keeps a freelist, it isn't really a "pool"
anymore.  Rename it to AIOCBInfo and make it const since it no longer
needs to be modified.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoaio: use g_slice_alloc() for AIOCB pooling
Stefan Hajnoczi [Wed, 31 Oct 2012 15:34:36 +0000 (16:34 +0100)]
aio: use g_slice_alloc() for AIOCB pooling

AIO control blocks are frequently acquired and released because each aio
request involves at least one AIOCB.  Therefore, we pool them to avoid
heap allocation overhead.

The problem with the freelist approach in AIOPool is thread-safety.  If
we want BlockDriverStates to associate with AioContexts that execute in
multiple threads, then a global freelist becomes a problem.

This patch drops the freelist and instead uses g_slice_alloc() which is
tuned for per-thread fixed-size object pools.  qemu_aio_get() and
qemu_aio_release() are now thread-safe.

Note that the change from g_malloc0() to g_slice_alloc() should be safe
since the freelist reuse case doesn't zero the AIOCB either.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoaio: switch aiocb_size type int -> size_t
Stefan Hajnoczi [Wed, 31 Oct 2012 15:34:35 +0000 (16:34 +0100)]
aio: switch aiocb_size type int -> size_t

Using appropriate types for variables is a good thing :).  All users
simply do sizeof(MyType) and the value is passed to a memory allocator,
it should be size_t.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agotests: allow qemu-iotests to be run against nbd backend
Nick Thomas [Fri, 2 Nov 2012 13:01:23 +0000 (13:01 +0000)]
tests: allow qemu-iotests to be run against nbd backend

To do this, we start a qemu-nbd process at _make_test_img and kill
it in _cleanup_test_img. $TEST_IMG is changed to point at the TCP
server. We also remove the checks for existence of binaries from
common.config - they're duplicated in common, and we can make the
qemu-nbd check conditional on $IMGPROTO being "nbd" if we do it there.

Signed-off-by: Nick Thomas <nick@bytemark.co.uk>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoblock: Workaround for older versions of MinGW gcc
Stefan Weil [Sun, 4 Nov 2012 11:09:34 +0000 (12:09 +0100)]
block: Workaround for older versions of MinGW gcc

Versions before gcc-4.6 don't support unnamed fields in initializers
(see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10676).

Offset and OffsetHigh belong to an unnamed struct which is part of an
unnamed union. Therefore the original code does not work with older
versions of gcc.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoMAINTAINERS: add Stefan Hajnoczi as block and virtio-blk co-maintainer
Stefan Hajnoczi [Fri, 9 Nov 2012 13:29:03 +0000 (14:29 +0100)]
MAINTAINERS: add Stefan Hajnoczi as block and virtio-blk co-maintainer

Kevin has requested co-maintainership to give him more time to write
code.  We will alternate patch review duties on a weekly basis.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqemu-iotests: qcow2: Test growing large refcount table
Kevin Wolf [Fri, 26 Oct 2012 18:31:15 +0000 (20:31 +0200)]
qemu-iotests: qcow2: Test growing large refcount table

Actually writing all the content with 512 byte sector size would take
forever, therefore build the image file with a Python script and use
qemu-io for the last write that actually triggers the refcount table
growth.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>