OSDN Git Service

qmiga/qemu.git
2 years agoMerge tag 'for-upstream' of https://gitlab.com/bonzini/qemu into staging
Richard Henderson [Fri, 19 Aug 2022 14:42:37 +0000 (07:42 -0700)]
Merge tag 'for-upstream' of https://gitlab.com/bonzini/qemu into staging

Fix SIGSEGV with query-stats-schema.

This allows management tools to query the statistics schemas without
worrying that some versions of QEMU will crash.

# -----BEGIN PGP SIGNATURE-----
#
# iQFIBAABCAAyFiEE8TM4V0tmI4mGbHaCv/vSX3jHroMFAmL/U90UHHBib256aW5p
# QHJlZGhhdC5jb20ACgkQv/vSX3jHroN93gf/Q9pye7bA436FsMujHgaspp7asI0z
# MHgs1anNSEoRrogIqw595Blyt7ILGvEe333rpDqg23W52/NVn+R0qdiTeg/lG/Zm
# zDLCT8T9CrJZEJvmRora6JPapjrsXRiXsDCkhi8ClqoEPm1X/rDCRMtxpOKJzk5E
# dZTLZcy6FVtcNroqx2BzAJiDcXlby6H92LTXmBRFK6jesst9nj4wvZLiDhsLBEte
# PdVXbxCV85OKRng55c9wyFuthkAi7UtRCYrgjPSDqCe/UnnscVPYEDQElMfmf8Ts
# DL7vQ0MZy8F9hVd851Mu57uKeYVenAETNEs/P9qfwo1ANPizqcB+ACYoBA==
# =LX7e
# -----END PGP SIGNATURE-----
# gpg: Signature made Fri 19 Aug 2022 02:11:57 AM PDT
# gpg:                using RSA key F13338574B662389866C7682BFFBD25F78C7AE83
# gpg:                issuer "pbonzini@redhat.com"
# gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" [undefined]
# gpg:                 aka "Paolo Bonzini <pbonzini@redhat.com>" [undefined]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4  E2F7 7E15 100C CD36 69B1
#      Subkey fingerprint: F133 3857 4B66 2389 866C  7682 BFFB D25F 78C7 AE83

* tag 'for-upstream' of https://gitlab.com/bonzini/qemu:
  kvm: fix segfault with query-stats-schemas and -M none

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agoRevert "linux-user: un-parent OBJECT(cpu) when closing thread"
Richard Henderson [Fri, 19 Aug 2022 01:03:52 +0000 (18:03 -0700)]
Revert "linux-user: un-parent OBJECT(cpu) when closing thread"

This reverts commit 52f0c1607671293afcdb2acc2f83e9bccbfa74bb.

This caused a regression in arm/aarch64.

We are hard-coding ARMCPRegInfo pointers into TranslationBlocks,
for calling into helper_{get,set}cp_reg{,64}.  So we have a race
condition between whichever cpu thread translates the code first
(encoding the pointer), and that cpu thread exiting, so that the
next execution of the TB references a freed data structure.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agoMerge tag 'fixes-pull-request' of gitlab.com:marcandre.lureau/qemu into staging
Richard Henderson [Thu, 18 Aug 2022 15:35:53 +0000 (08:35 -0700)]
Merge tag 'fixes-pull-request' of gitlab.com:marcandre.lureau/qemu into staging

Some fixes pending on the ML:
* console regression fix
* dbus-vmstate error handling fix
* a build-sys fix

# -----BEGIN PGP SIGNATURE-----
#
# iQJQBAABCAA6FiEEh6m9kz+HxgbSdvYt2ujhCXWWnOUFAmL94mAcHG1hcmNhbmRy
# ZS5sdXJlYXVAcmVkaGF0LmNvbQAKCRDa6OEJdZac5eSNEACwl191H8uB1kS5sI/6
# 4TyNPtQRBebbuT14l5fFlX6DzosWeIUke3BDPNbB3hgqO0J/LWjmf0w3a1FSAOsR
# UnoUYlvAaMFG6giWd5oG+dl05WridEi/S8BJFp89cDCuziBQ5EyesWmGL/RFxU9w
# jjV9i3qMXghGNDg3KAqBHQkSDNlEQ0cmjYB7J5SIHK2+YmKinSWz9tyYlh1tBPnK
# Qghw1UVelFO+tHSnWaPXZW9t0AzbbQGrGcKryotYyx5GAWbYh5dAygtzNpBfgqGm
# dNacFS76fdKwtarf5bqA0NiRTOwUpvlkpmQ7kju/YBT2Bzr5TCrfKCSESwdUYfI9
# GPAxczHsH7yxBi0wUyNL6PpbVQ+t/x7mY0qHaVBt/Ju55be6qSgO14RyGcPcXLd/
# TmYn8YX8xLjeDUDm821rBIKeaF6IfMpSd/JIL/6rjxFAQgdpPyCU8yXWUnVghAyI
# wmndIOZNIf5OJfwd+1XgsHRXsCI4TGUodY3iyKAWN0OwlWiLrd//UeizgA7xNxOO
# tihR2nBjuAQAR9KQakGYl6g6oSPAba86eUYxPNI7JX2NExZaUGt2o9hMAY2LhfuI
# gtxMQSeOqvpqkTWlysmb4t4kAYPL8EbrYxvzbxxd92kxYSGZvoC9oRkjbd+TIRSS
# N8TsvssjlW94BihpLRN4bHmHDQ==
# =SSEL
# -----END PGP SIGNATURE-----
# gpg: Signature made Wed 17 Aug 2022 11:55:28 PM PDT
# gpg:                using RSA key 87A9BD933F87C606D276F62DDAE8E10975969CE5
# gpg:                issuer "marcandre.lureau@redhat.com"
# gpg: Good signature from "Marc-André Lureau <marcandre.lureau@redhat.com>" [full]
# gpg:                 aka "Marc-André Lureau <marcandre.lureau@gmail.com>" [full]

* tag 'fixes-pull-request' of gitlab.com:marcandre.lureau/qemu:
  ui/console: fix qemu_console_resize() regression
  build-sys: disable vhost-user-gpu if !opengl
  dbus-vmstate: Restrict error checks to registered proxies in dbus_get_proxies

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agokvm: fix segfault with query-stats-schemas and -M none
Paolo Bonzini [Thu, 18 Aug 2022 12:08:24 +0000 (14:08 +0200)]
kvm: fix segfault with query-stats-schemas and -M none

-M none creates a guest without a vCPU, causing the following error:

$ ./qemu-system-x86_64 -qmp stdio -M none -accel kvm
{execute:qmp_capabilities}
{"return": {}}
{execute: query-stats-schemas}
Segmentation fault (core dumped)

Fix it by not querying the vCPU stats if first_cpu is NULL.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2 years agoMerge tag 'for_upstream' of git://git.kernel.org/pub/scm/virt/kvm/mst/qemu into staging
Richard Henderson [Thu, 18 Aug 2022 07:18:50 +0000 (00:18 -0700)]
Merge tag 'for_upstream' of git://git./virt/kvm/mst/qemu into staging

pc,virtio: fixes

Several bugfixes, they all look very safe to me. Revert
seed support since we aren't any closer to a proper fix.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
# -----BEGIN PGP SIGNATURE-----
#
# iQFDBAABCAAtFiEEXQn9CHHI+FuUyooNKB8NuNKNVGkFAmL9IIQPHG1zdEByZWRo
# YXQuY29tAAoJECgfDbjSjVRpKCkH/2KjgmgG2BpeSm5WHm2ySMZ8aNactDhjc/zg
# S2iFMPRx6at4fagErT0h4hdI2SunbWz+dH8v6wdPmiIX//HNRUiZPW6vItib3aaN
# b6IxG+yWasRxFhLMZ41634vCUmnISkCsbMwJYTUMZjUV3iuEVnK8rQpIuGIkmvYK
# nt3Y3TLospn19ZrTbV00flghHnmU4WIZkyJv7T64bvvlgxITIw/02XxAI5QvhWb9
# qANmT+T9IPsZXdXOGj9W2d23Ejl9fRfvJSgRJsmxcOH24ozDUNGfia/ZDuq7J9rB
# NZ+g29j27oU5hdazOZR5e9q5SaFfaNZ3uYsU/A+lZkt/9+7G1u0=
# =soZc
# -----END PGP SIGNATURE-----
# gpg: Signature made Wed 17 Aug 2022 10:08:20 AM PDT
# gpg:                using RSA key 5D09FD0871C8F85B94CA8A0D281F0DB8D28D5469
# gpg:                issuer "mst@redhat.com"
# gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>" [undefined]
# gpg:                 aka "Michael S. Tsirkin <mst@redhat.com>" [undefined]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 0270 606B 6F3C DF3D 0B17  0970 C350 3912 AFBE 8E67
#      Subkey fingerprint: 5D09 FD08 71C8 F85B 94CA  8A0D 281F 0DB8 D28D 5469

* tag 'for_upstream' of git://git.kernel.org/pub/scm/virt/kvm/mst/qemu:
  virtio-pci: don't touch pci on virtio reset
  tests: acpi: silence applesmc warning about invalid key
  hw/cxl: Correctly handle variable sized mailbox input payloads.
  hw/cxl: Fix Get LSA input payload size which should be 8 bytes.
  hw/cxl: Add stub write function for RO MemoryRegionOps entries.
  hw/cxl: Fix wrong query of target ports
  hw/cxl: Fix memory leak in error paths
  x86: disable rng seeding via setup_data
  hw/virtio: fix vhost_user_read tracepoint
  hw/virtio: handle un-configured shutdown in virtio-pci
  hw/virtio: gracefully handle unset vhost_dev vdev
  virtio-scsi: fix race in virtio_scsi_dataplane_start()

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agoui/console: fix qemu_console_resize() regression
Marc-André Lureau [Mon, 25 Jul 2022 11:58:15 +0000 (15:58 +0400)]
ui/console: fix qemu_console_resize() regression

The display may be corrupted when changing screen colour depth in
qemu-system-ppc/MacOS since 7.0.

Do not short-cut qemu_console_resize() if the surface is backed by vga
vram. When the scanout isn't set, or it is already allocated, or opengl,
and the size is fitting, we still avoid the reallocation & replace path.

Fixes: commit cb8962c1 ("ui: do not create a surface when resizing a GL scanout")

Reported-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Tested-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Message-Id: <20220725115815.2461322-1-marcandre.lureau@redhat.com>

2 years agobuild-sys: disable vhost-user-gpu if !opengl
Marc-André Lureau [Tue, 28 Jun 2022 13:23:15 +0000 (17:23 +0400)]
build-sys: disable vhost-user-gpu if !opengl

vhost-user-gpu uses epoxy/glflush and thus requires opengl.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20220628132315.664026-1-marcandre.lureau@redhat.com>

2 years agodbus-vmstate: Restrict error checks to registered proxies in dbus_get_proxies
Priyankar Jain [Fri, 26 Nov 2021 14:15:17 +0000 (14:15 +0000)]
dbus-vmstate: Restrict error checks to registered proxies in dbus_get_proxies

The purpose of dbus_get_proxies to construct the proxies corresponding to the
IDs registered to dbus-vmstate.

Currenty, this function returns an error in case there is any failure
while instantiating proxy for "all" the names on dbus.

Ideally this function should error out only if it is not able to find and
validate the proxies registered to the backend otherwise any offending
process(for eg: the process purposefully may not export its Id property on
the dbus) may connect to the dbus and can lead to migration failures.

This commit ensures that dbus_get_proxies returns an error if it is not
able to find and validate the proxies of interest(the IDs registered
during the dbus-vmstate instantiation).

Signed-off-by: Priyankar Jain <priyankar.jain@nutanix.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <1637936117-37977-1-git-send-email-priyankar.jain@nutanix.com>

2 years agovirtio-pci: don't touch pci on virtio reset
Michael S. Tsirkin [Wed, 27 Jul 2022 16:10:38 +0000 (12:10 -0400)]
virtio-pci: don't touch pci on virtio reset

virtio level reset should not affect pci express
registers such as PM, error or link.

Fixes: 27ce0f3afc ("hw/virtio: fix Power Management Control Register for PCI Express virtio devices")
Fixes: d584f1b9ca ("hw/virtio: fix Link Control Register for PCI Express virtio devices")
Fixes: c2cabb3422 ("hw/virtio: fix error enabling flags in Device Control register")
Cc: "Marcel Apfelbaum" <marcel@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2 years agotests: acpi: silence applesmc warning about invalid key
Igor Mammedov [Thu, 28 Jul 2022 13:37:13 +0000 (09:37 -0400)]
tests: acpi: silence applesmc warning about invalid key

OSK value is irrelevant for ACPI test case.
Supply fake OSK explicitly to prevent QEMU complaining about
invalid key when it fallbacks to default_osk.

Suggested-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20220728133713.1369596-1-imammedo@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2 years agohw/cxl: Correctly handle variable sized mailbox input payloads.
Jonathan Cameron [Wed, 17 Aug 2022 14:57:59 +0000 (15:57 +0100)]
hw/cxl: Correctly handle variable sized mailbox input payloads.

A placeholder of ~0 is used to indicate variable payload size.
Whilst the checks for output payload correctly took this into
account, those for input payload did not.

This results in failure of the Set LSA command.

Fixes: 464e14ac43 ("hw/cxl/device: Implement basic mailbox (8.2.8.4)")
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Message-Id: <20220817145759.32603-4-Jonathan.Cameron@huawei.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2 years agohw/cxl: Fix Get LSA input payload size which should be 8 bytes.
Jonathan Cameron [Wed, 17 Aug 2022 14:57:58 +0000 (15:57 +0100)]
hw/cxl: Fix Get LSA input payload size which should be 8 bytes.

Get LSA needs 4 byte offset and 4 byte length arguments.
CXL rev 2.0 Table 178.

Fixes: 3ebe676a34 ("hw/cxl/device: Implement get/set Label Storage Area (LSA)")
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Message-Id: <20220817145759.32603-3-Jonathan.Cameron@huawei.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2 years agohw/cxl: Add stub write function for RO MemoryRegionOps entries.
Jonathan Cameron [Wed, 17 Aug 2022 14:57:57 +0000 (15:57 +0100)]
hw/cxl: Add stub write function for RO MemoryRegionOps entries.

There is no checking on the availability of a write callback.
Hence QEMU crashes if a write does occur to one of these regions.

Discovered whilst chasing a Linux kernel bug that incorrectly
wrote into one of these regions.

Fixes: 6364adacdf ("hw/cxl/device: Implement the CAP array (8.2.8.1-2)")
Reported-by: Bobo WL <lmw.bobo@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Message-Id: <20220817145759.32603-2-Jonathan.Cameron@huawei.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2 years agohw/cxl: Fix wrong query of target ports
Jonathan Cameron [Mon, 8 Aug 2022 12:20:51 +0000 (13:20 +0100)]
hw/cxl: Fix wrong query of target ports

Two issues were present in this code:
1) Check on which register to look in was inverted.
2) Both branches use the _LO register.

Whilst here moved to extract32() rather than hand rolling
the field extraction as simpler and hopefully less error prone.

Fixes Coverity CID: 1488873

Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Message-Id: <20220808122051.14822-3-Jonathan.Cameron@huawei.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2 years agohw/cxl: Fix memory leak in error paths
Jonathan Cameron [Mon, 8 Aug 2022 12:20:50 +0000 (13:20 +0100)]
hw/cxl: Fix memory leak in error paths

