]> git.proxmox.com Git - mirror_qemu.git/log
mirror_qemu.git
8 years agoivshmem: fix pci_ivshmem_exit()
Marc-André Lureau [Tue, 23 Jun 2015 10:57:16 +0000 (12:57 +0200)]
ivshmem: fix pci_ivshmem_exit()

Free all objects owned by the device, making sure the device is free,
fixing hot-unplug.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Claudio Fontana <claudio.fontana@huawei.com>
8 years agoivshmem: add device description
Marc-André Lureau [Tue, 23 Jun 2015 11:01:40 +0000 (13:01 +0200)]
ivshmem: add device description

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Claudio Fontana <claudio.fontana@huawei.com>
8 years agoivshmem: check shm isn't already initialized
Marc-André Lureau [Tue, 23 Jun 2015 10:55:41 +0000 (12:55 +0200)]
ivshmem: check shm isn't already initialized

The server should not change the shm, and this isn't handled by qemu and
we should should verify this in qemu.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Claudio Fontana <claudio.fontana@huawei.com>
8 years agoivshmem: shmfd can be 0
Marc-André Lureau [Tue, 23 Jun 2015 10:53:42 +0000 (12:53 +0200)]
ivshmem: shmfd can be 0

0 is a valid fd value, so change conditions and set -1 value early

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Claudio Fontana <claudio.fontana@huawei.com>
8 years agoivshmem: migrate with VMStateDescription
Marc-André Lureau [Thu, 18 Jun 2015 12:05:46 +0000 (14:05 +0200)]
ivshmem: migrate with VMStateDescription

load_state_old() is used to keep compatibility with version 0.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Claudio Fontana <claudio.fontana@huawei.com>
8 years agoivshmem: use common is_power_of_2()
Marc-André Lureau [Thu, 18 Jun 2015 14:10:33 +0000 (16:10 +0200)]
ivshmem: use common is_power_of_2()

The common version correctly checks for 0 value case.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Claudio Fontana <claudio.fontana@huawei.com>
8 years agoivshmem: use common return
Marc-André Lureau [Fri, 19 Jun 2015 10:21:46 +0000 (12:21 +0200)]
ivshmem: use common return

Both if branches return, move this out to common end.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Claudio Fontana <claudio.fontana@huawei.com>
8 years agoivshmem: simplify a bit the code
Marc-André Lureau [Fri, 19 Jun 2015 10:19:55 +0000 (12:19 +0200)]
ivshmem: simplify a bit the code

Use some more explicit variables to simplify the code.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Claudio Fontana <claudio.fontana@huawei.com>
8 years agoivshmem: print error on invalid peer id
Marc-André Lureau [Tue, 23 Jun 2015 11:34:09 +0000 (13:34 +0200)]
ivshmem: print error on invalid peer id

The server shouldn't send invalid peer id, so print an error if it's the
case.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Claudio Fontana <claudio.fontana@huawei.com>
8 years agoivshmem: improve error handling
Marc-André Lureau [Thu, 18 Jun 2015 12:39:49 +0000 (14:39 +0200)]
ivshmem: improve error handling

The test whether the chardev is an AF_UNIX socket rejects
"-chardev socket,id=chr0,path=/tmp/foo,server,nowait -device
ivshmem,chardev=chr0", but fails to explain why.

Use an explicit error on why a chardev may be rejected.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Claudio Fontana <claudio.fontana@huawei.com>
8 years agoivshmem: improve debug messages
Marc-André Lureau [Thu, 18 Jun 2015 13:04:13 +0000 (15:04 +0200)]
ivshmem: improve debug messages

Some misc improvements to ivshmem debug.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Claudio Fontana <claudio.fontana@huawei.com>
8 years agoivshmem: remove max_peer field
Marc-André Lureau [Fri, 19 Jun 2015 10:17:26 +0000 (12:17 +0200)]
ivshmem: remove max_peer field

max_peer isn't really useful, it tracks the maximum received VM id, but
that quickly matches nb_peers, the size of the peers array. Since VM
come and go, there might be sparse peers so it doesn't help much in
general to have this value around.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Claudio Fontana <claudio.fontana@huawei.com>
8 years agoivshmem: initialize max_peer to -1
Marc-André Lureau [Thu, 25 Jun 2015 11:49:09 +0000 (13:49 +0200)]
ivshmem: initialize max_peer to -1

There is no peer when device is initialized, do not let doorbell for
inexisting peer 0.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Claudio Fontana <claudio.fontana@huawei.com>
8 years agoivshmem: remove useless ivshmem_update_irq() val argument
Marc-André Lureau [Thu, 18 Jun 2015 13:00:52 +0000 (15:00 +0200)]
ivshmem: remove useless ivshmem_update_irq() val argument

val isn't used in ivshmem_update_irq() function.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Claudio Fontana <claudio.fontana@huawei.com>
8 years agoivshmem: allocate eventfds in resize_peers()
Marc-André Lureau [Tue, 15 Sep 2015 15:23:07 +0000 (17:23 +0200)]
ivshmem: allocate eventfds in resize_peers()

It simplifies a bit the code to allocate the array when setting the
number of peers instead of lazily when receiving the first vector.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Claudio Fontana <claudio.fontana@huawei.com>
8 years agoivshmem: simplify around increase_dynamic_storage()
Marc-André Lureau [Tue, 15 Sep 2015 15:21:37 +0000 (17:21 +0200)]
ivshmem: simplify around increase_dynamic_storage()

