* [PATCH 1/2] headers: Add pvpanic.h @ 2022-02-21 12:27 zhenwei pi 2022-02-21 12:27 ` [PATCH 2/2] hw/misc/pvpanic: Use standard headers instead zhenwei pi 2022-02-21 15:10 ` [PATCH 1/2] headers: Add pvpanic.h Philippe Mathieu-Daudé 0 siblings, 2 replies; 6+ messages in thread From: zhenwei pi @ 2022-02-21 12:27 UTC (permalink / raw) To: pbonzini, mst; +Cc: qemu-devel, zhenwei pi Since 2020, linux kernel started to export pvpanic.h. Import the latest version from linux into QEMU. Signed-off-by: zhenwei pi <pizhenwei@bytedance.com> --- include/standard-headers/linux/pvpanic.h | 9 +++++++++ scripts/update-linux-headers.sh | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 include/standard-headers/linux/pvpanic.h diff --git a/include/standard-headers/linux/pvpanic.h b/include/standard-headers/linux/pvpanic.h new file mode 100644 index 0000000000..54b7485390 --- /dev/null +++ b/include/standard-headers/linux/pvpanic.h @@ -0,0 +1,9 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ + +#ifndef __PVPANIC_H__ +#define __PVPANIC_H__ + +#define PVPANIC_PANICKED (1 << 0) +#define PVPANIC_CRASH_LOADED (1 << 1) + +#endif /* __PVPANIC_H__ */ diff --git a/scripts/update-linux-headers.sh b/scripts/update-linux-headers.sh index fe850763c5..839a5ec614 100755 --- a/scripts/update-linux-headers.sh +++ b/scripts/update-linux-headers.sh @@ -214,7 +214,8 @@ for i in "$tmpdir"/include/linux/*virtio*.h \ "$tmpdir/include/linux/const.h" \ "$tmpdir/include/linux/kernel.h" \ "$tmpdir/include/linux/vhost_types.h" \ - "$tmpdir/include/linux/sysinfo.h"; do + "$tmpdir/include/linux/sysinfo.h" \ + "$tmpdir/include/misc/pvpanic.h"; do cp_portable "$i" "$output/include/standard-headers/linux" done mkdir -p "$output/include/standard-headers/drm" -- 2.25.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] hw/misc/pvpanic: Use standard headers instead 2022-02-21 12:27 [PATCH 1/2] headers: Add pvpanic.h zhenwei pi @ 2022-02-21 12:27 ` zhenwei pi 2022-02-21 13:32 ` Philippe Mathieu-Daudé 2022-02-21 15:10 ` [PATCH 1/2] headers: Add pvpanic.h Philippe Mathieu-Daudé 1 sibling, 1 reply; 6+ messages in thread From: zhenwei pi @ 2022-02-21 12:27 UTC (permalink / raw) To: pbonzini, mst; +Cc: qemu-devel, zhenwei pi QEMU side has already imported pvpanic.h from linux, remove bit definitions from include/hw/misc/pvpanic.h, and use include/standard-headers/linux/pvpanic.h instead. Also minor changes for PVPANIC_CRASHLOADED -> PVPANIC_CRASH_LOADED. Signed-off-by: zhenwei pi <pizhenwei@bytedance.com> --- hw/misc/pvpanic-isa.c | 4 +++- hw/misc/pvpanic-pci.c | 4 +++- hw/misc/pvpanic.c | 5 +++-- include/hw/misc/pvpanic.h | 8 -------- 4 files changed, 9 insertions(+), 12 deletions(-) diff --git a/hw/misc/pvpanic-isa.c b/hw/misc/pvpanic-isa.c index 7b66d58acc..36bf04c4a0 100644 --- a/hw/misc/pvpanic-isa.c +++ b/hw/misc/pvpanic-isa.c @@ -21,6 +21,7 @@ #include "hw/misc/pvpanic.h" #include "qom/object.h" #include "hw/isa/isa.h" +#include "standard-headers/linux/pvpanic.h" OBJECT_DECLARE_SIMPLE_TYPE(PVPanicISAState, PVPANIC_ISA_DEVICE) @@ -64,7 +65,8 @@ static void pvpanic_isa_realizefn(DeviceState *dev, Error **errp) static Property pvpanic_isa_properties[] = { DEFINE_PROP_UINT16(PVPANIC_IOPORT_PROP, PVPanicISAState, ioport, 0x505), - DEFINE_PROP_UINT8("events", PVPanicISAState, pvpanic.events, PVPANIC_PANICKED | PVPANIC_CRASHLOADED), + DEFINE_PROP_UINT8("events", PVPanicISAState, pvpanic.events, + PVPANIC_PANICKED | PVPANIC_CRASH_LOADED), DEFINE_PROP_END_OF_LIST(), }; diff --git a/hw/misc/pvpanic-pci.c b/hw/misc/pvpanic-pci.c index af8cbe2830..d8fc38c243 100644 --- a/hw/misc/pvpanic-pci.c +++ b/hw/misc/pvpanic-pci.c @@ -21,6 +21,7 @@ #include "hw/misc/pvpanic.h" #include "qom/object.h" #include "hw/pci/pci.h" +#include "standard-headers/linux/pvpanic.h" OBJECT_DECLARE_SIMPLE_TYPE(PVPanicPCIState, PVPANIC_PCI_DEVICE) @@ -53,7 +54,8 @@ static void pvpanic_pci_realizefn(PCIDevice *dev, Error **errp) } static Property pvpanic_pci_properties[] = { - DEFINE_PROP_UINT8("events", PVPanicPCIState, pvpanic.events, PVPANIC_PANICKED | PVPANIC_CRASHLOADED), + DEFINE_PROP_UINT8("events", PVPanicPCIState, pvpanic.events, + PVPANIC_PANICKED | PVPANIC_CRASH_LOADED), DEFINE_PROP_END_OF_LIST(), }; diff --git a/hw/misc/pvpanic.c b/hw/misc/pvpanic.c index e2cb4a5d28..1540e9091a 100644 --- a/hw/misc/pvpanic.c +++ b/hw/misc/pvpanic.c @@ -21,12 +21,13 @@ #include "hw/qdev-properties.h" #include "hw/misc/pvpanic.h" #include "qom/object.h" +#include "standard-headers/linux/pvpanic.h" static void handle_event(int event) { static bool logged; - if (event & ~(PVPANIC_PANICKED | PVPANIC_CRASHLOADED) && !logged) { + if (event & ~(PVPANIC_PANICKED | PVPANIC_CRASH_LOADED) && !logged) { qemu_log_mask(LOG_GUEST_ERROR, "pvpanic: unknown event %#x.\n", event); logged = true; } @@ -36,7 +37,7 @@ static void handle_event(int event) return; } - if (event & PVPANIC_CRASHLOADED) { + if (event & PVPANIC_CRASH_LOADED) { qemu_system_guest_crashloaded(NULL); return; } diff --git a/include/hw/misc/pvpanic.h b/include/hw/misc/pvpanic.h index ca3c5bb533..7f16cc9b16 100644 --- a/include/hw/misc/pvpanic.h +++ b/include/hw/misc/pvpanic.h @@ -22,14 +22,6 @@ #define PVPANIC_IOPORT_PROP "ioport" -/* The bit of supported pv event, TODO: include uapi header and remove this */ -#define PVPANIC_F_PANICKED 0 -#define PVPANIC_F_CRASHLOADED 1 - -/* The pv event value */ -#define PVPANIC_PANICKED (1 << PVPANIC_F_PANICKED) -#define PVPANIC_CRASHLOADED (1 << PVPANIC_F_CRASHLOADED) - /* * PVPanicState for any device type */ -- 2.25.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] hw/misc/pvpanic: Use standard headers instead 2022-02-21 12:27 ` [PATCH 2/2] hw/misc/pvpanic: Use standard headers instead zhenwei pi @ 2022-02-21 13:32 ` Philippe Mathieu-Daudé 2022-02-21 14:11 ` Peter Maydell 0 siblings, 1 reply; 6+ messages in thread From: Philippe Mathieu-Daudé @ 2022-02-21 13:32 UTC (permalink / raw) To: zhenwei pi, pbonzini, mst; +Cc: qemu-devel On 21/2/22 13:27, zhenwei pi wrote: > QEMU side has already imported pvpanic.h from linux, remove bit > definitions from include/hw/misc/pvpanic.h, and use > include/standard-headers/linux/pvpanic.h instead. > Also minor changes for PVPANIC_CRASHLOADED -> PVPANIC_CRASH_LOADED. It seems to fail to build, missing PVPANIC_CRASH_LOADED. On which tree is this patch based? Do we need to run scripts/update-linux-headers.sh before? > Signed-off-by: zhenwei pi <pizhenwei@bytedance.com> > --- > hw/misc/pvpanic-isa.c | 4 +++- > hw/misc/pvpanic-pci.c | 4 +++- > hw/misc/pvpanic.c | 5 +++-- > include/hw/misc/pvpanic.h | 8 -------- > 4 files changed, 9 insertions(+), 12 deletions(-) ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] hw/misc/pvpanic: Use standard headers instead 2022-02-21 13:32 ` Philippe Mathieu-Daudé @ 2022-02-21 14:11 ` Peter Maydell 2022-02-21 14:29 ` Philippe Mathieu-Daudé 0 siblings, 1 reply; 6+ messages in thread From: Peter Maydell @ 2022-02-21 14:11 UTC (permalink / raw) To: Philippe Mathieu-Daudé; +Cc: pbonzini, qemu-devel, zhenwei pi, mst On Mon, 21 Feb 2022 at 13:55, Philippe Mathieu-Daudé <philippe.mathieu.daude@gmail.com> wrote: > > On 21/2/22 13:27, zhenwei pi wrote: > > QEMU side has already imported pvpanic.h from linux, remove bit > > definitions from include/hw/misc/pvpanic.h, and use > > include/standard-headers/linux/pvpanic.h instead. > > Also minor changes for PVPANIC_CRASHLOADED -> PVPANIC_CRASH_LOADED. > > It seems to fail to build, missing PVPANIC_CRASH_LOADED. On which > tree is this patch based? That's in patch 1/2. -- PMM ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] hw/misc/pvpanic: Use standard headers instead 2022-02-21 14:11 ` Peter Maydell @ 2022-02-21 14:29 ` Philippe Mathieu-Daudé 0 siblings, 0 replies; 6+ messages in thread From: Philippe Mathieu-Daudé @ 2022-02-21 14:29 UTC (permalink / raw) To: Peter Maydell; +Cc: pbonzini, qemu-devel, zhenwei pi, mst On 21/2/22 15:11, Peter Maydell wrote: > On Mon, 21 Feb 2022 at 13:55, Philippe Mathieu-Daudé > <philippe.mathieu.daude@gmail.com> wrote: >> >> On 21/2/22 13:27, zhenwei pi wrote: >>> QEMU side has already imported pvpanic.h from linux, remove bit >>> definitions from include/hw/misc/pvpanic.h, and use >>> include/standard-headers/linux/pvpanic.h instead. >>> Also minor changes for PVPANIC_CRASHLOADED -> PVPANIC_CRASH_LOADED. >> >> It seems to fail to build, missing PVPANIC_CRASH_LOADED. On which >> tree is this patch based? > > That's in patch 1/2. Sorry Google Mail is making my life harder, and this series not having a cover letter didn't help. Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] headers: Add pvpanic.h 2022-02-21 12:27 [PATCH 1/2] headers: Add pvpanic.h zhenwei pi 2022-02-21 12:27 ` [PATCH 2/2] hw/misc/pvpanic: Use standard headers instead zhenwei pi @ 2022-02-21 15:10 ` Philippe Mathieu-Daudé 1 sibling, 0 replies; 6+ messages in thread From: Philippe Mathieu-Daudé @ 2022-02-21 15:10 UTC (permalink / raw) To: zhenwei pi, pbonzini, mst; +Cc: qemu-devel On 21/2/22 13:27, zhenwei pi wrote: > Since 2020, linux kernel started to export pvpanic.h. Import the > latest version from linux into QEMU. > > Signed-off-by: zhenwei pi <pizhenwei@bytedance.com> > --- > include/standard-headers/linux/pvpanic.h | 9 +++++++++ > scripts/update-linux-headers.sh | 3 ++- > 2 files changed, 11 insertions(+), 1 deletion(-) > create mode 100644 include/standard-headers/linux/pvpanic.h Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-02-21 15:15 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2022-02-21 12:27 [PATCH 1/2] headers: Add pvpanic.h zhenwei pi 2022-02-21 12:27 ` [PATCH 2/2] hw/misc/pvpanic: Use standard headers instead zhenwei pi 2022-02-21 13:32 ` Philippe Mathieu-Daudé 2022-02-21 14:11 ` Peter Maydell 2022-02-21 14:29 ` Philippe Mathieu-Daudé 2022-02-21 15:10 ` [PATCH 1/2] headers: Add pvpanic.h Philippe Mathieu-Daudé
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).