qemu-e2k/docs/devel
Damien Hedde 310616d367 hw/core/resettable: fix reset level counting
The code for handling the reset level count in the Resettable code
has two issues:

The reset count is only decremented for the 1->0 case.  This means
that if there's ever a nested reset that takes the count to 2 then it
will never again be decremented.  Eventually the count will exceed
the '50' limit in resettable_phase_enter() and QEMU will trip over
the assertion failure.  The repro case in issue 1266 is an example of
this that happens now the SCSI subsystem uses three-phase reset.

Secondly, the count is decremented only after the exit phase handler
is called.  Moving the reset count decrement from "just after" to
"just before" calling the exit phase handler allows
resettable_is_in_reset() to return false during the handler
execution.

This simplifies reset handling in resettable devices.  Typically, a
function that updates the device state will just need to read the
current reset state and not anymore treat the "in a reset-exit
transition" as a special case.

Note that the semantics change to the *_is_in_reset() functions
will have no effect on the current codebase, because only two
devices (hw/char/cadence_uart.c and hw/misc/zynq_sclr.c) currently
call those functions, and in neither case do they do it from the
device's exit phase methed.

Fixes: 4a5fc890 ("scsi: Use device_cold_reset() and bus_cold_reset()")
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1266
Signed-off-by: Damien Hedde <damien.hedde@greensocs.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reported-by: Michael Peter <michael.peter@hensoldt-cyber.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-id: 20221020142749.3357951-1-peter.maydell@linaro.org
Buglink: https://bugs.launchpad.net/qemu/+bug/1905297
Reported-by: Michael Peter <michael.peter@hensoldt-cyber.com>
[PMM: adjust the docs paragraph changed to get the name of the
 'enter' phase right and to clarify exactly when the count is
 adjusted; rewrite the commit message]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2022-10-27 10:27:23 +01:00
