]> git.proxmox.com Git - qemu.git/log
qemu.git
11 years agousb: add usb attached scsi emulation
Gerd Hoffmann [Fri, 8 Jun 2012 14:03:37 +0000 (16:03 +0200)]
usb: add usb attached scsi emulation

$subject says all.  First cut.

It's a pure UAS (usb attached scsi) emulation, without BOT (bulk-only
transport) compatibility.  If your guest can't handle it use usb-storage
instead.

The emulation works like any other scsi hba emulation (eps, lsi, virtio,
megasas, ...).  It provides just the HBA where you can attach scsi
devices as you like using '-device'.  A single scsi target with up to
256 luns is supported.

For now only usb 2.0 transport is supported.  This will change in the
future though as I plan to use this as playground when codeing up &
testing usb 3.0 transport and streams support in the qemu usb core and
the xhci emulation.

No migration support yet.  I'm planning to add usb 3.0 support first as
this probably requires saving additional state.

Special thanks go to Paolo for bringing the qemu scsi emulation into
shape, so this can be added nicely without having to touch a single line
of scsi code.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoscsi: add free_request callback
Paolo Bonzini [Mon, 9 Jul 2012 10:06:28 +0000 (12:06 +0200)]
scsi: add free_request callback

Most device models have a simple lifecycle for the hba_private field
and they can free it when a request is completed or cancelled.
However, in some cases it may be simpler to tie the lifetime
of hba_private to that of the included SCSIRequest.  This patch
adds a free_request callback to SCSIBusInfo that lets an HBA
device model do exactly that.

Normally, device models use req->hba_private == NULL to flag requests
that have been completed already.  Device models that use free_request
will still need to track this using a flag.  This is the reason why
"converting" existing HBAs to use free_request adds complexity and
makes little sense.  It is simply an additional convenience that is
provided by the SCSI layer.  USB-attached storage will be the first
user.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agomegasas: disable due to build breakage
Anthony Liguori [Mon, 9 Jul 2012 23:16:16 +0000 (18:16 -0500)]
megasas: disable due to build breakage

The Buildbot has detected a new failure on builder default_i386_rhel61 while
building qemu.

Full details are available at:
 http://buildbot.b1-systems.de/qemu/builders/default_i386_rhel61/builds/304

The proper fix is non-trivial so let's disable the build by default until it's
fixed properly.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge remote-tracking branch 'mjt/mjt-iov2' into staging
Anthony Liguori [Mon, 9 Jul 2012 17:35:06 +0000 (12:35 -0500)]
Merge remote-tracking branch 'mjt/mjt-iov2' into staging

* mjt/mjt-iov2:
  rewrite iov_send_recv() and move it to iov.c
  cleanup qemu_co_sendv(), qemu_co_recvv() and friends
  export iov_send_recv() and use it in iov_send() and iov_recv()
  rename qemu_sendv to iov_send, change proto and move declarations to iov.h
  change qemu_iovec_to_buf() to match other to,from_buf functions
  consolidate qemu_iovec_copy() and qemu_iovec_concat() and make them consistent
  allow qemu_iovec_from_buffer() to specify offset from which to start copying
  consolidate qemu_iovec_memset{,_skip}() into single function and use existing iov_memset()
  rewrite iov_* functions
  change iov_* function prototypes to be more appropriate
  virtio-serial-bus: use correct lengths in control_out() message

Conflicts:
tests/Makefile

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge remote-tracking branch 'quintela/migration-anthony-v2' into staging
Anthony Liguori [Mon, 9 Jul 2012 16:57:34 +0000 (11:57 -0500)]
Merge remote-tracking branch 'quintela/migration-anthony-v2' into staging

* quintela/migration-anthony-v2:
  Maintain the number of dirty pages
  dirty bitmap: abstract its use
  Exit loop if we have been there too long
  Only calculate expected_time for stage 2
  Only TCG needs TLB handling
  No need to iterate if we already are over the limit
  Add tracepoints for savevm section start/end
  Add spent time for migration
  Add migration_end function
  Add debugging infrastructure
  Add save_block_hdr function
  Add MigrationParams structure
  Add missing check for host_from_stream_offset return value for RAM_SAVE_FLAG_PAGE

11 years agoMerge remote-tracking branch 'kiszka/queues/slirp' into staging
Anthony Liguori [Mon, 9 Jul 2012 16:56:43 +0000 (11:56 -0500)]
Merge remote-tracking branch 'kiszka/queues/slirp' into staging

* kiszka/queues/slirp:
  slirp: Improve error reporting of inaccessible smb directories
  slirp: Ensure smbd and shared directory exist when enable smb
  slirp: add 'cmd:' target for guestfwd
  slirp: Enforce host-side user of smb share

11 years agoslirp: Improve error reporting of inaccessible smb directories
Jan Kiszka [Fri, 6 Jul 2012 06:40:48 +0000 (08:40 +0200)]
slirp: Improve error reporting of inaccessible smb directories

Instead of guessing, print the error code returned by access.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
11 years agoslirp: Ensure smbd and shared directory exist when enable smb
Dunrong Huang [Fri, 6 Jul 2012 06:04:43 +0000 (14:04 +0800)]
slirp: Ensure smbd and shared directory exist when enable smb

Users may pass the following parameters to qemu:
    $ qemu-kvm -net nic -net user,smb= ...
    $ qemu-kvm -net nic -net user,smb ...
    $ qemu-kvm -net nic -net user,smb=bad_directory ...

In these cases, qemu started successfully while samba server
failed to start. Users will confuse since samba server
failed silently without any indication of what it did wrong.

To avoid it, we check whether the shared directory exist and
if users have permission to access this directory when QEMU's
"built-in" SMB server is enabled.

Signed-off-by: Dunrong Huang <riegamaths@gmail.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
11 years agoslirp: add 'cmd:' target for guestfwd
Alexander Graf [Sun, 3 Jun 2012 07:45:01 +0000 (09:45 +0200)]
slirp: add 'cmd:' target for guestfwd

When using guestfwd=, Qemu only connects the virtual server's TCP port
to a single chardev. This is useless in most cases, as we usually want
to have more than a single connection from the guest to the outside world.

This patch adds a new cmd: target to guestfwd= that allows for execution
of a command on every TCP connection. This leverages the same code as
the -smb parameter, just that here the command is user defined.

