]> git.proxmox.com Git - mirror_qemu.git/log
mirror_qemu.git
5 years agoipxe: update to latest git master
Gerd Hoffmann [Tue, 22 Jan 2019 06:27:59 +0000 (07:27 +0100)]
ipxe: update to latest git master

git shortlog ipxe-qemu-20170717-0600d3ae94-0..ipxe-qemu-20190122-de4565cbe7-0
-----------------------------------------------------------------------------

Aaron Young (1):
      [libc] Fix strcmp()/strncmp() to return proper values

Ameer Mahagneh (1):
      [golan] Set log_max_qp to 1

Bruce Rogers (1):
      [build] Disable gcc stringop-truncation warnings

Christian Hesse (1):
      [build] Handle R_X86_64_PLT32 from binutils 2.31

Hannes Reinecke (1):
      [iscsi] Parse IPv6 address in root path

Heinrich Schuchardt (2):
      [efi] Accept (and ignore) R_ARM_V4BX relocations
      [efi] Add support for R_ARM_REL32 relocations

Ignat Korchagin (1):
      [efi] Fix error handling path in efi_snp_probe

Janos Mattyasovszky (1):
      [intel] Add PCI device ID for X550-T2

Joseph Wong (1):
      [tg3] Add support for SerDes PHY initialization

Ladi Prosek (1):
      [crypto] Fail fast if cross-certificate source is empty

Laurent Gourvénec (1):
      [acpi] Compute and check checksum for ACPI tables

Martin Habets (2):
      [netdevice] Make netdev_irq_enabled() independent of netdev_irq_supported()
      [sfc] Add support for X25xx adapters

Michael Brown (88):
      [efi] Enumerate PCI BARs in same order as SnpDxe
      [build] Conditionalise use of -mabi=lp64 for ARM64 builds
      [build] Fix use of inline assembly on GCC 4.8 ARM64 builds
      [build] Fix ARM32 EFI builds with current EDK2 headers
      [acpi] Fix spurious uninitialised-variable warning on some gcc versions
      [hyperv] Do not steal ownership from the Gen 2 UEFI firmware
      [shell] Enable "shell" command even when BANNER_TIMEOUT is zero
      [romprefix] Avoid unaligned accesses within ROM headers
      [malloc] Avoid false positive warnings from valgrind
      [linux] Impose receive quota on tap driver
      [efi] Raise TPL when calling UNDI entry point
      [netdevice] Cancel all pending transmissions on any transmit error
      [monojob] Check for job progress only once per timer tick
      [job] Allow jobs to report an arbitrary status message
      [downloader] Allow underlying downloads to provide detailed job progress
      [monojob] Display job status message, if present
      [peerdist] Gather and report peer statistics during download
      [netdevice] Add "hwaddr" setting
      [resolv] Use pass-through interfaces for name resolution multiplexer
      [dns] Report current DNS query as job progress status message
      [efi] Check buffer length for packets retrieved via our SNP protocol
      [efi] Match behaviour of SnpDxe for truncated received packets
      [dns] Ensure DNS names are NUL-terminated when used as diagnostic strings
      [efi] Continue to connect remaining handles after connection errors
      [build] Exclude selected directories from Secure Boot builds
      [efi] Inhibit our driver Start() method during disconnection attempts
      [efi] Allow for building with older versions of elf.h system header
      [crypto] Fix endianness typo in comment
      [crypto] Eliminate repetitions in MD5 round constant table
      [crypto] Add MD4 message digest algorithm
      [ntlm] Add support for NTLM authentication mechanism
      [http] Gracefully handle offers of multiple authentication schemes
      [http] Handle parsing of WWW-Authenticate header within authentication scheme
      [http] Add support for NTLM authentication
      [xen] Skip probing of any unsupported device types
      [http] Include error messages for 4xx and 5xx response codes
      [http] Report unsuccessful response status lines at DBGVL_LOG
      [image] Omit URI query string and fragment from download progress messages
      [legal] Add missing FILE_LICENCE declarations
      [legal] Add missing FILE_LICENCE declarations
      [build] Avoid use of "ld --oformat binary"
      [ena] Add driver for Amazon ENA virtual function NIC
      [skel] Remove MII interface
      [ena] Fix spurious uninitialised variable warning on older versions of gcc
      [xhci] Assume an invalid PSI table if any invalid PSI value is observed
      [intel] Work around broken reset mechanism in i219 devices
      [http] Allow for domain names within NTLM user names
      [xhci] Consume event TRB before reporting completion to USB core
      [efi] Run at TPL_CALLBACK to protect against UEFI timers
      [efi] Raise TPL within EFI_SIMPLE_NETWORK_PROTOCOL entry points
      [efi] Raise TPL within EFI_USB_IO_PROTOCOL entry points
      [process] Include process name in debug messages
      [efi] Drop to TPL_APPLICATION when gathering entropy
      [efi] Raise TPL within EFI_DRIVER_BINDING_PROTOCOL entry points
      [librm] Add facility to provide register and stack dump for CPU exceptions
      [golan] Do not assume all devices are identical
      [lacp] Mark link as blocked if partner is not yet up and running
      [lacp] Fix debug message to match documentation
      [tftp] Prevent potential division by zero
      [profile] Prevent potential division by zero
      [ocsp] Centralise test for whether or not an OCSP check is required
      [ocsp] Allow OCSP checks to be disabled
      [lacp] Check the partner's own state when checking for blocked links
      [efi] Provide Map_Mem() and associated UNDI callbacks
      [time] Add support for the ACPI power management timer
      [rng] Use fixed-point calculations for min-entropy quantities
      [build] Prevent use of MMX and SSE registers
      [undi] Treat invalid IRQ numbers as non-fatal errors
      [librm] Provide symbols for inline code placed into other sections
      [librm] Ensure that inline code symbols are unique
      [tls] Ensure received data list is initialised before calling tls_free()
      [list] Add list_is_first_entry() and list_is_last_entry()
      [tls] Rename tls_session to tls_connection
      [tls] Ensure that window change is propagated to plainstream interface
      [efi] Release SNP devices before starting SAN boot image
      [efi] Do not raise TPL within EFI_DRIVER_BINDING_PROTOCOL.Supported()
      [undi] Include subsystem IDs in broken interrupt device check
      [rhine] Fix usage of mii_read()
      [velocity] Fix usage of mii_read() and mii_write()
      [mii] Separate concepts of MII interface and MII device
      [tcp] Add missing packed attribute on struct tcp_header
      [mii] Fix typo in parameter name
      [http] Work around stateful authentication schemes
      [build] Use positive-form tests when checking for supported warnings
      [rndis] Clean up error handling path in register_rndis()
      [ethernet] Use standard 1500 byte MTU unless explicitly overridden
      [intelxl] Add driver for Intel 40 Gigabit Ethernet NICs
      [zbin] Fix compiler warning with GCC 9

Peter von Konigsmark (2):
      [exanic] Power up optical PHYs (if present)
      [exanic] Add PCI device ID for another X40 variant

Petr Borsodi (3):
      [pci] Correct invalid base-class/sub-class/prog-if order in PCIR
      [util] Improve processing of ROM images in Option::ROM
      [util] Add support for EFI ROM images

Richard Moore (1):
      [intel] Add various PCI device IDs

Rob Taglang (3):
      [intel] Add PCI_ROM entry for Intel i354 NIC
      [intelx] Add PCI_ROM entry for Intel X553 NIC
      [efi] Exclude link-layer header length from MaxPacketSize

Robin Smidsrød (1):
      [util] Support reversed sort ordering when generating NIC list

Roman Kagan (2):
      [rndis] Register netdev with MAC filled
      [vmbus] Do not expect version in version_response

Steven Haber (1):
      [intelx] Add support for Intel X552 NIC

Sylvie Barlow (3):
      [mii] Add mii_find()
      [mii] Add bit-bashing interface
      [icplus] Add driver for IC+ network card

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
5 years agoMerge remote-tracking branch 'remotes/jnsnow/tags/bitmaps-pull-request' into staging
Peter Maydell [Thu, 17 Jan 2019 12:48:42 +0000 (12:48 +0000)]
Merge remote-tracking branch 'remotes/jnsnow/tags/bitmaps-pull-request' into staging

Pull request

# gpg: Signature made Wed 16 Jan 2019 01:00:25 GMT
# gpg:                using RSA key 7DEF8106AAFC390E
# gpg: Good signature from "John Snow (John Huston) <jsnow@redhat.com>"
# Primary key fingerprint: FAEB 9711 A12C F475 812F  18F2 88A9 064D 1835 61EB
#      Subkey fingerprint: F9B7 ABDB BCAC DF95 BE76  CBD0 7DEF 8106 AAFC 390E

* remotes/jnsnow/tags/bitmaps-pull-request:
  Revert "hbitmap: Add @advance param to hbitmap_iter_next()"
  Revert "test-hbitmap: Add non-advancing iter_next tests"
  Revert "block/dirty-bitmap: Add bdrv_dirty_iter_next_area"
  block/mirror: fix and improve do_sync_target_write
  tests: add tests for hbitmap_next_dirty_area
  dirty-bitmap: add bdrv_dirty_bitmap_next_dirty_area
  tests: add tests for hbitmap_next_zero with specified end parameter
  dirty-bitmap: improve bdrv_dirty_bitmap_next_zero

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoRevert "hbitmap: Add @advance param to hbitmap_iter_next()"
Vladimir Sementsov-Ogievskiy [Tue, 15 Jan 2019 23:26:50 +0000 (18:26 -0500)]
Revert "hbitmap: Add @advance param to hbitmap_iter_next()"

This reverts commit a33fbb4f8b64226becf502a123733776ce319b24.

The functionality is unused.

Note: in addition to automatic revert, drop second parameter in
hbitmap_iter_next() call from hbitmap_next_dirty_area() too.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: John Snow <jsnow@redhat.com>
5 years agoRevert "test-hbitmap: Add non-advancing iter_next tests"
Vladimir Sementsov-Ogievskiy [Tue, 15 Jan 2019 23:26:50 +0000 (18:26 -0500)]
Revert "test-hbitmap: Add non-advancing iter_next tests"

This reverts commit 269576848ec3d57d2d958cf5ac69b08c44adf816.

The functionality is unused. Drop tests.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: John Snow <jsnow@redhat.com>
5 years agoRevert "block/dirty-bitmap: Add bdrv_dirty_iter_next_area"
Vladimir Sementsov-Ogievskiy [Tue, 15 Jan 2019 23:26:50 +0000 (18:26 -0500)]
Revert "block/dirty-bitmap: Add bdrv_dirty_iter_next_area"

This reverts commit 72d10a94213a954ad569095cb4491f2ae0853c40.

The function is unused now.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: John Snow <jsnow@redhat.com>
5 years agoblock/mirror: fix and improve do_sync_target_write
Vladimir Sementsov-Ogievskiy [Tue, 15 Jan 2019 23:26:50 +0000 (18:26 -0500)]
block/mirror: fix and improve do_sync_target_write

