OSDN Git Service

qmiga/qemu.git
23 months agoppc/pnv: set root port chassis and slot using Bus properties
Daniel Henrique Barboza [Thu, 11 Aug 2022 16:39:42 +0000 (13:39 -0300)]
ppc/pnv: set root port chassis and slot using Bus properties

For default root ports we have a way of accessing chassis and slot,
before root_port_realize(), via pnv_phb_attach_root_port(). For the
future user created root ports this won't be the case: we can't use
this helper because we don't have access to the PHB phb-id/chip-id
values.

In earlier patches we've added phb-id and chip-id to pnv-phb-root-bus
objects. We're now able to use the bus to retrieve them. The bus is
reachable for both user created and default devices, so we're changing
all the code paths. This also allow us to validate these changes with
the existing default devices.

Reviewed-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Frederic Barrat <fbarrat@linux.ibm.com>
Message-Id: <20220811163950.578927-4-danielhb413@gmail.com>

23 months agoppc/pnv: add phb-id/chip-id PnvPHB4RootBus properties
Daniel Henrique Barboza [Thu, 11 Aug 2022 16:39:41 +0000 (13:39 -0300)]
ppc/pnv: add phb-id/chip-id PnvPHB4RootBus properties

The same rationale provided in the PHB3 bus case applies here.

Note: we could have merged both buses in a single object, like we did
with the root ports, and spare some boilerplate. The reason we opted to
preserve both buses objects is twofold:

- there's not user side advantage in doing so. Unifying the root ports
presents a clear user QOL change when we enable user created devices back.
The buses objects, aside from having a different QOM name, is transparent
to the user;

- we leave a door opened in case we want to increase the root port limit
for phb4/5 later on without having to deal with phb3 code.

Reviewed-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Frederic Barrat <fbarrat@linux.ibm.com>
Message-Id: <20220811163950.578927-3-danielhb413@gmail.com>

23 months agoppc/pnv: add phb-id/chip-id PnvPHB3RootBus properties
Daniel Henrique Barboza [Thu, 11 Aug 2022 16:39:40 +0000 (13:39 -0300)]
ppc/pnv: add phb-id/chip-id PnvPHB3RootBus properties

We rely on the phb-id and chip-id, which are PHB properties, to assign
chassis and slot to the root port. For default devices this is no big
deal: the root port is being created under pnv_phb_realize() and the
values are being passed on via the 'index' and 'chip-id' of the
pnv_phb_attach_root_port() helper.

If we want to implement user created root ports we have a problem. The
user created root port will not be aware of which PHB it belongs to,
unless we're willing to violate QOM best practices and access the PHB
via dev->parent_bus->parent. What we can do is to access the root bus
parent bus.

Since we're already assigning the root port as QOM child of the bus, and
the bus is initiated using PHB properties, let's add phb-id and chip-id
as properties of the bus. This will allow us trivial access to them, for
both user-created and default root ports, without doing anything too
shady with QOM.

Reviewed-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Frederic Barrat <fbarrat@linux.ibm.com>
Message-Id: <20220811163950.578927-2-danielhb413@gmail.com>

23 months agoppc/pnv: move attach_root_port helper to pnv-phb.c
Daniel Henrique Barboza [Fri, 24 Jun 2022 08:49:21 +0000 (05:49 -0300)]
ppc/pnv: move attach_root_port helper to pnv-phb.c

The helper is only used in this file.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Frederic Barrat <fbarrat@linux.ibm.com>
Message-Id: <20220624084921.399219-13-danielhb413@gmail.com>

23 months agoppc/pnv: remove PnvPHB4.version
Daniel Henrique Barboza [Fri, 24 Jun 2022 08:49:20 +0000 (05:49 -0300)]
ppc/pnv: remove PnvPHB4.version

It's unused.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Frederic Barrat <fbarrat@linux.ibm.com>
Message-Id: <20220624084921.399219-12-danielhb413@gmail.com>

23 months agoppc/pnv: remove pecc->rp_model
Daniel Henrique Barboza [Fri, 24 Jun 2022 08:49:19 +0000 (05:49 -0300)]
ppc/pnv: remove pecc->rp_model

The attribute is unused.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Frederic Barrat <fbarrat@linux.ibm.com>
Message-Id: <20220624084921.399219-11-danielhb413@gmail.com>

