]> git.proxmox.com Git - qemu.git/log
qemu.git
11 years agolinux-headers: Update to 3.7-rc5
Alex Williamson [Tue, 13 Nov 2012 19:27:40 +0000 (12:27 -0700)]
linux-headers: Update to 3.7-rc5

update-linux-headers.sh script run against Linux tag v3.7-rc5

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
11 years agoaio: fix aio_ctx_prepare with idle bottom halves
Paolo Bonzini [Mon, 12 Nov 2012 12:30:10 +0000 (13:30 +0100)]
aio: fix aio_ctx_prepare with idle bottom halves

Commit ed2aec4867f0d5f5de496bb765347b5d0cfe113d changed the return
value of aio_ctx_prepare from false to true when only idle bottom
halves are available.  This broke PC old-style DMA, which uses them.
Fix this by making aio_ctx_prepare return true only when non-idle
bottom halves are scheduled to run.

Reported-by: malc <av1474@comtv.ru>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: malc <av1474@comtv.ru>
11 years agotcg: properly check that op's output needs to be synced to memory
Kirill Batuzov [Wed, 7 Nov 2012 11:26:38 +0000 (15:26 +0400)]
tcg: properly check that op's output needs to be synced to memory

Fix typo introduced in b3a1be87bac3a6aaa59bb88c1410f170dc9b22d5.

Reported-by: Ruslan Savchenko <ruslan.savchenko@gmail.com>
Signed-off-by: Kirill Batuzov <batuzovk@ispras.ru>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
11 years agotarget-mips: Fix seg fault for LUI when MIPS_DEBUG_DISAS==1.
Eric Johnson [Sat, 10 Nov 2012 03:40:51 +0000 (19:40 -0800)]
target-mips: Fix seg fault for LUI when MIPS_DEBUG_DISAS==1.

The call to gen_logic_imm for OPC_LUI passes -1 for rs.  This
causes the MIPS_DEBUG statement to seg fault due to the deference
of regnames[rs].  This patch fixes that.

Signed-off-by: Eric Johnson <ericj@mips.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
(aurel32: replaced static string formating by a static string)

11 years agotarget-i386: avoid using cpu_single_env
Blue Swirl [Sat, 8 Sep 2012 13:26:02 +0000 (13:26 +0000)]
target-i386: avoid using cpu_single_env

Pass around CPUArchState instead of using global cpu_single_env.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
11 years agotarget-xtensa: avoid using cpu_single_env
Blue Swirl [Sat, 8 Sep 2012 13:09:07 +0000 (13:09 +0000)]
target-xtensa: avoid using cpu_single_env

Pass around CPUArchState instead of using global cpu_single_env.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Acked-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
11 years agotarget-unicore32: avoid using cpu_single_env
Blue Swirl [Sat, 8 Sep 2012 12:58:13 +0000 (12:58 +0000)]
target-unicore32: avoid using cpu_single_env

Pass around CPUArchState instead of using global cpu_single_env.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Acked-by: Guan Xuetao <gxt@mprc.pku.edu.cn>
Reviewed-by: Andreas Färber <afaerber@suse.de>
11 years agokvm: avoid using cpu_single_env
Blue Swirl [Sat, 8 Sep 2012 12:43:16 +0000 (12:43 +0000)]
kvm: avoid using cpu_single_env

Pass around CPUArchState instead of using global cpu_single_env.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
11 years agodisas: avoid using cpu_single_env
Blue Swirl [Sat, 8 Sep 2012 12:40:00 +0000 (12:40 +0000)]
disas: avoid using cpu_single_env

Pass around CPUArchState instead of using global cpu_single_env.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Acked-by: Richard Henderson <rth@twiddle.net>
Acked-by: Aurelien Jarno <aurelien@aurel32.net>
Acked-by: Guan Xuetao <gxt@mprc.pku.edu.cn>
11 years agoslirp: remove unused function u_sleep
Blue Swirl [Sat, 13 Oct 2012 18:52:23 +0000 (18:52 +0000)]
slirp: remove unused function u_sleep

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agosun4c: remove unused functions
Blue Swirl [Sat, 13 Oct 2012 18:49:20 +0000 (18:49 +0000)]
sun4c: remove unused functions

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agom48t59: remove unused m48t59_set_addr
Blue Swirl [Sat, 13 Oct 2012 18:46:05 +0000 (18:46 +0000)]
m48t59: remove unused m48t59_set_addr

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotests/tcg: new test for i386 FPREM and FPREM1
Catalin Patulea [Mon, 29 Oct 2012 07:45:51 +0000 (03:45 -0400)]
tests/tcg: new test for i386 FPREM and FPREM1

This is setting the stage for a cleanup of FPREM and FPREM1 helpers while being
sure that they behave same as bare metal.

The test constructs operands using combinations of corner cases for the
floating-point bitfields and prints operands, result and FPU status word for
FPREM and FPREM1. The outputs can then be compared between bare metal and QEMU.
The 'run-test-i386-fprem' make target does just that.

Signed-off-by: Catalin Patulea <catalinp@google.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agomemory: Don't dump disabled regions
Jan Kiszka [Wed, 31 Oct 2012 09:49:02 +0000 (10:49 +0100)]
memory: Don't dump disabled regions

This makes "info mtree" output readable again.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agomemory: Reintroduce dirty flag to optimize changes on disabled regions
Jan Kiszka [Mon, 5 Nov 2012 15:45:56 +0000 (16:45 +0100)]
memory: Reintroduce dirty flag to optimize changes on disabled regions

Cirrus is triggering this, e.g. during Win2k boot: Changes only on
disabled regions require no topology update when transaction depth drops
to 0 again.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agoqemu-timer: Fix compilation for non-POSIX hosts
Stefan Weil [Sun, 4 Nov 2012 20:42:08 +0000 (21:42 +0100)]
qemu-timer: Fix compilation for non-POSIX hosts

A compiler warning is caused by the unused local function reinit_timers
on non-POSIX hosts. Include that function only for POSIX hosts.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agovmware_vga: Add back some info in local state partially reverting aa32b38c
BALATON Zoltan [Sun, 4 Nov 2012 17:41:59 +0000 (18:41 +0100)]
vmware_vga: Add back some info in local state partially reverting aa32b38c

