#define cpu_up(x) (-EOPNOTSUPP)
#endif
+#ifdef CONFIG_SMP
static void save_vcpu_context(int vcpu, vcpu_guest_context_t *ctxt)
{
int r;
return 0;
}
+#endif
static int __do_suspend(void *ignore)
{
int i, j;
suspend_record_t *suspend_record;
- static vcpu_guest_context_t suspended_cpu_records[NR_CPUS];
/* Hmmm... a cleaner interface to suspend/resume blkdevs would be nice. */
/* XXX SMH: yes it would :-( */
extern unsigned long max_pfn;
extern unsigned int *pfn_to_mfn_frame_list;
+#ifdef CONFIG_SMP
+ static vcpu_guest_context_t suspended_cpu_records[NR_CPUS];
cpumask_t prev_online_cpus, prev_present_cpus;
+#endif
+
int err = 0;
BUG_ON(smp_processor_id() != 0);
if ( suspend_record == NULL )
goto out;
+ preempt_disable();
+#ifdef CONFIG_SMP
/* Take all of the other cpus offline. We need to be careful not
to get preempted between the final test for num_online_cpus()
== 1 and disabling interrupts, since otherwise userspace could
since by the time num_online_cpus() == 1, there aren't any
other cpus) */
cpus_clear(prev_online_cpus);
- preempt_disable();
while (num_online_cpus() > 1) {
preempt_enable();
for_each_online_cpu(i) {
}
preempt_disable();
}
+#endif
suspend_record->nr_pfns = max_pfn; /* final number of pfns */
preempt_enable();
+#ifdef CONFIG_SMP
cpus_clear(prev_present_cpus);
for_each_present_cpu(i) {
if (i == 0)
save_vcpu_context(i, &suspended_cpu_records[i]);
cpu_set(i, prev_present_cpus);
}
+#endif
#ifdef __i386__
mm_pin_all();
usbif_resume();
- for_each_cpu_mask(i, prev_present_cpus) {
+#ifdef CONFIG_SMP
+ for_each_cpu_mask(i, prev_present_cpus)
restore_vcpu_context(i, &suspended_cpu_records[i]);
- }
+#endif
__sti();
+#ifdef CONFIG_SMP
out_reenable_cpus:
for_each_cpu_mask(i, prev_online_cpus) {
j = cpu_up(i);
err = j;
}
}
+#endif
out:
if ( suspend_record != NULL )