23 months agoppc/pnv: remove root port name from pnv_phb_attach_root_port()
Daniel Henrique Barboza [Fri, 24 Jun 2022 08:49:18 +0000 (05:49 -0300)]
ppc/pnv: remove root port name from pnv_phb_attach_root_port()

We support only a single root port, PNV_PHB_ROOT_PORT.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Frederic Barrat <fbarrat@linux.ibm.com>
Message-Id: <20220624084921.399219-10-danielhb413@gmail.com>

23 months agoppc/pnv: remove pnv-phb4-root-port
Daniel Henrique Barboza [Fri, 24 Jun 2022 08:49:17 +0000 (05:49 -0300)]
ppc/pnv: remove pnv-phb4-root-port

The unified pnv-phb-root-port can be used instead. The phb4-root-port
device isn't exposed to the user in any official QEMU release so there's
no ABI breakage in removing it.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Frederic Barrat <fbarrat@linux.ibm.com>
Message-Id: <20220624084921.399219-9-danielhb413@gmail.com>

23 months agoppc/pnv: remove pnv-phb3-root-port
Daniel Henrique Barboza [Fri, 24 Jun 2022 08:49:16 +0000 (05:49 -0300)]
ppc/pnv: remove pnv-phb3-root-port

The unified pnv-phb-root-port can be used in its place. There is no ABI
breakage in doing so because no official QEMU release introduced user
creatable pnv-phb3-root-port devices.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Frederic Barrat <fbarrat@linux.ibm.com>
Message-Id: <20220624084921.399219-8-danielhb413@gmail.com>

23 months agoppc/pnv: add pnv-phb-root-port device
Daniel Henrique Barboza [Fri, 24 Jun 2022 08:49:15 +0000 (05:49 -0300)]
ppc/pnv: add pnv-phb-root-port device

We have two very similar root-port devices, pnv-phb3-root-port and
pnv-phb4-root-port. Both consist of a wrapper around the PCIESlot device
that, until now, has no additional attributes.

The main difference between the PHB3 and PHB4 root ports is that
pnv-phb4-root-port has the pnv_phb4_root_port_reset() callback. All
other differences can be merged in a single device without too much
trouble.

This patch introduces the unified pnv-phb-root-port that, in time, will
be used as the default root port for the pnv-phb device.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Frederic Barrat <fbarrat@linux.ibm.com>
Message-Id: <20220624084921.399219-7-danielhb413@gmail.com>

23 months agoppc/pnv: turn PnvPHB4 into a PnvPHB backend
Daniel Henrique Barboza [Fri, 24 Jun 2022 08:49:14 +0000 (05:49 -0300)]
ppc/pnv: turn PnvPHB4 into a PnvPHB backend

Change the parent type of the PnvPHB4 device to TYPE_PARENT since the
PCI bus is going to be initialized by the PnvPHB parent. Functions that
needs to access the bus via a PnvPHB4 object can do so via the
phb4->phb_base pointer.

pnv_phb4_pec now creates a PnvPHB object.

The powernv9 machine class will create PnvPHB devices with version '4'.
powernv10 will create using version '5'. Both are using global machine
properties in their class_init() to do that.

These changes will benefit us when adding PnvPHB user creatable devices
for powernv9 and powernv10.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Frederic Barrat <fbarrat@linux.ibm.com>
Message-Id: <20220624084921.399219-6-danielhb413@gmail.com>

23 months agoppc/pnv: add PHB4 bus init helper
Daniel Henrique Barboza [Fri, 24 Jun 2022 08:49:13 +0000 (05:49 -0300)]
ppc/pnv: add PHB4 bus init helper

Similar to what we already did for the PnvPHB3 device, let's add a
helper to init the bus when using a PnvPHB4. This helper will be used by
PnvPHb when PnvPHB4 turns into a backend.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Frederic Barrat <fbarrat@linux.ibm.com>
Message-Id: <20220624084921.399219-5-danielhb413@gmail.com>

23 months agoppc/pnv: turn PnvPHB3 into a PnvPHB backend
Daniel Henrique Barboza [Fri, 24 Jun 2022 08:49:12 +0000 (05:49 -0300)]
ppc/pnv: turn PnvPHB3 into a PnvPHB backend

