sdk/emulator/qemu.git
12 years agoscsi: remove devs array from SCSIBus
Paolo Bonzini [Thu, 28 Jul 2011 16:02:13 +0000 (18:02 +0200)]
scsi: remove devs array from SCSIBus

Change the devs array into a linked list, and add a scsi_device_find
function to navigate the children list instead.  This lets the SCSI
bus use more complex addressing, and HBAs can talk to the correct device
when there are multiple LUNs per target.

scsi_device_find may return another LUN on the same target if none is
found that matches exactly.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqdev: switch children device list to QTAILQ
Paolo Bonzini [Wed, 14 Sep 2011 07:28:06 +0000 (09:28 +0200)]
qdev: switch children device list to QTAILQ

SCSI buses will need to read the children list first-to-last.  This
requires using a QTAILQ, because hell breaks loose if you just try
inserting at the tail (thus reversing the order of all existing
visits from last-to-first to first-to-tail).

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoscsi: move tcq/ndev to SCSIBusOps (now SCSIBusInfo)
Paolo Bonzini [Sat, 13 Aug 2011 13:44:45 +0000 (15:44 +0200)]
scsi: move tcq/ndev to SCSIBusOps (now SCSIBusInfo)

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoscsi-disk: report media changed via GET EVENT STATUS NOTIFICATION
Paolo Bonzini [Tue, 13 Sep 2011 14:26:51 +0000 (16:26 +0200)]
scsi-disk: report media changed via GET EVENT STATUS NOTIFICATION

This adds support for media change notification via the GET EVENT STATUS
NOTIFICATION command, used by Linux versions 2.6.38 and newer.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoscsi-disk: support READ DVD STRUCTURE
Paolo Bonzini [Tue, 13 Sep 2011 13:57:15 +0000 (15:57 +0200)]
scsi-disk: support READ DVD STRUCTURE

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoscsi-disk: support DVD profile in GET CONFIGURATION
Paolo Bonzini [Tue, 13 Sep 2011 13:22:31 +0000 (15:22 +0200)]
scsi-disk: support DVD profile in GET CONFIGURATION

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoatapi/scsi-disk: make mode page values coherent between the two
Paolo Bonzini [Tue, 13 Sep 2011 13:08:22 +0000 (15:08 +0200)]
atapi/scsi-disk: make mode page values coherent between the two

This patch adds to scsi-disk the missing mode page 0x01 for both disk
and CD-ROM drives, and mode page 0x0e for CD drives only.

A few offsets were wrong in atapi.c.  Also change the 2Ah mode page to
expose DVD media read capabilities in the IDE cdrom.  This lets you run
dvd+rw-mediainfo on the virtual DVD drives.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoscsi-disk: store valid mode pages in a table
Paolo Bonzini [Tue, 13 Sep 2011 12:50:15 +0000 (14:50 +0200)]
scsi-disk: store valid mode pages in a table

A small refactoring of the MODE SENSE implementation in scsi-disk.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoscsi-disk: add stubs for more MMC commands
Paolo Bonzini [Tue, 13 Sep 2011 12:33:47 +0000 (14:33 +0200)]
scsi-disk: add stubs for more MMC commands

This patch adds a few stub implementations for MMC commands to
scsi-disk, to be filled in later in the series.  It also adds to
scsi-defs.h constants for commands implemented by ide/atapi.c,
when missing.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoscsi-disk: fix coding style issues (braces)
Paolo Bonzini [Mon, 17 Oct 2011 14:39:27 +0000 (16:39 +0200)]
scsi-disk: fix coding style issues (braces)

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoscsi-disk: report media changed via unit attention sense codes
Paolo Bonzini [Tue, 13 Sep 2011 14:26:06 +0000 (16:26 +0200)]
scsi-disk: report media changed via unit attention sense codes

Building on the previous patch, this one adds a media change callback
to scsi-disk.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoscsi: notify the device when unit attention is reported
Paolo Bonzini [Tue, 13 Sep 2011 14:19:53 +0000 (16:19 +0200)]
scsi: notify the device when unit attention is reported

Reporting media change events via unit attention sense codes requires
a small state machine: first report "NO MEDIUM", then report "MEDIUM MAY
HAVE CHANGED".  Unfortunately there is no good hooking point for the
device to notice that its pending unit attention condition has been
reported.  This patch reworks the generic machinery to add one.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoatapi: cleanup/fix mode sense results
Paolo Bonzini [Mon, 17 Oct 2011 14:34:59 +0000 (16:34 +0200)]
atapi: cleanup/fix mode sense results

