]> git.proxmox.com Git - mirror_qemu.git/log
mirror_qemu.git
5 years agopcie: Add a simple PCIe ACS (Access Control Services) helper function
Knut Omang [Thu, 21 Feb 2019 18:13:22 +0000 (19:13 +0100)]
pcie: Add a simple PCIe ACS (Access Control Services) helper function

Implementing an ACS capability on downstream ports and multifunction
endpoints indicates isolation and IOMMU visibility to a finer
granularity. This creates smaller IOMMU groups in the guest and thus
more flexibility in assigning endpoints to guest userspace or an L2
guest.

Signed-off-by: Knut Omang <knut.omang@oracle.com>
Message-Id: <07489975121696f5573b0a92baaf3486ef51e35d.1550768238.git-series.knut.omang@oracle.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Alex Williamson <alex.williamson@redhat.com>
5 years agovhost-user-blk: Add support to get/set inflight buffer
Xie Yongji [Thu, 28 Feb 2019 08:53:53 +0000 (16:53 +0800)]
vhost-user-blk: Add support to get/set inflight buffer

This patch adds support for vhost-user-blk device to get/set
inflight buffer from/to backend.

Signed-off-by: Xie Yongji <xieyongji@baidu.com>
Signed-off-by: Zhang Yu <zhangyu31@baidu.com>
Message-Id: <20190228085355.9614-6-xieyongji@baidu.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
5 years agolibvhost-user: Support tracking inflight I/O in shared memory
Xie Yongji [Thu, 28 Feb 2019 08:53:52 +0000 (16:53 +0800)]
libvhost-user: Support tracking inflight I/O in shared memory

This patch adds support for VHOST_USER_GET_INFLIGHT_FD and
VHOST_USER_SET_INFLIGHT_FD message to set/get shared buffer
to/from qemu. Then backend can track inflight I/O in this buffer.

Signed-off-by: Xie Yongji <xieyongji@baidu.com>
Signed-off-by: Zhang Yu <zhangyu31@baidu.com>
Message-Id: <20190228085355.9614-5-xieyongji@baidu.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
5 years agolibvhost-user: Introduce vu_queue_map_desc()
Xie Yongji [Thu, 28 Feb 2019 08:53:51 +0000 (16:53 +0800)]
libvhost-user: Introduce vu_queue_map_desc()

Introduce vu_queue_map_desc() which should be
independent with vu_queue_pop();

Signed-off-by: Xie Yongji <xieyongji@baidu.com>
Signed-off-by: Zhang Yu <zhangyu31@baidu.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20190228085355.9614-4-xieyongji@baidu.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
5 years agolibvhost-user: Remove unnecessary FD flag check for event file descriptors
Xie Yongji [Thu, 28 Feb 2019 08:53:50 +0000 (16:53 +0800)]
libvhost-user: Remove unnecessary FD flag check for event file descriptors

The vu_check_queue_msg_file() has checked the FD flag. So let's
delete the redundant check after it.

Signed-off-by: Xie Yongji <xieyongji@baidu.com>
Signed-off-by: Zhang Yu <zhangyu31@baidu.com>
Message-Id: <20190228085355.9614-3-xieyongji@baidu.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
5 years agovhost-user: Support transferring inflight buffer between qemu and backend
Xie Yongji [Thu, 28 Feb 2019 08:53:49 +0000 (16:53 +0800)]
vhost-user: Support transferring inflight buffer between qemu and backend

This patch introduces two new messages VHOST_USER_GET_INFLIGHT_FD
and VHOST_USER_SET_INFLIGHT_FD to support transferring a shared
buffer between qemu and backend.

Firstly, qemu uses VHOST_USER_GET_INFLIGHT_FD to get the
shared buffer from backend. Then qemu should send it back
through VHOST_USER_SET_INFLIGHT_FD each time we start vhost-user.

This shared buffer is used to track inflight I/O by backend.
Qemu should retrieve a new one when vm reset.

Signed-off-by: Xie Yongji <xieyongji@baidu.com>
Signed-off-by: Chai Wen <chaiwen@baidu.com>
Signed-off-by: Zhang Yu <zhangyu31@baidu.com>
Message-Id: <20190228085355.9614-2-xieyongji@baidu.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
5 years agonvdimm: use NVDIMM_ACPI_IO_LEN for the proper IO size
Wei Yang [Wed, 27 Feb 2019 07:51:00 +0000 (15:51 +0800)]
nvdimm: use NVDIMM_ACPI_IO_LEN for the proper IO size

The IO range is defined to 4 bytes with NVDIMM_ACPI_IO_LEN, so it is
more proper to use this macro instead of calculating it by sizeof.

Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
Message-Id: <20190227075101.6263-4-richardw.yang@linux.intel.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
5 years agonvdimm: use *function* directly instead of allocating it again
Wei Yang [Wed, 27 Feb 2019 07:50:59 +0000 (15:50 +0800)]
nvdimm: use *function* directly instead of allocating it again

At the beginning or nvdimm_build_common_dsm(), variable *function* is
already allocated for Arg2.

This patch reuse variable *function* instead of allocating it again.

Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
Message-Id: <20190227075101.6263-3-richardw.yang@linux.intel.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
5 years agonvdimm: fix typo in nvdimm_build_nvdimm_devices argument
Wei Yang [Wed, 27 Feb 2019 07:50:58 +0000 (15:50 +0800)]
nvdimm: fix typo in nvdimm_build_nvdimm_devices argument

>From dsm_dma_arrea to dsm_dma_area.

Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
Message-Id: <20190227075101.6263-2-richardw.yang@linux.intel.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
5 years agointel_iommu: add scalable-mode option to make scalable mode work
Yi Sun [Tue, 5 Mar 2019 02:34:55 +0000 (10:34 +0800)]
intel_iommu: add scalable-mode option to make scalable mode work

This patch adds an option to provide flexibility for user to expose
Scalable Mode to guest. User could expose Scalable Mode to guest by
the config as below:

"-device intel-iommu,caching-mode=on,scalable-mode=on"

The Linux iommu driver has supported scalable mode. Please refer below
patch set:

    https://www.spinics.net/lists/kernel/msg2985279.html

Signed-off-by: Liu, Yi L <yi.l.liu@intel.com>
Signed-off-by: Yi Sun <yi.y.sun@linux.intel.com>
Message-Id: <1551753295-30167-4-git-send-email-yi.y.sun@linux.intel.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
5 years agointel_iommu: add 256 bits qi_desc support
Liu, Yi L [Tue, 5 Mar 2019 02:34:54 +0000 (10:34 +0800)]
intel_iommu: add 256 bits qi_desc support

Per Intel(R) VT-d 3.0, the qi_desc is 256 bits in Scalable
Mode. This patch adds emulation of 256bits qi_desc.