Use bdrv_dirty_bitmap_next_dirty_area() instead of
bdrv_dirty_iter_next_area(), because of the following problems of
bdrv_dirty_iter_next_area():

1. Using HBitmap iterators we should carefully handle unaligned offset,
as first call to hbitmap_iter_next() may return a value less than
original offset (actually, it will be original offset rounded down to
bitmap granularity). This handling is not done in
do_sync_target_write().

2. bdrv_dirty_iter_next_area() handles unaligned max_offset
incorrectly:

look at the code:
    if (max_offset == iter->bitmap->size) {
        /* If max_offset points to the image end, round it up by the
         * bitmap granularity */
        gran_max_offset = ROUND_UP(max_offset, granularity);
    } else {
        gran_max_offset = max_offset;
    }

    ret = hbitmap_iter_next(&iter->hbi, false);
    if (ret < 0 || ret + granularity > gran_max_offset) {
        return false;
    }

and assume that max_offset != iter->bitmap->size but still unaligned.
if 0 < ret < max_offset we found dirty area, but the function can
return false in this case (if ret + granularity > max_offset).

3. bdrv_dirty_iter_next_area() uses inefficient loop to find the end of
the dirty area. Let's use more efficient hbitmap_next_zero instead
(bdrv_dirty_bitmap_next_dirty_area() do so)

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
5 years agotests: add tests for hbitmap_next_dirty_area
Vladimir Sementsov-Ogievskiy [Tue, 15 Jan 2019 23:26:50 +0000 (18:26 -0500)]
tests: add tests for hbitmap_next_dirty_area

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
5 years agodirty-bitmap: add bdrv_dirty_bitmap_next_dirty_area
Vladimir Sementsov-Ogievskiy [Tue, 15 Jan 2019 23:26:50 +0000 (18:26 -0500)]
dirty-bitmap: add bdrv_dirty_bitmap_next_dirty_area

The function alters bdrv_dirty_iter_next_area(), which is wrong and
less efficient (see further commit
"block/mirror: fix and improve do_sync_target_write" for description).

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
5 years agotests: add tests for hbitmap_next_zero with specified end parameter
Vladimir Sementsov-Ogievskiy [Tue, 15 Jan 2019 23:26:49 +0000 (18:26 -0500)]
tests: add tests for hbitmap_next_zero with specified end parameter

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
5 years agodirty-bitmap: improve bdrv_dirty_bitmap_next_zero
Vladimir Sementsov-Ogievskiy [Tue, 15 Jan 2019 23:26:49 +0000 (18:26 -0500)]
dirty-bitmap: improve bdrv_dirty_bitmap_next_zero

Add bytes parameter to the function, to limit searched range.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
5 years agoMerge remote-tracking branch 'remotes/thibault/tags/samuel-thibault' into staging
Peter Maydell [Tue, 15 Jan 2019 18:32:57 +0000 (18:32 +0000)]
Merge remote-tracking branch 'remotes/thibault/tags/samuel-thibault' into staging

slirp updates

Gerd Hoffmann (1):
  slirp: add tftp tracing

Marc-André Lureau (61):
  slirp: associate slirp_output callback with the Slirp context
  slirp: remove do_pty from fork_exec()
  slirp: replace ex_pty with ex_chardev
  slirp: use a dedicated field for chardev pointer
  slirp: remove unused EMU_RSH
  slirp: rename /extra/chardev
  slirp: move internal function declarations
  slirp: remove Monitor dependency, return a string for info
  slirp: fix slirp_add_exec() leaks
  slirp: replace the poor-man string split with g_strsplit()
  slirp: remove dead declarations
  slirp: move socket pair creation in helper function
  slirp: remove unused M_TRAILINGSPACE
  slirp: use a callback structure to interface with qemu
  slirp: remove PROBE_CONN dead-code
  slirp: remove FULL_BOLT
  slirp: remove the disabled readv()/writev() code path
  slirp: remove HAVE_SYS_SIGNAL_H
  slirp: remove unused HAVE_SYS_BITYPES_H
  slirp: remove NO_UNIX_SOCKETS
  slirp: remove unused HAVE_SYS_STROPTS_H
  slirp: remove unused HAVE_ARPA_INET_H
  slirp: remove unused HAVE_SYS_WAIT_H
  slirp: remove unused HAVE_SYS_SELECT_H
  slirp: remove HAVE_SYS_IOCTL_H
  slirp: remove HAVE_SYS_FILIO_H
  slirp: remove unused DECLARE_IOVEC
  slirp: remove unused HAVE_INET_ATON
  slirp: replace HOST_WORDS_BIGENDIAN with glib equivalent
  slirp: replace SIZEOF_CHAR_P with glib equivalent
  slirp: replace compile time DO_KEEPALIVE
  slirp: remove unused global slirp_instance
  slirp: replace error_report() with g_critical()
  slirp: improve a bit the debug macros
  slirp: add a callback to log guest errors
  slirp: remove #if notdef dead code
  slirp: remove unused sbflush()
  slirp: NULL is defined by stddef.h
  slirp: remove dead TCP_ACK_HACK code
  slirp: replace ARRAY_SIZE with G_N_ELEMENTS
  net: do not depend on slirp internals
  glib-compat: add g_spawn_async_with_fds() fallback
  slirp: simplify fork_exec()
  slirp: replace error_report() with g_critical()
  slirp: drop <Vista compatibility
  slirp: rename exec_list
  slirp: use virtual time for packet expiration
  slirp: replace a fprintf with g_critical()
  slirp: replace some fprintf() with DEBUG_MISC
  slirp: replace a DEBUG block with WITH_ICMP_ERROR_MSG
  slirp: no need to make DPRINTF conditional on DEBUG
  slirp: always build with debug statements
  slirp: introduce SLIRP_DEBUG environment variable
  slirp: use %p for pointers format
  slirp: remove remaining DEBUG blocks
  slirp: replace DEBUG_ARGS with DEBUG_ARG
  slirp: factor out guestfwd addition checks
  slirp: add clock_get_ns() callback
  build-sys: use a separate slirp-obj-y && slirp.mo
  slirp: set G_LOG_DOMAIN
  slirp: call into g_debug() for DEBUG macros

Prasad J Pandit (1):
  slirp: check data length while emulating ident function

Samuel Thibault (2):
  slirp: Enable fork_exec support on Windows
  slirp: Mark debugging calls as unlikely

 Makefile              |   5 +-
 Makefile.objs         |   4 +-
 Makefile.target       |   5 +-
 include/glib-compat.h |  56 +++++++++
 net/colo-compare.c    |  11 +-
 net/colo.c            |   1 +
 net/colo.h            |   7 +-
 net/filter-rewriter.c |   9 +-
 net/slirp.c           |  61 +++++----
 net/util.h            |  55 ++++++++
 slirp/Makefile.objs   |  37 +++++-
 slirp/arp_table.c     |  12 +-
 slirp/bootp.c         |  10 +-
 slirp/cksum.c         |   8 +-
 slirp/debug.h         |  47 ++++---
 slirp/dhcpv6.c        |  17 ++-
 slirp/if.c            |   4 +-
 slirp/ip.h            |  10 +-
 slirp/ip6.h           |   3 +-
 slirp/ip6_icmp.c      |  27 ++--
 slirp/ip6_icmp.h      |   6 +-
 slirp/ip6_input.c     |   2 +-
 slirp/ip6_output.c    |   4 +-
 slirp/ip_icmp.c       |  31 ++---
 slirp/ip_input.c      | 200 -----------------------------
 slirp/libslirp.h      |  27 ++--
 slirp/main.h          |  33 -----
 slirp/mbuf.c          |   2 +-
 slirp/mbuf.h          |   1 -
 slirp/misc.c          | 286 +++++++++++++++++-------------------------
 slirp/misc.h          |  13 +-
 slirp/ncsi.c          |   4 +-
 slirp/ndp_table.c     |  32 +++--
 slirp/sbuf.h          |   1 -
 slirp/slirp.c         | 177 +++++++++++++-------------
 slirp/slirp.h         |  45 ++-----
 slirp/slirp_config.h  |  86 -------------
 slirp/socket.c        |  53 +++-----
 slirp/socket.h        |   2 +-
 slirp/tcp.h           |   4 +-
 slirp/tcp_input.c     |  84 ++-----------
 slirp/tcp_output.c    |   2 +-
 slirp/tcp_subr.c      |  22 ++--
 slirp/tcp_timer.c     |   2 +-
 slirp/tftp.c          |   7 +-
 slirp/trace-events    |   5 +
 slirp/udp.c           |   5 +-
 slirp/udp6.c          |  11 +-
 stubs/slirp.c         |   2 +-
 49 files changed, 603 insertions(+), 935 deletions(-)
 delete mode 100644 slirp/slirp_config.h
 create mode 100644 slirp/trace-events

--
2.20.1

# gpg: Signature made Mon 14 Jan 2019 22:52:32 GMT
# gpg:                using RSA key DB550E89F0FA54F3
# gpg: Good signature from "Samuel Thibault <samuel.thibault@aquilenet.fr>"
# gpg:                 aka "Samuel Thibault <sthibault@debian.org>"
# gpg:                 aka "Samuel Thibault <samuel.thibault@gnu.org>"
# gpg:                 aka "Samuel Thibault <samuel.thibault@inria.fr>"
# gpg:                 aka "Samuel Thibault <samuel.thibault@labri.fr>"
# gpg:                 aka "Samuel Thibault <samuel.thibault@ens-lyon.org>"
# gpg:                 aka "Samuel Thibault <samuel.thibault@u-bordeaux.fr>"
# 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: 900C B024 B679 31D4 0F82  304B D017 8C76 7D06 9EE6
#      Subkey fingerprint: E61D BB15 D417 2BDE C97E  92D9 DB55 0E89 F0FA 54F3

* remotes/thibault/tags/samuel-thibault: (65 commits)
  slirp: check data length while emulating ident function
  slirp: Mark debugging calls as unlikely
  slirp: call into g_debug() for DEBUG macros
  slirp: set G_LOG_DOMAIN
  build-sys: use a separate slirp-obj-y && slirp.mo
  slirp: add clock_get_ns() callback
  slirp: factor out guestfwd addition checks
  slirp: replace DEBUG_ARGS with DEBUG_ARG
  slirp: remove remaining DEBUG blocks
  slirp: use %p for pointers format
  slirp: introduce SLIRP_DEBUG environment variable
  slirp: always build with debug statements
  slirp: no need to make DPRINTF conditional on DEBUG
  slirp: replace a DEBUG block with WITH_ICMP_ERROR_MSG
  slirp: replace some fprintf() with DEBUG_MISC
  slirp: replace a fprintf with g_critical()
  slirp: use virtual time for packet expiration
  slirp: rename exec_list
  slirp: drop <Vista compatibility
  slirp: Enable fork_exec support on Windows
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoMerge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging
Peter Maydell [Tue, 15 Jan 2019 17:24:00 +0000 (17:24 +0000)]
Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging

Pull request

No user-visible changes.

# gpg: Signature made Mon 14 Jan 2019 16:32:19 GMT
# gpg:                using RSA key 9CA4ABB381AB73C8
# gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>"
# gpg:                 aka "Stefan Hajnoczi <stefanha@gmail.com>"
# Primary key fingerprint: 8695 A8BF D3F9 7CDA AC35  775A 9CA4 ABB3 81AB 73C8

* remotes/stefanha/tags/block-pull-request:
  aio-posix: Fix concurrent aio_poll/set_fd_handler.
  aio-posix: Unregister fd from ctx epoll when removing fd_handler.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoMerge remote-tracking branch 'remotes/ericb/tags/pull-nbd-2019-01-14' into staging
Peter Maydell [Tue, 15 Jan 2019 14:19:18 +0000 (14:19 +0000)]
Merge remote-tracking branch 'remotes/ericb/tags/pull-nbd-2019-01-14' into staging

nbd patches for 2019-01-14

Promote bitmap/NBD interfaces to stable for use in incremental
backups. Add 'qemu-nbd --bitmap'.

- John Snow: 0/11 bitmaps: remove x- prefix from QMP api
- Philippe Mathieu-Daudé: qemu-nbd: Rename 'exp' variable clashing with math::exp() symbol
- Eric Blake: 0/8 Promote x-nbd-server-add-bitmap to stable

# gpg: Signature made Mon 14 Jan 2019 16:13:45 GMT
# gpg:                using RSA key A7A16B4A2527436A
# gpg: Good signature from "Eric Blake <eblake@redhat.com>"
# gpg:                 aka "Eric Blake (Free Software Programmer) <ebb9@byu.net>"
# gpg:                 aka "[jpeg image of size 6874]"
# Primary key fingerprint: 71C2 CC22 B1C4 6029 27D2  F3AA A7A1 6B4A 2527 436A

* remotes/ericb/tags/pull-nbd-2019-01-14:
  qemu-nbd: Add --bitmap=NAME option
  nbd: Merge nbd_export_bitmap into nbd_export_new
  nbd: Remove x-nbd-server-add-bitmap
  nbd: Allow bitmap export during QMP nbd-server-add
  nbd: Merge nbd_export_set_name into nbd_export_new
  nbd: Only require disabled bitmap for read-only exports
  nbd: Forbid nbd-server-stop when server is not running
  nbd: Add some error case testing to iotests 223
  qemu-nbd: Rename 'exp' variable clashing with math::exp() symbol
  iotests: add iotest 236 for testing bitmap merge
  iotests: implement pretty-print for log and qmp_log
  iotests: change qmp_log filters to expect QMP objects only
  iotests: remove default filters from qmp_log
  iotests: add qmp recursive sorting function
  iotests: add filter_generated_node_ids
  iotests.py: don't abort if IMGKEYSECRET is undefined
  block: remove 'x' prefix from experimental bitmap APIs
  blockdev: n-ary bitmap merge
  block/dirty-bitmap: remove assertion from restore
  blockdev: abort transactions in reverse order

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoMerge remote-tracking branch 'remotes/stsquad/tags/pull-misc-gitdm-next-140119-1...
Peter Maydell [Tue, 15 Jan 2019 13:16:58 +0000 (13:16 +0000)]
Merge remote-tracking branch 'remotes/stsquad/tags/pull-misc-gitdm-next-140119-1' into staging

gitdm updates with 2018 year end stats:

  git log --numstat --after="1/1/2018 00:00" --before="31/12/2018 23:59" | ~/src/gitdm.git/gitdm -n -l 10

  Top changeset contributors by employer
  Red Hat                   3091 (43.3%)
  Linaro                    1201 (16.8%)
  (None)                     484 (6.8%)
  IBM                        426 (6.0%)
  Academics (various)        186 (2.6%)
  Virtuozzo                  172 (2.4%)
  Wave Computing             118 (1.7%)
  Igalia                     109 (1.5%)
  Xilinx                     102 (1.4%)
  Cadence Design Systems      80 (1.1%)

  Top lines changed by employer
  Red Hat                   140523 (30.3%)
  Cadence Design Systems    81010 (17.5%)
  Linaro                    78098 (16.8%)
  Wave Computing            33134 (7.1%)
  IBM                       18918 (4.1%)
  SiFive                    14436 (3.1%)
  Academics (various)       11995 (2.6%)
  (None)                    11458 (2.5%)
  Virtuozzo                 10770 (2.3%)
  Oracle                    6698 (1.4%)

# gpg: Signature made Mon 14 Jan 2019 16:08:52 GMT
# gpg:                using RSA key FBD0DB095A9E2A44
# gpg: Good signature from "Alex Bennée (Master Work Key) <alex.bennee@linaro.org>"
# Primary key fingerprint: 6685 AE99 E751 67BC AFC8  DF35 FBD0 DB09 5A9E 2A44

* remotes/stsquad/tags/pull-misc-gitdm-next-140119-1:
  MAINTAINERS: add myself as a route for gitdm updates
  contrib/gitdm: add another name to WaveComp map
  contrib/gitdm: add two more IBM'ers to group-map-ibm
  contrib/gitdm: Add other IBMers
  contrib/gitdm: add Nokia and Proxmox to the domain-map

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoslirp: check data length while emulating ident function
Prasad J Pandit [Sun, 13 Jan 2019 17:59:48 +0000 (23:29 +0530)]
slirp: check data length while emulating ident function

While emulating identification protocol, tcp_emu() does not check
available space in the 'sc_rcv->sb_data' buffer. It could lead to
heap buffer overflow issue. Add check to avoid it.

Reported-by: Kira <864786842@qq.com>
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
5 years agoslirp: Mark debugging calls as unlikely
Samuel Thibault [Wed, 21 Nov 2018 22:40:34 +0000 (23:40 +0100)]
slirp: Mark debugging calls as unlikely

to get them out of the hot path.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
5 years agoslirp: call into g_debug() for DEBUG macros
Marc-André Lureau [Wed, 21 Nov 2018 22:06:41 +0000 (02:06 +0400)]
slirp: call into g_debug() for DEBUG macros

Make slirp use GLib logging, instead of fprintf(), so that
applications can filter log, process it etc.

With recent versions of glib, G_MESSAGES_DEBUG must be set to "all" or
"Slirp" to see slirp debug messages.

Reformat DEBUG_MISC & DEBUG_ERROR calls to not need \n ending.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
5 years agoslirp: set G_LOG_DOMAIN
Marc-André Lureau [Wed, 21 Nov 2018 22:06:31 +0000 (02:06 +0400)]
slirp: set G_LOG_DOMAIN

We are moving to g_log() facilities to log errors and probably debug
messages too. Let's have the "Slirp" prefix on messages slirp produces.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
5 years agobuild-sys: use a separate slirp-obj-y && slirp.mo
Marc-André Lureau [Wed, 21 Nov 2018 22:06:30 +0000 (02:06 +0400)]
build-sys: use a separate slirp-obj-y && slirp.mo

This will allow to have cflags for the whole slirp.mo -objs.
It makes it possible to build tests that links only with
slirp-obj-y (and not the whole common-obj).

It is also a step towards building slirp as a shared library, although
this requires a bit more thoughts to build with
net/slirp.o (CONFIG_SLIRP would need to be 'm') and other build issues.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
5 years agoMerge remote-tracking branch 'remotes/stsquad/tags/pull-testing-next-140119-1' into...
Peter Maydell [Mon, 14 Jan 2019 19:28:12 +0000 (19:28 +0000)]
Merge remote-tracking branch 'remotes/stsquad/tags/pull-testing-next-140119-1' into staging

A bunch of fixes for testing:

  - Various Travis updates
  - "stable" SID snapshot for docker
  - avoid :latest docker tags
  - g_usleep fix for some tests

# gpg: Signature made Mon 14 Jan 2019 14:59:35 GMT
# gpg:                using RSA key FBD0DB095A9E2A44
# gpg: Good signature from "Alex Bennée (Master Work Key) <alex.bennee@linaro.org>"
# Primary key fingerprint: 6685 AE99 E751 67BC AFC8  DF35 FBD0 DB09 5A9E 2A44

* remotes/stsquad/tags/pull-testing-next-140119-1: (21 commits)
  Revert "tests: Disable qht-bench parallel test when using gprof"
  tests: use g_usleep instead of rem = sleep(time)
  tests/docker: remove SID_AGE test hack
  tests/docker: update our Travis image
  travis: bump to Xenial baseline
  docker: Use a stable snapshot for Debian Sid
  travis: remove matrix settings that duplicate global settings
  travis: run tests in verbose mode
  travis: stop using container based envs
  travis: stop redefining the script commands
  travis: use homebrew addon for MacOSX
  travis: don't clone git submodules upfront
  travis: standardize the syntax used for env variables
  travis: define all the build matrix entries in one place
  travis: add whitespace between each major section & matrix entry
  tests: use in-place sed magic for enabling deb-src in travis image
  tests: update Fedora i386 cross image to Fedora 29
  tests: update Fedora dockerfile to use Fedora 29
  tests: remove obsolete 'debian' dockerfile
  tests: run ldconfig after installing extra software
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoMerge remote-tracking branch 'remotes/ehabkost/tags/x86-next-pull-request' into staging
Peter Maydell [Mon, 14 Jan 2019 17:35:00 +0000 (17:35 +0000)]
Merge remote-tracking branch 'remotes/ehabkost/tags/x86-next-pull-request' into staging

x86 queue, 2019-01-14

* Reenable RDTSCP support on Opteron_G[345] CPU models CPU models
  (Borislav Petkov)
* host-phys-bits-limit option for better control of 5-level EPT
  (Eduardo Habkost)
* Disable MPX support on named CPU models (Paolo Bonzini)
* expose HV_CPUID_ENLIGHTMENT_INFO.EAX and HV_CPUID_NESTED_FEATURES.EAX
  as feature words (Vitaly Kuznetsov)

# gpg: Signature made Mon 14 Jan 2019 14:33:55 GMT
# gpg:                using RSA key 2807936F984DC5A6
# gpg: Good signature from "Eduardo Habkost <ehabkost@redhat.com>"
# Primary key fingerprint: 5A32 2FD5 ABC4 D3DB ACCF  D1AA 2807 936F 984D C5A6

* remotes/ehabkost/tags/x86-next-pull-request:
  i386/kvm: add a comment explaining why .feat_names are commented out for Hyper-V feature bits
  x86: host-phys-bits-limit option
  target/i386: Disable MPX support on named CPU models
  target-i386: Reenable RDTSCP support on Opteron_G[345] CPU models CPU models
  i386/kvm: expose HV_CPUID_ENLIGHTMENT_INFO.EAX and HV_CPUID_NESTED_FEATURES.EAX as feature words

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoqemu-nbd: Add --bitmap=NAME option
Eric Blake [Fri, 11 Jan 2019 19:47:20 +0000 (13:47 -0600)]
qemu-nbd: Add --bitmap=NAME option