The first two bytes (after the 8-byte ATAPI header) are the mode page
number and the number of bytes after the length field itself.  Make
this clear in the code.

The AUDIO_CTL page was filled with wrong values.  It is not anymore in
MMC, but at least keep the values sane.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoatapi: move GESN definitions to scsi-defs.h
Paolo Bonzini [Tue, 13 Sep 2011 14:00:52 +0000 (16:00 +0200)]
atapi: move GESN definitions to scsi-defs.h

As a complement to the previous patch, move definitions for GET EVENT
STATUS NOTIFICATION from the two functions to scsi-defs.h.

The NCR_* constants are just bit values corresponding to the ENC_*
values, with no offsets even, so keep just one copy.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoatapi/scsi: unify definitions for MMC
Paolo Bonzini [Tue, 13 Sep 2011 12:41:56 +0000 (14:41 +0200)]
atapi/scsi: unify definitions for MMC

The definitions in ide/internal.h are duplicates, since ATAPI commands
actually come from SCSI.  Use the ones in scsi-defs.h and move the
missing ones there.  Two exceptions:

- MODE_PAGE_WRITE_PARMS conflicts with the "flexible disk geometry"
page in scsi-disk.c.  It is unused, so pick the latter.

- GPCMD_* is left in ide/internal.h, at least for now.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoscsi: pass correct sense code for ENOMEDIUM
Paolo Bonzini [Mon, 19 Sep 2011 15:19:21 +0000 (17:19 +0200)]
scsi: pass correct sense code for ENOMEDIUM

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoDocumentation: Add syntax for using sheepdog devices
Ronnie Sahlberg [Fri, 28 Oct 2011 09:13:39 +0000 (20:13 +1100)]
Documentation: Add syntax for using sheepdog devices

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoblock: reinitialize across bdrv_close()/bdrv_open()
Stefan Hajnoczi [Thu, 27 Oct 2011 09:54:28 +0000 (10:54 +0100)]
block: reinitialize across bdrv_close()/bdrv_open()

Several BlockDriverState fields are not being reinitialized across
bdrv_close()/bdrv_open().  Make sure they are reset to their default
values.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoblock: set bs->read_only before .bdrv_open()
Stefan Hajnoczi [Thu, 27 Oct 2011 09:54:27 +0000 (10:54 +0100)]
block: set bs->read_only before .bdrv_open()

Several block drivers set bs->read_only in .bdrv_open() but
block.c:bdrv_open_common() clobbers its value.  Additionally, QED uses
bdrv_is_read_only() in .bdrv_open() to decide whether to perform
consistency checks.

The correct ordering is to initialize bs->read_only from the open flags
before calling .bdrv_open().  This way block drivers can override it if
necessary and can use bdrv_is_read_only() in .bdrv_open().

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqemu-io: delete bs instead of leaking it
Stefan Hajnoczi [Thu, 27 Oct 2011 09:54:26 +0000 (10:54 +0100)]
qemu-io: delete bs instead of leaking it

Using bdrv_close() is not enough to free a BlockDriverState.  Since we
explicitly create it with bdrv_new(), use bdrv_delete() to close and
delete it.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoblock: fix qcow2_co_flush deadlock
Dong Xu Wang [Thu, 27 Oct 2011 09:22:28 +0000 (17:22 +0800)]
block: fix qcow2_co_flush deadlock

If qcow2_cache_flush failed, s->lock will not be unlock.

Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoDocumentation: Describe NBD URL syntax
Ronnie Sahlberg [Thu, 27 Oct 2011 09:33:21 +0000 (20:33 +1100)]
Documentation: Describe NBD URL syntax

This patch adds a short description of how to specify a NBD device
to QEMU.
Syntax for both TCP and Unix Domain Sockets are provided as well
as examples.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agovmdk: Fix possible segfaults
Kevin Wolf [Wed, 26 Oct 2011 10:25:52 +0000 (12:25 +0200)]
vmdk: Fix possible segfaults

Data we read from the disk isn't necessarily null terminated and may not
contain the string we're looking for. The code needs to be a bit more careful
here.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agovmdk: Improve error handling
Kevin Wolf [Wed, 26 Oct 2011 10:25:25 +0000 (12:25 +0200)]
vmdk: Improve error handling

Return the right error values in some more places.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agovmdk: Fix use of uninitialised value
Kevin Wolf [Wed, 26 Oct 2011 10:22:40 +0000 (12:22 +0200)]
vmdk: Fix use of uninitialised value