Signed-off-by: Liu, Yi L <yi.l.liu@intel.com>
[Yi Sun is co-developer to rebase and refine the patch.]
Signed-off-by: Yi Sun <yi.y.sun@linux.intel.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Message-Id: <1551753295-30167-3-git-send-email-yi.y.sun@linux.intel.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
5 years agointel_iommu: scalable mode emulation
Liu, Yi L [Tue, 5 Mar 2019 02:34:53 +0000 (10:34 +0800)]
intel_iommu: scalable mode emulation

Intel(R) VT-d 3.0 spec introduces scalable mode address translation to
replace extended context mode. This patch extends current emulator to
support Scalable Mode which includes root table, context table and new
pasid table format change. Now intel_iommu emulates both legacy mode
and scalable mode (with legacy-equivalent capability set).

The key points are below:
1. Extend root table operations to support both legacy mode and scalable
   mode.
2. Extend context table operations to support both legacy mode and
   scalable mode.
3. Add pasid tabled operations to support scalable mode.

Signed-off-by: Liu, Yi L <yi.l.liu@intel.com>
[Yi Sun is co-developer to contribute much to refine the whole commit.]
Signed-off-by: Yi Sun <yi.y.sun@linux.intel.com>
Message-Id: <1551753295-30167-2-git-send-email-yi.y.sun@linux.intel.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
5 years agolibvhost-user: add vu_queue_unpop()
Marc-André Lureau [Fri, 8 Mar 2019 14:04:52 +0000 (15:04 +0100)]
libvhost-user: add vu_queue_unpop()

vhost-user-input will make use of this function to undo some queue pop
in case the virtio queue does not have enough room.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20190308140454.32437-11-marcandre.lureau@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
5 years agolibvhost-user-glib: export vug_source_new()
Marc-André Lureau [Fri, 8 Mar 2019 14:04:51 +0000 (15:04 +0100)]
libvhost-user-glib: export vug_source_new()

Simplify the creation of FD sources for other users. This is just
convenience to avoid duplicating similar code elsewhere.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20190308140454.32437-10-marcandre.lureau@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
5 years agovhost-user: split vhost_user_read()
Marc-André Lureau [Fri, 8 Mar 2019 14:04:49 +0000 (15:04 +0100)]
vhost-user: split vhost_user_read()

Split vhost_user_read(), so only header can be read with
vhost_user_read_header().

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20190308140454.32437-8-marcandre.lureau@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
5 years agovhost-user: wrap some read/write with retry handling
Marc-André Lureau [Fri, 8 Mar 2019 14:04:47 +0000 (15:04 +0100)]
vhost-user: wrap some read/write with retry handling

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20190308140454.32437-6-marcandre.lureau@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
5 years agolibvhost-user: exit by default on VHOST_USER_NONE
Marc-André Lureau [Fri, 8 Mar 2019 14:04:46 +0000 (15:04 +0100)]
libvhost-user: exit by default on VHOST_USER_NONE

Since commit 2566378d6d13bf4d28c7770bdbda5f7682594bbe, libvhost-user
no longer panics on disconnect (rc == 0), and instead silently ignores
an invalid VHOST_USER_NONE message.

Without extra work from the API user, this will simply busy-loop on
HUP events. The obvious thing to do is to exit(0) instead, while
additional or different work can be done by overriding
iface->process_msg().

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Jens Freimann <jfreimann@redhat.com>
Message-Id: <20190308140454.32437-5-marcandre.lureau@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
5 years agovhost-user: simplify vhost_user_init/vhost_user_cleanup
Marc-André Lureau [Fri, 8 Mar 2019 14:04:45 +0000 (15:04 +0100)]
vhost-user: simplify vhost_user_init/vhost_user_cleanup

Take a VhostUserState* that can be pre-allocated, and initialize it
with the associated chardev.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Tiwei Bie <tiwei.bie@intel.com>
Message-Id: <20190308140454.32437-4-marcandre.lureau@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
5 years agovhost-user: define conventions for vhost-user backends
Marc-André Lureau [Fri, 8 Mar 2019 14:04:44 +0000 (15:04 +0100)]
vhost-user: define conventions for vhost-user backends

As discussed during "[PATCH v4 00/29] vhost-user for input & GPU"
review, let's define a common set of backend conventions to help with
management layer implementation, and interoperability.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20190308140454.32437-3-marcandre.lureau@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
5 years agolibvhost-user: fix clang enum-conversion warning
Marc-André Lureau [Fri, 8 Mar 2019 14:04:43 +0000 (15:04 +0100)]
libvhost-user: fix clang enum-conversion warning

Now that the VhostUserMsg.request field is used for both master &
slave requests, since commit d84599f56c820d8c1ac9928a76500dcdfbbf194d:

contrib/libvhost-user/libvhost-user.c:953:20: error: implicit conversion from enumeration type 'enum VhostUserSlaveRequest' to different enumeration type 'VhostUserRequest' (aka 'enum VhostUserRequest') [-Werror,-Wenum-conversion]
        .request = VHOST_USER_SLAVE_VRING_HOST_NOTIFIER_MSG,
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20190308140454.32437-2-marcandre.lureau@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
5 years agovirtio-balloon: Restore MADV_WILLNEED hint on balloon deflate
David Gibson [Wed, 6 Mar 2019 03:06:01 +0000 (14:06 +1100)]
virtio-balloon: Restore MADV_WILLNEED hint on balloon deflate

Prior to f6deb6d9 "virtio-balloon: Remove unnecessary MADV_WILLNEED on
deflate", the balloon device issued an madvise() MADV_WILLNEED on
pages removed from the balloon.  That would hint to the host kernel
that the pages were likely to be needed by the guest in the near
future.

It's unclear if this is actually valuable or not, and so f6deb6d9
removed this, essentially ignoring balloon deflate requests.  However,
concerns have been raised that this might cause a performance
regression by causing extra latency for the guest in certain
configurations.

So, until we can get actual benchmark data to see if that's the case,
this restores the old behaviour, issuing a MADV_WILLNEED when a page is
removed from the balloon.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Message-Id: <20190306030601.21986-4-david@gibson.dropbear.id.au>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
5 years agovirtio-balloon: Fix possible guest memory corruption with inflates & deflates
David Gibson [Wed, 6 Mar 2019 03:06:00 +0000 (14:06 +1100)]
virtio-balloon: Fix possible guest memory corruption with inflates & deflates

This fixes a balloon bug with a nasty consequence - potentially
corrupting guest memory - but which is extremely unlikely to be
triggered in practice.

The balloon always works in 4kiB units, but the host could have a
larger page size on certain platforms.  Since ed48c59 "virtio-balloon:
Safely handle BALLOON_PAGE_SIZE < host page size" we've handled this
by accumulating requests to balloon 4kiB subpages until they formed a
full host page.  Since f6deb6d "virtio-balloon: Remove unnecessary
MADV_WILLNEED on deflate" we essentially ignore deflate requests.

Suppose we have a host with 8kiB pages, and one host page has subpages
A & B.  If we get this sequence of events -
inflate A
deflate A
inflate B
- the current logic will discard the whole host page.  That's
incorrect because the guest has deflated subpage A, and could have
written important data to it.

This patch fixes the problem by adjusting our state information about
partially ballooned host pages when deflate requests are received.

Fixes: ed48c59 "virtio-balloon: Safely handle BALLOON_PAGE_SIZE < host page size"
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Message-Id: <20190306030601.21986-3-david@gibson.dropbear.id.au>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: David Hildenbrand <david@redhat.com>
5 years agovirtio-balloon: Don't mismatch g_malloc()/free (CID 1399146)
David Gibson [Wed, 6 Mar 2019 03:05:59 +0000 (14:05 +1100)]
virtio-balloon: Don't mismatch g_malloc()/free (CID 1399146)

ed48c59875b6 "virtio-balloon: Safely handle BALLOON_PAGE_SIZE < host
page size" introduced a new temporary data structure which tracks 4kiB
chunks which have been inserted into the balloon by the guest but
don't yet form a full host page which we can discard.

Unfortunately, I had a thinko and allocated that structure with
g_malloc0() but freed it with a plain free() rather than g_free().
This corrects the problem.

Fixes: ed48c59875b6
Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Message-Id: <20190306030601.21986-2-david@gibson.dropbear.id.au>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
5 years agovirtio-balloon: fix a use-after-free case
Wei Wang [Tue, 12 Mar 2019 09:34:40 +0000 (17:34 +0800)]
virtio-balloon: fix a use-after-free case

The elem could theorically contain both outbuf and inbufs. We move the
free operation to the end of this function to avoid using elem->in_sg
while elem has been freed.

Fixes: c13c4153f7
("virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT")
Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Wei Wang <wei.w.wang@intel.com>
CC: Michael S. Tsirkin <mst@redhat.com>
CC: Dr. David Alan Gilbert <dgilbert@redhat.com>
CC: Juan Quintela <quintela@redhat.com>
CC: Peter Xu <peterx@redhat.com>
Message-Id: <1552383280-4122-1-git-send-email-wei.w.wang@intel.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
5 years agoMerge remote-tracking branch 'remotes/huth-gitlab/tags/pull-request-2019-03-12' into...
Peter Maydell [Tue, 12 Mar 2019 21:06:26 +0000 (21:06 +0000)]
Merge remote-tracking branch 'remotes/huth-gitlab/tags/pull-request-2019-03-12' into staging

- qtest patches
- One SD patch (with Reviewed-by from the maintainer)
- One license fix patch

# gpg: Signature made Tue 12 Mar 2019 09:03:58 GMT
# gpg:                using RSA key 2ED9D774FE702DB5
# gpg: Good signature from "Thomas Huth <th.huth@gmx.de>" [full]
# gpg:                 aka "Thomas Huth <thuth@redhat.com>" [full]
# gpg:                 aka "Thomas Huth <huth@tuxfamily.org>" [full]
# gpg:                 aka "Thomas Huth <th.huth@posteo.de>" [unknown]
# Primary key fingerprint: 27B8 8847 EEE0 2501 18F3  EAB9 2ED9 D774 FE70 2DB5

* remotes/huth-gitlab/tags/pull-request-2019-03-12:
  scripts/qemugdb: re-license timers.py to GPLv2 or later
  hw/sd/sdhci: Move PCI-related code into a separate file
  ahci-test: Drop dependence on global_qtest
  tests: test-announce-self: fix memory leak

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agocontrib: gitdm: add a mapping for Janus Technologies
Alex Bennée [Tue, 26 Feb 2019 15:35:24 +0000 (15:35 +0000)]
contrib: gitdm: add a mapping for Janus Technologies

Currently this just includes Marcel who is a fairly prolific
contributor.

Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
5 years agocontrib: gitdm: another IBM email
Alex Bennée [Tue, 26 Feb 2019 15:00:51 +0000 (15:00 +0000)]
contrib: gitdm: another IBM email

Based on Tom's LinkedIn profile his QEMU work was while in IBM's
virtualisation group.

Reviewed-by: Tom Musta <tommusta@gmail.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
5 years agocontrib: gitdm: add more individual contributors
Alex Bennée [Tue, 26 Feb 2019 14:51:21 +0000 (14:51 +0000)]
contrib: gitdm: add more individual contributors

I know Richard's is right because I asked him in the pub. I'm guessing
Fredrik's based on the fact I vaguely remember an Atari demo. The
others I attributed to academic institutions last time I posted so
have moved them to individuals as requested.

Cc: Fredrik Noring <noring@nocrew.org>
Cc: Samuel Thibault <samuel.thibault@ens-lyon.org>
Cc: Aurelien Jarno <aurelien@aurel32.net>
Cc: BALATON Zoltan <balaton@eik.bme.hu>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Acked-by: Richard Henderson <rth@twiddle.net>
5 years agocontrib: gitdm: Update Wave Computing group
Aleksandar Markovic [Fri, 18 Jan 2019 10:25:55 +0000 (11:25 +0100)]
contrib: gitdm: Update Wave Computing group

Add all missing MIPS/Imgtec/Wave contributors (from the inception of
QEMU).

Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
5 years agocontrib: gitdm: Update domain-map
Aleksandar Markovic [Fri, 18 Jan 2019 10:25:54 +0000 (11:25 +0100)]
contrib: gitdm: Update domain-map

Add Citrix, Huawei, Intel, and Microsoft to domain-map.

Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
[AJB: sorted, added Fujitsu]
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
5 years agoqemu-iotests: Test the x-blockdev-reopen QMP command
Alberto Garcia [Tue, 12 Mar 2019 16:48:52 +0000 (18:48 +0200)]
qemu-iotests: Test the x-blockdev-reopen QMP command

This patch adds several tests for the x-blockdev-reopen QMP command.

Signed-off-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agoblock: Add an 'x-blockdev-reopen' QMP command
Alberto Garcia [Tue, 12 Mar 2019 16:48:51 +0000 (18:48 +0200)]
block: Add an 'x-blockdev-reopen' QMP command

This command allows reopening an arbitrary BlockDriverState with a
new set of options. Some options (e.g node-name) cannot be changed
and some block drivers don't allow reopening, but otherwise this
command is modelled after 'blockdev-add' and the state of the reopened
BlockDriverState should generally be the same as if it had just been
added by 'blockdev-add' with the same set of options.

One notable exception is the 'backing' option: 'x-blockdev-reopen'
requires that it is always present unless the BlockDriverState in
question doesn't have a current or default backing file.

This command allows reconfiguring the graph by using the appropriate
options to change the children of a node. At the moment it's possible
to change a backing file by setting the 'backing' option to the name
of the new node, but it should also be possible to add a similar
functionality to other block drivers (e.g. Quorum, blkverify).

