]> git.proxmox.com Git - qemu.git/log
qemu.git
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 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>
11 years agoconsole: make qemu_alloc_display static
Gerd Hoffmann [Thu, 27 Sep 2012 09:06:36 +0000 (11:06 +0200)]
console: make qemu_alloc_display static

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agopixman: add pixman image to DisplaySurface
Gerd Hoffmann [Wed, 26 Sep 2012 13:20:05 +0000 (15:20 +0200)]
pixman: add pixman image to DisplaySurface

Surfaces are now allocated using pixman.  DisplaySurface gets new
struct fields with pixman image and data.  DisplayChangeListeners
can easily start using pixman now.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agopixman: helper functions
Gerd Hoffmann [Tue, 25 Sep 2012 14:23:24 +0000 (16:23 +0200)]
pixman: helper functions

Add some helper functions which will be put
into use by following patches.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agopixman: windup in configure & makefiles
Gerd Hoffmann [Tue, 25 Sep 2012 14:04:58 +0000 (16:04 +0200)]
pixman: windup in configure & makefiles

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agousb/ehci: add sysbus variant
Gerd Hoffmann [Tue, 30 Oct 2012 14:08:37 +0000 (15:08 +0100)]
usb/ehci: add sysbus variant

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agousb/ehci: split into multiple source files
Gerd Hoffmann [Tue, 30 Oct 2012 11:20:06 +0000 (12:20 +0100)]
usb/ehci: split into multiple source files

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agousb/ehci: Guard definition of EHCI_DEBUG
Peter Crosthwaite [Mon, 29 Oct 2012 01:34:39 +0000 (11:34 +1000)]
usb/ehci: Guard definition of EHCI_DEBUG

Guard against re-definition of EHCI_DEBUG. Allows for turning on of debug info
from configure (using --qemu-extra-cflags="-DEHCI_DEBUG=1") rather than source
code hacking.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agousb/ehci: seperate out PCIisms
Peter Crosthwaite [Mon, 29 Oct 2012 01:34:36 +0000 (11:34 +1000)]
usb/ehci: seperate out PCIisms

Seperate the PCI stuff from the EHCI components. Extracted the PCIDevice
out into a new wrapper struct to make EHCIState non-PCI-specific. Seperated
tho non PCI init component out into a seperate "common" init function.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agousb/ehci: Abstract away PCI DMA API
Peter Crosthwaite [Mon, 29 Oct 2012 01:34:35 +0000 (11:34 +1000)]
usb/ehci: Abstract away PCI DMA API

Pull the DMAContext for the PCI DMA out at device init time and put it into
the device state. Use dma_memory_read/write() instead of pci specific versions.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agousb/ehci: parameterise the register region offsets
Peter Crosthwaite [Mon, 29 Oct 2012 01:34:34 +0000 (11:34 +1000)]
usb/ehci: parameterise the register region offsets

The capabilities register and operational register offsets can vary from one
EHCI implementation to the next. Parameterise accordingly.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoxhci: allow address slot being called multiple times
Gerd Hoffmann [Fri, 26 Oct 2012 11:09:56 +0000 (13:09 +0200)]
xhci: allow address slot being called multiple times

win8 guests do that for some reason ...

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoxhci: add port trace points
Gerd Hoffmann [Fri, 26 Oct 2012 09:49:06 +0000 (11:49 +0200)]
xhci: add port trace points

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoxhci: set pls in xhci_port_update & xhci_port_reset
Gerd Hoffmann [Fri, 26 Oct 2012 08:30:53 +0000 (10:30 +0200)]
xhci: set pls in xhci_port_update & xhci_port_reset

Set the port link state to the correct values in xhci_port_update and
xhci_port_reset functions.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoxhci: add xhci_port_reset
Gerd Hoffmann [Fri, 26 Oct 2012 08:22:37 +0000 (10:22 +0200)]
xhci: add xhci_port_reset

Move port reset logic to its own function.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoxhci: add xhci_port_notify
Gerd Hoffmann [Fri, 26 Oct 2012 08:19:02 +0000 (10:19 +0200)]
xhci: add xhci_port_notify

Create a function to notify the guest about port
status changes and put it into use.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoxhci: add xhci_port_have_device
Gerd Hoffmann [Fri, 26 Oct 2012 08:15:47 +0000 (10:15 +0200)]
xhci: add xhci_port_have_device

Factor out the code which checks whenever a usb device is attached
to the port in question.  No functional change.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoxhci: s/xhci_update_port/xhci_port_update/
Gerd Hoffmann [Fri, 26 Oct 2012 08:13:13 +0000 (10:13 +0200)]
xhci: s/xhci_update_port/xhci_port_update/