Set the number of peers and array allocation in a single place. Rename
to better reflect the function content.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Claudio Fontana <claudio.fontana@huawei.com>
8 years agoivshmem: limit maximum number of peers to G_MAXUINT16
Marc-André Lureau [Tue, 15 Sep 2015 14:55:10 +0000 (16:55 +0200)]
ivshmem: limit maximum number of peers to G_MAXUINT16

Limit the maximum number of peers to MAXUINT16. This is more realistic
and better matches the limit of the doorbell register.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Claudio Fontana <claudio.fontana@huawei.com>
8 years agoivshmem: remove last exit(1)
Marc-André Lureau [Mon, 22 Jun 2015 10:55:16 +0000 (12:55 +0200)]
ivshmem: remove last exit(1)

Failing to create a chardev shouldn't be fatal.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Claudio Fontana <claudio.fontana@huawei.com>
8 years agoivshmem: more qdev conversion
Marc-André Lureau [Thu, 18 Jun 2015 12:59:28 +0000 (14:59 +0200)]
ivshmem: more qdev conversion

Use the latest qemu device modeling API, in particular, convert to
realize to fix the error handling; right now a botched device_add
ivhsmem command kills the VM.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Claudio Fontana <claudio.fontana@huawei.com>
8 years agoivshmem: remove useless doorbell field
Marc-André Lureau [Thu, 18 Jun 2015 14:17:48 +0000 (16:17 +0200)]
ivshmem: remove useless doorbell field

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Claudio Fontana <claudio.fontana@huawei.com>
8 years agoivshmem: remove superflous ivshmem_attr field
Marc-André Lureau [Thu, 18 Jun 2015 14:24:33 +0000 (16:24 +0200)]
ivshmem: remove superflous ivshmem_attr field

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Claudio Fontana <claudio.fontana@huawei.com>
8 years agoivshmem: remove unnecessary dup()
Marc-André Lureau [Mon, 22 Jun 2015 10:38:34 +0000 (12:38 +0200)]
ivshmem: remove unnecessary dup()

qemu_chr_fe_get_msgfd() transfers ownership, there is no need to dup the
fd.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Claudio Fontana <claudio.fontana@huawei.com>
8 years agoivshmem: factor out the incoming fifo handling
Marc-André Lureau [Tue, 23 Jun 2015 15:56:37 +0000 (17:56 +0200)]
ivshmem: factor out the incoming fifo handling

Make a new function fifo_update_and_get() that can be reused by other
functions (in next commits).

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Claudio Fontana <claudio.fontana@huawei.com>
8 years agoivshmem: fix number of bytes to push to fifo
Marc-André Lureau [Tue, 23 Jun 2015 15:53:46 +0000 (17:53 +0200)]
ivshmem: fix number of bytes to push to fifo

If the fifo has 0 bytes, and the read is of size 1, the call to
fifo8_push_all() will copy off boundary data.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Claudio Fontana <claudio.fontana@huawei.com>
8 years agoivhsmem: read do not accept more than sizeof(long)
Marc-André Lureau [Fri, 19 Jun 2015 11:00:32 +0000 (13:00 +0200)]
ivhsmem: read do not accept more than sizeof(long)

ivshmem_read() only reads sizeof(long) from the input buffer.  Accepting
more could lead to fifo8 abort() on 32bit systems if fifo is not empty.

A following patch will change the protocol to 64-bit little-endian
instead.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Claudio Fontana <claudio.fontana@huawei.com>
8 years agomsix: add VMSTATE_MSIX_TEST
Marc-André Lureau [Thu, 18 Jun 2015 12:05:13 +0000 (14:05 +0200)]
msix: add VMSTATE_MSIX_TEST

ivshmem is going to use MSIX state conditionally.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Claudio Fontana <claudio.fontana@huawei.com>
8 years agochar: add qemu_chr_free()
Marc-André Lureau [Mon, 22 Jun 2015 16:20:18 +0000 (18:20 +0200)]
char: add qemu_chr_free()

If a chardev is allowed to be created outside of QMP, then it must be
also possible to free it. This is useful for ivshmem that creates
chardev anonymously and must be able to free them.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Claudio Fontana <claudio.fontana@huawei.com>
8 years agotests: Add ivshmem qtest
Andreas Färber [Sat, 10 Oct 2015 22:18:32 +0000 (00:18 +0200)]
tests: Add ivshmem qtest

Note that it launches two instances, as sharing memory is the purpose of
ivshmem.

Cc: Cam Macdonell <cam@cs.ualberta.ca>
Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
[ Remove Nahanni codename, add test to pci set - Marc-André ]
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
8 years agoconfig: enable ivshmem on POSIX
Marc-André Lureau [Mon, 12 Oct 2015 13:25:55 +0000 (15:25 +0200)]
config: enable ivshmem on POSIX

ivshmem doesn't actually require kvm, so enable it when POSIX is
enabled. (it is required however when ioeventfd is enabled)

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
8 years agoMerge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging
Peter Maydell [Fri, 23 Oct 2015 17:14:42 +0000 (18:14 +0100)]
Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging

Block layer patches

# gpg: Signature made Fri 23 Oct 2015 17:59:56 BST using RSA key ID C88F2FD6
# gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>"

