All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Denis V. Lunev" <den@openvz.org>
To: qemu-devel@nongnu.org
Cc: den@openvz.org, Anton Nefedov <anton.nefedov@virtuozzo.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Eric Blake <eblake@redhat.com>
Subject: [Qemu-devel] [PATCH 2/3] qapi: flatten GuestPanicInformation union
Date: Mon, 20 Feb 2017 21:21:54 +0300	[thread overview]
Message-ID: <1487614915-18710-3-git-send-email-den@openvz.org> (raw)
In-Reply-To: <1487614915-18710-1-git-send-email-den@openvz.org>

From: Anton Nefedov <anton.nefedov@virtuozzo.com>

Signed-off-by: Anton Nefedov <anton.nefedov@virtuozzo.com>
Signed-off-by: Denis V. Lunev <den@openvz.org>
CC: Paolo Bonzini <pbonzini@redhat.com>
CC: Eric Blake <eblake@redhat.com>
---
 qapi-schema.json  | 12 ++++++++++++
 target/i386/cpu.c | 15 ++++++---------
 vl.c              | 12 ++++++------
 3 files changed, 24 insertions(+), 15 deletions(-)

diff --git a/qapi-schema.json b/qapi-schema.json
index e9a6364..b142e15 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -5872,6 +5872,16 @@
   'data': [ 'pause', 'poweroff' ] }
 
 ##
+# @GuestPanicInformationType:
+#
+# An enumeration of the guest panic information types
+#
+# Since: 2.9
+##
+{ 'enum': 'GuestPanicInformationType',
+  'data': [ 'hyper-v'] }
+
+##
 # @GuestPanicInformation:
 #
 # Information about a guest panic
@@ -5879,6 +5889,8 @@
 # Since: 2.9
 ##
 {'union': 'GuestPanicInformation',
+ 'base': {'type': 'GuestPanicInformationType'},
+ 'discriminator': 'type',
  'data': { 'hyper-v': 'GuestPanicInformationHyperV' } }
 
 ##
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index fd7add2..63be816 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -3502,19 +3502,16 @@ static GuestPanicInformation *x86_cpu_get_crash_info(CPUState *cs)
     GuestPanicInformation *panic_info = NULL;
 
     if (env->features[FEAT_HYPERV_EDX] & HV_X64_GUEST_CRASH_MSR_AVAILABLE) {
-        GuestPanicInformationHyperV *panic_info_hv =
-            g_malloc0(sizeof(GuestPanicInformationHyperV));
         panic_info = g_malloc0(sizeof(GuestPanicInformation));
 
-        panic_info->type = GUEST_PANIC_INFORMATION_KIND_HYPER_V;
-        panic_info->u.hyper_v.data = panic_info_hv;
+        panic_info->type = GUEST_PANIC_INFORMATION_TYPE_HYPER_V;
 
         assert(HV_X64_MSR_CRASH_PARAMS >= 5);
-        panic_info_hv->arg1 = env->msr_hv_crash_params[0];
-        panic_info_hv->arg2 = env->msr_hv_crash_params[1];
-        panic_info_hv->arg3 = env->msr_hv_crash_params[2];
-        panic_info_hv->arg4 = env->msr_hv_crash_params[3];
-        panic_info_hv->arg5 = env->msr_hv_crash_params[4];
+        panic_info->u.hyper_v.arg1 = env->msr_hv_crash_params[0];
+        panic_info->u.hyper_v.arg2 = env->msr_hv_crash_params[1];
+        panic_info->u.hyper_v.arg3 = env->msr_hv_crash_params[2];
+        panic_info->u.hyper_v.arg4 = env->msr_hv_crash_params[3];
+        panic_info->u.hyper_v.arg5 = env->msr_hv_crash_params[4];
     }
 
     return panic_info;
diff --git a/vl.c b/vl.c
index 81382b6..2781716 100644
--- a/vl.c
+++ b/vl.c
@@ -1682,14 +1682,14 @@ void qemu_system_reset(bool report)
 void qemu_system_guest_panicked(GuestPanicInformation *info)
 {
     qemu_log_mask(LOG_GUEST_ERROR, "Guest crashed\n");
-    if (info && info->type == GUEST_PANIC_INFORMATION_KIND_HYPER_V) {
+    if (info && info->type == GUEST_PANIC_INFORMATION_TYPE_HYPER_V) {
         qemu_log_mask(LOG_GUEST_ERROR, "HV crash parameters: (%#"PRIx64
                       " %#"PRIx64" %#"PRIx64" %#"PRIx64" %#"PRIx64")\n",
-                      info->u.hyper_v.data->arg1,
-                      info->u.hyper_v.data->arg2,
-                      info->u.hyper_v.data->arg3,
-                      info->u.hyper_v.data->arg4,
-                      info->u.hyper_v.data->arg5);
+                      info->u.hyper_v.arg1,
+                      info->u.hyper_v.arg2,
+                      info->u.hyper_v.arg3,
+                      info->u.hyper_v.arg4,
+                      info->u.hyper_v.arg5);
     }
 
     if (current_cpu) {
-- 
2.7.4

  parent reply	other threads:[~2017-02-20 18:22 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-20 18:21 [Qemu-devel] [PATCH for 2.9 0/3] guest panic information follow-up Denis V. Lunev
2017-02-20 18:21 ` [Qemu-devel] [PATCH 1/3] i386/cpu: release GuestPanicInformation memory Denis V. Lunev
2017-02-20 19:42   ` Eric Blake
2017-02-20 18:21 ` Denis V. Lunev [this message]
2017-02-20 19:48   ` [Qemu-devel] [PATCH 2/3] qapi: flatten GuestPanicInformation union Eric Blake
2017-02-20 19:58     ` Denis V. Lunev
2017-02-21  8:15       ` Evgeny Yakovlev
2017-02-20 18:21 ` [Qemu-devel] [PATCH 3/3] qmp-events: fix GUEST_PANICKED description formatting Denis V. Lunev
2017-02-20 19:49   ` Eric Blake
2017-02-21 10:41 ` [Qemu-devel] [PATCH for 2.9 0/3] guest panic information follow-up Paolo Bonzini

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=1487614915-18710-3-git-send-email-den@openvz.org \
    --to=den@openvz.org \
    --cc=anton.nefedov@virtuozzo.com \
    --cc=eblake@redhat.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.