Rename the function for xhci_port_* naming scheme, also drop
the xhci parameter as port carries a pointer to xhci anyway.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoxhci: add {get,set}_field macros & enum for pls
Gerd Hoffmann [Fri, 26 Oct 2012 08:10:54 +0000 (10:10 +0200)]
xhci: add {get,set}_field macros & enum for pls

Add {get,set}_field macros (simliar to ehci) to read and update
some bits of a word.  Put them into use for updating pls (port
link state) values.  Also add a enum for pls values.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agopixman: add submodule
Gerd Hoffmann [Thu, 27 Sep 2012 07:52:35 +0000 (09:52 +0200)]
pixman: add submodule

Add pixman submodule as fallback for old distros.
Picking version 0.18.4.  This is shipped by rhel6
and also the minimum version needed by spice so this
should serve well as baseline.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoconsole: remove DisplayAllocator
Gerd Hoffmann [Wed, 26 Sep 2012 05:46:20 +0000 (07:46 +0200)]
console: remove DisplayAllocator

Causes [temporary] preformance regression with 24bpp vga modes @ sdl.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoconsole: remove dpy_gfx_fill
Gerd Hoffmann [Fri, 28 Sep 2012 13:31:33 +0000 (15:31 +0200)]
console: remove dpy_gfx_fill

Unused code.  'nuff said.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agovga: fix text mode updating
Gerd Hoffmann [Tue, 9 Oct 2012 15:10:13 +0000 (17:10 +0200)]
vga: fix text mode updating

With both text (curses) and graphics (vnc/sdl/spice/...) display active
vga text mode emulation fails to update both correctly.  Depending on
whenever vga_update_text() or vga_draw_text() happens to be called first
only the text display or only the graphics display will see display
resolution changes and full redraws.

Fix it by calling both text/gfx resize functions in both code paths and
keep track of full screen redraws needed in VGACommonState fields.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoconsole: init displaychangelisteners on register
Gerd Hoffmann [Fri, 28 Sep 2012 13:30:07 +0000 (15:30 +0200)]
console: init displaychangelisteners on register

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoconsole: untangle gfx & txt updates
Gerd Hoffmann [Fri, 28 Sep 2012 13:02:08 +0000 (15:02 +0200)]
console: untangle gfx & txt updates

Stop abusing displaysurface fields for text mode displays.
(bpp = 0, width = cols, height = lines).

Add flags to displaystate indicating whenever text mode display
(curses) or gfx mode displays (sdl, vnc, ...) are present.

Add separate displaychangelistener callbacks for text / gfx mode
resize & updates.

This allows to enable gfx and txt diplays at the same time and also
paves the way for more cleanups in the future.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoconsole: s/TextConsole/QemuConsole/
Gerd Hoffmann [Fri, 28 Sep 2012 11:24:17 +0000 (13:24 +0200)]
console: s/TextConsole/QemuConsole/

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoconsole: move set_mouse + cursor_define callbacks
Gerd Hoffmann [Wed, 12 Sep 2012 05:56:45 +0000 (07:56 +0200)]
console: move set_mouse + cursor_define callbacks

When adding DisplayChangeListeners the set_mouse and cursor_define
callbacks have been left in DisplayState for some reason.  Fix it.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoconsole: add unregister_displaychangelistener
Gerd Hoffmann [Fri, 4 Jun 2010 09:51:31 +0000 (11:51 +0200)]
console: add unregister_displaychangelistener

Also change the way the gui_timer is initialized: each time a
displaychangelistener is registered or unregistered we'll check
whether we need a timer (due to dpy_refresh callback being present)
and if so setup a timer, otherwise zap it.  This way the gui timer
works correctly with displaychangelisteners coming and going.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoconsole: QLIST-ify display change listeners.
Gerd Hoffmann [Fri, 4 Jun 2010 09:46:35 +0000 (11:46 +0200)]
console: QLIST-ify display change listeners.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agopseries: Cleanup duplications of ics_valid_irq() code
David Gibson [Mon, 29 Oct 2012 17:25:02 +0000 (17:25 +0000)]
pseries: Cleanup duplications of ics_valid_irq() code

A couple of places in xics.c open-coded the same logic as is already
implemented in ics_valid_irq().  This patch fixes the code duplication.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agopseries: Clean up inconsistent variable name in xics.c
David Gibson [Mon, 29 Oct 2012 17:25:00 +0000 (17:25 +0000)]
pseries: Clean up inconsistent variable name in xics.c

