|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen staging] xen/x86: Move freeze/thaw_domains to common code
commit b48d8bc3e002dfe9d3f84b567979103b0c3a7784
Author: Mirela Simonovic <mirela.simonovic@xxxxxxxxxx>
AuthorDate: Wed Jun 4 12:11:40 2025 +0200
Commit: Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Wed Jun 4 12:11:40 2025 +0200
xen/x86: Move freeze/thaw_domains to common code
The freeze_domains and thaw_domains functions are currently defined
in x86-specific suspend code. These functions are also useful on other
architectures, such as ARM, for implementing system-wide suspend and
resume functionality.
This patch moves these functions to common code so they can be reused
across architectures.
Signed-off-by: Mirela Simonovic <mirela.simonovic@xxxxxxxxxx>
Signed-off-by: Saeed Nowshadi <saeed.nowshadi@xxxxxxxxxx>
Signed-off-by: Mykyta Poturai <mykyta_poturai@xxxxxxxx>
Signed-off-by: Mykola Kvach <mykola_kvach@xxxxxxxx>
Acked-by: Jan Beulich <jbeulich@xxxxxxxx>
---
xen/arch/x86/acpi/power.c | 25 -------------------------
xen/common/domain.c | 25 +++++++++++++++++++++++++
xen/include/xen/sched.h | 3 +++
3 files changed, 28 insertions(+), 25 deletions(-)
diff --git a/xen/arch/x86/acpi/power.c b/xen/arch/x86/acpi/power.c
index 448aa9f3a7..2ac162c997 100644
--- a/xen/arch/x86/acpi/power.c
+++ b/xen/arch/x86/acpi/power.c
@@ -138,31 +138,6 @@ static void device_power_up(enum dev_power_saved saved)
}
}
-static void freeze_domains(void)
-{
- struct domain *d;
-
- rcu_read_lock(&domlist_read_lock);
- /*
- * Note that we iterate in order of domain-id. Hence we will pause dom0
- * first which is required for correctness (as only dom0 can add domains to
- * the domain list). Otherwise we could miss concurrently-created domains.
- */
- for_each_domain ( d )
- domain_pause(d);
- rcu_read_unlock(&domlist_read_lock);
-}
-
-static void thaw_domains(void)
-{
- struct domain *d;
-
- rcu_read_lock(&domlist_read_lock);
- for_each_domain ( d )
- domain_unpause(d);
- rcu_read_unlock(&domlist_read_lock);
-}
-
static void acpi_sleep_prepare(u32 state)
{
void *wakeup_vector_va;
diff --git a/xen/common/domain.c b/xen/common/domain.c
index abf1969e60..58c5ffc466 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -2405,6 +2405,31 @@ domid_t get_initial_domain_id(void)
return hardware_domid;
}
+void freeze_domains(void)
+{
+ struct domain *d;
+
+ rcu_read_lock(&domlist_read_lock);
+ /*
+ * Note that we iterate in order of domain-id. Hence we will pause dom0
+ * first which is required for correctness (as only dom0 can add domains to
+ * the domain list). Otherwise we could miss concurrently-created domains.
+ */
+ for_each_domain ( d )
+ domain_pause(d);
+ rcu_read_unlock(&domlist_read_lock);
+}
+
+void thaw_domains(void)
+{
+ struct domain *d;
+
+ rcu_read_lock(&domlist_read_lock);
+ for_each_domain ( d )
+ domain_unpause(d);
+ rcu_read_unlock(&domlist_read_lock);
+}
+
/*
* Local variables:
* mode: C
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index b17aada5f5..62869cf6f2 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -1070,6 +1070,9 @@ static inline struct vcpu *domain_vcpu(const struct
domain *d,
return vcpu_id >= d->max_vcpus ? NULL : d->vcpu[idx];
}
+void freeze_domains(void);
+void thaw_domains(void);
+
void cpu_init(void);
/*
--
generated by git-patchbot for /home/xen/git/xen.git#staging
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |