From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>,
Eduardo Habkost <eduardo@habkost.net>,
Ani Sinha <anisinha@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Marcel Apfelbaum <marcel.apfelbaum@gmail.com>,
Richard Henderson <richard.henderson@linaro.org>,
Stefano Garzarella <sgarzare@redhat.com>,
Luigi Leonardi <leonardi@redhat.com>,
Oliver Steffen <osteffen@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>
Subject: [PATCH 1/4] igvm: make igvm-cfg object resetable
Date: Tue, 18 Nov 2025 13:21:29 +0100 [thread overview]
Message-ID: <20251118122133.1695767-2-kraxel@redhat.com> (raw)
In-Reply-To: <20251118122133.1695767-1-kraxel@redhat.com>
Add TYPE_RESETTABLE_INTERFACE to interfaces. Register callbacks for the
reset phases. Add trace points for logging and debugging. No
functional change, that will come in followup patches.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
include/system/igvm-cfg.h | 2 ++
backends/igvm-cfg.c | 36 +++++++++++++++++++++++++++++++++++-
backends/trace-events | 5 +++++
3 files changed, 42 insertions(+), 1 deletion(-)
diff --git a/include/system/igvm-cfg.h b/include/system/igvm-cfg.h
index 944f23a814dd..312f77c092b0 100644
--- a/include/system/igvm-cfg.h
+++ b/include/system/igvm-cfg.h
@@ -13,6 +13,7 @@
#define QEMU_IGVM_CFG_H
#include "qom/object.h"
+#include "hw/resettable.h"
typedef struct IgvmCfg {
ObjectClass parent_class;
@@ -23,6 +24,7 @@ typedef struct IgvmCfg {
* format.
*/
char *filename;
+ ResettableState reset_state;
} IgvmCfg;
typedef struct IgvmCfgClass {
diff --git a/backends/igvm-cfg.c b/backends/igvm-cfg.c
index d00acf351249..4e3ef88ffc27 100644
--- a/backends/igvm-cfg.c
+++ b/backends/igvm-cfg.c
@@ -13,8 +13,11 @@
#include "system/igvm-cfg.h"
#include "system/igvm.h"
+#include "system/reset.h"
#include "qom/object_interfaces.h"
+#include "trace.h"
+
static char *get_igvm(Object *obj, Error **errp)
{
IgvmCfg *igvm = IGVM_CFG(obj);
@@ -28,24 +31,55 @@ static void set_igvm(Object *obj, const char *value, Error **errp)
igvm->filename = g_strdup(value);
}
+static ResettableState *igvm_reset_state(Object *obj)
+{
+ IgvmCfg *igvm = IGVM_CFG(obj);
+ return &igvm->reset_state;
+}
+
+static void igvm_reset_enter(Object *obj, ResetType type)
+{
+ trace_igvm_reset_enter(type);
+}
+
+static void igvm_reset_hold(Object *obj, ResetType type)
+{
+ trace_igvm_reset_hold(type);
+}
+
+static void igvm_reset_exit(Object *obj, ResetType type)
+{
+ trace_igvm_reset_exit(type);
+}
+
OBJECT_DEFINE_TYPE_WITH_INTERFACES(IgvmCfg, igvm_cfg, IGVM_CFG, OBJECT,
- { TYPE_USER_CREATABLE }, { NULL })
+ { TYPE_USER_CREATABLE },
+ { TYPE_RESETTABLE_INTERFACE },
+ { NULL })
static void igvm_cfg_class_init(ObjectClass *oc, const void *data)
{
IgvmCfgClass *igvmc = IGVM_CFG_CLASS(oc);
+ ResettableClass *rc = RESETTABLE_CLASS(oc);
object_class_property_add_str(oc, "file", get_igvm, set_igvm);
object_class_property_set_description(oc, "file",
"Set the IGVM filename to use");
igvmc->process = qigvm_process_file;
+
+ rc->get_state = igvm_reset_state;
+ rc->phases.enter = igvm_reset_enter;
+ rc->phases.hold = igvm_reset_hold;
+ rc->phases.exit = igvm_reset_exit;
}
static void igvm_cfg_init(Object *obj)
{
+ qemu_register_resettable(obj);
}
static void igvm_cfg_finalize(Object *obj)
{
+ qemu_unregister_resettable(obj);
}
diff --git a/backends/trace-events b/backends/trace-events
index 56132d3fd22b..45ac46dc2454 100644
--- a/backends/trace-events
+++ b/backends/trace-events
@@ -21,3 +21,8 @@ iommufd_backend_free_id(int iommufd, uint32_t id, int ret) " iommufd=%d id=%d (%
iommufd_backend_set_dirty(int iommufd, uint32_t hwpt_id, bool start, int ret) " iommufd=%d hwpt=%u enable=%d (%d)"
iommufd_backend_get_dirty_bitmap(int iommufd, uint32_t hwpt_id, uint64_t iova, uint64_t size, uint64_t page_size, int ret) " iommufd=%d hwpt=%u iova=0x%"PRIx64" size=0x%"PRIx64" page_size=0x%"PRIx64" (%d)"
iommufd_backend_invalidate_cache(int iommufd, uint32_t id, uint32_t data_type, uint32_t entry_len, uint32_t entry_num, uint32_t done_num, uint64_t data_ptr, int ret) " iommufd=%d id=%u data_type=%u entry_len=%u entry_num=%u done_num=%u data_ptr=0x%"PRIx64" (%d)"
+
+# igvm-cfg.c
+igvm_reset_enter(int type) "type=%u"
+igvm_reset_hold(int type) "type=%u"
+igvm_reset_exit(int type) "type=%u"
--
2.51.1
next prev parent reply other threads:[~2025-11-18 12:22 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-18 12:21 [PATCH 0/4] igvm: rework igvm file loading + processing, fix reset Gerd Hoffmann
2025-11-18 12:21 ` Gerd Hoffmann [this message]
2025-11-21 12:16 ` [PATCH 1/4] igvm: make igvm-cfg object resetable Ani Sinha
2025-11-18 12:21 ` [PATCH 2/4] igvm: move file load to complete callback Gerd Hoffmann
2025-11-21 13:03 ` Ani Sinha
2025-11-18 12:21 ` [PATCH 3/4] igvm: add trace point for igvm file loading and processing Gerd Hoffmann
2025-11-21 13:07 ` Ani Sinha
2025-11-18 12:21 ` [PATCH 4/4] igvm: move igvm file processing to reset callbacks Gerd Hoffmann
2025-11-21 13:48 ` Ani Sinha
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=20251118122133.1695767-2-kraxel@redhat.com \
--to=kraxel@redhat.com \
--cc=anisinha@redhat.com \
--cc=eduardo@habkost.net \
--cc=leonardi@redhat.com \
--cc=marcel.apfelbaum@gmail.com \
--cc=mst@redhat.com \
--cc=osteffen@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=sgarzare@redhat.com \
/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).