Reported-by: Sascha Wilde <wilde@intevation.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
11 years agoslirp: Enforce host-side user of smb share
Jan Kiszka [Thu, 5 Jul 2012 17:35:57 +0000 (19:35 +0200)]
slirp: Enforce host-side user of smb share

Windows 7 (and possibly other versions) cannot connect to the samba
share if the exported host directory is not world-readable. This can be
resolved by forcing the username used for access checks to the one
under which QEMU and smbd are running.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
11 years agoMerge remote-tracking branch 'kwolf/for-anthony' into staging
Anthony Liguori [Mon, 9 Jul 2012 15:29:40 +0000 (10:29 -0500)]
Merge remote-tracking branch 'kwolf/for-anthony' into staging

* kwolf/for-anthony: (24 commits)
  block: Factor bdrv_read_unthrottled() out of guess_disk_lchs()
  qtest: Tidy up temporary files properly
  fdc: Drop broken code for user-defined floppy geometry
  fdc_test: introduce test_sense_interrupt
  fdc_test: update media_change test
  fdc: fix interrupt handling
  fdc: rewrite seek and DSKCHG bit handling
  block: introduce bdrv_swap, implement bdrv_append on top of it
  block: copy over job and dirty bitmap fields in bdrv_append
  raw: hook into blkdebug
  blkdebug: optionally tie errors to a specific sector
  blkdebug: store list of active rules
  blkdebug: pass getlength to underlying file
  blkdebug: tiny cleanup
  blkdebug: remove sync i/o events
  sheepdog: traverse pending_list from the first for each time
  sheepdog: split outstanding list into inflight and pending
  sheepdog: make sure we don't free aiocb before sending all requests
  sheepdog: use coroutine based socket functions in coroutine context
  sheepdog: restart I/O when socket becomes ready in do_co_req()
  ...

11 years agoblock: Factor bdrv_read_unthrottled() out of guess_disk_lchs()
Markus Armbruster [Fri, 29 Jun 2012 15:34:29 +0000 (17:34 +0200)]
block: Factor bdrv_read_unthrottled() out of guess_disk_lchs()

To prepare move of guess_disk_lchs() into hw/, where it poking
BlockDriverState member io_limits_enabled directly would be unclean.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqtest: Tidy up temporary files properly
Markus Armbruster [Fri, 29 Jun 2012 15:34:27 +0000 (17:34 +0200)]
qtest: Tidy up temporary files properly

Each test litters /tmp with several files: a pid file and two
sockets.  Tidy up.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoMerge remote-tracking branch 'kraxel/usb.55' into staging
Anthony Liguori [Mon, 9 Jul 2012 14:51:33 +0000 (09:51 -0500)]
Merge remote-tracking branch 'kraxel/usb.55' into staging

* kraxel/usb.55:
  usb-host: add trace events for iso xfers
  usb: fix interface initialization
  usb: split endpoint init and reset
  usb-redir: Correctly handle the usb_redir_babble usbredir status
  ehci: Kick async schedule on wakeup in the non companion case
  usb-ehci: Fix an assert whenever isoc transfers are used
  ehci: don't flush cache on doorbell rings.
  ehci: fix td writeback
  ehci: fix ehci_qh_do_overlay

11 years agoMerge remote-tracking branch 'bonzini/scsi-next' into staging
Anthony Liguori [Mon, 9 Jul 2012 14:51:19 +0000 (09:51 -0500)]
Merge remote-tracking branch 'bonzini/scsi-next' into staging

* bonzini/scsi-next:
  scsi: Fix transfer length for READ POSITION commands.
  scsi: Add basic support for SCSI media changer commands.
  scsi: Ensure command and transfer lengths are set for all SCSI devices
  scsi: Fix LOAD_UNLOAD
  scsi: Fix data length == SCSI_SENSE_BUF_SIZE
  virtio-scsi: do not crash on adding buffers to the event queue
  megasas: LSI Megaraid SAS HBA emulation
  megasas: Add header file
  ISCSI: force use of sg for SMC and SSC devices
  ISCSI: Add SCSI passthrough via scsi-generic to libiscsi
  scsi-disk: implement READ DISC INFORMATION
  atapi: implement READ DISC INFORMATION
  scsi: add a qdev property for the disk's WWN
  scsi: simplify handling of the VPD page length field

11 years agoMerge remote-tracking branch 'stefanha/trivial-patches' into staging
Anthony Liguori [Mon, 9 Jul 2012 14:51:06 +0000 (09:51 -0500)]
Merge remote-tracking branch 'stefanha/trivial-patches' into staging

* stefanha/trivial-patches:
  configure: Remove help for --disable-vnc-thread, --enable-vnc-thread
  cpu-common.h: Remove a pointless ifndef CONFIG_USER_ONLY
  cpu-common.h: Remove unnecessary guard on including targphys.h

11 years agofdc: Drop broken code for user-defined floppy geometry
Markus Armbruster [Fri, 29 Jun 2012 15:34:23 +0000 (17:34 +0200)]
fdc: Drop broken code for user-defined floppy geometry

bdrv_get_floppy_geometry_hint() fails to store through its parameter
drive when bs has a geometry hint.  Makes fd_revalidate() assign
random crap to drv->drive.

Has been broken that way for ages.  Harmless, because:

* The only way to set a geometry hint is -drive if=none,cyls=...
  Since commit c219331e, probably unintentional.

* The only use of drv->drive is as argument to another
  bdrv_get_floppy_geometry_hint().  Which doesn't use it, since the
  geometry hint is still there.

Drop the broken code, ignore -drive parameter cyls, heads and secs for
floppies even with if=none, just like before commit c219331e.  Matches
-help, which explains cyls, heads, secs as "hard disk physical
geometry".

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agofdc_test: introduce test_sense_interrupt
Pavel Hrdina [Wed, 4 Jul 2012 09:18:35 +0000 (11:18 +0200)]
fdc_test: introduce test_sense_interrupt

Calling sense interrupt status while there is no interrupt should
return invalid command (0x80).

Read command should always returns in st0 seek_end bit set to 1.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agofdc_test: update media_change test
Pavel Hrdina [Wed, 4 Jul 2012 14:26:04 +0000 (16:26 +0200)]
fdc_test: update media_change test

After rewrite DSKCHG bit handling the test has to be updated. Now
is needed to seek to different track to clear DSKCHG bit.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agofdc: fix interrupt handling
Pavel Hrdina [Fri, 22 Jun 2012 10:33:55 +0000 (12:33 +0200)]
fdc: fix interrupt handling

