sdk/emulator/qemu.git
11 years agoq35: Suppress SMM BIOS initialization under KVM
Jan Kiszka [Wed, 14 Nov 2012 20:54:07 +0000 (15:54 -0500)]
q35: Suppress SMM BIOS initialization under KVM

Same as for i44fx: KVM does not support SMM yet. Signal it initialized
to Seabios to avoid failures.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Jason Baron <jbaron@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoich9: Add i82801b11 dmi-to-pci bridge
Jason Baron [Wed, 14 Nov 2012 20:54:07 +0000 (15:54 -0500)]
ich9: Add i82801b11 dmi-to-pci bridge

Add the dmi-to-pci i82801b11 bridge chip. This is the pci bridge chip
that q35 uses on its host bus for PCI bus arbitration.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Jason Baron <jbaron@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoq35: Introduce q35 pc based chipset emulator
Isaku Yamahata [Wed, 14 Nov 2012 20:54:06 +0000 (15:54 -0500)]
q35: Introduce q35 pc based chipset emulator

pc q35 based chipset emulator to support pci express natively. Based on
Anthony Liguori's suggestion, the machine name is 'q35-next', with an alias
of 'q35'. At this point, there are no compatibility guarantees. When the
chipset stabilizes more, we will begin to version the machine names.

Major features which still need to be added:

-Migration support (mostly around ahci)
-ACPI hotplug support (pcie hotplug support is working)
-Passthrough support

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Jason Baron <jbaron@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoich9: Add smbus
Jason Baron [Fri, 23 Nov 2012 03:06:42 +0000 (22:06 -0500)]
ich9: Add smbus

Add support for the ich9 smbus chip.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Jason Baron <jbaron@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoich9: Add the lpc chip
Jason Baron [Wed, 14 Nov 2012 20:54:05 +0000 (15:54 -0500)]
ich9: Add the lpc chip

Add support for the ICH9 LPC chip.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Jason Baron <jbaron@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoich9: Add acpi support and definitions
Jason Baron [Fri, 23 Nov 2012 03:05:06 +0000 (22:05 -0500)]
ich9: Add acpi support and definitions

Lay the groundwork for subsequent ich9 support.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Jason Baron <jbaron@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agopc/piix_pci: factor out smram/pam logic
Isaku Yamahata [Wed, 14 Nov 2012 20:54:02 +0000 (15:54 -0500)]
pc/piix_pci: factor out smram/pam logic

Factor out smram/pam logic for use by other chipsets, namely q35
at this point.

Note: Should be factored out into a generic North Bridge Class.

[jbaron@redhat.com: changes for updated memory API]
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Jason Baron <jbaron@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agopc_piix: Move kvm irq routing functions out of pc_piix.c
Jason Baron [Wed, 14 Nov 2012 20:54:02 +0000 (15:54 -0500)]
pc_piix: Move kvm irq routing functions out of pc_piix.c

Rename: kvm_piix3_gsi_handlei() -> kvm_pc_gsi_handler()
        kvm_piix3_setup_irq_routing() -> kvm_pc_setup_irq_routing()

This is in preparation for other users, namely q35 at this time.

Signed-off-by: Jason Baron <jbaron@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agopc: Move ioapic_init() from pc_piix.c to pc.c
Jason Baron [Wed, 14 Nov 2012 20:54:01 +0000 (15:54 -0500)]
pc: Move ioapic_init() from pc_piix.c to pc.c

Move ioapic_init() from pc_piix.c to pc.c, to make it a common function.
Rename ioapic_init() -> ioapic_init_gsi().
Move to pc.h so q35 can use them as well.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Jason Baron <jbaron@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agopc, pc_piix: split out pc nic initialization
Isaku Yamahata [Wed, 14 Nov 2012 20:54:01 +0000 (15:54 -0500)]
pc, pc_piix: split out pc nic initialization

Factor out pc nic initialization.
This simplifies the pc initialization and will reduce the code
duplication of q35 pc initialization.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Jason Baron <jbaron@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge remote-tracking branch 'qemu-kvm/uq/master' into staging
Anthony Liguori [Mon, 26 Nov 2012 14:19:45 +0000 (08:19 -0600)]
Merge remote-tracking branch 'qemu-kvm/uq/master' into staging