* remotes/kevin/tags/for-upstream: (37 commits)
  tests: Add test case for aio_disable_external
  block: Add "drained begin/end" for internal snapshot
  block: Add "drained begin/end" for transactional blockdev-backup
  block: Add "drained begin/end" for transactional backup
  block: Add "drained begin/end" for transactional external snapshot
  block: Introduce "drained begin/end" API
  aio: introduce aio_{disable,enable}_external
  dataplane: Mark host notifiers' client type as "external"
  nbd: Mark fd handlers client type as "external"
  aio: Add "is_external" flag for event handlers
  throttle: Remove throttle_group_lock/unlock()
  blockdev: Allow more options for BB-less BDS tree
  blockdev: Pull out blockdev option extraction
  blockdev: Do not create BDS for empty drive
  block: Prepare for NULL BDS
  block: Add blk_insert_bs()
  block: Prepare remaining BB functions for NULL BDS
  block: Fail requests to empty BlockBackend
  block: Make some BB functions fall back to BBRS
  block: Add BlockBackendRootState
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agotests: Add test case for aio_disable_external
Fam Zheng [Fri, 23 Oct 2015 03:08:14 +0000 (11:08 +0800)]
tests: Add test case for aio_disable_external

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoblock: Add "drained begin/end" for internal snapshot
Fam Zheng [Fri, 23 Oct 2015 03:08:13 +0000 (11:08 +0800)]
block: Add "drained begin/end" for internal snapshot

This ensures the atomicity of the transaction by avoiding processing of
external requests such as those from ioeventfd.

state->bs is assigned right after bdrv_drained_begin. Because it was
used as the flag for deletion or not in abort, now we need a separate
flag - InternalSnapshotState.created.

Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoblock: Add "drained begin/end" for transactional blockdev-backup
Fam Zheng [Fri, 23 Oct 2015 03:08:12 +0000 (11:08 +0800)]
block: Add "drained begin/end" for transactional blockdev-backup

Similar to the previous patch, make sure that external events are not
dispatched during transaction operations.

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Jeff Cody <jcody@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoblock: Add "drained begin/end" for transactional backup
Fam Zheng [Fri, 23 Oct 2015 03:08:11 +0000 (11:08 +0800)]
block: Add "drained begin/end" for transactional backup

This ensures the atomicity of the transaction by avoiding processing of
external requests such as those from ioeventfd.

Move the assignment to state->bs up right after bdrv_drained_begin, so
that we can use it in the clean callback. The abort callback will still
check bs->job and state->job, so it's OK.

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Jeff Cody <jcody@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoblock: Add "drained begin/end" for transactional external snapshot
Fam Zheng [Fri, 23 Oct 2015 03:08:10 +0000 (11:08 +0800)]
block: Add "drained begin/end" for transactional external snapshot

This ensures the atomicity of the transaction by avoiding processing of
external requests such as those from ioeventfd.

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Jeff Cody <jcody@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoblock: Introduce "drained begin/end" API
Fam Zheng [Fri, 23 Oct 2015 03:08:09 +0000 (11:08 +0800)]
block: Introduce "drained begin/end" API

The semantics is that after bdrv_drained_begin(bs), bs will not get new external
requests until the matching bdrv_drained_end(bs).

Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoaio: introduce aio_{disable,enable}_external
Fam Zheng [Fri, 23 Oct 2015 03:08:08 +0000 (11:08 +0800)]
aio: introduce aio_{disable,enable}_external

Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agodataplane: Mark host notifiers' client type as "external"
Fam Zheng [Fri, 23 Oct 2015 03:08:07 +0000 (11:08 +0800)]
dataplane: Mark host notifiers' client type as "external"

They will be excluded by type in the nested event loops in block layer,
so that unwanted events won't be processed there.

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agonbd: Mark fd handlers client type as "external"
Fam Zheng [Fri, 23 Oct 2015 03:08:06 +0000 (11:08 +0800)]
nbd: Mark fd handlers client type as "external"

So we could distinguish it from internal used fds, thus avoid handling
unwanted events in nested aio polls.

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Jeff Cody <jcody@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoaio: Add "is_external" flag for event handlers
Fam Zheng [Fri, 23 Oct 2015 03:08:05 +0000 (11:08 +0800)]
aio: Add "is_external" flag for event handlers

All callers pass in false, and the real external ones will switch to
true in coming patches.

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Jeff Cody <jcody@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agothrottle: Remove throttle_group_lock/unlock()
Alberto Garcia [Wed, 21 Oct 2015 18:36:05 +0000 (21:36 +0300)]
throttle: Remove throttle_group_lock/unlock()

The group throttling code was always meant to handle its locking
internally. However, bdrv_swap() was touching the ThrottleGroup
structure directly and therefore needed an API for that.

Now that bdrv_swap() no longer exists there's no need for the
throttle_group_lock() API anymore.

Signed-off-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoblockdev: Allow more options for BB-less BDS tree
Max Reitz [Mon, 19 Oct 2015 15:53:32 +0000 (17:53 +0200)]
blockdev: Allow more options for BB-less BDS tree

Most of the options which blockdev_init() parses for both the
BlockBackend and the root BDS are valid for just the root BDS as well
(e.g. read-only). This patch allows specifying these options even if not
creating a BlockBackend.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoblockdev: Pull out blockdev option extraction
Max Reitz [Mon, 19 Oct 2015 15:53:31 +0000 (17:53 +0200)]
blockdev: Pull out blockdev option extraction