Although the API is unlikely to change, this command is marked
experimental for the time being so there's room to see if the
semantics need changes.

Signed-off-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agoblock: Remove the AioContext parameter from bdrv_reopen_multiple()
Alberto Garcia [Tue, 12 Mar 2019 16:48:50 +0000 (18:48 +0200)]
block: Remove the AioContext parameter from bdrv_reopen_multiple()

This parameter has been unused since 1a63a907507fbbcfaee3f622907ec244b

Signed-off-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agoblock: Add bdrv_reset_options_allowed()
Alberto Garcia [Tue, 12 Mar 2019 16:48:49 +0000 (18:48 +0200)]
block: Add bdrv_reset_options_allowed()

bdrv_reopen_prepare() receives a BDRVReopenState with (among other
things) a new set of options to be applied to that BlockDriverState.

If an option is missing then it means that we want to reset it to its
default value rather than keep the previous one. This way the state
of the block device after being reopened is comparable to that of a
device added with "blockdev-add" using the same set of options.

Not all options from all drivers can be changed this way, however.
If the user attempts to reset an immutable option to its default value
using this method then we must forbid it.

This new function takes a BlockDriverState and a new set of options
and checks if there's any option that was previously set but is
missing from the new set of options.

If the option is present in both sets we don't need to check that they
have the same value. The loop at the end of bdrv_reopen_prepare()
already takes care of that.

Signed-off-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agoblock: Add a 'mutable_opts' field to BlockDriver
Alberto Garcia [Tue, 12 Mar 2019 16:48:48 +0000 (18:48 +0200)]
block: Add a 'mutable_opts' field to BlockDriver

If we reopen a BlockDriverState and there is an option that is present
in bs->options but missing from the new set of options then we have to
return an error unless the driver is able to reset it to its default
value.

This patch adds a new 'mutable_opts' field to BlockDriver. This is
a list of runtime options that can be modified during reopen. If an
option in this list is unspecified on reopen then it must be reset (or
return an error).

Signed-off-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agoblock: Allow changing the backing file on reopen
Alberto Garcia [Tue, 12 Mar 2019 16:48:47 +0000 (18:48 +0200)]
block: Allow changing the backing file on reopen

This patch allows the user to change the backing file of an image that
is being reopened. Here's what it does:

 - In bdrv_reopen_prepare(): check that the value of 'backing' points
   to an existing node or is null. If it points to an existing node it
   also needs to make sure that replacing the backing file will not
   create a cycle in the node graph (i.e. you cannot reach the parent
   from the new backing file).

 - In bdrv_reopen_commit(): perform the actual node replacement by
   calling bdrv_set_backing_hd().

There may be temporary implicit nodes between a BDS and its backing
file (e.g. a commit filter node). In these cases bdrv_reopen_prepare()
looks for the real (non-implicit) backing file and requires that the
'backing' option points to it. Replacing or detaching a backing file
is forbidden if there are implicit nodes in the middle.

Although x-blockdev-reopen is meant to be used like blockdev-add,
there's an important thing that must be taken into account: the only
way to set a new backing file is by using a reference to an existing
node (previously added with e.g. blockdev-add).  If 'backing' contains
a dictionary with a new set of options ({"driver": "qcow2", "file": {
... }}) then it is interpreted that the _existing_ backing file must
be reopened with those options.

Signed-off-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agoblock: Allow omitting the 'backing' option in certain cases
Alberto Garcia [Tue, 12 Mar 2019 16:48:46 +0000 (18:48 +0200)]
block: Allow omitting the 'backing' option in certain cases

Of all options of type BlockdevRef used to specify children in
BlockdevOptions, 'backing' is the only one that is optional.

For "x-blockdev-reopen" we want that if an option is omitted then it
must be reset to its default value. The default value of 'backing'
means that QEMU opens the backing file specified in the image
metadata, but this is not something that we want to support for the
reopen operation.

Because of this the 'backing' option has to be specified during
reopen, pointing to the existing backing file if we want to keep it,
or pointing to a different one (or NULL) if we want to replace it (to
be implemented in a subsequent patch).

In order to simplify things a bit and not to require that the user
passes the 'backing' option to every single block device even when
it's clearly not necessary, this patch allows omitting this option if
the block device being reopened doesn't have a backing file attached
_and_ no default backing file is specified in the image metadata.

Signed-off-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agoblock: Handle child references in bdrv_reopen_queue()
Alberto Garcia [Tue, 12 Mar 2019 16:48:45 +0000 (18:48 +0200)]
block: Handle child references in bdrv_reopen_queue()

Children in QMP are specified with BlockdevRef / BlockdevRefOrNull,
which can contain a set of child options, a child reference, or
NULL. In optional attributes like "backing" it can also be missing.

Only the first case (set of child options) is being handled properly
by bdrv_reopen_queue(). This patch deals with all the others.

Here's how these cases should be handled when bdrv_reopen_queue() is
deciding what to do with each child of a BlockDriverState:

   1) Set of child options: if the child was implicitly created (i.e
      inherits_from points to the parent) then the options are removed
      from the parent's options QDict and are passed to the child with
      a recursive bdrv_reopen_queue() call. This case was already
      working fine.

   2) Child reference: there's two possibilites here.

      2a) Reference to the current child: if the child was implicitly
          created then it is put in the reopen queue, keeping its
          current set of options (since this was a child reference
          there was no way to specify a different set of options).
          If the child is not implicit then it keeps its current set
          of options but it is not reopened (and therefore does not
          inherit any new option from the parent).

      2b) Reference to a different BDS: the current child is not put
          in the reopen queue at all. Passing a reference to a
          different BDS can be used to replace a child, although at
          the moment no driver implements this, so it results in an
          error. In any case, the current child is not going to be
          reopened (and might in fact disappear if it's replaced)

   3) NULL: This is similar to (2b). Although no driver allows this
      yet it can be used to detach the current child so it should not
      be put in the reopen queue.

   4) Missing option: at the moment "backing" is the only case where
      this can happen. With "blockdev-add", leaving "backing" out
      means that the default backing file is opened. We don't want to
      open a new image during reopen, so we require that "backing" is
      always present. We'll relax this requirement a bit in the next
      patch. If keep_old_opts is true and "backing" is missing then
      this behaves like 2a (the current child is reopened).

Signed-off-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agoblock: Add 'keep_old_opts' parameter to bdrv_reopen_queue()
Alberto Garcia [Tue, 12 Mar 2019 16:48:44 +0000 (18:48 +0200)]
block: Add 'keep_old_opts' parameter to bdrv_reopen_queue()

The bdrv_reopen_queue() function is used to create a queue with
the BDSs that are going to be reopened and their new options. Once
the queue is ready bdrv_reopen_multiple() is called to perform the
operation.

The original options from each one of the BDSs are kept, with the new
options passed to bdrv_reopen_queue() applied on top of them.