In error cases, cid is never set.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoide: Fix off-by-one error in array index check
Kevin Wolf [Wed, 26 Oct 2011 09:52:47 +0000 (11:52 +0200)]
ide: Fix off-by-one error in array index check

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoqcow: Fix bdrv_write_compressed error handling
Kevin Wolf [Wed, 26 Oct 2011 09:21:50 +0000 (11:21 +0200)]
qcow: Fix bdrv_write_compressed error handling

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoblock: Fix bdrv_open use after free
Kevin Wolf [Wed, 26 Oct 2011 09:03:01 +0000 (11:03 +0200)]
block: Fix bdrv_open use after free

tmp_filename was used outside the block it was defined in, i.e. after it went
out of scope. Move its declaration to the top level.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoblock: Remove dead code
Kevin Wolf [Wed, 26 Oct 2011 09:02:11 +0000 (11:02 +0200)]
block: Remove dead code

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqcow2: fix some errors and typo in qcow2.txt
Zhi Yong Wu [Thu, 27 Oct 2011 06:58:57 +0000 (14:58 +0800)]
qcow2: fix some errors and typo in qcow2.txt

Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoTeach block/vdi about "discarded" (no longer allocated) blocks
Eric Sunshine [Wed, 26 Oct 2011 19:51:18 +0000 (15:51 -0400)]
Teach block/vdi about "discarded" (no longer allocated) blocks

An entry in the VDI block map will hold an offset to the actual block if
the block is allocated, or one of two specially-interpreted values if
not allocated. Using VirtualBox terminology, value VDI_IMAGE_BLOCK_FREE
(0xffffffff) represents a never-allocated block (semantically arbitrary
content).  VDI_IMAGE_BLOCK_ZERO (0xfffffffe) represents a "discarded"
block (semantically zero-filled).  block/vdi knows only about
VDI_IMAGE_BLOCK_FREE.  Teach it about VDI_IMAGE_BLOCK_ZERO.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoDocumentation: Add iSCSI section
Ronnie Sahlberg [Wed, 26 Oct 2011 12:51:37 +0000 (23:51 +1100)]
Documentation: Add iSCSI section

Add new section for device URL syntax for special files and describe the iSCSI
URL with examples

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoiSCSI block driver
Ronnie Sahlberg [Tue, 25 Oct 2011 08:24:24 +0000 (19:24 +1100)]
iSCSI block driver

This provides built-in support for iSCSI to QEMU.

This has the advantage that the iSCSI devices need not be made visible to the host, which is useful if you have very many virtual machines and very many iscsi devices.
It also has the benefit that non-root users of QEMU can access iSCSI devices across the network without requiring root privilege on the host.

This driver interfaces with the multiplatform posix library for iscsi initiator/client access to iscsi devices hosted at
    git://github.com/sahlberg/libiscsi.git

The patch adds the driver to interface with the iscsi library.
It also updated the configure script to
* by default, probe is libiscsi is available and if so, build
  qemu against libiscsi.
* --enable-libiscsi
  Force a build against libiscsi. If libiscsi is not available
  the build will fail.
* --disable-libiscsi
  Do not link against libiscsi, even if it is available.

When linked with libiscsi, qemu gains support to access iscsi resources such as disks and cdrom directly, without having to make the devices visible to the host.

You can specify devices using a iscsi url of the form :
iscsi://[<username>[:<password>@]]<host>[:<port]/<target-iqn-name>/<lun>
When using authentication, the password can optionally be set with
LIBISCSI_CHAP_PASSWORD="password" to avoid it showing up in the process list

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoMerge branch 'rth/vis2' of git://repo.or.cz/qemu/rth
Blue Swirl [Thu, 27 Oct 2011 20:27:07 +0000 (20:27 +0000)]
Merge branch 'rth/vis2' of git://repo.or.cz/qemu/rth

* 'rth/vis2' of git://repo.or.cz/qemu/rth:
  target-sparc: Implement FALIGNDATA inline.
  target-sparc: Implement BMASK/BSHUFFLE.
  target-sparc: Implement ALIGNADDR* inline.
  target-sparc: Implement EDGE* instructions.
  target-sparc: Implement fpack{16,32,fix}.
  target-sparc: Implement PDIST.
  target-sparc: Do exceptions management fully inside the helpers.
  target-sparc: Change fpr representation to doubles.
  target-sparc: Undo cpu_fpr rename.
  target-sparc: Extract float128 move to a function.
  target-sparc: Extract common code for floating-point operations.
  target-sparc: Make FPU/VIS helpers const when possible.
  target-sparc: Pass float64 parameters instead of dt0/1 temporaries.
  target-sparc: Add accessors for double-precision fpr access.
  target-sparc: Mark fprs dirty in store accessor.
  target-sparc: Add accessors for single-precision fpr access.