Keep saving display surface parameters at init and using these cached
values instead of getting them when needed. Not sure why this is
needed (maybe due to the interaction with the vga device) but not
doing this broke the Xorg vmware driver at least.

Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Tested-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agokvmvapic: Fix TB invalidation after instruction patching
Jan Kiszka [Sun, 4 Nov 2012 08:16:55 +0000 (09:16 +0100)]
kvmvapic: Fix TB invalidation after instruction patching

Since 0b57e287, cpu_memory_rw_debug already triggers a TB invalidation.
As it doesn't (and cannot) set is_cpu_write_access=1 but "consumes" the
currently executed TB, the tb_invalidate_phys_page_range call from
patch_instruction didn't work anymore.

Fix this by open-coding the required bits to restore the CPU state from
the current TB position before patching and resume execution on the
patched instruction afterward.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Tested-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agomicroblaze: translate.c: Fix swaph decoding
Peter Crosthwaite [Thu, 8 Nov 2012 04:01:19 +0000 (14:01 +1000)]
microblaze: translate.c: Fix swaph decoding

The swaph instruction was not decoding correctly. s/1e1/1e2 on the
9 LSBs on the instruction decode.

Reported-by: David Holsgrove <david.holsgrove@xilinx.com>
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
11 years agotools: initialize main loop before block layer
Paolo Bonzini [Sat, 3 Nov 2012 17:10:17 +0000 (18:10 +0100)]
tools: initialize main loop before block layer

Tools were broken because they initialized the block layer while
qemu_aio_context was still NULL.

Reported-by: malc <av1474@comtv.ru>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: malc <av1474@comtv.ru>
11 years agotcg/ppc32: Use trampolines to trim the code size for mmu slow path accessors
malc [Mon, 5 Nov 2012 17:47:04 +0000 (21:47 +0400)]
tcg/ppc32: Use trampolines to trim the code size for mmu slow path accessors

mmu access looks something like:

<check tlb>
if miss goto slow_path
<fast path>
done:
...

; end of the TB
slow_path:
 <pre process>
 mr r3, r27         ; move areg0 to r3
                    ; (r3 holds the first argument for all the PPC32 ABIs)
 <call mmu_helper>
 b $+8
 .long done
 <post process>
 b done

On ppc32 <call mmu_helper> is:

(SysV and Darwin)

mmu_helper is most likely not within direct branching distance from
the call site, necessitating

a. moving 32 bit offset of mmu_helper into a GPR ; 8 bytes
b. moving GPR to CTR/LR                          ; 4 bytes
c. (finally) branching to CTR/LR                 ; 4 bytes

r3 setting              - 4 bytes
call                    - 16 bytes
dummy jump over retaddr - 4 bytes
embedded retaddr        - 4 bytes
         Total overhead - 28 bytes

(PowerOpen (AIX))
a. moving 32 bit offset of mmu_helper's TOC into a GPR1 ; 8 bytes
b. loading 32 bit function pointer into GPR2            ; 4 bytes
c. moving GPR2 to CTR/LR                                ; 4 bytes
d. loading 32 bit small area pointer into R2            ; 4 bytes
e. (finally) branching to CTR/LR                        ; 4 bytes

r3 setting              - 4 bytes
call                    - 24 bytes
dummy jump over retaddr - 4 bytes
embedded retaddr        - 4 bytes
         Total overhead - 36 bytes

Following is done to trim the code size of slow path sections:

In tcg_target_qemu_prologue trampolines are emitted that look like this:

trampoline:
mfspr r3, LR
addi  r3, 4
mtspr LR, r3      ; fixup LR to point over embedded retaddr
mr    r3, r27
<jump mmu_helper> ; tail call of sorts

And slow path becomes:

slow_path:
 <pre process>
 <call trampoline>
 .long done
 <post process>
 b done

call                    - 4 bytes (trampoline is within code gen buffer
                                   and most likely accessible via
                                   direct branch)
embedded retaddr        - 4 bytes
         Total overhead - 8 bytes

In the end the icache pressure is decreased by 20/28 bytes at the cost
of an extra jump to trampoline and adjusting LR (to skip over embedded
retaddr) once inside.

Signed-off-by: malc <av1474@comtv.ru>
11 years agotarget-mips: use ULL for 64 bit constants
Blue Swirl [Sat, 3 Nov 2012 18:48:35 +0000 (18:48 +0000)]
target-mips: use ULL for 64 bit constants

Fix build on a 32 bit host:
  CC    mips-softmmu/target-mips/dsp_helper.o
/src/qemu/target-mips/dsp_helper.c: In function 'helper_dextr_rs_w':
/src/qemu/target-mips/dsp_helper.c:3556: error: integer constant is too large for 'long' type
/src/qemu/target-mips/dsp_helper.c: In function 'helper_extr_s_h':
/src/qemu/target-mips/dsp_helper.c:3656: error: integer constant is too large for 'long' type

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
11 years agobuild: pthread_atfork() needs include of pthread.h
Anthony Liguori [Fri, 2 Nov 2012 21:12:53 +0000 (16:12 -0500)]
build: pthread_atfork() needs include of pthread.h

Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agotcg/ppc: ld/st optimization
malc [Sat, 3 Nov 2012 15:38:32 +0000 (19:38 +0400)]
tcg/ppc: ld/st optimization

Signed-off-by: malc <av1474@comtv.ru>
11 years agovmware_vga: Allow simple drivers to work without using the fifo
BALATON Zoltan [Sat, 3 Nov 2012 11:47:08 +0000 (12:47 +0100)]
vmware_vga: Allow simple drivers to work without using the fifo

Postpone stopping the dirty log to the point where the command fifo is
configured to allow drivers which don't use the fifo to work too.
(Without this the picture rendered into the vram never got to the
screen and the DIRECT_VRAM option meant to support this case was
removed a year ago.)

Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agovmware_vga: Return a value for FB_SIZE before the device is enabled
BALATON Zoltan [Sat, 3 Nov 2012 11:47:08 +0000 (12:47 +0100)]
vmware_vga: Return a value for FB_SIZE before the device is enabled

