[SRU][jammy/linux-aws][PATCH 02/20] UBUNTU: SAUCE: xen/manage: introduce helper function to know the on-going suspend mode
Gerald Yang
gerald.yang at canonical.com
Wed Aug 17 08:51:28 UTC 2022
From: Munehisa Kamata <kamatam at amazon.com>
BugLink: https://bugs.launchpad.net/bugs/1968062
Introduce simple functions which help to know the on-going suspend mode
so that other Xen-related code can behave differently according to the
current suspend mode.
Signed-off-by: Munehisa Kamata <kamatam at amazon.com>
Signed-off-by: Anchal Agarwal <anchalag at amazon.com>
Reviewed-by: Alakesh Haloi <alakeshh at amazon.com>
Reviewed-by: Sebastian Biemueller <sbiemue at amazon.com>
Reviewed-by: Munehisa Kamata <kamatam at amazon.com>
Reviewed-by: Eduardo Valentin <eduval at amazon.com>
CR: https://cr.amazon.com/r/8273190/
(cherry picked from commit 7d04745f53231fcfc934cea2b5ef3cf4f80fb7d4 amazon-5.15.y/mainline)
Signed-off-by: Gerald Yang <gerald.yang at canonical.com>
Signed-off-by: Matthew Ruffell <matthew.ruffell at canonical.com>
---
drivers/xen/manage.c | 15 +++++++++++++++
include/xen/xen-ops.h | 4 ++++
2 files changed, 19 insertions(+)
diff --git a/drivers/xen/manage.c b/drivers/xen/manage.c
index 63abb3ab09af..d1cfbbf56e6e 100644
--- a/drivers/xen/manage.c
+++ b/drivers/xen/manage.c
@@ -51,6 +51,21 @@ enum suspend_modes {
/* Protected by pm_mutex */
static enum suspend_modes suspend_mode = NO_SUSPEND;
+bool xen_suspend_mode_is_xen_suspend(void)
+{
+ return suspend_mode == XEN_SUSPEND;
+}
+
+bool xen_suspend_mode_is_pm_suspend(void)
+{
+ return suspend_mode == PM_SUSPEND;
+}
+
+bool xen_suspend_mode_is_pm_hibernation(void)
+{
+ return suspend_mode == PM_HIBERNATION;
+}
+
struct suspend_info {
int cancelled;
};
diff --git a/include/xen/xen-ops.h b/include/xen/xen-ops.h
index a3584a357f35..8bfbc80d4b53 100644
--- a/include/xen/xen-ops.h
+++ b/include/xen/xen-ops.h
@@ -40,6 +40,10 @@ u64 xen_steal_clock(int cpu);
int xen_setup_shutdown_event(void);
+bool xen_suspend_mode_is_xen_suspend(void);
+bool xen_suspend_mode_is_pm_suspend(void);
+bool xen_suspend_mode_is_pm_hibernation(void);
+
extern unsigned long *xen_contiguous_bitmap;
#if defined(CONFIG_XEN_PV) || defined(CONFIG_ARM) || defined(CONFIG_ARM64)
--
2.34.1
More information about the kernel-team
mailing list