Use g_autofree to free the CXLFixedWindow structure if an
error occurs in configuration before we have added to
the list (via g_steal_pointer())

Fix Coverity CID: 1488872

Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Message-Id: <20220808122051.14822-2-Jonathan.Cameron@huawei.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2 years agox86: disable rng seeding via setup_data
Gerd Hoffmann [Wed, 17 Aug 2022 08:39:40 +0000 (10:39 +0200)]
x86: disable rng seeding via setup_data

Causes regressions when doing direct kernel boots with OVMF.

At this point in the release cycle the only sensible action
is to just disable this for 7.1 and sort it properly in the
7.2 devel cycle.

Cc: Jason A. Donenfeld <Jason@zx2c4.com>
Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Richard Henderson <richard.henderson@linaro.org>
Cc: Eduardo Habkost <eduardo@habkost.net>
Cc: Peter Maydell <peter.maydell@linaro.org>
Cc: Philippe Mathieu-Daudé <f4bug@amsat.org>
Cc: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-Id: <20220817083940.3174933-1-kraxel@redhat.com>
Cc: Jason A. Donenfeld <Jason@zx2c4.com>
Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Richard Henderson <richard.henderson@linaro.org>
Cc: Eduardo Habkost <eduardo@habkost.net>
Cc: Peter Maydell <peter.maydell@linaro.org>
Cc: Philippe Mathieu-Daudé <f4bug@amsat.org>
Cc: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2 years agohw/virtio: fix vhost_user_read tracepoint
Alex Bennée [Thu, 28 Jul 2022 13:55:03 +0000 (14:55 +0100)]
hw/virtio: fix vhost_user_read tracepoint

As reads happen in the callback we were never seeing them. We only
really care about the header so move the tracepoint to when the header
is complete.

Fixes: 6ca6d8ee9d (hw/virtio: add vhost_user_[read|write] trace points)
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Acked-by: Jason Wang <jasowang@redhat.com>
Message-Id: <20220728135503.1060062-5-alex.bennee@linaro.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2 years agohw/virtio: handle un-configured shutdown in virtio-pci
Alex Bennée [Thu, 28 Jul 2022 13:55:02 +0000 (14:55 +0100)]
hw/virtio: handle un-configured shutdown in virtio-pci

The assert() protecting against leakage is a little aggressive and
causes needless crashes if a device is shutdown without having been
configured. In this case no descriptors are lost because none have
been assigned.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20220728135503.1060062-4-alex.bennee@linaro.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2 years agohw/virtio: gracefully handle unset vhost_dev vdev
Alex Bennée [Thu, 28 Jul 2022 13:55:01 +0000 (14:55 +0100)]
hw/virtio: gracefully handle unset vhost_dev vdev

I've noticed asserts firing because we query the status of vdev after
a vhost connection is closed down. Rather than faulting on the NULL
indirect just quietly reply false.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20220728135503.1060062-3-alex.bennee@linaro.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2 years agovirtio-scsi: fix race in virtio_scsi_dataplane_start()
Stefan Hajnoczi [Mon, 8 Aug 2022 16:21:34 +0000 (12:21 -0400)]
virtio-scsi: fix race in virtio_scsi_dataplane_start()

As soon as virtio_scsi_data_plane_start() attaches host notifiers the
IOThread may start virtqueue processing. There is a race between
IOThread virtqueue processing and virtio_scsi_data_plane_start() because
it only assigns s->dataplane_started after attaching host notifiers.

When a virtqueue handler function in the IOThread calls
virtio_scsi_defer_to_dataplane() it may see !s->dataplane_started and
attempt to start dataplane even though we're already in the IOThread:

  #0  0x00007f67b360857c __pthread_kill_implementation (libc.so.6 + 0xa257c)
  #1  0x00007f67b35bbd56 raise (libc.so.6 + 0x55d56)
  #2  0x00007f67b358e833 abort (libc.so.6 + 0x28833)
  #3  0x00007f67b358e75b __assert_fail_base.cold (libc.so.6 + 0x2875b)
  #4  0x00007f67b35b4cd6 __assert_fail (libc.so.6 + 0x4ecd6)
  #5  0x000055ca87fd411b memory_region_transaction_commit (qemu-kvm + 0x67511b)
  #6  0x000055ca87e17811 virtio_pci_ioeventfd_assign (qemu-kvm + 0x4b8811)
  #7  0x000055ca87e14836 virtio_bus_set_host_notifier (qemu-kvm + 0x4b5836)
  #8  0x000055ca87f8e14e virtio_scsi_set_host_notifier (qemu-kvm + 0x62f14e)
  #9  0x000055ca87f8dd62 virtio_scsi_dataplane_start (qemu-kvm + 0x62ed62)
  #10 0x000055ca87e14610 virtio_bus_start_ioeventfd (qemu-kvm + 0x4b5610)
  #11 0x000055ca87f8c29a virtio_scsi_handle_ctrl (qemu-kvm + 0x62d29a)
  #12 0x000055ca87fa5902 virtio_queue_host_notifier_read (qemu-kvm + 0x646902)
  #13 0x000055ca882c099e aio_dispatch_handler (qemu-kvm + 0x96199e)
  #14 0x000055ca882c1761 aio_poll (qemu-kvm + 0x962761)
  #15 0x000055ca880e1052 iothread_run (qemu-kvm + 0x782052)
  #16 0x000055ca882c562a qemu_thread_start (qemu-kvm + 0x96662a)

This patch assigns s->dataplane_started before attaching host notifiers
so that virtqueue handler functions that run in the IOThread before
virtio_scsi_data_plane_start() returns correctly identify that dataplane
does not need to be started. This fix is taken from the virtio-blk
dataplane code and it's worth adding a comment in virtio-blk as well to
explain why it works.

Note that s->dataplane_started does not need the AioContext lock because
it is set before attaching host notifiers and cleared after detaching
host notifiers. In other words, the IOThread always sees the value true
and the main loop thread does not modify it while the IOThread is
active.

Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=2099541
Reported-by: Qing Wang <qinwang@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20220808162134.240405-1-stefanha@redhat.com>
Reviewed-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2 years agoUpdate version for v7.1.0-rc3 release
Richard Henderson [Wed, 17 Aug 2022 01:45:19 +0000 (20:45 -0500)]
Update version for v7.1.0-rc3 release

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agoMerge tag 'pull-request-2022-08-16' of https://gitlab.com/thuth/qemu into staging
Richard Henderson [Tue, 16 Aug 2022 15:58:57 +0000 (10:58 -0500)]
Merge tag 'pull-request-2022-08-16' of https://gitlab.com/thuth/qemu into staging

* Fix a possible endless loop in USB XHCI code
* Minor fixes for the new readconfig test

# -----BEGIN PGP SIGNATURE-----
#
# iQJFBAABCAAvFiEEJ7iIR+7gJQEY8+q5LtnXdP5wLbUFAmL7aT8RHHRodXRoQHJl
# ZGhhdC5jb20ACgkQLtnXdP5wLbXm6w//TzGqEkzN6VeYqCgbI5ZuCcu3uL/X7KcO
# vsljTTYeJgE3IuT4RARk4d2/K8xD/mzyxMTHP5SrbCIYSOBY4OusJN55fytX46mb
# cdy3dHWbwaT7y8J+BLpwOg7om+oDp1Q2o1JxPY39BEi5T2C6PBHveDf9XxNv2n2j
# 9kwF0la7EmhmNoUgWyvf3dVoOFS3G4BTP1ZSvjcUNRuAxGLGZ8XOhZYw5zQ4MMTF
# OrNdVPmMDyLjAxpdO5dKItvTs8l0ioSXsbrNK+w2o58U1Wmczkn3BYcel2m+J14v
# XY9jtq9qUHjTmFRCCop0LYitkDvW+mAmptFsc94Y0ulc3JQ1KNvvjBIgNKZGRCkv
# Fw7xdArifc1TMpRdgNP1Gr88LXtSPEaPsHYMRy7AHcv2Abd9zrRm7JMa45mburzp
# jhUvFYCLN2iDgd78HClDAGuRLWAEaJDLkbvxHtJxGW8m9lHHwkrUeLm6uJMrSwu6
# 880O0/ayEz0jw5yDEDC/ooTbcWKgbpZ7KPREciSLTAPsC2orBrBIjlioY1YxfAMZ
# rrP7KvGggP7yWrOn4BKUWRo7NC2WPQ69nJQCTsXij4NlKsWAaJ3EgldKDcFgungk
# DsEm+FQhcDDfeOWN03dNxRxz8bFm1/HbSHgna5C5xnbQbQMiSPYVYWPjzK6E8kKO
# NgjewJS4E7E=
# =5xZ9
# -----END PGP SIGNATURE-----
# gpg: Signature made Tue 16 Aug 2022 04:54:07 AM CDT
# gpg:                using RSA key 27B88847EEE0250118F3EAB92ED9D774FE702DB5
# gpg:                issuer "thuth@redhat.com"
# gpg: Good signature from "Thomas Huth <th.huth@gmx.de>" [undefined]
# gpg:                 aka "Thomas Huth <thuth@redhat.com>" [undefined]
# gpg:                 aka "Thomas Huth <th.huth@posteo.de>" [unknown]
# gpg:                 aka "Thomas Huth <huth@tuxfamily.org>" [undefined]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 27B8 8847 EEE0 2501 18F3  EAB9 2ED9 D774 FE70 2DB5

* tag 'pull-request-2022-08-16' of https://gitlab.com/thuth/qemu:
  hw/usb/hcd-xhci: Fix unbounded loop in xhci_ring_chain_length() (CVE-2020-14394)
  tests/qtest: misc tweaks to readconfig

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agoMerge tag 'pull-for-7.1-fixes-160822-1' of https://github.com/stsquad/qemu into staging
Richard Henderson [Tue, 16 Aug 2022 14:01:50 +0000 (09:01 -0500)]
Merge tag 'pull-for-7.1-fixes-160822-1' of https://github.com/stsquad/qemu into staging

A few small fixes:

  - properly un-parent OBJECT(cpu) when closing -user thread
  - add missing timeout to aspeed tests
  - reduce raciness of login: prompt handling for aspeed tests

# -----BEGIN PGP SIGNATURE-----
#
# iQEzBAABCgAdFiEEZoWumedRZ7yvyN81+9DbCVqeKkQFAmL7XG0ACgkQ+9DbCVqe
# KkRDAAf9EfolGONaDKRaBkzdASuIadVGDr3EUDFe+Ho7cyJjnrOu8XjbOuB9Ayc4
# Vg4ccTSWYtCQdh4HhPOuCSmCoDmvCgnzze+eLS1E/PDNAMH0puPYikacpdp09Nng
# qtPqb9QfaJNy7imrtg43kXWDbUHU21YlgGIguBYCJV5EKBFlNH84iyf5wYjXjQkp
# OXpSGcSdNBJ569g1tksrBZrrSMEMMFHnpDmMxRbNnDlJ/yDKbLI8t0CXLR1hU6le
# IjKWV7ZChEYiTRn+tlVrRdiFJjqhKtOoc9VXlVG67MW9orEQwk0gYVrnhxmC+N0t
# hMcbncw8CgxS270cEqccxxYDF5Uxng==
# =9IHQ
# -----END PGP SIGNATURE-----
# gpg: Signature made Tue 16 Aug 2022 03:59:25 AM CDT
# gpg:                using RSA key 6685AE99E75167BCAFC8DF35FBD0DB095A9E2A44
# gpg: Good signature from "Alex Bennée (Master Work Key) <alex.bennee@linaro.org>" [undefined]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 6685 AE99 E751 67BC AFC8  DF35 FBD0 DB09 5A9E 2A44

* tag 'pull-for-7.1-fixes-160822-1' of https://github.com/stsquad/qemu:
  tests/avocado: apply a band aid to aspeed-evb login
  tests/avocado: add timeout to the aspeed tests
  linux-user: un-parent OBJECT(cpu) when closing thread

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agohw/usb/hcd-xhci: Fix unbounded loop in xhci_ring_chain_length() (CVE-2020-14394)
Thomas Huth [Thu, 4 Aug 2022 13:13:00 +0000 (15:13 +0200)]
hw/usb/hcd-xhci: Fix unbounded loop in xhci_ring_chain_length() (CVE-2020-14394)

The loop condition in xhci_ring_chain_length() is under control of
the guest, and additionally the code does not check for failed DMA
transfers (e.g. if reaching the end of the RAM), so the loop there
could run for a very long time or even forever. Fix it by checking
the return value of dma_memory_read() and by introducing a maximum
loop length.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/646
Message-Id: <20220804131300.96368-1-thuth@redhat.com>
Reviewed-by: Mauro Matteo Cascella <mcascell@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
2 years agotests/qtest: misc tweaks to readconfig
Daniel P. Berrangé [Tue, 9 Aug 2022 09:38:54 +0000 (05:38 -0400)]
tests/qtest: misc tweaks to readconfig

The property name parameter is ignored when visiting a top
level type, but the obvious typo should be fixed to avoid
confusion. A few indentation issues were tidied up. We
can break out of the loop when finding the RNG device.
Finally, close the temp FD immediately when no longer
needed.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20220809093854.168438-1-berrange@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Thomas Huth <thuth@redhat.com>
2 years agotests/avocado: apply a band aid to aspeed-evb login
Alex Bennée [Thu, 11 Aug 2022 15:14:12 +0000 (16:14 +0100)]
tests/avocado: apply a band aid to aspeed-evb login

This is really a limitation of the underlying console code which
doesn't allow us to detect the login: and following "#" prompts
because it reads input line wise. By adding a small delay we ensure
that the login prompt has appeared so we don't accidentally spaff the
shell commands to a confused getty in the guest.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Acked-by: John Snow <jsnow@redhat.com>
Message-Id: <20220811151413.3350684-8-alex.bennee@linaro.org>

2 years agotests/avocado: add timeout to the aspeed tests
Alex Bennée [Thu, 11 Aug 2022 15:14:11 +0000 (16:14 +0100)]
tests/avocado: add timeout to the aspeed tests

On some systems the test can hang. At least defining a timeout stops
it from hanging forever.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20220811151413.3350684-7-alex.bennee@linaro.org>

2 years agolinux-user: un-parent OBJECT(cpu) when closing thread
Alex Bennée [Thu, 11 Aug 2022 15:14:06 +0000 (16:14 +0100)]
linux-user: un-parent OBJECT(cpu) when closing thread

While forcing the CPU to unrealize by hand does trigger the clean-up
code we never fully free resources because refcount never reaches
zero. This is because QOM automatically added objects without an
explicit parent to /unattached/, incrementing the refcount.

Instead of manually triggering unrealization just unparent the object
and let the device machinery deal with that for us.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/866
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20220811151413.3350684-2-alex.bennee@linaro.org>

2 years agoMerge tag 'pull-la-20220814' of https://gitlab.com/rth7680/qemu into staging
Richard Henderson [Sun, 14 Aug 2022 13:48:10 +0000 (08:48 -0500)]
Merge tag 'pull-la-20220814' of https://gitlab.com/rth7680/qemu into staging

Loongarch docs update

