OSDN Git Service

qmiga/qemu.git
9 years agoqtest/ahci: halted NCQ test
John Snow [Sat, 4 Jul 2015 06:06:05 +0000 (02:06 -0400)]
qtest/ahci: halted NCQ test

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 1435767578-32743-10-git-send-email-jsnow@redhat.com

9 years agoahci: correct ncq sector count
John Snow [Sat, 4 Jul 2015 06:06:05 +0000 (02:06 -0400)]
ahci: correct ncq sector count

uint16_t isn't enough to hold the real sector count, since a value of
zero implies a full 64K sectors, so we need a uint32_t here.

We *could* cheat and pretend that this value is 0-based and fit it in
a uint16_t, but I'd rather waste 2 bytes instead of a future dev's
10 minutes when they forget to +1/-1 accordingly somewhere.

See SATA 3.2, section 13.6.4.1 "READ FPDMA QUEUED".

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 1435767578-32743-9-git-send-email-jsnow@redhat.com

9 years agoahci: correct types in NCQTransferState
John Snow [Sat, 4 Jul 2015 06:06:05 +0000 (02:06 -0400)]
ahci: correct types in NCQTransferState

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 1435767578-32743-8-git-send-email-jsnow@redhat.com

9 years agoahci: add rwerror=stop support for ncq
John Snow [Sat, 4 Jul 2015 06:06:04 +0000 (02:06 -0400)]
ahci: add rwerror=stop support for ncq

Handle NCQ failures for cases where we want to halt the VM on IO errors.
Upon a VM state change, retry the halted NCQ commands.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 1435767578-32743-7-git-send-email-jsnow@redhat.com

9 years agoahci: factor ncq_finish out of ncq_cb
John Snow [Sat, 4 Jul 2015 06:06:04 +0000 (02:06 -0400)]
ahci: factor ncq_finish out of ncq_cb

When we add werror=stop or rerror=stop support to NCQ,
we'll want to take a codepath where we don't actually
complete the command, so factor that out into a new routine.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 1435767578-32743-6-git-send-email-jsnow@redhat.com

9 years agoahci: refactor process_ncq_command
John Snow [Sat, 4 Jul 2015 06:06:04 +0000 (02:06 -0400)]
ahci: refactor process_ncq_command

Split off execute_ncq_command so that we can call
it separately later if we desire.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 1435767578-32743-5-git-send-email-jsnow@redhat.com

9 years agoahci: assert is_ncq for process_ncq
John Snow [Sat, 4 Jul 2015 06:06:04 +0000 (02:06 -0400)]
ahci: assert is_ncq for process_ncq

We already checked this in the handle_cmd phase, so just
change this to an assertion and simplify the error logic.

(Also, fix the switch indent, because checkpatch.pl yelled.)
((Sorry for churn.))

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 1435767578-32743-4-git-send-email-jsnow@redhat.com

9 years agoahci: stash ncq command
John Snow [Sat, 4 Jul 2015 06:06:04 +0000 (02:06 -0400)]
ahci: stash ncq command

For migration and werror=stop/rerror=stop resume purposes,
it will be convenient to have the command handy inside of
ncq_tfs.

Eventually, we'd like to avoid reading from the FIS entirely
after the initial read, so this is a byte (hah!) sized step
in that direction.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 1435767578-32743-3-git-send-email-jsnow@redhat.com

9 years agoide: add limit to .prepare_buf()
John Snow [Sat, 4 Jul 2015 06:06:04 +0000 (02:06 -0400)]
ide: add limit to .prepare_buf()

prepare_buf should not always grab as many descriptors
as it can, sometimes it should self-limit.

For example, an NCQ transfer of 1 sector with a PRDT that
describes 4GiB of data should not copy 4GiB of data, it
should just transfer that first 512 bytes.

PIO is not affected, because the dma_buf_rw dma helpers
already have a byte limit built-in to them, but DMA/NCQ
will exhaust the entire list regardless of requested size.

AHCI 1.3 specifies in section 6.1.6 Command List Underflow that
NCQ is not required to detect underflow conditions. Non-NCQ
pathways signal underflow by writing to the PRDBC field, which
will already occur by writing the actual transferred byte count
to the PRDBC, signaling the underflow.

Our NCQ pathways aren't required to detect underflow, but since our DMA
backend uses the size of the PRDT to determine the size of the transer,
if our PRDT is bigger than the transaction (the underflow condition) it
doesn't cost us anything to detect it and truncate the PRDT.

This is a recoverable error and is not signaled to the guest, in either
NCQ or normal DMA cases.

For BMDMA, the existing pathways should see no guest-visible difference,
but any bytes described in the overage will no longer be transferred
before indicating to the guest that there was an underflow.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 1435767578-32743-2-git-send-email-jsnow@redhat.com

9 years agoqtest/ahci: ncq migration test
John Snow [Sat, 4 Jul 2015 06:06:04 +0000 (02:06 -0400)]
qtest/ahci: ncq migration test

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 1435016308-6150-17-git-send-email-jsnow@redhat.com

9 years agoqtest/ahci: simple ncq data test
John Snow [Sat, 4 Jul 2015 06:06:04 +0000 (02:06 -0400)]
qtest/ahci: simple ncq data test

Test the NCQ pathways for a simple IO RW test.
Also, test that libqos doesn't explode when
running NCQ commands :)

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 1435016308-6150-16-git-send-email-jsnow@redhat.com

9 years agolibqos/ahci: Force all NCQ commands to be LBA48
John Snow [Sat, 4 Jul 2015 06:06:04 +0000 (02:06 -0400)]
libqos/ahci: Force all NCQ commands to be LBA48

NCQ commands are LBA48 by definition.

See SATA 3.2 13.6.4.1 "READ FPDMA QUEUED", or
    SATA 3.2 13.6.5.1 "WRITE FPDMA QUEUED."

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 1435016308-6150-15-git-send-email-jsnow@redhat.com

9 years agolibqos/ahci: set the NCQ tag on command_commit
John Snow [Sat, 4 Jul 2015 06:06:04 +0000 (02:06 -0400)]
libqos/ahci: set the NCQ tag on command_commit

NCQ commands have the concept of a "TAG" that they need to set,
but in the AHCI world, it is mandated that the TAG always match
the command slot that you executed the NCQ from.

See AHCI 9.3.1.1.5.2 "Native Queued Commands".

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 1435016308-6150-14-git-send-email-jsnow@redhat.com

9 years agolibqos/ahci: adjust expected NCQ interrupts
John Snow [Sat, 4 Jul 2015 06:06:04 +0000 (02:06 -0400)]
libqos/ahci: adjust expected NCQ interrupts

NCQ commands will expect the SDBS interrupt,
and in the normative case, do not expect to see
a D2H Register FIS unless something went wrong.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 1435016308-6150-13-git-send-email-jsnow@redhat.com

9 years agolibqos/ahci: edit wait to be ncq aware
John Snow [Sat, 4 Jul 2015 06:06:03 +0000 (02:06 -0400)]
libqos/ahci: edit wait to be ncq aware

The wait command should check to make sure SACT is clear as well
as the Command Issue register.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 1435016308-6150-12-git-send-email-jsnow@redhat.com