For "x-blockdev-reopen" we want a function that behaves much like
"blockdev-add". We want to ignore the previous set of options so that
only the ones actually specified by the user are applied, with the
rest having their default values.

One of the things that we need is a way to tell bdrv_reopen_queue()
whether we want to keep the old set of options or not, and that's what
this patch does. All current callers are setting this new parameter to
true and x-blockdev-reopen will set it to false.

Signed-off-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agoblock: Freeze the backing chain for the duration of the stream job
Alberto Garcia [Tue, 12 Mar 2019 16:48:43 +0000 (18:48 +0200)]
block: Freeze the backing chain for the duration of the stream job

Signed-off-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agoblock: Freeze the backing chain for the duration of the mirror job
Alberto Garcia [Tue, 12 Mar 2019 16:48:42 +0000 (18:48 +0200)]
block: Freeze the backing chain for the duration of the mirror job

Signed-off-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agoblock: Freeze the backing chain for the duration of the commit job
Alberto Garcia [Tue, 12 Mar 2019 16:48:41 +0000 (18:48 +0200)]
block: Freeze the backing chain for the duration of the commit job

Signed-off-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agoblock: Allow freezing BdrvChild links
Alberto Garcia [Tue, 12 Mar 2019 16:48:40 +0000 (18:48 +0200)]
block: Allow freezing BdrvChild links

Our permission system is useful to define what operations are allowed
on a certain block node and includes things like BLK_PERM_WRITE or
BLK_PERM_RESIZE among others.

One of the permissions is BLK_PERM_GRAPH_MOD which allows "changing
the node that this BdrvChild points to". The exact meaning of this has
never been very clear, but it can be understood as "change any of the
links connected to the node". This can be used to prevent changing a
backing link, but it's too coarse.

This patch adds a new 'frozen' attribute to BdrvChild, which forbids
detaching the link from the node it points to, and new API to freeze
and unfreeze a backing chain.

After this change a few functions can fail, so they need additional
checks.

Signed-off-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agonvme: fix write zeroes offset and count
Keith Busch [Mon, 11 Mar 2019 15:11:53 +0000 (09:11 -0600)]
nvme: fix write zeroes offset and count

The implementation used blocks units rather than the expected bytes.

Fixes: c03e7ef12a9 ("nvme: Implement Write Zeroes")
Reported-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Keith Busch <keith.busch@intel.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agofile-posix: Make auto-read-only dynamic
Kevin Wolf [Fri, 1 Mar 2019 21:15:11 +0000 (22:15 +0100)]
file-posix: Make auto-read-only dynamic

Until now, with auto-read-only=on we tried to open the file read-write
first and if that failed, read-only was tried. This is actually not good
enough for libvirt, which gives QEMU SELinux permissions for read-write
only as soon as it actually intends to write to the image. So we need to
be able to switch between read-only and read-write at runtime.

This patch makes auto-read-only dynamic, i.e. the file is opened
read-only as long as no user of the node has requested write
permissions, but it is automatically reopened read-write as soon as the
first writer is attached. Conversely, if the last writer goes away, the
file is reopened read-only again.

bs->read_only is no longer set for auto-read-only=on files even if the
file descriptor is opened read-only because it will be transparently
upgraded as soon as a writer is attached. This changes the output of
qemu-iotests 232.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agofile-posix: Prepare permission code for fd switching
Kevin Wolf [Fri, 8 Mar 2019 14:40:40 +0000 (15:40 +0100)]
file-posix: Prepare permission code for fd switching

In order to be able to dynamically reopen the file read-only or
read-write, depending on the users that are attached, we need to be able
to switch to a different file descriptor during the permission change.

This interacts with reopen, which also creates a new file descriptor and
performs permission changes internally. In this case, the permission
change code must reuse the reopen file descriptor instead of creating a
third one.

In turn, reopen can drop its code to copy file locks to the new file
descriptor because that is now done when applying the new permissions.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agofile-posix: Lock new fd in raw_reopen_prepare()
Kevin Wolf [Fri, 1 Mar 2019 21:48:45 +0000 (22:48 +0100)]
file-posix: Lock new fd in raw_reopen_prepare()

There is no reason why we can take locks on the new file descriptor only
in raw_reopen_commit() where error handling isn't possible any more.
Instead, we can already do this in raw_reopen_prepare().

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agofile-posix: Store BDRVRawState.reopen_state during reopen
Kevin Wolf [Thu, 7 Mar 2019 18:07:35 +0000 (19:07 +0100)]
file-posix: Store BDRVRawState.reopen_state during reopen

We'll want to access the file descriptor in the reopen_state while
processing permission changes in the context of the repoen.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agofile-posix: Factor out raw_reconfigure_getfd()
Kevin Wolf [Fri, 1 Mar 2019 23:26:30 +0000 (00:26 +0100)]
file-posix: Factor out raw_reconfigure_getfd()

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agofile-posix: Fix bdrv_open_flags() for snapshot=on
Kevin Wolf [Mon, 11 Mar 2019 15:13:16 +0000 (16:13 +0100)]
file-posix: Fix bdrv_open_flags() for snapshot=on

Using a different read-only setting for bs->open_flags than for the
flags to the driver's open function is just inconsistent and a bad idea.
After this patch, the temporary snapshot keeps being opened read-only if
read-only=on,snapshot=on is passed.

If we wanted to change this behaviour to make only the orginal image
file read-only, but the temporary overlay read-write (as the comment in
the removed code suggests), that change would have to be made in
bdrv_temp_snapshot_options() (where the comment suggests otherwise).

Addressing this inconsistency before introducing dynamic auto-read-only
is important because otherwise we would immediately try to reopen the
temporary overlay even though the file is already unlinked.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agoblock: Make permission changes in reopen less wrong
Kevin Wolf [Tue, 5 Mar 2019 16:18:22 +0000 (17:18 +0100)]
block: Make permission changes in reopen less wrong

The way that reopen interacts with permission changes has one big
problem: Both operations are recursive, and the permissions are changes
for each node in the reopen queue.

For a simple graph that consists just of parent and child,
.bdrv_check_perm will be called twice for the child, once recursively
when adjusting the permissions of parent, and once again when the child
itself is reopened.

Even worse, the first .bdrv_check_perm call happens before
.bdrv_reopen_prepare was called for the child and the second one is
called afterwards.

Making sure that .bdrv_check_perm (and the other permission callbacks)
are called only once is hard. We can cope with multiple calls right now,
but as soon as file-posix gets a dynamic auto-read-only that may need to
open a new file descriptor, we get the additional requirement that all
of them are after the .bdrv_reopen_prepare call.

