unsigned int s390_cpu_set_state(uint8_t cpu_state, S390CPU *cpu) { trace_cpu_set_state(CPU(cpu)->cpu_index, cpu_state); switch (cpu_state) { case CPU_STATE_STOPPED: case CPU_STATE_CHECK_STOP: /* halt the cpu for common infrastructure */ s390_cpu_halt(cpu); break; case CPU_STATE_OPERATING: case CPU_STATE_LOAD: /* unhalt the cpu for common infrastructure */ s390_cpu_unhalt(cpu); break; default: error_report("Requested CPU state is not a valid S390 CPU state: %u", cpu_state); exit(1); } if (kvm_enabled() && cpu->env.cpu_state != cpu_state) { kvm_s390_set_cpu_state(cpu, cpu_state); } cpu->env.cpu_state = cpu_state; return s390_count_running_cpus(); }
static int cpu_post_load(void *opaque, int version_id) { S390CPU *cpu = opaque; /* * As the cpu state is pushed to kvm via kvm_set_mp_state rather * than via cpu_synchronize_state, we need update kvm here. */ if (kvm_enabled()) { kvm_s390_set_cpu_state(cpu, cpu->env.cpu_state); return kvm_s390_vcpu_interrupt_post_load(cpu); } return 0; }
static int cpu_post_load(void *opaque, int version_id) { S390CPU *cpu = opaque; /* * As the cpu state is pushed to kvm via kvm_set_mp_state rather * than via cpu_synchronize_state, we need update kvm here. */ if (kvm_enabled()) { kvm_s390_set_cpu_state(cpu, cpu->env.cpu_state); return kvm_s390_vcpu_interrupt_post_load(cpu); } if (tcg_enabled()) { /* Rearm the CKC timer if necessary */ tcg_s390_tod_updated(CPU(cpu), RUN_ON_CPU_NULL); } return 0; }