According to the documentation drivers using this device should read
FB_SIZE before enabling the device to know what memory to map. This
would not work if we return 0 before enabled. The docs also mention
reading SVGA_REG_DEPTH but not writing it. (Only SVGA_REG_BITS_PER_PIXEL
can be written but we don't really support that either.)

Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agovmware_vga: Remove duplicated info from local state
BALATON Zoltan [Sat, 3 Nov 2012 11:47:08 +0000 (12:47 +0100)]
vmware_vga: Remove duplicated info from local state

Removed info from vmsvga_state that is available from elsewhere and
thus was duplicated here unnecessarily.

Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agovmware_vga: Coding style cleanup
BALATON Zoltan [Sat, 3 Nov 2012 11:47:08 +0000 (12:47 +0100)]
vmware_vga: Coding style cleanup

Fix coding style as suggested by checkpatch.pl

Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agoMerge branch 'trivial-patches' of git://github.com/stefanha/qemu
Blue Swirl [Sat, 3 Nov 2012 12:55:05 +0000 (12:55 +0000)]
Merge branch 'trivial-patches' of git://github.com/stefanha/qemu

* 'trivial-patches' of git://github.com/stefanha/qemu:
  pc: Drop redundant test for ROM memory region
  exec: make some functions static
  target-ppc: make some functions static
  ppc: add missing static
  vnc: add missing static
  vl.c: add missing static
  target-sparc: make do_unaligned_access static
  m68k: Return semihosting errno values correctly
  cadence_uart: More debug information

Conflicts:
target-m68k/m68k-semi.c

11 years agotcg: Optimize qemu_ld/st by generating slow paths at the end of a block
Yeongkyoon Lee [Wed, 31 Oct 2012 07:04:25 +0000 (16:04 +0900)]
tcg: Optimize qemu_ld/st by generating slow paths at the end of a block

Add optimized TCG qemu_ld/st generation which locates the code of TLB miss
cases at the end of a block after generating the other IRs.
Currently, this optimization supports only i386 and x86_64 hosts.

Signed-off-by: Yeongkyoon Lee <yeongkyoon.lee@samsung.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotcg: Add extended GETPC mechanism for MMU helpers with ldst optimization
Yeongkyoon Lee [Wed, 31 Oct 2012 07:04:24 +0000 (16:04 +0900)]
tcg: Add extended GETPC mechanism for MMU helpers with ldst optimization

Add GETPC_EXT which is used by MMU helpers to selectively calculate the code
address of accessing guest memory when called from a qemu_ld/st optimized code
or a C function. Currently, it supports only i386 and x86-64 hosts.

Signed-off-by: Yeongkyoon Lee <yeongkyoon.lee@samsung.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agoconfigure: Add CONFIG_QEMU_LDST_OPTIMIZATION for TCG qemu_ld/st optimization
Yeongkyoon Lee [Wed, 31 Oct 2012 07:04:23 +0000 (16:04 +0900)]
configure: Add CONFIG_QEMU_LDST_OPTIMIZATION for TCG qemu_ld/st optimization

Enable CONFIG_QEMU_LDST_OPTIMIZATION for TCG qemu_ld/st optimization only when
a host is i386 or x86_64.

Signed-off-by: Yeongkyoon Lee <yeongkyoon.lee@samsung.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotarget-m68k/m68k-semi.c: Log when put_user for returning values fails
Peter Maydell [Mon, 29 Oct 2012 12:05:11 +0000 (12:05 +0000)]
target-m68k/m68k-semi.c: Log when put_user for returning values fails

Abstract out the use of put_user for returning semihosting call results,
so that we can log when a guest erroneously attempts a semihosting call
with an unwritable argument block.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotarget-m68k/m68k-semi: Handle get_user failure
Peter Maydell [Mon, 29 Oct 2012 12:05:10 +0000 (12:05 +0000)]
target-m68k/m68k-semi: Handle get_user failure

Handle failure of get_user accessing the semihosting
argument block, rather than simply ignoring the failures.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agom68k: Return semihosting errno values correctly
Meador Inge [Mon, 29 Oct 2012 12:05:09 +0000 (12:05 +0000)]
m68k: Return semihosting errno values correctly

Fixing a simple typo, s/errno/err/, that caused
the error status from GDB semihosted system calls
to be returned incorrectly.

Signed-off-by: Meador Inge <meadori@codesourcery.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agovl: delay thread initialization after daemonization
Paolo Bonzini [Fri, 2 Nov 2012 14:43:24 +0000 (15:43 +0100)]
vl: delay thread initialization after daemonization

Commit ac4119c (chardev: Use timer instead of bottom-half to postpone
open event, 2012-10-12) moved the alarm timer initialization to an earlier
point but failed to consider that it depends on qemu_init_main_loop.

Later, commit 1c53786 (vl: init main loop earlier, 2012-10-30) fixed
this, but left -daemonize in two different ways.  First, timers need to
be reinitialized after forking.  Second, the global mutex was being held
by the parent, and thus dropped after forking.

The first is now fixed using pthread_atfork.  For the second part,
make sure that the global mutex is not taken before daemonization,
and similarly delay qemu_thread_self.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovl: unify calls to init_timer_alarm
Paolo Bonzini [Fri, 2 Nov 2012 14:43:23 +0000 (15:43 +0100)]
vl: unify calls to init_timer_alarm

init_timer_alarm was being called twice.  This is not needed.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoqemu-timer: reinitialize timers after fork
Paolo Bonzini [Fri, 2 Nov 2012 14:43:22 +0000 (15:43 +0100)]
qemu-timer: reinitialize timers after fork

Timers are not inherited by the child of a fork(2), so just use
pthread_atfork to reinstate them after daemonize.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agosemaphore: implement fallback counting semaphores with mutex+condvar
Paolo Bonzini [Fri, 2 Nov 2012 14:43:21 +0000 (15:43 +0100)]
semaphore: implement fallback counting semaphores with mutex+condvar

OpenBSD and Darwin do not have sem_timedwait.  Implement a fallback
for them.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agocompiler: support Darwin weak references
Paolo Bonzini [Fri, 2 Nov 2012 14:43:20 +0000 (15:43 +0100)]
compiler: support Darwin weak references

Weakrefs only tell you if the symbol was defined elsewhere, so you
need a further check at runtime to pick the default definition
when needed.

This could be automated by the compiler, but it does not do it.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge remote-tracking branch 'bonzini/migr-coroutine' into staging
Anthony Liguori [Fri, 2 Nov 2012 18:06:28 +0000 (13:06 -0500)]
Merge remote-tracking branch 'bonzini/migr-coroutine' into staging

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* bonzini/migr-coroutine:
  migration: move process_incoming_migration to a coroutine
  migration: handle EAGAIN while reading QEMUFile
  migration: move qemu_fclose to process_incoming_migration
  migration: close socket QEMUFile from socket_close
  migration: xxx_close will only be called once
  migration: use closesocket, not close
  migration: use migrate_fd_close in migrate_fd_cleanup
  migration: clean up server sockets and handlers before invoking process_incoming_migration
  migration: replace qemu_stdio_fd with qemu_get_fd
  migration: add qemu_get_fd
  migration: consolidate QEMUFile methods in a single QEMUFileOps struct
  migration: unify stdio-based QEMUFile operations

11 years agoMerge remote-tracking branch 'afaerber/qom-cpu' into staging
Anthony Liguori [Fri, 2 Nov 2012 18:05:38 +0000 (13:05 -0500)]
Merge remote-tracking branch 'afaerber/qom-cpu' into staging

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* afaerber/qom-cpu:
  target-i386: cpu: fix --disable-kvm compilation

11 years agomigration: move process_incoming_migration to a coroutine
Paolo Bonzini [Tue, 7 Aug 2012 08:57:43 +0000 (10:57 +0200)]
migration: move process_incoming_migration to a coroutine

The final part of incoming migration, which now consists of
process_incoming_migration for all protocols, is thus made non-blocking.

Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agomigration: handle EAGAIN while reading QEMUFile
Paolo Bonzini [Tue, 7 Aug 2012 09:07:59 +0000 (11:07 +0200)]
migration: handle EAGAIN while reading QEMUFile

This will never happen right now (the assertion would fail).  The
next patch will set the socket or pipe in non-blocking mode, thus
enabling this part of the code.

Coroutines can just stop whenever they want with qemu_coroutine_yield.
As soon as select tells the main loop that the migration stream is
readable, the coroutine is re-entered directly in qemu_get_buffer,
where it will read more data and pass it to the loading routines.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agomigration: move qemu_fclose to process_incoming_migration
Paolo Bonzini [Tue, 7 Aug 2012 08:51:51 +0000 (10:51 +0200)]
migration: move qemu_fclose to process_incoming_migration

The common suffix is now just process_incoming_migration.

Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agomigration: close socket QEMUFile from socket_close
Paolo Bonzini [Tue, 7 Aug 2012 08:50:26 +0000 (10:50 +0200)]
migration: close socket QEMUFile from socket_close

The common suffix now is process_incoming_migration+qemu_fclose.

Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agomigration: xxx_close will only be called once
Paolo Bonzini [Thu, 27 Sep 2012 11:30:15 +0000 (13:30 +0200)]
migration: xxx_close will only be called once

No need to test s->fd again, it is tested in the caller.

Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agomigration: use closesocket, not close
Paolo Bonzini [Thu, 27 Sep 2012 11:33:08 +0000 (13:33 +0200)]
migration: use closesocket, not close

Windows requires this.  Migration does not quite work under Windows
but let's be uniform across QEMU.

Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agomigration: use migrate_fd_close in migrate_fd_cleanup
Paolo Bonzini [Thu, 27 Sep 2012 11:25:45 +0000 (13:25 +0200)]
migration: use migrate_fd_close in migrate_fd_cleanup

migrate_fd_cleanup will usually close the file descriptor via
buffered_file_close's call to migrate_fd_close.  However, in the case
of s->file == NULL it is "inlining" migrate_fd_close (almost: there is a
direct close() instead of using s->close(s)).  To fix the inconsistency
and clean up the code, allow multiple calls to migrate_fd_close and use
the function in migrate_fd_cleanup.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agomigration: clean up server sockets and handlers before invoking process_incoming_migr...
Paolo Bonzini [Tue, 7 Aug 2012 08:49:13 +0000 (10:49 +0200)]
migration: clean up server sockets and handlers before invoking process_incoming_migration

A first step towards making a common "suffix" for all migration protocols,
and moving it to process_incoming_migration.

Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agomigration: replace qemu_stdio_fd with qemu_get_fd
Paolo Bonzini [Wed, 8 Aug 2012 08:21:26 +0000 (10:21 +0200)]
migration: replace qemu_stdio_fd with qemu_get_fd

Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agomigration: add qemu_get_fd
Paolo Bonzini [Wed, 8 Aug 2012 08:20:18 +0000 (10:20 +0200)]
migration: add qemu_get_fd

Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agomigration: consolidate QEMUFile methods in a single QEMUFileOps struct
Paolo Bonzini [Wed, 8 Aug 2012 08:15:15 +0000 (10:15 +0200)]
migration: consolidate QEMUFile methods in a single QEMUFileOps struct

Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agomigration: unify stdio-based QEMUFile operations
Paolo Bonzini [Fri, 21 Sep 2012 10:04:03 +0000 (12:04 +0200)]
migration: unify stdio-based QEMUFile operations

Now that qemu_fseek does not exist anymore, there is no reason to do
an fseek before fread/fwrite when operating on an stdio file.
Thus, unify the get/put_buffer callbacks used by qemu_fopen
with those used for pipes.

Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agotarget-i386: cpu: fix --disable-kvm compilation
Eduardo Habkost [Fri, 2 Nov 2012 16:25:15 +0000 (14:25 -0200)]
target-i386: cpu: fix --disable-kvm compilation

This fixes the following:
  target-i386/cpu.o: In function `kvm_cpu_fill_host':
  target-i386/cpu.c:783: undefined reference to `kvm_state'

I didn't notice the problem before because GCC was optimizing the entire
kvm_cpu_fill_host() function out (because all calls are conditional on
kvm_enabled()).

* cpu_x86_fill_model_id() is used only if CONFIG_KVM is set, so #ifdef it
  entirely to avoid compiler warnings.

* kvm_cpu_fill_host() should be called only if KVM is enabled, so
  use #ifdef CONFIG_KVM around the entire function body.

Reported-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agoui/cocoa.m: Update to new DisplayChangeListener member names
Peter Maydell [Fri, 2 Nov 2012 14:54:43 +0000 (14:54 +0000)]
ui/cocoa.m: Update to new DisplayChangeListener member names

Commit a93a4a2 changed the names of some fields in DisplayChangeListener
and broke compilation of the cocoa UI. Update to the new names.

Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Andreas Färber <andreas.faerber@web.de>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoxenfb: fix build breakage caused by console cleanup series
Gerd Hoffmann [Fri, 2 Nov 2012 07:44:13 +0000 (08:44 +0100)]
xenfb: fix build breakage caused by console cleanup series

Console cleanup series renamed dpy_resize and dpy_update all over the
tree, but hw/xenfb.c was forgotten.  Update it too so it builds again.

Reported-by: Jan Kiszka <jan.kiszka@web.de>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge remote-tracking branch 'kraxel/usb.69' into staging
Anthony Liguori [Thu, 1 Nov 2012 19:34:13 +0000 (14:34 -0500)]
Merge remote-tracking branch 'kraxel/usb.69' into staging

* kraxel/usb.69: (31 commits)
  usb-redir: Allow redirecting super speed devices to high speed controllers
  usb-redir: Allow to attach USB 2.0 devices to 1.1 host controller
  usb-redir: Use reject rather the disconnect on bad ep info
  usb-redir: Add an usbredir_setup_usb_eps() helper function
  usb-redir: Add support for input pipelining
  usb-redir: Add support for 32 bits bulk packet length
  combined-packet: Add a workaround for Linux usbfs + live migration
  usb: Add packet combining functions
  uhci: Don't crash on device disconnect
  uhci: Add a uhci_handle_td_error() helper function
  usb/ehci-pci: add helper to create ich9 usb controllers
  usb/ehci-pci: add ich9 00:1a.* variant
  usb/ehci-pci: dynamic type generation
  uhci: add ich9 00:1a.* variants
  uhci: stick irq routing info into UHCIInfo too.
  uhci: dynamic type generation
  xilinx_zynq: add USB controllers
  usb/ehci: add sysbus variant
  usb/ehci: split into multiple source files
  usb/ehci: Guard definition of EHCI_DEBUG
  ...

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agopc: Drop redundant test for ROM memory region
Jan Kiszka [Thu, 1 Nov 2012 16:29:24 +0000 (17:29 +0100)]
pc: Drop redundant test for ROM memory region

Just a few lines above, we already initialize rom_memory accordingly.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoexec: make some functions static
Blue Swirl [Sun, 28 Oct 2012 11:04:51 +0000 (11:04 +0000)]
exec: make some functions static

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agotarget-ppc: make some functions static
Blue Swirl [Sun, 28 Oct 2012 11:04:50 +0000 (11:04 +0000)]
target-ppc: make some functions static

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Acked-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoppc: add missing static
Blue Swirl [Sun, 28 Oct 2012 11:04:49 +0000 (11:04 +0000)]
ppc: add missing static

Add missing 'static' qualifiers.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Acked-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agovnc: add missing static
Blue Swirl [Sun, 28 Oct 2012 11:04:48 +0000 (11:04 +0000)]
vnc: add missing static

Add missing 'static' qualifiers.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agovl.c: add missing static
Blue Swirl [Sun, 28 Oct 2012 11:04:47 +0000 (11:04 +0000)]
vl.c: add missing static

Add missing 'static' qualifiers.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agotarget-sparc: make do_unaligned_access static
Blue Swirl [Sun, 28 Oct 2012 11:04:46 +0000 (11:04 +0000)]
target-sparc: make do_unaligned_access static

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agom68k: Return semihosting errno values correctly
Meador Inge [Fri, 24 Feb 2012 22:18:41 +0000 (16:18 -0600)]
m68k: Return semihosting errno values correctly

Fixing a simple typo, s/errno/err/, that caused
the error status from GDB semihosted system calls
to be returned incorrectly.

Signed-off-by: Meador Inge <meadori@codesourcery.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agocadence_uart: More debug information
Peter Crosthwaite [Fri, 19 Oct 2012 09:08:04 +0000 (19:08 +1000)]
cadence_uart: More debug information

Add more helpful debug information to the cadence UART.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoMerge remote-tracking branch 'kraxel/pixman.v3' into staging
Anthony Liguori [Thu, 1 Nov 2012 16:14:39 +0000 (11:14 -0500)]
Merge remote-tracking branch 'kraxel/pixman.v3' into staging

* kraxel/pixman.v3: (22 commits)
  pixman: drop obsolete fields from DisplaySurface
  pixman/vnc: remove dead code.
  pixman/vnc: remove rgb_prepare_row* functions
  pixman/vnc: use pixman images in vnc.
  pixman: switch screendump function.
  vga: stop direct access to DisplaySurface fields.
  qxl: stop direct access to DisplaySurface fields.
  console: don't set PixelFormat alpha fields for 32bpp
  console: make qemu_alloc_display static
  pixman: add pixman image to DisplaySurface
  pixman: helper functions
  pixman: windup in configure & makefiles
  pixman: add submodule
  console: remove DisplayAllocator
  console: remove dpy_gfx_fill
  vga: fix text mode updating
  console: init displaychangelisteners on register
  console: untangle gfx & txt updates
  console: s/TextConsole/QemuConsole/
  console: move set_mouse + cursor_define callbacks
  ...

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge remote-tracking branch 'stefanha/net' into staging
Anthony Liguori [Thu, 1 Nov 2012 16:13:59 +0000 (11:13 -0500)]
Merge remote-tracking branch 'stefanha/net' into staging

* stefanha/net:
  e1000: pre-initialize RAH/RAL registers
  net: Reject non-netdevs in qmp_netdev_del()
  net: use "socket" model name for UDP sockets
  e1000: drop check_rxov, always treat RX ring with RDH == RDT as empty

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge remote-tracking branch 'bonzini/threadpool' into staging
Anthony Liguori [Thu, 1 Nov 2012 16:13:39 +0000 (11:13 -0500)]
Merge remote-tracking branch 'bonzini/threadpool' into staging

* bonzini/threadpool: (39 commits)
  raw-win32: implement native asynchronous I/O
  raw-posix: move linux-aio.c to block/
  raw-win32: add emulated AIO support
  raw-posix: rename raw-posix-aio.h, hide unavailable prototypes
  raw: merge posix-aio-compat.c into block/raw-posix.c
  block: switch posix-aio-compat to threadpool
  threadpool: do not take lock in event_notifier_ready
  aio: add generic thread-pool facility
  qemu-thread: add QemuSemaphore
  linux-aio: use event notifiers
  aio: clean up now-unused functions
  main-loop: use aio_notify for qemu_notify_event
  main-loop: use GSource to poll AIO file descriptors
  aio: call aio_notify after setting I/O handlers
  aio: add aio_notify
  aio: make AioContexts GSources
  aio: add Win32 implementation
  aio: prepare for introducing GSource-based dispatch
  aio: add non-blocking variant of aio_wait
  aio: test node->deleted before calling io_flush
  ...

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge remote-tracking branch 'qemu-kvm/uq/master' into staging
Anthony Liguori [Thu, 1 Nov 2012 16:12:50 +0000 (11:12 -0500)]
Merge remote-tracking branch 'qemu-kvm/uq/master' into staging

* qemu-kvm/uq/master: (28 commits)
  update-linux-headers.sh: Handle new kernel uapi/ directories
  target-i386: kvm_cpu_fill_host: use GET_SUPPORTED_CPUID
  target-i386: cpu: make -cpu host/check/enforce code KVM-specific
  target-i386: make cpu_x86_fill_host() void
  Emulate qemu-kvms -no-kvm option
  Issue warning when deprecated -tdf option is used
  Issue warning when deprecated drive parameter boot=on|off is used
  Use global properties to emulate -no-kvm-pit-reinjection
  Issue warning when deprecated -no-kvm-pit is used
  Use machine options to emulate -no-kvm-irqchip
  cirrus_vga: allow configurable vram size
  target-i386: Add missing kvm cpuid feature name
  i386: cpu: add missing CPUID[EAX=7,ECX=0] flag names
  i386: kvm: filter CPUID leaf 7 based on GET_SUPPORTED_CPUID, too
  i386: kvm: reformat filter_features_for_kvm() code
  i386: kvm: filter CPUID feature words earlier, on cpu.c
  i386: kvm: mask cpuid_ext4_features bits earlier
  i386: kvm: mask cpuid_kvm_features earlier
  i386: kvm: x2apic is not supported without in-kernel irqchip
  i386: kvm: set CPUID_EXT_TSC_DEADLINE_TIMER on kvm_arch_get_supported_cpuid()
  ...

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge remote-tracking branch 'afaerber/qom-cpu' into staging
Anthony Liguori [Thu, 1 Nov 2012 16:12:32 +0000 (11:12 -0500)]
Merge remote-tracking branch 'afaerber/qom-cpu' into staging

* afaerber/qom-cpu: (35 commits)
  target-i386: Pass X86CPU to kvm_handle_halt()
  target-i386: Pass X86CPU to kvm_get_mp_state()
  cpu: Move thread_id to CPUState
  cpus: Pass CPUState to run_on_cpu()
  target-i386: Pass X86CPU to cpu_x86_inject_mce()
  target-i386: Pass X86CPU to kvm_mce_inject()
  cpus: Pass CPUState to [qemu_]cpu_has_work()
  spapr: Pass PowerPCCPU to hypercalls
  spapr: Pass PowerPCCPU to spapr_hypercall()
  target-ppc: Pass PowerPCCPU to cpu_ppc_hypercall
  target-ppc: Pass PowerPCCPU to powerpc_excp()
  xtensa_pic: Pass XtensaCPU to xtensa_ccompare_cb()
  cpus: Pass CPUState to qemu_wait_io_event_common()
  cpus: Pass CPUState to flush_queued_work()
  cpu: Move queued_work_{first,last} to CPUState
  cpus: Pass CPUState to qemu_cpu_kick()
  target-ppc: Rename kvm_kick_{env => cpu} and pass PowerPCCPU
  ppc: Pass PowerPCCPU to {ppc6xx,ppc970,power7,ppc40x,ppce500}_set_irq()
  cpus: Pass CPUState to qemu_tcg_init_vcpu()
  cpus: Pass CPUState to qemu_tcg_cpu_thread_fn
  ...

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoarm_boot: Change initrd load address to "halfway through RAM"
Peter Maydell [Fri, 26 Oct 2012 15:29:38 +0000 (16:29 +0100)]
arm_boot: Change initrd load address to "halfway through RAM"

To avoid continually having to bump the initrd load address
to account for larger kernel images, put the initrd halfway
through RAM. This allows large kernels on new boards with lots
of RAM to work OK, without breaking existing usecases for
boards with only 32MB of RAM.

Note that this change fixes in passing a bug where we were
passing an overly large max_size to load_image_targphys()
for the initrd, which meant that we wouldn't correctly refuse
to load an enormous initrd that didn't actually fit into RAM.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Reviewed-by: Igor Mitsyanko <i.mitsyanko@samsung.com>
Tested-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
11 years agoMerge branch 'ppc-for-upstream' of git://repo.or.cz/qemu/agraf
Aurelien Jarno [Thu, 1 Nov 2012 15:42:49 +0000 (16:42 +0100)]
Merge branch 'ppc-for-upstream' of git://repo.or.cz/qemu/agraf

* 'ppc-for-upstream' of git://repo.or.cz/qemu/agraf:
  pseries: Cleanup duplications of ics_valid_irq() code
  pseries: Clean up inconsistent variable name in xics.c
  target-ppc: Extend FPU state for newer POWER CPUs
  target-ppc: Rework storage of VPA registration state
  Revert "PPC: pseries: Remove hack for PIO window"

11 years agoMerge branch 'arm-devs.for-upstream' of git://git.linaro.org/people/pmaydell/qemu-arm
Aurelien Jarno [Thu, 1 Nov 2012 15:42:29 +0000 (16:42 +0100)]
Merge branch 'arm-devs.for-upstream' of git://git.linaro.org/people/pmaydell/qemu-arm

* 'arm-devs.for-upstream' of git://git.linaro.org/people/pmaydell/qemu-arm: (28 commits)
  hw/sd.c: add SD card save/load support
  vmstate: Add support for saving/loading bitmaps
  hw/sd.c: Fix erase for high capacity cards
  pflash_cfi01: Fix debug mode printfery
  pflash_cfi0x: QOMified
  pflash_cfi01: remove unused total_len field
  pflash_cfi0x: remove unused base field
  hw/versatile_i2c: Use LOG_GUEST_ERROR
  hw/arm_l2x0: Use LOG_GUEST_ERROR
  hw/arm_sysctl: Use LOG_GUEST_ERROR
  hw/armv7m_nvic: Use LOG_GUEST_ERROR and LOG_UNIMP
  hw/arm_timer: Use LOG_GUEST_ERROR and LOG_UNIMP
  hw/arm_gic: Use LOG_GUEST_ERROR
  hw/arm11mpcore: Use LOG_GUEST_ERROR rather than hw_error()
  hw/pl190: Use LOG_UNIMP rather than hw_error()
  hw/pl110: Use LOG_GUEST_ERROR rather than hw_error()
  hw/pl080: Use LOG_GUEST_ERROR and LOG_UNIMP
  hw/pl061: Use LOG_GUEST_ERROR
  hw/pl050: Use LOG_GUEST_ERROR
  hw/exynos4_boards: Don't prematurely explode QEMUMachineInitArgs
  ...

11 years agousb-redir: Allow redirecting super speed devices to high speed controllers
Hans de Goede [Wed, 31 Oct 2012 12:47:16 +0000 (13:47 +0100)]
usb-redir: Allow redirecting super speed devices to high speed controllers

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agousb-redir: Allow to attach USB 2.0 devices to 1.1 host controller
Jan Kiszka [Wed, 31 Oct 2012 12:47:15 +0000 (13:47 +0100)]
usb-redir: Allow to attach USB 2.0 devices to 1.1 host controller

This follows the logic of host-linux: If a 2.0 device has no ISO
endpoint and no interrupt endpoint with a packet size > 64, we can
attach it also to an 1.1 host controller. In case the redir server does
not report endpoint sizes, play safe and remove the 1.1 compatibility as
well. Moreover, if we detect a conflicting change in the configuration
after the device was already attached, it will be disconnected
immediately.

HdG: Several small cleanups and fixes

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agousb-redir: Use reject rather the disconnect on bad ep info
Hans de Goede [Wed, 31 Oct 2012 12:47:14 +0000 (13:47 +0100)]
usb-redir: Use reject rather the disconnect on bad ep info

So that the client gets a notification about us disconnecting the device.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agousb-redir: Add an usbredir_setup_usb_eps() helper function
Hans de Goede [Wed, 31 Oct 2012 12:47:13 +0000 (13:47 +0100)]
usb-redir: Add an usbredir_setup_usb_eps() helper function

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agousb-redir: Add support for input pipelining
Hans de Goede [Wed, 31 Oct 2012 12:47:12 +0000 (13:47 +0100)]
usb-redir: Add support for input pipelining

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agousb-redir: Add support for 32 bits bulk packet length
Hans de Goede [Wed, 31 Oct 2012 12:47:11 +0000 (13:47 +0100)]
usb-redir: Add support for 32 bits bulk packet length

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agocombined-packet: Add a workaround for Linux usbfs + live migration
Hans de Goede [Wed, 31 Oct 2012 12:47:10 +0000 (13:47 +0100)]
combined-packet: Add a workaround for Linux usbfs + live migration

Older versions (anything but the latest) of Linux usbfs + libusb(x),
will submit larger (bulk) transfers split into multiple 16k submissions,
which means that rather then all tds getting linked into the queue in
one atomic operarion they get linked in a bunch at a time, which could
cause problems if:
1) We scan the queue while libusb is in the middle of submitting a split
   bulk transfer