Extract some of the blockdev option extraction code from blockdev_init()
into its own function. This simplifies blockdev_init() and will allow
reusing the code in a different function added in a follow-up patch.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoblockdev: Do not create BDS for empty drive
Max Reitz [Mon, 19 Oct 2015 15:53:30 +0000 (17:53 +0200)]
blockdev: Do not create BDS for empty drive

Do not use "rudimentary" BDSs for empty drives any longer (for
freshly created drives).

After a follow-up patch, empty drives will generally use a NULL BDS, not
only the freshly created drives.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoblock: Prepare for NULL BDS
Max Reitz [Mon, 19 Oct 2015 15:53:29 +0000 (17:53 +0200)]
block: Prepare for NULL BDS

blk_bs() will not necessarily return a non-NULL value any more (unless
blk_is_available() is true or it can be assumed to otherwise, e.g.
because it is called immediately after a successful blk_new_with_bs() or
blk_new_open()).

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoblock: Add blk_insert_bs()
Max Reitz [Mon, 19 Oct 2015 15:53:28 +0000 (17:53 +0200)]
block: Add blk_insert_bs()

This function associates the given BlockDriverState with the given
BlockBackend.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoblock: Prepare remaining BB functions for NULL BDS
Max Reitz [Mon, 19 Oct 2015 15:53:27 +0000 (17:53 +0200)]
block: Prepare remaining BB functions for NULL BDS

There are several BlockBackend functions which, in theory, cannot fail.
This patch makes them cope with the BlockDriverState pointer being NULL
by making them fall back to some default action like ignoring the value
in setters and returning the default in getters.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoblock: Fail requests to empty BlockBackend
Max Reitz [Mon, 19 Oct 2015 15:53:26 +0000 (17:53 +0200)]
block: Fail requests to empty BlockBackend

If there is no BlockDriverState in a BlockBackend or if the tray of the
guest device is open, fail all requests (where that is possible) with
-ENOMEDIUM.

The reason the status of the guest device is taken into account is
because once the guest device's tray is opened, any request on the same
BlockBackend as the guest uses should fail. If the BDS tree is supposed
to be usable even after ejecting it from the guest, a different
BlockBackend must be used.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoblock: Make some BB functions fall back to BBRS
Max Reitz [Mon, 19 Oct 2015 15:53:25 +0000 (17:53 +0200)]
block: Make some BB functions fall back to BBRS

If there is no BDS tree attached to a BlockBackend, functions that can
do so should fall back to the BlockBackendRootState structure.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoblock: Add BlockBackendRootState
Max Reitz [Mon, 19 Oct 2015 15:53:24 +0000 (17:53 +0200)]
block: Add BlockBackendRootState

This structure will store some of the state of the root BDS if the BDS
tree is removed, so that state can be restored once a new BDS tree is
inserted.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoblock/throttle-groups: Make incref/decref public
Max Reitz [Mon, 19 Oct 2015 15:53:23 +0000 (17:53 +0200)]
block/throttle-groups: Make incref/decref public

Throttle groups are not necessarily referenced by BDSs alone; a later
patch will essentially allow BBs to reference them, too. Make the
ref/unref functions public so that reference can be properly accounted
for.

Their interface is slightly adjusted in that they return and take a
ThrottleState pointer, respectively, instead of a ThrottleGroup pointer.
Functionally, they are equivalent, but since ThrottleGroup is not meant
to be used outside of block/throttle-groups.c, ThrottleState is easier
to handle.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoblock: Move I/O status and error actions into BB
Max Reitz [Mon, 19 Oct 2015 15:53:22 +0000 (17:53 +0200)]
block: Move I/O status and error actions into BB

These options are only relevant for the user of a whole BDS tree (like a
guest device or a block job) and should thus be moved into the
BlockBackend.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoblock: Move BlockAcctStats into BlockBackend
Max Reitz [Mon, 19 Oct 2015 15:53:21 +0000 (17:53 +0200)]
block: Move BlockAcctStats into BlockBackend

As the comment above bdrv_get_stats() says, BlockAcctStats is something
which belongs to the device instead of each BlockDriverState. This patch
therefore moves it into the BlockBackend.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoblock: Remove wr_highest_sector from BlockAcctStats
Max Reitz [Mon, 19 Oct 2015 15:53:20 +0000 (17:53 +0200)]
block: Remove wr_highest_sector from BlockAcctStats

BlockAcctStats contains statistics about the data transferred from and
to the device; wr_highest_sector does not fit in with the rest.

Furthermore, those statistics are supposed to be specific for a certain
device and not necessarily for a BDS (see the comment above
bdrv_get_stats()); on the other hand, wr_highest_sector may be a rather
important information to know for each BDS. When BlockAcctStats is
finally removed from the BDS, we will want to keep wr_highest_sector in
the BDS.

Finally, wr_highest_sector is renamed to wr_highest_offset and given the
appropriate meaning. Externally, it is represented as an offset so there
is no point in doing something different internally. Its definition is
changed to match that in qapi/block-core.json which is "the offset after
the greatest byte written to". Doing so should not cause any harm since
if external programs tried to calculate the volume usage by
(wr_highest_offset + 512) / volume_size, after this patch they will just
assume the volume to be full slightly earlier than before.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoblock: Move guest_block_size into BlockBackend
Max Reitz [Mon, 19 Oct 2015 15:53:19 +0000 (17:53 +0200)]
block: Move guest_block_size into BlockBackend