If you call the SENSE INTERRUPT STATUS command while there is no interrupt
waiting you get as result unknown command.

Fixed status0 register handling for read/write/format commands.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agofdc: rewrite seek and DSKCHG bit handling
Pavel Hrdina [Fri, 22 Jun 2012 10:33:54 +0000 (12:33 +0200)]
fdc: rewrite seek and DSKCHG bit handling

This bit is cleared on every successful seek to a different track (cylinder).
The seek is also called on revalidate or on read/write/format commands which
also clear the DSKCHG bit.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoblock: introduce bdrv_swap, implement bdrv_append on top of it
Paolo Bonzini [Thu, 14 Jun 2012 14:55:02 +0000 (16:55 +0200)]
block: introduce bdrv_swap, implement bdrv_append on top of it

The new function can be made a bit nicer than bdrv_append.  It swaps the
whole contents, and then swaps back (using the usual t=a;a=b;b=t idiom)
the fields that need to stay on top.  Thus, it does not need explicit
bdrv_detach_dev, bdrv_iostatus_disable, etc.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoblock: copy over job and dirty bitmap fields in bdrv_append
Paolo Bonzini [Thu, 14 Jun 2012 14:55:01 +0000 (16:55 +0200)]
block: copy over job and dirty bitmap fields in bdrv_append

While these should not be in use at the time a transaction is started,
a command in the prepare phase of a transaction might have added them,
so they need to be brought over.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoraw: hook into blkdebug
Paolo Bonzini [Wed, 6 Jun 2012 06:10:44 +0000 (08:10 +0200)]
raw: hook into blkdebug

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoblkdebug: optionally tie errors to a specific sector
Paolo Bonzini [Wed, 6 Jun 2012 06:10:43 +0000 (08:10 +0200)]
blkdebug: optionally tie errors to a specific sector

This makes blkdebug scripts more powerful, and independent of the
exact sequence of operations performed by streaming.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoblkdebug: store list of active rules
Paolo Bonzini [Wed, 6 Jun 2012 06:10:42 +0000 (08:10 +0200)]
blkdebug: store list of active rules

This prepares for the next patch, where some active rules may actually
not trigger depending on input to readv/writev.  Store the active rules
in a SIMPLEQ (so that it can be emptied easily with QSIMPLEQ_INIT), and
fetch the errno/once/immediately arguments from there.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoblkdebug: pass getlength to underlying file
Paolo Bonzini [Wed, 6 Jun 2012 06:10:41 +0000 (08:10 +0200)]
blkdebug: pass getlength to underlying file

This is required when using blkdebug with raw format.  Unlike qcow2/QED,
raw asks blkdebug for the length of the file, it doesn't get it from
a header.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoblkdebug: tiny cleanup
Paolo Bonzini [Wed, 6 Jun 2012 06:10:40 +0000 (08:10 +0200)]
blkdebug: tiny cleanup

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoblkdebug: remove sync i/o events
Paolo Bonzini [Wed, 6 Jun 2012 06:10:39 +0000 (08:10 +0200)]
blkdebug: remove sync i/o events

These are unused, except (by mistake more or less) in QED.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agosheepdog: traverse pending_list from the first for each time
MORITA Kazutaka [Tue, 26 Jun 2012 22:26:23 +0000 (07:26 +0900)]
sheepdog: traverse pending_list from the first for each time

The pending list can be modified in other coroutine context
sd_co_rw_vector, so we need to traverse the list from the first again
after we send the pending request.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agosheepdog: split outstanding list into inflight and pending
MORITA Kazutaka [Tue, 26 Jun 2012 22:26:22 +0000 (07:26 +0900)]
sheepdog: split outstanding list into inflight and pending

outstanding_list_head is used for both pending and inflight requests.
This patch splits it and improves readability.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agosheepdog: make sure we don't free aiocb before sending all requests
MORITA Kazutaka [Tue, 26 Jun 2012 22:26:21 +0000 (07:26 +0900)]
sheepdog: make sure we don't free aiocb before sending all requests

This patch increments the pending counter before sending requests, and
make sures that aiocb is not freed while sending them.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agosheepdog: use coroutine based socket functions in coroutine context
MORITA Kazutaka [Tue, 26 Jun 2012 22:26:20 +0000 (07:26 +0900)]
sheepdog: use coroutine based socket functions in coroutine context

This removes blocking network I/Os in coroutine context.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agosheepdog: restart I/O when socket becomes ready in do_co_req()
MORITA Kazutaka [Tue, 26 Jun 2012 22:26:19 +0000 (07:26 +0900)]
sheepdog: restart I/O when socket becomes ready in do_co_req()

Currently, no one reenters the yielded coroutine.  This fixes it.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agosheepdog: fix dprintf format strings
MORITA Kazutaka [Tue, 26 Jun 2012 22:26:18 +0000 (07:26 +0900)]
sheepdog: fix dprintf format strings

This fixes warnings about dprintf format in debug mode.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoblockdev: warn when copy_on_read=on and readonly=on
Stefan Hajnoczi [Wed, 27 Jun 2012 17:03:13 +0000 (18:03 +0100)]
blockdev: warn when copy_on_read=on and readonly=on

If the image is read-only then it's not possible to copy read data into
it.  Therefore copy-on-read is automatically disabled for read-only
images.

Up until now this behavior was silent, add a warning so the user knows
why copy-on-read is not working.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqcow2: preserve free_byte_offset when qcow2_alloc_bytes() fails
Stefan Hajnoczi [Mon, 18 Jun 2012 13:00:57 +0000 (14:00 +0100)]
qcow2: preserve free_byte_offset when qcow2_alloc_bytes() fails

When qcow2_alloc_clusters() error handling code was introduced in commit
5d757b563d59142ca81e1073a8e8396750a0ad1a, the value of free_byte_offset
was clobbered in the error case.  This patch keeps free_byte_offset at 0
so we will try to allocate clusters again next time this function is
called.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqcow2: fix #ifdef'd qcow2_check_refcounts() callers
Stefan Hajnoczi [Fri, 15 Jun 2012 15:41:07 +0000 (16:41 +0100)]
qcow2: fix #ifdef'd qcow2_check_refcounts() callers