We need a handful of changes that needs to be done in a single swoop to
turn PnvPHB3 into a PnvPHB backend.

In the PnvPHB3, since the PnvPHB device implements PCIExpressHost and
will hold the PCI bus, change PnvPHB3 parent to TYPE_DEVICE. There are a
couple of instances in pnv_phb3.c that needs to access the PCI bus, so a
phb_base pointer is added to allow access to the parent PnvPHB. The
PnvPHB3 root port will now be connected to a PnvPHB object.

In pnv.c, the powernv8 machine chip8 will now hold an array of PnvPHB
objects.  pnv_get_phb3_child() needs to be adapted to return the PnvPHB3
backend from the PnvPHB child. A global property is added in
pnv_machine_power8_class_init() to ensure that all PnvPHBs are created
with phb->version = 3.

After all these changes we're still able to boot a powernv8 machine with
default settings. The real gain will come with user created PnvPHB
devices, coming up next.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Frederic Barrat <fbarrat@linux.ibm.com>
Message-Id: <20220624084921.399219-4-danielhb413@gmail.com>

23 months agoppc/pnv: add PnvPHB base/proxy device
Daniel Henrique Barboza [Fri, 24 Jun 2022 08:49:11 +0000 (05:49 -0300)]
ppc/pnv: add PnvPHB base/proxy device

The PnvPHB device is going to be the base device for all other powernv
PHBs. It consists of a device that has the same user API as the other
PHB, namely being a PCIHostBridge and having chip-id and index
properties. It also has a 'backend' pointer that will be initialized
with the PHB implementation that the device is going to use.

The initialization of the PHB backend is done by checking the PHB
version via a 'version' attribute that can be set via a global machine
property.  The 'version' field will be used to make adjustments based on
the running version, e.g. PHB3 uses a 'chip' reference while PHB4 uses
'pec'. To init the PnvPHB bus we'll rely on helpers for each version.
The version 3 helper is already added (pnv_phb3_bus_init), the PHB4
helper will be added later on.

For now let's add the basic logic of the PnvPHB object, which consists
mostly of pnv_phb_realize() doing all the work of checking the
phb->version set, initializing the proper backend, passing through its
attributes to the chosen backend, finalizing the backend realize and
adding a root port in the end.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Frederic Barrat <fbarrat@linux.ibm.com>
Message-Id: <20220624084921.399219-3-danielhb413@gmail.com>

23 months agoppc/pnv: add PHB3 bus init helper
Daniel Henrique Barboza [Fri, 24 Jun 2022 08:49:10 +0000 (05:49 -0300)]
ppc/pnv: add PHB3 bus init helper

The PnvPHB3 bus init consists of initializing the pci_io and pci_mmio
regions, registering it via pci_register_root_bus() and then setup the
iommu.

We'll want to init the bus from outside pnv_phb3.c when the bus is
removed from the PnvPHB3 device and put into a new parent PnvPHB device.
The new pnv_phb3_bus_init() helper will be used by the parent to init
the bus when using the PHB3 backend.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Frederic Barrat <fbarrat@linux.ibm.com>
Message-Id: <20220624084921.399219-2-danielhb413@gmail.com>

23 months agotarget/ppc: Bugfix FP when OE/UE are set
Lucas Mateus Castro (alqotel) [Fri, 5 Aug 2022 14:15:22 +0000 (11:15 -0300)]
target/ppc: Bugfix FP when OE/UE are set

When an overflow exception occurs and OE is set the intermediate result
should be adjusted (by subtracting from the exponent) to avoid rounding
to inf. The same applies to an underflow exceptionion and UE (but adding
to the exponent). To do this set the fp_status.rebias_overflow when OE
is set and fp_status.rebias_underflow when UE is set as the FPU will
recalculate in case of a overflow/underflow if the according rebias* is
set.

Signed-off-by: Lucas Mateus Castro (alqotel) <lucas.araujo@eldorado.org.br>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20220805141522.412864-3-lucas.araujo@eldorado.org.br>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
23 months agofpu: Add rebias bool, value and operation
Lucas Mateus Castro (alqotel) [Fri, 5 Aug 2022 14:15:21 +0000 (11:15 -0300)]
fpu: Add rebias bool, value and operation

