From: "Thomas Weißschuh" <thomas@t-8ch.de>
To: "Michael S. Tsirkin" <mst@redhat.com>,
Cornelia Huck <cohuck@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Thomas Huth <thuth@redhat.com>,
Laurent Vivier <lvivier@redhat.com>
Cc: qemu-devel@nongnu.org, "Thomas Weißschuh" <thomas@t-8ch.de>
Subject: [PATCH v4 2/4] hw/misc/pvpanic: centralize definition of supported events
Date: Sun, 07 Jan 2024 15:05:09 +0100 [thread overview]
Message-ID: <20240107-pvpanic-shutdown-v4-2-81500a7e4081@t-8ch.de> (raw)
In-Reply-To: <20240107-pvpanic-shutdown-v4-0-81500a7e4081@t-8ch.de>
The different components of pvpanic duplicate the list of supported
events. Move it to the shared header file to minimize changes when new
events are added.
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
---
hw/misc/pvpanic-isa.c | 2 +-
hw/misc/pvpanic-pci.c | 2 +-
hw/misc/pvpanic.c | 2 +-
include/hw/misc/pvpanic.h | 1 +
4 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/hw/misc/pvpanic-isa.c b/hw/misc/pvpanic-isa.c
index ef438a31fbe9..9a923b786907 100644
--- a/hw/misc/pvpanic-isa.c
+++ b/hw/misc/pvpanic-isa.c
@@ -101,7 +101,7 @@ static void build_pvpanic_isa_aml(AcpiDevAmlIf *adev, Aml *scope)
static Property pvpanic_isa_properties[] = {
DEFINE_PROP_UINT16(PVPANIC_IOPORT_PROP, PVPanicISAState, ioport, 0x505),
DEFINE_PROP_UINT8("events", PVPanicISAState, pvpanic.events,
- PVPANIC_PANICKED | PVPANIC_CRASH_LOADED),
+ PVPANIC_EVENTS),
DEFINE_PROP_END_OF_LIST(),
};
diff --git a/hw/misc/pvpanic-pci.c b/hw/misc/pvpanic-pci.c
index 01e269b55284..be4063121e1d 100644
--- a/hw/misc/pvpanic-pci.c
+++ b/hw/misc/pvpanic-pci.c
@@ -54,7 +54,7 @@ static void pvpanic_pci_realizefn(PCIDevice *dev, Error **errp)
static Property pvpanic_pci_properties[] = {
DEFINE_PROP_UINT8("events", PVPanicPCIState, pvpanic.events,
- PVPANIC_PANICKED | PVPANIC_CRASH_LOADED),
+ PVPANIC_EVENTS),
DEFINE_PROP_END_OF_LIST(),
};
diff --git a/hw/misc/pvpanic.c b/hw/misc/pvpanic.c
index 4915ef256e74..a4982cc5928e 100644
--- a/hw/misc/pvpanic.c
+++ b/hw/misc/pvpanic.c
@@ -26,7 +26,7 @@ static void handle_event(int event)
{
static bool logged;
- if (event & ~(PVPANIC_PANICKED | PVPANIC_CRASH_LOADED) && !logged) {
+ if (event & ~PVPANIC_EVENTS && !logged) {
qemu_log_mask(LOG_GUEST_ERROR, "pvpanic: unknown event %#x.\n", event);
logged = true;
}
diff --git a/include/hw/misc/pvpanic.h b/include/hw/misc/pvpanic.h
index dffca827f77a..48f2ec4c86a1 100644
--- a/include/hw/misc/pvpanic.h
+++ b/include/hw/misc/pvpanic.h
@@ -20,6 +20,7 @@
#define PVPANIC_PANICKED (1 << 0)
#define PVPANIC_CRASH_LOADED (1 << 1)
+#define PVPANIC_EVENTS (PVPANIC_PANICKED | PVPANIC_CRASH_LOADED)
#define TYPE_PVPANIC_ISA_DEVICE "pvpanic"
#define TYPE_PVPANIC_PCI_DEVICE "pvpanic-pci"
--
2.43.0
next prev parent reply other threads:[~2024-01-07 14:06 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-07 14:05 [PATCH v4 0/4] hw/misc/pvpanic: add support for normal shutdowns Thomas Weißschuh
2024-01-07 14:05 ` [PATCH v4 1/4] linux-headers: drop pvpanic.h Thomas Weißschuh
2024-01-08 11:09 ` Thomas Huth
2024-01-12 9:44 ` Cornelia Huck
2024-01-07 14:05 ` Thomas Weißschuh [this message]
2024-01-08 11:10 ` [PATCH v4 2/4] hw/misc/pvpanic: centralize definition of supported events Thomas Huth
2024-01-12 9:45 ` Cornelia Huck
2024-01-07 14:05 ` [PATCH v4 3/4] tests/qtest/pvpanic: use centralized " Thomas Weißschuh
2024-01-12 9:47 ` Cornelia Huck
2024-01-07 14:05 ` [PATCH v4 4/4] hw/misc/pvpanic: add support for normal shutdowns Thomas Weißschuh
2024-01-12 9:51 ` Cornelia Huck
2024-01-26 18:47 ` Alejandro Jimenez
2024-01-26 21:52 ` Thomas Weißschuh
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=20240107-pvpanic-shutdown-v4-2-81500a7e4081@t-8ch.de \
--to=thomas@t-8ch.de \
--cc=cohuck@redhat.com \
--cc=lvivier@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=thuth@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).