Throughout xics.c 'nr' is used to refer to a global interrupt number, and
'server' is used to refer to an interrupt server number (i.e. CPU number).
Except in icp_set_mfrr(), where 'nr' is used as a server number.  Fix this
confusing inconsistency.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agotarget-ppc: Extend FPU state for newer POWER CPUs
David Gibson [Mon, 29 Oct 2012 17:24:59 +0000 (17:24 +0000)]
target-ppc: Extend FPU state for newer POWER CPUs

This patch adds some extra FPU state to CPUPPCState.  Specifically,
fpscr is extended to a target_ulong bits, since some recent (64 bit)
CPUs now have more status bits than fit inside 32 bits.  Also, we add
the 32 VSR registers present on CPUs with VSX (these extend the
standard FP regs, which together with the Altivec/VMX registers form a
64 x 128bit register file for VSX).

We don't actually support the instructions using these extra registers
in TCG yet, but we still need a place to store the state so we can
sync it with KVM and savevm/loadvm it.  This patch updates the savevm
code to not fail on the extended state, but also does not actually
save it - that's a project for another patch.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agotarget-ppc: Rework storage of VPA registration state
David Gibson [Mon, 29 Oct 2012 17:24:58 +0000 (17:24 +0000)]
target-ppc: Rework storage of VPA registration state

We change the storage of the VPA information to explicitly use fixed
size integer types which will make life easier for syncing this data with
KVM, which we will need in future.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
[agraf: fix commit message]
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agoRevert "PPC: pseries: Remove hack for PIO window"
David Gibson [Mon, 29 Oct 2012 17:24:57 +0000 (17:24 +0000)]
Revert "PPC: pseries: Remove hack for PIO window"

This reverts commit a178274efabcbbc5d44805b51def874e47051325.

Contrary to that commit's message, the users of old_portio are not all
gone.  In particular VGA still uses it via portio_list_add().

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agoe1000: pre-initialize RAH/RAL registers
Gabriel L. Somlo [Wed, 31 Oct 2012 18:15:39 +0000 (14:15 -0400)]
e1000: pre-initialize RAH/RAL registers

Some guest operating systems' drivers (Mac OS X in particular) fail to
properly initialize the Receive Address registers (probably expecting
them to be pre-initialized by an earlier component, such as a specific
proprietary BIOS). This patch pre-initializes the RA registers, allowing
OS X networking to function properly. Other guest operating systems are
not affected, and free to (re)initialize these registers during boot.

[According to the datasheet the Address Valid bits in the RA registers
are cleared on PCI or software reset.  This patch adds the NIC's MAC
address and sets Address Valid on reset.  So we diverge from real
hardware behavior here. -- Stefan]

Signed-off-by: Gabriel Somlo <somlo@cmu.edu>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agonet: Reject non-netdevs in qmp_netdev_del()
Stefan Hajnoczi [Wed, 24 Oct 2012 12:34:12 +0000 (14:34 +0200)]
net: Reject non-netdevs in qmp_netdev_del()

The netdev_del command crashes when given a -net device, because it
calls qemu_opts_del(NULL).

Check that this is a -netdev before attempting to delete it and the
QemuOpts.

Note the subtle change from qemu_find_opts_err("netdev", errp) to
qemu_find_opts_err("netdev", NULL).  Since "netdev" is a built in
options group and we don't check for NULL return anyway, there's no use
in passing errp here.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agonet: use "socket" model name for UDP sockets
Lei Li [Thu, 1 Nov 2012 09:39:55 +0000 (17:39 +0800)]
net: use "socket" model name for UDP sockets

Fix the problem that can not delete the udp socket.
It's caused by passing "udp" model to net_socket_udp_init,
but we do not have "udp" model in our model list.
Pass the right model "socket" to init function.

https://bugs.launchpad.net/qemu/+bug/1073585?comments=all

Signed-off-by: Lei Li <lilei@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoe1000: drop check_rxov, always treat RX ring with RDH == RDT as empty
Dmitry Fleytman [Fri, 19 Oct 2012 05:56:55 +0000 (07:56 +0200)]
e1000: drop check_rxov, always treat RX ring with RDH == RDT as empty

Real HW always treats RX ring with RDH == RDT as empty.
Emulation is supposed to behave the same.

Reported-by: Chris Webb <chris.webb@elastichosts.com>
Reported-by: Richard Davies <richard.davies@elastichosts.com>
Signed-off-by: Dmitry Fleytman <dmitry@daynix.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agotarget-mips: don't flush extra TLB on permissions upgrade
Aurelien Jarno [Tue, 9 Oct 2012 19:53:21 +0000 (21:53 +0200)]
target-mips: don't flush extra TLB on permissions upgrade