9 years agolibqos/ahci: add NCQ frame support
John Snow [Sat, 4 Jul 2015 06:06:03 +0000 (02:06 -0400)]
libqos/ahci: add NCQ frame support

NCQ frames are generated a little differently than
their non-NCQ cousins. Add support for them.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 1435016308-6150-11-git-send-email-jsnow@redhat.com

9 years agolibqos/ahci: fix cmd_sanity for ncq
John Snow [Sat, 4 Jul 2015 06:06:03 +0000 (02:06 -0400)]
libqos/ahci: fix cmd_sanity for ncq

NCQ commands should not / do not update the byte count
in the command header post command, so this field is
meaningless for NCQ tests.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 1435016308-6150-10-git-send-email-jsnow@redhat.com

9 years agoahci/qtest: Execute IDENTIFY prior to data commands
John Snow [Sat, 4 Jul 2015 06:06:03 +0000 (02:06 -0400)]
ahci/qtest: Execute IDENTIFY prior to data commands

If you try to execute an NCQ command before trying to engage with the
device by issuing an IDENTIFY command, the error bits that are part of
the signature will fool the test suite into thinking there was a failure.

Issue IDENTIFY first on "boot", which will clear the signature out of
the registers for us.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 1435016308-6150-9-git-send-email-jsnow@redhat.com

9 years agoahci: ncq sector count correction
John Snow [Sat, 4 Jul 2015 06:06:03 +0000 (02:06 -0400)]
ahci: ncq sector count correction

This value should not be size-corrected, 0 sectors does not imply
1 sector(s). This is just debug information, but it's misleading!

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 1435016308-6150-8-git-send-email-jsnow@redhat.com

9 years agoahci: add ncq debug checks
John Snow [Sat, 4 Jul 2015 06:06:03 +0000 (02:06 -0400)]
ahci: add ncq debug checks

Most of the time, these bits can be safely ignored. For the purposes
of debugging however, it's nice to know that they're not being used.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 1435016308-6150-7-git-send-email-jsnow@redhat.com

9 years agoahci: separate prdtl from opts
John Snow [Sat, 4 Jul 2015 06:06:03 +0000 (02:06 -0400)]
ahci: separate prdtl from opts

There's no real reason to have it bundled together, and this way
is a little nicer to follow if you have the AHCI spec pulled up.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 1435016308-6150-6-git-send-email-jsnow@redhat.com

9 years agoahci: check for ncq prdtl overflow
John Snow [Sat, 4 Jul 2015 06:06:03 +0000 (02:06 -0400)]
ahci: check for ncq prdtl overflow

Don't attempt the NCQ transfer if the PRDT we were given is not big
enough to perform the entire transfer.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 1435016308-6150-5-git-send-email-jsnow@redhat.com

9 years agoahci: add ncq_err helper
John Snow [Sat, 4 Jul 2015 06:06:03 +0000 (02:06 -0400)]
ahci: add ncq_err helper

Set some appropriate error bits for NCQ for us.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 1435016308-6150-4-git-send-email-jsnow@redhat.com

9 years agoahci: use shorter variables
John Snow [Sat, 4 Jul 2015 06:06:03 +0000 (02:06 -0400)]
ahci: use shorter variables

Trivial cleanup that I didn't want to tack-on to anything else.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 1435016308-6150-3-git-send-email-jsnow@redhat.com

9 years agoahci: Rename NCQFIS structure fields
John Snow [Sat, 4 Jul 2015 06:06:03 +0000 (02:06 -0400)]
ahci: Rename NCQFIS structure fields

Several fields of the NCQFIS structure are ambiguously named. This patch
clarifies the intended (if unsupported) usage of the NCQ fields to aid
in creating more meaningful debug messages through the NCQ codepaths.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 1435016308-6150-2-git-send-email-jsnow@redhat.com

9 years agoqtest/ahci: add port_reset test
John Snow [Sat, 4 Jul 2015 06:06:02 +0000 (02:06 -0400)]
qtest/ahci: add port_reset test

Test that we can survive a couple of cycles of running a basic identify
test, some IO, and resetting the HBA. Ensures that we can bring the HBA
back to compliant spec during the lifecycle of the VM.

Signed-off-by: John Snow <jsnow@redhat.com>
Message-id: 1434470575-21625-5-git-send-email-jsnow@redhat.com

9 years agolibqos/ahci: fix memory management bugs
John Snow [Sat, 4 Jul 2015 06:06:02 +0000 (02:06 -0400)]
libqos/ahci: fix memory management bugs

There's a handful of trivial bugs in the libqos/ahci functions,
squish them together.

- Zero cached pointers after freeing them
- The Command List Buffer is an array of 32x 32 byte structures, not
  32x 8 byte pointers -- it's 1MiB, not 256 bytes. Zero it ALL.
- Free the correct command in ahci_pick_cmd.

Signed-off-by: John Snow <jsnow@redhat.com>
Message-id: 1434470575-21625-4-git-send-email-jsnow@redhat.com

9 years agoqtest/ahci: add test_max
John Snow [Sat, 4 Jul 2015 06:06:02 +0000 (02:06 -0400)]
qtest/ahci: add test_max

Test that the FIS delivered after a nondata command has appropriately
updated registers, just as we'd expect a data command to do.

Signed-off-by: John Snow <jsnow@redhat.com>
Message-id: 1434470575-21625-3-git-send-email-jsnow@redhat.com

9 years agoahci: Do not ignore memory access read size
John Snow [Sat, 4 Jul 2015 06:06:02 +0000 (02:06 -0400)]
ahci: Do not ignore memory access read size

The only guidance the AHCI specification gives on memory access is:
"Register accesses shall have a maximum size of 64-bits; 64-bit access
must not cross an 8-byte alignment boundary."

I interpret this to mean that aligned or unaligned 1, 2 and 4 byte
accesses should work, as well as aligned 8 byte accesses.

In practice, a real Q35/ICH9 responds to 1, 2, 4 and 8 byte reads
regardless of alignment. Windows 7 can be observed making 1 byte
reads to the middle of 32 bit registers to fetch error codes.

Introduce a wrapper to support unaligned accesses to AHCI.
This wrapper will support aligned 8 byte reads, but will make
no effort to support unaligned 8 byte reads, which although they
will work on real hardware, are not guaranteed to work and do
not appear to be used by either Windows or Linux.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 1434470575-21625-2-git-send-email-jsnow@redhat.com

9 years agoMerge remote-tracking branch 'remotes/kraxel/tags/pull-input-20150703-1' into staging
Peter Maydell [Fri, 3 Jul 2015 11:05:31 +0000 (12:05 +0100)]
Merge remote-tracking branch 'remotes/kraxel/tags/pull-input-20150703-1' into staging

virtio-input: add input routing support, update multiseat docs.

# gpg: Signature made Fri Jul  3 11:22:33 2015 BST using RSA key ID D3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"

* remotes/kraxel/tags/pull-input-20150703-1:
  update pci-bridge-seat section in docs/multiseat.txt
  virtio-input: add input routing support

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agoupdate pci-bridge-seat section in docs/multiseat.txt
Gerd Hoffmann [Wed, 1 Jul 2015 08:59:47 +0000 (10:59 +0200)]
update pci-bridge-seat section in docs/multiseat.txt

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agovirtio-input: add input routing support
Gerd Hoffmann [Wed, 24 Jun 2015 09:59:16 +0000 (11:59 +0200)]
virtio-input: add input routing support