* qemu-kvm/uq/master:
  Legacy qemu-kvm options have no argument

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

* kraxel/usb.72:
  usb-redir: Don't handle interrupt output packets async
  usb-redir: Split usb_handle_interrupt_data into separate in/out functions
  usb-smartcard-reader: Properly NAK interrupt eps when we've no events
  usb-bt: Return NAK instead of STALL when interrupt ep has no data
  uhci: Fix double unlink
  uhci: Don't allow the guest to set port-enabled when there is no dev connected
  uhci: Add a completions_only flag for async completions

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

* spice/spice.v64:
  spice: add new spice-server callbacks to ui/spice-display.c
  Fix the inconsistency in x509-dh-key-file parameter

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

* stefanha/block:
  ide: Fix status register after short PRDs
  ide: Fix crash with too long PRD
  use int64_t for return values from rbd instead of int
  vdi: don't override libuuid symbols
  block: add bdrv_reopen() support for raw hdev, floppy, and cdrom

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

* stefanha/net:
  tap: reset vnet header size on open

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovnc: fix option misspelling ("non-adapative" -> "non-adaptive")
Catalin Patulea [Sat, 10 Nov 2012 00:01:26 +0000 (19:01 -0500)]
vnc: fix option misspelling ("non-adapative" -> "non-adaptive")

Signed-off-by: Catalin Patulea <catalinp@google.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agochardev: Use real-time clock for open timer
Jan Kiszka [Thu, 22 Nov 2012 17:30:02 +0000 (18:30 +0100)]
chardev: Use real-time clock for open timer

The vm clock may be stopped, and then we won't get open events anymore.
Seen with QMP sessions.

Reported-by: Dietmar Maurer <dietmar@proxmox.com>
Tested-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agoBuild system fix distclean error for pixman
Wenchao Xia [Sat, 24 Nov 2012 09:27:18 +0000 (17:27 +0800)]
Build system fix distclean error for pixman

  Currently Makefile test if pixman have configure log, but the script directly
return error if that file do not exist. This patch fix it.

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agoblock: Fix regression for MinGW (assertion caused by short string)
Stefan Weil [Thu, 22 Nov 2012 06:25:48 +0000 (07:25 +0100)]
block: Fix regression for MinGW (assertion caused by short string)

The local string tmp_filename is passed to function get_tmp_filename
which expects a string with minimum size MAX_PATH for w32 hosts.

MAX_PATH is 260 and PATH_MAX is 259, so tmp_filename was too short.

Commit eba25057b9a5e19d10ace2bc7716667a31297169 introduced this
regression.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotci: Fix type of tci_read_label
Richard Henderson [Mon, 19 Nov 2012 20:43:14 +0000 (12:43 -0800)]
tci: Fix type of tci_read_label

Fixes the pointer truncation that was occurring for branches.

Cc: Stefan Weil <sw@weilnetz.de>
Cc: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Stefan Weil <sw@weilnetz.de>
Tested-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotarget-mips: remove POOL48A from the microMIPS decoding
Aurelien Jarno [Sat, 24 Nov 2012 12:35:06 +0000 (13:35 +0100)]
target-mips: remove POOL48A from the microMIPS decoding

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
11 years agotcg: mark local temps as MEM in dead_temp()
Aurelien Jarno [Sat, 24 Nov 2012 10:53:55 +0000 (11:53 +0100)]
tcg: mark local temps as MEM in dead_temp()

In dead_temp, local temps should always be marked as back to memory,
even if they have not been allocated (i.e. they are discared before
cross a basic block).