Added the possibility of recalculating a result if it overflows or
underflows, if the result overflow and the rebias bool is true then the
intermediate result should have 3/4 of the total range subtracted from
the exponent. The same for underflow but it should be added to the
exponent of the intermediate number instead.

Signed-off-by: Lucas Mateus Castro (alqotel) <lucas.araujo@eldorado.org.br>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20220805141522.412864-2-lucas.araujo@eldorado.org.br>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
23 months agoppc/pnv: Add initial P9/10 SBE model
Nicholas Piggin [Thu, 11 Aug 2022 09:37:26 +0000 (19:37 +1000)]
ppc/pnv: Add initial P9/10 SBE model

The SBE (Self Boot Engine) are on-chip microcontrollers that perform
early boot steps, as well as provide some runtime facilities (e.g.,
timer, secure register access, MPIPL). The latter facilities are
accessed mostly via a message system called SBEFIFO.

This driver provides initial emulation for the SBE runtime registers
and a very basic SBEFIFO implementation that provides the timer
command. This covers the basic SBE behaviour expected by skiboot when
booting.

Reviewed-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Message-Id: <20220811093726.1442343-1-npiggin@gmail.com>
[danielhb: fixed SBE_HOST_RESPONSE_MASK long line]
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
23 months agotarget/ppc: Fix host PVR matching for KVM
Nicholas Piggin [Sun, 31 Jul 2022 01:33:58 +0000 (11:33 +1000)]
target/ppc: Fix host PVR matching for KVM

ppc_cpu_compare_class_pvr_mask() should match the best CPU class in the
family, because it is used by the KVM subsystem to find the host CPU
class. Since commit 03ae4133ab8 ("target-ppc: Add pvr_match()
callback"), it matches any class in the family (the first one in the
comparison list).

Since commit f30c843ced5 ("ppc/pnv: Introduce PowerNV machines with
fixed CPU models"), pnv has relied on pnv_match having these new
semantics to check machine compatibility with a CPU family.

Resolve this by adding a parameter to the pvr_match function to select
the best or any match, and restore the old behaviour for the KVM case.

Prior to this fix, e.g., a POWER9 DD2.3 KVM host matches to the
power9_v1.0 class (because that happens to be the first POWER9 family
CPU compared). After the patch, it matches the power9_v2.0 class.

This approach requires pnv_match contain knowledge of the CPU classes
implemented in the same family, which feels ugly. But pushing the 'best'
match down to the class would still require they know about one another
which is not obviously much better. For now this gets things working.

Fixes: 03ae4133ab8 ("target-ppc: Add pvr_match() callback")
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Message-Id: <20220731013358.170187-1-npiggin@gmail.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
23 months agopseries: Update SLOF firmware image
Alexey Kardashevskiy [Tue, 19 Jul 2022 07:48:03 +0000 (17:48 +1000)]
pseries: Update SLOF firmware image

The only change is that now SLOF can also boot big endian zImage
but kernel-addr=0 is still required.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
23 months agoOpen 7.2 development tree
Richard Henderson [Tue, 30 Aug 2022 16:40:41 +0000 (09:40 -0700)]
Open 7.2 development tree

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
23 months agoUpdate version for v7.1.0 release
Richard Henderson [Tue, 30 Aug 2022 16:40:11 +0000 (09:40 -0700)]
Update version for v7.1.0 release

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
23 months agoUpdate version for v7.1.0-rc4 release
Richard Henderson [Thu, 25 Aug 2022 02:27:56 +0000 (19:27 -0700)]
Update version for v7.1.0-rc4 release

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
23 months agoMerge tag 'pull-for-7.1-fixes-240822-3' of https://github.com/stsquad/qemu into staging
Richard Henderson [Wed, 24 Aug 2022 15:04:26 +0000 (08:04 -0700)]
Merge tag 'pull-for-7.1-fixes-240822-3' of https://github.com/stsquad/qemu into staging

Testing and doc updates:

  - move default timeout to QemuBaseTests
  - optimise migration tests to run faster
  - removed duplicate migration test
  - add some clarifying language to block options in manual

# -----BEGIN PGP SIGNATURE-----
#
# iQEzBAABCgAdFiEEZoWumedRZ7yvyN81+9DbCVqeKkQFAmMF7MMACgkQ+9DbCVqe
# KkTCmgf/eyjET4BObyQEp7QsbdS295eL3If2PxSumCrypMjpmYAFJcQ9POjagExo
# wh+E8hU587BLzghgjPcsJ4fm3m21bngmAvsczmLcgOMhAaMhH5MRMR0dvHjo7l9F
# isJ1ro20fCJ2QcFNybAIu4VluwBr9oYBnZ3B7YpL9DDu8x9MmS6UCQkCJ4Y86raW
# G9IXTHwwiq3D4RiuLccPRZ/WsMZhuNVafFrgJK56GBF7jWI0d0kOar5HyS8pATNL
# hkAYBTfkrBmEhOA86vMiRmfmpVa+FqSzXkn2quWvJ8HGQ2tmIoboBbGWDExvN0/d
# pPLoAzDVPEnHAMqarC2RgSQTH0JmJQ==
# =ODg1
# -----END PGP SIGNATURE-----
# gpg: Signature made Wed 24 Aug 2022 02:17:55 AM PDT
# 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-240822-3' of https://github.com/stsquad/qemu:
  qemu-options: try and clarify preferred block semantics
  tests/qtest/migration-test: Remove duplicated test_postcopy from the test plan
  tests/migration/i386: Speed up the i386 migration test (when using TCG)
  tests/migration/aarch64: Speed up the aarch64 migration test
  tests/qtest/migration-test: Only wait for serial output where migration succeeds
  tests/avocado: push default timeout to QemuBaseTest

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
23 months agoqemu-options: try and clarify preferred block semantics
Alex Bennée [Mon, 22 Aug 2022 16:56:08 +0000 (17:56 +0100)]
qemu-options: try and clarify preferred block semantics

Try to correct any confusion about QEMU's Byzantine disk options by
laying out the preferred "modern" options as-per:

 "<danpb> (best:  -device + -blockdev,  2nd obsolete syntax: -device +
     -drive,  3rd obsolete syntax: -drive, 4th obsolete syntax: -hdNN)"

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Acked-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Cc: qemu-block@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Hanna Reitz <hreitz@redhat.com>
Cc: Thomas Huth <thuth@redhat.com>
Message-Id: <20220822165608.2980552-7-alex.bennee@linaro.org>