Add display and head properties for input routing to
virtio-input devices, update multiseat documentation.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agoMerge remote-tracking branch 'remotes/cohuck/tags/s390x-20150702-v3' into staging
Peter Maydell [Thu, 2 Jul 2015 14:20:55 +0000 (15:20 +0100)]
Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20150702-v3' into staging

Several s390x patches including:
- missing virtio-1 related code for virtio-ccw
- bugfixes in ipl device, gdb, virtio-ccw
- bugfix in s390-ccw bios + rebuild
- introduce versioned machines for s390-ccw-virtio

# gpg: Signature made Thu Jul  2 15:05:34 2015 BST using RSA key ID C6F02FAF
# gpg: Good signature from "Cornelia Huck <huckc@linux.vnet.ibm.com>"
# gpg:                 aka "Cornelia Huck <cornelia.huck@de.ibm.com>"

* remotes/cohuck/tags/s390x-20150702-v3:
  s390x/migration: Introduce 2.4 machine
  s390x/gdb: synchronize cpu state after modifying acrs
  s390x/ipl: Fix boot if no bootindex was specified
  virtio-ccw: migrate ->revision
  s390x/virtio-ccw: support virtio-1 set_vq format
  s390x/virtio-ccw: add virtio set-revision call
  s390x/css: Add a callback for when subchannel gets disabled
  s390-ccw.img: update
  s390-ccw.img: Consume service interrupts
  css: mss/mcss-e vs. migration
  virtio-ccw: complete handling of guest-initiated resets

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agos390x/migration: Introduce 2.4 machine
Christian Borntraeger [Wed, 1 Jul 2015 09:16:57 +0000 (11:16 +0200)]
s390x/migration: Introduce 2.4 machine

