mirror of
https://github.com/xen-project/xen.git
synced 2026-10-30 03:00:05 +01:00
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:
1 parent
461510e87e
commit
b48d8bc3e0
3 files changed
+28
-25
No files matched your search
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
/*
|
||||
|
||||