So reorder things in bdrv_reopen_multiple() to first call
.bdrv_reopen_prepare for all involved nodes and only then adjust
permissions.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agoblock: Avoid useless local_err
Kevin Wolf [Tue, 5 Mar 2019 15:51:13 +0000 (16:51 +0100)]
block: Avoid useless local_err

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agoqemu-iotests: commit to backing file with auto-read-only
Kevin Wolf [Mon, 11 Mar 2019 16:40:41 +0000 (17:40 +0100)]
qemu-iotests: commit to backing file with auto-read-only

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agotests/virtio-blk-test: Disable auto-read-only
Kevin Wolf [Tue, 5 Mar 2019 13:14:52 +0000 (14:14 +0100)]
tests/virtio-blk-test: Disable auto-read-only

tests/virtio-blk-test uses a temporary image file that it deletes while
QEMU is still running, so it can't be reopened when writers are
attached or detached. Disable auto-read-only to keep it always writable.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agoqapi: drop x- from x-block-latency-histogram-set
Vladimir Sementsov-Ogievskiy [Tue, 5 Mar 2019 12:53:17 +0000 (15:53 +0300)]
qapi: drop x- from x-block-latency-histogram-set

Drop x- and x_ prefixes for latency histograms and update version to
4.0

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agotests/qemu-iotests: add bitmap resize test 246
John Snow [Mon, 11 Mar 2019 18:51:47 +0000 (21:51 +0300)]
tests/qemu-iotests: add bitmap resize test 246

Test that we can actually resize qcow2 images with persistent bitmaps
correctly. Throw some other goofy stuff at the test while we're at it,
like adding bitmaps of different granularities and at different times.

Signed-off-by: John Snow <jsnow@redhat.com>
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Tested-by: Eric Blake <eblake@redhat.com>
Message-id: 20190311185147.52309-5-vsementsov@virtuozzo.com
   [vsmentsov: drop \n from the end of test output,
      test output changed a bit: some bitmaps goes in other order
      int the output]
Signed-off-by: John Snow <jsnow@redhat.com>
5 years agoblock/qcow2-bitmap: Allow resizes with persistent bitmaps
John Snow [Mon, 11 Mar 2019 18:51:46 +0000 (21:51 +0300)]
block/qcow2-bitmap: Allow resizes with persistent bitmaps

Since we now load all bitmaps into memory anyway, we can just truncate
them in-memory and then flush them back to disk. Just in case, we will
still check and enforce that this shortcut is valid -- i.e. that any
bitmap described on-disk is indeed in-memory and can be modified.

If there are any inconsistent bitmaps, we refuse to allow the truncate
as we do not actually load these bitmaps into memory, and it isn't safe
or reasonable to attempt to truncate corrupted data.

Signed-off-by: John Snow <jsnow@redhat.com>
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-id: 20190311185147.52309-4-vsementsov@virtuozzo.com
  [vsementsov: drop bitmap flushing, fix block comments style]
Signed-off-by: John Snow <jsnow@redhat.com>
5 years agoblock/qcow2-bitmap: Don't check size for IN_USE bitmap
Vladimir Sementsov-Ogievskiy [Mon, 11 Mar 2019 18:51:45 +0000 (21:51 +0300)]
block/qcow2-bitmap: Don't check size for IN_USE bitmap

We are going to allow image resize when there are persistent bitmaps.
It may lead to appearing of inconsistent bitmaps (IN_USE=1) with
inconsistent size. But we still want to load them as inconsistent.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-id: 20190311185147.52309-3-vsementsov@virtuozzo.com
Signed-off-by: John Snow <jsnow@redhat.com>
5 years agoMerge remote-tracking branch 'remotes/ehabkost/tags/python-next-pull-request' into...
Peter Maydell [Tue, 12 Mar 2019 18:31:56 +0000 (18:31 +0000)]
Merge remote-tracking branch 'remotes/ehabkost/tags/python-next-pull-request' into staging

qmp-shell: fix nested json regression

One small bug fix.

# gpg: Signature made Tue 12 Mar 2019 02:16:24 GMT
# gpg:                using RSA key 2807936F984DC5A6
# gpg: Good signature from "Eduardo Habkost <ehabkost@redhat.com>" [full]
# Primary key fingerprint: 5A32 2FD5 ABC4 D3DB ACCF  D1AA 2807 936F 984D C5A6

* remotes/ehabkost/tags/python-next-pull-request:
  qmp-shell: fix nested json regression

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years ago.travis.yml: add softmmu check-tcg tests
Alex Bennée [Thu, 28 Feb 2019 10:18:43 +0000 (10:18 +0000)]
.travis.yml: add softmmu check-tcg tests

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
5 years ago.travis.yml: separate softfloat from check-tcg
Alex Bennée [Thu, 28 Feb 2019 10:15:29 +0000 (10:15 +0000)]
.travis.yml: separate softfloat from check-tcg

While used by TCG it is not explicitly part of TCG and the tests can
be run standalone in a minimal build.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
5 years agotests/tcg/arm: account for pauth randomness
Alex Bennée [Tue, 12 Mar 2019 15:42:21 +0000 (15:42 +0000)]
tests/tcg/arm: account for pauth randomness

Pointer authentication isn't guaranteed to always detect a clash
between different keys. Take this into account in the test by running
several times and checking the percentage hit rate of the test.

Cc: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
5 years agotests/tcg/i386: add memory test to exercise softmmu
Alex Bennée [Mon, 4 Mar 2019 19:32:41 +0000 (19:32 +0000)]
tests/tcg/i386: add memory test to exercise softmmu

This is a simple test to check various access patterns to memory
including unaligned access.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
5 years agotests/tcg/i386: add system mode Hello World test
Alex Bennée [Fri, 1 Mar 2019 16:37:02 +0000 (16:37 +0000)]
tests/tcg/i386: add system mode Hello World test

This introduces the build framework for simple i386 system tests. The
first test is the eponymous "Hello World" which simply outputs the
text on the serial port and then exits.

I've included the framework for x86_64 but it is not in this series as
it is a work in progress.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
5 years agotests/tcg: provide a minilib for system tests
Alex Bennée [Tue, 5 Mar 2019 11:40:31 +0000 (11:40 +0000)]
tests/tcg: provide a minilib for system tests

We will likely want a few common functions to make up for the fact we
don't have a libc and we don't want to feel like we are programming by
banging rocks together.

I've purloined the printf function from:

  https://git.virtualopensystems.com/dev/tcg_baremetal_tests

Although I have tweaked the names to avoid confusing GCC about clashing
with builtins.

Cc: Alexander Spyridakis <a.spyridakis@virtualopensystems.com>
Cc: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
5 years agotests/tcg: enable cris base user-mode tests
Alex Bennée [Thu, 6 Dec 2018 17:59:45 +0000 (17:59 +0000)]
tests/tcg: enable cris base user-mode tests

This converts the existing Makefile into a Makefile.target and updates
it so it can be called by the tcg build system. The original Makefile
didn't set -cpu except for the v17 tests however that has broken (I
assume because linux-user is a "max" cpu) so here I force it to be
crisv17.