The section footer changes commit f68945d42bab ("Add a protective
section footer") and commit 37fb569c0198 ("Disable section footers
on older machine types") broke migration for any non-versioned
machines.

This pinpoints a problem of s390-ccw machines: it needs to
be versioned to be compatible with future changes in common
code data structures such as section footers.

Let's introduce a version scheme for s390-ccw-virtio machines.
We will use the old s390-ccw-virtio name as alias to the latest
version as all existing libvirt XML for the ccw type were expanded
by libvirt to that name.

The only downside of this patch is, that the old alias s390-ccw
will no longer be available as machines can have only one alias,
but it should not really matter.

Cc: Dr. David Alan Gilbert <dgilbert@redhat.com>
Cc: Juan Quintela <quintela@redhat.com>
Cc: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
Cc: Jason J. Herne <jjherne@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Message-Id: <1435742217-62246-1-git-send-email-borntraeger@de.ibm.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
9 years agos390x/gdb: synchronize cpu state after modifying acrs
David Hildenbrand [Tue, 23 Jun 2015 07:10:51 +0000 (09:10 +0200)]
s390x/gdb: synchronize cpu state after modifying acrs

Whenever we touch the access control registers, we have to make sure that
the values will make it into kvm. Otherwise the change will simply be lost.

When synchronizing qemu and kvm, a normal KVM_PUT_RUNTIME_STATE does not take
care of these registers. Let's simply trigger a KVM_PUT_FULL_STATE sync,
so the values will directly be written to kvm. The performance overhead can
be ignored and this is much cleaner than manually writing these registers to kvm
via our two supported ways.

Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
9 years agos390x/ipl: Fix boot if no bootindex was specified
Christian Borntraeger [Thu, 18 Jun 2015 14:37:39 +0000 (16:37 +0200)]
s390x/ipl: Fix boot if no bootindex was specified

commit fa92e218df1d ("s390x/ipl: avoid sign extension") introduced
a regression:

qemu-system-s390x -drive file=image.qcow,format=qcow2
does not boot, the bios states
"No virtio-blk device found!"

adding bootindex=1 does boot.

The reason is that the uint32_t as return value will not do the right
thing for the return -1 (default without bootindex).
The bios itself, will interpret a 64bit -1 as autodetect (but it will
interpret 32bit -1 as ccw device address ff.ff.ffff)

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Cornelia Huck <cornelia.huck@de.ibm.com>
Cc: qemu-stable@nongnu.org # v2.3.0
Tested-by: Aurelien Jarno <aurelien@aurel32.net>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
9 years agovirtio-ccw: migrate ->revision
Cornelia Huck [Thu, 25 Jun 2015 10:20:08 +0000 (12:20 +0200)]
virtio-ccw: migrate ->revision

We need to migrate the revision field as well. No compatibility
concerns as we already introduced migration of ->config_vector in
this release.

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
9 years agos390x/virtio-ccw: support virtio-1 set_vq format
Cornelia Huck [Thu, 11 Dec 2014 13:25:13 +0000 (14:25 +0100)]
s390x/virtio-ccw: support virtio-1 set_vq format

Support the new CCW_CMD_SET_VQ format for virtio-1 devices.

While we're at it, refactor the code a bit and enforce big endian
fields (which had always been required, even for legacy).

Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
9 years agos390x/virtio-ccw: add virtio set-revision call
Thomas Huth [Thu, 11 Dec 2014 13:25:12 +0000 (14:25 +0100)]
s390x/virtio-ccw: add virtio set-revision call

Handle the virtio-ccw revision according to what the guest sets.
When revision 1 is selected, we have a virtio-1 standard device
with byteswapping for the virtio rings.

When a channel gets disabled, we have to revert to the legacy behavior
in case the next user of the device does not negotiate the revision 1
anymore (e.g. the boot firmware uses revision 1, but the operating
system only uses the legacy mode).

Note that revisions > 0 are still disabled.

[CH: assure memory accesses are always BE]
Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
9 years agoMerge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging
Peter Maydell [Thu, 2 Jul 2015 09:44:34 +0000 (10:44 +0100)]
Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging

# gpg: Signature made Thu Jul  2 10:10:39 2015 BST using RSA key ID 81AB73C8
# gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>"
# gpg:                 aka "Stefan Hajnoczi <stefanha@gmail.com>"

* remotes/stefanha/tags/block-pull-request:
  block: remove redundant check before g_slist_find()
  block/nfs: limit maximum readahead size to 1MB
  block/iscsi: restore compatiblity with libiscsi 1.9.0
  iotests: Use event_wait in wait_ready
  qemu-iotests: Add test case for mirror with unmap
  qemu-iotests: Make block job methods common
  block: Remove bdrv_reset_dirty
  block: Fix dirty bitmap in bdrv_co_discard
  mirror: Do zero write on target if sectors not allocated
  qmp: Add optional bool "unmap" to drive-mirror
  block: Add bdrv_get_block_status_above
  timer: Use a single definition of NSEC_PER_SEC for the whole codebase
  timer: Move NANOSECONDS_PER_SECONDS to timer.h
  blockdev: no need to drain+flush in hmp_drive_del
  qapi: Rename 'dirty-bitmap' mode to 'incremental'
  qcow2: Handle EAGAIN returned from update_refcount
  block/iscsi: add support for request timeouts

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agoblock: remove redundant check before g_slist_find()
Alberto Garcia [Mon, 29 Jun 2015 13:12:13 +0000 (16:12 +0300)]
block: remove redundant check before g_slist_find()

An empty GSList is represented by a NULL pointer, therefore it's a
perfectly valid argument for g_slist_find() and there's no need to
make any additional check.

Signed-off-by: Alberto Garcia <berto@igalia.com>
Message-id: 1435583533-5758-1-git-send-email-berto@igalia.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9 years agoblock/nfs: limit maximum readahead size to 1MB
Peter Lieven [Fri, 26 Jun 2015 11:14:01 +0000 (13:14 +0200)]
block/nfs: limit maximum readahead size to 1MB

a malicious caller could otherwise specify a very
large value via the URI and force libnfs to allocate
a large amount of memory for the readahead buffer.

Cc: qemu-stable@nongnu.org
Signed-off-by: Peter Lieven <pl@kamp.de>
Message-id: 1435317241-25585-1-git-send-email-pl@kamp.de
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9 years agoblock/iscsi: restore compatiblity with libiscsi 1.9.0
Peter Lieven [Fri, 26 Jun 2015 10:18:01 +0000 (12:18 +0200)]
block/iscsi: restore compatiblity with libiscsi 1.9.0

RHEL7 and others are stuck with libiscsi 1.9.0 since there
unfortunately was an ABI breakage after that release.

Signed-off-by: Peter Lieven <pl@kamp.de>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 1435313881-19366-1-git-send-email-pl@kamp.de
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9 years agoiotests: Use event_wait in wait_ready
Fam Zheng [Mon, 8 Jun 2015 05:56:14 +0000 (13:56 +0800)]
iotests: Use event_wait in wait_ready

Only poll the specific type of event we are interested in, to avoid
stealing events that should be consumed by someone else.

Suggested-by: John Snow <jsnow@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9 years agoqemu-iotests: Add test case for mirror with unmap
Fam Zheng [Mon, 8 Jun 2015 05:56:13 +0000 (13:56 +0800)]
qemu-iotests: Add test case for mirror with unmap

This checks that the discard on mirror source that effectively zeroes
data is also reflected by the data of target.

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9 years agoqemu-iotests: Make block job methods common
Fam Zheng [Mon, 8 Jun 2015 05:56:12 +0000 (13:56 +0800)]
qemu-iotests: Make block job methods common

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9 years agoblock: Remove bdrv_reset_dirty
Fam Zheng [Mon, 8 Jun 2015 05:56:11 +0000 (13:56 +0800)]
block: Remove bdrv_reset_dirty

Using this function would always be wrong because a dirty bitmap must
have a specific owner that consumes the dirty bits and calls
bdrv_reset_dirty_bitmap().

Remove the unused function to avoid future misuse.

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9 years agoblock: Fix dirty bitmap in bdrv_co_discard
Fam Zheng [Mon, 8 Jun 2015 05:56:10 +0000 (13:56 +0800)]
block: Fix dirty bitmap in bdrv_co_discard

Unsetting dirty globally with discard is not very correct. The discard may zero
out sectors (depending on can_write_zeroes_with_unmap), we should replicate
this change to destination side to make sure that the guest sees the same data.

Calling bdrv_reset_dirty also troubles mirror job because the hbitmap iterator
doesn't expect unsetting of bits after current position.

So let's do it the opposite way which fixes both problems: set the dirty bits
if we are to discard it.

Reported-by: wangxiaolong@ucloud.cn
Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9 years agomirror: Do zero write on target if sectors not allocated
Fam Zheng [Mon, 8 Jun 2015 05:56:09 +0000 (13:56 +0800)]
mirror: Do zero write on target if sectors not allocated

If guest discards a source cluster, mirroring with bdrv_aio_readv is overkill.
Some protocols do zero upon discard, where it's best to use
bdrv_aio_write_zeroes, otherwise, bdrv_aio_discard will be enough.

Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9 years agoqmp: Add optional bool "unmap" to drive-mirror
Fam Zheng [Mon, 8 Jun 2015 05:56:08 +0000 (13:56 +0800)]
qmp: Add optional bool "unmap" to drive-mirror

If specified as "true", it allows discarding on target sectors where source is
not allocated.

Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9 years agoblock: Add bdrv_get_block_status_above
Fam Zheng [Mon, 8 Jun 2015 05:56:07 +0000 (13:56 +0800)]
block: Add bdrv_get_block_status_above

Like bdrv_is_allocated_above, this function follows the backing chain until seeing
BDRV_BLOCK_ALLOCATED.  Base is not included.

Reimplement bdrv_is_allocated on top.

[Initialized bdrv_co_get_block_status_above() ret to 0 to silence
mingw64 compiler warning about the unitialized variable.  assert(bs !=
base) prevents that case but I suppose the program could be compiled
with -DNDEBUG.
--Stefan]

Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9 years agotimer: Use a single definition of NSEC_PER_SEC for the whole codebase
Alberto Garcia [Fri, 12 Jun 2015 13:01:30 +0000 (16:01 +0300)]
timer: Use a single definition of NSEC_PER_SEC for the whole codebase

Signed-off-by: Alberto Garcia <berto@igalia.com>
Message-id: c6e55468856ba0b8f95913c4da111cc0ef266541.1434113783.git.berto@igalia.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9 years agotimer: Move NANOSECONDS_PER_SECONDS to timer.h
Alberto Garcia [Fri, 12 Jun 2015 13:01:29 +0000 (16:01 +0300)]
timer: Move NANOSECONDS_PER_SECONDS to timer.h

We want to be able to reuse this define by making it common to
multiple QEMU modules.

This also makes it an integer since there's no need for it to be a
float.

Signed-off-by: Alberto Garcia <berto@igalia.com>
Message-id: 6375912849da2ab561046dd013684535ccecca44.1434113783.git.berto@igalia.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9 years agoblockdev: no need to drain+flush in hmp_drive_del
Paolo Bonzini [Thu, 28 May 2015 14:17:09 +0000 (16:17 +0200)]
blockdev: no need to drain+flush in hmp_drive_del

bdrv_close already does that, and in fact hmp_drive_del would need
another drain after the flush (which bdrv_close does).  So remove
the duplication.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 1432822629-25401-1-git-send-email-pbonzini@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9 years agoqapi: Rename 'dirty-bitmap' mode to 'incremental'
John Snow [Fri, 5 Jun 2015 00:20:34 +0000 (20:20 -0400)]
qapi: Rename 'dirty-bitmap' mode to 'incremental'

If we wish to make differential backups a feature that's easy to access,
it might be pertinent to rename the "dirty-bitmap" mode to "incremental"
to make it clear what /type/ of backup the dirty-bitmap is helping us
perform.

This is an API breaking change, but 2.4 has not yet gone live,
so we have this flexibility.

Signed-off-by: John Snow <jsnow@redhat.com>
Message-id: 1433463642-21840-2-git-send-email-jsnow@redhat.com
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9 years agoqcow2: Handle EAGAIN returned from update_refcount
Jindřich Makovička [Wed, 24 Jun 2015 05:05:25 +0000 (07:05 +0200)]
qcow2: Handle EAGAIN returned from update_refcount

Fixes a crash during image compression

Signed-off-by: Jindřich Makovička <makovick@gmail.com>
Tested-by: Richard W.M. Jones <rjones@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9 years agoblock/iscsi: add support for request timeouts
Peter Lieven [Tue, 16 Jun 2015 11:45:07 +0000 (13:45 +0200)]
block/iscsi: add support for request timeouts

libiscsi starting with 1.15 will properly support timeout of iscsi
commands. The default will remain no timeout, but this can
be changed via cmdline parameters, e.g.:

qemu -iscsi timeout=30 -drive file=iscsi://...

If a timeout occurs a reconnect is scheduled and the timed out command
will be requeued for processing after a successful reconnect.

The required API call iscsi_set_timeout is present since libiscsi
1.10 which was released in October 2013. However, due to some bugs
in the libiscsi code the use is not recommended before version 1.15.

Please note that this patch bumps the libiscsi requirement to 1.10
to have all function and macros defined. The patch fixes also a
off-by-one error in the NOP timeout calculation which was fixed
while touching these code parts.

Signed-off-by: Peter Lieven <pl@kamp.de>
Message-id: 1434455107-19328-1-git-send-email-pl@kamp.de
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9 years agos390x/css: Add a callback for when subchannel gets disabled
Thomas Huth [Thu, 11 Dec 2014 13:25:11 +0000 (14:25 +0100)]
s390x/css: Add a callback for when subchannel gets disabled

We need a possibility to run code when a subchannel gets disabled.
This patch adds the necessary infrastructure.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
9 years agos390-ccw.img: update
Cornelia Huck [Thu, 25 Jun 2015 11:48:58 +0000 (13:48 +0200)]
s390-ccw.img: update

Update for "s390-ccw.img: Consume service interrupts".

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
9 years agos390-ccw.img: Consume service interrupts
Christian Borntraeger [Fri, 19 Jun 2015 13:40:45 +0000 (15:40 +0200)]
s390-ccw.img: Consume service interrupts

We have to consume the outstanding service interrupt after each
service call, otherwise a correct implementation will return
CC=2 on subsequent service calls.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
9 years agocss: mss/mcss-e vs. migration
Cornelia Huck [Wed, 24 Jun 2015 08:57:23 +0000 (10:57 +0200)]
css: mss/mcss-e vs. migration

Our main channel_subsys structure is not a device (yet), but we need
to setup mss/mcss-e again if the guest had enabled it before. Use
a hack that should catch most configurations (assuming that the guest
will have enabled at least one device in higher subchannel sets or
channel subsystems if it enabled the functionality.)

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
9 years agovirtio-ccw: complete handling of guest-initiated resets
Cornelia Huck [Tue, 23 Jun 2015 13:46:31 +0000 (15:46 +0200)]
virtio-ccw: complete handling of guest-initiated resets

For a guest-initiated reset, we need to not only reset the virtio device,
but also reset the VirtioCcwDevice into a clean state. This includes
resetting the indicators, or else a guest will not be able to e.g.
switch from classic interrupts to adapter interrupts.

Split off this routine into a new function virtio_ccw_reset_virtio()
to make the distinction between resetting the virtio-related devices
and the base subchannel device clear.

CC: qemu-stable@nongnu.org
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
9 years agoMerge remote-tracking branch 'remotes/vivier/tags/pull-m68k-20150629' into staging
Peter Maydell [Mon, 29 Jun 2015 16:03:20 +0000 (17:03 +0100)]
Merge remote-tracking branch 'remotes/vivier/tags/pull-m68k-20150629' into staging

Trivial m68k cleanup

# gpg: Signature made Mon Jun 29 16:38:40 2015 BST using DSA key ID ABF36C53
# gpg: Good signature from "Laurent Vivier <laurent@vivier.eu>"
# gpg:                 aka "Laurent Vivier <Laurent@vivier.eu>"
# gpg:                 aka "Laurent Vivier <Laurent@lvivier.info>"
# gpg:                 aka "Laurent Vivier (Red Hat) <lvivier@redhat.com>"
# gpg:                 aka "[jpeg image of size 3881]"
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 9EC7 B78A C0AC E697 5E4B  BDE3 34A4 F6C9 ABF3 6C53

* remotes/vivier/tags/pull-m68k-20150629:
  m68k: remove useless parameter op_size from gen_lea_indexed()
  m68k: remove useless file m68k-qreg.h
  m68k: is_mem is useless

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agom68k: remove useless parameter op_size from gen_lea_indexed()
Laurent Vivier [Wed, 24 Jun 2015 00:51:49 +0000 (02:51 +0200)]
m68k: remove useless parameter op_size from gen_lea_indexed()

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Thomas Huth <huth@tuxfamily.org>
9 years agom68k: remove useless file m68k-qreg.h
Laurent Vivier [Wed, 24 Jun 2015 00:07:24 +0000 (02:07 +0200)]
m68k: remove useless file m68k-qreg.h

Unused since:

    commit e1f3808e03f73e7a7fa966afbed2455dd052202e
    Author: pbrook <pbrook@c046a42c-6fe2-441c-8c8c-71466251a162>
    Date:   Sat May 24 22:29:16 2008 +0000

        Convert m68k target to TCG.

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Thomas Huth <huth@tuxfamily.org>
9 years agom68k: is_mem is useless
Laurent Vivier [Tue, 23 Jun 2015 23:00:22 +0000 (01:00 +0200)]
m68k: is_mem is useless

Remove is_mem as it is never tested anymore since:

    commit bfa50bc2638d877cf2900712b7503be22e8811cb
    Author: aliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>
    Date:   Tue Nov 18 20:26:41 2008 +0000

        Remove premature memop TB terminations (Jan Kiszka)

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Thomas Huth <huth@tuxfamily.org>
9 years agoMerge remote-tracking branch 'remotes/bkoppelmann/tags/pull-tricore-20150629' into...
Peter Maydell [Mon, 29 Jun 2015 12:26:43 +0000 (13:26 +0100)]
Merge remote-tracking branch 'remotes/bkoppelmann/tags/pull-tricore-20150629' into staging

TriCore bugfixes

# gpg: Signature made Mon Jun 29 13:08:17 2015 BST using RSA key ID 6B69CA14
# gpg: Good signature from "Bastian Koppelmann <kbastian@mail.uni-paderborn.de>"

* remotes/bkoppelmann/tags/pull-tricore-20150629:
  target-tricore: fix depositing bits from PCXI into ICR

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agotarget-tricore: fix depositing bits from PCXI into ICR
Paolo Bonzini [Wed, 24 Jun 2015 12:01:10 +0000 (14:01 +0200)]
target-tricore: fix depositing bits from PCXI into ICR

Spotted by Coverity, because (env->PCXI & MASK_PCXI_PCPN) >> 24
is always zero.  The immediately preceding assignment is also
wrong though.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
Message-Id: <1435147270-1040-1-git-send-email-pbonzini@redhat.com>

9 years agoMerge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging
Peter Maydell [Fri, 26 Jun 2015 14:57:43 +0000 (15:57 +0100)]
Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging

virtio, pci fixes, enhancements

Almost exclusively bugfixes, though in this case,
we are adding functionality to the pxb in order
to make OVMF work on it.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
# gpg: Signature made Fri Jun 26 14:43:27 2015 BST using RSA key ID D28D5469
# gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>"
# gpg:                 aka "Michael S. Tsirkin <mst@redhat.com>"

* remotes/mst/tags/for_upstream:
  Fix glib_subprocess test
  hw/pci-bridge: format special OFW unit address for PXB host
  hw/core: explicit OFW unit address callback for SysBusDeviceClass
  hw/pci-bridge: disable SHPC in PXB
  hw/pci-bridge: introduce "shpc" property
  hw/pci: introduce shpc_present() helper function
  hw/pci-bridge: add macro for "msi" property
  hw/pci-bridge: add macro for "chassis_nr" property
  hw/pci-bridge: expose _test parameter in SHPC_VMSTATE()
  migration: introduce VMSTATE_BUFFER_UNSAFE_INFO_TEST()
  add pci-bridge-seat
  pc: cleanup and convert TMP ACPI device description to AML API
  MAINTAINERS: add ACPI entry
  vhost: correctly pass error to caller in vhost_dev_enable_notifiers()
  balloon: add a feature bit to let Guest OS deflate balloon on oom
  qdev: fix OVERFLOW_BEFORE_WIDEN
  virito-pci: fix OVERRUN problem

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agoMerge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20150626' into...
Peter Maydell [Fri, 26 Jun 2015 13:40:47 +0000 (14:40 +0100)]
Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20150626' into staging

target-arm queue:
 * Change the virt board's default interface type for block devices to virtio
 * Improve some error messages that will now be triggered by some incorrect
   but previously worked-by-accident command lines
 * Print ELR if we're doing debug logging of AArch64 exception entry
 * Handle the "completely empty semihosting commandline" correctly for
   softmmu (we already did for linux-user)
 * Add GICv2m description to ACPI tables for virt board
 * Fix some incorrect table revision entries in virt board ACPI tables

# gpg: Signature made Fri Jun 26 14:29:39 2015 BST using RSA key ID 14360CDE
# gpg: Good signature from "Peter Maydell <peter.maydell@linaro.org>"

* remotes/pmaydell/tags/pull-target-arm-20150626:
  hw/arm/virt: Make block devices default to virtio
  qdev-properties-system: Improve error message for drive assignment conflict
  qdev-properties-system: Change set_pointer's parse callback to use Error
  target-arm: A64: Print ELR when taking exceptions
  target-arm: default empty semihosting cmdline
  hw/arm/virt-acpi-build: Add GICv2m description in ACPI MADT table
  hw/arm/virt-acpi-build: Fix table revision and some comments

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agohw/arm/virt: Make block devices default to virtio
Peter Maydell [Fri, 26 Jun 2015 13:22:37 +0000 (14:22 +0100)]
hw/arm/virt: Make block devices default to virtio

Now we have virtio-pci, we can make the virt board's default block
device type be IF_VIRTIO. This allows users to use simplified
command lines that don't have to explicitly create virtio-pci-blk
devices; the -hda &c very short options now also work.

This means we also need to set no_cdrom to avoid getting a
default cdrom device -- this is needed because the virtio-blk
device will fail if it is connected to a block backend with
no media, which is what the default cdrom device typically is.
Providing a cdrom with media via -cdrom will succeed, but silently
create a device with non-removable medium. this is probably
not really what the user wants, but is the best we can do now.

Note that this change means that some command lines which used
to work (by accident) will stop working. Where a drive was connected
manually to a device but without 'if=none' being specified, we
used to treat this as an IDE drive, which we would then not autoplug
because the board doesn't support IDE. Now we will treat it as a
virtio disk and autoplug it, which means the attempt to use the
drive manually will fail:
  qemu-system-arm: -drive file=img.qcow2,id=foo: Drive 'foo' is already
  in use because it has been automatically connected to another device
  (did you need 'if=none' in the drive options?)
The command line will have to be changed to include 'if=none', as the
error message suggests.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 1435068107-12594-4-git-send-email-peter.maydell@linaro.org

9 years agoqdev-properties-system: Improve error message for drive assignment conflict
Peter Maydell [Fri, 26 Jun 2015 13:22:36 +0000 (14:22 +0100)]
qdev-properties-system: Improve error message for drive assignment conflict

If the user forgot if=none on their drive specification they're likely
to get an error message because the drive is assigned once automatically
by QEMU and once by the manual id=/drive= user command line specification.
Improve the error message produced in this case to explicitly guide the
user towards if=none.

We rephrase the "drive conflict but not for an if=something" error as
well to keep the wording in line.

The two cases that change are:

(1) Drive specified as to be auto-connected and also manually connected
(and the board does handle this if= type):

  qemu-system-x86_64 -nodefaults -display none \
     -drive if=scsi,file=tmp.qcow2,id=foo -device ide-hd,drive=foo

Previously:
  qemu-system-x86_64: -device ide-hd,drive=foo: Property 'ide-hd.drive'
  can't take value 'foo', it's in use

Now:
  qemu-system-x86_64: -device ide-hd,drive=foo: Drive 'foo' is already in
  use because it has been automatically connected to another device (did
  you need 'if=none' in the drive options?)

(2) Drive specified to be manually connected in two different ways:

  qemu-system-x86_64 -nodefaults -display none \
   -drive if=none,file=tmp.qcow2,id=foo -device ide-hd,drive=foo \
   -device ide-hd,drive=foo

Previously:
  qemu-system-x86_64: -device ide-hd,drive=foo: Property 'ide-hd.drive'
  can't take value 'foo', it's in use

Now:
  qemu-system-x86_64: -device ide-hd,drive=foo: Drive 'foo' is already in
  use by another device

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 1435068107-12594-3-git-send-email-peter.maydell@linaro.org

9 years agoqdev-properties-system: Change set_pointer's parse callback to use Error
Peter Maydell [Fri, 26 Jun 2015 13:22:36 +0000 (14:22 +0100)]
qdev-properties-system: Change set_pointer's parse callback to use Error

Instead of having set_pointer() call a parse callback which returns
an error number that we then convert to an Error string with
error_set_from_qdev_prop_error(), make the parse callback take an
Error** and set the error itself. This will allow parse routines
to provide more helpful error messages than the generic ones.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 1435068107-12594-2-git-send-email-peter.maydell@linaro.org

9 years agotarget-arm: A64: Print ELR when taking exceptions
Soren Brinkmann [Fri, 26 Jun 2015 13:22:36 +0000 (14:22 +0100)]
target-arm: A64: Print ELR when taking exceptions

When taking an exception print the content of the exception link
register. This is useful especially for synchronous exceptions because
in that case this registers holds the address of the instruction that
generated the exception.

Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
Message-id: 1435036655-16132-1-git-send-email-soren.brinkmann@xilinx.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agotarget-arm: default empty semihosting cmdline
Liviu Ionescu [Fri, 26 Jun 2015 13:22:36 +0000 (14:22 +0100)]
target-arm: default empty semihosting cmdline

If neither explicit semihosting args nor -kernel are used,
make SYS_GET_CMDLINE return an empty string.

Signed-off-by: Liviu Ionescu <ilg@livius.net>
Message-id: AC7B5AFC-06AE-4FAD-9852-B65708E80E09@livius.net
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agohw/arm/virt-acpi-build: Add GICv2m description in ACPI MADT table
Shannon Zhao [Fri, 26 Jun 2015 13:22:36 +0000 (14:22 +0100)]
hw/arm/virt-acpi-build: Add GICv2m description in ACPI MADT table

Add GICv2m description in ACPI MADT table, so guest can use MSI when
booting with ACPI.

Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com>
Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Reviewed-by: Andrew Jones <drjones@redhat.com>
Tested-by: Andrew Jones <drjones@redhat.com>
Message-id: 1434676210-2276-1-git-send-email-shannon.zhao@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agohw/arm/virt-acpi-build: Fix table revision and some comments
Shannon Zhao [Fri, 26 Jun 2015 13:22:36 +0000 (14:22 +0100)]
hw/arm/virt-acpi-build: Fix table revision and some comments

The table revision is not the ACPI spec version. Fix the wrong revision
and also some comments.

Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Message-id: 1433820378-8336-1-git-send-email-zhaoshenglong@huawei.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agoMerge remote-tracking branch 'remotes/lalrae/tags/mips-20150626' into staging
Peter Maydell [Fri, 26 Jun 2015 10:32:58 +0000 (11:32 +0100)]
Merge remote-tracking branch 'remotes/lalrae/tags/mips-20150626' into staging

MIPS patches 2015-06-26

Changes:
* MIPS UHI semihosting support
* microMIPS32 R6 support

# gpg: Signature made Fri Jun 26 10:42:33 2015 BST using RSA key ID 0B29DA6B
# gpg: Good signature from "Leon Alrae <leon.alrae@imgtec.com>"
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 8DD3 2F98 5495 9D66 35D4  4FC0 5211 8E3C 0B29 DA6B

* remotes/lalrae/tags/mips-20150626:
  target-mips: add mips32r6-generic CPU definition
  target-mips: microMIPS32 R6 POOL16{A, C} instructions
  target-mips: microMIPS32 R6 Major instructions
  target-mips: microMIPS32 R6 POOL32{I, C} instructions
  target-mips: microMIPS32 R6 POOL32F instructions
  target-mips: microMIPS32 R6 POOL32A{XF} instructions
  target-mips: microMIPS32 R6 branches and jumps
  target-mips: add microMIPS32 R6 opcode enum
  target-mips: signal RI for removed instructions in microMIPS R6
  target-mips: raise RI exceptions when FIR.PS = 0
  target-mips: rearrange gen_compute_compact_branch
  target-mips: refactor {D}LSA, {D}ALIGN, {D}BITSWAP
  target-mips: remove an unused argument
  target-mips: add microMIPS TLBINV, TLBINVF
  target-mips: fix {RD, WR}PGPR in microMIPS
  target-mips: convert host to MIPS errno values when required
  target-mips: add Unified Hosting Interface (UHI) support
  target-mips: remove identical code in different branch
  hw/mips: Do not clear BEV for MIPS malta kernel load
  include/softmmu-semi.h: Make semihosting support 64-bit clean

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agotarget-mips: add mips32r6-generic CPU definition
Yongbok Kim [Wed, 24 Jun 2015 23:24:27 +0000 (00:24 +0100)]
target-mips: add mips32r6-generic CPU definition

Define a new CPU definition supporting MIPS32 Release 6 ISA and
microMIPS32 Release 6 ISA.

Signed-off-by: Yongbok Kim <yongbok.kim@imgtec.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
9 years agotarget-mips: microMIPS32 R6 POOL16{A, C} instructions
Yongbok Kim [Wed, 24 Jun 2015 23:24:26 +0000 (00:24 +0100)]
target-mips: microMIPS32 R6 POOL16{A, C} instructions

microMIPS32 Release 6 POOL16A/ POOL16C instructions

Signed-off-by: Yongbok Kim <yongbok.kim@imgtec.com>
Reviewed-by: Leon Alrae <leon.alrae@imgtec.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
9 years agotarget-mips: microMIPS32 R6 Major instructions
Yongbok Kim [Wed, 24 Jun 2015 23:24:25 +0000 (00:24 +0100)]
target-mips: microMIPS32 R6 Major instructions

Add new microMIPS32 Release 6 Major opcode instructions

Signed-off-by: Yongbok Kim <yongbok.kim@imgtec.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
9 years agotarget-mips: microMIPS32 R6 POOL32{I, C} instructions
Yongbok Kim [Wed, 24 Jun 2015 23:24:24 +0000 (00:24 +0100)]
target-mips: microMIPS32 R6 POOL32{I, C} instructions

Add new microMIPS32 Release 6 POOL32I/POOL32C type instructions

Signed-off-by: Yongbok Kim <yongbok.kim@imgtec.com>
Reviewed-by: Leon Alrae <leon.alrae@imgtec.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
9 years agotarget-mips: microMIPS32 R6 POOL32F instructions
Yongbok Kim [Wed, 24 Jun 2015 23:24:23 +0000 (00:24 +0100)]
target-mips: microMIPS32 R6 POOL32F instructions

Add new microMIPS32 Release 6 POOL32F instructions

Signed-off-by: Yongbok Kim <yongbok.kim@imgtec.com>
Reviewed-by: Leon Alrae <leon.alrae@imgtec.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
9 years agotarget-mips: microMIPS32 R6 POOL32A{XF} instructions
Yongbok Kim [Wed, 24 Jun 2015 23:24:22 +0000 (00:24 +0100)]
target-mips: microMIPS32 R6 POOL32A{XF} instructions

Add new microMIPS32 Release 6 pool32a/pool32axf instructions.

Signed-off-by: Yongbok Kim <yongbok.kim@imgtec.com>
Reviewed-by: Leon Alrae <leon.alrae@imgtec.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
9 years agotarget-mips: microMIPS32 R6 branches and jumps
Yongbok Kim [Wed, 24 Jun 2015 23:24:21 +0000 (00:24 +0100)]
target-mips: microMIPS32 R6 branches and jumps

Add new microMIPS32 Release 6 branch and jump instructions.

Signed-off-by: Yongbok Kim <yongbok.kim@imgtec.com>
Reviewed-by: Leon Alrae <leon.alrae@imgtec.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
9 years agotarget-mips: add microMIPS32 R6 opcode enum
Yongbok Kim [Wed, 24 Jun 2015 23:24:20 +0000 (00:24 +0100)]
target-mips: add microMIPS32 R6 opcode enum

Add microMIPS32 Release 6 opcode enum.
Remove RI checking for pre-R6 reserved opcode.

Signed-off-by: Yongbok Kim <yongbok.kim@imgtec.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
9 years agotarget-mips: signal RI for removed instructions in microMIPS R6
Yongbok Kim [Wed, 24 Jun 2015 23:24:19 +0000 (00:24 +0100)]
target-mips: signal RI for removed instructions in microMIPS R6

Signal a Reserved Instruction exception for removed instruction encoding
in microMIPS Release 6.

Signed-off-by: Yongbok Kim <yongbok.kim@imgtec.com>
Reviewed-by: Leon Alrae <leon.alrae@imgtec.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
9 years agotarget-mips: raise RI exceptions when FIR.PS = 0
Yongbok Kim [Wed, 24 Jun 2015 23:24:18 +0000 (00:24 +0100)]
target-mips: raise RI exceptions when FIR.PS = 0

64-bit paired-single (PS) floating point data type is optional in the
pre-Release 6.
It has to raise RI exception when PS type is not implemented. (FIR.PS = 0)
(The PS data type is removed in the Release 6.)
Loongson-2E and Loongson-2F don't have any implementation field in
FCSR0(FIR) but do support PS data format, therefore for these cores RI will
not be signalled regardless of PS bit.

Signed-off-by: Yongbok Kim <yongbok.kim@imgtec.com>
Reviewed-by: Leon Alrae <leon.alrae@imgtec.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
9 years agotarget-mips: rearrange gen_compute_compact_branch
Yongbok Kim [Wed, 24 Jun 2015 23:24:17 +0000 (00:24 +0100)]
target-mips: rearrange gen_compute_compact_branch

The function will be also used for microMIPS Release 6.

Signed-off-by: Yongbok Kim <yongbok.kim@imgtec.com>
Reviewed-by: Leon Alrae <leon.alrae@imgtec.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
9 years agotarget-mips: refactor {D}LSA, {D}ALIGN, {D}BITSWAP
Yongbok Kim [Wed, 24 Jun 2015 23:24:16 +0000 (00:24 +0100)]
target-mips: refactor {D}LSA, {D}ALIGN, {D}BITSWAP

Refactor those instructions in order to reuse them for microMIPS32
Release 6.
Rearrange gen_move_low32().

Signed-off-by: Yongbok Kim <yongbok.kim@imgtec.com>
Reviewed-by: Leon Alrae <leon.alrae@imgtec.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
9 years agotarget-mips: remove an unused argument
Yongbok Kim [Wed, 24 Jun 2015 23:24:15 +0000 (00:24 +0100)]
target-mips: remove an unused argument

Remove an unused argument from decode_micromips32_opc()

Signed-off-by: Yongbok Kim <yongbok.kim@imgtec.com>
Reviewed-by: Leon Alrae <leon.alrae@imgtec.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
9 years agotarget-mips: add microMIPS TLBINV, TLBINVF
Yongbok Kim [Wed, 24 Jun 2015 23:24:14 +0000 (00:24 +0100)]
target-mips: add microMIPS TLBINV, TLBINVF

Add microMIPS TLBINV, TLBINVF

Signed-off-by: Yongbok Kim <yongbok.kim@imgtec.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Reviewed-by: Leon Alrae <leon.alrae@imgtec.com>
Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
9 years agotarget-mips: fix {RD, WR}PGPR in microMIPS
Yongbok Kim [Wed, 24 Jun 2015 23:24:13 +0000 (00:24 +0100)]
target-mips: fix {RD, WR}PGPR in microMIPS

rt, rs were swapped

Signed-off-by: Yongbok Kim <yongbok.kim@imgtec.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Reviewed-by: Leon Alrae <leon.alrae@imgtec.com>
Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
9 years agotarget-mips: convert host to MIPS errno values when required
Leon Alrae [Fri, 19 Jun 2015 10:08:44 +0000 (11:08 +0100)]
target-mips: convert host to MIPS errno values when required

Convert only errno values which can be returned by system calls in
mips-semi.c and are not generic to all archs.

Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
9 years agotarget-mips: add Unified Hosting Interface (UHI) support
Leon Alrae [Fri, 19 Jun 2015 10:08:43 +0000 (11:08 +0100)]
target-mips: add Unified Hosting Interface (UHI) support

Add UHI semihosting support for MIPS. QEMU run with "-semihosting" option
will alter the behaviour of SDBBP 1 instruction -- UHI operation will be
called instead of generating a debug exception.

Also tweak Malta's pseudo-bootloader. On CPU reset the $4 register is set
to -1 if semihosting arguments are passed to indicate that the UHI
operations should be used to obtain input arguments.

Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
9 years agotarget-mips: remove identical code in different branch
Leon Alrae [Fri, 19 Jun 2015 10:08:42 +0000 (11:08 +0100)]
target-mips: remove identical code in different branch

Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
9 years agohw/mips: Do not clear BEV for MIPS malta kernel load
Matthew Fortune [Fri, 19 Jun 2015 10:08:41 +0000 (11:08 +0100)]
hw/mips: Do not clear BEV for MIPS malta kernel load

The BEV flag controls whether the boot exception vector is still
in place when starting a kernel.  When cleared the exception vector
at EBASE (or hard coded address of 0x80000000) is used instead.

The early stages of the linux kernel would benefit from BEV still
being set to ensure any faults get handled by the boot rom exception
handlers.  This is a moot point for system qemu as there aren't really
any BEV handlers, but there are other good reasons to change this...

The UHI (semi-hosting interface) defines special behaviours depending
on whether an application starts in an environment with BEV set or
cleared. When BEV is set then UHI assumes that a bootloader is
relatively dumb and has no advanced exception handling logic.
However, when BEV is cleared then UHI assumes that the bootloader
has the ability to handle UHI exceptions with its exception handlers
and will unwind and forward UHI SYSCALL exceptions to the exception
vector that was installed prior to running the application.

Signed-off-by: Matthew Fortune <matthew.fortune@imgtec.com>
Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
9 years agoinclude/softmmu-semi.h: Make semihosting support 64-bit clean
Maciej W. Rozycki [Fri, 19 Jun 2015 10:08:40 +0000 (11:08 +0100)]
include/softmmu-semi.h: Make semihosting support 64-bit clean

Correct addresses passed around in semihosting to use a data type suitable
for both 32-bit and 64-bit targets.

Signed-off-by: Maciej W. Rozycki <macro@codesourcery.com>
Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
9 years agoMerge remote-tracking branch 'remotes/stefanha/tags/net-pull-request' into staging
Peter Maydell [Thu, 25 Jun 2015 13:03:55 +0000 (14:03 +0100)]
Merge remote-tracking branch 'remotes/stefanha/tags/net-pull-request' into staging

# gpg: Signature made Wed Jun 24 16:37:23 2015 BST using RSA key ID 81AB73C8
# gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>"
# gpg:                 aka "Stefan Hajnoczi <stefanha@gmail.com>"

* remotes/stefanha/tags/net-pull-request:
  net: simplify net_client_init1()
  net: drop if expression that is always true
  net: raise an error if -net type is invalid
  net: replace net_client_init1() netdev whitelist with blacklist
  net: add missing "netmap" to host_net_devices[]

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agoMerge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging
Peter Maydell [Thu, 25 Jun 2015 10:19:46 +0000 (11:19 +0100)]
Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging

# gpg: Signature made Wed Jun 24 16:27:53 2015 BST using RSA key ID 81AB73C8
# gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>"
# gpg:                 aka "Stefan Hajnoczi <stefanha@gmail.com>"

* remotes/stefanha/tags/block-pull-request:
  virito-blk: drop duplicate check
  qemu-iotests: fix 051.out after qdev error message change
  iov: don't touch iov in iov_send_recv()
  raw-posix: Introduce hdev_is_sg()
  raw-posix: Use DPRINTF for DEBUG_FLOPPY
  raw-posix: DPRINTF instead of DEBUG_BLOCK_PRINT
  Fix migration in case of scsi-generic
  block: Use bdrv_is_sg() everywhere
  nvme: Fix memleak in nvme_dma_read_prp
  vvfat: add a label option
  util/hbitmap: Add an API to reset all set bits in hbitmap
  virtio-blk: Use blk_drain() to drain IO requests
  block-backend: Introduce blk_drain()
  throttle: Check current timers before updating any_timer_armed[]
  block: Let bdrv_drain_all() to call aio_poll() for each AioContext

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>