12 years agoMerge branch 'target-arm.for-upstream' of git://git.linaro.org/people/pmaydell/qemu-arm
Andrzej Zaborowski [Wed, 26 Oct 2011 23:02:46 +0000 (01:02 +0200)]
Merge branch 'target-arm.for-upstream' of git://git.linaro.org/people/pmaydell/qemu-arm

12 years agotarget-sparc: Implement FALIGNDATA inline.
Richard Henderson [Tue, 18 Oct 2011 16:41:30 +0000 (09:41 -0700)]
target-sparc: Implement FALIGNDATA inline.

This is a relatively simple sequence of shifts.

Signed-off-by: Richard Henderson <rth@twiddle.net>
12 years agotarget-sparc: Implement BMASK/BSHUFFLE.
Richard Henderson [Tue, 18 Oct 2011 16:24:43 +0000 (09:24 -0700)]
target-sparc: Implement BMASK/BSHUFFLE.

Signed-off-by: Richard Henderson <rth@twiddle.net>
12 years agotarget-sparc: Implement ALIGNADDR* inline.
Richard Henderson [Tue, 18 Oct 2011 15:35:58 +0000 (08:35 -0700)]
target-sparc: Implement ALIGNADDR* inline.

While ALIGNADDR was implemented out-of-line, ALIGNADDRL was not
implemeneted at all.  However, this is a very simple operation
so we're better off doing this inline.

Signed-off-by: Richard Henderson <rth@twiddle.net>
12 years agotarget-sparc: Implement EDGE* instructions.
Richard Henderson [Tue, 18 Oct 2011 02:57:23 +0000 (19:57 -0700)]
target-sparc: Implement EDGE* instructions.

Signed-off-by: Richard Henderson <rth@twiddle.net>
12 years agotarget-sparc: Implement fpack{16,32,fix}.
Richard Henderson [Tue, 18 Oct 2011 01:03:47 +0000 (18:03 -0700)]
target-sparc: Implement fpack{16,32,fix}.

Signed-off-by: Richard Henderson <rth@twiddle.net>
12 years agotarget-sparc: Implement PDIST.
Richard Henderson [Tue, 18 Oct 2011 00:32:26 +0000 (17:32 -0700)]
target-sparc: Implement PDIST.

Signed-off-by: Richard Henderson <rth@twiddle.net>
12 years agotarget-sparc: Do exceptions management fully inside the helpers.
Richard Henderson [Mon, 17 Oct 2011 18:25:56 +0000 (11:25 -0700)]
target-sparc: Do exceptions management fully inside the helpers.

This reduces the size of the individual translation blocks, since
we only emit a single call for each FOP rather than three.  In
addition, clear_float_exceptions expands inline to a single byte store.

Signed-off-by: Richard Henderson <rth@twiddle.net>
12 years agotarget-sparc: Change fpr representation to doubles.
Richard Henderson [Mon, 17 Oct 2011 17:42:49 +0000 (10:42 -0700)]
target-sparc: Change fpr representation to doubles.

This allows a more efficient representation for 64-bit hosts.
It should be about the same for 32-bit hosts, as we can still
access the individual pieces of the double.

Signed-off-by: Richard Henderson <rth@twiddle.net>
12 years agotarget-sparc: Undo cpu_fpr rename.
Richard Henderson [Sat, 15 Oct 2011 19:12:02 +0000 (12:12 -0700)]
target-sparc: Undo cpu_fpr rename.

Signed-off-by: Richard Henderson <rth@twiddle.net>
12 years agotarget-sparc: Extract float128 move to a function.
Richard Henderson [Sat, 15 Oct 2011 19:00:08 +0000 (12:00 -0700)]
target-sparc: Extract float128 move to a function.

Signed-off-by: Richard Henderson <rth@twiddle.net>
12 years agotarget-sparc: Extract common code for floating-point operations.
Richard Henderson [Sat, 15 Oct 2011 18:52:00 +0000 (11:52 -0700)]
target-sparc: Extract common code for floating-point operations.

