git: 0b4f30c2366c - main - xen/control: introduce xen_pv_shutdown_handler()

Roger Pau Monné royger at FreeBSD.org
Wed Jul 28 15:27:59 UTC 2021


The branch main has been updated by royger:

URL: https://cgit.FreeBSD.org/src/commit/?id=0b4f30c2366c658ea158590cfe621b8229a210e3

commit 0b4f30c2366c658ea158590cfe621b8229a210e3
Author:     Julien Grall <julien at xen.org>
AuthorDate: 2014-04-04 23:52:05 +0000
Commit:     Roger Pau Monné <royger at FreeBSD.org>
CommitDate: 2021-07-28 15:27:04 +0000

    xen/control: introduce xen_pv_shutdown_handler()
    
    While x86 only register PV shutdown handler for PV guests. ARM guests
    are always using HVM and requires the PV shutdown handler.
    
    Submitted by: Elliott Mitchell <ehem+freebsd at m5p.com>
    Reviewed by: royger
    Differential Revision: https://reviews.freebsd.org/D29406
---
 sys/dev/xen/control/control.c | 2 +-
 sys/x86/include/xen/xen-os.h  | 7 +++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/sys/dev/xen/control/control.c b/sys/dev/xen/control/control.c
index 57251a10e6eb..f72193edceea 100644
--- a/sys/dev/xen/control/control.c
+++ b/sys/dev/xen/control/control.c
@@ -446,7 +446,7 @@ xctrl_attach(device_t dev)
 	xctrl->xctrl_watch.max_pending = 1;
 	xs_register_watch(&xctrl->xctrl_watch);
 
-	if (xen_pv_domain())
+	if (xen_pv_shutdown_handler())
 		EVENTHANDLER_REGISTER(shutdown_final, xen_pv_shutdown_final, NULL,
 		                      SHUTDOWN_PRI_LAST);
 
diff --git a/sys/x86/include/xen/xen-os.h b/sys/x86/include/xen/xen-os.h
index 37463a8b069c..5b3b912e0891 100644
--- a/sys/x86/include/xen/xen-os.h
+++ b/sys/x86/include/xen/xen-os.h
@@ -49,6 +49,13 @@ extern int xen_disable_pv_disks;
 /* tunable for disabling PV nics */
 extern int xen_disable_pv_nics;
 
+static inline bool
+xen_pv_shutdown_handler(void)
+{
+
+	return (xen_pv_domain());
+}
+
 static inline bool
 xen_pv_disks_disabled(void)
 {


More information about the dev-commits-src-main mailing list