2) While this bulk transfer is pending we migrate to another host.

The problem is that after 2, the new host will rescan the queue and
combine the packets in one large transfer, where as 1) has caused the
original host to see them as 2 transfers. This patch fixes this by stopping
combinging if we detect a 16k transfer with its int_req flag set.

This should not adversely effect performance for other cases as:
1) Linux never sets the interrupt flag on packets other then the last
2) Windows does set the in_req flag on each td, but will submit large
transfers in 20k tds thus never triggering the check

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agousb: Add packet combining functions
Hans de Goede [Wed, 31 Oct 2012 12:47:09 +0000 (13:47 +0100)]
usb: Add packet combining functions

Currently we only do pipelining for output endpoints, since to properly
support short-not-ok semantics we can only have one outstanding input
packet. Since the ehci and uhci controllers have a limited per td packet
size guests will split large input transfers to into multiple packets,
and since we don't pipeline these, this comes with a serious performance
penalty.

This patch adds helper functions to (re-)combine packets which belong to 1
transfer at the guest device-driver level into 1 large transger. This can be
used by (redirection) usb-devices to enable pipelining for input endpoints.

This patch will combine packets together until a transfer terminating packet
is encountered. A terminating packet is a packet which meets one or more of
the following conditions:
1) The packet size is *not* a multiple of the endpoint max packet size
2) The packet does *not* have its short-not-ok flag set
3) The packet has its interrupt-on-complete flag set