The DEBUG_ALLOC qcow2.h macro enables additional consistency checks
throughout the code.  This makes it easier to spot corruptions that are
introduced during development.  Since consistency check is an expensive
operation the DEBUG_ALLOC macro is used to compile checks out in normal
builds and qcow2_check_refcounts() calls missed the addition of a new
function argument.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agousb-host: add trace events for iso xfers
Gerd Hoffmann [Tue, 3 Jul 2012 13:43:49 +0000 (15:43 +0200)]
usb-host: add trace events for iso xfers

Replace iso transfer fprintf's with trace points.  Also rename existing
tracepoints so they all match usb_host_iso_*.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agousb: fix interface initialization
Gerd Hoffmann [Tue, 3 Jul 2012 08:15:08 +0000 (10:15 +0200)]
usb: fix interface initialization

zero is a valid interface number, so don't use it when resetting the
endpoints.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agousb: split endpoint init and reset
Gerd Hoffmann [Tue, 3 Jul 2012 08:11:21 +0000 (10:11 +0200)]
usb: split endpoint init and reset

Create a new usb_ep_reset() function to reset endpoint state, without
re-initialiting the queues, so we don't unlink in-flight packets just
because usb-host has to re-parse the descriptor tables.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agousb-redir: Correctly handle the usb_redir_babble usbredir status
Hans de Goede [Fri, 6 Jul 2012 10:09:32 +0000 (12:09 +0200)]
usb-redir: Correctly handle the usb_redir_babble usbredir status

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoehci: Kick async schedule on wakeup in the non companion case
Hans de Goede [Fri, 6 Jul 2012 14:53:39 +0000 (16:53 +0200)]
ehci: Kick async schedule on wakeup in the non companion case

Commit 0f588df8b3688b00e77aabaa32e26ece5f19bd39, added code
to ehci_wakeup to kick the async schedule on wakeup, but the else
was positioned wrong making it trigger for devices which are routed
to the companion rather then to the ehci controller itself.

This patch fixes this. Note that the "programming style" with using the
return at the end of the companion block matches how the companion case
is handled in the other ports ops, and is done this way for consistency.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agousb-ehci: Fix an assert whenever isoc transfers are used
Hans de Goede [Fri, 6 Jul 2012 10:09:33 +0000 (12:09 +0200)]
usb-ehci: Fix an assert whenever isoc transfers are used

hcd-ehci.c is missing an usb_packet_init() call for the ipacket UsbPacket
it uses for isoc transfers, triggering an assert (taking the entire vm down)
in usb_packet_setup as soon as any isoc transfers are done by a high speed
USB device.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoehci: don't flush cache on doorbell rings.
Gerd Hoffmann [Wed, 20 Jun 2012 11:14:08 +0000 (13:14 +0200)]
ehci: don't flush cache on doorbell rings.

Commit 4be23939ab0d7019c7e59a37485b416fbbf0f073 makes ehci instantly
zap any unlinked queue heads when the guest rings the doorbell.

While hacking up uas support this turned out to be a problem.  The linux
kernel can unlink and instantly relink the very same queue head, thereby
killing any async packets in flight.  That alone isn't an issue yet, the
packet will canceled and resubmitted and everything is fine.  We'll run
into trouble though in case the async packet is completed already, so we
can't cancel it any more.  The transaction is simply lost then.

usb_ehci_qh_ptrs q (nil) - QH @ 39c4f000: next 39c4f122 qtds 00000000,00000001,39c50000
usb_ehci_qh_fields QH @ 39c4f000 - rl 0, mplen 0, eps 0, ep 0, dev 0
usb_ehci_qh_ptrs q 0x7f95feba90a0 - QH @ 39c4f000: next 39c4f122 qtds 00000000,00000001,39c50000
usb_ehci_qh_fields QH @ 39c4f000 - rl 0, mplen 0, eps 0, ep 0, dev 0
usb_ehci_qh_ptrs q 0x7f95fe515210 - QH @ 39c4f120: next 39c4f0c2 qtds 29dbce40,29dbc4e0,00000009
usb_ehci_qh_fields QH @ 39c4f120 - rl 4, mplen 512, eps 2, ep 1, dev 2
usb_ehci_packet_action q 0x7f95fe515210 p 0x7f95fdec32a0: alloc
usb_packet_state_change bus 0, port 2, ep 1, packet 0x7f95fdec32e0, state undef -> setup
usb_ehci_packet_action q 0x7f95fe515210 p 0x7f95fdec32a0: process
usb_uas_command dev 2, tag 0x2, lun 0, lun64 00000000-00000000
scsi_req_parsed target 0 lun 0 tag 2 command 42 dir 2 length 16384
scsi_req_parsed_lba target 0 lun 0 tag 2 command 42 lba 5933312
scsi_req_alloc target 0 lun 0 tag 2
scsi_req_continue target 0 lun 0 tag 2
scsi_req_data target 0 lun 0 tag 2 len 16384
usb_uas_scsi_data dev 2, tag 0x2, bytes 16384
usb_uas_write_ready dev 2, tag 0x2
usb_packet_state_change bus 0, port 2, ep 1, packet 0x7f95fdec32e0, state setup -> complete
usb_ehci_packet_action q 0x7f95fe515210 p 0x7f95fdec32a0: free
usb_ehci_qh_ptrs q 0x7f95fdec3210 - QH @ 39c4f0c0: next 39c4f002 qtds 29dbce40,00000001,00000009
usb_ehci_qh_fields QH @ 39c4f0c0 - rl 4, mplen 512, eps 2, ep 2, dev 2
usb_ehci_queue_action q 0x7f95fe5152a0: free
usb_packet_state_change bus 0, port 2, ep 2, packet 0x7f95feba9170, state async -> complete
^^^ async packets completes.
usb_ehci_packet_action q 0x7f95fdec3210 p 0x7f95feba9130: wakeup

usb_ehci_qh_ptrs q (nil) - QH @ 39c4f000: next 39c4f122 qtds 00000000,00000001,39c50000
usb_ehci_qh_fields QH @ 39c4f000 - rl 0, mplen 0, eps 0, ep 0, dev 0
usb_ehci_qh_ptrs q 0x7f95feba90a0 - QH @ 39c4f000: next 39c4f122 qtds 00000000,00000001,39c50000
usb_ehci_qh_fields QH @ 39c4f000 - rl 0, mplen 0, eps 0, ep 0, dev 0
usb_ehci_qh_ptrs q 0x7f95fe515210 - QH @ 39c4f120: next 39c4f002 qtds 29dbc4e0,29dbc8a0,00000009
usb_ehci_qh_fields QH @ 39c4f120 - rl 4, mplen 512, eps 2, ep 1, dev 2
usb_ehci_queue_action q 0x7f95fdec3210: free
usb_ehci_packet_action q 0x7f95fdec3210 p 0x7f95feba9130: free
^^^ endpoint #2 queue head removed from schedule, doorbell makes ehci zap the queue,
    the (completed) usb packet is freed too and gets lost.