guest_block_size is a guest device property so it should be moved into
the interface between block layer and guest devices, which is the
BlockBackend.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoblock: Fix BB AIOCB AioContext without BDS
Max Reitz [Mon, 19 Oct 2015 15:53:18 +0000 (17:53 +0200)]
block: Fix BB AIOCB AioContext without BDS

Fix the BlockBackend's AIOCB AioContext for aborting AIO in case there
is no BDS. If there is no implementation of AIOCBInfo::get_aio_context()
the AioContext is derived from the BDS the AIOCB belongs to. If that BDS
is NULL (because it has been removed from the BB) this will not work.

This patch makes blk_get_aio_context() fall back to the main loop
context if the BDS pointer is NULL and implements
AIOCBInfo::get_aio_context() (blk_aiocb_get_aio_context()) which invokes
blk_get_aio_context().

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agohw/usb-storage: Check whether BB is inserted
Max Reitz [Mon, 19 Oct 2015 15:53:17 +0000 (17:53 +0200)]
hw/usb-storage: Check whether BB is inserted

Only call bdrv_add_key() on the BlockDriverState if it is not NULL.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agohw/block/fdc: Implement tray status
Max Reitz [Mon, 19 Oct 2015 15:53:16 +0000 (17:53 +0200)]
hw/block/fdc: Implement tray status

The tray of an FDD is open iff there is no medium inserted (there are
only two states for an FDD: "medium inserted" or "no medium inserted").

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoblock: Invoke change media CB before NULLing drv
Max Reitz [Mon, 19 Oct 2015 15:53:15 +0000 (17:53 +0200)]
block: Invoke change media CB before NULLing drv

In order to handle host device passthrough, some guest device models
may call blk_is_inserted() to check whether the medium is inserted on
the host, when checking the guest tray status.

This tray status is inquired by blk_dev_change_media_cb(); because
bdrv_is_inserted() (invoked by blk_is_inserted()) always returns false
for BDS with drv set to NULL, blk_dev_change_media_cb() should therefore
be called before drv is set to NULL.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoblock/raw_bsd: Drop raw_is_inserted()
Max Reitz [Mon, 19 Oct 2015 15:53:14 +0000 (17:53 +0200)]
block/raw_bsd: Drop raw_is_inserted()

With the new automatically-recursive implementation of
bdrv_is_inserted() checking by default whether all the children of a BDS
are inserted, we can drop raw's own implementation.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoblock: Make bdrv_is_inserted() recursive
Max Reitz [Mon, 19 Oct 2015 15:53:13 +0000 (17:53 +0200)]
block: Make bdrv_is_inserted() recursive

If bdrv_is_inserted() is called on the top level BDS, it should make
sure all nodes in the BDS tree are actually inserted.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoblock: Add blk_is_available()
Max Reitz [Mon, 19 Oct 2015 15:53:12 +0000 (17:53 +0200)]
block: Add blk_is_available()

blk_is_available() returns true iff the BDS is inserted (which means
blk_bs() is not NULL and bdrv_is_inserted() returns true) and if the
tray of the guest device is closed.

blk_is_inserted() is changed to return true only if blk_bs() is not
NULL.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoblock: Make bdrv_is_inserted() return a bool
Max Reitz [Mon, 19 Oct 2015 15:53:11 +0000 (17:53 +0200)]
block: Make bdrv_is_inserted() return a bool

Make bdrv_is_inserted(), blk_is_inserted(), and the callback
BlockDriver.bdrv_is_inserted() return a bool.

Suggested-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoiotests: Only create BB if necessary
Max Reitz [Mon, 19 Oct 2015 15:53:10 +0000 (17:53 +0200)]
iotests: Only create BB if necessary

Tests 071 and 081 test giving references in blockdev-add. It is not
necessary to create a BlockBackend here, so omit it.

While at it, fix up some blockdev-add invocations in the vicinity
(s/raw/$IMGFMT/ in 081, drop the format BDS for blkverify's raw child in
071).

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoblockdev: Allow creation of BDS trees without BB
Max Reitz [Mon, 19 Oct 2015 15:53:09 +0000 (17:53 +0200)]
blockdev: Allow creation of BDS trees without BB

If the "id" field is missing from the options given to blockdev-add,
just omit the BlockBackend and create the BlockDriverState tree alone.

However, if "id" is missing, "node-name" must be specified; otherwise,
the BDS tree would no longer be accessible.

Many BDS options which are not parsed by bdrv_open() (like caching)
cannot be specified for these BB-less BDS trees yet. A future patch will
remove this limitation.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoblock: Set BDRV_O_INCOMING in bdrv_fill_options()
Max Reitz [Mon, 19 Oct 2015 15:53:08 +0000 (17:53 +0200)]
block: Set BDRV_O_INCOMING in bdrv_fill_options()

This flag should not be set for the root BDS only, but for any BDS that
is being created while incoming migration is pending, so setting it is
moved from blockdev_init() to bdrv_fill_options().

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoblock: Remove host floppy support
Max Reitz [Mon, 19 Oct 2015 15:53:07 +0000 (17:53 +0200)]
block: Remove host floppy support