..
atomics.rst qemu/atomic.h: rename atomic_ to qatomic_ 2020-09-23 16:07:44 +01:00
bitops.rst
blkdebug.txt docs/: fix some comment spelling errors 2020-09-17 20:37:13 +02:00
blkverify.txt
block-coroutine-wrapper.rst scripts: add block-coroutine-wrapper.py 2020-10-05 10:59:06 +01:00
build-system.rst configure: improve error for ucontext coroutine backend 2022-09-01 07:42:37 +02:00
ci-definitions.rst.inc tests/acceptance: rename tests acceptance to tests avocado 2021-11-08 17:00:22 +01:00
ci-jobs.rst.inc docs/devel: clean-up the CI links in the docs 2022-06-01 18:55:04 +01:00
ci-runners.rst.inc docs: name included files ".rst.inc" 2021-10-01 19:04:45 +02:00
ci.rst docs/devel: clean-up the CI links in the docs 2022-06-01 18:55:04 +01:00
clocks.rst clock: Provide builtin multiplier/divider 2021-09-01 11:08:19 +01:00
code-of-conduct.rst docs: link to archived Fedora code of conduct 2021-09-13 13:56:26 +02:00
conflict-resolution.rst docs: Add a QEMU Code of Conduct and Conflict Resolution Policy document 2021-04-01 13:21:02 +02:00
control-flow-integrity.rst Fix typo in CFI build documentation 2021-05-02 17:24:50 +02:00
decodetree.rst decodetree: Extend argument set syntax to allow types 2021-05-01 11:45:35 -07:00
ebpf_rss.rst docs/devel/ebpf_rss.rst: Format literals correctly 2021-08-02 11:42:38 +01:00
fuzzing.rst ui/cocoa: Run qemu_init in the main thread 2022-09-23 14:36:33 +02:00
index-api.rst docs/devel: drop :hidden: and :includehidden: tags 2022-04-20 16:04:20 +01:00
index-build.rst docs/devel: drop :hidden: and :includehidden: tags 2022-04-20 16:04:20 +01:00
index-internals.rst docs/devel: start documenting writing VirtIO devices 2022-05-16 04:38:40 -04:00
index-process.rst docs/devel: drop :hidden: and :includehidden: tags 2022-04-20 16:04:20 +01:00
index-tcg.rst docs: convert docs/devel/replay page to rst 2022-06-06 09:26:53 +02:00
index.rst docs/devel: drop :hidden: and :includehidden: tags 2022-04-20 16:04:20 +01:00
kconfig.rst * More Meson conversions (0.59.x now required rather than suggested) 2022-02-21 17:24:05 +00:00
loads-stores.rst Replace TARGET_WORDS_BIGENDIAN 2022-04-06 10:50:37 +02:00
lockcnt.txt docs: fix references to docs/devel/atomics.rst 2021-06-02 06:51:09 +02:00
memory.rst docs/devel: add some clarifying text for aliases 2022-01-18 12:56:29 +01:00
migration.rst migration: Remove load_state_old and minimum_version_id_old 2022-03-02 18:20:45 +00:00
modules.rst docs: Spell QEMU all caps 2021-11-19 10:16:58 +01:00
multi-process.rst docs: Render binary names as monospaced text 2021-11-22 15:02:38 +01:00
multi-thread-tcg.rst docs: Spell QEMU all caps 2021-11-19 10:16:58 +01:00
multiple-iothreads.txt
qapi-code-gen.rst docs/devel/qapi-code-gen: Belatedly document feature naming rules 2022-05-16 07:29:50 +02:00
qgraph.rst Fix some typos in documentation (found by codespell) 2021-11-22 15:02:38 +01:00
qom.rst misc: fix commonly doubled up words 2022-08-01 11:58:02 +02:00
qtest.rst tests: move libqtest.h back under qtest/ 2022-05-03 15:16:51 +04:00
rcu.txt Docs/RCU: Correct sample code of qatomic_rcu_set 2021-01-12 12:38:03 +01:00
replay.rst docs: move replay docs to docs/system/replay.rst 2022-06-06 09:26:54 +02:00
reset.rst hw/core/resettable: fix reset level counting 2022-10-27 10:27:23 +01:00
s390-dasd-ipl.rst
secure-coding-practices.rst docs/secure-coding-practices: Describe how to use 'null-co' block driver 2021-06-02 14:29:14 +02:00
stable-process.rst docs: Fix botched rST conversion of 'submitting-a-patch.rst' 2021-11-22 15:02:38 +01:00
style.rst doc/style: CLang -> Clang 2022-04-21 17:03:51 +04:00
submitting-a-patch.rst Replace 'whitelist' with 'allow' 2022-07-18 20:24:36 +02:00
submitting-a-pull-request.rst docs: Fix botched rST conversion of 'submitting-a-patch.rst' 2021-11-22 15:02:38 +01:00
tcg-icount.rst tcg: Drop gen_io_end() 2021-09-08 11:09:45 +01:00
tcg-plugins.rst docs/devel: document the test plugins 2022-10-06 11:53:40 +01:00
tcg.rst docs/devel: Explain in more detail the TB chaining mechanisms 2021-06-13 17:42:40 -07:00
testing.rst docs/devel: testing: Document writing portable test cases 2022-09-27 20:51:21 +02:00
tracing.rst docs: trace-events-all is installed without renaming 2022-04-21 17:03:51 +04:00
trivial-patches.rst docs: Fix botched rST conversion of 'submitting-a-patch.rst' 2021-11-22 15:02:38 +01:00
ui.rst docs: Spell QEMU all caps 2021-11-19 10:16:58 +01:00
vfio-migration.rst docs/devel: Add VFIO device migration documentation 2021-06-18 08:38:04 -06:00
virtio-backends.rst docs/devel: start documenting writing VirtIO devices 2022-05-16 04:38:40 -04:00
virtio-migration.txt
writing-monitor-commands.rst monitor: expose monitor_puts to rest of code 2022-10-06 11:53:40 +01:00