23 months agotests/qtest/migration-test: Remove duplicated test_postcopy from the test plan
Thomas Huth [Mon, 22 Aug 2022 16:56:07 +0000 (17:56 +0100)]
tests/qtest/migration-test: Remove duplicated test_postcopy from the test plan

test_postcopy() is currently run twice - which is just a waste of resources
and time. The commit d1a27b169b2d that introduced the duplicate talked about
renaming the "postcopy/unix" test, but apparently it forgot to remove the
old entry. Let's do that now.

Fixes: d1a27b169b ("tests: Add postcopy tls migration test")
Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20220819053802.296584-5-thuth@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Message-Id: <20220822165608.2980552-6-alex.bennee@linaro.org>

23 months agotests/migration/i386: Speed up the i386 migration test (when using TCG)
Thomas Huth [Mon, 22 Aug 2022 16:56:06 +0000 (17:56 +0100)]
tests/migration/i386: Speed up the i386 migration test (when using TCG)

When KVM is not available, the i386 migration test also runs in a rather
slow fashion, since the guest code takes a couple of seconds to print
the "B"s on the serial console, and the migration test has to wait for
this each time. Let's increase the frequency here, too, so that the
delays in the migration tests get smaller.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20220819053802.296584-4-thuth@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20220822165608.2980552-5-alex.bennee@linaro.org>

23 months agotests/migration/aarch64: Speed up the aarch64 migration test
Thomas Huth [Mon, 22 Aug 2022 16:56:05 +0000 (17:56 +0100)]
tests/migration/aarch64: Speed up the aarch64 migration test

The migration tests spend a lot of time waiting for a sign of live
of the guest on the serial console. The aarch64 migration code only
outputs "B"s every couple of seconds (at least it takes more than 4
seconds between each characeter on my x86 laptop). There are a lot
of migration tests, and if each test that checks for a successful
migration waits for these characters before and after migration, the
wait time sums up to multiple minutes! Let's use a shorter delay to
speed things up.