The short-not-ok flag of the combined packet is that of the terminating packet.
Multiple combined packets may be submitted to the device, if the combined
packets do not have their short-not-ok flag set, enabling true pipelining.

If a combined packet does have its short-not-ok flag set the queue will
wait with submitting further packets to the device until that packet has
completed.

Once enabled in the usb-redir and ehci code, this improves the speed (MB/s)
of a Linux guest reading from a USB mass storage device by a factor of
1.2 - 1.5.

And the main reason why I started working on this, when reading from a pl2303
USB<->serial converter, it combines the previous 4 packets submitted per
device-driver level read into 1 big read, reducing the number of packets / sec
by a factor 4, and it allows to have multiple reads outstanding. This allows
for much better latency tolerance without the pl2303's internal buffer
overflowing (which was happening at 115200 bps, without serial flow control).

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agouhci: Don't crash on device disconnect
Hans de Goede [Wed, 31 Oct 2012 11:54:37 +0000 (12:54 +0100)]
uhci: Don't crash on device disconnect

My recent uhci cleanup series has introduced a regression, where
qemu sometimes crashes on a device disconnect. The problem is that
the uhci code never checked for a device not / no longer existing, instead
it was relying on usb_handle_packet accepting a NULL device.

But since we now pass usb_handle_packet q->ep->dev, rather then just
a local dev variable, we crash as q->ep == NULL due to the device no longer
existing.

