* [Stable-8.1.5 01/11] block: Fix crash when loading snapshot on inactive node
2024-01-18 12:50 [Stable-8.1.5 00/11] Patch Round-up for stable 8.1.5, freeze on 2024-01-27 Michael Tokarev
@ 2024-01-18 12:50 ` Michael Tokarev
2024-01-18 12:50 ` [Stable-8.1.5 02/11] vl: Improve error message for conflicting -incoming and -loadvm Michael Tokarev
` (9 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Michael Tokarev @ 2024-01-18 12:50 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-stable, Kevin Wolf, Michael Tokarev
From: Kevin Wolf <kwolf@redhat.com>
bdrv_is_read_only() only checks if the node is configured to be
read-only eventually, but even if it returns false, writing to the node
may not be permitted at the moment (because it's inactive).
bdrv_is_writable() checks that the node can be written to right now, and
this is what the snapshot operations really need.
Change bdrv_can_snapshot() to use bdrv_is_writable() to fix crashes like
the following:
$ ./qemu-system-x86_64 -hda /tmp/test.qcow2 -loadvm foo -incoming defer
qemu-system-x86_64: ../block/io.c:1990: int bdrv_co_write_req_prepare(BdrvChild *, int64_t, int64_t, BdrvTrackedRequest *, int): Assertion `!(bs->open_flags & BDRV_O_INACTIVE)' failed.
The resulting error message after this patch isn't perfect yet, but at
least it doesn't crash any more:
$ ./qemu-system-x86_64 -hda /tmp/test.qcow2 -loadvm foo -incoming defer
qemu-system-x86_64: Device 'ide0-hd0' is writable but does not support snapshots
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-ID: <20231201142520.32255-2-kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit d3007d348adaaf04ee8b099a475282034a662414)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
diff --git a/block/snapshot.c b/block/snapshot.c
index e22ac3eac6..86e29ca59f 100644
--- a/block/snapshot.c
+++ b/block/snapshot.c
@@ -190,8 +190,10 @@ static BlockDriverState *bdrv_snapshot_fallback(BlockDriverState *bs)
int bdrv_can_snapshot(BlockDriverState *bs)
{
BlockDriver *drv = bs->drv;
+
GLOBAL_STATE_CODE();
- if (!drv || !bdrv_is_inserted(bs) || bdrv_is_read_only(bs)) {
+
+ if (!drv || !bdrv_is_inserted(bs) || !bdrv_is_writable(bs)) {
return 0;
}
--
2.39.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Stable-8.1.5 02/11] vl: Improve error message for conflicting -incoming and -loadvm
2024-01-18 12:50 [Stable-8.1.5 00/11] Patch Round-up for stable 8.1.5, freeze on 2024-01-27 Michael Tokarev
2024-01-18 12:50 ` [Stable-8.1.5 01/11] block: Fix crash when loading snapshot on inactive node Michael Tokarev
@ 2024-01-18 12:50 ` Michael Tokarev
2024-01-18 12:50 ` [Stable-8.1.5 03/11] iotests: Basic tests for internal snapshots Michael Tokarev
` (8 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Michael Tokarev @ 2024-01-18 12:50 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-stable, Kevin Wolf, Michael Tokarev
From: Kevin Wolf <kwolf@redhat.com>
Currently, the conflict between -incoming and -loadvm is only detected
when loading the snapshot fails because the image is still inactive for
the incoming migration. This results in a suboptimal error message:
$ ./qemu-system-x86_64 -hda /tmp/test.qcow2 -loadvm foo -incoming defer
qemu-system-x86_64: Device 'ide0-hd0' is writable but does not support snapshots
Catch the situation already in qemu_validate_options() to improve the
message:
$ ./qemu-system-x86_64 -hda /tmp/test.qcow2 -loadvm foo -incoming defer
qemu-system-x86_64: 'incoming' and 'loadvm' options are mutually exclusive
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-ID: <20231201142520.32255-3-kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit 5a7f21efaf99c60614fe1967be1c0f9aa46c526e)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
diff --git a/softmmu/vl.c b/softmmu/vl.c
index b0b96f67fa..c9e9ede237 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -2357,6 +2357,10 @@ static void qemu_validate_options(const QDict *machine_opts)
}
}
+ if (loadvm && incoming) {
+ error_report("'incoming' and 'loadvm' options are mutually exclusive");
+ exit(EXIT_FAILURE);
+ }
if (loadvm && preconfig_requested) {
error_report("'preconfig' and 'loadvm' options are "
"mutually exclusive");
--
2.39.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Stable-8.1.5 03/11] iotests: Basic tests for internal snapshots
2024-01-18 12:50 [Stable-8.1.5 00/11] Patch Round-up for stable 8.1.5, freeze on 2024-01-27 Michael Tokarev
2024-01-18 12:50 ` [Stable-8.1.5 01/11] block: Fix crash when loading snapshot on inactive node Michael Tokarev
2024-01-18 12:50 ` [Stable-8.1.5 02/11] vl: Improve error message for conflicting -incoming and -loadvm Michael Tokarev
@ 2024-01-18 12:50 ` Michael Tokarev
2024-01-18 12:50 ` [Stable-8.1.5 04/11] hw/net/can/sja1000: fix bug for single acceptance filter and standard frame Michael Tokarev
` (7 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Michael Tokarev @ 2024-01-18 12:50 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-stable, Kevin Wolf, Michael Tokarev
From: Kevin Wolf <kwolf@redhat.com>
We have a few test cases that include tests for corner case aspects of
internal snapshots, but nothing that tests that they actually function
as snapshots or that involves deleting a snapshot. Add a test for this
kind of basic internal snapshot functionality.
The error cases include a regression test for the crash we just fixed
with snapshot operations on inactive images.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-ID: <20231201142520.32255-4-kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit bb6e2511eb48539b7dcbcb5f47772e156b9c45d1)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
diff --git a/tests/qemu-iotests/tests/qcow2-internal-snapshots b/tests/qemu-iotests/tests/qcow2-internal-snapshots
new file mode 100755
index 0000000000..36523aba06
--- /dev/null
+++ b/tests/qemu-iotests/tests/qcow2-internal-snapshots
@@ -0,0 +1,170 @@
+#!/usr/bin/env bash
+# group: rw quick
+#
+# Test case for internal snapshots in qcow2
+#
+# Copyright (C) 2023 Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+# creator
+owner=kwolf@redhat.com
+
+seq="$(basename $0)"
+echo "QA output created by $seq"
+
+status=1 # failure is the default!
+
+_cleanup()
+{
+ _cleanup_test_img
+}
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+# get standard environment, filters and checks
+. ../common.rc
+. ../common.filter
+
+# This tests qcow2-specific low-level functionality
+_supported_fmt qcow2
+_supported_proto generic
+# Internal snapshots are (currently) impossible with refcount_bits=1,
+# and generally impossible with external data files
+_unsupported_imgopts 'compat=0.10' 'refcount_bits=1[^0-9]' data_file
+
+IMG_SIZE=64M
+
+_qemu()
+{
+ $QEMU -no-shutdown -nographic -monitor stdio -serial none \
+ -blockdev file,filename="$TEST_IMG",node-name=disk0-file \
+ -blockdev "$IMGFMT",file=disk0-file,node-name=disk0 \
+ -object iothread,id=iothread0 \
+ -device virtio-scsi,iothread=iothread0 \
+ -device scsi-hd,drive=disk0,share-rw=on \
+ "$@" 2>&1 |\
+ _filter_qemu | _filter_hmp | _filter_qemu_io
+}
+
+_make_test_img $IMG_SIZE
+
+echo
+echo "=== Write some data, take a snapshot and overwrite part of it ==="
+echo
+
+{
+ echo 'qemu-io disk0 "write -P0x11 0 1M"'
+ # Give qemu some time to boot before saving the VM state
+ sleep 0.5
+ echo "savevm snap0"
+ echo 'qemu-io disk0 "write -P0x22 0 512k"'
+ echo "quit"
+} | _qemu
+
+echo
+$QEMU_IMG snapshot -l "$TEST_IMG" | _filter_date | _filter_vmstate_size
+_check_test_img
+
+echo
+echo "=== Verify that loading the snapshot reverts to the old content ==="
+echo
+
+{
+ # -loadvm reverted the write from the previous QEMU instance
+ echo 'qemu-io disk0 "read -P0x11 0 1M"'
+
+ # Verify that it works without restarting QEMU, too
+ echo 'qemu-io disk0 "write -P0x33 512k 512k"'
+ echo "loadvm snap0"
+ echo 'qemu-io disk0 "read -P0x11 0 1M"'
+
+ # Verify COW by writing a partial cluster
+ echo 'qemu-io disk0 "write -P0x33 63k 2k"'
+ echo 'qemu-io disk0 "read -P0x11 0 63k"'
+ echo 'qemu-io disk0 "read -P0x33 63k 2k"'
+ echo 'qemu-io disk0 "read -P0x11 65k 63k"'
+
+ # Take a second snapshot
+ echo "savevm snap1"
+
+ echo "quit"
+} | _qemu -loadvm snap0
+
+echo
+$QEMU_IMG snapshot -l "$TEST_IMG" | _filter_date | _filter_vmstate_size
+_check_test_img
+
+echo
+echo "=== qemu-img snapshot can revert to snapshots ==="
+echo
+
+$QEMU_IMG snapshot -a snap0 "$TEST_IMG"
+$QEMU_IO -c "read -P0x11 0 1M" "$TEST_IMG" | _filter_qemu_io
+$QEMU_IMG snapshot -a snap1 "$TEST_IMG"
+$QEMU_IO \
+ -c "read -P0x11 0 63k" \
+ -c "read -P0x33 63k 2k" \
+ -c "read -P0x11 65k 63k" \
+ "$TEST_IMG" | _filter_qemu_io
+
+echo
+echo "=== Deleting snapshots ==="
+echo
+{
+ # The active layer stays unaffected by deleting the snapshot
+ echo "delvm snap1"
+ echo 'qemu-io disk0 "read -P0x11 0 63k"'
+ echo 'qemu-io disk0 "read -P0x33 63k 2k"'
+ echo 'qemu-io disk0 "read -P0x11 65k 63k"'
+
+ echo "quit"
+} | _qemu
+
+
+echo
+$QEMU_IMG snapshot -l "$TEST_IMG" | _filter_date | _filter_vmstate_size
+_check_test_img
+
+echo
+echo "=== Error cases ==="
+echo
+
+# snap1 should not exist any more
+_qemu -loadvm snap1
+
+echo
+{
+ echo "loadvm snap1"
+ echo "quit"
+} | _qemu
+
+# Snapshot operations and inactive images are incompatible
+echo
+_qemu -loadvm snap0 -incoming defer
+{
+ echo "loadvm snap0"
+ echo "delvm snap0"
+ echo "savevm snap1"
+ echo "quit"
+} | _qemu -incoming defer
+
+# -loadvm and -preconfig are incompatible
+echo
+_qemu -loadvm snap0 -preconfig
+
+# success, all done
+echo "*** done"
+rm -f $seq.full
+status=0
diff --git a/tests/qemu-iotests/tests/qcow2-internal-snapshots.out b/tests/qemu-iotests/tests/qcow2-internal-snapshots.out
new file mode 100644
index 0000000000..438f535e6a
--- /dev/null
+++ b/tests/qemu-iotests/tests/qcow2-internal-snapshots.out
@@ -0,0 +1,107 @@
+QA output created by qcow2-internal-snapshots
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
+
+=== Write some data, take a snapshot and overwrite part of it ===
+
+QEMU X.Y.Z monitor - type 'help' for more information
+(qemu) qemu-io disk0 "write -P0x11 0 1M"
+wrote 1048576/1048576 bytes at offset 0
+1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+(qemu) savevm snap0
+(qemu) qemu-io disk0 "write -P0x22 0 512k"
+wrote 524288/524288 bytes at offset 0
+512 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+(qemu) quit
+
+Snapshot list:
+ID TAG VM SIZE DATE VM CLOCK ICOUNT
+1 snap0 SIZE yyyy-mm-dd hh:mm:ss 00:00:00.000
+No errors were found on the image.
+
+=== Verify that loading the snapshot reverts to the old content ===
+
+QEMU X.Y.Z monitor - type 'help' for more information
+(qemu) qemu-io disk0 "read -P0x11 0 1M"
+read 1048576/1048576 bytes at offset 0
+1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+(qemu) qemu-io disk0 "write -P0x33 512k 512k"
+wrote 524288/524288 bytes at offset 524288
+512 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+(qemu) loadvm snap0
+(qemu) qemu-io disk0 "read -P0x11 0 1M"
+read 1048576/1048576 bytes at offset 0
+1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+(qemu) qemu-io disk0 "write -P0x33 63k 2k"
+wrote 2048/2048 bytes at offset 64512
+2 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+(qemu) qemu-io disk0 "read -P0x11 0 63k"
+read 64512/64512 bytes at offset 0
+63 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+(qemu) qemu-io disk0 "read -P0x33 63k 2k"
+read 2048/2048 bytes at offset 64512
+2 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+(qemu) qemu-io disk0 "read -P0x11 65k 63k"
+read 64512/64512 bytes at offset 66560
+63 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+(qemu) savevm snap1
+(qemu) quit
+
+Snapshot list:
+ID TAG VM SIZE DATE VM CLOCK ICOUNT
+1 snap0 SIZE yyyy-mm-dd hh:mm:ss 00:00:00.000
+2 snap1 SIZE yyyy-mm-dd hh:mm:ss 00:00:00.000
+No errors were found on the image.
+
+=== qemu-img snapshot can revert to snapshots ===
+
+read 1048576/1048576 bytes at offset 0
+1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+read 64512/64512 bytes at offset 0
+63 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+read 2048/2048 bytes at offset 64512
+2 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+read 64512/64512 bytes at offset 66560
+63 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+
+=== Deleting snapshots ===
+
+QEMU X.Y.Z monitor - type 'help' for more information
+(qemu) delvm snap1
+(qemu) qemu-io disk0 "read -P0x11 0 63k"
+read 64512/64512 bytes at offset 0
+63 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+(qemu) qemu-io disk0 "read -P0x33 63k 2k"
+read 2048/2048 bytes at offset 64512
+2 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+(qemu) qemu-io disk0 "read -P0x11 65k 63k"
+read 64512/64512 bytes at offset 66560
+63 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+(qemu) quit
+
+Snapshot list:
+ID TAG VM SIZE DATE VM CLOCK ICOUNT
+1 snap0 SIZE yyyy-mm-dd hh:mm:ss 00:00:00.000
+No errors were found on the image.
+
+=== Error cases ===
+
+QEMU X.Y.Z monitor - type 'help' for more information
+(qemu) QEMU_PROG: Snapshot 'snap1' does not exist in one or more devices
+
+QEMU X.Y.Z monitor - type 'help' for more information
+(qemu) loadvm snap1
+Error: Snapshot 'snap1' does not exist in one or more devices
+(qemu) quit
+
+QEMU_PROG: 'incoming' and 'loadvm' options are mutually exclusive
+QEMU X.Y.Z monitor - type 'help' for more information
+(qemu) loadvm snap0
+Error: Device 'disk0' is writable but does not support snapshots
+(qemu) delvm snap0
+Error: Device 'disk0' is writable but does not support snapshots
+(qemu) savevm snap1
+Error: Device 'disk0' is writable but does not support snapshots
+(qemu) quit
+
+QEMU_PROG: 'preconfig' and 'loadvm' options are mutually exclusive
+*** done
--
2.39.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Stable-8.1.5 04/11] hw/net/can/sja1000: fix bug for single acceptance filter and standard frame
2024-01-18 12:50 [Stable-8.1.5 00/11] Patch Round-up for stable 8.1.5, freeze on 2024-01-27 Michael Tokarev
` (2 preceding siblings ...)
2024-01-18 12:50 ` [Stable-8.1.5 03/11] iotests: Basic tests for internal snapshots Michael Tokarev
@ 2024-01-18 12:50 ` Michael Tokarev
2024-01-18 12:50 ` [Stable-8.1.5 05/11] target/riscv: Fix mcycle/minstret increment behavior Michael Tokarev
` (6 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Michael Tokarev @ 2024-01-18 12:50 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-stable, Pavel Pisa, Grant Ramsay, Michael Tokarev
From: Pavel Pisa <pisa@cmp.felk.cvut.cz>
A CAN sja1000 standard frame filter mask has been computed and applied
incorrectly for standard frames when single Acceptance Filter Mode
(MOD_AFM = 1) has been selected. The problem has not been found
by Linux kernel testing because it uses dual filter mode (MOD_AFM = 0)
and leaves falters fully open.
The problem has been noticed by Grant Ramsay when testing with Zephyr
RTOS which uses single filter mode.
Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
Reported-by: Grant Ramsay <gramsay@enphaseenergy.com>
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2028
Fixes: 733210e754 ("hw/net/can: SJA1000 chip register level emulation")
Message-ID: <20240103231426.5685-1-pisa@fel.cvut.cz>
(cherry picked from commit 25145a7d7735344a469551946fc2a7f19eb4aa3d)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
diff --git a/hw/net/can/can_sja1000.c b/hw/net/can/can_sja1000.c
index 73201f9139..575df7d2f8 100644
--- a/hw/net/can/can_sja1000.c
+++ b/hw/net/can/can_sja1000.c
@@ -108,7 +108,7 @@ void can_sja_single_filter(struct qemu_can_filter *filter,
}
filter->can_mask = (uint32_t)amr[0] << 3;
- filter->can_mask |= (uint32_t)amr[1] << 5;
+ filter->can_mask |= (uint32_t)amr[1] >> 5;
filter->can_mask = ~filter->can_mask & QEMU_CAN_SFF_MASK;
if (!(amr[1] & 0x10)) {
filter->can_mask |= QEMU_CAN_RTR_FLAG;
--
2.39.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Stable-8.1.5 05/11] target/riscv: Fix mcycle/minstret increment behavior
2024-01-18 12:50 [Stable-8.1.5 00/11] Patch Round-up for stable 8.1.5, freeze on 2024-01-27 Michael Tokarev
` (3 preceding siblings ...)
2024-01-18 12:50 ` [Stable-8.1.5 04/11] hw/net/can/sja1000: fix bug for single acceptance filter and standard frame Michael Tokarev
@ 2024-01-18 12:50 ` Michael Tokarev
2024-01-18 12:50 ` [Stable-8.1.5 06/11] chardev/char.c: fix "abstract device type" error message Michael Tokarev
` (5 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Michael Tokarev @ 2024-01-18 12:50 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-stable, Xu Lu, Daniel Henrique Barboza, Michael Tokarev
From: Xu Lu <luxu.kernel@bytedance.com>
The mcycle/minstret counter's stop flag is mistakenly updated on a copy
on stack. Thus the counter increments even when the CY/IR bit in the
mcountinhibit register is set. This commit corrects its behavior.
Fixes: 3780e33732f88 (target/riscv: Support mcycle/minstret write operation)
Signed-off-by: Xu Lu <luxu.kernel@bytedance.com>
Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
(cherry picked from commit 5cb0e7abe1635cb82e0033260dac2b910d142f8c)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
diff --git a/target/riscv/csr.c b/target/riscv/csr.c
index ea7585329e..cbb73863d6 100644
--- a/target/riscv/csr.c
+++ b/target/riscv/csr.c
@@ -898,11 +898,11 @@ static int write_mhpmcounterh(CPURISCVState *env, int csrno, target_ulong val)
static RISCVException riscv_pmu_read_ctr(CPURISCVState *env, target_ulong *val,
bool upper_half, uint32_t ctr_idx)
{
- PMUCTRState counter = env->pmu_ctrs[ctr_idx];
- target_ulong ctr_prev = upper_half ? counter.mhpmcounterh_prev :
- counter.mhpmcounter_prev;
- target_ulong ctr_val = upper_half ? counter.mhpmcounterh_val :
- counter.mhpmcounter_val;
+ PMUCTRState *counter = &env->pmu_ctrs[ctr_idx];
+ target_ulong ctr_prev = upper_half ? counter->mhpmcounterh_prev :
+ counter->mhpmcounter_prev;
+ target_ulong ctr_val = upper_half ? counter->mhpmcounterh_val :
+ counter->mhpmcounter_val;
if (get_field(env->mcountinhibit, BIT(ctr_idx))) {
/*
@@ -910,12 +910,12 @@ static RISCVException riscv_pmu_read_ctr(CPURISCVState *env, target_ulong *val,
* stop the icount counting. Just return the counter value written by
* the supervisor to indicate that counter was not incremented.
*/
- if (!counter.started) {
+ if (!counter->started) {
*val = ctr_val;
return RISCV_EXCP_NONE;
} else {
/* Mark that the counter has been stopped */
- counter.started = false;
+ counter->started = false;
}
}
--
2.39.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Stable-8.1.5 06/11] chardev/char.c: fix "abstract device type" error message
2024-01-18 12:50 [Stable-8.1.5 00/11] Patch Round-up for stable 8.1.5, freeze on 2024-01-27 Michael Tokarev
` (4 preceding siblings ...)
2024-01-18 12:50 ` [Stable-8.1.5 05/11] target/riscv: Fix mcycle/minstret increment behavior Michael Tokarev
@ 2024-01-18 12:50 ` Michael Tokarev
2024-01-18 12:50 ` [Stable-8.1.5 07/11] hw/intc/arm_gicv3_cpuif: handle LPIs in in the list registers Michael Tokarev
` (4 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Michael Tokarev @ 2024-01-18 12:50 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-stable, Michael Tokarev, Zhao Liu
Current error message:
qemu-system-x86_64: -chardev spice,id=foo: Parameter 'driver' expects an abstract device type
while in fact the meaning is in reverse, -chardev expects
a non-abstract device type.
Fixes: 777357d758d9 ("chardev: qom-ify" 2016-12-07)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
(cherry picked from commit 4ad87cd4b2254197b7ac12e3da824854e6a90f8f)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
diff --git a/chardev/char.c b/chardev/char.c
index 661ad8176a..7bd1b1405c 100644
--- a/chardev/char.c
+++ b/chardev/char.c
@@ -518,7 +518,7 @@ static const ChardevClass *char_get_class(const char *driver, Error **errp)
if (object_class_is_abstract(oc)) {
error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "driver",
- "an abstract device type");
+ "a non-abstract device type");
return NULL;
}
--
2.39.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Stable-8.1.5 07/11] hw/intc/arm_gicv3_cpuif: handle LPIs in in the list registers
2024-01-18 12:50 [Stable-8.1.5 00/11] Patch Round-up for stable 8.1.5, freeze on 2024-01-27 Michael Tokarev
` (5 preceding siblings ...)
2024-01-18 12:50 ` [Stable-8.1.5 06/11] chardev/char.c: fix "abstract device type" error message Michael Tokarev
@ 2024-01-18 12:50 ` Michael Tokarev
2024-01-18 12:50 ` [Stable-8.1.5 08/11] util: fix build with musl libc on ppc64le Michael Tokarev
` (3 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Michael Tokarev @ 2024-01-18 12:50 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-stable, Peter Maydell, Richard Henderson, Miguel Luis,
Michael Tokarev
From: Peter Maydell <peter.maydell@linaro.org>
The hypervisor can deliver (virtual) LPIs to a guest by setting up a
list register to have an intid which is an LPI. The GIC has to treat
these a little differently to standard interrupt IDs, because LPIs
have no Active state, and so the guest will only EOI them, it will
not also deactivate them. So icv_eoir_write() must do two things:
* if the LPI ID is not in any list register, we drop the
priority but do not increment the EOI count
* if the LPI ID is in a list register, we immediately deactivate
it, regardless of the split-drop-and-deactivate control
This can be seen in the VirtualWriteEOIR0() and VirtualWriteEOIR1()
pseudocode in the GICv3 architecture specification.
Without this fix, potentially a hypervisor guest might stall because
LPIs get stuck in a bogus Active+Pending state.
Cc: qemu-stable@nongnu.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Tested-by: Miguel Luis <miguel.luis@oracle.com>
(cherry picked from commit 82a65e3188abebb509510b391726711606aca642)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
diff --git a/hw/intc/arm_gicv3_cpuif.c b/hw/intc/arm_gicv3_cpuif.c
index d07b13eb27..05dcfc4bc3 100644
--- a/hw/intc/arm_gicv3_cpuif.c
+++ b/hw/intc/arm_gicv3_cpuif.c
@@ -1434,16 +1434,25 @@ static void icv_eoir_write(CPUARMState *env, const ARMCPRegInfo *ri,
idx = icv_find_active(cs, irq);
if (idx < 0) {
- /* No valid list register corresponding to EOI ID */
- icv_increment_eoicount(cs);
+ /*
+ * No valid list register corresponding to EOI ID; if this is a vLPI
+ * not in the list regs then do nothing; otherwise increment EOI count
+ */
+ if (irq < GICV3_LPI_INTID_START) {
+ icv_increment_eoicount(cs);
+ }
} else {
uint64_t lr = cs->ich_lr_el2[idx];
int thisgrp = (lr & ICH_LR_EL2_GROUP) ? GICV3_G1NS : GICV3_G0;
int lr_gprio = ich_lr_prio(lr) & icv_gprio_mask(cs, grp);
if (thisgrp == grp && lr_gprio == dropprio) {
- if (!icv_eoi_split(env, cs)) {
- /* Priority drop and deactivate not split: deactivate irq now */
+ if (!icv_eoi_split(env, cs) || irq >= GICV3_LPI_INTID_START) {
+ /*
+ * Priority drop and deactivate not split: deactivate irq now.
+ * LPIs always get their active state cleared immediately
+ * because no separate deactivate is expected.
+ */
icv_deactivate_irq(cs, idx);
}
}
--
2.39.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Stable-8.1.5 08/11] util: fix build with musl libc on ppc64le
2024-01-18 12:50 [Stable-8.1.5 00/11] Patch Round-up for stable 8.1.5, freeze on 2024-01-27 Michael Tokarev
` (6 preceding siblings ...)
2024-01-18 12:50 ` [Stable-8.1.5 07/11] hw/intc/arm_gicv3_cpuif: handle LPIs in in the list registers Michael Tokarev
@ 2024-01-18 12:50 ` Michael Tokarev
2024-01-18 12:50 ` [Stable-8.1.5 09/11] tests/qtest/virtio-ccw: Fix device presence checking Michael Tokarev
` (2 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Michael Tokarev @ 2024-01-18 12:50 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-stable, Natanael Copa, Richard Henderson, Michael Tokarev
From: Natanael Copa <ncopa@alpinelinux.org>
Use PPC_FEATURE2_ISEL and PPC_FEATURE2_VEC_CRYPTO from linux headers
instead of the GNU specific PPC_FEATURE2_HAS_ISEL and
PPC_FEATURE2_HAS_VEC_CRYPTO. This fixes build with musl libc.
Cc: qemu-stable@nongnu.org
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1861
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Fixes: 63922f467a ("tcg/ppc: Replace HAVE_ISEL macro with a variable")
Fixes: 68f340d4cd ("tcg/ppc: Enable Altivec detection")
Message-Id: <20231219105236.7059-1-ncopa@alpinelinux.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
(cherry picked from commit 1d513e06d96697f44de4a1b85c6ff627c443e306)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
diff --git a/util/cpuinfo-ppc.c b/util/cpuinfo-ppc.c
index 7212afa45d..990e62e141 100644
--- a/util/cpuinfo-ppc.c
+++ b/util/cpuinfo-ppc.c
@@ -6,10 +6,10 @@
#include "qemu/osdep.h"
#include "host/cpuinfo.h"
+#include <asm/cputable.h>
#ifdef CONFIG_GETAUXVAL
# include <sys/auxv.h>
#else
-# include <asm/cputable.h>
# include "elf.h"
#endif
@@ -40,7 +40,7 @@ unsigned __attribute__((constructor)) cpuinfo_init(void)
info |= CPUINFO_V2_06;
}
- if (hwcap2 & PPC_FEATURE2_HAS_ISEL) {
+ if (hwcap2 & PPC_FEATURE2_ISEL) {
info |= CPUINFO_ISEL;
}
if (hwcap & PPC_FEATURE_HAS_ALTIVEC) {
@@ -53,7 +53,7 @@ unsigned __attribute__((constructor)) cpuinfo_init(void)
* always have both anyway, since VSX came with Power7
* and crypto came with Power8.
*/
- if (hwcap2 & PPC_FEATURE2_HAS_VEC_CRYPTO) {
+ if (hwcap2 & PPC_FEATURE2_VEC_CRYPTO) {
info |= CPUINFO_CRYPTO;
}
}
--
2.39.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Stable-8.1.5 09/11] tests/qtest/virtio-ccw: Fix device presence checking
2024-01-18 12:50 [Stable-8.1.5 00/11] Patch Round-up for stable 8.1.5, freeze on 2024-01-27 Michael Tokarev
` (7 preceding siblings ...)
2024-01-18 12:50 ` [Stable-8.1.5 08/11] util: fix build with musl libc on ppc64le Michael Tokarev
@ 2024-01-18 12:50 ` Michael Tokarev
2024-01-18 12:50 ` [Stable-8.1.5 10/11] target/s390x: Fix LAE setting a wrong access register Michael Tokarev
2024-01-18 12:50 ` [Stable-8.1.5 11/11] .gitlab-ci.d/buildtest.yml: Work around htags bug when environment is large Michael Tokarev
10 siblings, 0 replies; 12+ messages in thread
From: Michael Tokarev @ 2024-01-18 12:50 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-stable, Samuel Tardieu, Philippe Mathieu-Daudé,
Thomas Huth, Michael Tokarev
From: Samuel Tardieu <sam@rfc1149.net>
An apparent copy-paste error tests for the presence of the
virtio-rng-ccw device in order to perform tests on the virtio-scsi-ccw
device.
Signed-off-by: Samuel Tardieu <sam@rfc1149.net>
Message-ID: <20240106130121.1244993-1-sam@rfc1149.net>
Fixes: 65331bf5d1 ("tests/qtest: Check for virtio-ccw devices before using them")
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Thomas Huth <thuth@redhat.com>
(cherry picked from commit c98873ee4a0c2694aac976ab9affcf55da8b7e61)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
diff --git a/tests/qtest/virtio-ccw-test.c b/tests/qtest/virtio-ccw-test.c
index f4f5858b84..7a5357c212 100644
--- a/tests/qtest/virtio-ccw-test.c
+++ b/tests/qtest/virtio-ccw-test.c
@@ -85,7 +85,7 @@ int main(int argc, char **argv)
if (qtest_has_device("virtio-rng-ccw")) {
qtest_add_func("/virtio/rng/nop", virtio_rng_nop);
}
- if (qtest_has_device("virtio-rng-ccw")) {
+ if (qtest_has_device("virtio-scsi-ccw")) {
qtest_add_func("/virtio/scsi/nop", virtio_scsi_nop);
qtest_add_func("/virtio/scsi/hotplug", virtio_scsi_hotplug);
}
--
2.39.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Stable-8.1.5 10/11] target/s390x: Fix LAE setting a wrong access register
2024-01-18 12:50 [Stable-8.1.5 00/11] Patch Round-up for stable 8.1.5, freeze on 2024-01-27 Michael Tokarev
` (8 preceding siblings ...)
2024-01-18 12:50 ` [Stable-8.1.5 09/11] tests/qtest/virtio-ccw: Fix device presence checking Michael Tokarev
@ 2024-01-18 12:50 ` Michael Tokarev
2024-01-18 12:50 ` [Stable-8.1.5 11/11] .gitlab-ci.d/buildtest.yml: Work around htags bug when environment is large Michael Tokarev
10 siblings, 0 replies; 12+ messages in thread
From: Michael Tokarev @ 2024-01-18 12:50 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-stable, Ilya Leoshkevich, Ido Plat, David Hildenbrand,
Thomas Huth, Michael Tokarev
From: Ilya Leoshkevich <iii@linux.ibm.com>
LAE should set the access register corresponding to the first operand,
instead, it always modifies access register 1.
Co-developed-by: Ido Plat <Ido.Plat@ibm.com>
Cc: qemu-stable@nongnu.org
Fixes: a1c7610a6879 ("target-s390x: implement LAY and LAEY instructions")
Reviewed-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Message-ID: <20240111092328.929421-2-iii@linux.ibm.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
(cherry picked from commit e358a25a97c71c39e3513d9b869cdb82052e50b8)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
(Mjt: target/s390x/tcg/translate.c: fixup for
v8.1.0-1189-gad75a51e84 "tcg: Rename cpu_env to tcg_env")
diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c
index d927e01c0c..b009789281 100644
--- a/target/s390x/tcg/translate.c
+++ b/target/s390x/tcg/translate.c
@@ -3221,6 +3221,7 @@ static DisasJumpType op_mov2e(DisasContext *s, DisasOps *o)
{
int b2 = get_field(s, b2);
TCGv ar1 = tcg_temp_new_i64();
+ int r1 = get_field(s, r1);
o->out = o->in2;
o->in2 = NULL;
@@ -3244,7 +3245,7 @@ static DisasJumpType op_mov2e(DisasContext *s, DisasOps *o)
break;
}
- tcg_gen_st32_i64(ar1, cpu_env, offsetof(CPUS390XState, aregs[1]));
+ tcg_gen_st32_i64(ar1, cpu_env, offsetof(CPUS390XState, aregs[r1]));
return DISAS_NEXT;
}
--
2.39.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Stable-8.1.5 11/11] .gitlab-ci.d/buildtest.yml: Work around htags bug when environment is large
2024-01-18 12:50 [Stable-8.1.5 00/11] Patch Round-up for stable 8.1.5, freeze on 2024-01-27 Michael Tokarev
` (9 preceding siblings ...)
2024-01-18 12:50 ` [Stable-8.1.5 10/11] target/s390x: Fix LAE setting a wrong access register Michael Tokarev
@ 2024-01-18 12:50 ` Michael Tokarev
10 siblings, 0 replies; 12+ messages in thread
From: Michael Tokarev @ 2024-01-18 12:50 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-stable, Peter Maydell, Philippe Mathieu-Daudé,
Thomas Huth, Michael Tokarev
From: Peter Maydell <peter.maydell@linaro.org>
Sometimes the CI "pages" job fails with a message like this from
htags:
$ htags -anT --tree-view=filetree -m qemu_init -t "Welcome to the QEMU sourcecode"
htags: Negative exec line limit = -371
This is due to a bug in hflags where if the environment is too large it
falls over:
https://lists.gnu.org/archive/html/bug-global/2024-01/msg00000.html
This happens to us because GitLab CI puts the commit message of the
commit under test into the CI_COMMIT_MESSAGE and/or CI_COMMIT_TAG_MESSAGE
environment variables, so the job will fail if the commit happens to
have a verbose commit message.
Work around the htags bug by unsetting these variables while running
htags.
Cc: qemu-stable@nongnu.org
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2080
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20240111125543.1573473-1-peter.maydell@linaro.org>
Signed-off-by: Thomas Huth <thuth@redhat.com>
(cherry picked from commit 52a21689cd829c1cc931b59b5ee5bdb10dd578c1)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
diff --git a/.gitlab-ci.d/buildtest.yml b/.gitlab-ci.d/buildtest.yml
index 77dc83a6be..994d1e9149 100644
--- a/.gitlab-ci.d/buildtest.yml
+++ b/.gitlab-ci.d/buildtest.yml
@@ -584,7 +584,10 @@ pages:
- mkdir -p public
# HTML-ised source tree
- make gtags
- - htags -anT --tree-view=filetree -m qemu_init
+ # We unset variables to work around a bug in some htags versions
+ # which causes it to fail when the environment is large
+ - CI_COMMIT_MESSAGE= CI_COMMIT_TAG_MESSAGE= htags
+ -anT --tree-view=filetree -m qemu_init
-t "Welcome to the QEMU sourcecode"
- mv HTML public/src
# Project documentation
--
2.39.2
^ permalink raw reply related [flat|nested] 12+ messages in thread