While we're at it, also remove a superfluous masking with 0xff - we're
reading and storing bytes, so the upper bits of the register do not
matter anyway.

With these changes, the test runs twice as fast on my laptop, decreasing
the total run time from approx. 8 minutes to only 4 minutes!

Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20220819053802.296584-3-thuth@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20220822165608.2980552-4-alex.bennee@linaro.org>

23 months agotests/qtest/migration-test: Only wait for serial output where migration succeeds
Thomas Huth [Mon, 22 Aug 2022 16:56:04 +0000 (17:56 +0100)]
tests/qtest/migration-test: Only wait for serial output where migration succeeds

Waiting for the serial output can take a couple of seconds - and since
we're doing a lot of migration tests, this time easily sums up to
multiple minutes. But if a test is supposed to fail, it does not make
much sense to wait for the source to be in the right state first, so
we can skip the waiting here. This way we can speed up all tests where
the migration is supposed to fail. In the gitlab-CI gprov-gcov test,
each of the migration-tests now run two minutes faster!

Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20220819053802.296584-2-thuth@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Message-Id: <20220822165608.2980552-3-alex.bennee@linaro.org>

23 months agotests/avocado: push default timeout to QemuBaseTest
Alex Bennée [Mon, 22 Aug 2022 16:56:03 +0000 (17:56 +0100)]
tests/avocado: push default timeout to QemuBaseTest

All of the QEMU tests eventually end up derrived from this class. Move
the default timeout from LinuxTest to ensure we catch them all. We
keep the 15 minute timeout as currently some of the more heavyweight
CFI and TCG tests can overrun. We should aim to drop it down to 2
minutes which is a more reasonable target for tests to aim for but we
want to get this release out.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
[AJB: revert to 15 min timeout for v2]
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20220822165608.2980552-2-alex.bennee@linaro.org>

23 months agoMerge tag 'for-upstream' of git://repo.or.cz/qemu/kevin into staging
Richard Henderson [Tue, 23 Aug 2022 17:37:21 +0000 (10:37 -0700)]
Merge tag 'for-upstream' of git://repo.or.cz/qemu/kevin into staging

Block layer patches

- scsi-generic: Fix I/O errors due to wrong block limits

# -----BEGIN PGP SIGNATURE-----
#
# iQJFBAABCAAvFiEE3D3rFZqa+V09dFb+fwmycsiPL9YFAmME3eARHGt3b2xmQHJl
# ZGhhdC5jb20ACgkQfwmycsiPL9avDA//YIJPQDOwiaDaVPY9aqAsnHPvxv/KWwcY
# mNluOhIluRDcXaOuFRNZsL4L69oc7n1dqV1CkKgaYZOLaq0gk6Vt/RyENo5faCoq
# IkGD9PjRoa6heAD0r/xzFUCCszYs2W2xrmK9yX1R9xCtKZ+jbygCNBiDbdigBfi/
# HWL8OZYpnyVXeKmNeqvYHPnfCuCCNpIz0PkyaJ3jE/nsTefrmBHpdyLC0xa953tN
# VaTERnHQyMfFybtri2nTDQgARztRi+3ph1bFV6moxLOpwMb49hdU+2g1VZdcsedL
# XgYWXEJyBRq0KRz1qUbtXO5SRTFpsZFo9cOvWoHA5IrcEHeDpsrZzQ5RsZRoQENx
# GV4DAI3unrwsqSWk682UHHVfIFW1qV1BvueT6MsiobL2pV6+uYPHI1A9XnOzoTRg
# syUoiqvsKDcXATkszxQV+DSRWDsIHo1LS3kSokxwUDp3HhHWhvnUBUww8HkUXxlE
# 7GkMFXkjygAxBekkzIaxNgF7AnGqwrrSUESX+j2S4V5xGFoaZGSWIZIjEyyEBtjc
# YZZoVEPAK3Gg7RMfSsM0obIXZpuiS1okxfb0cm6nHP+VKBdmaa12wFaCkC0TAEzy
# IcZf7Midq/Is5O3uSlreWeFWEyaRDRWe7v4NnZ2qXFqch7Gi3QWDaCDtjnOu+78S
# X/FK3RH+E38=
# =cj4W
# -----END PGP SIGNATURE-----
# gpg: Signature made Tue 23 Aug 2022 07:02:08 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:
  scsi-generic: Fix emulated block limits VPD page

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
23 months agoscsi-generic: Fix emulated block limits VPD page
Kevin Wolf [Mon, 22 Aug 2022 12:53:20 +0000 (14:53 +0200)]
scsi-generic: Fix emulated block limits VPD page