This patch fixes this. Note that this patch also improves over
the old behavior were we would:
1) create a queue for the device
2) create an async for the packet
3) have usb_handle_packet fail
4) destroy the async
5) wait for the queue to be idle for 32 frames
6) destroy the queue

Which was rather sub-optimal.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agouhci: Add a uhci_handle_td_error() helper function
Hans de Goede [Wed, 31 Oct 2012 11:54:36 +0000 (12:54 +0100)]
uhci: Add a uhci_handle_td_error() helper function

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agousb/ehci-pci: add helper to create ich9 usb controllers
Gerd Hoffmann [Tue, 30 Oct 2012 12:18:36 +0000 (13:18 +0100)]
usb/ehci-pci: add helper to create ich9 usb controllers

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agousb/ehci-pci: add ich9 00:1a.* variant
Gerd Hoffmann [Tue, 30 Oct 2012 12:17:46 +0000 (13:17 +0100)]
usb/ehci-pci: add ich9 00:1a.* variant

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agousb/ehci-pci: dynamic type generation
Gerd Hoffmann [Tue, 30 Oct 2012 11:53:17 +0000 (12:53 +0100)]
usb/ehci-pci: dynamic type generation

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agouhci: add ich9 00:1a.* variants
Gerd Hoffmann [Tue, 30 Oct 2012 08:57:28 +0000 (09:57 +0100)]
uhci: add ich9 00:1a.* variants

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agouhci: stick irq routing info into UHCIInfo too.
Gerd Hoffmann [Fri, 26 Oct 2012 12:56:19 +0000 (14:56 +0200)]
uhci: stick irq routing info into UHCIInfo too.