usb_ehci_qh_ptrs q (nil) - QH @ 39c4f000: next 39c4f0c2 qtds 00000000,00000001,39c50000
usb_ehci_qh_fields QH @ 39c4f000 - rl 0, mplen 0, eps 0, ep 0, dev 0
usb_ehci_qh_ptrs q 0x7f95feba90a0 - QH @ 39c4f000: next 39c4f0c2 qtds 00000000,00000001,39c50000
usb_ehci_qh_fields QH @ 39c4f000 - rl 0, mplen 0, eps 0, ep 0, dev 0
usb_ehci_queue_action q 0x7f9600dff570: alloc
usb_ehci_qh_ptrs q 0x7f9600dff570 - QH @ 39c4f0c0: next 39c4f122 qtds 29dbce40,00000001,00000009
usb_ehci_qh_fields QH @ 39c4f0c0 - rl 4, mplen 512, eps 2, ep 2, dev 2
usb_ehci_packet_action q 0x7f9600dff570 p 0x7f95feba9130: alloc
usb_packet_state_change bus 0, port 2, ep 2, packet 0x7f95feba9170, state undef -> setup
usb_ehci_packet_action q 0x7f9600dff570 p 0x7f95feba9130: process
usb_packet_state_change bus 0, port 2, ep 2, packet 0x7f95feba9170, state setup -> async
usb_ehci_packet_action q 0x7f9600dff570 p 0x7f95feba9130: async
^^^ linux kernel relinked the queue head, ehci creates a new usb packet,
    but we should have delivered the completed one instead.
usb_ehci_qh_ptrs q 0x7f95fe515210 - QH @ 39c4f120: next 39c4f002 qtds 29dbc4e0,29dbc8a0,00000009
usb_ehci_qh_fields QH @ 39c4f120 - rl 4, mplen 512, eps 2, ep 1, dev 2

So instead of instantly zapping the queue we'll set a flag that the
queue needs revalidation in case we'll see it again in the schedule.
ehci then checks that the queue head fields addressing / describing the
endpoint and the qtd pointer match the cached content before reusing it.

Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoehci: fix td writeback
Gerd Hoffmann [Tue, 19 Jun 2012 11:53:28 +0000 (13:53 +0200)]
ehci: fix td writeback

Only write back the dwords the hc is supposed to update.  Should not
make a difference in theory as the guest must not touch the td while
it is active to avoid races.  But it is still more correct.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoehci: fix ehci_qh_do_overlay
Gerd Hoffmann [Tue, 19 Jun 2012 14:23:32 +0000 (16:23 +0200)]
ehci: fix ehci_qh_do_overlay

Use ehci_flush_qh to make sure we touch inly the fields the hc is
allowed to touch.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agobitops.h: Add functions to extract and deposit bitfields
Peter Maydell [Fri, 6 Jul 2012 14:48:00 +0000 (15:48 +0100)]
bitops.h: Add functions to extract and deposit bitfields

Add functions deposit32(), deposit64(), extract32() and extract64()
to extract and deposit bitfields in 32 and 64 bit words. Based on
ideas by Jia Liu and Avi Kivity.

Suggested-by: Jia Liu <proljc@gmail.com>
Suggested-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotarget-i386: make it clearer that op table accesses don't overrun
Peter Maydell [Thu, 5 Jul 2012 21:29:00 +0000 (22:29 +0100)]
target-i386: make it clearer that op table accesses don't overrun

Rephrase some of the expressions used to select an entry
in the SSE op table arrays so that it's clearer that they
don't overrun the op table array size.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotarget-i386: Remove confusing X86_64_DEF macro
Peter Maydell [Thu, 5 Jul 2012 21:28:59 +0000 (22:28 +0100)]
target-i386: Remove confusing X86_64_DEF macro

The X86_64_DEF macro is a confusing way of making some terms
in a conditional only appear if TARGET_X86_64 is defined. We
only use it in two places, and in both cases this is for making
the same test, so abstract that check out into a function
where we can use a more conventional #ifdef.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotarget-i386: Remove unused macros
Peter Maydell [Thu, 5 Jul 2012 21:28:58 +0000 (22:28 +0100)]
target-i386: Remove unused macros

Commit 11f8cdb removed all the uses of the X86_64_ONLY
macro. The BUGGY_64() macro has been unused for a long time:
it originally marked some ops which couldn't be enabled
because of issues with the pre-TCG code generation scheme.
Remove the now-unnecessary definitions of both macros.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years ago.gitignore update
Eduardo Habkost [Wed, 4 Jul 2012 19:10:47 +0000 (16:10 -0300)]
.gitignore update

Makes sure the following files are ignored:

  libcacard/.libs/
  libcacard/libcacard.la
  libcacard/libcacard.pc
  libcacard/libcacard/
  libcacard/osdep.lo
  libcacard/oslib-posix.lo
  libcacard/qemu-thread-posix.lo
  libcacard/qemu-timer-common.lo
  libcacard/trace.lo
  libcacard/trace/
  tests/test-visitor-serialization
  vscclient

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agoMerge branch 'arm-devs.for-upstream' of git://git.linaro.org/people/pmaydell/qemu-arm
Blue Swirl [Sat, 7 Jul 2012 09:00:38 +0000 (09:00 +0000)]
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:
  hw/cadence_gem: Make rx_desc_addr and tx_desc_addr uint32_t
  i.MX31: KZM-ARM11-01 evaluation board
  i.MX31: Interrupt Controller
  i.MX31: Timers
  i.MX31: Clock Control Module
  i.MX: UART support
  Exynos4: add RTC device
  hw/exynos4210.c: Fix misleading initialization of IROM mirror
  hw/exynos4210_pwm.c: Fix STOP status in tick handler.
  ARM: hw/exynos4210_mct.c: Fix a bug which hangs Linux kernel.

11 years agotarget-i386: Fix compilation with --enable-debug
Stefan Weil [Fri, 29 Jun 2012 20:38:20 +0000 (22:38 +0200)]
target-i386: Fix compilation with --enable-debug

commit c4baa0503d9623f1ce891f525ccd140c598bc29a improved SSE table
type safety which now raises compiler errors when latest QEMU was
configured with --enable-debug.