It has been deprecated as of 2.3, so we can now remove it.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoMerge remote-tracking branch 'remotes/ehabkost/tags/x86-pull-request' into staging
Peter Maydell [Fri, 23 Oct 2015 15:35:43 +0000 (16:35 +0100)]
Merge remote-tracking branch 'remotes/ehabkost/tags/x86-pull-request' into staging

X86 queue, 2015-10-23

# gpg: Signature made Fri 23 Oct 2015 16:30:58 BST using RSA key ID 984DC5A6
# gpg: Good signature from "Eduardo Habkost <ehabkost@redhat.com>"

* remotes/ehabkost/tags/x86-pull-request:
  vl: trivial: minor tweaks to a max-cpu error msg
  target-i386: Use 1UL for bit shift
  target-i386: Add DE to TCG_FEATURES
  target-i386: Ensure always-1 bits on DR6 can't be cleared
  target-i386: Check CR4[DE] for processing DR4/DR5
  target-i386: Handle I/O breakpoints
  target-i386: Optimize setting dr[0-3]
  target-i386: Move hw_*breakpoint_* functions
  target-i386: Ensure bit 10 on DR7 is never cleared
  target-i386: Re-introduce optimal breakpoint removal
  target-i386: Introduce cpu_x86_update_dr7
  target-i386: Disable cache info passthrough by default
  target-i386: allow any alignment for SMBASE

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agovl: trivial: minor tweaks to a max-cpu error msg
Andrew Jones [Sun, 18 Oct 2015 17:35:27 +0000 (19:35 +0200)]
vl: trivial: minor tweaks to a max-cpu error msg

Signed-off-by: Andrew Jones <drjones@redhat.com>
8 years agotarget-i386: Use 1UL for bit shift
Eduardo Habkost [Tue, 29 Sep 2015 20:34:22 +0000 (17:34 -0300)]
target-i386: Use 1UL for bit shift

Fix undefined behavior detected by clang runtime check:

  qemu/target-i386/cpu.c:1494:15: runtime error:
    left shift of 1 by 31 places cannot be represented in type 'int'

While doing that, add extra parenthesis for clarity.

Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
8 years agotarget-i386: Add DE to TCG_FEATURES
Eduardo Habkost [Wed, 7 Oct 2015 19:39:43 +0000 (16:39 -0300)]
target-i386: Add DE to TCG_FEATURES

Now DE is supported by TCG so it can be enabled in CPUID bits.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
8 years agotarget-i386: Ensure always-1 bits on DR6 can't be cleared
Eduardo Habkost [Wed, 7 Oct 2015 20:19:18 +0000 (17:19 -0300)]
target-i386: Ensure always-1 bits on DR6 can't be cleared

Bits 4-11 and 16-31 on DR6 are documented as always 1, so ensure they
can't be cleared by software.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
8 years agotarget-i386: Check CR4[DE] for processing DR4/DR5
Richard Henderson [Tue, 15 Sep 2015 18:45:13 +0000 (11:45 -0700)]
target-i386: Check CR4[DE] for processing DR4/DR5

Introduce helper_get_dr so that we don't have to put CR4[DE]
into the scarce HFLAGS resource.  At the same time, rename
helper_movl_drN_T0 to helper_set_dr and set the helper flags.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
8 years agotarget-i386: Handle I/O breakpoints
Eduardo Habkost [Mon, 19 Oct 2015 17:14:35 +0000 (15:14 -0200)]
target-i386: Handle I/O breakpoints

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
8 years agotarget-i386: Optimize setting dr[0-3]
Richard Henderson [Tue, 15 Sep 2015 18:45:11 +0000 (11:45 -0700)]
target-i386: Optimize setting dr[0-3]

If the debug register is not enabled, we need
do nothing besides update the register.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
8 years agotarget-i386: Move hw_*breakpoint_* functions
Richard Henderson [Tue, 15 Sep 2015 18:45:10 +0000 (11:45 -0700)]
target-i386: Move hw_*breakpoint_* functions

They're only used from bpt_helper.c now.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
8 years agotarget-i386: Ensure bit 10 on DR7 is never cleared
Eduardo Habkost [Thu, 8 Oct 2015 20:10:27 +0000 (17:10 -0300)]
target-i386: Ensure bit 10 on DR7 is never cleared

Bit 10 of DR7 is documented as always set to 1, so ensure that's
always the case.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
8 years agotarget-i386: Re-introduce optimal breakpoint removal
Richard Henderson [Tue, 15 Sep 2015 18:45:09 +0000 (11:45 -0700)]
target-i386: Re-introduce optimal breakpoint removal

Before the last patch, we had an efficient loop that disabled
local breakpoints on task switch.  Re-add that, but in a more
general way that handles changes to the global enable bits too.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
8 years agotarget-i386: Introduce cpu_x86_update_dr7
Richard Henderson [Tue, 15 Sep 2015 18:45:08 +0000 (11:45 -0700)]
target-i386: Introduce cpu_x86_update_dr7

This moves the last of the iteration over breakpoints into
the bpt_helper.c file.  This also allows us to make several
breakpoint functions static.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
8 years agotarget-i386: Disable cache info passthrough by default
Eduardo Habkost [Wed, 2 Sep 2015 14:19:11 +0000 (11:19 -0300)]
target-i386: Disable cache info passthrough by default

