From: peterx@redhat.com
To: qemu-devel@nongnu.org
Cc: Eric Auger <eric.auger@redhat.com>,
"Michael S . Tsirkin" <mst@redhat.com>,
Jason Wang <jasowang@redhat.com>,
Alex Williamson <alex.williamson@redhat.com>,
Igor Mammedov <imammedo@redhat.com>,
peterx@redhat.com
Subject: [PATCH 1/4] reset: qemu_register_reset_one()
Date: Wed, 17 Jan 2024 17:15:56 +0800 [thread overview]
Message-ID: <20240117091559.144730-2-peterx@redhat.com> (raw)
In-Reply-To: <20240117091559.144730-1-peterx@redhat.com>
From: Peter Xu <peterx@redhat.com>
Cleanup the code to use a single entrance on register reset hooks.
Signed-off-by: Peter Xu <peterx@redhat.com>
---
hw/core/reset.c | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/hw/core/reset.c b/hw/core/reset.c
index d3263b613e..8cf60b2b09 100644
--- a/hw/core/reset.c
+++ b/hw/core/reset.c
@@ -39,23 +39,26 @@ typedef struct QEMUResetEntry {
static QTAILQ_HEAD(, QEMUResetEntry) reset_handlers =
QTAILQ_HEAD_INITIALIZER(reset_handlers);
-void qemu_register_reset(QEMUResetHandler *func, void *opaque)
+static void qemu_register_reset_one(QEMUResetHandler *func, void *opaque,
+ bool skip_snap)
{
QEMUResetEntry *re = g_new0(QEMUResetEntry, 1);
re->func = func;
re->opaque = opaque;
+ re->skip_on_snapshot_load = skip_snap;
QTAILQ_INSERT_TAIL(&reset_handlers, re, entry);
}
-void qemu_register_reset_nosnapshotload(QEMUResetHandler *func, void *opaque)
+void qemu_register_reset(QEMUResetHandler *func, void *opaque)
{
- QEMUResetEntry *re = g_new0(QEMUResetEntry, 1);
+ /* By default, do not skip during load of a snapshot */
+ qemu_register_reset_one(func, opaque, false);
+}
- re->func = func;
- re->opaque = opaque;
- re->skip_on_snapshot_load = true;
- QTAILQ_INSERT_TAIL(&reset_handlers, re, entry);
+void qemu_register_reset_nosnapshotload(QEMUResetHandler *func, void *opaque)
+{
+ qemu_register_reset_one(func, opaque, true);
}
void qemu_unregister_reset(QEMUResetHandler *func, void *opaque)
--
2.43.0
next prev parent reply other threads:[~2024-01-17 9:17 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-17 9:15 [PATCH 0/4] intel_iommu: Reset vIOMMU after all the rest of devices peterx
2024-01-17 9:15 ` peterx [this message]
2024-01-17 10:29 ` [PATCH 1/4] reset: qemu_register_reset_one() Eric Auger
2024-01-17 9:15 ` [PATCH 2/4] reset: Allow multiple stages of system resets peterx
2024-01-17 10:28 ` Eric Auger
2024-01-17 13:58 ` Cédric Le Goater
2024-01-17 17:46 ` Peter Maydell
2024-01-18 15:53 ` Philippe Mathieu-Daudé
2024-01-18 16:15 ` Peter Maydell
2024-01-19 11:10 ` Peter Xu
2024-01-17 9:15 ` [PATCH 3/4] intel_iommu: Tear down address spaces before IOMMU reset peterx
2024-01-17 10:29 ` Eric Auger
2024-01-18 8:09 ` Philippe Mathieu-Daudé
2024-01-17 9:15 ` [PATCH 4/4] intel_iommu: Reset vIOMMU at the last stage of system reset peterx
2024-01-17 10:38 ` Eric Auger
2024-01-17 10:29 ` [PATCH 0/4] intel_iommu: Reset vIOMMU after all the rest of devices Eric Auger
2024-01-19 10:46 ` Peter Xu
2025-01-23 9:16 ` Eric Auger
2025-01-23 17:57 ` Peter Xu
2025-01-23 18:02 ` Eric Auger
2025-01-29 18:22 ` Eric Auger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240117091559.144730-2-peterx@redhat.com \
--to=peterx@redhat.com \
--cc=alex.williamson@redhat.com \
--cc=eric.auger@redhat.com \
--cc=imammedo@redhat.com \
--cc=jasowang@redhat.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).