Fix this by splitting the SSE tables even further to separate
helper functions with different signatures.

Instead of crashing by calling address 0, the code now jumps to
label illegal_op.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agohw/cadence_gem: Make rx_desc_addr and tx_desc_addr uint32_t
Peter Maydell [Wed, 4 Jul 2012 10:50:58 +0000 (10:50 +0000)]
hw/cadence_gem: Make rx_desc_addr and tx_desc_addr uint32_t

Make the state fields rx_desc_addr and tx_desc_addr uint32_t;
this matches the VMStateDescription, and also conforms to how
hardware works: the registers don't magically become larger
if the device is attached to a CPU with a larger physical
address size. It also fixes a compile failure if the
target_phys_addr_t type is changed to 64 bits.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
11 years agoi.MX31: KZM-ARM11-01 evaluation board
Peter Chubb [Wed, 4 Jul 2012 10:43:34 +0000 (10:43 +0000)]
i.MX31: KZM-ARM11-01 evaluation board

Board support for Kyoto Micro's KZM-ARM11-01, an evaluation board built
around the Freescale i.MX31.

Signed-off-by: Philip O'Sullivan <philipo@ok-labs.com>
Signed-off-by: Peter Chubb <peter.chubb@nicta.com.au>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agoi.MX31: Interrupt Controller
Peter Chubb [Wed, 4 Jul 2012 10:43:34 +0000 (10:43 +0000)]
i.MX31: Interrupt Controller

Implement the Freescale i.MX31 advanced vectored interrupt controller, at least
to the extent it is used by Linux 3.x

Vectors are not implemented.

Signed-off-by: Philip O'Sullivan <philipo@ok-labs.com>
Signed-off-by: Peter Chubb <peter.chubb@nicta.com.au>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agoi.MX31: Timers
Peter Chubb [Wed, 4 Jul 2012 10:43:33 +0000 (10:43 +0000)]
i.MX31: Timers

Implement the timers on the Freescale i.MX31 SoC.
This is not a complete implementation, but gives enough for
Linux to boot and run. In particular external triggers, which are
not useful under QEMU, are not implemented.

Signed-off-by: Philip O'Sullivan <philipo@ok-labs.com>
Signed-off-by: Peter Chubb <peter.chubb@nicta.com.au>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agoi.MX31: Clock Control Module
Peter Chubb [Wed, 4 Jul 2012 10:43:33 +0000 (10:43 +0000)]
i.MX31: Clock Control Module

For Linux to be able to work out how fast its clocks are going, so
that timer ticks come approximately at the right time, it needs to
be able to query the clock control module (CCM).

This is the start of a CCM implementation.  It currently knows only about
the MCU, HSP and IPG clocks --- i.e., the ones used to feed the periodic
and general purpose timers.

Signed-off-by: Peter Chubb <peter.chubb@nicta.com.au>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agoi.MX: UART support
Peter Chubb [Wed, 4 Jul 2012 10:43:33 +0000 (10:43 +0000)]
i.MX: UART support

Implement the Freescale i.MX UART.  This uart is used in a variety of
SoCs, including some by Motorola, as well as in the Freescale i.MX
series.