The host cache information may not make sense for the guest if the VM
CPU topology doesn't match the host CPU topology. To make sure we won't
expose broken cache information to the guest, disable cache info
passthrough by default, and add a new "host-cache-info" property that
can be used to enable the old behavior for users that really need it.

Cc: Benoît Canet <benoit@irqsave.net>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
8 years agotarget-i386: allow any alignment for SMBASE
Paolo Bonzini [Mon, 12 Oct 2015 16:25:40 +0000 (18:25 +0200)]
target-i386: allow any alignment for SMBASE

Processors up to the Pentium (says Bochs---I do not have old enough
manuals) require a 32KiB alignment for the SMBASE, but newer processors
do not need that, and Tiano Core will use non-aligned SMBASE values.

Reported-by: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
8 years agoMerge remote-tracking branch 'remotes/mdroth/tags/qga-pull-2015-10-23-tag' into staging
Peter Maydell [Fri, 23 Oct 2015 14:55:50 +0000 (15:55 +0100)]
Merge remote-tracking branch 'remotes/mdroth/tags/qga-pull-2015-10-23-tag' into staging

qemu-ga patch queue

* unbreak qga-test unit test on travis-ci systems by not assuming a
  disk-based filesystem must be present

# gpg: Signature made Fri 23 Oct 2015 15:01:47 BST using RSA key ID F108B584
# gpg: Good signature from "Michael Roth <flukshun@gmail.com>"
# gpg:                 aka "Michael Roth <mdroth@utexas.edu>"
# gpg:                 aka "Michael Roth <mdroth@linux.vnet.ibm.com>"

* remotes/mdroth/tags/qga-pull-2015-10-23-tag:
  tests: test-qga, loosen assumptions about host filesystems

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agotests: test-qga, loosen assumptions about host filesystems
Michael Roth [Tue, 20 Oct 2015 16:17:36 +0000 (11:17 -0500)]
tests: test-qga, loosen assumptions about host filesystems

QGA skips pseudo-filesystems when querying filesystems via
guest-get-fsinfo. On some hosts, such as travis-ci which uses
containers with simfs filesystems, QGA might not report *any*
filesystems. Our test case assumes there would be at least one,
leading to false error messages in these situations.

Instead, sanity-check values iff we get at least one filesystem.

Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
Cc: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
8 years agoMerge remote-tracking branch 'remotes/dgibson/tags/ppc-next-20151023' into staging
Peter Maydell [Fri, 23 Oct 2015 12:09:09 +0000 (13:09 +0100)]
Merge remote-tracking branch 'remotes/dgibson/tags/ppc-next-20151023' into staging

ppc patch queue - 2015-10-23

sPAPR highlights:
  * Allow VFIO devices on the spapr-pci-host-bridge
  * Allow virtio VGA
  * Safer handling of HTAB allocation
  * ibm,pa-features device tree property

non-sPAPR highlights:
  * Categorization of many ppc specific devices in help output
  * Tweaks to MMU type constants

# gpg: Signature made Fri 23 Oct 2015 07:27:56 BST using RSA key ID 20D9B392
# gpg: Good signature from "David Gibson <david@gibson.dropbear.id.au>"
# gpg:                 aka "David Gibson (Red Hat) <dgibson@redhat.com>"
# gpg:                 aka "David Gibson (ozlabs.org) <dgibson@ozlabs.org>"
# gpg: WARNING: This key is not certified with sufficiently trusted signatures!
# gpg:          It is not certain that the signature belongs to the owner.
# Primary key fingerprint: 75F4 6586 AE61 A66C C44E  87DC 6C38 CACA 20D9 B392

* remotes/dgibson/tags/ppc-next-20151023: (21 commits)
  prep: do not use CPU_LOG_IOPORT, convert to tracepoints
  openpic: add to misc category
  macio-nvram: add to misc category
  macio: add to bridge category
  uninorth: add to bridge category
  macio-ide: add to storage category
  cuda: add to bridge category
  grackle: add to bridge category
  escc: add to input category
  cmd646: add to storage category
  adb: add to input category
  ppc/spapr: Add "ibm,pa-features" property to the device-tree
  ppc: Add mmu_model defines for arch 2.03 and 2.07
  hw/scsi/spapr_vscsi: Remove superfluous memset
  spapr_pci: Allow VFIO devices to work on the normal PCI host bridge
  spapr_iommu: Provide a function to switch a TCE table to allowing VFIO
  spapr_iommu: Rename vfio_accel parameter
  spapr_pci: Allow PCI host bridge DMA window to be configured
  spapr: Add "slb-size" property to CPU device tree nodes
  spapr: Abort when HTAB of requested size isn't allocated
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agoMerge remote-tracking branch 'remotes/berrange/tags/qcrypto-fixes-pull-20151022-2...
Peter Maydell [Fri, 23 Oct 2015 11:09:02 +0000 (12:09 +0100)]
Merge remote-tracking branch 'remotes/berrange/tags/qcrypto-fixes-pull-20151022-2' into staging

Merge qcrypto-fixes 2015/10/22

# gpg: Signature made Thu 22 Oct 2015 19:03:45 BST using RSA key ID 15104FDF
# gpg: Good signature from "Daniel P. Berrange <dan@berrange.com>"
# gpg:                 aka "Daniel P. Berrange <berrange@redhat.com>"