Having to fire up qemu, then use QMP commands for nbd-server-start
and nbd-server-add, just to expose a persistent dirty bitmap, is
rather tedious.  Make it possible to expose a dirty bitmap using
just qemu-nbd (of course, for now this only works when qemu-nbd is
visiting a BDS formatted as qcow2).

Of course, any good feature also needs unit testing, so expand
iotest 223 to cover it.

Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <20190111194720.15671-9-eblake@redhat.com>

5 years agonbd: Merge nbd_export_bitmap into nbd_export_new
Eric Blake [Fri, 11 Jan 2019 19:47:19 +0000 (13:47 -0600)]
nbd: Merge nbd_export_bitmap into nbd_export_new

We only have one caller that wants to export a bitmap name,
which it does right after creation of the export. But there is
still a brief window of time where an NBD client could see the
export but not the dirty bitmap, which a robust client would
have to interpret as meaning the entire image should be treated
as dirty.  Better is to eliminate the window entirely, by
inlining nbd_export_bitmap() into nbd_export_new(), and refusing
to create the bitmap in the first place if the requested bitmap
can't be located.

We also no longer need logic for setting a different bitmap
name compared to the bitmap being exported.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20190111194720.15671-8-eblake@redhat.com>

5 years agonbd: Remove x-nbd-server-add-bitmap
Eric Blake [Fri, 11 Jan 2019 19:47:18 +0000 (13:47 -0600)]
nbd: Remove x-nbd-server-add-bitmap

Now that nbd-server-add can do the same functionality (well, other
than making the exported bitmap name different than the underlying
bitamp - but we argued that was not essential, since it is just as
easy to create a new non-persistent bitmap with the desired name),
we no longer need the experimental separate command.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20190111194720.15671-7-eblake@redhat.com>

5 years agonbd: Allow bitmap export during QMP nbd-server-add
Eric Blake [Fri, 11 Jan 2019 19:47:17 +0000 (13:47 -0600)]
nbd: Allow bitmap export during QMP nbd-server-add

With the experimental x-nbd-server-add-bitmap command, there was
a window of time where an NBD client could see the export but not
the associated dirty bitmap, which can cause a client that planned
on using the dirty bitmap to be forced to treat the entire image
as dirty as a safety fallback.  Furthermore, if the QMP client
successfully exports a disk but then fails to add the bitmap, it
has to take on the burden of removing the export.  Since we don't
allow changing the exposed dirty bitmap (whether to a different
bitmap, or removing advertisement of the bitmap), it is nicer to
make the bitmap tied to the export at the time the export is
created, with automatic failure to export if the bitmap is not
available.

The experimental command included an optional 'bitmap-export-name'
field for remapping the name exposed over NBD to be different from
the bitmap name stored on disk.  However, my libvirt demo code
for implementing differential backups on top of persistent bitmaps
did not need to take advantage of that feature (it is instead
possible to create a new temporary bitmap with the desired name,
use block-dirty-bitmap-merge to merge one or more persistent
bitmaps into the temporary, then associate the temporary with the
NBD export, if control is needed over the exported bitmap name).
Hence, I'm not copying that part of the experiment over to the
stable addition. For more details on the libvirt demo, see
https://www.redhat.com/archives/libvir-list/2018-October/msg01254.html,
https://kvmforum2018.sched.com/event/FzuB/facilitating-incremental-backup-eric-blake-red-hat

This patch focuses on the user interface, and reduces (but does
not completely eliminate) the window where an NBD client can see
the export but not the dirty bitmap, with less work to clean up
after errors.  Later patches will add further cleanups now that
this interface is declared stable via a single QMP command,
including removing the race window.

Update test 223 to use the new interface.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20190111194720.15671-6-eblake@redhat.com>

5 years agonbd: Merge nbd_export_set_name into nbd_export_new
Eric Blake [Fri, 11 Jan 2019 19:47:16 +0000 (13:47 -0600)]
nbd: Merge nbd_export_set_name into nbd_export_new

The existing NBD code had a weird split where nbd_export_new()
created an export but did not add it to the list of exported
names until a later nbd_export_set_name() came along and grabbed
a second reference on the object; later, the first call to
nbd_export_close() drops the second reference while removing
the export from the list.  This is in part because the QAPI
NbdServerRemoveNode enum documents the possibility of adding a
mode where we could do a soft disconnect: preventing new clients,
but waiting for existing clients to gracefully quit, based on
the mode used when calling nbd_export_close().

But in spite of all that, note that we never change the name of
an NBD export while it is exposed, which means it is easier to
just inline the process of setting the name as part of creating
the export.

Inline the contents of nbd_export_set_name() and
nbd_export_set_description() into the two points in an export
lifecycle where they matter, then adjust both callers to pass
the name up front.  Note that for creation, all callers pass a
non-NULL name, (passing NULL at creation was for old style
servers, but we removed support for that in commit 7f7dfe2a),
so we can add an assert and do things unconditionally; but for
cleanup, because of the dual nature of nbd_export_close(), we
still have to be careful to avoid use-after-free.  Along the
way, add a comment reminding ourselves of the potential of
adding a middle mode disconnect.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20190111194720.15671-5-eblake@redhat.com>

5 years agonbd: Only require disabled bitmap for read-only exports
Eric Blake [Fri, 11 Jan 2019 19:47:15 +0000 (13:47 -0600)]
nbd: Only require disabled bitmap for read-only exports

Our initial implementation of x-nbd-server-add-bitmap put
in a restriction because of incremental backups: in that
usage, we are exporting one qcow2 file (the temporary overlay
target of a blockdev-backup sync:none job) and a dirty bitmap
owned by a second qcow2 file (the source of the
blockdev-backup, which is the backing file of the temporary).
While both qcow2 files are still writable (the target in
order to capture copy-on-write of old contents, and the
source in order to track live guest writes in the meantime),
the NBD client expects to see constant data, including the
dirty bitmap.  An enabled bitmap in the source would be
modified by guest writes, which is at odds with the NBD
export being a read-only constant view, hence the initial
code choice of enforcing a disabled bitmap (the intent is
that the exposed bitmap was disabled in the same transaction
that started the blockdev-backup job, although we don't want
to track enough state to actually enforce that).

However, consider the case of a bitmap contained in a read-only
node (including when the bitmap is found in a backing layer of
the active image).  Because the node can't be modified, the
bitmap won't change due to writes, regardless of whether it is
still enabled.  Forbidding the export unless the bitmap is
disabled is awkward, paritcularly since we can't change the
bitmap to be disabled (because the node is read-only).

Alternatively, consider the case of live storage migration,
where management directs the destination to create a writable
NBD server, then performs a drive-mirror from the source to
the target, prior to doing the rest of the live migration.
Since storage migration can be time-consuming, it may be wise
to let the destination include a dirty bitmap to track which
portions it has already received, where even if the migration
is interrupted and restarted, the source can query the
destination block status in order to potentially minimize
re-sending data that has not changed in the meantime on a
second attempt. Such code has not been written, and might not
be trivial (after all, a cluster being marked dirty in the
bitmap does not necessarily guarantee it has the desired
contents), but it makes sense that letting an active dirty
bitmap be exposed and changing alongside writes may prove
useful in the future.

Solve both issues by gating the restriction against a
disabled bitmap to only happen when the caller has requested
a read-only export, and where the BDS that owns the bitmap
(whether or not it is the BDS handed to nbd_export_new() or
from its backing chain) is still writable.  We could drop
the check altogether (if management apps are prepared to
deal with a changing bitmap even on a read-only image), but
for now keeping a check for the read-only case still stands
a chance of preventing management errors.

Update iotest 223 to show the looser behavior by leaving
a bitmap enabled the whole run; note that we have to tear
down and re-export a node when handling an error.

Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <20190111194720.15671-4-eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
5 years agonbd: Forbid nbd-server-stop when server is not running
Eric Blake [Fri, 11 Jan 2019 19:47:14 +0000 (13:47 -0600)]
nbd: Forbid nbd-server-stop when server is not running

Since we already forbid other nbd-server commands when not
in the right state, it is unlikely that any caller was relying
on a second stop to behave as a silent no-op.  Update iotest
223 to show the improved behavior.

Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <20190111194720.15671-3-eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
5 years agonbd: Add some error case testing to iotests 223
Eric Blake [Fri, 11 Jan 2019 19:47:13 +0000 (13:47 -0600)]
nbd: Add some error case testing to iotests 223

Testing success paths is important, but it's also nice to highlight
expected failure handling, to show that we don't crash, and so that
upcoming tests that change behavior can demonstrate the resulting
effects on error paths.

Add the following errors:
Attempting to export without a running server
Attempting to start a second server
Attempting to export a bad node name
Attempting to export a name that is already exported
Attempting to export an enabled bitmap
Attempting to remove an already removed export
Attempting to quit server a second time

All of these properly complain except for a second server-stop,
which will be fixed next.

Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <20190111194720.15671-2-eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
5 years agoqemu-nbd: Rename 'exp' variable clashing with math::exp() symbol
Philippe Mathieu-Daudé [Fri, 11 Jan 2019 16:35:19 +0000 (17:35 +0100)]
qemu-nbd: Rename 'exp' variable clashing with math::exp() symbol

The use of a variable named 'exp' prevents includes to import <math.h>.

Rename it to avoid:

  qemu-nbd.c:64:19: error: ‘exp’ redeclared as different kind of symbol
   static NBDExport *exp;
                     ^~~
  In file included from /usr/include/features.h:428,
                   from /usr/include/bits/libc-header-start.h:33,
                   from /usr/include/stdint.h:26,
                   from /usr/lib/gcc/x86_64-redhat-linux/8/include/stdint.h:9,
                   from /source/qemu/include/qemu/osdep.h:80,
                   from /source/qemu/qemu-nbd.c:19:
  /usr/include/bits/mathcalls.h:95:1: note: previous declaration of ‘exp’ was here
    __MATHCALL_VEC (exp,, (_Mdouble_ __x));
    ^~~~~~~~~~~~~~

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20190111163519.11457-1-philmd@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
5 years agoiotests: add iotest 236 for testing bitmap merge
John Snow [Fri, 21 Dec 2018 09:35:29 +0000 (04:35 -0500)]
iotests: add iotest 236 for testing bitmap merge

New interface, new smoke test.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20181221093529.23855-12-jsnow@redhat.com>
[eblake: fix last-minute change to echo text]
Signed-off-by: Eric Blake <eblake@redhat.com>
5 years agoiotests: implement pretty-print for log and qmp_log
John Snow [Fri, 21 Dec 2018 09:35:28 +0000 (04:35 -0500)]
iotests: implement pretty-print for log and qmp_log

If iotests have lines exceeding >998 characters long, git doesn't
want to send it plaintext to the list. We can solve this by allowing
the iotests to use pretty printed QMP output that we can match against
instead.

As a bonus, it's much nicer for human eyes too.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20181221093529.23855-11-jsnow@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
5 years agoiotests: change qmp_log filters to expect QMP objects only
John Snow [Fri, 21 Dec 2018 09:35:27 +0000 (04:35 -0500)]
iotests: change qmp_log filters to expect QMP objects only