I've also replicated the GNU simulator targets (run-FOO-on-sim).

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
5 years agotests/tcg/cris: align mul operations
Alex Bennée [Fri, 7 Dec 2018 18:06:34 +0000 (18:06 +0000)]
tests/tcg/cris: align mul operations

To avoid:

  Error: dangerous MULS/MULU location; give it higher alignment

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
5 years agotests/tcg/cris: comment out the ccs test
Alex Bennée [Fri, 7 Dec 2018 18:05:52 +0000 (18:05 +0000)]
tests/tcg/cris: comment out the ccs test

Evidently upstream gcc doesn't like this opcode.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
5 years agotests/tcg: split cris tests into bare and libc directories
Alex Bennée [Fri, 7 Dec 2018 10:28:31 +0000 (10:28 +0000)]
tests/tcg: split cris tests into bare and libc directories

Bare tests are standalone assembly tests that don't require linking to
any libc and hence can be built with kernel only compilers. The libc
tests need a compiler capable of building properly linked userspace
binaries. As we don't have such a cross compiler at the moment we
won't be building those tests.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
5 years agotests/tcg/cris: cleanup sys.c
Alex Bennée [Fri, 7 Dec 2018 15:16:43 +0000 (15:16 +0000)]
tests/tcg/cris: cleanup sys.c

This is a mini library which provides helper functions to the tests
which are all currently written in assembly. A bunch of minor changes:

      - removed libc related headers (fedora-cris-cross is a system compiler)
      - re-organised the functions to avoid forward declarations
      - cleaned up brace usage
      - restored exit for _fail case
      - removed tabs and fixed indentation

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
5 years agotests/docker: add fedora-cris-cross compilers
Alex Bennée [Thu, 6 Dec 2018 17:55:22 +0000 (17:55 +0000)]
tests/docker: add fedora-cris-cross compilers

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
5 years agotests/tcg/arm: add ARMv6-M UNDEFINED 32-bit instruction test
Stefan Hajnoczi [Thu, 29 Nov 2018 18:51:13 +0000 (18:51 +0000)]
tests/tcg/arm: add ARMv6-M UNDEFINED 32-bit instruction test

Test that 32-bit instructions declared UNDEFINED in the ARMv6-M
Reference Manual really do raise an exception.  Also test that the 6
32-bit instructions defined in the ARMv6-M Reference Manual do not raise
an exception.

Based-on: <20181029194519.15628-1-stefanha@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20181129185113.30353-1-stefanha@redhat.com>
[AJB: integrated into system tests]
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
5 years agotests/tcg/xtensa: enable system tests
Alex Bennée [Thu, 6 Dec 2018 17:12:44 +0000 (17:12 +0000)]
tests/tcg/xtensa: enable system tests

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
5 years agotests/docker: add debian-xtensa-cross image
Philippe Mathieu-Daudé [Sat, 23 Jun 2018 21:53:13 +0000 (18:53 -0300)]
tests/docker: add debian-xtensa-cross image

Xtensa cpu supported:
- dc232b
- dc233c
- csp

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
5 years agotests/tcg/mips: fix hello-mips compilation
Alex Bennée [Fri, 21 Dec 2018 11:52:05 +0000 (11:52 +0000)]
tests/tcg/mips: fix hello-mips compilation

The compilation flags for proper building are in the source tree. We
also fix exit to 0 so the result is counted as a success.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
5 years agotests/tcg: add gdb runner variant
Alex Bennée [Wed, 27 Feb 2019 15:42:18 +0000 (15:42 +0000)]
tests/tcg: add gdb runner variant

With this you can launch a test in gdb with:

  cd $(BUILD)/tests
  make -f $(SRC)/tests/tcg/Makefile gdb-$(TEST_NAME)

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
5 years agotests/tcg: split run-test into user and system variants
Alex Bennée [Tue, 12 Mar 2019 14:13:16 +0000 (14:13 +0000)]
tests/tcg: split run-test into user and system variants

We can't rely on shell redirect magic to get things right so lets
setup a common output chardev that is expecting to write to files. As
we have split run-test up we might as well move the default monitor
bits into the call.

Finally a little make sophistry is required to correctly quote
$(COMMA) and as we don't inherit common rules we have our own little
copy here.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
5 years agotests/tcg: add QEMU_OPT option for test runner
Alex Bennée [Thu, 6 Dec 2018 11:09:17 +0000 (11:09 +0000)]
tests/tcg: add QEMU_OPT option for test runner

This will allow tests to modify the QEMU invocation with for example
different -cpu stazas without having to define a whole new set of
runner types.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5 years agotests/tcg: enable tcg tests for softmmu
Alex Bennée [Thu, 29 Nov 2018 22:21:50 +0000 (22:21 +0000)]
tests/tcg: enable tcg tests for softmmu

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5 years agotests/tcg: add softmmu awareness to Makefile
Alex Bennée [Thu, 29 Nov 2018 22:19:21 +0000 (22:19 +0000)]
tests/tcg: add softmmu awareness to Makefile

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5 years agoMakefile: explicitly pass $(BUILD_DIR) to gcovr
Alex Bennée [Tue, 12 Mar 2019 09:18:31 +0000 (09:18 +0000)]
Makefile: explicitly pass $(BUILD_DIR) to gcovr

Best to be explicit about where to find things.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
5 years agoMakefile: explicitly pass $(SRC_PATH) to gcovr
Alex Bennée [Mon, 11 Mar 2019 16:12:53 +0000 (16:12 +0000)]
Makefile: explicitly pass $(SRC_PATH) to gcovr

In an out-of-tree build gcovr can get quite confused about what is
going on otherwise.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
5 years ago.travis.yml: reduce the module builds to major architectures
Alex Bennée [Fri, 8 Mar 2019 15:52:13 +0000 (15:52 +0000)]
.travis.yml: reduce the module builds to major architectures

The --enable-modules build is consistently tripping the time limit so
reduce our target list to the "major" architectures.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
5 years ago.travis.yml: combine docs and tools build with out-of-tree
Alex Bennée [Fri, 8 Mar 2019 15:48:08 +0000 (15:48 +0000)]
.travis.yml: combine docs and tools build with out-of-tree

We will be moving all builds out of tree eventually but for now we
need to for building the docs as sphinx requires an out-of-tree build.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
5 years agotravis: Bump Xcode 10 image to 10.2
Philippe Mathieu-Daudé [Wed, 20 Feb 2019 19:35:41 +0000 (20:35 +0100)]
travis: Bump Xcode 10 image to 10.2

Travis enforce the use of the git protocol v2 on their images,
but the 'xcode10' image doesn't handle this correctly, resulting
in the brew packages installation failing:

  $ git config protocol.version
  2
  $ rvm $brew_ruby do brew bundle --verbose --global
  /usr/local/bin/brew tap homebrew/bundle
  ==> Tapping homebrew/bundle
  Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-bundle'...
  fatal: unknown value for config 'protocol.version': 2
  Error: Failure while executing; `git clone https://github.com/Homebrew/homebrew-bundle /usr/local/Homebrew/Library/Taps/homebrew/homebrew-bundle --depth=1` exited with 128.
  Error: Failure while executing; `/usr/local/bin/brew tap homebrew/bundle` exited with 1.

