qemu-kvm/kvm-reset-Add-RESET_TYPE_WAKEUP.patch
Jon Maloy eace179c9a * Mon Apr 14 2025 Jon Maloy <jmaloy@redhat.com> - 9.1.0-18
- kvm-virtio-kconfig-memory-devices-are-PCI-only.patch [RHEL-72977]
- kvm-hw-s390-ccw-device-Convert-to-three-phase-reset.patch [RHEL-72977]
- kvm-hw-s390-virtio-ccw-Convert-to-three-phase-reset.patch [RHEL-72977]
- kvm-target-s390-Convert-CPU-to-Resettable-interface.patch [RHEL-72977]
- kvm-reset-Use-ResetType-for-qemu_devices_reset-and-Machi.patch [RHEL-72977]
- kvm-reset-Add-RESET_TYPE_WAKEUP.patch [RHEL-72977]
- kvm-virtio-mem-Use-new-Resettable-framework-instead-of-L.patch [RHEL-72977]
- kvm-virtio-mem-Add-support-for-suspend-wake-up-with-plug.patch [RHEL-72977]
- kvm-virtio-mem-unplug-memory-only-during-system-resets-n.patch [RHEL-72977]
- kvm-s390x-s390-virtio-ccw-don-t-crash-on-weird-RAM-sizes.patch [RHEL-72977]
- kvm-s390x-s390-virtio-hcall-remove-hypercall-registratio.patch [RHEL-72977]
- kvm-s390x-s390-virtio-hcall-prepare-for-more-diag500-hyp.patch [RHEL-72977]
- kvm-s390x-rename-s390-virtio-hcall-to-s390-hypercall.patch [RHEL-72977]
- kvm-s390x-s390-virtio-ccw-move-setting-the-maximum-guest.patch [RHEL-72977]
- kvm-s390x-introduce-s390_get_memory_limit.patch [RHEL-72977]
- kvm-s390x-s390-hypercall-introduce-DIAG500-STORAGE_LIMIT.patch [RHEL-72977]
- kvm-s390x-s390-stattrib-kvm-prepare-for-memory-devices-a.patch [RHEL-72977]
- kvm-s390x-s390-skeys-prepare-for-memory-devices.patch [RHEL-72977]
- kvm-s390x-s390-virtio-ccw-prepare-for-memory-devices.patch [RHEL-72977]
- kvm-s390x-pv-prepare-for-memory-devices.patch [RHEL-72977]
- kvm-s390x-remember-the-maximum-page-size.patch [RHEL-72977]
- kvm-s390x-virtio-ccw-add-support-for-virtio-based-memory.patch [RHEL-72977]
- kvm-s390x-virtio-mem-support.patch [RHEL-72977]
- kvm-hw-virtio-Also-include-md-stubs-in-case-CONFIG_VIRTI.patch [RHEL-72977]
- kvm-virtio-mem-don-t-warn-about-THP-sizes-on-a-kernel-wi.patch [RHEL-72977]
- kvm-redhat-Enable-virtio-mem-on-s390x.patch [RHEL-72977]
- Resolves: RHEL-72977
  ([IBM 9.7 FEAT] KVM: Enable virtio-mem support - qemu part)
2025-04-14 18:57:58 -04:00

95 lines
4.0 KiB
Diff

From 2de79d978c2cd29ad686dd91e74a86dbf2121f1f Mon Sep 17 00:00:00 2001
From: Juraj Marcin <jmarcin@redhat.com>
Date: Wed, 4 Sep 2024 12:37:13 +0200
Subject: [PATCH 06/26] reset: Add RESET_TYPE_WAKEUP
RH-Author: Thomas Huth <thuth@redhat.com>
RH-MergeRequest: 351: Enable virtio-mem support on s390x
RH-Jira: RHEL-72977
RH-Acked-by: David Hildenbrand <david@redhat.com>
RH-Acked-by: Juraj Marcin <None>
RH-Commit: [6/26] 6169fe25bfa5715340c180ee8711d0ad61832106 (thuth/qemu-kvm-cs)
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.
Message-ID: <20240904103722.946194-3-jmarcin@redhat.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Juraj Marcin <jmarcin@redhat.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
(cherry picked from commit 759cbb4ee971da13ddfa8ad73befc2351d542044)
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
docs/devel/reset.rst | 12 +++++++++++-
hw/i386/pc.c | 2 +-
include/hw/resettable.h | 2 ++
3 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/docs/devel/reset.rst b/docs/devel/reset.rst
index d2799eba7a..44bd51b42e 100644
--- a/docs/devel/reset.rst
+++ b/docs/devel/reset.rst
@@ -44,6 +44,17 @@ 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``
+ If the machine supports waking up from a suspended state and needs to reset
+ its devices during wake-up (from the ``MachineClass::wakeup()`` method), this
+ reset type should be used for such a request. Devices can utilize this reset
+ type to differentiate the reset requested during machine wake-up from other
+ reset requests. For example, RAM content must not be lost during wake-up, and
+ memory devices like virtio-mem that provide additional RAM must not reset
+ such state during wake-ups, but might do so during cold resets. However, this
+ reset type should not be used for wake-up detection, as not every machine
+ type issues a device reset request during wake-up.
+
``RESET_TYPE_S390_CPU_NORMAL``
This is only used for S390 CPU objects; it clears interrupts, stops
processing, and clears the TLB, but does not touch register contents.
@@ -53,7 +64,6 @@ The Resettable interface handles reset types with an enum ``ResetType``:
``RESET_TYPE_S390_CPU_NORMAL`` does and also clears the PSW, prefix,
FPC, timer and control registers. It does not touch gprs, fprs or acrs.
-
Devices which implement reset methods must treat any unknown ``ResetType``
as equivalent to ``RESET_TYPE_COLD``; this will reduce the amount of
existing code we need to change if we add more types in future.
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index fedcf2a65f..fa9f16cbaf 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1889,7 +1889,7 @@ static void pc_machine_reset(MachineState *machine, ResetType type)
static void pc_machine_wakeup(MachineState *machine)
{
cpu_synchronize_all_states();
- pc_machine_reset(machine, RESET_TYPE_COLD);
+ pc_machine_reset(machine, RESET_TYPE_WAKEUP);
cpu_synchronize_all_post_reset();
}
diff --git a/include/hw/resettable.h b/include/hw/resettable.h
index 83b561fc83..cf37cd5ead 100644
--- a/include/hw/resettable.h
+++ b/include/hw/resettable.h
@@ -29,6 +29,7 @@ typedef struct ResettableState ResettableState;
* Types of reset.
*
* + Cold: reset resulting from a power cycle of the object.
+ * + Wakeup: reset resulting from a wake-up from a suspended state.
*
* TODO: Support has to be added to handle more types. In particular,
* ResettableState structure needs to be expanded.
@@ -36,6 +37,7 @@ typedef struct ResettableState ResettableState;
typedef enum ResetType {
RESET_TYPE_COLD,
RESET_TYPE_SNAPSHOT_LOAD,
+ RESET_TYPE_WAKEUP,
RESET_TYPE_S390_CPU_INITIAL,
RESET_TYPE_S390_CPU_NORMAL,
} ResetType;
--
2.48.1