# -----BEGIN PGP SIGNATURE-----
#
# iQFRBAABCgA7FiEEekgeeIaLTbaoWgXAZN846K9+IV8FAmL4/I8dHHJpY2hhcmQu
# aGVuZGVyc29uQGxpbmFyby5vcmcACgkQZN846K9+IV/kCQf9HTiK6VSrbJXdOLQi
# iGfXwZTcRDxG4brzj+GQ2/nuag2Dg9McADUxs1/3zlb965+CuQdfqtjSzgfxCjzX
# iVvHq3wtCoOQZ5/T+XrFCaew0djkT6N/hBsa33oORXg5o5mAzCIFObuTMnusvjTu
# VPXWe65fxTv3dsHZgjWekRZLu8Bn/anLypJxHzzFbXL3+RTKJ5u6GGVMn0DEcvEq
# ooHYhETBEXmdKCbj2QpRmG1sldiKSMEcBQ6OXPM6ehOgWoucR00/LyKi1ucQq5JP
# gJIEhV4iCKfPHykoTiBcMlz8zqphcn6GgU71Ekv1GGmYxBWBLAj3tfmX4yiFh33p
# x25afA==
# =gfY0
# -----END PGP SIGNATURE-----
# gpg: Signature made Sun 14 Aug 2022 08:45:51 AM CDT
# gpg:                using RSA key 7A481E78868B4DB6A85A05C064DF38E8AF7E215F
# gpg:                issuer "richard.henderson@linaro.org"
# gpg: Good signature from "Richard Henderson <richard.henderson@linaro.org>" [ultimate]

* tag 'pull-la-20220814' of https://gitlab.com/rth7680/qemu:
  docs/system/loongarch: Update the LoongArch document

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agodocs/system/loongarch: Update the LoongArch document
Xiaojuan Yang [Fri, 12 Aug 2022 09:19:57 +0000 (17:19 +0800)]
docs/system/loongarch: Update the LoongArch document

1. Add some information about how to boot the LoongArch virt
machine by uefi bios and linux kernel and how to access the
source code or binary file.
2. Move the explanation of LoongArch system emulation in the
target/loongarch/README to docs/system/loongarch/loongson3.rst

Signed-off-by: Xiaojuan Yang <yangxiaojuan@loongson.cn>
Reviewed-by: Song Gao <gaosong@loongson.cn>
Message-Id: <20220812091957.3338126-1-yangxiaojuan@loongson.cn>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agoMerge tag 'pull-target-arm-20220812' of https://git.linaro.org/people/pmaydell/qemu...
Richard Henderson [Fri, 12 Aug 2022 17:46:43 +0000 (10:46 -0700)]
Merge tag 'pull-target-arm-20220812' of https://git.linaro.org/people/pmaydell/qemu-arm into staging

target-arm queue:
 * Don't report Statistical Profiling Extension in ID registers
 * virt ACPI tables: Present the GICR structure properly for GICv4
 * Fix some typos in documentation
 * tests/unit: fix a -Wformat-truncation warning
 * cutils: Add missing dyld(3) include on macOS

# -----BEGIN PGP SIGNATURE-----
#
# iQJNBAABCAA3FiEE4aXFk81BneKOgxXPPCUl7RQ2DN4FAmL2PP4ZHHBldGVyLm1h
# eWRlbGxAbGluYXJvLm9yZwAKCRA8JSXtFDYM3qLKD/964d9vRe9b1Upv5mTxM7+y
# JxgwvsgVe7HeWBTOIIHsP7y1F+5MduiDDf2BC5XBiwtkVNSeJB1J1QQWkas6baVr
# DiRPiP/D6gG3B9naujCWsI5QbnSlONeunE0R+gYfNK6J/Odidzu6DtNa4PZJ1tcP
# vmZA5eLSAjaCIVmzQYF/Ae7nSoFz/sVR+li+tLSb/ynC+3H+rCry4TrQ7HgGyhjO
# nz4hIOtiYdAqp6hklMeLl6yAPMwZrxCtq51LE+Oj90uh7xt3gs0d29Zlbdc/vQFw
# dSZM/Cm0X+TMV6HHjpKrHnoUH+o+yv/O1q7VFccC4UpLSj7jbB8o/fbCASsBV+Jg
# /Y87G9WjtS6EO5SEqnDTSw5cAEKAqpgzQe8HhEGFa3MymuzkrnBagj59TNa5t4hV
# +maoR2vRb8hnhYDtFsWDPbfhFSCP3MSHki6sP7IMFNQsaUxFDNu2mRn0TOtSx0NB
# n5a/JOby7AeYI5JWyAwQ2T5Hxgh8EeBrPsXDxyy1jA+t67nrlrqdYwyLL5564jU4
# ESuMnuRTWjUnXaF9yhKbe6g1QdVV3OAC6jikzMuYLEHmKC/1MUJT1W4MECzjx1FM
# b0tQ2Q+0mfSfm5YrJqbAIdDg3Cie88pvl/i0POtFBiwoOhPRH6QBzd/b6q6B6zw6
# MPV6QAwBfdQYxJId93shTQ==
# =/sV7
# -----END PGP SIGNATURE-----
# gpg: Signature made Fri 12 Aug 2022 04:43:58 AM PDT
# gpg:                using RSA key E1A5C593CD419DE28E8315CF3C2525ED14360CDE
# gpg:                issuer "peter.maydell@linaro.org"
# gpg: Good signature from "Peter Maydell <peter.maydell@linaro.org>" [full]
# gpg:                 aka "Peter Maydell <pmaydell@gmail.com>" [full]
# gpg:                 aka "Peter Maydell <pmaydell@chiark.greenend.org.uk>" [full]

* tag 'pull-target-arm-20220812' of https://git.linaro.org/people/pmaydell/qemu-arm:
  cutils: Add missing dyld(3) include on macOS
  hw/arm/virt-acpi-build: Present the GICR structure properly for GICv4
  tests/unit: fix a -Wformat-truncation warning
  Fix some typos in documentation (most of them found by codespell)
  target/arm: Don't report Statistical Profiling Extension in ID registers

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agoMerge tag 'linux-user-for-7.1-pull-request' of https://gitlab.com/laurent_vivier...
Richard Henderson [Fri, 12 Aug 2022 15:13:23 +0000 (08:13 -0700)]
Merge tag 'linux-user-for-7.1-pull-request' of https://gitlab.com/laurent_vivier/qemu into staging

Pull request linux-user 20220812

# -----BEGIN PGP SIGNATURE-----
#
# iQJGBAABCAAwFiEEzS913cjjpNwuT1Fz8ww4vT8vvjwFAmL2LIUSHGxhdXJlbnRA
# dml2aWVyLmV1AAoJEPMMOL0/L748L8QP/iHtv9fsHZe7ANCMd2UjpPo5CZTJxMEa
# T8muaNasIJPoZbQR5WJRsCT8j5lNriWYA/xEBYGYlzvn/ZBK+NnUlBYrRFUX3LwQ
# Oim9gBYReW7nkv2m1Vr5mYXeC1bth4GMqycHSjwJtosYJsp/oTpcQE22/iG3MFBW
# azu+yM/QV7yuoi6EFyuUq5hefQE139W333x01c3qsekVY4cr4Bc81cpsQhWw/4Y4
# e32byrT39vtBvRlC/CuikZXyMqbD+nK+hESkJ9oqI73raC4PaCg10WNHMr1m/pw1
# ITPeH6iphVmyOckidHsbBLDkC4FQEVNo9R4j13Nk2gqU3VyLk73Say2GGvXrUEBJ
# a50XvV897N1M8ZiRUifYnNgawtO7sIOuQViofQtCcIfal9h2AV5Zjnm/5tJXGpnB
# F0U7hi5bootHtJFMLCBOWLhWVT7SNrzi1ijCFs2irj6grSyvJ9LU7yRHj0pOVC43
# WopdzPuxBWye8jRo2YgDQx5BZkBtlmWJgfbhYL3QVFX5wp8vqAgdXl0dXqdid5RN
# 5RCdBj9HAFwEUqL8n4LVI0EbrjI/IQlVwhZmBjQx3lBh4o08d7AUGUSQnZHDcy3C
# W6dTkfqPleqdOw5xS9Rw3rHJPHcuGWQNA4MMyvztbMivU/TYN7fwBdXouI9KeeBk
# wfYTi+n/bkeR
# =4v8b
# -----END PGP SIGNATURE-----
# gpg: Signature made Fri 12 Aug 2022 03:33:41 AM PDT
# gpg:                using RSA key CD2F75DDC8E3A4DC2E4F5173F30C38BD3F2FBE3C
# gpg:                issuer "laurent@vivier.eu"
# gpg: Good signature from "Laurent Vivier <lvivier@redhat.com>" [undefined]
# gpg:                 aka "Laurent Vivier <laurent@vivier.eu>" [undefined]
# gpg:                 aka "Laurent Vivier (Red Hat) <lvivier@redhat.com>" [undefined]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F  5173 F30C 38BD 3F2F BE3C

* tag 'linux-user-for-7.1-pull-request' of https://gitlab.com/laurent_vivier/qemu:
  linux-user/aarch64: Reset target data on MADV_DONTNEED

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agocutils: Add missing dyld(3) include on macOS
Philippe Mathieu-Daudé [Tue, 9 Aug 2022 22:20:46 +0000 (00:20 +0200)]
cutils: Add missing dyld(3) include on macOS