If the guest uses a TLBWI instruction for upgrading permissions, we
don't need to flush the extra TLBs. This improve boot time performance
by about 10%.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
11 years agotarget-mips: fix TLBR wrt SEGMask
Aurelien Jarno [Tue, 9 Oct 2012 19:53:21 +0000 (21:53 +0200)]
target-mips: fix TLBR wrt SEGMask

Like r4k_map_address(), r4k_helper_tlbp() should use SEGMask to mask the
address.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
11 years agotarget-mips: use deposit instead of hardcoded version
Aurelien Jarno [Tue, 9 Oct 2012 19:53:21 +0000 (21:53 +0200)]
target-mips: use deposit instead of hardcoded version

Use the deposit op instead of and hardcoded bit field insertion. It
allows the host to emit the corresponding instruction if available.

At the same time remove the (lsb > msb) test. The MIPS64R2 instruction
set manual says "Because of the instruction format, lsb can never be
greater than msb, so there is no UNPREDICATABLE case for this
instruction."

(Bug reported as LP:1071149.)
Cc: Никита Канунников <n.kanunnikov@sbtcom.ru>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
11 years agotarget-mips: optimize ddiv/ddivu/div/divu with movcond
Aurelien Jarno [Tue, 9 Oct 2012 19:53:21 +0000 (21:53 +0200)]
target-mips: optimize ddiv/ddivu/div/divu with movcond

The result of a division by 0, or a division of INT_MIN by -1 in the
signed case, is unpredictable. Just replace 0 by 1 in that case so that
it doesn't trigger a floating point exception on the host.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
11 years agotarget-mips: implement movn/movz using movcond
Aurelien Jarno [Tue, 9 Oct 2012 19:53:21 +0000 (21:53 +0200)]
target-mips: implement movn/movz using movcond

Avoid the branches in movn/movz implementation and replace them with
movcond. Also update a wrong command.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
11 years agotarget-mips: don't use local temps for store conditional
Aurelien Jarno [Tue, 9 Oct 2012 19:53:21 +0000 (21:53 +0200)]
target-mips: don't use local temps for store conditional

Store conditional operations only need local temps in user mode. Fix
the code to use temp local only in user mode, this spares two memory
stores in system mode.

At the same time remove a wrong a wrong copied & pasted comment,
store operations don't have a register destination.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
11 years agotarget-mips: implement unaligned loads using TCG
Aurelien Jarno [Tue, 9 Oct 2012 19:53:21 +0000 (21:53 +0200)]
target-mips: implement unaligned loads using TCG

Load/store from helpers should be avoided as they are quite
inefficient. Rewrite unaligned loads instructions using TCG and
aligned loads. The number of actual loads operations to implement
an unaligned load instruction is reduced from up to 8 to 1.

Note: As we can't rely on shift by 32 or 64 undefined behaviour,
the code loads already shift by one constants.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
11 years agotarget-mips: simplify load/store microMIPS helpers
Aurelien Jarno [Tue, 9 Oct 2012 19:53:20 +0000 (21:53 +0200)]
target-mips: simplify load/store microMIPS helpers

load/store microMIPS helpers are reinventing the wheel. Call do_lw,
do_ll, do_sw and do_sl instead of using a macro calling the cpu_*
load/store functions.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
11 years agotarget-mips: optimize load operations
Aurelien Jarno [Tue, 9 Oct 2012 19:53:20 +0000 (21:53 +0200)]
target-mips: optimize load operations

Only allocate t1 when needed.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
11 years agotarget-mips: cleanup load/store operations
Aurelien Jarno [Tue, 9 Oct 2012 19:53:20 +0000 (21:53 +0200)]
target-mips: cleanup load/store operations

Load/store operations use macros for historical reasons. Now that there
is no point in keeping them, replace them by direct calls to qemu_ld/st.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
11 years agotarget-mips: restore CPU state after an FPU exception
Aurelien Jarno [Sun, 28 Oct 2012 18:34:03 +0000 (19:34 +0100)]
target-mips: restore CPU state after an FPU exception

Rework *raise_exception*() functions so that they can be called from
other helpers, passing the return address as an argument.

Use do_raise_exception() function in update_fcr31() to correctly restore
the CPU state after an FPU exception.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
11 years agotarget-mips: use softfloat constants when possible
Aurelien Jarno [Tue, 23 Oct 2012 08:12:00 +0000 (10:12 +0200)]
target-mips: use softfloat constants when possible

softfloat already has a few constants defined, use them instead of
redefining them in target-mips.

Rename FLOAT_SNAN32 and FLOAT_SNAN64 to FP_TO_INT32_OVERFLOW and
FP_TO_INT64_OVERFLOW as even if they have the same value, they are
technically different (and defined differently in the MIPS ISA).

Remove the unused constants.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>