qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Sergio Lopez <slp@redhat.com>
To: f4bug@amsat.org, mjt@tls.msk.ru, pbonzini@redhat.com,
	qemu-devel@nongnu.org
Cc: Sergio Lopez <slp@redhat.com>
Subject: [Qemu-devel] [PATCH 2/2] pvpanic: add PVPANIC_ABORT_PROP
Date: Fri, 29 Dec 2017 10:42:06 +0100	[thread overview]
Message-ID: <20171229094206.14512-3-slp@redhat.com> (raw)
In-Reply-To: <20171229094206.14512-1-slp@redhat.com>

PVPANIC_ABORT_PROP is a boolean to instruct pvpanic to request an
abort() of the process when the Guest signals a panic.

Signed-off-by: Sergio Lopez <slp@redhat.com>
---
 hw/misc/pvpanic.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/hw/misc/pvpanic.c b/hw/misc/pvpanic.c
index 4fb074df06..c901458297 100644
--- a/hw/misc/pvpanic.c
+++ b/hw/misc/pvpanic.c
@@ -28,7 +28,7 @@
 #define ISA_PVPANIC_DEVICE(obj)    \
     OBJECT_CHECK(PVPanicState, (obj), TYPE_PVPANIC)
 
-static void handle_event(int event)
+static void handle_event(int event, bool abort_on_panic)
 {
     static bool logged;
 
@@ -38,7 +38,7 @@ static void handle_event(int event)
     }
 
     if (event & PVPANIC_PANICKED) {
-        qemu_system_guest_panicked(NULL, false);
+        qemu_system_guest_panicked(NULL, abort_on_panic);
         return;
     }
 }
@@ -50,6 +50,7 @@ typedef struct PVPanicState {
 
     MemoryRegion io;
     uint16_t ioport;
+    bool abort_on_panic;
 } PVPanicState;
 
 /* return supported events on read */
@@ -61,7 +62,8 @@ static uint64_t pvpanic_ioport_read(void *opaque, hwaddr addr, unsigned size)
 static void pvpanic_ioport_write(void *opaque, hwaddr addr, uint64_t val,
                                  unsigned size)
 {
-    handle_event(val);
+    PVPanicState *s = opaque;
+    handle_event(val, s->abort_on_panic);
 }
 
 static const MemoryRegionOps pvpanic_ops = {
@@ -100,6 +102,7 @@ static void pvpanic_isa_realizefn(DeviceState *dev, Error **errp)
 }
 
 #define PVPANIC_IOPORT_PROP "ioport"
+#define PVPANIC_ABORT_PROP "abort"
 
 uint16_t pvpanic_port(void)
 {
@@ -112,6 +115,7 @@ uint16_t pvpanic_port(void)
 
 static Property pvpanic_isa_properties[] = {
     DEFINE_PROP_UINT16(PVPANIC_IOPORT_PROP, PVPanicState, ioport, 0x505),
+    DEFINE_PROP_BOOL(PVPANIC_ABORT_PROP, PVPanicState, abort_on_panic, false),
     DEFINE_PROP_END_OF_LIST(),
 };
 
-- 
2.14.3

  parent reply	other threads:[~2017-12-29  9:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-29  9:42 [Qemu-devel] [PATCH 0/2] pvpanic: implement abort_on_panic option Sergio Lopez
2017-12-29  9:42 ` [Qemu-devel] [PATCH 1/2] vl: extend qemu_system_guest_panicked with abort_on_panic Sergio Lopez
2017-12-29  9:42 ` Sergio Lopez [this message]
2018-01-12 16:31 ` [Qemu-devel] [PATCH 0/2] pvpanic: implement abort_on_panic option Sergio Lopez
2018-04-03 15:00   ` Sergio Lopez

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=20171229094206.14512-3-slp@redhat.com \
    --to=slp@redhat.com \
    --cc=f4bug@amsat.org \
    --cc=mjt@tls.msk.ru \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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).