As laid out in the previous commit's message:

```
Several places in iotests deal with serializing objects into JSON
strings, but to add pretty-printing it seems desirable to localize
all of those cases.

log() seems like a good candidate for that centralized behavior.
log() can already serialize json objects, but when it does so,
it assumes filters=[] operates on QMP objects, not strings.

qmp_log currently operates by dumping outgoing and incoming QMP
objects into strings and filtering them assuming that filters=[]
are string filters.
```

Therefore:

Change qmp_log to treat filters as if they're always qmp object filters,
then change the logging call to rely on log()'s ability to serialize QMP
objects, so we're not duplicating that effort.

Add a qmp version of filter_testfiles and adjust the only caller using
it for qmp_log to use the qmp version.

Signed-off-by: John Snow <jsnow@redhat.com>
Message-Id: <20181221093529.23855-10-jsnow@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
5 years agoiotests: remove default filters from qmp_log
John Snow [Fri, 21 Dec 2018 09:35:26 +0000 (04:35 -0500)]
iotests: remove default filters from qmp_log

Several places in iotests deal with serializing objects into JSON
strings, but to add pretty-printing it seems desirable to localize
all of those cases.

log() seems like a good candidate for that centralized behavior.
log() can already serialize json objects, but when it does so,
it assumes filters=[] operates on QMP objects, not strings.

qmp_log currently operates by dumping outgoing and incoming QMP
objects into strings and filtering them assuming that filters=[]
are string filters.

To have qmp_log use log's serialization, qmp_log will need to
accept only qmp filters, not text filters.

However, only a single caller of qmp_log actually requires any
filters at all. I remove the default filter and add it explicitly
to the caller in preparation for refactoring qmp_log to use rich
filters instead.

test 206 is amended to name the filter explicitly and the default
is removed.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20181221093529.23855-9-jsnow@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
5 years agoiotests: add qmp recursive sorting function
John Snow [Fri, 21 Dec 2018 09:35:25 +0000 (04:35 -0500)]
iotests: add qmp recursive sorting function

Python before 3.6 does not sort dictionaries (including kwargs).
Therefore, printing QMP objects involves sorting the keys to have
a predictable ordering in the iotests output. This means that
iotests output will sometimes show arguments in an order not
specified by the test author.

Presently, we accomplish this by using json.dumps' sort_keys argument,
where we only serialize the arguments dictionary, but not the command.

However, if we want to pretty-print QMP objects being sent to the
QEMU process, we need to build the entire command before logging it.
Ordinarily, this would then involve "arguments" being sorted above
"execute", which would necessitate a rather ugly and harder-to-read
change to many iotests outputs.

To facilitate pretty-printing AND maintaining predictable output AND
having "arguments" sort after "execute", add a custom sort function
that takes a dictionary and recursively builds an OrderedDict that
maintains the specific key order we wish to see in iotests output.

The qmp_log function uses this to build a QMP object that keeps
"execute" above "arguments", but sorts all keys and keys in any
subdicts in "arguments" lexicographically to maintain consistent
iotests output, with no incompatible changes to any current test.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20181221093529.23855-8-jsnow@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
5 years agoiotests: add filter_generated_node_ids
John Snow [Fri, 21 Dec 2018 09:35:24 +0000 (04:35 -0500)]
iotests: add filter_generated_node_ids

To mimic the common filter of the same name, but for the python tests.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20181221093529.23855-7-jsnow@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
5 years agoiotests.py: don't abort if IMGKEYSECRET is undefined
John Snow [Fri, 21 Dec 2018 09:35:23 +0000 (04:35 -0500)]
iotests.py: don't abort if IMGKEYSECRET is undefined

Instead of using os.environ[], use .get with a default of empty string
to match the setup in check to allow us to import the iotests module
(for debugging, say) without needing a crafted environment just to
import the module.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20181221093529.23855-6-jsnow@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
5 years agoblock: remove 'x' prefix from experimental bitmap APIs
John Snow [Fri, 21 Dec 2018 09:35:22 +0000 (04:35 -0500)]
block: remove 'x' prefix from experimental bitmap APIs

The 'x' prefix was added because I was uncertain of the direction we'd
take for the libvirt API. With the general approach solidified, I feel
comfortable committing to this API for 4.0.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20181221093529.23855-5-jsnow@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
5 years agoblockdev: n-ary bitmap merge
John Snow [Fri, 21 Dec 2018 09:35:21 +0000 (04:35 -0500)]
blockdev: n-ary bitmap merge

Especially outside of transactions, it is helpful to provide
all-or-nothing semantics for bitmap merges. This facilitates
the coalescing of multiple bitmaps into a single target for
the "checkpoint" interpretation when assembling bitmaps that
represent arbitrary points in time from component bitmaps.

This is an incompatible change from the preliminary version
of the API.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20181221093529.23855-4-jsnow@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
5 years agoblock/dirty-bitmap: remove assertion from restore
John Snow [Fri, 21 Dec 2018 09:35:20 +0000 (04:35 -0500)]
block/dirty-bitmap: remove assertion from restore

When making a backup of a dirty bitmap (for transactions), we want to
restore that backup whether or not the bitmap is enabled.

It is perfectly valid to write into bitmaps that are disabled. It is
only illegitimate for the guest to have done so.

Remove this assertion.

Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: John Snow <jsnow@redhat.com>
Message-Id: <20181221093529.23855-3-jsnow@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
5 years agoblockdev: abort transactions in reverse order
John Snow [Fri, 11 Jan 2019 17:59:16 +0000 (11:59 -0600)]
blockdev: abort transactions in reverse order

Presently, we abort transactions in the same order they were processed in.
Bitmap commands, though, attempt to restore backup data structures on abort.

That's not valid, they need to be aborted in reverse chronological order.

Replace the QSIMPLEQ data structure with a QTAILQ one, so we can iterate
in reverse for the abort phase of the transaction.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20181221093529.23855-2-jsnow@redhat.com>
[eblake: rebase]
Signed-off-by: Eric Blake <eblake@redhat.com>
5 years agoMAINTAINERS: add myself as a route for gitdm updates
Alex Bennée [Mon, 14 Jan 2019 15:25:13 +0000 (15:25 +0000)]
MAINTAINERS: add myself as a route for gitdm updates

Seeing as I'll get pegged by get_maintainers.pl anyway I might as well
make the support status of the data mining config official.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
5 years agocontrib/gitdm: add another name to WaveComp map
Alex Bennée [Mon, 14 Jan 2019 16:03:04 +0000 (16:03 +0000)]
contrib/gitdm: add another name to WaveComp map

Requested by Aleksandar.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
5 years agocontrib/gitdm: add two more IBM'ers to group-map-ibm
Alex Bennée [Thu, 20 Dec 2018 16:26:10 +0000 (16:26 +0000)]
contrib/gitdm: add two more IBM'ers to group-map-ibm

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Aleksandar Markovic <amarkovic@wavecomp.com>
5 years agocontrib/gitdm: Add other IBMers
Joel Stanley [Wed, 2 Jan 2019 11:06:12 +0000 (21:36 +1030)]
contrib/gitdm: Add other IBMers

Here are some IBMers who use their personal addresses when submitting
patches.

Signed-off-by: Joel Stanley <joel@jms.id.au>
Acked-by: Andrew Jeffery <andrew@aj.id.au>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Aleksandar Markovic <amarkovic@wavecomp.com>
5 years agocontrib/gitdm: add Nokia and Proxmox to the domain-map
Alex Bennée [Thu, 20 Dec 2018 16:25:31 +0000 (16:25 +0000)]
contrib/gitdm: add Nokia and Proxmox to the domain-map

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Aleksandar Markovic <amarkovic@wavecomp.com>
5 years agoRevert "tests: Disable qht-bench parallel test when using gprof"
Alex Bennée [Mon, 14 Jan 2019 14:54:38 +0000 (14:54 +0000)]
Revert "tests: Disable qht-bench parallel test when using gprof"

This reverts commit ce2eefd7c21697fee87a0686353de881081d22c6. The
underlying cause was fixed with eb4f8e100f.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
5 years agotests: use g_usleep instead of rem = sleep(time)
Alex Bennée [Fri, 11 Jan 2019 13:50:02 +0000 (13:50 +0000)]
tests: use g_usleep instead of rem = sleep(time)

Relying on sleep to always return having slept isn't safe as a signal
may have occurred. If signals are constantly incoming the program will
never reach its termination condition. This is believed to be the
mechanism causing time outs for qht-test in Travis.

The glib g_usleep() deals with all of this for us so lets use it instead.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
5 years agotests/docker: remove SID_AGE test hack
Alex Bennée [Thu, 10 Jan 2019 17:18:42 +0000 (17:18 +0000)]
tests/docker: remove SID_AGE test hack

Now we are using "named" snapshots of debian-sid we can rely on the
existing checksum mechanism for detecting changes.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
5 years agotests/docker: update our Travis image
Alex Bennée [Wed, 9 Jan 2019 13:30:54 +0000 (13:30 +0000)]
tests/docker: update our Travis image

We are now using Xenial based images on Travis so we should make the
same one available as our qemu:travis docker image.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
5 years agotravis: bump to Xenial baseline
Alex Bennée [Wed, 9 Jan 2019 10:42:00 +0000 (10:42 +0000)]
travis: bump to Xenial baseline

Travis is slowly catching up. Move to Xenial based images for our
current builds. These are now all proper VMs.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
5 years agodocker: Use a stable snapshot for Debian Sid
Philippe Mathieu-Daudé [Thu, 1 Nov 2018 18:37:05 +0000 (19:37 +0100)]
docker: Use a stable snapshot for Debian Sid

The Debian Sid repository is not garanteed to be stable, as his
'unstable' name suggest :)
To allow quick testing, packages are pushed various time a day,
which my be annoying when trying to use it for stable development
(which is not recommended, but Sid provides edge packages we use
for testing).

Debian provides repositories snapshots which are suitable for our
use. Pick a recent date that works. When required, update to newer
releases will be easy.

This fixes current issues with this image:

  $ make docker-image-debian-sid
  [...]
  The following packages have unmet dependencies:
   build-essential : Depends: dpkg-dev (>= 1.17.11) but it is not going to be installed
   git : Depends: perl but it is not going to be installed
         Depends: liberror-perl but it is not going to be installed
   pkg-config : Depends: libdpkg-perl but it is not going to be installed
   texinfo : Depends: perl (>= 5.26.2-6) but it is not going to be installed
             Depends: libtext-unidecode-perl but it is not going to be installed
             Depends: libxml-libxml-perl but it is not going to be installed
  E: Unable to correct problems, you have held broken packages.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
[AJB: also tweak FROM to a earlier snapshot]
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
5 years agotravis: remove matrix settings that duplicate global settings
Daniel P. Berrangé [Wed, 9 Jan 2019 16:31:14 +0000 (16:31 +0000)]
travis: remove matrix settings that duplicate global settings