Signed-off-by: Richard Henderson <rth@twiddle.net>
12 years agotarget-sparc: Make FPU/VIS helpers const when possible.
Richard Henderson [Wed, 19 Oct 2011 21:56:43 +0000 (14:56 -0700)]
target-sparc: Make FPU/VIS helpers const when possible.

This also removes the unused ENV parameter from these helpers.

Signed-off-by: Richard Henderson <rth@twiddle.net>
12 years agotarget-sparc: Pass float64 parameters instead of dt0/1 temporaries.
Richard Henderson [Sat, 15 Oct 2011 17:20:20 +0000 (10:20 -0700)]
target-sparc: Pass float64 parameters instead of dt0/1 temporaries.

Signed-off-by: Richard Henderson <rth@twiddle.net>
12 years agotarget-sparc: Add accessors for double-precision fpr access.
Richard Henderson [Fri, 14 Oct 2011 22:47:35 +0000 (15:47 -0700)]
target-sparc: Add accessors for double-precision fpr access.

Begin using i64 quantities to manipulate double-precision values.
On a 64-bit host this will, for the moment, generate less efficient
code; on a 32-bit host code quality should be largely unchanged.
Code quality for 64-bit will be adjusted with a subsequent patch.

Signed-off-by: Richard Henderson <rth@twiddle.net>
12 years agotarget-sparc: Mark fprs dirty in store accessor.
Richard Henderson [Fri, 14 Oct 2011 22:03:25 +0000 (15:03 -0700)]
target-sparc: Mark fprs dirty in store accessor.

Signed-off-by: Richard Henderson <rth@twiddle.net>
12 years agotarget-sparc: Add accessors for single-precision fpr access.
Richard Henderson [Fri, 14 Oct 2011 21:58:32 +0000 (14:58 -0700)]
target-sparc: Add accessors for single-precision fpr access.

Load, store, and "create destination".  This version attempts to
change the behaviour of the translator as little as possible.  We
previously used cpu_tmp32 as the temporary destination, and we
continue to use that.  This will eventually allow a change in
representation of the fprs.

Change the name of the cpu_fpr array to make certain that all
instances are converted.

Signed-off-by: Richard Henderson <rth@twiddle.net>
12 years agoSparc: split load and store op helpers
Blue Swirl [Mon, 1 Aug 2011 10:15:51 +0000 (10:15 +0000)]
Sparc: split load and store op helpers

Move load and store op helpers top ldst_helper.c.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoSparc: convert win_helper to trace framework
Blue Swirl [Sun, 11 Sep 2011 15:53:35 +0000 (15:53 +0000)]
Sparc: convert win_helper to trace framework

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoSparc: convert interrupt helpers to trace framework
Blue Swirl [Sun, 11 Sep 2011 15:05:41 +0000 (15:05 +0000)]
Sparc: convert interrupt helpers to trace framework

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoSparc: convert mmu_helper to trace framework
Blue Swirl [Sun, 11 Sep 2011 14:51:24 +0000 (14:51 +0000)]
Sparc: convert mmu_helper to trace framework

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoSparc: split MMU helpers
Blue Swirl [Sun, 11 Sep 2011 11:30:01 +0000 (11:30 +0000)]
Sparc: split MMU helpers

Move MMU helpers to mmu_helper.c.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoSparc: fix coding style in helper.c
Blue Swirl [Sun, 11 Sep 2011 12:03:08 +0000 (12:03 +0000)]
Sparc: fix coding style in helper.c

Before the next patch, fix coding style of the areas affected.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoSparc: avoid AREG0 for division op helpers
Blue Swirl [Mon, 4 Jul 2011 18:15:42 +0000 (18:15 +0000)]
Sparc: avoid AREG0 for division op helpers

Make [su]div{,cc} helpers take a parameter for CPUState instead
of relying on global env. Move the functions to helper.c.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoSparc: avoid AREG0 for softint op helpers and Leon cache control
Blue Swirl [Mon, 1 Aug 2011 09:20:58 +0000 (09:20 +0000)]
Sparc: avoid AREG0 for softint op helpers and Leon cache control

Make softint op helpers and Leon cache irq manager take a parameter
for CPUState instead of relying on global env. Move the functions
to int{32,64}_helper.c.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoSparc: avoid AREG0 for CWP and PSTATE helpers
Blue Swirl [Sun, 3 Jul 2011 21:01:59 +0000 (21:01 +0000)]
Sparc: avoid AREG0 for CWP and PSTATE helpers

