From: "Michael S. Tsirkin" <mst@redhat.com>
To: "Thomas Weißschuh" <thomas@t-8ch.de>
Cc: Cornelia Huck <cohuck@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Thomas Huth <thuth@redhat.com>,
Laurent Vivier <lvivier@redhat.com>,
Eric Blake <eblake@redhat.com>,
Markus Armbruster <armbru@redhat.com>,
qemu-devel@nongnu.org,
Alejandro Jimenez <alejandro.j.jimenez@oracle.com>,
kvm@vger.kernel.org
Subject: Re: [PATCH v8 3/8] hw/misc/pvpanic: centralize definition of supported events
Date: Fri, 21 Jun 2024 06:26:19 -0400 [thread overview]
Message-ID: <20240621062512-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20240527-pvpanic-shutdown-v8-3-5a28ec02558b@t-8ch.de>
On Mon, May 27, 2024 at 08:27:49AM +0200, Thomas Weißschuh wrote:
> 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.
>
> Reviewed-by: Thomas Huth <thuth@redhat.com>
> Reviewed-by: Cornelia Huck <cohuck@redhat.com>
> Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
> ---
> hw/misc/pvpanic-isa.c | 3 +--
> hw/misc/pvpanic-pci.c | 3 +--
> hw/misc/pvpanic.c | 3 +--
> include/hw/misc/pvpanic.h | 4 ++++
> 4 files changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/hw/misc/pvpanic-isa.c b/hw/misc/pvpanic-isa.c
> index ccec50f61bbd..9a923b786907 100644
> --- a/hw/misc/pvpanic-isa.c
> +++ b/hw/misc/pvpanic-isa.c
> @@ -21,7 +21,6 @@
> #include "hw/misc/pvpanic.h"
> #include "qom/object.h"
> #include "hw/isa/isa.h"
> -#include "standard-headers/linux/pvpanic.h"
> #include "hw/acpi/acpi_aml_interface.h"
>
> OBJECT_DECLARE_SIMPLE_TYPE(PVPanicISAState, PVPANIC_ISA_DEVICE)
> @@ -102,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 83be95d0d249..603c5c7600da 100644
> --- a/hw/misc/pvpanic-pci.c
> +++ b/hw/misc/pvpanic-pci.c
> @@ -21,7 +21,6 @@
> #include "hw/misc/pvpanic.h"
> #include "qom/object.h"
> #include "hw/pci/pci_device.h"
> -#include "standard-headers/linux/pvpanic.h"
>
> OBJECT_DECLARE_SIMPLE_TYPE(PVPanicPCIState, PVPANIC_PCI_DEVICE)
>
> @@ -55,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 1540e9091a45..a4982cc5928e 100644
> --- a/hw/misc/pvpanic.c
> +++ b/hw/misc/pvpanic.c
> @@ -21,13 +21,12 @@
> #include "hw/qdev-properties.h"
> #include "hw/misc/pvpanic.h"
> #include "qom/object.h"
> -#include "standard-headers/linux/pvpanic.h"
This part is wrong. PVPANIC_PANICKED and PVPANIC_CRASH_LOADED
are still used in pvpanic.c directly, so we should
include standard-headers/linux/pvpanic.h to avoid depending
on which header includes which.
I fixed up the patch.
> 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 fab94165d03d..947468b81b1a 100644
> --- a/include/hw/misc/pvpanic.h
> +++ b/include/hw/misc/pvpanic.h
> @@ -18,6 +18,10 @@
> #include "exec/memory.h"
> #include "qom/object.h"
>
> +#include "standard-headers/linux/pvpanic.h"
> +
> +#define PVPANIC_EVENTS (PVPANIC_PANICKED | PVPANIC_CRASH_LOADED)
> +
> #define TYPE_PVPANIC_ISA_DEVICE "pvpanic"
> #define TYPE_PVPANIC_PCI_DEVICE "pvpanic-pci"
>
>
> --
> 2.45.1
next prev parent reply other threads:[~2024-06-21 10:26 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-27 6:27 [PATCH v8 0/8] update linux headers to v6.10-rc1 and shutdown support for pvpanic Thomas Weißschuh
2024-05-27 6:27 ` [PATCH v8 1/8] scripts/update-linux-headers: Copy setup_data.h to correct directory Thomas Weißschuh
2024-05-27 6:33 ` Thomas Huth
2024-05-27 6:27 ` [PATCH v8 2/8] linux-headers: update to 6.10-rc1 Thomas Weißschuh
2024-05-27 6:27 ` [PATCH v8 3/8] hw/misc/pvpanic: centralize definition of supported events Thomas Weißschuh
2024-06-21 10:26 ` Michael S. Tsirkin [this message]
2024-06-21 10:45 ` Thomas Weißschuh
2024-05-27 6:27 ` [PATCH v8 4/8] tests/qtest/pvpanic: use centralized " Thomas Weißschuh
2024-05-27 6:27 ` [PATCH v8 5/8] hw/misc/pvpanic: add support for normal shutdowns Thomas Weißschuh
2024-05-27 6:27 ` [PATCH v8 6/8] pvpanic: Emit GUEST_PVSHUTDOWN QMP event on pvpanic shutdown signal Thomas Weißschuh
2024-05-27 6:27 ` [PATCH v8 7/8] tests/qtest/pvpanic: add tests for pvshutdown event Thomas Weißschuh
2024-05-27 6:27 ` [PATCH v8 8/8] Revert "docs/specs/pvpanic: mark shutdown event as not implemented" 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=20240621062512-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=alejandro.j.jimenez@oracle.com \
--cc=armbru@redhat.com \
--cc=cohuck@redhat.com \
--cc=eblake@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=lvivier@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=thomas@t-8ch.de \
--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).