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@aggios.com>
Signed-off-by: Saeed Nowshadi <saeed.nowshadi@xilinx.com>
Signed-off-by: Mykyta Poturai <mykyta_poturai@epam.com>
Signed-off-by: Mykola Kvach <mykola_kvach@epam.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
This commit is contained in:
Mirela Simonovic authored and Jan Beulich committed 2025-06-04 12:11:40 +02:00
1 parent 461510e87e
commit b48d8bc3e0
3 files changed
+28 -25

No files matched your search

-25
View File
@@ -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;
+25
View File
@@ -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
+3
View File
@@ -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);
/*
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.