Make CWP and PSTATE helpers take a parameter for CPUState instead
of relying on global env. Remove wrapper functions.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoMerge remote-tracking branch 'kwolf/for-anthony' into staging
Anthony Liguori [Wed, 26 Oct 2011 15:29:24 +0000 (10:29 -0500)]
Merge remote-tracking branch 'kwolf/for-anthony' into staging

12 years agomain-loop: Add missing include file
Stefan Weil [Tue, 25 Oct 2011 20:23:17 +0000 (22:23 +0200)]
main-loop: Add missing include file

stdint.h defines the POSIX data types and is needed
for MinGW-w64 (and maybe other hosts).

v2: Instead of adding stdint.h directly, qemu-common.h is now
included and duplicate include statements were removed.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agotarget-sparc: Fix use of g_new0 / g_free
Stefan Weil [Tue, 25 Oct 2011 05:16:25 +0000 (07:16 +0200)]
target-sparc: Fix use of g_new0 / g_free

g_malloc0 needs g_free instead of free.
While fixing this, I also replaced g_malloc0 by g_new0
as was suggested by Stuart Brady.

Cc: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agotarget-sparc: Fix order of function parameters
Stefan Weil [Mon, 24 Oct 2011 20:29:48 +0000 (22:29 +0200)]
target-sparc: Fix order of function parameters

The MinGW-w64 gcc complains about wrong parameters for
gen_helper_fpadd16_s and three other functions.

gen_helper_fpadd16_s is declared like this (hidden in lots of macros):

static inline void
 gen_helper_fpadd16s(TCGv_i32 retval, TCGv_ptr arg1,
                     TCGv_i32 arg2, TCGv_i32 arg3);

So it looks like cpu_env should be the 2nd parameter.

Please review this patch as I have no environment to test it
(maybe the 1st parameter should be cpu_dst?).

Cc: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agohda: do not mix output and input stream states, RHBZ #740493
Marc-André Lureau [Tue, 25 Oct 2011 14:53:01 +0000 (16:53 +0200)]
hda: do not mix output and input stream states, RHBZ #740493

Windows 7 may use the same stream number for input and output.
Current code will confuse streams.

Changes since v1:
- keep running_compat[] for migration version 1
- add running_real[] for migration version 2

Signed-off-by: Marc-Andr? Lureau <marcandre.lureau@redhat.com>
Signed-off-by: malc <av1474@comtv.ru>
12 years agohda: do not mix output and input streams, RHBZ #740493
Marc-André Lureau [Tue, 25 Oct 2011 14:53:00 +0000 (16:53 +0200)]
hda: do not mix output and input streams, RHBZ #740493

Windows 7 may use the same stream number for input and output.
That will result in lot of garbage on playback.

The hardcoded value of 4 needs to be in sync with GCAP streams
description and IN/OUT registers.

Signed-off-by: Marc-Andr? Lureau <marcandre.lureau@redhat.com>
Signed-off-by: malc <av1474@comtv.ru>
12 years agoMerge remote-tracking branch 'bonzini/split-main-loop-for-anthony' into staging
Anthony Liguori [Mon, 24 Oct 2011 15:51:12 +0000 (10:51 -0500)]
Merge remote-tracking branch 'bonzini/split-main-loop-for-anthony' into staging

12 years agoAdd stdio char device on windows
Fabien Chouteau [Thu, 6 Oct 2011 14:37:51 +0000 (16:37 +0200)]
Add stdio char device on windows

Simple implementation of an stdio char device on Windows.

Signed-off-by: Fabien Chouteau <chouteau@adacore.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoSparc: split CWP and PSTATE op helpers
Blue Swirl [Mon, 1 Aug 2011 09:03:20 +0000 (09:03 +0000)]
Sparc: split CWP and PSTATE op helpers

Move CWP and PSTATE op helpers to win_helper.c.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoSparc: avoid AREG0 for lazy condition code helpers
Blue Swirl [Sun, 3 Jul 2011 16:01:57 +0000 (16:01 +0000)]
Sparc: avoid AREG0 for lazy condition code helpers

Make lazy condition code helpers take a parameter for CPUState instead
of relying on global env.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoSparc: split lazy condition code handling op helpers
Blue Swirl [Mon, 1 Aug 2011 08:37:36 +0000 (08:37 +0000)]
Sparc: split lazy condition code handling op helpers