Kills the ugly "switch (device_id) { ... }" struct and makes it easier
to figure what the differences between the uhci variants are.

Need our own DeviceClass struct for that so we can allocate some space
to store UHCIInfo.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agouhci: dynamic type generation
Gerd Hoffmann [Thu, 25 Oct 2012 14:22:57 +0000 (16:22 +0200)]
uhci: dynamic type generation

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoxilinx_zynq: add USB controllers
Peter Crosthwaite [Mon, 29 Oct 2012 01:34:38 +0000 (11:34 +1000)]
xilinx_zynq: add USB controllers

Add the two usb controllers in Zynq.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agopixman: drop obsolete fields from DisplaySurface
Gerd Hoffmann [Wed, 10 Oct 2012 09:15:52 +0000 (11:15 +0200)]
pixman: drop obsolete fields from DisplaySurface

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agopixman/vnc: remove dead code.
Gerd Hoffmann [Thu, 11 Oct 2012 10:11:27 +0000 (12:11 +0200)]
pixman/vnc: remove dead code.

Switching the vnc server framebuffer to use 32bpp unconditionally
turns the code bits which handle 8 and 16 bpp into dead code.
Remove them.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agopixman/vnc: remove rgb_prepare_row* functions
Gerd Hoffmann [Thu, 11 Oct 2012 10:04:33 +0000 (12:04 +0200)]
pixman/vnc: remove rgb_prepare_row* functions