Commits 01ef8185b80 amd 24b36e9813e updated the way that the maximum
transfer length is calculated for patching block limits VPD page in an
INQUIRY response.

The same updates also need to be made for the case where the host device
does not support the block limits VPD page at all and we emulate the
whole page.

Without this fix, on host block devices a maximum transfer length of
(INT_MAX - sector_size) bytes is advertised to the guest, resulting in
I/O errors when a request that exceeds the host limits is made by the
guest. (Prior to commit 24b36e9813e, this code path would use the
max_transfer value from the host instead of INT_MAX, but still miss the
fix from 01ef8185b80 where max_transfer is also capped to max_iov
host pages, so it would be less wrong, but still wrong.)

Cc: qemu-stable@nongnu.org
Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=2096251
Fixes: 01ef8185b809af9d287e1a03a3f9d8ea8231118a
Fixes: 24b36e9813ec15da7db62e3b3621730710c5f020
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20220822125320.48257-1-kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
23 months agoMerge tag 'for-7.1-hppa' of https://github.com/hdeller/qemu-hppa into staging
Richard Henderson [Fri, 19 Aug 2022 16:35:29 +0000 (09:35 -0700)]
Merge tag 'for-7.1-hppa' of https://github.com/hdeller/qemu-hppa into staging

target/hppa: Fix proberi instruction emulation for linux-user

# -----BEGIN PGP SIGNATURE-----
#
# iHUEABYKAB0WIQS86RI+GtKfB8BJu973ErUQojoPXwUCYv+X7AAKCRD3ErUQojoP
# XyGaAQCUaZmTFIEMz7TOjPCz1ix8MaLTrQH8B/gAt3Ss9hXvKgD/ZtOItG3Iz8y0
# tHslvPvJKHlr8s5Ol9rxRPzRG7iigAo=
# =DQho
# -----END PGP SIGNATURE-----
# gpg: Signature made Fri 19 Aug 2022 07:02:20 AM PDT
# gpg:                using EDDSA key BCE9123E1AD29F07C049BBDEF712B510A23A0F5F
# gpg: Good signature from "Helge Deller <deller@gmx.de>" [unknown]
# gpg:                 aka "Helge Deller <deller@kernel.org>" [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: 4544 8228 2CD9 10DB EF3D  25F8 3E5F 3D04 A7A2 4603
#      Subkey fingerprint: BCE9 123E 1AD2 9F07 C049  BBDE F712 B510 A23A 0F5F

* tag 'for-7.1-hppa' of https://github.com/hdeller/qemu-hppa:
  target/hppa: Fix proberi instruction emulation for linux-user

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
23 months 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>
23 months agotarget/hppa: Fix proberi instruction emulation for linux-user
Helge Deller [Tue, 16 Aug 2022 07:58:14 +0000 (09:58 +0200)]
target/hppa: Fix proberi instruction emulation for linux-user

The proberi assembler instruction checks the read/write access rights
for the page of a given address and shall return a value of 1 if the
test succeeds and a value of 0 on failure in the target register.

But when run in linux-user mode, qemu currently simply returns the
return code of page_check_range() which returns 0 on success and -1 on
failure, which is the opposite of what proberi should return.

Fix it by checking the return code of page_check_range() and return the
expected return value.

The easiest way to reproduce the issue is by running
"/lib/ld.so.1 --version" in a chroot which fails without this patch.
At startup of ld.so the __canonicalize_funcptr_for_compare() function is
used to resolve the function address out of a function descriptor, which
fails because proberi (due to the wrong return code) seems to indicate
that the given address isn't accessible.

Signed-off-by: Helge Deller <deller@gmx.de>
23 months 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>
23 months 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>
23 months 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>
23 months 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>
23 months 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>

23 months 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>

23 months 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>

23 months 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>
23 months 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>
23 months 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>
23 months 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>
23 months 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>
23 months 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>
23 months 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>
23 months 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>
23 months 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>
23 months 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>
23 months 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>
23 months 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>