Move lazy condition code handling op helpers to cc_helper.c.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoSparc: avoid AREG0 for float and VIS ops
Blue Swirl [Sun, 3 Jul 2011 10:42:23 +0000 (10:42 +0000)]
Sparc: avoid AREG0 for float and VIS ops

Make floating point and VIS ops take a parameter for CPUState instead
of relying on global env.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoSparc: split FPU and VIS op helpers
Blue Swirl [Mon, 1 Aug 2011 07:37:45 +0000 (07:37 +0000)]
Sparc: split FPU and VIS op helpers

Move FPU op helpers to fop_helper.c. Move VIS op helpers to vis_helper.c,
compile it only for Sparc64.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoSparc: fix coding style
Blue Swirl [Sun, 3 Jul 2011 15:22:03 +0000 (15:22 +0000)]
Sparc: fix coding style

Before the next patches, fix coding style of the areas affected.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoSparc: avoid AREG0 for raise_exception and helper_debug
Blue Swirl [Sun, 3 Jul 2011 08:19:42 +0000 (08:19 +0000)]
Sparc: avoid AREG0 for raise_exception and helper_debug

Make raise_exception() and helper_debug() take a parameter for
CPUState instead of relying on global env. Move the functions
to helper.c.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoSparc: move trivial functions from op_helper.c
Blue Swirl [Sun, 3 Jul 2011 07:05:50 +0000 (07:05 +0000)]
Sparc: move trivial functions from op_helper.c

These functions don't need access to CPUState or already pass it,
so relocating them from op_helper.c to helper.c and int64_helper.c
is trivial.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoSparc: split helper.c
Blue Swirl [Sun, 11 Sep 2011 09:33:40 +0000 (09:33 +0000)]
Sparc: split helper.c

Move CPU init to cpu_init.c and interrupt handling to int32_helper.c
for Sparc32 and int64_helper.c for Sparc64.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoSparc: fix coding style
Blue Swirl [Sun, 11 Sep 2011 09:42:13 +0000 (09:42 +0000)]
Sparc: fix coding style

Before the next patch, fix coding style of the areas affected.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agom48t59: fix write access
Blue Swirl [Sat, 15 Oct 2011 08:05:18 +0000 (08:05 +0000)]
m48t59: fix write access

Fix incorrect order of arguments, letting writes to NVRAM succeed.

It looks like guests never write to the device, only read from it, since the bug
originates back to 819385c58b319d9f80d676cefaed0610118f03ac.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agom48t59: drop obsolete address base arithmetic
Blue Swirl [Sat, 15 Oct 2011 07:57:49 +0000 (07:57 +0000)]
m48t59: drop obsolete address base arithmetic

Remove now incorrect address base arithmetic, missed by
9936d6e42392f1440505dfa9df065eabd251cadf. Fixes Sparc64 boot.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agopci_bridge: fix typo
Blue Swirl [Sun, 16 Oct 2011 14:43:00 +0000 (14:43 +0000)]
pci_bridge: fix typo

Reviewed-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agosimplify main loop functions
Paolo Bonzini [Mon, 12 Sep 2011 12:03:13 +0000 (14:03 +0200)]
simplify main loop functions

Provide a clean example of how to use the main loop in the tools.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoRevert to a hand-made select loop
Paolo Bonzini [Mon, 12 Sep 2011 12:59:42 +0000 (14:59 +0200)]
Revert to a hand-made select loop

This reverts commit c82dc29a9112f34e0a51cad9a412cf6d9d05dfb2
and 4d88a2ac8643265108ef1fb47ceee5d7b28e19f2.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agomain-loop: create main-loop.c
Paolo Bonzini [Tue, 13 Sep 2011 08:30:52 +0000 (10:30 +0200)]
main-loop: create main-loop.c

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agomain-loop: create main-loop.h
Paolo Bonzini [Mon, 12 Sep 2011 14:44:30 +0000 (16:44 +0200)]
main-loop: create main-loop.h

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoqemu-timer: do not use RunState change handlers
Paolo Bonzini [Tue, 27 Sep 2011 16:23:14 +0000 (18:23 +0200)]
qemu-timer: do not use RunState change handlers

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoqemu-timer: move more stuff out of qemu-timer.c
Paolo Bonzini [Mon, 12 Sep 2011 14:21:44 +0000 (16:21 +0200)]
qemu-timer: move more stuff out of qemu-timer.c

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoqemu-timer: use atexit for quit_timers
Paolo Bonzini [Mon, 19 Sep 2011 08:18:51 +0000 (10:18 +0200)]
qemu-timer: use atexit for quit_timers

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoqemu-timer: do not refer to runstate_is_running()
Paolo Bonzini [Mon, 12 Sep 2011 12:40:36 +0000 (14:40 +0200)]
qemu-timer: do not refer to runstate_is_running()

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoqemu-timer: move icount to cpus.c
Paolo Bonzini [Mon, 12 Sep 2011 11:57:37 +0000 (13:57 +0200)]
qemu-timer: move icount to cpus.c

