On 08.08.24 17:28, Juraj Marcin wrote:
On Thu, Aug 8, 2024 at 2:18 PM Peter Maydell <peter.mayd...@linaro.org> wrote:
On Tue, 6 Aug 2024 at 17:08, Juraj Marcin <jmar...@redhat.com> wrote:
Some devices need to distinguish cold start reset from waking up from a
suspended state. This patch adds new value to the enum, and updates the
i386 wakeup method to use this new reset type.
Signed-off-by: Juraj Marcin <jmar...@redhat.com>
---
docs/devel/reset.rst | 7 +++++++
hw/i386/pc.c | 2 +-
include/hw/resettable.h | 2 ++
3 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/docs/devel/reset.rst b/docs/devel/reset.rst
index 9746a4e8a0..30c9a0cc2b 100644
--- a/docs/devel/reset.rst
+++ b/docs/devel/reset.rst
@@ -44,6 +44,13 @@ The Resettable interface handles reset types with an enum
``ResetType``:
value on each cold reset, such as RNG seed information, and which they
must not reinitialize on a snapshot-load reset.
+``RESET_TYPE_WAKEUP``
+ This type is used when the machine is woken up from a suspended state (deep
+ sleep, suspend-to-ram). Devices that must not be reset to their initial state
+ after wake-up (for example virtio-mem) can use this state to differentiate
+ cold start from wake-up can use this state to differentiate cold start from
+ wake-up.
I feel like this needs more clarity about what this is, since
as a reset type it's a general behaviour, not a machine
specific one. What exactly is "wakeup" and when does it happen?
How does it differ from what you might call a "warm" reset,
where the user pressed the front-panel reset button?
Why is virtio-mem in particular interesting here?
Thank you for the feedback!
I have rewritten the paragraph:
This type is called for a reset when the system is being woken up from
a suspended state using the ``qemu_system_wakeup()`` function. If the
machine type needs to reset in its ``MachineClass::wakeup()`` method,
this reset type should be used so that devices can differentiate
system wake-up from other reset types. For example, a virtio-mem
device must not unplug its memory during wake-up, as that would clear
the guest RAM.
Is it clearer? Thank you!
Conceptually, if we want to avoid the "WAKEUP" terminology here, maybe
we should consider talking about a WARM reset -- in contrast to a COLD one?
During a WARM reset, memory content is supposed to stay untouched, which
is what we effectively want to achieve with virtio-mem.
Peter, what would be your preference?
--
Cheers,
David / dhildenb