The global defaults request "trusty" and "gcc", so matrix entries do not
need to repeat this.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
5 years agotravis: run tests in verbose mode
Daniel P. Berrangé [Wed, 9 Jan 2019 16:31:13 +0000 (16:31 +0000)]
travis: run tests in verbose mode

Travis sometimes fails a build because it produces no console output for
over 10 minutes. If this is due to a genuine hang, it would be useful to
have used verbose test output to see where it failed. If this is just
due to tests being very slow, having verbose output might allow the
build to succeed.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
5 years agotravis: stop using container based envs
Daniel P. Berrangé [Wed, 9 Jan 2019 16:31:12 +0000 (16:31 +0000)]
travis: stop using container based envs

The Travis container based envs are deprecated:

  https://docs.travis-ci.com/user/reference/trusty/

  "Container-based infrastructure is currently being deprecated.
   Please remove any sudo: false keys in your .travis.yml file
   to use the default fully-virtualized Linux infrastructure
   instead."

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
5 years agotravis: stop redefining the script commands
Daniel P. Berrangé [Wed, 9 Jan 2019 16:31:11 +0000 (16:31 +0000)]
travis: stop redefining the script commands

One of the matrix entries redefines the script command in order to add
the ${MAKEFLAGS} variable. Ideally ${MAKEFLAGS} would be referenced by
the definition of the ${TEST_CMD} env variable, but this isn't possible
in travis. ${MAKEFLAGS} exists to eliminate duplication of flags in
every "make" command, but this cure causes a worse problem, namely the
reduplication of the "script" command. It is simpler to just insert "-j3"
directly into any "make" command.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
5 years agotravis: use homebrew addon for MacOSX
Alex Bennée [Wed, 9 Jan 2019 14:20:54 +0000 (14:20 +0000)]
travis: use homebrew addon for MacOSX

Rather than poking homebrew manually we can specify the packages
needed via the homebrew addon. These are only installed on MacOS based
builds.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agotravis: don't clone git submodules upfront
Daniel P. Berrangé [Wed, 9 Jan 2019 16:31:09 +0000 (16:31 +0000)]
travis: don't clone git submodules upfront

The configure script & Makefile are already capable of figuring out
which git submodules are required for a given build platform, and
cloning them at the right time.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
5 years agotravis: standardize the syntax used for env variables
Daniel P. Berrangé [Wed, 9 Jan 2019 16:31:08 +0000 (16:31 +0000)]
travis: standardize the syntax used for env variables

Matrix entries are defining env variables using two different syntax
styles:

   - env: FOO=bar
          WIZZ=bang

and

   - env:
       - FOO=bar
       - WIZZ=bang

Switch everything to use the latter style as the more normal indentation
approach.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
5 years agotravis: define all the build matrix entries in one place
Daniel P. Berrangé [Wed, 9 Jan 2019 16:31:07 +0000 (16:31 +0000)]
travis: define all the build matrix entries in one place

The current build matrix is constructed from entries listed under the
environment variable config section, as well as the general purpose
build matrix section. Move everything under the general purpose section
so it is clear at a glance what is in the matrix.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
5 years agotravis: add whitespace between each major section & matrix entry
Daniel P. Berrangé [Wed, 9 Jan 2019 16:31:06 +0000 (16:31 +0000)]
travis: add whitespace between each major section & matrix entry

Improve the readability of the travis config by adding two blank lines
between each major section and matrix entry.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
5 years agotests: use in-place sed magic for enabling deb-src in travis image
Alex Bennée [Wed, 9 Jan 2019 13:53:57 +0000 (13:53 +0000)]
tests: use in-place sed magic for enabling deb-src in travis image

This avoids potential problems with duplicates.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
5 years agotests: update Fedora i386 cross image to Fedora 29
Daniel P. Berrangé [Wed, 9 Jan 2019 16:31:05 +0000 (16:31 +0000)]
tests: update Fedora i386 cross image to Fedora 29

Using the "latest" tag is not a good idea because this changes what
release it points to every 6 months. Together with caching of docker
builds this can cause confusion where CI has cached & built with Fedora
N, while a developer tries to reproduce a CI problem with Fedora N + 1,
or vica-verca.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
5 years agotests: update Fedora dockerfile to use Fedora 29
Daniel P. Berrangé [Wed, 9 Jan 2019 16:31:04 +0000 (16:31 +0000)]
tests: update Fedora dockerfile to use Fedora 29

Fedora 29 is the current newest release, so switch to using that
from the current Fedora 28.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
5 years agotests: remove obsolete 'debian' dockerfile
Daniel P. Berrangé [Wed, 9 Jan 2019 16:31:03 +0000 (16:31 +0000)]
tests: remove obsolete 'debian' dockerfile

The 'debian' dockerfile was deprecated in favour of versioned
dockerfiles in July 2017. That is enough time for developers to
be warned about the rename.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
5 years agotests: run ldconfig after installing extra software
Daniel P. Berrangé [Wed, 9 Jan 2019 16:31:02 +0000 (16:31 +0000)]
tests: run ldconfig after installing extra software

The docker file builds and installs software into /usr/local but does
not run ldconfig. As a result QEMU links to libvirglrenderer.so, but
then crashes in "make check" unable to find the library.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
5 years agodocker: Use stable git tag for virglrenderer
Philippe Mathieu-Daudé [Thu, 3 Jan 2019 17:21:51 +0000 (18:21 +0100)]
docker: Use stable git tag for virglrenderer

Use a stable tag instead of some random commit from mainstream
development, to avoid unexpected build failures.

This fixes:

    CC       virglrenderer.lo
  virglrenderer.c: In function 'virgl_has_gl_colorspace':
  virglrenderer.c:208:11: error: implicit declaration of function 'virgl_has_egl_khr_gl_colorspace' [-Werror=implicit-function-declaration]
             virgl_has_egl_khr_gl_colorspace(egl_info));
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  virglrenderer.c:208:43: error: 'egl_info' undeclared (first use in this function)
             virgl_has_egl_khr_gl_colorspace(egl_info));
                                             ^~~~~~~~
  virglrenderer.c:208:43: note: each undeclared identifier is reported only once for each function it appears in
  cc1: some warnings being treated as errors

As of this commit 'git virglrenderer-0.7.0' is the last stable tag.
(virglrenderer commit breaking: fb4f7577f7ef)

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
5 years agoi386/kvm: add a comment explaining why .feat_names are commented out for Hyper-V...
Vitaly Kuznetsov [Fri, 21 Dec 2018 14:16:04 +0000 (15:16 +0100)]
i386/kvm: add a comment explaining why .feat_names are commented out for Hyper-V feature bits

Hyper-V .feat_names are, unlike hardware features, commented out and it is
not obvious why we do that. Document the current status quo.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Message-Id: <20181221141604.16935-1-vkuznets@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agox86: host-phys-bits-limit option
Eduardo Habkost [Tue, 11 Dec 2018 19:25:27 +0000 (17:25 -0200)]
x86: host-phys-bits-limit option

Some downstream distributions of QEMU set host-phys-bits=on by
default.  This worked very well for most use cases, because
phys-bits really didn't have huge consequences. The only
difference was on the CPUID data seen by guests, and on the
handling of reserved bits.