Let pixman do it instead.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agopixman/vnc: use pixman images in vnc.
Gerd Hoffmann [Wed, 10 Oct 2012 11:29:43 +0000 (13:29 +0200)]
pixman/vnc: use pixman images in vnc.

The vnc code uses *three* DisplaySurfaces:

First is the surface of the actual QemuConsole, usually the guest
screen, but could also be a text console (monitor/serial reachable via
Ctrl-Alt-<nr> keys).  This is left as-is.

Second is the current server's view of the screen content.  The vnc code
uses this to figure which parts of the guest screen did _really_ change
to reduce the amount of updates sent to the vnc clients.  It is also
used as data source when sending out the updates to the clients.  This
surface gets replaced by a pixman image.  The format changes too,
instead of using the guest screen format we'll use fixed 32bit rgb
framebuffer and convert the pixels on the fly when comparing and
updating the server framebuffer.

Third surface carries the format expected by the vnc client.  That isn't
used to store image data.  This surface is switched to PixelFormat and a
boolean for bigendian byte order.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agopixman: switch screendump function.
Gerd Hoffmann [Wed, 10 Oct 2012 11:12:58 +0000 (13:12 +0200)]
pixman: switch screendump function.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agovga: stop direct access to DisplaySurface fields.
Gerd Hoffmann [Wed, 10 Oct 2012 11:05:05 +0000 (13:05 +0200)]
vga: stop direct access to DisplaySurface fields.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoqxl: stop direct access to DisplaySurface fields.
Gerd Hoffmann [Wed, 10 Oct 2012 11:02:14 +0000 (13:02 +0200)]
qxl: stop direct access to DisplaySurface fields.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoconsole: don't set PixelFormat alpha fields for 32bpp
Gerd Hoffmann [Wed, 10 Oct 2012 09:16:26 +0000 (11:16 +0200)]
console: don't set PixelFormat alpha fields for 32bpp

Currently it is inconstent, PixelFormat->amask is left unset whereas
abits and amax and ashift are filled.  As an alpha channel doesn't make
sense for the vga framebuffer leave all alpha fields clear.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>