None of this is needed by tools, and most of it can even be made static
inside cpus.c.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoqemu-timer: more clock functions
Paolo Bonzini [Mon, 12 Sep 2011 13:50:16 +0000 (15:50 +0200)]
qemu-timer: more clock functions

These will be used when moving icount accounting to cpus.c.

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoqemu-timer: move common code to qemu_rearm_alarm_timer
Paolo Bonzini [Mon, 14 Mar 2011 08:45:38 +0000 (09:45 +0100)]
qemu-timer: move common code to qemu_rearm_alarm_timer

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoqemu-timer: remove active_timers array
Paolo Bonzini [Tue, 13 Sep 2011 09:42:26 +0000 (11:42 +0200)]
qemu-timer: remove active_timers array

Embed the list in the QEMUClock instead.

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoremove unused function
Paolo Bonzini [Mon, 12 Sep 2011 13:17:57 +0000 (15:17 +0200)]
remove unused function

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agocompatfd.c: Don't pass NULL pointer to SYS_signalfd
Peter Maydell [Thu, 13 Oct 2011 17:45:37 +0000 (18:45 +0100)]
compatfd.c: Don't pass NULL pointer to SYS_signalfd

Don't pass a NULL pointer in to SYS_signalfd in qemu_signalfd_available():
this isn't valid and Valgrind complains about it.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
12 years agolinux-user: Fix broken "-version" option
Peter Maydell [Thu, 29 Sep 2011 14:48:12 +0000 (15:48 +0100)]
linux-user: Fix broken "-version" option

Fix the "-version" option, which was accidentally broken in commit
fc9c541:
 * exit after printing version information rather than proceeding
   blithely onward (and likely printing the full usage message)
 * correct the cut-n-paste error in the usage message for it
 * don't insist on the presence of a following argument for
   options which don't take an argument (this was preventing
   'qemu-arm -version' from working)
 * remove a spurious argc check from the beginning of main() which
   meant 'QEMU_VERSION=1 qemu-arm' didn't work.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
12 years agoblock: change discard to co_discard
Paolo Bonzini [Thu, 20 Oct 2011 11:16:25 +0000 (13:16 +0200)]
block: change discard to co_discard

Since coroutine operation is now mandatory, convert both bdrv_discard
implementations to coroutines.  For qcow2, this means taking the lock
around the operation.  raw-posix remains synchronous.

The bdrv_discard callback is then unused and can be eliminated.

Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoblock: change flush to co_flush
Paolo Bonzini [Thu, 20 Oct 2011 11:16:24 +0000 (13:16 +0200)]
block: change flush to co_flush

Since coroutine operation is now mandatory, convert all bdrv_flush
implementations to coroutines.  For qcow2, this means taking the lock.
Other implementations are simpler and just forward bdrv_flush to the
underlying protocol, so they can avoid the lock.

The bdrv_flush callback is then unused and can be eliminated.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoblock: take lock around bdrv_write implementations
Paolo Bonzini [Thu, 20 Oct 2011 11:16:23 +0000 (13:16 +0200)]
block: take lock around bdrv_write implementations

This does the first part of the conversion to coroutines, by
wrapping bdrv_write implementations to take the mutex.

Drivers that implement bdrv_write rather than bdrv_co_writev can
then benefit from asynchronous operation (at least if the underlying
protocol supports it, which is not the case for raw-win32), even
though they still operate with a bounce buffer.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoblock: take lock around bdrv_read implementations
Paolo Bonzini [Thu, 20 Oct 2011 11:16:22 +0000 (13:16 +0200)]
block: take lock around bdrv_read implementations

This does the first part of the conversion to coroutines, by
wrapping bdrv_read implementations to take the mutex.

Drivers that implement bdrv_read rather than bdrv_co_readv can
then benefit from asynchronous operation (at least if the underlying
protocol supports it, which is not the case for raw-win32), even
though they still operate with a bounce buffer.

raw-win32 does not need the lock, because it cannot yield.
nbd also doesn't probably, but better be safe.

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