public inbox for virtualization@lists.linux-foundation.org
 help / color / mirror / Atom feed
From: Alexey Makhalov <alexey.makhalov@broadcom.com>
To: x86@kernel.org, virtualization@lists.linux.dev, bp@alien8.de,
	hpa@zytor.com, dave.hansen@linux.intel.com, mingo@redhat.com,
	tglx@linutronix.de
Cc: ajay.kaher@broadcom.com, brennan.lamoreaux@broadcom.com,
	bo.gan@broadcom.com, bcm-kernel-feedback-list@broadcom.com,
	linux-kernel@vger.kernel.org, kas@kernel.org,
	rick.p.edgecombe@intel.com, linux-coco@lists.linux.dev,
	Alexey Makhalov <alexey.makhalov@broadcom.com>
Subject: [PATCH 3/4] x86/vmware: Report guest crash to the hypervisor
Date: Sat,  7 Mar 2026 00:42:37 +0000	[thread overview]
Message-ID: <20260307004238.1181299-4-alexey.makhalov@broadcom.com> (raw)
In-Reply-To: <20260307004238.1181299-1-alexey.makhalov@broadcom.com>

Register the guest crash reporter to panic_notifier_list,
which will be called at panic time. Guest crash reporter
will report the crash to the hypervisor through
a hypercall.

Co-developed-by: Brennan Lamoreaux <brennan.lamoreaux@broadcom.com>
Signed-off-by: Brennan Lamoreaux <brennan.lamoreaux@broadcom.com>
Signed-off-by: Alexey Makhalov <alexey.makhalov@broadcom.com>
---
 arch/x86/include/asm/vmware.h |  1 +
 arch/x86/kernel/cpu/vmware.c  | 21 +++++++++++++++++++++
 2 files changed, 22 insertions(+)

diff --git a/arch/x86/include/asm/vmware.h b/arch/x86/include/asm/vmware.h
index c23164503e54..bf6141353774 100644
--- a/arch/x86/include/asm/vmware.h
+++ b/arch/x86/include/asm/vmware.h
@@ -97,6 +97,7 @@
 #define VMWARE_CMD_GETHZ		45
 #define VMWARE_CMD_GETVCPU_INFO		68
 #define VMWARE_CMD_STEALCLOCK		91
+#define VMWARE_CMD_REPORTGUESTCRASH	102
 /*
  * Hypercall command mask:
  *   bits [6:0] command, range [0, 127]
diff --git a/arch/x86/kernel/cpu/vmware.c b/arch/x86/kernel/cpu/vmware.c
index d9753b1aba58..8997295a5a5c 100644
--- a/arch/x86/kernel/cpu/vmware.c
+++ b/arch/x86/kernel/cpu/vmware.c
@@ -31,6 +31,7 @@
 #include <linux/static_call.h>
 #include <linux/sched/cputime.h>
 #include <linux/kmsg_dump.h>
+#include <linux/panic_notifier.h>
 #include <asm/div64.h>
 #include <asm/x86_init.h>
 #include <asm/hypervisor.h>
@@ -451,6 +452,24 @@ static void __init vmware_paravirt_ops_setup(void)
 #define vmware_paravirt_ops_setup() do {} while (0)
 #endif
 
+static int vmware_report_guest_crash(struct notifier_block *self,
+				     unsigned long action, void *data)
+{
+	vmware_hypercall1(VMWARE_CMD_REPORTGUESTCRASH, 0);
+	return 0;
+}
+
+static struct notifier_block guest_crash_reporter = {
+	.notifier_call = vmware_report_guest_crash
+};
+
+static int __init register_guest_crash_reporter(void)
+{
+	atomic_notifier_chain_register(&panic_notifier_list,
+					&guest_crash_reporter);
+
+	return 0;
+}
 /*
  * VMware hypervisor takes care of exporting a reliable TSC to the guest.
  * Still, due to timing difference when running on virtual cpus, the TSC can
@@ -545,6 +564,8 @@ static void __init vmware_platform_setup(void)
 	vmware_set_capabilities();
 
 	kmsg_dump_register(&kmsg_dumper);
+
+	register_guest_crash_reporter();
 }
 
 static u8 __init get_hypercall_mode(void)
-- 
2.43.7


  parent reply	other threads:[~2026-03-07  1:06 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-07  0:42 [PATCH 0/4] x86/vmware: Hypercall refactoring and improved guest support Alexey Makhalov
2026-03-07  0:42 ` [PATCH 1/4] x86/vmware: Introduce common vmware_hypercall() Alexey Makhalov
2026-03-07  0:42 ` [PATCH 2/4] x86/vmware: Log kmsg dump on panic Alexey Makhalov
2026-03-07 12:03   ` kernel test robot
2026-03-07 13:26   ` kernel test robot
2026-03-07  0:42 ` Alexey Makhalov [this message]
2026-03-07  0:42 ` [PATCH 4/4] x86/vmware: Support steal time clock for encrypted guests Alexey Makhalov
2026-03-09 23:52 ` [PATCH v2 0/4] x86/vmware: Hypercall refactoring and improved guest support Alexey Makhalov
2026-03-09 23:52   ` [PATCH v2 1/4] x86/vmware: Introduce common vmware_hypercall() Alexey Makhalov
2026-03-09 23:52   ` [PATCH v2 2/4] x86/vmware: Log kmsg dump on panic Alexey Makhalov
2026-03-09 23:52   ` [PATCH v2 3/4] x86/vmware: Report guest crash to the hypervisor Alexey Makhalov
2026-03-09 23:52   ` [PATCH v2 4/4] x86/vmware: Support steal time clock for encrypted guests Alexey Makhalov

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=20260307004238.1181299-4-alexey.makhalov@broadcom.com \
    --to=alexey.makhalov@broadcom.com \
    --cc=ajay.kaher@broadcom.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=bo.gan@broadcom.com \
    --cc=bp@alien8.de \
    --cc=brennan.lamoreaux@broadcom.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=kas@kernel.org \
    --cc=linux-coco@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=rick.p.edgecombe@intel.com \
    --cc=tglx@linutronix.de \
    --cc=virtualization@lists.linux.dev \
    --cc=x86@kernel.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