This patch gives only a `bare-bones' implementation, enough to run Linux
or OKL4, but that's about it.

Signed-off-by: Philip O'Sullivan <philipo@ok-labs.com>
Signed-off-by: Peter Chubb <peter.chubb@nicta.com.au>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agoExynos4: add RTC device
Oleg Ogurtsov [Wed, 4 Jul 2012 10:43:32 +0000 (10:43 +0000)]
Exynos4: add RTC device

Signed-off-by: Oleg Ogurtsov <o.ogurtsov@samsung.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agohw/exynos4210.c: Fix misleading initialization of IROM mirror
Evgeny Voevodin [Wed, 4 Jul 2012 10:43:32 +0000 (10:43 +0000)]
hw/exynos4210.c: Fix misleading initialization of IROM mirror

We want to mirror whole IROM and should pass zero instead of
EXYNOS4210_IROM_BASE_ADDR (though it equals to zero too) since
memory_region_init_alias takes an offset within an original
region as an argument.

Signed-off-by: Evgeny Voevodin <e.voevodin@samsung.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agohw/exynos4210_pwm.c: Fix STOP status in tick handler.
Evgeny Voevodin [Wed, 4 Jul 2012 10:43:31 +0000 (10:43 +0000)]
hw/exynos4210_pwm.c: Fix STOP status in tick handler.

START/STOP bit was not cleaned correctly.

Signed-off-by: Evgeny Voevodin <e.voevodin@samsung.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agoARM: hw/exynos4210_mct.c: Fix a bug which hangs Linux kernel.
Stanislav Vorobiov [Wed, 4 Jul 2012 10:43:30 +0000 (10:43 +0000)]
ARM: hw/exynos4210_mct.c: Fix a bug which hangs Linux kernel.

After some long period of time Linux kernel hanged due to
ptimer_get_count may return 0 before timer interrupt occurs,
thus, causing FRC to jump back in time

Signed-off-by: Evgeny Voevodin <e.voevodin@samsung.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agoscsi: Fix transfer length for READ POSITION commands.
Christian Hoff [Thu, 14 Jun 2012 13:55:28 +0000 (15:55 +0200)]
scsi: Fix transfer length for READ POSITION commands.

The transfer length depends on the specific service action
code, as defined in the SCSI stream commands spec section 7.7.
Up to now only the extended form was supported.

Signed-off-by: Christian Hoff <christian.hoff@de.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agoscsi: Add basic support for SCSI media changer commands.
Christian Hoff [Thu, 14 Jun 2012 13:55:27 +0000 (15:55 +0200)]
scsi: Add basic support for SCSI media changer commands.

This adds basic support for SCSI media changer commands.
Not all commands are supported as of now, but enough to cover
basic functionality.

Signed-off-by: Christian Hoff <christian.hoff@de.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agoscsi: Ensure command and transfer lengths are set for all SCSI devices
Paolo Bonzini [Thu, 14 Jun 2012 14:13:49 +0000 (16:13 +0200)]
scsi: Ensure command and transfer lengths are set for all SCSI devices

scsi-generic relies on those values to be correct, so it is important that
those values are initialized properly for all device types.

Reported-by: Christian Hoff <christian.hoff@de.ibm.com>
Reported-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agoscsi: Fix LOAD_UNLOAD
Christian Hoff [Thu, 14 Jun 2012 13:55:26 +0000 (15:55 +0200)]
scsi: Fix LOAD_UNLOAD

Change operation code of LOAD_UNLOAD command to 0x1b as described in
section 7.3 of the SCSI Stream Commands spec.

Signed-off-by: Christian Hoff <christian.hoff@de.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agoscsi: Fix data length == SCSI_SENSE_BUF_SIZE
Christian Hoff [Thu, 14 Jun 2012 13:55:25 +0000 (15:55 +0200)]
scsi: Fix data length == SCSI_SENSE_BUF_SIZE

Fix the edge case where the sense data length is exactly the same
as SCSI_SENSE_BUF_SIZE.
This makes SCSI requests work that use all of the available 95 byte
sense data.

Signed-off-by: Christian Hoff <christian.hoff@de.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agovirtio-scsi: do not crash on adding buffers to the event queue
Paolo Bonzini [Tue, 12 Jun 2012 16:37:25 +0000 (18:37 +0200)]
virtio-scsi: do not crash on adding buffers to the event queue

The event queue is not supported yet and the handler does not
have to do much anyway when buffers are added.  However, the
handler is called unconditionally by the virtio layer, and this
results in a crash as soon as buffers are added to the event
queue because we pass NULL.

Reported-by: Bryan Venteicher <bryanv@daemoninthecloset.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agomegasas: LSI Megaraid SAS HBA emulation
Hannes Reinecke [Tue, 29 May 2012 11:51:17 +0000 (13:51 +0200)]
megasas: LSI Megaraid SAS HBA emulation

This patch adds an emulation for the LSI Megaraid SAS 8708EM2 HBA.
I've tested it to work with Linux, Windows Vista, and Windows7.

Signed-off-by: Hannes Reinecke <hare@suse.de>
[ Squashed trivial changes from Andreas Faerber, rebased over IOMMU
  and QBus changes - Paolo ]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agoconfigure: Remove help for --disable-vnc-thread, --enable-vnc-thread
Stefan Weil [Thu, 28 Jun 2012 15:56:37 +0000 (17:56 +0200)]
configure: Remove help for --disable-vnc-thread, --enable-vnc-thread

Commit 2624bab836662d37f08336408a99d97652fc9c4d removed these
configure arguments. Now the help text for both is removed, too.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
11 years agocpu-common.h: Remove a pointless ifndef CONFIG_USER_ONLY
Peter Maydell [Fri, 22 Jun 2012 11:30:59 +0000 (12:30 +0100)]
cpu-common.h: Remove a pointless ifndef CONFIG_USER_ONLY

Remove an ifndef CONFIG_USER_ONLY guard that was pointless
because it is already inside an if !defined(CONFIG_USER_ONLY).

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Acked-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
11 years agocpu-common.h: Remove unnecessary guard on including targphys.h
Peter Maydell [Fri, 22 Jun 2012 11:30:58 +0000 (12:30 +0100)]
cpu-common.h: Remove unnecessary guard on including targphys.h

There's no need to make the include of targphys.h conditional
on whether TARGET_PHYS_ADDR_BITS is defined, because targphys.h
itself checks that and does nothing if it isn't.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
11 years agomegasas: Add header file
Hannes Reinecke [Tue, 29 May 2012 11:51:16 +0000 (13:51 +0200)]
megasas: Add header file

This patch adds the header file for megasas.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agoISCSI: force use of sg for SMC and SSC devices
Ronnie Sahlberg [Sat, 26 May 2012 04:56:41 +0000 (14:56 +1000)]
ISCSI: force use of sg for SMC and SSC devices

If the device we open is a SMC or SSC device, then force the use of sg. We
dont have any medium changer or tape emulation so only passthrough via
real sg or scsi-generic via iscsi would work anyway.

Forcing sg also makes qemu skip trying to read from the device to guess
the image format by reading from the device (find_image_format()).
SMC devices do not implement READ6/10/12/16 so it is not possible to
read from them (SSC have different CDBs).

With this patch I can successfully manage a SMC device wiht iscsi in
passthrough mode.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
[Added TYPE_TAPE handling - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agoISCSI: Add SCSI passthrough via scsi-generic to libiscsi
Ronnie Sahlberg [Fri, 25 May 2012 11:59:01 +0000 (21:59 +1000)]
ISCSI: Add SCSI passthrough via scsi-generic to libiscsi

Update iscsi to allow passthrough of SG_IO scsi commands when the iscsi
device is forced to be scsi-generic.

Implement both bdrv_ioctl() and bdrv_aio_ioctl() in the iscsi backend,
emulate the SG_IO ioctl and pass the SCSI commands across to the
iscsi target.

This allows end-to-end passthrough of SCSI all the way from the guest,
to qemu, via scsi-generic, then libiscsi all the way to the iscsi target.

To activate this you need to specify that the iscsi lun should be treated
as a scsi-generic device.

Example:
    -device lsi -device scsi-generic,drive=MyISCSI \
    -drive file=iscsi://10.1.1.125/iqn.ronnie.test/1,if=none,id=MyISCSI

Note, you can currently not boot a qemu guest from a scsi device.

Note,
This only works when the host is linux, since the emulation relies on
definitions of SG_IO from the scsi-generic implementation in the
linux kernel.
It should be fairly easy to re-implement some structures similar enough
for non-linux hosts to do the same style of passthrough via a fake
scsi generic layer and libiscsi if need be.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agoscsi-disk: implement READ DISC INFORMATION
Paolo Bonzini [Fri, 25 May 2012 10:59:55 +0000 (12:59 +0200)]
scsi-disk: implement READ DISC INFORMATION

This command is not necessary for CD-ROM and DVD-ROM, but some versions of
udev trip on its absence.

Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agoatapi: implement READ DISC INFORMATION
Paolo Bonzini [Fri, 25 May 2012 10:59:31 +0000 (12:59 +0200)]
atapi: implement READ DISC INFORMATION

This command is not necessary for CD-ROM and DVD-ROM, but some versions of
udev trip on its absence.

Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agoscsi: add a qdev property for the disk's WWN
Paolo Bonzini [Tue, 15 May 2012 10:46:09 +0000 (12:46 +0200)]
scsi: add a qdev property for the disk's WWN

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agoscsi: simplify handling of the VPD page length field
Paolo Bonzini [Tue, 15 May 2012 10:45:20 +0000 (12:45 +0200)]
scsi: simplify handling of the VPD page length field

The last four bytes of the thin provisioning page were cut out.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agoMaintain the number of dirty pages
Juan Quintela [Fri, 22 Jun 2012 13:21:07 +0000 (15:21 +0200)]
Maintain the number of dirty pages

Calculate the number of dirty pages takes a lot on hosts with lots
of memory.  Just maintain how many pages are dirty.

Signed-off-by: Juan Quintela <quintela@redhat.com>
11 years agodirty bitmap: abstract its use
Juan Quintela [Fri, 22 Jun 2012 11:14:17 +0000 (13:14 +0200)]
dirty bitmap: abstract its use

Always use accessors to read/set the dirty bitmap.

Signed-off-by: Juan Quintela <quintela@redhat.com>
11 years agoExit loop if we have been there too long
Juan Quintela [Tue, 22 May 2012 14:27:59 +0000 (16:27 +0200)]
Exit loop if we have been there too long

Checking each 64 pages is a random magic number as good as any other.
We don't want to test too many times, but on the other hand,
qemu_get_clock_ns() is not so expensive either.  We want to be sure
that we spent less than 50ms (half of buffered_file timer), if we
spent more than 100ms, all the accounting got wrong.

Signed-off-by: Juan Quintela <quintela@redhat.com>
11 years agoOnly calculate expected_time for stage 2
Juan Quintela [Mon, 21 May 2012 22:44:24 +0000 (00:44 +0200)]
Only calculate expected_time for stage 2

ram_save_remaining() is an expensive operation when there is a lot of memory.
So we only call the function when we need it.

Signed-off-by: Juan Quintela <quintela@redhat.com>
11 years agoOnly TCG needs TLB handling
Juan Quintela [Mon, 21 May 2012 22:42:40 +0000 (00:42 +0200)]
Only TCG needs TLB handling

Refactor the code that is only needed for tcg to an static function.
Call that only when tcg is enabled.  We can't refactor to a dummy
function in the kvm case, as qemu can be compiled at the same time
with tcg and kvm.

Signed-off-by: Juan Quintela <quintela@redhat.com>
11 years agoNo need to iterate if we already are over the limit
Juan Quintela [Mon, 21 May 2012 22:38:26 +0000 (00:38 +0200)]
No need to iterate if we already are over the limit

If buffers are full, don't iterate, just exit.

Signed-off-by: Juan Quintela <quintela@redhat.com>
11 years agoAdd tracepoints for savevm section start/end
Juan Quintela [Mon, 21 May 2012 21:46:44 +0000 (23:46 +0200)]
Add tracepoints for savevm section start/end

This allows to know how long each section takes to save.

An awk script like this tells us sections that takes more that 10ms

$1 ~ /savevm_state_iterate_end/ {
/* Print savevm_section_end line when > 10ms duration */
if ($2 > 10000) {
printf("%s times_missing=%u\n", $0, times_missing++);
}
}

Signed-off-by: Juan Quintela <quintela@redhat.com>
fix ws tracepoints

Signed-off-by: Juan Quintela <quintela@redhat.com>
11 years agoAdd spent time for migration
Juan Quintela [Mon, 21 May 2012 20:01:07 +0000 (22:01 +0200)]
Add spent time for migration

We add time spent for migration to the output of "info migrate"
command.  'total_time' means time since the start fo migration if
migration is 'active', and total time of migration if migration is
completed.  As we are also interested in transferred ram when
migration completes, adding all ram statistics

Signed-off-by: Juan Quintela <quintela@redhat.com>
11 years agoAdd migration_end function
Orit Wasserman [Tue, 19 Jun 2012 15:43:17 +0000 (18:43 +0300)]
Add migration_end function

Signed-off-by: Orit Wasserman <owasserm@redhat.com>
11 years agoAdd debugging infrastructure
Orit Wasserman [Tue, 19 Jun 2012 15:43:15 +0000 (18:43 +0300)]
Add debugging infrastructure

Signed-off-by: Orit Wasserman <owasserm@redhat.com>
11 years agoAdd save_block_hdr function
Orit Wasserman [Tue, 19 Jun 2012 15:43:14 +0000 (18:43 +0300)]
Add save_block_hdr function

Signed-off-by: Benoit Hudzia <benoit.hudzia@sap.com>
Signed-off-by: Petter Svard <petters@cs.umu.se>
Signed-off-by: Aidan Shribman <aidan.shribman@sap.com>
Signed-off-by: Orit Wasserman <owasserm@redhat.com>
11 years agoAdd MigrationParams structure
Isaku Yamahata [Tue, 19 Jun 2012 15:43:09 +0000 (18:43 +0300)]
Add MigrationParams structure

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
11 years agoAdd missing check for host_from_stream_offset return value for RAM_SAVE_FLAG_PAGE
Orit Wasserman [Tue, 19 Jun 2012 08:51:37 +0000 (11:51 +0300)]
Add missing check for host_from_stream_offset return value for RAM_SAVE_FLAG_PAGE

Signed-off-by: Orit Wasserman <owasserm@redhat.com>
11 years agobsd-user: fix build
Blue Swirl [Sun, 24 Jun 2012 20:15:05 +0000 (20:15 +0000)]
bsd-user: fix build

Link in oslib objects also for BSD user, but avoid using the version of
qemu_vmalloc() defined in oslib-posix.c.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agox86: rename op_helper.c to seg_helper.c
Blue Swirl [Thu, 21 Jun 2012 19:19:15 +0000 (19:19 +0000)]
x86: rename op_helper.c to seg_helper.c

Rename what is remaining of op_helper.c to seg_helper.c.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agox86: split off memory access helpers
Blue Swirl [Sun, 29 Apr 2012 16:39:13 +0000 (16:39 +0000)]
x86: split off memory access helpers

Move memory access helpers to mem_helper.c.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agox86: split off misc helpers
Blue Swirl [Sun, 29 Apr 2012 18:20:34 +0000 (18:20 +0000)]
x86: split off misc helpers

Move various functions to misc_helper.c.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agox86: split off SMM helpers
Blue Swirl [Sun, 29 Apr 2012 17:48:05 +0000 (17:48 +0000)]
x86: split off SMM helpers

Move SMM helpers to smm_helper.c.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agox86: split off SVM helpers
Blue Swirl [Sun, 29 Apr 2012 14:42:35 +0000 (14:42 +0000)]
x86: split off SVM helpers

Move SVM helpers to svm_helper.c.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>