Commit 06680b15b4 moved qemu_*_exec_dir() to cutils but forgot
to move the macOS dyld(3) include, resulting in the following
error (when building with Homebrew GCC on macOS Monterey 12.4):

  [313/1197] Compiling C object libqemuutil.a.p/util_cutils.c.o
  FAILED: libqemuutil.a.p/util_cutils.c.o
  ../../util/cutils.c:1039:13: error: implicit declaration of function '_NSGetExecutablePath' [-Werror=implicit-function-declaration]
   1039 |         if (_NSGetExecutablePath(fpath, &len) == 0) {
        |             ^~~~~~~~~~~~~~~~~~~~
  ../../util/cutils.c:1039:13: error: nested extern declaration of '_NSGetExecutablePath' [-Werror=nested-externs]

Fix by moving the include line to cutils.

Fixes: 06680b15b4 ("include: move qemu_*_exec_dir() to cutils")
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-id: 20220809222046.30812-1-f4bug@amsat.org
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2 years agohw/arm/virt-acpi-build: Present the GICR structure properly for GICv4
Zenghui Yu [Fri, 12 Aug 2022 02:20:18 +0000 (10:20 +0800)]
hw/arm/virt-acpi-build: Present the GICR structure properly for GICv4

With the introduction of the new TCG GICv4, build_madt() is badly broken
as we do not present any GIC Redistributor structure in MADT for GICv4
guests, so that they have no idea about where the Redistributor
register frames are. This fixes a Linux guest crash at boot time with
ACPI enabled and '-machine gic-version=4'.

While at it, let's convert the remaining hard coded gic_version into
enumeration VIRT_GIC_VERSION_2 for consistency.

Signed-off-by: Zenghui Yu <yuzenghui@huawei.com>
Message-id: 20220812022018.1069-1-yuzenghui@huawei.com
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2 years agotests/unit: fix a -Wformat-truncation warning
Marc-André Lureau [Wed, 10 Aug 2022 12:15:13 +0000 (16:15 +0400)]
tests/unit: fix a -Wformat-truncation warning

../tests/test-qobject-input-visitor.c: In function ‘test_visitor_in_list’:
../tests/test-qobject-input-visitor.c:454:49: warning: ‘%d’ directive output may be truncated writing between 1 and 10 bytes into a region of size 6 [-Wformat-truncation=]
  454 |         snprintf(string, sizeof(string), "string%d", i);
      |                                                 ^~
../tests/test-qobject-input-visitor.c:454:42: note: directive argument in the range [0, 2147483606]
  454 |         snprintf(string, sizeof(string), "string%d", i);
      |                                          ^~~~~~~~~~
../tests/test-qobject-input-visitor.c:454:9: note: ‘snprintf’ output between 8 and 17 bytes into a destination of size 12
  454 |         snprintf(string, sizeof(string), "string%d", i);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Rather than trying to be clever, since this is called 3 times during
tests, let's simply use g_strdup_printf().

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-id: 20220810121513.1356081-1-marcandre.lureau@redhat.com
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
[PMM: fixed commit message typos]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2 years agoFix some typos in documentation (most of them found by codespell)
Stefan Weil [Fri, 12 Aug 2022 07:56:42 +0000 (09:56 +0200)]
Fix some typos in documentation (most of them found by codespell)

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Hongren (Zenithal) Zheng <i@zenithal.me>
Message-id: 20220812075642.1200578-1-sw@weilnetz.de
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2 years agotarget/arm: Don't report Statistical Profiling Extension in ID registers
Peter Maydell [Thu, 11 Aug 2022 13:11:27 +0000 (14:11 +0100)]
target/arm: Don't report Statistical Profiling Extension in ID registers

The newly added neoverse-n1 CPU has ID register values which indicate
the presence of the Statistical Profiling Extension, because the real
hardware has this feature.  QEMU's TCG emulation does not yet
implement SPE, though (not even as a minimal stub implementation), so
guests will crash if they try to use it because the SPE system
registers don't exist.

Force ID_AA64DFR0_EL1.PMSVer to 0 in CPU realize for TCG, so that
we don't advertise to the guest a feature that doesn't exist.

(We could alternatively do this by editing the value that
aarch64_neoverse_n1_initfn() sets for this ID register, but
suppressing the field in realize means we won't re-introduce this bug
when we add other CPUs that have SPE in hardware, such as the
Neoverse-V1.)

An example of a non-booting guest is current mainline Linux (5.19),
when booting in EL2 on the virt board (ie with -machine
virtualization=on).

Reported-by: Zenghui Yu <yuzenghui@huawei.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Zenghui Yu <yuzenghui@huawei.com>
Message-id: 20220811131127.947334-1-peter.maydell@linaro.org

2 years agolinux-user/aarch64: Reset target data on MADV_DONTNEED
Vitaly Buka [Mon, 11 Jul 2022 22:00:28 +0000 (15:00 -0700)]
linux-user/aarch64: Reset target data on MADV_DONTNEED

aarch64 stores MTE tags in target_date, and they should be reset by
MADV_DONTNEED.

Signed-off-by: Vitaly Buka <vitalybuka@google.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20220711220028.2467290-1-vitalybuka@google.com>
[lv: fix code style issues]
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2 years agoMerge tag 'linux-user-for-7.1-pull-request' of https://gitlab.com/laurent_vivier...
Richard Henderson [Wed, 10 Aug 2022 17:26:57 +0000 (10:26 -0700)]
Merge tag 'linux-user-for-7.1-pull-request' of https://gitlab.com/laurent_vivier/qemu into staging

Pull request linux-user 20220810

fix compat with glibc >= 2.36 sys/mount.h

# -----BEGIN PGP SIGNATURE-----
#
# iQJGBAABCAAwFiEEzS913cjjpNwuT1Fz8ww4vT8vvjwFAmLz4coSHGxhdXJlbnRA
# dml2aWVyLmV1AAoJEPMMOL0/L7487vMP/RjW8WI+0SliCfLPUcRvymeu9Feyzlit
# fj/s1sONL3TDZYWV2AhIM5mKYPPWDh7z8aNnIgOc5pnIMOw9MDX33ynTWvh0ZhPb
# EMSRqPDUFDaC4JMnlw3rSZpUj5PdZjDrlK4RGLqS+vPjd+xo5fETcYTA+zEovLJ3
# RfNk0QVvfYX5V0aLDlNBQQSxWb+Sq4Nlp00oUAwGsIZ3+GHBr83+4NQ0/oUIDq3F
# 6SpZ4tsZpPvIDNZihP7yNQVWFiIiCIEY6naYDSKxDgKb1HP/6pYxFFn2pmXSrD21
# ew9FxHzGNrqwlTxRbgjxNHvG33Y03NygNrXxI5sp00r6KnXXd05pIAtOLhJUjREY
# ErdJgNFDBeCujBmmNE5zD/dnaUoPdsSjGljPXiyjsMPSAHe2uEkmT6P0ZMGXTeTT
# eHbfTKQXs7cFhMtYPGDrKwREYKnEZz+zqfgx0+BWfShVSZr+tMpeXZ4TCgYNO2Ur
# s2budJJy3fkbz809l4weIHhF7iuPAzEbCV4TY+t/wm0W/nJnQ4WSy5bXGfqH+Pk5
# e20nUhiiuvXGo5CwefSKWQ2Fz9RHOZ1LszI8rZkVbYdfAxcWs3oG/1jDNgTcZLXu
# RJq0uMj+JPW3DPk61qRW5jp0UFwOCaanOf1jVNvlSXF/tu0ufeII6gyUElwpEUOt
# DDXrqodv7ZkX
# =G/l+
# -----END PGP SIGNATURE-----
# gpg: Signature made Wed 10 Aug 2022 09:50:18 AM PDT
# gpg:                using RSA key CD2F75DDC8E3A4DC2E4F5173F30C38BD3F2FBE3C
# gpg:                issuer "laurent@vivier.eu"
# gpg: Good signature from "Laurent Vivier <lvivier@redhat.com>" [undefined]
# gpg:                 aka "Laurent Vivier <laurent@vivier.eu>" [undefined]
# gpg:                 aka "Laurent Vivier (Red Hat) <lvivier@redhat.com>" [undefined]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F  5173 F30C 38BD 3F2F BE3C

* tag 'linux-user-for-7.1-pull-request' of https://gitlab.com/laurent_vivier/qemu:
  linux-user: fix compat with glibc >= 2.36 sys/mount.h

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agolinux-user: fix compat with glibc >= 2.36 sys/mount.h
Daniel P. Berrangé [Tue, 2 Aug 2022 16:41:34 +0000 (12:41 -0400)]
linux-user: fix compat with glibc >= 2.36 sys/mount.h

The latest glibc 2.36 has extended sys/mount.h so that it
defines the FSCONFIG_* enum constants. These are historically
defined in linux/mount.h, and thus if you include both headers
the compiler complains:

In file included from /usr/include/linux/fs.h:19,
                 from ../linux-user/syscall.c:98:
/usr/include/linux/mount.h:95:6: error: redeclaration of 'enum fsconfig_command'
   95 | enum fsconfig_command {
      |      ^~~~~~~~~~~~~~~~
In file included from ../linux-user/syscall.c:31:
/usr/include/sys/mount.h:189:6: note: originally defined here
  189 | enum fsconfig_command
      |      ^~~~~~~~~~~~~~~~
/usr/include/linux/mount.h:96:9: error: redeclaration of enumerator 'FSCONFIG_SET_FLAG'
   96 |         FSCONFIG_SET_FLAG       = 0,    /* Set parameter, supplying no value */
      |         ^~~~~~~~~~~~~~~~~
/usr/include/sys/mount.h:191:3: note: previous definition of 'FSCONFIG_SET_FLAG' with type 'enum fsconfig_command'
  191 |   FSCONFIG_SET_FLAG       = 0,    /* Set parameter, supplying no value */
      |   ^~~~~~~~~~~~~~~~~
...snip...

QEMU doesn't include linux/mount.h, but it does use
linux/fs.h and thus gets linux/mount.h indirectly.

glibc acknowledges this problem but does not appear to
be intending to fix it in the forseeable future, simply
documenting it as a known incompatibility with no
workaround:

  https://sourceware.org/glibc/wiki/Release/2.36#Usage_of_.3Clinux.2Fmount.h.3E_and_.3Csys.2Fmount.h.3E
  https://sourceware.org/glibc/wiki/Synchronizing_Headers

To address this requires either removing use of sys/mount.h
or linux/fs.h, despite QEMU needing declarations from
both.

This patch removes linux/fs.h, meaning we have to define
various FS_IOC constants that are now unavailable.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Tested-by: Richard W.M. Jones <rjones@redhat.com>
Message-Id: <20220802164134.1851910-1-berrange@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2 years agoUpdate version for v7.1.0-rc2 release
Richard Henderson [Wed, 10 Aug 2022 02:25:15 +0000 (19:25 -0700)]
Update version for v7.1.0-rc2 release

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agoMerge tag 'trivial-branch-for-7.1-pull-request' of https://gitlab.com/laurent_vivier...
Richard Henderson [Tue, 9 Aug 2022 19:17:21 +0000 (12:17 -0700)]
Merge tag 'trivial-branch-for-7.1-pull-request' of https://gitlab.com/laurent_vivier/qemu into staging

Pull request trivial branch 20220809

# -----BEGIN PGP SIGNATURE-----
#
# iQJGBAABCAAwFiEEzS913cjjpNwuT1Fz8ww4vT8vvjwFAmLykYgSHGxhdXJlbnRA
# dml2aWVyLmV1AAoJEPMMOL0/L74881MP/1UL3bfp1/tzxeN5wvT0mAdrKcj8obPE
# 5BB0QPD48NL8JqWq9HLLhX2vmAi2ibhPptpJkn+kXsqj8OW4Qp1JyWggZgD7O3mz
# S2OjVcpWrClhugoGhRUBm6G6kPsYjIBU0dLAINsyL6ETBZpIdkU/axLUJ6b2Wrm0
# eIQm6xNkGRhFAuya7MOX5ObzNylix2t1+QLxJMbA3XOCwl9PQRh7Wb/0oRhFMWZ9
# xCjraG9Jv1IxG28gGxMbUa2Ic7VTcVs+X+iu98AP7P3HBe/I31aXAmAf47MbMirk
# NJEYI9nDLZJyQmLgmBmyrQ+FIidDVhG7FURzIYeOoREv+xotQt6CTBNLKOcc4ccO
# YRy05JeUNeCJ015r8MZdiTwAwsbY0XPMijgqngqaWCw1BJO/luCdvUX6D4ehC5aZ
# zJPr7jJdqyhIZJjvPawoJSRsvWU495BCtyORtnU1T3uunEEu9vHLQKEy8gWtyitJ
# 7R6E/Mj4IzB9T0Kvz2acGBtxmtTshonjXaYgb11QRI5SWEUUhDNN64839opDPAW8
# PSmRZwfwkhIUlb9eRIEPMFScEEbQVgU+dAngSZva9un9ED2adPMreWHQrinMxQM4
# jtGAfG3RMQUh7b3VBlS87y0N+b2FSIrL9x0ujcozwuh0JMeiWxx+9AUq4dH8m2HU
# YZb3LXjm8i/P
# =o5gT
# -----END PGP SIGNATURE-----
# gpg: Signature made Tue 09 Aug 2022 09:55:36 AM PDT
# gpg:                using RSA key CD2F75DDC8E3A4DC2E4F5173F30C38BD3F2FBE3C
# gpg:                issuer "laurent@vivier.eu"
# gpg: Good signature from "Laurent Vivier <lvivier@redhat.com>" [undefined]
# gpg:                 aka "Laurent Vivier <laurent@vivier.eu>" [undefined]
# gpg:                 aka "Laurent Vivier (Red Hat) <lvivier@redhat.com>" [undefined]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F  5173 F30C 38BD 3F2F BE3C

* tag 'trivial-branch-for-7.1-pull-request' of https://gitlab.com/laurent_vivier/qemu:
  xlnx_dp: drop unsupported AUXCommand in xlnx_dp_aux_set_command
  contrib/vhost-user-blk: Clean up deallocation of VuVirtqElement

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agoMerge tag 'pull-target-arm-20220809' of https://git.linaro.org/people/pmaydell/qemu...
Richard Henderson [Tue, 9 Aug 2022 16:43:42 +0000 (09:43 -0700)]
Merge tag 'pull-target-arm-20220809' of https://git.linaro.org/people/pmaydell/qemu-arm into staging

target-arm queue:
 * icount: Take iothread lock when running QEMU timers

# -----BEGIN PGP SIGNATURE-----
#
# iQJNBAABCAA3FiEE4aXFk81BneKOgxXPPCUl7RQ2DN4FAmLyTy0ZHHBldGVyLm1h
# eWRlbGxAbGluYXJvLm9yZwAKCRA8JSXtFDYM3o2MEACpdpgpJd+OObHRSLZqQJbL
# 83X/aSSnBIFTeV1IlGC6sHbARffcKsEDQ/ktpmwvrABAJwEzTfaddSQADwlUefLJ
# 1L6Co1MpcOXnYZUIeaWAmN0POKKExB3gjrF19d9Dz9zHvm8Vu0CH/c/3iHsCVfd0
# +v00Pudd11ePWFn+BL6xjDN31OfZexqHVDbhKxoTAjj5BK0AJJAObBQUrp28UrbE
# 1qfg+BZMo/fPPLxRelmGIQLLr8UPEIyNoWZKRcuarJHbqhxqcPe1qIezMHPhMpzn
# vSzjiaYJVOxqj1gzj0Z+J7MSd0jNXVDQn0p7A0nEg7vT4mMt8+hhAuYqW0qAFCmQ
# 1rxiiGGKp5fmK7K+WfraaXqqXqi2P1078moVyg1rGdL5wYfZHyQoldDDNQwHoJkz
# DG6da5hiZjQn1nmL3OyyS0peyLzIE7DmFLP6xw+Op5Hrx/alVBrhpN1qPMzd7wG0
# TmrG//BtIIF5EiZw8oZqrvjcL//lzPvtM1EYmw/jTraV+KSO5anl2vjEi+VN5ngr
# zXPfvgupVoSqr/nCtitp+H71yogOWYp/FkE2xBgIS8qW4bQycPpX+qoi/0I1upTw
# 5FZYTTh6t5IBF8emc/1jQDUi8VlcT7Nz7Kma8fCdHI11xm8m5JI0+hfVkHEs2HQV
# lB+1HhMoJJ3pCzqJiWeINA==
# =xyyN
# -----END PGP SIGNATURE-----
# gpg: Signature made Tue 09 Aug 2022 05:12:29 AM PDT
# gpg:                using RSA key E1A5C593CD419DE28E8315CF3C2525ED14360CDE
# gpg:                issuer "peter.maydell@linaro.org"
# gpg: Good signature from "Peter Maydell <peter.maydell@linaro.org>" [full]
# gpg:                 aka "Peter Maydell <pmaydell@gmail.com>" [full]
# gpg:                 aka "Peter Maydell <pmaydell@chiark.greenend.org.uk>" [full]

* tag 'pull-target-arm-20220809' of https://git.linaro.org/people/pmaydell/qemu-arm:
  icount: Take iothread lock when running QEMU timers

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agoMerge tag 'net-pull-request' of https://github.com/jasowang/qemu into staging
Richard Henderson [Tue, 9 Aug 2022 14:44:29 +0000 (07:44 -0700)]
Merge tag 'net-pull-request' of https://github.com/jasowang/qemu into staging

# -----BEGIN PGP SIGNATURE-----
# Version: GnuPG v1
#
# iQEcBAABAgAGBQJi8iLAAAoJEO8Ells5jWIRrdMIAI1T5lgOhv2DfHXA6bElokIx
# 10NQ0dG5IBhO6l56p6Um95+tMDMfYBDjc8YOI1qv3L1PZOXdeHjs2ldUg8f0cmFP
# asvY1EJJW4SlCI0hk/Jb6oXf8BoVnNEnMmNGg8qRmVyEw2sFYkNhhA9dXH+537GN
# K0ZFOmfsYpn3EzKyqooln8XLT9lPsXX9LC1Oh0Jz1YmRn6y8/rngR1DWAEyr6MnL
# 5iGIyv5VEdeU1sQJRrH9DyCCGLlILCCUa2yo1RkV+Ac/qPdKWfkyE6K6kUelzGbp
# qqP9+rDpF3LwokqAI+8tJCwc6WqLL3Y/Ddb1J6gzydh8WcszjlXPjcBn8FeKXzk=
# =hAhp
# -----END PGP SIGNATURE-----
# gpg: Signature made Tue 09 Aug 2022 02:02:56 AM PDT
# gpg:                using RSA key EF04965B398D6211
# gpg: Good signature from "Jason Wang (Jason Wang on RedHat) <jasowang@redhat.com>" [undefined]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 215D 46F4 8246 689E C77F  3562 EF04 965B 398D 6211

* tag 'net-pull-request' of https://github.com/jasowang/qemu:
  hw/net/rocker: Avoid undefined shifts with more than 31 ports

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agoicount: Take iothread lock when running QEMU timers
Peter Maydell [Tue, 9 Aug 2022 09:55:14 +0000 (10:55 +0100)]
icount: Take iothread lock when running QEMU timers

The function icount_prepare_for_run() is called with the iothread
unlocked, but it can call icount_notify_aio_contexts() which will
run qemu timer handlers. Those are supposed to be run only with
the iothread lock held, so take the lock while we do that.

Since icount mode runs everything on a single thread anyway,
not holding the lock is likely mostly not going to introduce
races, but it can cause us to trip over assertions that we
do hold the lock, such as the one reported in issue 1130.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1130
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Tested-by: Pavel Dovgalyuk <Pavel.Dovgalyuk@ispras.ru>
Message-id: 20220801164527.3134765-1-peter.maydell@linaro.org

2 years agohw/net/rocker: Avoid undefined shifts with more than 31 ports
Peter Maydell [Fri, 29 Jul 2022 15:59:32 +0000 (16:59 +0100)]
hw/net/rocker: Avoid undefined shifts with more than 31 ports

In rocker_port_phys_link_status() and rocker_port_phys_enable_read()
we construct a 64-bit value with one bit per front-panel port.
However we accidentally do the shift as 32-bit arithmetic, which
means that if there are more than 31 front-panel ports this is
undefined behaviour.

Fix the problem by ensuring we use 64-bit arithmetic for the whole
calculation. (We won't ever shift off the 64-bit value because
ROCKER_FP_PORTS_MAX is 62.)

Resolves: Coverity CID 14871211487160
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Jason Wang <jasowang@redhat.com>
2 years agoMerge tag 'pull-la-20220808' of https://gitlab.com/rth7680/qemu into staging
Richard Henderson [Tue, 9 Aug 2022 02:51:12 +0000 (19:51 -0700)]
Merge tag 'pull-la-20220808' of https://gitlab.com/rth7680/qemu into staging

loongarch: fix emulation of fcsr register

# -----BEGIN PGP SIGNATURE-----
#
# iQFRBAABCgA7FiEEekgeeIaLTbaoWgXAZN846K9+IV8FAmLxy0UdHHJpY2hhcmQu
# aGVuZGVyc29uQGxpbmFyby5vcmcACgkQZN846K9+IV91ZggAjgUGqrFRZFR72C5m
# cNkgB6f5rzc6hgnqwstsQpvKOXKu8WH9+6xJHoQKau1NY2KNdLnt1itpThL3K2+c
# nh0E/w/DrTiaq4NsbWu3SrkTSGW+zcdhljQff6gyyLZyLQAY34Ej2hBhKfva3sRZ
# Y/Lm8euq6d559LWvN/Nyo11RBPdSq+KPtfGcGdOynY+OBFsDmXDTjdjGDFHQESh2
# +WnXcjlXq46vLOuZ6LLiNIHRbvFdfjcr5pqKKlESedA+wikgxP+ZeoIx+7HxlZe3
# CpYTzbmhoz5n3seRRAl5CouxGsEfL7plUn3BS+InabthE+qE6xvgvS9vcd1YMkg1
# eoKefQ==
# =Sk/5
# -----END PGP SIGNATURE-----
# gpg: Signature made Mon 08 Aug 2022 07:49:41 PM PDT
# gpg:                using RSA key 7A481E78868B4DB6A85A05C064DF38E8AF7E215F
# gpg:                issuer "richard.henderson@linaro.org"
# gpg: Good signature from "Richard Henderson <richard.henderson@linaro.org>" [ultimate]

* tag 'pull-la-20220808' of https://gitlab.com/rth7680/qemu:
  target/loongarch: Remove cpu_fcsr0

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agotarget/loongarch: Remove cpu_fcsr0
Richard Henderson [Sat, 6 Aug 2022 17:04:44 +0000 (10:04 -0700)]
target/loongarch: Remove cpu_fcsr0

All of the fpu operations are defined with TCG_CALL_NO_WG, but they
all modify FCSR0.  The most efficient way to fix this is to remove
cpu_fcsr0, and instead use explicit load and store operations for the
two instructions that manipulate that value.

Acked-by: Qi Hu <huqi@loongson.cn>
Reviewed-by: Song Gao <gaosong@loongson.cn>
Reported-by: Feiyang Chen <chenfeiyang@loongson.cn>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agoMerge tag 'mips-20220809' of https://github.com/philmd/qemu into staging
Richard Henderson [Tue, 9 Aug 2022 00:59:27 +0000 (17:59 -0700)]
Merge tag 'mips-20220809' of https://github.com/philmd/qemu into staging

MIPS/SPARC patches queue

- target/mips: Handle lock_user failure in UHI_plog semihosting (Peter Maydell)
- hw/mips/malta: Turn off x86 specific features of PIIX4 PM (Igor Mammedov)
- hw/misc/grlib_ahb_apb_pnp: Support 8 and 16 bit accesses (Peter Maydell)

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCAAdFiEE+qvnXhKRciHc/Wuy4+MsLN6twN4FAmLxjkMACgkQ4+MsLN6t
# wN4DhQ/+L/lcVmz/hoIDsjyqMBpBYMYEftlytyuXUDqp9+1CGQpXXzf6cmXwiMK5
# DDP/q0PR508tevljDuc7A01ThkN5Vx8FcEpCaD54AjZ5n0BxSLl0Yw9Leftq8doD
# Nk0YonVEY1tNXYV/KGWsiA7Xhkm3pL66Jzc0fyotNhzsI/dGxTVO9vLTgLl4/Hxv
# iMj0AxPIOrKEsom61k6QKLgE5ZC3yIPZb+6upSwrQfx6oMtIac5NofEjNCuR0Uy5
# PgM6ZJKAM376JlP4hdJ91K04Wg8ql+ze/x2jpjbR0S3QRz4TbH57hJ00nNRLxDep
# 5hHE7FIg6xf7sJv8ukwLK31zOiT46Azkr1wG97mZ7NyxxT7VTXtKgje6IENLGCgy
# sCMWIEnrOh03seMShaCRqPcguYUR+XaMc+Hpv9XCu3ZvniI2CUpmVlm8M0t3hqVK
# XCMwSsXJZ2w4522lUAJio2a10dsHJDg8U81n1KozTRUEZ8QBVlkqNLAIsROKl1Fr
# LMsv9408nQLkAhYCBeZArw8ayITLTPqlE/S7fiLwwa6e8lPpkMyz/RlN16QsCSHr
# zQO0iwY4kldn7QekKPTMQE73sW5ziBIOe7P6F5jtexbeaY0vJ5ph8Kfrq6hUVuqN
# ieQVSi4psz43fpIjNodTk0nnsqAJXZ/7vy0sS38DvwQjBZojWIk=
# =RIZd
# -----END PGP SIGNATURE-----
# gpg: Signature made Mon 08 Aug 2022 03:29:23 PM PDT
# gpg:                using RSA key FAABE75E12917221DCFD6BB2E3E32C2CDEADC0DE
# gpg: Good signature from "Philippe Mathieu-Daudé (F4BUG) <f4bug@amsat.org>" [full]

* tag 'mips-20220809' of https://github.com/philmd/qemu:
  hw/misc/grlib_ahb_apb_pnp: Support 8 and 16 bit accesses
  hw/mips/malta: turn off x86 specific features of PIIX4_PM
  target/mips: Handle lock_user() failure in UHI_plog semihosting call

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agohw/misc/grlib_ahb_apb_pnp: Support 8 and 16 bit accesses
Peter Maydell [Tue, 2 Aug 2022 13:19:25 +0000 (14:19 +0100)]
hw/misc/grlib_ahb_apb_pnp: Support 8 and 16 bit accesses

In real hardware, the APB and AHB PNP data tables can be accessed
with byte and halfword reads as well as word reads.  Our
implementation currently only handles word reads.  Add support for
the 8 and 16 bit accesses.  Note that we only need to handle aligned
accesses -- unaligned accesses should continue to trap, as happens on
hardware.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1132
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Frederic Konrad <fkonrad@amd.com>
Message-Id: <20220802131925.3380923-1-peter.maydell@linaro.org>
Tested-by: Tomasz Martyniak <gitlab.com/tom4r>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
2 years agohw/mips/malta: turn off x86 specific features of PIIX4_PM
Igor Mammedov [Thu, 28 Jul 2022 11:50:34 +0000 (07:50 -0400)]
hw/mips/malta: turn off x86 specific features of PIIX4_PM

QEMU crashes trying to save VMSTATE when only MIPS target are compiled in
  $ qemu-system-mips -monitor stdio
  (qemu) migrate "exec:gzip -c > STATEFILE.gz"
  Segmentation fault (core dumped)

It happens due to PIIX4_PM trying to parse hotplug vmstate structures
which are valid only for x86 and not for MIPS (as it requires ACPI
tables support which is not existent for ithe later)

Issue was probably exposed by trying to cleanup/compile out unused
ACPI bits from MIPS target (but forgetting about migration bits).

Disable compiled out features using compat properties as the least
risky way to deal with issue.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/995
Reviewed-by: Ani Sinha <ani@anisinha.ca>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Message-Id: <20220728115034.1327988-1-imammedo@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
2 years agotarget/mips: Handle lock_user() failure in UHI_plog semihosting call
Peter Maydell [Tue, 19 Jul 2022 19:17:37 +0000 (20:17 +0100)]
target/mips: Handle lock_user() failure in UHI_plog semihosting call

Coverity notes that we forgot to check the error return from
lock_user() in one place in the handling of the UHI_plog semihosting
call.  Add the missing error handling.

report_fault() is rather brutal in that it will call abort(), but
this is the same error-handling used in the rest of this file.

Resolves: Coverity CID 1490684
Fixes: ea4210600db3c5 ("target/mips: Avoid qemu_semihosting_log_out for UHI_plog")
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20220719191737.384744-1-peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
2 years agoMerge tag 'for-upstream' of https://gitlab.com/bonzini/qemu into staging
Richard Henderson [Mon, 8 Aug 2022 16:57:37 +0000 (09:57 -0700)]
Merge tag 'for-upstream' of https://gitlab.com/bonzini/qemu into staging

* Fix and tests for -readconfig
* Fixes for changeable block size

# -----BEGIN PGP SIGNATURE-----
#
# iQFIBAABCAAyFiEE8TM4V0tmI4mGbHaCv/vSX3jHroMFAmLxB6wUHHBib256aW5p
# QHJlZGhhdC5jb20ACgkQv/vSX3jHroMbgQgAmj38xh/KurUvjAwlki9OF+jIXem/
# r7eHtc6wG/dGN7CyL+EK08c2GfPIphhii3JGfLT3P/xHvHRVgYow2AELNvYSG85M
# SBQGfDsHLoKvY6Wni3AolECvtGycXkd30RtrzqdTT8iZyIhTTsikEG2hSgE+Z6Yy
# 9XGPHN9puTkkD5HYnDV1+T4+yc28F8UTVob3fv9b7LMH7mSYz7UN5Tw4zB7DjOL1
# JNTuYqW9JN1X1vIYKxYw9Y5Jb3qNjnl8y6if8bPuvrLRw94sd0ax23yEQHwtgcUj
# cYGcvZ2/X0SQg4AHTsqGJCuffKNDfHhmmA7w0Xb2DEvBvoveYOaDp3dKZQ==
# =L9FI
# -----END PGP SIGNATURE-----
# gpg: Signature made Mon 08 Aug 2022 05:55:08 AM PDT
# gpg:                using RSA key F13338574B662389866C7682BFFBD25F78C7AE83
# gpg:                issuer "pbonzini@redhat.com"
# gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" [undefined]
# gpg:                 aka "Paolo Bonzini <pbonzini@redhat.com>" [undefined]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4  E2F7 7E15 100C CD36 69B1
#      Subkey fingerprint: F133 3857 4B66 2389 866C  7682 BFFB D25F 78C7 AE83

* tag 'for-upstream' of https://gitlab.com/bonzini/qemu:
  tests/qtest: add scenario for -readconfig handling
  vl: remove dead code in parse_memory_options()
  vl: fix [memory] section with -readconfig
  scsi-disk: ensure block size is non-zero and changes limited to bits 8-15
  scsi-disk: fix overflow when block size is not a multiple of BDRV_SECTOR_SIZE

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agoMerge tag 'pull-request-2022-08-08' of https://gitlab.com/thuth/qemu into staging
Richard Henderson [Mon, 8 Aug 2022 15:20:29 +0000 (08:20 -0700)]
Merge tag 'pull-request-2022-08-08' of https://gitlab.com/thuth/qemu into staging

* Fix booting in the s390-ccw bios when physical and logical block sizes differ
* Fix the replay-linux avocado test
* Relax a time constraint in iotest 264

# -----BEGIN PGP SIGNATURE-----
#
# iQJFBAABCAAvFiEEJ7iIR+7gJQEY8+q5LtnXdP5wLbUFAmLwmJsRHHRodXRoQHJl
# ZGhhdC5jb20ACgkQLtnXdP5wLbUuaw//XGlKYzjKHEsmSGGuwSEF/iW7BvHf8lAn
# X2loC7Fd1WzEoq1EX/s5jd/4+ZUVxDP4F2wO9Hzhi7GpEfd/Cr5cu3TPwWCGjQT8
# g6UFVPPzHeVU68GxQX6ufBAPk7Lc9S57GHZ9n4tzcN7Jvp63zAXEFXe4lVLnAmzJ
# ykDz1Ir1bCDEl1AIbVp1umpIAh4MkbY1XfZeXWRkbGtQolH1y/F6sZWw3i72G30b
# JOM1pmu89KjnxWPoz1J142jOx53/XpSSlrqpFeqieykbU59rilBTIwi+k7K0KMOd
# 0DbrPDuU0EQ7JRkWzAlTT/IfNPbQB5gOjw6zFr+0L5S+3LcPM/p8XszNk4j3XQWt
# Bps3HDU13LDQpydRyZajY4iCQl6tzBDVXCoY+LUgrYjkP6OM5UpbakZgXJWNw9Nu
# Juu3kQ7imtLtMlKZQGSvhsy6gyUXjVlZxTZFspTQsMoOp/BDZdIwG+mKxk786hgr
# 32RxingXv6SWFYS+zrKsRJePtleLJr/RcySZFHNboJt9RIGf6W/IdROEjgZeYLce
# QDnlfi6AbwnP37nWmah5Iu2PeoZwDgr3jL81otdWlU8bc7G+gjwrnN/E77y3jJvH
# Auhj9YBNttQH6O8L4juMaD9+8/KtO47FfVfXojmPoicEB9NeWLChlUovVz47LC/U
# olsgxmuoDac=
# =JZmF
# -----END PGP SIGNATURE-----
# gpg: Signature made Sun 07 Aug 2022 10:01:15 PM PDT
# gpg:                using RSA key 27B88847EEE0250118F3EAB92ED9D774FE702DB5
# gpg:                issuer "thuth@redhat.com"
# gpg: Good signature from "Thomas Huth <th.huth@gmx.de>" [undefined]
# gpg:                 aka "Thomas Huth <thuth@redhat.com>" [undefined]
# gpg:                 aka "Thomas Huth <th.huth@posteo.de>" [unknown]
# gpg:                 aka "Thomas Huth <huth@tuxfamily.org>" [undefined]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 27B8 8847 EEE0 2501 18F3  EAB9 2ED9 D774 FE70 2DB5

* tag 'pull-request-2022-08-08' of https://gitlab.com/thuth/qemu:
  tests/qemu-iotests/264: Allow up to 5s for the BLOCK_JOB_CANCEL event to arrive
  tests/avocado: fix replay-linux test
  pc-bios/s390-ccw: Update the s390-ccw.img with the block size fix
  pc-bios/s390-ccw: Fix booting with logical block size < physical block size

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agotests/qtest: add scenario for -readconfig handling
Daniel P. Berrangé [Fri, 5 Aug 2022 11:55:29 +0000 (12:55 +0100)]
tests/qtest: add scenario for -readconfig handling

This test of -readconfig validates the last three regressions we
have fixed with -readconfig:

 * Interpretation of memory size units as MiB not bytes
 * Allow use of [spice]
 * Allow use of [object]

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20220805115529.124544-2-berrange@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2 years agovl: remove dead code in parse_memory_options()
Paolo Bonzini [Fri, 5 Aug 2022 17:15:39 +0000 (19:15 +0200)]
vl: remove dead code in parse_memory_options()

mem_str will never be an empty string, because qemu_opt_get_size() fails
if it encounters one:

   $ ./qemu-system-x86_64 -m size=
   qemu-system-x86_64: -m size=: Parameter size expects a non-negative number below 2^64
   Optional suffix k, M, G, T, P or E means kilo-, mega-, giga-, tera-, peta-
   and exabytes, respectively.

Suggested-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2 years agovl: fix [memory] section with -readconfig
Paolo Bonzini [Fri, 5 Aug 2022 10:01:51 +0000 (12:01 +0200)]
vl: fix [memory] section with -readconfig

The -M memory.* options do not have magic applied to them like the -m
option, namely no "M" (for mebibytes) is tacked at the end of a suffixless
value for "-M memory.size".

This magic is performed by parse_memory_options, and we have to do it for
both "-m" and the [memory] section of a config file.  Storing [memory]
sections directly to machine_opts_dict changed the meaning of

    [memory]
      size = "1024"

in a -readconfig file from 1024MiB to 8KiB (1024 Bytes rounded up to
8KiB silently).  To avoid this, the [memory] section has to be changed
back to QemuOpts (combining [memory] and "-m" will work fine thanks to
.merge_lists being true).

Change parse_memory_options() so that, similar to the older function
set_memory_options(), it operates after command line parsing is done;
and also call it where set_memory_options() used to be.

Note, the parsing code uses exit(1) instead of exit(EXIT_FAILURE) to
match neighboring code.

Reported-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Fixes: ce9d03fb3f ("machine: add mem compound property", 2022-05-12)
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2 years agoxlnx_dp: drop unsupported AUXCommand in xlnx_dp_aux_set_command
Qiang Liu [Mon, 8 Aug 2022 08:01:16 +0000 (16:01 +0800)]
xlnx_dp: drop unsupported AUXCommand in xlnx_dp_aux_set_command

In xlnx_dp_aux_set_command, when the command leads to the default
branch, xlxn-dp will abort and then crash.

This patch removes this abort and drops this operation.

Fixes: 58ac482 ("introduce xlnx-dp")
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/411
Reported-by: Qiang Liu <cyruscyliu@gmail.com>
Tested-by: Qiang Liu <cyruscyliu@gmail.com>
Suggested-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Qiang Liu <cyruscyliu@gmail.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Frederic Konrad <fkonrad@amd.com>
Message-Id: <20220808080116.2184881-1-cyruscyliu@gmail.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2 years agocontrib/vhost-user-blk: Clean up deallocation of VuVirtqElement
Markus Armbruster [Thu, 30 Jun 2022 08:52:19 +0000 (10:52 +0200)]
contrib/vhost-user-blk: Clean up deallocation of VuVirtqElement

We allocate VuVirtqElement with g_malloc() in
virtqueue_alloc_element(), but free it with free() in
vhost-user-blk.c.  Harmless, but use g_free() anyway.

One of the calls is guarded by a "not null" condition.  Useless,
because it cannot be null (it's dereferenced right before), and even
it it could be, free() and g_free() do the right thing.  Drop the
conditional.

Fixes: Coverity CID 1490290
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Raphael Norwitz <raphael.norwitz@nutanix.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Message-Id: <20220630085219.1305519-1-armbru@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2 years agotests/qemu-iotests/264: Allow up to 5s for the BLOCK_JOB_CANCEL event to arrive
Thomas Huth [Tue, 2 Aug 2022 12:31:01 +0000 (14:31 +0200)]
tests/qemu-iotests/264: Allow up to 5s for the BLOCK_JOB_CANCEL event to arrive

It is possible to hit the assertTrue(delta_t < 2.0) on very loaded
systems. Increase the value to 5.0 to ease the situation a little bit.

Message-Id: <20220802123101.430757-1-thuth@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Signed-off-by: Thomas Huth <thuth@redhat.com>
2 years agotests/avocado: fix replay-linux test
Pavel Dovgalyuk [Tue, 2 Aug 2022 10:36:06 +0000 (13:36 +0300)]
tests/avocado: fix replay-linux test

Last line of the test is missing by accident.
This patch fixes the script.

Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgalyuk@ispras.ru>
Message-Id: <165943656662.362178.2086588841425038338.stgit@pasha-ThinkPad-X280>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Thomas Huth <thuth@redhat.com>
2 years agopc-bios/s390-ccw: Update the s390-ccw.img with the block size fix
Thomas Huth [Sun, 7 Aug 2022 16:22:35 +0000 (18:22 +0200)]
pc-bios/s390-ccw: Update the s390-ccw.img with the block size fix

The new binary now gets the block size of virtio-blk devices right.

Signed-off-by: Thomas Huth <thuth@redhat.com>
2 years agopc-bios/s390-ccw: Fix booting with logical block size < physical block size
Thomas Huth [Fri, 5 Aug 2022 09:42:14 +0000 (11:42 +0200)]
pc-bios/s390-ccw: Fix booting with logical block size < physical block size

For accessing single blocks during boot, it's the logical block size that
matters. (Physical block sizes are rather interesting e.g. for creating
file systems with the correct alignment for speed reasons etc.).
So the s390-ccw bios has to use the logical block size for calculating
sector numbers during the boot phase, the "physical_block_exp" shift
value must not be taken into account. This change fixes the boot process
when the guest hast been installed on a disk where the logical block size
differs from the physical one, e.g. if the guest has been installed
like this:

 qemu-system-s390x -nographic -accel kvm -m 2G \
  -drive if=none,id=d1,file=fedora.iso,format=raw,media=cdrom \
  -device virtio-scsi -device scsi-cd,drive=d1 \
  -drive if=none,id=d2,file=test.qcow2,format=qcow2
  -device virtio-blk,drive=d2,physical_block_size=4096,logical_block_size=512

Linux correctly uses the logical block size of 512 for the installation,
but the s390-ccw bios tries to boot from a disk with 4096 block size so
far, as long as this patch has not been applied yet (well, it used to work
by accident in the past due to the virtio_assume_scsi() hack that used to
enforce 512 byte sectors on all virtio-block disks, but that hack has been
well removed in commit 5447de2619050a0a4d to fix other scenarios).

Fixes: 5447de2619 ("pc-bios/s390-ccw/virtio-blkdev: Remove virtio_assume_scsi()")
Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=2112303
Message-Id: <20220805094214.285223-1-thuth@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Reviewed-by: Eric Farman <farman@linux.ibm.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
2 years agoMerge tag 'pull-la-20220805' of https://gitlab.com/rth7680/qemu into staging
Richard Henderson [Fri, 5 Aug 2022 19:55:53 +0000 (12:55 -0700)]
Merge tag 'pull-la-20220805' of https://gitlab.com/rth7680/qemu into staging

LoongArch updates:
  Store value in SET_FPU_* macros.
  Fix unused variable Werrors in acpi-build.c
  Update xml to match upstream gdb.

# -----BEGIN PGP SIGNATURE-----
#
# iQFRBAABCgA7FiEEekgeeIaLTbaoWgXAZN846K9+IV8FAmLtdTodHHJpY2hhcmQu
# aGVuZGVyc29uQGxpbmFyby5vcmcACgkQZN846K9+IV/u3Qf/XON//wiT054wyL3a
# wCZ7c4A96zA0Zu+S1FSo4CZ81wCUpAF5b76fhIU5GrLuWrs/UzOcn+akS8LNLLcM
# nQHqbYNQbkTGOj6DwlZfts8Ul/Ki/Yimjh0gBLFGepzYrsahJ4dCVwQR/KZNkMKf
# xwBn3+yq96DzEmIqjqEQtlet3Wmsow/zDU+RuHbtdrFiSx6MwhLo/e+dHVEEPkEL
# EBmFNETcmAzIg+oFfifkP1ZHgL/Nt2yjElwFZM2pKLMgANVpHOpCTap03KAO/xTt
# LzX5nmJ+4MYPyoEchRaNuq5sB5GqicDGuwGPdhu6qOV589duZ64M4dfm9ErTKEFA
# eE27rA==
# =fcsy
# -----END PGP SIGNATURE-----
# gpg: Signature made Fri 05 Aug 2022 12:53:30 PM PDT
# gpg:                using RSA key 7A481E78868B4DB6A85A05C064DF38E8AF7E215F
# gpg:                issuer "richard.henderson@linaro.org"
# gpg: Good signature from "Richard Henderson <richard.henderson@linaro.org>" [ultimate]

* tag 'pull-la-20220805' of https://gitlab.com/rth7680/qemu:
  target/loongarch: Update gdb_set_fpu() and gdb_get_fpu()
  target/loongarch: Update loongarch-fpu.xml
  target/loongarch: update loongarch-base64.xml
  target/loongarch: add gdb_arch_name()
  target/loongarch: Fix GDB get the wrong pc
  hw/loongarch: remove acpi-build.c unused variable 'aml_len'
  target/loongarch: Fix macros SET_FPU_* in cpu.h

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agoMerge tag 'misc-next-pull-request' of https://gitlab.com/berrange/qemu into staging
Richard Henderson [Fri, 5 Aug 2022 17:28:09 +0000 (10:28 -0700)]
Merge tag 'misc-next-pull-request' of https://gitlab.com/berrange/qemu into staging

Merge misc patches

 * Display deprecation warnings in -cpu help
 * Fix zerocopy IPv6 handling
 * Clarify platform support policy on minor release/backports
 * Fix closesocket call in error path

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCAAdFiEE2vOm/bJrYpEtDo4/vobrtBUQT98FAmLtNQoACgkQvobrtBUQ
# T9/vbQ//ab28uFWbUxnBjOsI57PEJLCL4iWCtJtMEkjWRT6W5hoMirktsThierSe
# Yi1idrL0Z5lP6S1AZvuKYO9yTjzO+VzpmolXXRB6lRabQJ7eL/KNAAj2gO1X/ELh
# UItcalI14ucrWUSd14PGjHAOgpI1RONDcgnY3/Yp9/ARz+0XEtH4CLk2NyAxCRn/
# PHDA/BB0tKf0S6aC92vHOVLdLppA6lhheIKCyrM+QWZfp/PuIQLvjHdilB9dcbdC
# JtZN5TWISvOPuAGBMkulAefKPMWhrdy2UYBIGvN3+s+l6y++neyrChagt0ky+8F3
# dF0AZsqVRQfVwAKLhHpaNAImCbUt2jVWXHXzgrwVSNpdP1oDcFVVuu/strdcvyb6
# UgZI10hkKWsaZXcjXJ0qMZ8bI5CLXAosRx4SA0U/SLGJs5jpEO9gK3cq5o+vtG+j
# cJI7/B5OI3csuBVCXddgl6bkOYldSOcP6QEre7KJ+V07feDWDGa8qzwpRvh9h6Vb
# YZ+eWWTOAbDbXpgwk8sNTGYHbKME6GSBMa2QF2rLFrIHnI9OoWFzn2O87wKSNt9M
# 9p7Xv2UF0hB6CQ2p0wjETbnkfbQR5C3ybanfWvqK/98w1AkwMkaK3pDDbX571hFN
# EzZx1cdirpthzvGXyYRsM+V64T86t7J2jeCbbPpEzSmpglD9IKM=
# =JTiu
# -----END PGP SIGNATURE-----
# gpg: Signature made Fri 05 Aug 2022 08:19:38 AM PDT
# gpg:                using RSA key DAF3A6FDB26B62912D0E8E3FBE86EBB415104FDF
# gpg: Good signature from "Daniel P. Berrange <dan@berrange.com>" [full]
# gpg:                 aka "Daniel P. Berrange <berrange@redhat.com>" [full]

* tag 'misc-next-pull-request' of https://gitlab.com/berrange/qemu:
  util/qemu-sockets: Replace the call to close a socket with closesocket()
  target/arm: display deprecation status in '-cpu help'
  target/s390x: display deprecation status in '-cpu help'
  target/i386: display deprecation status in '-cpu help'
  QIOChannelSocket: Add support for MSG_ZEROCOPY + IPV6
  docs: build-platforms: Clarify stance on minor releases and backports

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agotarget/loongarch: Update gdb_set_fpu() and gdb_get_fpu()
Song Gao [Fri, 5 Aug 2022 03:35:23 +0000 (11:35 +0800)]
target/loongarch: Update gdb_set_fpu() and gdb_get_fpu()

GDB LoongArch fpu use fcc register, update gdb_set_fpu()
and gdb_get_fpu() to match it.

Signed-off-by: Song Gao <gaosong@loongson.cn>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Acked-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20220805033523.1416837-6-gaosong@loongson.cn>

2 years agotarget/loongarch: Update loongarch-fpu.xml
Song Gao [Fri, 5 Aug 2022 03:35:22 +0000 (11:35 +0800)]
target/loongarch: Update loongarch-fpu.xml

Rename loongarch-fpu64.xml to loongarch-fpu.xml and update
loongarch-fpu.xml to match upstream GDB [1]

[1]:https://github.com/bminor/binutils-gdb/blob/master/gdb/features/loongarch/fpu.xml

Signed-off-by: Song Gao <gaosong@loongson.cn>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Acked-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20220805033523.1416837-5-gaosong@loongson.cn>

2 years agotarget/loongarch: update loongarch-base64.xml
Song Gao [Fri, 5 Aug 2022 03:35:21 +0000 (11:35 +0800)]
target/loongarch: update loongarch-base64.xml

Update loongarch-base64.xml to match the upstream GDB [1].

[1]:https://github.com/bminor/binutils-gdb/blob/master/gdb/features/loongarch/base64.xml

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Song Gao <gaosong@loongson.cn>
Acked-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20220805033523.1416837-4-gaosong@loongson.cn>

2 years agotarget/loongarch: add gdb_arch_name()
Song Gao [Fri, 5 Aug 2022 03:35:20 +0000 (11:35 +0800)]
target/loongarch: add gdb_arch_name()

Matches bfd/cpu-loongarch.c, bfd_loongarch_arch.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Song Gao <gaosong@loongson.cn>
Acked-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20220805033523.1416837-3-gaosong@loongson.cn>

2 years agotarget/loongarch: Fix GDB get the wrong pc
Song Gao [Fri, 5 Aug 2022 03:35:19 +0000 (11:35 +0800)]
target/loongarch: Fix GDB get the wrong pc

GDB LoongArch add a register orig_a0, see the base64.xml [1].
We should add the orig_a0 to match the upstream GDB.

[1]: https://github.com/bminor/binutils-gdb/blob/master/gdb/features/loongarch/base64.xml

Signed-off-by: Song Gao <gaosong@loongson.cn>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Acked-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20220805033523.1416837-2-gaosong@loongson.cn>

2 years agohw/loongarch: remove acpi-build.c unused variable 'aml_len'
Song Gao [Thu, 21 Jul 2022 04:00:46 +0000 (12:00 +0800)]
hw/loongarch: remove acpi-build.c unused variable 'aml_len'

Fix a compiler warning on openbsd:
../src/hw/loongarch/acpi-build.c:416:12: warning: variable 'aml_len'
set but not used [-Wunused-but-set-variable]
    size_t aml_len = 0;
           ^

Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Song Gao <gaosong@loongson.cn>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20220721040046.3985609-1-gaosong@loongson.cn>
[rth: Removing aml_len in turn makes fadt set but not used.]
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agotarget/loongarch: Fix macros SET_FPU_* in cpu.h
Qi Hu [Thu, 4 Aug 2022 13:24:50 +0000 (21:24 +0800)]
target/loongarch: Fix macros SET_FPU_* in cpu.h

The macros SET_FPU_* are used to set corresponding bits of fcsr.
Unfortunately it forgets to set the result and it causes fcsr's
"CAUSE" never being updated. This patch is to fix this bug.

Signed-off-by: Qi Hu <huqi@loongson.cn>
Reviewed-by: Song Gao <gaosong@loongson.cn>
Message-Id: <20220804132450.314329-1-huqi@loongson.cn>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agoutil/qemu-sockets: Replace the call to close a socket with closesocket()
Bin Meng [Tue, 2 Aug 2022 07:51:57 +0000 (15:51 +0800)]
util/qemu-sockets: Replace the call to close a socket with closesocket()

close() is a *nix function. It works on any file descriptor, and
sockets in *nix are an example of a file descriptor.

closesocket() is a Windows-specific function, which works only
specifically with sockets. Sockets on Windows do not use *nix-style
file descriptors, and socket() returns a handle to a kernel object
instead, so it must be closed with closesocket().

In QEMU there is already a logic to handle such platform difference
in os-posix.h and os-win32.h, that:

  * closesocket maps to close on POSIX
  * closesocket maps to a wrapper that calls the real closesocket()
    on Windows

Replace the call to close a socket with closesocket() instead.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agotarget/arm: display deprecation status in '-cpu help'
Daniel P. Berrangé [Tue, 24 May 2022 14:44:55 +0000 (15:44 +0100)]
target/arm: display deprecation status in '-cpu help'

When the user queries CPU models via QMP there is a 'deprecated' flag
present, however, this is not done for the CLI '-cpu help' command.

Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agotarget/s390x: display deprecation status in '-cpu help'
Daniel P. Berrangé [Tue, 24 May 2022 14:44:55 +0000 (15:44 +0100)]
target/s390x: display deprecation status in '-cpu help'

When the user queries CPU models via QMP there is a 'deprecated' flag
present, however, this is not done for the CLI '-cpu help' command.

Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agotarget/i386: display deprecation status in '-cpu help'
Daniel P. Berrangé [Tue, 24 May 2022 14:44:55 +0000 (15:44 +0100)]
target/i386: display deprecation status in '-cpu help'

When the user queries CPU models via QMP there is a 'deprecated' flag
present, however, this is not done for the CLI '-cpu help' command.

Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agoQIOChannelSocket: Add support for MSG_ZEROCOPY + IPV6
Leonardo Bras [Thu, 4 Aug 2022 07:10:43 +0000 (04:10 -0300)]
QIOChannelSocket: Add support for MSG_ZEROCOPY + IPV6

For using MSG_ZEROCOPY, there are two steps:
1 - io_writev() the packet, which enqueues the packet for sending, and
2 - io_flush(), which gets confirmation that all packets got correctly sent

Currently, if MSG_ZEROCOPY is used to send packets over IPV6, no error will
be reported in (1), but it will fail in the first time (2) happens.

This happens because (2) currently checks for cmsg_level & cmsg_type
associated with IPV4 only, before reporting any error.

Add checks for cmsg_level & cmsg_type associated with IPV6, and thus enable
support for MSG_ZEROCOPY + IPV6

Fixes: 2bc58ffc29 ("QIOChannelSocket: Implement io_writev zero copy flag & io_flush for CONFIG_LINUX")
Signed-off-by: Leonardo Bras <leobras@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agodocs: build-platforms: Clarify stance on minor releases and backports
Andrea Bolognani [Wed, 20 Apr 2022 16:03:11 +0000 (18:03 +0200)]
docs: build-platforms: Clarify stance on minor releases and backports

These changes match those made in the following libvirt commits:

  2ac78307af docs: Clarify our stance on backported packages
  78cffd450a docs: Spell out our policy concerning minor releases

Since QEMU's platform support policy is based on libvirt's, it
makes sense to mirror these recent changes made to the latter.

The policy is not altered significantly - we're simply spelling
out some rules that were likely already being implicitly
enforced.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agoMerge tag 'trivial-branch-for-7.1-pull-request' of https://gitlab.com/laurent_vivier...
Richard Henderson [Fri, 5 Aug 2022 00:21:13 +0000 (17:21 -0700)]
Merge tag 'trivial-branch-for-7.1-pull-request' of https://gitlab.com/laurent_vivier/qemu into staging

Pull request trivial branch 20220804

# -----BEGIN PGP SIGNATURE-----
#
# iQJGBAABCAAwFiEEzS913cjjpNwuT1Fz8ww4vT8vvjwFAmLsHD8SHGxhdXJlbnRA
# dml2aWVyLmV1AAoJEPMMOL0/L748y7AP/iXRxiqvnb478I+OuOPRu37PaBEfU3n4
# Ry4xr1VT+9GV3MKBK1icA065+tTmW4s1ANJBihhGgn0S1oMiSJQk6esAKtjGsdt0
# OdWPPxVHN2XMs0UgwnONjzgSCbS5boLPK6wk+jMoyb3Vry+moa7JIbRr1ynlWOdN
# 3S3rDTsyOX0gvuNOjht56g5aGRnnPqU3qIU6AdIOxpZxpb4dHi3g+UDAB5APCZss
# oUZonuBeiSA+1T2XJc9opNdA56s8ObO41TJ1vMqt4TboYWUo+VXZf5Y21wE85Cx/
# qUtNiY7rCfBA8EdjmvkunmV0jIc9TghWCBTh3JMWp756dvwIpwl4eWnODFUwyhZs
# S4EAlPgHEjzqi6dbuKb+MNDkQKjUjP8gDn8ZVPQT+QLl0yjY9sOasKqkI0xnZDfI
# NVVIhUjpwWfC9jJL7M+ML6+Tg16UpH4vOq9nySZ3G/z61P1+uXnI/M2Fx5LxoELQ
# Z9eHzphbXgyGialt+Yin0A07rOYG9oRgAKGc2e0RgEPFSO8c6kcy+DdoVgz87xCC
# PwrfNs/s6vzH11a3MPkYhTadVvaDIXbPgkRdUNKPyaGLvSjkrQ7aMCCGT0dCfDAq
# 00SAq+KMaSdL9VDgtipGcDOGwbLpI9ixNXvMPNrfVu+Qa6VcZO6synwWaeTMnxzf
# tx4tSb/W4nB3
# =y8/X
# -----END PGP SIGNATURE-----
# gpg: Signature made Thu 04 Aug 2022 12:21:35 PM PDT
# gpg:                using RSA key CD2F75DDC8E3A4DC2E4F5173F30C38BD3F2FBE3C
# gpg:                issuer "laurent@vivier.eu"
# gpg: Good signature from "Laurent Vivier <lvivier@redhat.com>" [undefined]
# gpg:                 aka "Laurent Vivier <laurent@vivier.eu>" [undefined]
# gpg:                 aka "Laurent Vivier (Red Hat) <lvivier@redhat.com>" [undefined]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F  5173 F30C 38BD 3F2F BE3C

* tag 'trivial-branch-for-7.1-pull-request' of https://gitlab.com/laurent_vivier/qemu:
  include/qemu/host-utils.h: Simplify the compiler check in mulu128()
  ppc: Remove redundant macro MSR_BOOK3S_MASK.
  docs/about/removed-features: Move the -soundhw into the right section
  vdpa: Fix file descriptor leak on get features error
  README.rst: fix link formatting

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agoMerge tag 'block-pull-request' of https://gitlab.com/stefanha/qemu into staging
Richard Henderson [Thu, 4 Aug 2022 21:06:17 +0000 (14:06 -0700)]
Merge tag 'block-pull-request' of https://gitlab.com/stefanha/qemu into staging

Pull request

- Format string portability fix in virtiofsd

# -----BEGIN PGP SIGNATURE-----
#
# iQEzBAABCAAdFiEEhpWov9P5fNqsNXdanKSrs4Grc8gFAmLsF9sACgkQnKSrs4Gr
# c8hAgwf/QPdBt6F1kBZTlSSt2nV2VAlX9HxsWAE5tSbtUTNS9Xr+avX6MHljAU20
# WN+zZ+4cUHjIqtt6NueqkTczV5PqccvB6H9Cs0FdkKH8unyMSHvSRNuRlAG+LgMF
# YQdHGGc9tvcIACz4GwWfzXJ/FsaoFHw7qTX3AUxe9nmlZnbB7cdl4Z7v6CQZ6kFL
# bfXCd2bXcw2XosykGijsiiJ5IV+nshchaVA01DbO+w/KeLaGJgUbiEB6unMGUIBL
# IMxy9VaP2AS44cGqNkFfWIm2tCfE0uT2qhca4BMk0kXQlwoBAuFGHuGHhbH0dU+w
# fFN+lSaLs0oBGo1G0Mw+ImLF9XymAw==
# =k1jb
# -----END PGP SIGNATURE-----
# gpg: Signature made Thu 04 Aug 2022 12:02:51 PM PDT
# gpg:                using RSA key 8695A8BFD3F97CDAAC35775A9CA4ABB381AB73C8
# gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>" [full]
# gpg:                 aka "Stefan Hajnoczi <stefanha@gmail.com>" [full]

* tag 'block-pull-request' of https://gitlab.com/stefanha/qemu:
  virtiofsd: Fix format strings

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agoMerge tag 'pull-ppc-20220804' of https://gitlab.com/danielhb/qemu into staging
Richard Henderson [Thu, 4 Aug 2022 18:47:58 +0000 (11:47 -0700)]
Merge tag 'pull-ppc-20220804' of https://gitlab.com/danielhb/qemu into staging

ppc patch queue for 2022-08-04:

In this short queue we have a fix in the sam460ex machine where we're
not storing all GPIO lines in sam460ex_init().

This is not causing problems (as far as we're aware of) at this moment,
but this is getting in the way of a ppc405 rework we want to do for 7.2,
so let's fix it now.

# -----BEGIN PGP SIGNATURE-----
#
# iHUEABYKAB0WIQQX6/+ZI9AYAK8oOBk82cqW3gMxZAUCYuwOIQAKCRA82cqW3gMx
# ZN+NAQDDOk4b79khltmrslo4Sa16nu/ARgqMGOsyy0Y5Whs9MgEAyiAVhpQ6C7Ok
# W2sHeUkv/ZvzWvE7LWXMPZehBgU9DgM=
# =QrsF
# -----END PGP SIGNATURE-----
# gpg: Signature made Thu 04 Aug 2022 11:21:21 AM PDT
# gpg:                using EDDSA key 17EBFF9923D01800AF2838193CD9CA96DE033164
# gpg: Good signature from "Daniel Henrique Barboza <danielhb413@gmail.com>" [unknown]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 17EB FF99 23D0 1800 AF28  3819 3CD9 CA96 DE03 3164

* tag 'pull-ppc-20220804' of https://gitlab.com/danielhb/qemu:
  hw/ppc: sam460ex.c: store all GPIO lines in mal_irqs[]

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agovirtiofsd: Fix format strings
Stefan Weil [Thu, 4 Aug 2022 07:48:33 +0000 (09:48 +0200)]
virtiofsd: Fix format strings

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Message-Id: <20220804074833.892604-1-sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2 years agohw/ppc: sam460ex.c: store all GPIO lines in mal_irqs[]
Daniel Henrique Barboza [Wed, 3 Aug 2022 23:32:04 +0000 (20:32 -0300)]
hw/ppc: sam460ex.c: store all GPIO lines in mal_irqs[]

We're not storing all GPIO lines we're retrieving with
qdev_get_gpio_in() in mal_irqs[]. We're storing just the last one in the
first index:

    for (i = 0; i < ARRAY_SIZE(mal_irqs); i++) {
        mal_irqs[0] = qdev_get_gpio_in(uic[2], 3 + i);
    }
    ppc4xx_mal_init(env, 4, 16, mal_irqs);

mal_irqs is used in ppc4xx_mal_init() to assign the IRQs to MAL:

    for (i = 0; i < 4; i++) {
        mal->irqs[i] = irqs[i];
    }

Since only irqs[0] has been initialized, mal->irqs[1,2,3] are being
zeroed.

This doesn´t seem to trigger any apparent issues at this moment, but
Cedric's QOMification of the MAL device [1] is executing a
sysbus_connect_irq() that will fail if we do not store all GPIO lines
properly.

[1] https://lists.gnu.org/archive/html/qemu-devel/2022-08/msg00497.html

Cc: Peter Maydell <peter.maydell@linaro.org>
Cc: BALATON Zoltan <balaton@eik.bme.hu>
Fixes: 706e944206d7 ("hw/ppc/sam460ex: Drop use of ppcuic_init()")
Acked-by: BALATON Zoltan <balaton@eik.bme.hu>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Message-Id: <20220803233204.2724202-1-danielhb413@gmail.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2 years agoinclude/qemu/host-utils.h: Simplify the compiler check in mulu128()
Thomas Huth [Thu, 21 Jul 2022 07:48:09 +0000 (09:48 +0200)]
include/qemu/host-utils.h: Simplify the compiler check in mulu128()

We currently require at least GCC 7.4 or Clang 6.0 for compiling QEMU.
GCC has __builtin_mul_overflow since version 5 already, and Clang 6.0
also provides this built-in function (see its documentation on this page:
https://releases.llvm.org/6.0.0/tools/clang/docs/LanguageExtensions.html ).
So we can simplify the #if statement here.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20220721074809.1513357-1-thuth@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2 years agoppc: Remove redundant macro MSR_BOOK3S_MASK.
Yonggang Luo [Thu, 28 Jul 2022 20:11:35 +0000 (04:11 +0800)]
ppc: Remove redundant macro MSR_BOOK3S_MASK.

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Message-Id: <20220728201135.223-1-luoyonggang@gmail.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2 years agodocs/about/removed-features: Move the -soundhw into the right section
Thomas Huth [Tue, 2 Aug 2022 07:56:11 +0000 (09:56 +0200)]
docs/about/removed-features: Move the -soundhw into the right section

The note about the removal of '-soundhw' has been accidentally added
to the section of removed "linux-user mode CPUs" ... it should reside
in the section about removed "System emulator command line arguments"
instead.

Fixes: 039a68373c ("introduce -audio as a replacement for -soundhw")
Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
Message-Id: <20220802075611.346835-1-thuth@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2 years agovdpa: Fix file descriptor leak on get features error
Eugenio Pérez [Tue, 2 Aug 2022 11:24:46 +0000 (13:24 +0200)]
vdpa: Fix file descriptor leak on get features error

File descriptor vdpa_device_fd is not free in the case of returning
error from vhost_vdpa_get_features. Fixing it by making all errors go to
the same error path.

Resolves: Coverity CID 1490785
Fixes: 8170ab3f43 ("vdpa: Extract get features part from vhost_vdpa_get_max_queue_pairs")

Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
Reviewed-by: Laurent Vivier <lvivier@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Message-Id: <20220802112447.249436-2-eperezma@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2 years agoREADME.rst: fix link formatting
Cornelia Huck [Wed, 3 Aug 2022 09:02:50 +0000 (11:02 +0200)]
README.rst: fix link formatting

Make the links render correctly.

Signed-off-by: Cornelia Huck <cohuck@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20220803090250.136556-1-cohuck@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2 years agoMerge tag 'linux-user-for-7.1-pull-request' of https://gitlab.com/laurent_vivier...
Richard Henderson [Wed, 3 Aug 2022 15:32:44 +0000 (08:32 -0700)]
Merge tag 'linux-user-for-7.1-pull-request' of https://gitlab.com/laurent_vivier/qemu into staging

Pull request linux-user 20220803

# -----BEGIN PGP SIGNATURE-----
#
# iQJGBAABCAAwFiEEzS913cjjpNwuT1Fz8ww4vT8vvjwFAmLqjIMSHGxhdXJlbnRA
# dml2aWVyLmV1AAoJEPMMOL0/L748bpAP/1HW4wQztNCDL2epXGtDMTHFIjsLlc05
# h/3BwnXXXbRv/m4+IEJLITI5WpyZ24CGgA5kIFPRDxLCIHxcTo5etzqkJzxhnRvU
# MNP3m8L5gSAUUZhD8Xw2b95V8vOv4cu8J+sgub8ZaRXJpcHK1cuCF43OeI3bBuoz
# HNVY8XHl0E46JyXQmK9/phBRSK8INhlMIORd+k/GzSx7+9/UdIqTj1kVpdgbQ8we
# GqrnVW9hYA2T2vUL3SEV8t6GE6lSGRr9bvsyRRfLxJanUEQbGmbJPvqBwjamRwUF
# xZOBou/cYQOoI9AVku9bL+h2ITGfrfNZ8Oo7r7oOrz+ZjBfL9hUQqhFhI/oI265n
# 4ivzdOcsXH6OT7X+JdZRvyv6pxVL7ycu2KCKvmnNvQSocGHT1OvFqIHAWd+NAdEr
# c4q1ob1QdUfZjrzjzLR/qY2NPZat1Ge5lSIXOwC1G3T5umuw8cV7BV9KJJRoQXfE
# AWeXsLKqqByQ59z+qObnFIkUXLaUOzKMjHNFpDGSqk+dzXxQYJtBn+b8ZLoL9MLa
# miIN9imVzI2gzolIBz9Za2pnBw72bIR2PdXd3zfKH0cqmytOhKlMIEK4KJcB6kMB
# CNAbszUwrmBSopGGryf+hLMk9VsPLVUg+Yqnc6/GLY8LF9d8Xr5rd8UzelYowBuh
# 3UR/V06U2Skv
# =41sQ
# -----END PGP SIGNATURE-----
# gpg: Signature made Wed 03 Aug 2022 07:56:03 AM PDT
# gpg:                using RSA key CD2F75DDC8E3A4DC2E4F5173F30C38BD3F2FBE3C
# gpg:                issuer "laurent@vivier.eu"
# gpg: Good signature from "Laurent Vivier <lvivier@redhat.com>" [undefined]
# gpg:                 aka "Laurent Vivier <laurent@vivier.eu>" [undefined]
# gpg:                 aka "Laurent Vivier (Red Hat) <lvivier@redhat.com>" [undefined]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F  5173 F30C 38BD 3F2F BE3C

* tag 'linux-user-for-7.1-pull-request' of https://gitlab.com/laurent_vivier/qemu:
  linux-user: Use memfd for open syscall emulation
  linux-user: Do not treat madvise()'s advice as a bitmask
  linux-user/flatload.c: Fix setting of image_info::end_code

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agoUpdate version for v7.1.0-rc1 release
Richard Henderson [Wed, 3 Aug 2022 03:12:42 +0000 (20:12 -0700)]
Update version for v7.1.0-rc1 release

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agoMerge tag 'pull-semi-20220802' of https://gitlab.com/rth7680/qemu into staging
Richard Henderson [Wed, 3 Aug 2022 00:59:36 +0000 (17:59 -0700)]
Merge tag 'pull-semi-20220802' of https://gitlab.com/rth7680/qemu into staging

Fix mips semihosting regression.

# -----BEGIN PGP SIGNATURE-----
#
# iQFRBAABCgA7FiEEekgeeIaLTbaoWgXAZN846K9+IV8FAmLpx/EdHHJpY2hhcmQu
# aGVuZGVyc29uQGxpbmFyby5vcmcACgkQZN846K9+IV8d2Qf+PO1v5r5HDZYVYyhZ
# moew0E+XKv+Tzw9zjHlarC75pxMfFWbkUzKXvrsvGRg/MKo+VQyLC65PuxdtMQsr
# FSHF0KQpa0XRb7fZ+HozZE5ufmXHdtEiiXxDe0hvTt7MVRHqtonECYA2Ian3cZra
# bTJ1Iwn9mVmaWWG1JqCyvDO+PszAAQO8wCc+ADso7yt5C3BJLfWUmjjPRMWF2dHu
# 9mz15ii6kF73833btwb1/LuxtPy9UxxpHKTA8Xqpjb7ZXOZU67e0Z52CMgNBcB/U
# aeo1GUZqDKi7swI9Ilrl5ZUAQ5PsS76ePjr4j4d6aTp0ry+1axdwvkcbJnW1okMe
# qS242Q==
# =5DLw
# -----END PGP SIGNATURE-----
# gpg: Signature made Tue 02 Aug 2022 05:57:21 PM PDT
# gpg:                using RSA key 7A481E78868B4DB6A85A05C064DF38E8AF7E215F
# gpg:                issuer "richard.henderson@linaro.org"
# gpg: Good signature from "Richard Henderson <richard.henderson@linaro.org>" [ultimate]

* tag 'pull-semi-20220802' of https://gitlab.com/rth7680/qemu:
  target/mips: Advance pc after semihosting exception

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agotarget/mips: Advance pc after semihosting exception
Richard Henderson [Sat, 30 Jul 2022 02:17:02 +0000 (19:17 -0700)]
target/mips: Advance pc after semihosting exception

Delay generating the exception until after we know the
insn length, and record that length in env->error_code.

Fixes: 8ec7e3c53d4 ("target/mips: Use an exception for semihosting")
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1126
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agoMerge tag 'pull-migration-20220802c' of https://gitlab.com/dagrh/qemu into staging
Richard Henderson [Tue, 2 Aug 2022 17:03:18 +0000 (10:03 -0700)]
Merge tag 'pull-migration-20220802c' of https://gitlab.com/dagrh/qemu into staging

Migration fixes pull 2022-08-02

Small migration (and virtiofsd) fixes.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCAAdFiEERfXHG0oMt/uXep+pBRYzHrxb/ecFAmLpR80ACgkQBRYzHrxb
# /edDiQ//VWx6VFpq3j/cFe+aZudCJWbHD5HI8e0wABoCAMzfYnRRq5pMP7DaVy/x
# Su0Lr6AO7vqSZzAqjsSm4DLQJHYM28YXxo0un/aJvnOZFGiXJzFe9OIE1LUwekQe
# g6OrsyhOAf7wHY9MsoC6RRitKdSo/z7YZYZY6wEv2cyIJDda1+b9jpD6mWADQ2z1
# 7eU5T0Kxfg2nArgF1MwgMWzPzjw4xN6BbqLLkWKdf3RD8Vl0BOdwxfXPDECqouUi
# 08vcNB4jRV7WSJ5mnOEW2EMQvgmUkSe9HUhMhkD39LmbeeJ4a84oRoKZkQuvrb1h
# qsbwoMlWhg8nxqyqB7ChTUw/27V3lfzlr/k6r6ExXsDL+zUwJXg4LrFuzyaqWdb2
# vH5cp/mZkSho+PcIF+KeFQMEj51yV/y0ucU4JWwyyKCnGoJYofmZnBWG2czGOotq
# 2qX44srufFkTDISpZ+NVUsaFl06nTrS7W9aTZdISYpGuxzHphOtrnYj8Pqqdwv4B
# F6CyNmUcVbLLnGIRASYYEYMByfptmiRQgGhOtv1IJyYgzIgg0PJQUR5Dbjgb96vR
# 0jhvLucKAkBrQaxkxxMVuIUJ9JdLeVbyEaSrc38qfr3FinRt8rgNr0mnFPAcNS7s
# oAy4Ei9jZ3MoAITs/JD+ODglC/f58o0oHaSA6RFrOxmxxkrXowk=
# =b2BF
# -----END PGP SIGNATURE-----
# gpg: Signature made Tue 02 Aug 2022 08:50:37 AM PDT
# gpg:                using RSA key 45F5C71B4A0CB7FB977A9FA90516331EBC5BFDE7
# gpg: Good signature from "Dr. David Alan Gilbert (RH2) <dgilbert@redhat.com>" [full]

* tag 'pull-migration-20220802c' of https://gitlab.com/dagrh/qemu:
  virtiofsd: Disable killpriv_v2 by default
  migration: Define BLK_MIG_BLOCK_SIZE as unsigned long long
  migration: Assert that migrate_multifd_compression() returns an in-range value
  Revert "migration: Simplify unqueue_page()"
  migration: add remaining params->has_* = true in migration_instance_init()

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agovirtiofsd: Disable killpriv_v2 by default
Vivek Goyal [Fri, 29 Jul 2022 13:17:06 +0000 (09:17 -0400)]
virtiofsd: Disable killpriv_v2 by default

We are having bunch of issues with killpriv_v2 enabled by default. First
of all it relies on clearing suid/sgid bits as needed by dropping
capability CAP_FSETID. This does not work for remote filesystems like
NFS (and possibly others).

Secondly, we are noticing other issues related to clearing of SGID
which leads to failures for xfstests generic/355 and generic/193.

Thirdly, there are other issues w.r.t caching of metadata (suid/sgid)
bits in fuse client with killpriv_v2 enabled. Guest can cache that
data for sometime even if cleared on server.

Second and Third issue are fixable. Just that it might take a little
while to get it fixed in kernel. First one will probably not see
any movement for a long time.

Given these issues, killpriv_v2 does not seem to be a good candidate
for enabling by default. We have already disabled it by default in
rust version of virtiofsd.

Hence this patch disabled killpriv_v2 by default. User can choose to
enable it by passing option "-o killpriv_v2".

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Message-Id: <YuPd0itNIAz4tQRt@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
2 years agomigration: Define BLK_MIG_BLOCK_SIZE as unsigned long long
Peter Maydell [Thu, 21 Jul 2022 11:52:07 +0000 (12:52 +0100)]
migration: Define BLK_MIG_BLOCK_SIZE as unsigned long long

When we use BLK_MIG_BLOCK_SIZE in expressions like
block_mig_state.submitted * BLK_MIG_BLOCK_SIZE, this multiplication
is done as 32 bits, because both operands are 32 bits.  Coverity
complains about possible overflows because we then accumulate that
into a 64 bit variable.

Define BLK_MIG_BLOCK_SIZE as unsigned long long using the ULL suffix.
The only two current uses of it with this problem are both in
block_save_pending(), so we could just cast to uint64_t there, but
using the ULL suffix is simpler and ensures that we don't
accidentally introduce new variants of the same issue in future.

Resolves: Coverity CID 14871361487175
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20220721115207.729615-3-peter.maydell@linaro.org>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
2 years agomigration: Assert that migrate_multifd_compression() returns an in-range value
Peter Maydell [Thu, 21 Jul 2022 11:52:06 +0000 (12:52 +0100)]
migration: Assert that migrate_multifd_compression() returns an in-range value

Coverity complains that when we use the return value from
migrate_multifd_compression() as an array index:
  multifd_recv_state->ops = multifd_ops[migrate_multifd_compression()];

that this might overrun the array (which is declared to have size
MULTIFD_COMPRESSION__MAX).  This is because the function return type
is MultiFDCompression, which is an autogenerated enum.  The code
generator includes the "one greater than the maximum possible value"
MULTIFD_COMPRESSION__MAX in the enum, even though this is not
actually a valid value for the enum, and this makes Coverity think
that migrate_multifd_compression() could return that __MAX value and
index off the end of the array.

Suppress the Coverity error by asserting that the value we're going
to return is within range.

Resolves: Coverity CID 14872391487254
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20220721115207.729615-2-peter.maydell@linaro.org>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
2 years agoRevert "migration: Simplify unqueue_page()"
Thomas Huth [Tue, 2 Aug 2022 06:19:49 +0000 (08:19 +0200)]
Revert "migration: Simplify unqueue_page()"

This reverts commit cfd66f30fb0f735df06ff4220e5000290a43dad3.

The simplification of unqueue_page() introduced a bug that sometimes
breaks migration on s390x hosts.

The problem is not fully understood yet, but since we are already in
the freeze for QEMU 7.1 and we need something working there, let's
revert this patch for the upcoming release. The optimization can be
redone later again in a proper way if necessary.

Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=2099934
Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20220802061949.331576-1-thuth@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
2 years agomigration: add remaining params->has_* = true in migration_instance_init()
Leonardo Bras [Tue, 26 Jul 2022 01:02:35 +0000 (22:02 -0300)]
migration: add remaining params->has_* = true in migration_instance_init()

Some of params->has_* = true are missing in migration_instance_init, this
causes migrate_params_check() to skip some tests, allowing some
unsupported scenarios.

Fix this by adding all missing params->has_* = true in
migration_instance_init().

Fixes: 69ef1f36b0 ("migration: define 'tls-creds' and 'tls-hostname' migration parameters")
Fixes: 1d58872a91 ("migration: do not wait for free thread")
Fixes: d2f1d29b95 ("migration: add support for a "tls-authz" migration parameter")
Signed-off-by: Leonardo Bras <leobras@redhat.com>
Message-Id: <20220726010235.342927-1-leobras@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
2 years agoMerge tag 'for-upstream' of git://repo.or.cz/qemu/kevin into staging
Richard Henderson [Tue, 2 Aug 2022 13:52:05 +0000 (06:52 -0700)]
Merge tag 'for-upstream' of git://repo.or.cz/qemu/kevin into staging

Block layer patches

- libvduse: Coverity fixes
- hd-geometry: Fix ignored bios-chs-trans setting
- io_uring: Fix compiler warning (missing #include)
- main loop: add missing documentation links to GS/IO macros
- qemu-iotests: Discard stderr when probing devices

# -----BEGIN PGP SIGNATURE-----
#
# iQJFBAABCAAvFiEE3D3rFZqa+V09dFb+fwmycsiPL9YFAmLpKDURHGt3b2xmQHJl
# ZGhhdC5jb20ACgkQfwmycsiPL9ZMcA//buzWQl/AFL2VT5Fy3WpFCYDVp5mTPJ2q
# bgkhCpn6i7UXIkML53hygfm7LN9Fj8Q8Ld4ljkETzljJajS3zsXvyY6bgNevQutX
# 8WvkcUNWMb96DEgetInak2ebH6lhti6/V7lBfjNFG1yC2s8l+JoWIPqWfJqohdiN
# D4+loa/wQx1ZS3TgKq8zAxfi5qbbGxRTZQUvuCJNYRryRQmJsZH380DzlIqkRJWt
# b3rM7m9ElSpmcmwmztWkdK4E/2VYGknUQOnRpY0AUSUTcm/kaP7EVwh61+TdjlKL
# NZxvZ08kenGFTBEA9z3ahnggcLypj4IYU3DB29CiJLjMjCb0s7tMwc8USYajN+GA
# iDqkbK14mDd8auRDVbVcmnq34xzS0rJocpzT0Jo9zYo7oGe/r+JjaVWmWq0pZ2SE
# QQuSPZXZokUdpL6E5X05+JZ+u6+G+iQz9UOhNpwmKB1ajiXUVKIst/SctpyKedOr
# cJWB34tQxQIFB57s6K7wVMbSWPIumTwQc08EX0HoicT9pUMN7s+Z1jrCufudZ0ot
# gx95v7gBDZZDsJim5qi3znA8tqnUmtL0yxkUVgv7LdQfIleEnEFfutFJpq/7VFe9
# WRzXBQJPU451jF7Gvj/StA3+05qMr22mXW4CX6t96Ud6QHiR0mUBSGPRzYusIV4d
# KYOjySU7cOg=
# =axCN
# -----END PGP SIGNATURE-----
# gpg: Signature made Tue 02 Aug 2022 06:35:49 AM PDT
# gpg:                using RSA key DC3DEB159A9AF95D3D7456FE7F09B272C88F2FD6
# gpg:                issuer "kwolf@redhat.com"
# gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>" [full]

* tag 'for-upstream' of git://repo.or.cz/qemu/kevin:
  main loop: add missing documentation links to GS/IO macros
  qemu-iotests: Discard stderr when probing devices
  hw/block/hd-geometry: Do not override specified bios-chs-trans
  libvduse: Pass positive value to strerror()
  libvduse: Replace strcpy() with strncpy()
  libvduse: Fix the incorrect function name
  block/io_uring: add missing include file

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agolinux-user: Use memfd for open syscall emulation
Rainer Müller [Fri, 29 Jul 2022 15:49:51 +0000 (17:49 +0200)]
linux-user: Use memfd for open syscall emulation

For certain paths in /proc, the open syscall is intercepted and the
returned file descriptor points to a temporary file with emulated
contents.

If TMPDIR is not accessible or writable for the current user (for
example in a read-only mounted chroot or container) tools such as ps
from procps may fail unexpectedly. Trying to read one of these paths
such as /proc/self/stat would return an error such as ENOENT or EROFS.

To relax the requirement on a writable TMPDIR, use memfd_create()
instead to create an anonymous file and return its file descriptor.

Signed-off-by: Rainer Müller <raimue@codingfarm.de>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20220729154951.76268-1-raimue@codingfarm.de>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>