This changed in KVM commit 855feb673640 ("KVM: MMU: Add 5 level
EPT & Shadow page table support").  Now choosing a large
phys-bits value for a VM has bigger impact: it will make KVM use
5-level EPT even when it's not really necessary.  This means
using the host phys-bits value may not be the best choice.

Management software could address this problem by manually
configuring phys-bits depending on the size of the VM and the
amount of MMIO address space required for hotplug.  But this is
not trivial to implement.

However, there's another workaround that would work for most
cases: keep using the host phys-bits value, but only if it's
smaller than 48.  This patch makes this possible by introducing a
new "-cpu" option: "host-phys-bits-limit".  Management software
or users can make sure they will always use 4-level EPT using:
"host-phys-bits=on,host-phys-bits-limit=48".

This behavior is still not enabled by default because QEMU
doesn't enable host-phys-bits=on by default.  But users,
management software, or downstream distributions may choose to
change their defaults using the new option.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20181211192527.13254-1-ehabkost@redhat.com>
[ehabkost: removed test code while some issues are addressed]
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agotarget/i386: Disable MPX support on named CPU models
Paolo Bonzini [Thu, 20 Dec 2018 12:11:00 +0000 (13:11 +0100)]
target/i386: Disable MPX support on named CPU models

MPX support is being phased out by Intel; GCC has dropped it, Linux
is also going to do that.  Even though KVM will have special code
to support MPX after the kernel proper stops enabling it in XCR0,
we probably also want to deprecate that in a few years.  As a start,
do not enable it by default for any named CPU model starting with
the 4.0 machine types; this include Skylake, Icelake and Cascadelake.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20181220121100.21554-1-pbonzini@redhat.com>
Reviewed-by:   Wainer dos Santos Moschetta <wainersm@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agotarget-i386: Reenable RDTSCP support on Opteron_G[345] CPU models CPU models
Borislav Petkov [Thu, 20 Dec 2018 12:07:32 +0000 (10:07 -0200)]
target-i386: Reenable RDTSCP support on Opteron_G[345] CPU models CPU models

The missing functionality was added ~3 years ago with the Linux commit

  46896c73c1a4 ("KVM: svm: add support for RDTSCP")

so reenable RDTSCP support on those CPU models.

Opteron_G2 - being family 15, model 6, doesn't have RDTSCP support
(the real hardware doesn't have it. K8 got RDTSCP support with the NPT
models, i.e., models >= 0x40).

Document the host's minimum required kernel version, while at it.

Signed-off-by: Borislav Petkov <bp@suse.de>
Message-ID: <20181212200803.GG6653@zn.tnic>
[ehabkost: moved compat properties code to pc.c]
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agoi386/kvm: expose HV_CPUID_ENLIGHTMENT_INFO.EAX and HV_CPUID_NESTED_FEATURES.EAX as...
Vitaly Kuznetsov [Mon, 26 Nov 2018 13:59:58 +0000 (14:59 +0100)]
i386/kvm: expose HV_CPUID_ENLIGHTMENT_INFO.EAX and HV_CPUID_NESTED_FEATURES.EAX as feature words

It was found that QMP users of QEMU (e.g. libvirt) may need
HV_CPUID_ENLIGHTMENT_INFO.EAX/HV_CPUID_NESTED_FEATURES.EAX information. In
particular, 'hv_tlbflush' and 'hv_evmcs' enlightenments are only exposed in
HV_CPUID_ENLIGHTMENT_INFO.EAX.

HV_CPUID_NESTED_FEATURES.EAX is exposed for two reasons: convenience
(we don't need to export it from hyperv_handle_properties() and as
future-proof for Enlightened MSR-Bitmap, PV EPT invalidation and
direct virtual flush features.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Message-Id: <20181126135958.20956-1-vkuznets@redhat.com>
Reviewed-by: Roman Kagan <rkagan@virtuozzo.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agoaio-posix: Fix concurrent aio_poll/set_fd_handler.
Remy Noel [Thu, 20 Dec 2018 15:20:30 +0000 (16:20 +0100)]
aio-posix: Fix concurrent aio_poll/set_fd_handler.

It is possible for an io_poll callback to be concurrently executed along
with an aio_set_fd_handlers. This can cause all sorts of problems, like
a NULL callback or a bad opaque pointer.

This changes set_fd_handlers so that it no longer modify existing handlers
entries and instead, always insert those after having proper initialisation.

Tested-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Remy Noel <remy.noel@blade-group.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 20181220152030.28035-3-remy.noel@blade-group.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
5 years agoaio-posix: Unregister fd from ctx epoll when removing fd_handler.
Remy Noel [Thu, 20 Dec 2018 15:20:29 +0000 (16:20 +0100)]
aio-posix: Unregister fd from ctx epoll when removing fd_handler.

Cleaning the events will cause aio_epoll_update to unregister the fd.
Otherwise, the fd is kept registered until it is destroyed.

Signed-off-by: Remy Noel <remy.noel@blade-group.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 20181220152030.28035-2-remy.noel@blade-group.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
5 years agoMerge remote-tracking branch 'remotes/aperard/tags/pull-xen-20190114' into staging
Peter Maydell [Mon, 14 Jan 2019 13:54:17 +0000 (13:54 +0000)]
Merge remote-tracking branch 'remotes/aperard/tags/pull-xen-20190114' into staging

Xen queue

* Xen PV backend 'qdevification'.
  Starting with xen_disk.
* Performance improvements for xen-block.
* Remove of the Xen PV domain builder.
* bug fixes.

# gpg: Signature made Mon 14 Jan 2019 13:46:33 GMT
# gpg:                using RSA key 0CF5572FD7FB55AF
# gpg: Good signature from "Anthony PERARD <anthony.perard@gmail.com>"
# gpg:                 aka "Anthony PERARD <anthony.perard@citrix.com>"
# 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: 5379 2F71 024C 600F 778A  7161 D8D5 7199 DF83 42C8
#      Subkey fingerprint: F80C 0063 08E2 2CFD 8A92  E798 0CF5 572F D7FB 55AF

* remotes/aperard/tags/pull-xen-20190114: (25 commits)
  xen-block: avoid repeated memory allocation
  xen-block: improve response latency
  xen-block: improve batching behaviour
  xen: Replace few mentions of xend by libxl
  Remove broken Xen PV domain builder
  xen: remove the legacy 'xen_disk' backend
  MAINTAINERS: add myself as a Xen maintainer
  xen: automatically create XenBlockDevice-s
  xen: add a mechanism to automatically create XenDevice-s...
  xen: add implementations of xen-block connect and disconnect functions...
  xen: purge 'blk' and 'ioreq' from function names in dataplane/xen-block.c
  xen: remove 'ioreq' struct/varable/field names from dataplane/xen-block.c
  xen: remove 'XenBlkDev' and 'blkdev' names from dataplane/xen-block
  xen: add header and build dataplane/xen-block.c
  xen: remove unnecessary code from dataplane/xen-block.c
  xen: duplicate xen_disk.c as basis of dataplane/xen-block.c
  xen: add event channel interface for XenDevice-s
  xen: add grant table interface for XenDevice-s
  xen: add xenstore watcher infrastructure
  xen: create xenstore areas for XenDevice-s
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoxen-block: avoid repeated memory allocation
Tim Smith [Wed, 12 Dec 2018 11:16:26 +0000 (11:16 +0000)]
xen-block: avoid repeated memory allocation

The xen-block dataplane currently allocates memory to hold the data for
each request as that request is used, and frees it afterwards. Because
it requires page-aligned blocks, this interacts poorly with non-page-
aligned allocations and balloons the heap.

Instead, allocate the maximum possible buffer size required for the
protocol, which is BLKIF_MAX_SEGMENTS_PER_REQUEST (currently 11) pages
when the request structure is created, and keep that buffer until it is
destroyed. Since the requests are re-used via a free list, this should
actually improve memory usage.

Signed-off-by: Tim Smith <tim.smith@citrix.com>
Re-based and commit comment adjusted.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Acked-by: Anthony PERARD <anthony.perard@citrix.com>
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
5 years agoxen-block: improve response latency
Tim Smith [Wed, 12 Dec 2018 11:16:25 +0000 (11:16 +0000)]
xen-block: improve response latency

If the I/O ring is full, the guest cannot send any more requests
until some responses are sent. Only sending all available responses
just before checking for new work does not leave much time for the
guest to supply new work, so this will cause stalls if the ring gets
full. Also, not completing reads as soon as possible adds latency
to the guest.

To alleviate that, complete IO requests as soon as they come back.
xen_block_send_response() already returns a value indicating whether
a notify should be sent, which is all the batching we need.

Signed-off-by: Tim Smith <tim.smith@citrix.com>
Re-based and commit comment adjusted.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Acked-by: Anthony PERARD <anthony.perard@citrix.com>
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
5 years agoxen-block: improve batching behaviour
Tim Smith [Wed, 12 Dec 2018 11:16:24 +0000 (11:16 +0000)]
xen-block: improve batching behaviour

When I/O consists of many small requests, performance is improved by
batching them together in a single io_submit() call. When there are
relatively few requests, the extra overhead is not worth it. This
introduces a check to start batching I/O requests via blk_io_plug()/
blk_io_unplug() in an amount proportional to the number which were
already in flight at the time we started reading the ring.

Signed-off-by: Tim Smith <tim.smith@citrix.com>
Re-based and commit comment adjusted.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Acked-by: Anthony PERARD <anthony.perard@citrix.com>
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
5 years agoxen: Replace few mentions of xend by libxl
Anthony PERARD [Fri, 14 Sep 2018 11:18:30 +0000 (12:18 +0100)]
xen: Replace few mentions of xend by libxl

xend have been replaced by libxenlight (libxl) for many Xen releases
now.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Acked-by: Stefano Stabellini <sstabellini@kernel.org>
5 years agoRemove broken Xen PV domain builder
Anthony PERARD [Fri, 14 Sep 2018 11:18:29 +0000 (12:18 +0100)]
Remove broken Xen PV domain builder

It is broken since Xen 4.9 [1] and it will not build in Xen 4.12. Also,
it is not built by default since QEMU 2.6.

[1] https://lists.xenproject.org/archives/html/xen-devel/2018-09/msg00313.html

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Acked-by: Stefano Stabellini <sstabellini@kernel.org>
5 years agoxen: remove the legacy 'xen_disk' backend
Paul Durrant [Tue, 8 Jan 2019 14:49:03 +0000 (14:49 +0000)]
xen: remove the legacy 'xen_disk' backend

This backend has now been replaced by the 'xen-qdisk' XenDevice.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Acked-by: Anthony Perard <anthony.perard@citrix.com>
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
5 years agoMAINTAINERS: add myself as a Xen maintainer
Paul Durrant [Tue, 8 Jan 2019 14:49:02 +0000 (14:49 +0000)]
MAINTAINERS: add myself as a Xen maintainer

I have made many significant contributions to the Xen code in QEMU,
particularly the recent patches introducing a new PV device framework.
I intend to make further significant contributions, porting other PV back-
ends to the new framework with the intent of eventually removing the
legacy code. It therefore seems reasonable that I become a maintainer of
the Xen code.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Acked-by: Anthony Perard <anthony.perard@citrix.com>
Acked-by: Stefano Stabellini <sstabellini@kernel.org>
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
5 years agoxen: automatically create XenBlockDevice-s
Paul Durrant [Tue, 8 Jan 2019 14:49:01 +0000 (14:49 +0000)]
xen: automatically create XenBlockDevice-s

This patch adds create and destroy function for XenBlockDevice-s so that
they can be created automatically when the Xen toolstack instantiates a new
PV backend via xenstore. When the XenBlockDevice is created this way it is
also necessary to create a 'drive' which matches the configuration that the
Xen toolstack has written into xenstore. This is done by formulating the
parameters necessary for each 'blockdev' layer of the drive and then using
qmp_blockdev_add() to create the layers. Also, for compatibility with the
legacy 'xen_disk' implementation, an iothread is automatically created for
the new XenBlockDevice. This, like the driver layers, will be destroyed
after the XenBlockDevice is unrealized.

The legacy backend scan for 'qdisk' is removed by this patch, which makes
the 'xen_disk' code is redundant. The code will be removed by a subsequent
patch.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
5 years agoxen: add a mechanism to automatically create XenDevice-s...
Paul Durrant [Tue, 8 Jan 2019 14:49:00 +0000 (14:49 +0000)]
xen: add a mechanism to automatically create XenDevice-s...

...that maintains compatibility with existing Xen toolstacks.

Xen toolstacks instantiate PV backends by simply writing information into
xenstore and expecting a backend implementation to be watching for this.

This patch adds a new 'xen-backend' module to allow individual XenDevice
implementations to register create and destroy functions. The creator
will be called when a tool-stack instantiates a new backend in this way,
and the destructor will then be called after the resulting XenDevice
object is unrealized.

To support this it is also necessary to add new watchers into the XenBus
implementation to handle enumeration of new backends and also destruction
of XenDevice-s when the toolstack sets the backend 'online' key to 0.

NOTE: This patch only adds the framework. A subsequent patch will add a
      creator function for xen-block devices.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Reviewed-by: Anthony Perard <anthony.perard@citrix.com>
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
5 years agoxen: add implementations of xen-block connect and disconnect functions...
Paul Durrant [Tue, 8 Jan 2019 14:48:59 +0000 (14:48 +0000)]
xen: add implementations of xen-block connect and disconnect functions...

...and wire in the dataplane.

This patch adds the remaining code to make the xen-block XenDevice
functional. The parameters that a block frontend expects to find are
populated in the backend xenstore area, and the 'ring-ref' and
'event-channel' values specified in the frontend xenstore area are
mapped/bound and used to set up the dataplane.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Reviewed-by: Anthony Perard <anthony.perard@citrix.com>
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
5 years agoxen: purge 'blk' and 'ioreq' from function names in dataplane/xen-block.c
Paul Durrant [Tue, 8 Jan 2019 14:48:58 +0000 (14:48 +0000)]
xen: purge 'blk' and 'ioreq' from function names in dataplane/xen-block.c

This is a purely cosmetic patch that purges remaining use of 'blk' and
'ioreq' in local function names, and then makes sure all functions are
prefixed with 'xen_block_'.

No functional change.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Acked-by: Anthony Perard <anthony.perard@citrix.com>
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
5 years agoxen: remove 'ioreq' struct/varable/field names from dataplane/xen-block.c
Paul Durrant [Tue, 8 Jan 2019 14:48:57 +0000 (14:48 +0000)]
xen: remove 'ioreq' struct/varable/field names from dataplane/xen-block.c

This is a purely cosmetic patch that purges the name 'ioreq' from struct,
variable and field names. (This name has been problematic for a long time
as 'ioreq' is the name used for generic I/O requests coming from Xen).
The patch replaces 'struct ioreq' with a new 'XenBlockRequest' type and
'ioreq' field/variable names with 'request', and then does necessary
fix-up to adhere to coding style.

Function names are not modified by this patch. They will be dealt with in
a subsequent patch.

No functional change.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Acked-by: Anthony Perard <anthony.perard@citrix.com>
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
5 years agoxen: remove 'XenBlkDev' and 'blkdev' names from dataplane/xen-block
Paul Durrant [Tue, 8 Jan 2019 14:48:56 +0000 (14:48 +0000)]
xen: remove 'XenBlkDev' and 'blkdev' names from dataplane/xen-block

This is a purely cosmetic patch that substitutes the old 'struct XenBlkDev'
name with 'XenBlockDataPlane' and 'blkdev' field/variable names with
'dataplane', and then does necessary fix-up to adhere to coding style.

No functional change.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Acked-by: Anthony Perard <anthony.perard@citrix.com>
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
5 years agoxen: add header and build dataplane/xen-block.c
Paul Durrant [Tue, 8 Jan 2019 14:48:55 +0000 (14:48 +0000)]
xen: add header and build dataplane/xen-block.c

This patch adds the transformations necessary to get dataplane/xen-block.c
to build against the new XenBus/XenDevice framework. MAINTAINERS is also
updated due to the introduction of dataplane/xen-block.h.

NOTE: Existing data structure names are retained for the moment. These will
      be modified by subsequent patches. A typedef for XenBlockDataPlane
      has been added to the header (based on the old struct XenBlkDev name
      for the moment) so that the old names don't need to leak out of the
      dataplane code.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Reviewed-by: Anthony Perard <anthony.perard@citrix.com>
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
5 years agoxen: remove unnecessary code from dataplane/xen-block.c
Paul Durrant [Tue, 8 Jan 2019 14:48:54 +0000 (14:48 +0000)]
xen: remove unnecessary code from dataplane/xen-block.c

Not all of the code duplicated from xen_disk.c is required as the basis for
the new dataplane implementation so this patch removes extraneous code,
along with the legacy #includes and calls to the legacy xen_pv_printf()
function. Error messages are changed to be reported using error_report().

NOTE: The code is still not yet built. Further transformations will be
      required to make it correctly interface to the new XenBus/XenDevice
      framework. They will be delivered in a subsequent patch.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Acked-by: Anthony Perard <anthony.perard@citrix.com>
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
5 years agoxen: duplicate xen_disk.c as basis of dataplane/xen-block.c
Paul Durrant [Tue, 8 Jan 2019 14:48:53 +0000 (14:48 +0000)]
xen: duplicate xen_disk.c as basis of dataplane/xen-block.c

The new xen-block XenDevice implementation requires the same core
dataplane as the legacy xen_disk implementation it will eventually replace.
This patch therefore copies the legacy xen_disk.c source module into a new
dataplane/xen-block.c source module as the basis for the new dataplane and
adjusts the MAINTAINERS file accordingly.

NOTE: The duplicated code is not yet built. It is simply put into place by
      this patch (just fixing style violations) such that the
      modifications that will need to be made to the code are not
      conflated with code movement, thus making review harder.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Acked-by: Anthony Perard <anthony.perard@citrix.com>
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
5 years agoxen: add event channel interface for XenDevice-s
Paul Durrant [Tue, 8 Jan 2019 14:48:52 +0000 (14:48 +0000)]
xen: add event channel interface for XenDevice-s

The legacy PV backend infrastructure provides functions to bind, unbind
and send notifications to event channnels. Similar functionality will be
required by XenDevice implementations so this patch adds the necessary
support.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Reviewed-by: Anthony Perard <anthony.perard@citrix.com>
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Patch squashed with:

Patch "xen: add event channel interface for XenDevice-s" makes use of
the type xenevtchn_port_or_error_t, but this isn't avaiable before Xen
4.7. Also the function xen_device_bind_event_channel assign the return
value of xenevtchn_bind_interdomain to channel->local_port but check the
result for error with xendev->local_port.

Fix by:
- removing local_port from struct XenDevice as it isn't use anywere.
- adding a compatibility typedef for xenevtchn_port_or_error_t for Xen
  4.6 and earlier.

As extra, replace the type of XenEventChannel->local_port by
evtchn_port_t.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Paul Durrant <paul.durrant@citrix.com>
5 years agoxen: add grant table interface for XenDevice-s
Paul Durrant [Tue, 8 Jan 2019 14:48:51 +0000 (14:48 +0000)]
xen: add grant table interface for XenDevice-s

The legacy PV backend infrastructure provides functions to map, unmap and
copy pages granted by frontends. Similar functionality will be required
by XenDevice implementations so this patch adds the necessary support.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Reviewed-by: Anthony Perard <anthony.perard@citrix.com>
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
5 years agoxen: add xenstore watcher infrastructure
Paul Durrant [Tue, 8 Jan 2019 14:48:50 +0000 (14:48 +0000)]
xen: add xenstore watcher infrastructure

A Xen PV frontend communicates its state to the PV backend by writing to
the 'state' key in the frontend area in xenstore. It is therefore
necessary for a XenDevice implementation to be notified whenever the
value of this key changes.

This patch adds code to do this as follows:

- an 'fd handler' is registered on the libxenstore handle which will be
  triggered whenever a 'watch' event occurs
- primitives are added to xen-bus-helper to add or remove watch events
- a list of Notifier objects is added to XenBus to provide a mechanism
  to call the appropriate 'watch handler' when its associated event
  occurs

The xen-block implementation is extended with a 'frontend_changed' method,
which calls as-yet stub 'connect' and 'disconnect' functions when the
relevant frontend state transitions occur. A subsequent patch will supply
a full implementation for these functions.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Reviewed-by: Anthony Perard <anthony.perard@citrix.com>
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
5 years agoxen: create xenstore areas for XenDevice-s
Paul Durrant [Tue, 8 Jan 2019 14:48:49 +0000 (14:48 +0000)]
xen: create xenstore areas for XenDevice-s

This patch adds a new source module, xen-bus-helper.c, which builds on
basic libxenstore primitives to provide functions to create (setting
permissions appropriately) and destroy xenstore areas, and functions to
'printf' and 'scanf' nodes therein. The main xen-bus code then uses
these primitives [1] to initialize and destroy the frontend and backend
areas for a XenDevice during realize and unrealize respectively.

The 'xen-block' implementation is extended with a 'get_name' method that
returns the VBD number. This number is required to 'name' the xenstore
areas.

NOTE: An exit handler is also added to make sure the xenstore areas are
      cleaned up if QEMU terminates without devices being unrealized.

[1] The 'scanf' functions are actually not yet needed, but they will be
    needed by code delivered in subsequent patches.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Reviewed-by: Anthony Perard <anthony.perard@citrix.com>
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
5 years agoxen: introduce 'xen-block', 'xen-disk' and 'xen-cdrom'
Paul Durrant [Tue, 8 Jan 2019 14:48:48 +0000 (14:48 +0000)]
xen: introduce 'xen-block', 'xen-disk' and 'xen-cdrom'

This patch adds new XenDevice-s: 'xen-disk' and 'xen-cdrom', both derived
from a common 'xen-block' parent type. These will eventually replace the
'xen_disk' (note the underscore rather than hyphen) legacy PV backend but
it is illustrative to build up the implementation incrementally, along with
the XenBus/XenDevice framework. Subsequent patches will therefore add to
these devices' implementation as new features are added to the framework.

After this patch has been applied it is possible to instantiate new
'xen-disk' or 'xen-cdrom' devices with a single 'vdev' parameter, which
accepts values adhering to the Xen VBD naming scheme [1]. For example, a
command-line instantiation of a xen-disk can be done with an argument
similar to the following:

-device xen-disk,vdev=hda

The implementation of the vdev parameter formulates the appropriate VBD
number for use in the PV protocol.

[1] https://xenbits.xen.org/docs/unstable/man/xen-vbd-interface.7.html

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Reviewed-by: Anthony Perard <anthony.perard@citrix.com>
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
5 years agoxen: introduce new 'XenBus' and 'XenDevice' object hierarchy
Paul Durrant [Tue, 8 Jan 2019 14:48:47 +0000 (14:48 +0000)]
xen: introduce new 'XenBus' and 'XenDevice' object hierarchy

This patch adds the basic boilerplate for a 'XenBus' object that will act
as a parent to 'XenDevice' PV backends.
A new 'XenBridge' object is also added to connect XenBus to the system bus.

The XenBus object is instantiated by a new xen_bus_init() function called
from the same sites as the legacy xen_be_init() function.

Subsequent patches will flesh-out the functionality of these objects.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Reviewed-by: Anthony Perard <anthony.perard@citrix.com>
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
5 years agoxen: re-name XenDevice to XenLegacyDevice...
Paul Durrant [Tue, 8 Jan 2019 14:48:46 +0000 (14:48 +0000)]
xen: re-name XenDevice to XenLegacyDevice...

...and xen_backend.h to xen-legacy-backend.h

Rather than attempting to convert the existing backend infrastructure to
be QOM compliant (which would be hard to do in an incremental fashion),
subsequent patches will introduce a completely new framework for Xen PV
backends. Hence it is necessary to re-name parts of existing code to avoid
name clashes. The re-named 'legacy' infrastructure will be removed once all
backends have been ported to the new framework.

This patch is purely cosmetic. No functional change.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Acked-by: Anthony Perard <anthony.perard@citrix.com>
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
5 years agoxen/pt: allow passthrough of devices with bogus interrupt pin
Zhao Yan [Wed, 5 Dec 2018 07:58:30 +0000 (02:58 -0500)]
xen/pt: allow passthrough of devices with bogus interrupt pin

For some pci device, even its PCI_INTERRUPT_PIN is not 0, it actually
doesn't support INTx mode, so its machine irq read from host sysfs is 0.
In that case, report PCI_INTERRUPT_PIN as 0 to guest and let passthrough
continue.

Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
Signed-off-by: Zhao Yan <yan.y.zhao@intel.com>
Acked-by: Anthony PERARD <anthony.perard@citrix.com>
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
5 years agohw/xen/xen_pt_graphics: Don't trust the BIOS ROM contents so much
Peter Maydell [Mon, 19 Nov 2018 16:26:58 +0000 (16:26 +0000)]
hw/xen/xen_pt_graphics: Don't trust the BIOS ROM contents so much

Coverity (CID 796599) points out that xen_pt_setup_vga() trusts
the rom->size field in the BIOS ROM from a PCI passthrough VGA
device, and uses it as an index into the memory which contains
the BIOS image. A corrupt BIOS ROM could therefore cause us to
index off the end of the buffer.

Check that the size is within bounds before we use it.

We are also trusting the pcioffset field, and assuming that
the whole rom_header is present; Coverity doesn't notice these,
but check them too.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Acked-by: Anthony PERARD <anthony.perard@citrix.com>
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>