* remotes/berrange/tags/qcrypto-fixes-pull-20151022-2:
  configure: avoid polluting global CFLAGS with tasn1 flags
  crypto: add sanity checking of plaintext/ciphertext length
  crypto: don't let builtin aes crash if no IV is provided
  crypto: allow use of nettle/gcrypt to be selected explicitly

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agoMerge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging
Peter Maydell [Fri, 23 Oct 2015 09:24:08 +0000 (10:24 +0100)]
Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging

vhost: build fix

Fix build breakages when using older gcc.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
# gpg: Signature made Thu 22 Oct 2015 20:36:07 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:
  vhost-user: fix up rhel6 build

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agoprep: do not use CPU_LOG_IOPORT, convert to tracepoints
Paolo Bonzini [Fri, 16 Oct 2015 13:16:11 +0000 (15:16 +0200)]
prep: do not use CPU_LOG_IOPORT, convert to tracepoints

These messages are disabled by default; a perfect usecase for tracepoints.
Convert them over.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
8 years agoopenpic: add to misc category
Laurent Vivier [Sat, 26 Sep 2015 16:22:12 +0000 (18:22 +0200)]
openpic: add to misc category

openpic is a programmable interrupt controller, so
add it to the misc category.

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
8 years agomacio-nvram: add to misc category
Laurent Vivier [Sat, 26 Sep 2015 16:22:11 +0000 (18:22 +0200)]
macio-nvram: add to misc category

The macio nvram is a non volatile RAM, so add it
the misc category.

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
8 years agomacio: add to bridge category
Laurent Vivier [Sat, 26 Sep 2015 16:22:10 +0000 (18:22 +0200)]
macio: add to bridge category

macio is a bridge between the PCI bus and the Mac nvram,
IDE controller and PIC, so add it to the bridge category.

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
8 years agouninorth: add to bridge category
Laurent Vivier [Sat, 26 Sep 2015 16:22:09 +0000 (18:22 +0200)]
uninorth: add to bridge category

Uninorth is the mac99 PCI host controller, so add
it to the bridge category.

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
8 years agomacio-ide: add to storage category
Laurent Vivier [Sat, 26 Sep 2015 16:22:08 +0000 (18:22 +0200)]
macio-ide: add to storage category

macio-ide is an IDE controller, so add it
to the storage category.

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
8 years agocuda: add to bridge category
Laurent Vivier [Sat, 26 Sep 2015 16:22:07 +0000 (18:22 +0200)]
cuda: add to bridge category

Cuda is a bridge between PowerMac system bus and the ADB controller,
real-time clock, pram and the power management unit.

So add it to the bridge category.

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
8 years agograckle: add to bridge category
Laurent Vivier [Sat, 26 Sep 2015 16:22:06 +0000 (18:22 +0200)]
grackle: add to bridge category

Grackle is the PCI host controller of oldworld powermac,
so add it to the bridge category.

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
8 years agoescc: add to input category
Laurent Vivier [Sat, 26 Sep 2015 16:22:05 +0000 (18:22 +0200)]
escc: add to input category

ESCC is a serial port controller, so add it
to the input category.

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
8 years agocmd646: add to storage category
Laurent Vivier [Sat, 26 Sep 2015 16:22:04 +0000 (18:22 +0200)]
cmd646: add to storage category

cmd646 is an IDE controller, so add it to the
storage category.

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
8 years agoadb: add to input category
Laurent Vivier [Sat, 26 Sep 2015 16:22:03 +0000 (18:22 +0200)]
adb: add to input category

The Apple Desktop Bus is used to connect a keyboard and a mouse,
so add it to the input category.

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
8 years agoppc/spapr: Add "ibm,pa-features" property to the device-tree
Benjamin Herrenschmidt [Thu, 22 Oct 2015 07:30:59 +0000 (18:30 +1100)]
ppc/spapr: Add "ibm,pa-features" property to the device-tree

LoPAPR defines a "ibm,pa-features" per-CPU device tree property which
describes extended features of the Processor Architecture.

This adds the property to the device tree. At the moment this is the
copy of what pHyp advertises except "I=1 (cache inhibited) Large Pages"
which is enabled for TCG and disabled when running under HV KVM host
with 4K system page size.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
[aik: rebased, changed commit log, moved ci_large_pages initialization,
renamed pa_features arrays]
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
8 years agoppc: Add mmu_model defines for arch 2.03 and 2.07
Benjamin Herrenschmidt [Thu, 22 Oct 2015 07:30:58 +0000 (18:30 +1100)]
ppc: Add mmu_model defines for arch 2.03 and 2.07

This removes unused POWERPC_MMU_2_06a/POWERPC_MMU_2_06d.

This replaces POWERPC_MMU_64B with POWERPC_MMU_2_03 for POWER5+ to be
more explicit about the version of the PowerISA supported.

This defines POWERPC_MMU_2_07 and uses it for the POWER8 CPU family.
This will not have an immediate effect now but it will in the following
patch.

This should cause no behavioural change.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
[aik: rebased, changed commit log]
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
8 years agohw/scsi/spapr_vscsi: Remove superfluous memset
Thomas Huth [Thu, 8 Oct 2015 19:35:13 +0000 (21:35 +0200)]
hw/scsi/spapr_vscsi: Remove superfluous memset

g_malloc0 already clears the memory, so no need for
the additional memset here.

Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: David Gibson <david@gibson.dropbear.id.au>
Cc: Alexander Graf <agraf@suse.de>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>