The newer 'xcode10.2' beta [*] image doesn't have this limitation.

This image comes with the following brew packages pre-installed,
which extend the current code coverage:
 - libffi
 - libpng
 - libtasn1
 - gnutls
 - jpeg
 - nettle

[*] https://blog.travis-ci.com/2019-02-12-xcode-10-2-beta-2-is-now-available

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20190220193541.24419-1-philmd@redhat.com>
[AJB: re-enabled MacOS build first]
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
5 years agodecodetree: Properly diagnose fields overflowing an insn
Richard Henderson [Tue, 5 Mar 2019 23:34:41 +0000 (15:34 -0800)]
decodetree: Properly diagnose fields overflowing an insn

Previously this would result in an exception for shifting
the field mask by a negative number.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5 years agodecodetree: Prefix extract function names with decode_function
Richard Henderson [Thu, 28 Feb 2019 22:45:50 +0000 (14:45 -0800)]
decodetree: Prefix extract function names with decode_function

This makes it easier to name Formats within multiple decode files.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5 years agodecodetree: Allow +- to begin a number initializing a field
Richard Henderson [Thu, 28 Feb 2019 22:36:52 +0000 (14:36 -0800)]
decodetree: Allow +- to begin a number initializing a field

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5 years agodecodetree: Produce clean output for an empty input file
Richard Henderson [Thu, 28 Feb 2019 05:37:32 +0000 (21:37 -0800)]
decodetree: Produce clean output for an empty input file

This is interesting for bisection, where an output file is plumbed,
but does not yet have patterns.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5 years agodecodetree: Add --static-decode option
Richard Henderson [Sun, 24 Feb 2019 01:44:31 +0000 (17:44 -0800)]
decodetree: Add --static-decode option

Like --decode, but do not drop 'static' qualifier.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5 years agotest/decode: Add tests for PatternGroups
Bastian Koppelmann [Wed, 27 Feb 2019 12:02:17 +0000 (13:02 +0100)]
test/decode: Add tests for PatternGroups

This adds one test that supposed to succeed to test deep nesting
of pattern groups which is rarely exercised by targets using decode
tree. The remaining tests exercise various fail conditions.

Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
Message-Id: <20190227120217.20794-1-kbastian@mail.uni-paderborn.de>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5 years agodecodetree: Allow grouping of overlapping patterns
Richard Henderson [Sat, 23 Feb 2019 19:35:36 +0000 (11:35 -0800)]
decodetree: Allow grouping of overlapping patterns

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5 years agodecodetree: Do not unconditionaly return from Pattern.output_code
Richard Henderson [Sat, 23 Feb 2019 16:57:46 +0000 (08:57 -0800)]
decodetree: Do not unconditionaly return from Pattern.output_code

As a consequence, the 'return false' gets pushed up one level.

This will allow us to perform some other action when the
translator returns failure.

Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5 years agodecodetree: Ensure build_tree does not include values outside insnmask
Philippe Mathieu-Daudé [Mon, 17 Dec 2018 04:07:38 +0000 (20:07 -0800)]
decodetree: Ensure build_tree does not include values outside insnmask

Reproduced with "scripts/decodetree.py /dev/null".

Reviewed-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5 years agodecodetree: Document the usefulness of argument sets
Richard Henderson [Thu, 28 Feb 2019 02:34:38 +0000 (18:34 -0800)]
decodetree: Document the usefulness of argument sets

Reviewed-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5 years agodecodetree: Move documentation to docs/devel/decodetree.rst
Richard Henderson [Sat, 23 Feb 2019 21:00:10 +0000 (13:00 -0800)]
decodetree: Move documentation to docs/devel/decodetree.rst

One great big block comment isn't the best way to document
the syntax of a language.

Reviewed-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5 years agoMAINTAINERS: Add scripts/decodetree.py to the TCG section
Philippe Mathieu-Daudé [Sat, 10 Nov 2018 21:13:12 +0000 (22:13 +0100)]
MAINTAINERS: Add scripts/decodetree.py to the TCG section

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20181110211313.6922-2-f4bug@amsat.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5 years agoMerge remote-tracking branch 'remotes/kraxel/tags/audio-20190312-pull-request' into...
Peter Maydell [Tue, 12 Mar 2019 16:45:13 +0000 (16:45 +0000)]
Merge remote-tracking branch 'remotes/kraxel/tags/audio-20190312-pull-request' into staging

audio: introduce -audiodev

# gpg: Signature made Tue 12 Mar 2019 07:12:19 GMT
# gpg:                using RSA key 4CB6D8EED3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" [full]
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>" [full]
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>" [full]
# Primary key fingerprint: A032 8CFF B93A 17A7 9901  FE7D 4CB6 D8EE D3E8 7138

* remotes/kraxel/tags/audio-20190312-pull-request:
  audio: -audiodev command line option: cleanup
  wavaudio: port to -audiodev config
  spiceaudio: port to -audiodev config
  sdlaudio: port to -audiodev config
  paaudio: port to -audiodev config
  ossaudio: port to -audiodev config
  noaudio: port to -audiodev config
  dsoundaudio: port to -audiodev config
  coreaudio: port to -audiodev config
  alsaaudio: port to -audiodev config
  audio: -audiodev command line option basic implementation
  audio: -audiodev command line option: documentation
  audio: use qapi AudioFormat instead of audfmt_e
  qapi: qapi for audio backends

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
# Conflicts:
# qemu-deprecated.texi

5 years agotarget/hppa: exit TB if either Data or Instruction TLB changes
Sven Schnelle [Mon, 11 Mar 2019 19:16:01 +0000 (20:16 +0100)]
target/hppa: exit TB if either Data or Instruction TLB changes

The current code assumes that we don't need to exit the TB
if a Data Cache Flush or Insert has happend. However, as we
have a shared Data/Instruction TLB, a Data cache flush also
flushes Instruction TLB entries, and a Data cache TLB insert
might also evict a Instruction TLB entry.

So exit the TB in all cases if Instruction translation is enabled.

Signed-off-by: Sven Schnelle <svens@stackframe.org>
Message-Id: <20190311191602.25796-11-svens@stackframe.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5 years agotarget/hppa: add TLB protection id check
Sven Schnelle [Mon, 11 Mar 2019 19:16:00 +0000 (20:16 +0100)]
target/hppa: add TLB protection id check

Signed-off-by: Sven Schnelle <svens@stackframe.org>
Message-Id: <20190311191602.25796-10-svens@stackframe.org>
[rth: Add required tlb flushing when prot id registers change.]
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>