void __init xen_setup_vcpu_info_placement(void) { int cpu; for_each_possible_cpu(cpu) xen_vcpu_setup(cpu); }
static int xen_cpu_up_prepare_hvm(unsigned int cpu) { int rc; /* * This can happen if CPU was offlined earlier and * offlining timed out in common_cpu_die(). */ if (cpu_report_state(cpu) == CPU_DEAD_FROZEN) { xen_smp_intr_free(cpu); xen_uninit_lock_cpu(cpu); } if (cpu_acpi_id(cpu) != U32_MAX) per_cpu(xen_vcpu_id, cpu) = cpu_acpi_id(cpu); else per_cpu(xen_vcpu_id, cpu) = cpu; xen_vcpu_setup(cpu); if (xen_have_vector_callback && xen_feature(XENFEAT_hvm_safe_pvclock)) xen_setup_timer(cpu); rc = xen_smp_intr_init(cpu); if (rc) { WARN(1, "xen_smp_intr_init() for CPU %d failed: %d\n", cpu, rc); return rc; } return 0; }
void xen_setup_vcpu_info_placement(void) { int cpu; for_each_possible_cpu(cpu) xen_vcpu_setup(cpu); if (have_vcpu_info_placement) { pv_irq_ops.save_fl = __PV_IS_CALLEE_SAVE(xen_save_fl_direct); pv_irq_ops.restore_fl = __PV_IS_CALLEE_SAVE(xen_restore_fl_direct); pv_irq_ops.irq_disable = __PV_IS_CALLEE_SAVE(xen_irq_disable_direct); pv_irq_ops.irq_enable = __PV_IS_CALLEE_SAVE(xen_irq_enable_direct); pv_mmu_ops.read_cr2 = xen_read_cr2_direct; } }
/* This is called once we have the cpu_possible_map */ void xen_setup_vcpu_info_placement(void) { int cpu; for_each_possible_cpu(cpu) xen_vcpu_setup(cpu); /* xen_vcpu_setup managed to place the vcpu_info within the percpu area for all cpus, so make use of it */ if (have_vcpu_info_placement) { pv_irq_ops.save_fl = __PV_IS_CALLEE_SAVE(xen_save_fl_direct); pv_irq_ops.restore_fl = __PV_IS_CALLEE_SAVE(xen_restore_fl_direct); pv_irq_ops.irq_disable = __PV_IS_CALLEE_SAVE(xen_irq_disable_direct); pv_irq_ops.irq_enable = __PV_IS_CALLEE_SAVE(xen_irq_enable_direct); pv_mmu_ops.read_cr2 = xen_read_cr2_direct; } }
/* * On restore, set the vcpu placement up again. * If it fails, then we're in a bad state, since * we can't back out from using it... */ void xen_vcpu_restore(void) { int cpu; for_each_online_cpu(cpu) { bool other_cpu = (cpu != smp_processor_id()); if (other_cpu && HYPERVISOR_vcpu_op(VCPUOP_down, cpu, NULL)) BUG(); xen_setup_runstate_info(cpu); if (have_vcpu_info_placement) xen_vcpu_setup(cpu); if (other_cpu && HYPERVISOR_vcpu_op(VCPUOP_up, cpu, NULL)) BUG(); } }