diff mbox series

[2/2] hw/misc/pvpanic: Use standard headers instead

Message ID 20220221122717.1371010-2-pizhenwei@bytedance.com
State New
Headers show
Series [1/2] headers: Add pvpanic.h | expand

Commit Message

zhenwei pi Feb. 21, 2022, 12:27 p.m. UTC
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(-)

Comments

Philippe Mathieu-Daudé Feb. 21, 2022, 1:32 p.m. UTC | #1
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(-)
Peter Maydell Feb. 21, 2022, 2:11 p.m. UTC | #2
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
Philippe Mathieu-Daudé Feb. 21, 2022, 2:29 p.m. UTC | #3
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>
diff mbox series

Patch

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
  */