It fixes the following assertion in target-xtensa:

    qemu-system-xtensa: tcg/tcg.c:1665: temp_save: Assertion `s->temps[temp].val_type == 2 || s->temps[temp].fixed_reg' failed.
    Aborted

Reported-by: Max Filippov <jcmvbkbc@gmail.com>
Tested-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
11 years agotarget-mips: Clean up microMIPS32 major opcode
陳韋任 (Wei-Ren Chen) [Wed, 21 Nov 2012 06:04:41 +0000 (14:04 +0800)]
target-mips: Clean up microMIPS32 major opcode

  I check MIPS microMIPS manual [1], and found the major opcode might
be wrong. I add a comment to explicitly indicate what manual I am refering
to, and according that manual I remove microMIPS32 major opcodes 0x1f.
As for others, like 0x16, 0x17, 0x36 and 0x37, they are for higher-order
MIPS ISA level or new revision of this microMIPS architecture. Quote
from Johnson, they are belong MIPS64 [2].

[1] http://www.mips.com/products/architectures/micromips/#specifications

    MIPS Architecture for Programmers Volume II-B:
      The microMIPS32 Instruction Set (Revision 3.05)

    MD00582-2B-microMIPS-AFP-03.05.pdf

[2] http://www.mips.com/products/architectures/mips64/

    MIPS Architecture For Programmers
      Volume II-A: The MIPS64 Instruction Set

    MD00087-2B-MIPS64BIS-AFP-03.51.pdf

Signed-off-by: Chen Wei-Ren <chenwj@iis.sinica.edu.tw>
Reviewed-by: Eric Johnson <ericj@mips.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
11 years agotarget-mips: Add comments on POOL32Axf encoding
陳韋任 (Wei-Ren Chen) [Wed, 21 Nov 2012 05:50:45 +0000 (13:50 +0800)]
target-mips: Add comments on POOL32Axf encoding

  Current QEMU MIPS POOL32AXF encoding comes from microMIPS32
and microMIPS32 DSP. Add comment here to help reading.

Signed-off-by: Chen Wei-Ren <chenwj@iis.sinica.edu.tw>
Reviewed-by: Eric Johnson <ericj@mips.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
11 years agotarget-openrisc: remove conflicting definitions from cpu.h
Aurelien Jarno [Tue, 9 Oct 2012 19:53:12 +0000 (21:53 +0200)]
target-openrisc: remove conflicting definitions from cpu.h

On an ARM host, the registers definitions from cpu.h clash
with /usr/include/sys/ucontext.h. As there are unused, just remove
them.

Cc: Jia Liu <proljc@gmail.com>
Cc: qemu-stable@nongnu.org
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
11 years agotcg/arm: fix cross-endian qemu_st16
Aurelien Jarno [Tue, 9 Oct 2012 19:53:11 +0000 (21:53 +0200)]
tcg/arm: fix cross-endian qemu_st16

The bswap16 TCG opcode assumes that the high bytes of the temp equal
to 0 before calling it. The ARM backend implementation takes this
assumption to slightly optimize the generated code.

The same implementation is called for implementing the cross-endian
qemu_st16 opcode, where this assumption is not true anymore. One way to
fix that would be to zero the high bytes before calling it. Given the
store instruction just ignore them, it is possible to provide a slightly
more optimized version. With ARMv6+ the rev16 instruction does the work
correctly. For lower ARM versions the patch provides a version which
behaves correctly with non-zero high bytes, but fill them with junk.

Cc: Andrzej Zaborowski <balrogg@gmail.com>
Cc: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-stable@nongnu.org
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
11 years agotcg/arm: fix TLB access in qemu-ld/st ops
Aurelien Jarno [Tue, 9 Oct 2012 19:53:11 +0000 (21:53 +0200)]
tcg/arm: fix TLB access in qemu-ld/st ops

The TCG arm backend considers likely that the offset to the TLB
entries does not exceed 12 bits for mem_index = 0. In practice this is
not true for at least the MIPS target.

The current patch fixes that by loading the bits 23-12 with a separate
instruction, and using loads with address writeback, independently of
the value of mem_idx. In total this allow a 24-bit offset, which is a
lot more than needed.

Cc: Andrzej Zaborowski <balrogg@gmail.com>
Cc: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-stable@nongnu.org
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
11 years agoLegacy qemu-kvm options have no argument
Bruce Rogers [Tue, 20 Nov 2012 14:11:21 +0000 (07:11 -0700)]
Legacy qemu-kvm options have no argument

The options no-kvm, no-kvm-pit, no-kvm-pit-reinjection, and no-kvm-irqchip
should be marked as having no argument.

Signed-off-by: Bruce Rogers <brogers@suse.com>
Reviewed-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
11 years agousb-redir: Don't handle interrupt output packets async
Hans de Goede [Sat, 17 Nov 2012 11:26:57 +0000 (12:26 +0100)]
usb-redir: Don't handle interrupt output packets async

Instead report them as successfully completed directly on submission, this
has 2 advantages:

1) This matches the timing of interrupt output packets on real hardware,
with the previous async handling, if an ep has an interval of say 500 ms,
then there would be 500+ ms between the submission and the guest seeing the
completion, as we wont do the write back until the qh gets polled again. And
in the mean time the guest may very well have timed out, as the guest can
reasonable expect a much quicker completion.

2) This fixes interrupt output packets potentially getting send twice
surrounding a migration. As we delay the writeback to guest memory until
the qh gets polled again, there is a window between completion and writeback
where migration can happen, in this case the destination will not know
about the completion, and it will execute the packet *again*

But it does also come with a disadvantage:

1) If the actual interrupt out to the real usb device fails, there is no
way to report this back to the guest.

This patch assumes however that interrupt outs in practice never fail, as
they are only used by specialized drivers, which are unlikely to issue illegal
requests (unlike general class drivers which often issue requests which some
devices don't implement). And that thus the advantages outway the disadvantage.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agousb-redir: Split usb_handle_interrupt_data into separate in/out functions
Hans de Goede [Sat, 17 Nov 2012 11:26:56 +0000 (12:26 +0100)]
usb-redir: Split usb_handle_interrupt_data into separate in/out functions

No functional changes.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agousb-smartcard-reader: Properly NAK interrupt eps when we've no events
Hans de Goede [Sat, 17 Nov 2012 11:15:02 +0000 (12:15 +0100)]
usb-smartcard-reader: Properly NAK interrupt eps when we've no events

When we've no data to return from the interrupt endpoint, return NAK rather
then a 0 length packet.

CC: Alon Levy <alevy@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agousb-bt: Return NAK instead of STALL when interrupt ep has no data
Hans de Goede [Sat, 17 Nov 2012 11:15:01 +0000 (12:15 +0100)]
usb-bt: Return NAK instead of STALL when interrupt ep has no data

I noticed this while making all devices with interrupt endpoints properly
do wakeup. While at it also add wakeup support.

Note that I've not tested this, but returning STALL for an interrupt ep
which has no data is cleary the wrong thing to do.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agouhci: Fix double unlink
Hans de Goede [Sat, 17 Nov 2012 11:11:51 +0000 (12:11 +0100)]
uhci: Fix double unlink

uhci_async_cancel() already does a uhci_async_unlink().

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agouhci: Don't allow the guest to set port-enabled when there is no dev connected
Hans de Goede [Sat, 17 Nov 2012 11:11:50 +0000 (12:11 +0100)]
uhci: Don't allow the guest to set port-enabled when there is no dev connected

It is possible for device disconnect and the guest trying to reset the port
(because of USB xact errors prior to the disconnect getting signaled) to race,
when we hit this race, the guest will write the port-control register with its
pre-disconnect value + the reset bit set, after which we have a disconnected
device with its port-enabled bit set in its port-control register, which
is no good :)

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agouhci: Add a completions_only flag for async completions
Hans de Goede [Sat, 17 Nov 2012 11:11:49 +0000 (12:11 +0100)]
uhci: Add a completions_only flag for async completions

Add a completions_only flag, and set this when running process_frame for async
completion handling, this fixes 2 issues in a single patch:

1) It makes sure async completed packets get written to guest mem immediately,
even if all the bandwidth for the frame was consumed from the timer run
process_frame. This is necessary as delaying their writeback to the next frame
can cause the completion to get lost on migration.

2) The calling of process_frame from a bh on async completion causes iso
tds to get server more often they should, messing up usb sound class device
timing. By only processing completed packets, the iso tds get skipped fixing
this.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agospice: add new spice-server callbacks to ui/spice-display.c
Gerd Hoffmann [Wed, 21 Nov 2012 13:41:48 +0000 (14:41 +0100)]
spice: add new spice-server callbacks to ui/spice-display.c

Otherwise qemu crashes with non-qxl graphics cards.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoFix the inconsistency in x509-dh-key-file parameter
Lei Li [Mon, 19 Nov 2012 09:15:08 +0000 (17:15 +0800)]
Fix the inconsistency in x509-dh-key-file parameter

Commit c448e8552b0f6135dabddf944a7110f929c08320 (spice: tls
support) added options to the -spice command line. But there
is an inconsistency between the declaration of the option
'x509-dh-key-file' to -spice command line and its parameter
parsing 'x509-dh-file' in function qemu_spice_init.

https://bugs.launchpad.net/qemu/+bug/1035042

Reported-by: Alon Bar-Lev <alon.barlev@gmail.com>
Signed-off-by: Lei Li <lilei@linux.vnet.ibm.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoide: Fix status register after short PRDs
Kevin Wolf [Tue, 20 Nov 2012 16:27:44 +0000 (17:27 +0100)]
ide: Fix status register after short PRDs

When failing a request because the length of the regions described by
the PRDT was too short for the requested number of sectors, the IDE
emulation forgot to update the status register, so that the device would
keep the BSY flag set indefinitely.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoide: Fix crash with too long PRD
Kevin Wolf [Tue, 20 Nov 2012 16:27:43 +0000 (17:27 +0100)]
ide: Fix crash with too long PRD

Without this, s->nsector can become negative and badness happens (trying
to malloc huge amount of memory and glib calls abort())

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agouse int64_t for return values from rbd instead of int
Stefan Priebe [Tue, 20 Nov 2012 12:44:55 +0000 (13:44 +0100)]
use int64_t for return values from rbd instead of int

rbd / rados tends to return pretty often length of writes
or discarded blocks. These values might be bigger than int.

The steps to reproduce are:

  mkfs.xfs -f a whole device bigger than int in bytes. mkfs.xfs sends
  a discard. Important is that you use scsi-hd and set
  discard_granularity=512. Otherwise rbd disabled discard support.

Signed-off-by: Stefan Priebe <s.priebe@profihost.ag>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agovdi: don't override libuuid symbols
Stefan Hajnoczi [Tue, 20 Nov 2012 15:34:17 +0000 (16:34 +0100)]
vdi: don't override libuuid symbols

It's poor symbol hygiene to provide a global symbols that collide with a
common library like libuuid.  If QEMU links against a shared library
that depends on uuid_generate() it can end up calling our stub version
of the function.

This exact scenario happened with GlusterFS libgfapi.so, which depends
on libglusterfs.so's uuid_generate().

Scope the uuid stubs for vdi.c only and avoid affecting other shared
objects.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
11 years agoblock: add bdrv_reopen() support for raw hdev, floppy, and cdrom
Jeff Cody [Tue, 20 Nov 2012 15:21:10 +0000 (10:21 -0500)]
block: add bdrv_reopen() support for raw hdev, floppy, and cdrom

For hdev, floppy, and cdrom, the reopen() handlers are the same as
for the file reopen handler.  For floppy and cdrom types, however,
we keep O_NONBLOCK, as in the _open function.

Signed-off-by: Jeff Cody <jcody@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoqemu-sockets: Fix parsing of the inet option 'to'.
Anthony PERARD [Fri, 16 Nov 2012 04:08:14 +0000 (04:08 +0000)]
qemu-sockets: Fix parsing of the inet option 'to'.

Having a qemu command line argument like "-vnc 127.0.0.1:0,to=99" is broken.
This have been break with commit 879e45c72da1569e07fbbc6a1aa2a708ea796044.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: malc <av1474@comtv.ru>
11 years agotcg/ppc: Fix !softmmu case
malc [Wed, 21 Nov 2012 06:55:28 +0000 (10:55 +0400)]
tcg/ppc: Fix !softmmu case

Signed-off-by: malc <av1474@comtv.ru>
11 years agotap: reset vnet header size on open
Michael S. Tsirkin [Tue, 13 Nov 2012 10:23:23 +0000 (12:23 +0200)]
tap: reset vnet header size on open

For tap, we currently assume the vnet header size is 10
(the default value) but that might not be the case
if tap is persistent and has been used by qemu previously.
To fix, set host header size in tap device on open.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoUpdate version for 1.3.0-rc0 release
Anthony Liguori [Mon, 19 Nov 2012 16:31:17 +0000 (10:31 -0600)]
Update version for 1.3.0-rc0 release

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
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