Resend. Privious one forgets to remove debug info. Sorry! Xiantao >From 8c032c78665745ef421a75d2a9465d392f068c93 Mon Sep 17 00:00:00 2001 From: Xiantao Zhang <xiantao.zhang@xxxxxxxxx> Date: Sat, 30 Aug 2008 08:36:03 +0800 Subject: [PATCH] kvm/ia64: Qemu : Add get/set_mpstate for Ipf. Add get/set_mpstate for Ipf. Signed-off-by: Xiantao Zhang <xiantao.zhang@xxxxxxxxx> --- qemu/qemu-kvm-ia64.c | 37 +++++++++++++++++++++++++++++++++++++ qemu/target-ia64/cpu.h | 2 +- qemu/target-ia64/machine.c | 12 ++++++++++++ 3 files changed, 50 insertions(+), 1 deletions(-) diff --git a/qemu/qemu-kvm-ia64.c b/qemu/qemu-kvm-ia64.c index d227d22..042c7ed 100644 --- a/qemu/qemu-kvm-ia64.c +++ b/qemu/qemu-kvm-ia64.c @@ -62,6 +62,43 @@ void kvm_arch_update_regs_for_sipi(CPUState *env) { } +void kvm_save_mpstate(CPUState *env) +{ +#ifdef KVM_CAP_MP_STATE + int r; + struct kvm_mp_state mp_state; + + r = kvm_get_mpstate(kvm_context, env->cpu_index, &mp_state); + if (r < 0) + env->mp_state = -1; + else + env->mp_state = mp_state.mp_state; +#endif +} + +void kvm_load_mpstate(CPUState *env) +{ +#ifdef KVM_CAP_MP_STATE + struct kvm_mp_state mp_state = { .mp_state = env->mp_state }; + + /* + * -1 indicates that the host did not support GET_MP_STATE ioctl, + * so don't touch it. + */ + if (env->mp_state != -1) + kvm_set_mpstate(kvm_context, env->cpu_index, &mp_state); +#endif +} + void kvm_arch_cpu_reset(CPUState *env) { + if (kvm_irqchip_in_kernel(kvm_context)) { +#ifdef KVM_CAP_MP_STATE + kvm_reset_mpstate(kvm_context, env->cpu_index); +#endif + } else { + env->interrupt_request &= ~CPU_INTERRUPT_HARD; + env->halted = 1; + env->exception_index = EXCP_HLT; + } } diff --git a/qemu/target-ia64/cpu.h b/qemu/target-ia64/cpu.h index a3ff7a8..e65e628 100644 --- a/qemu/target-ia64/cpu.h +++ b/qemu/target-ia64/cpu.h @@ -44,7 +44,7 @@ typedef struct CPUIA64State { CPU_COMMON; uint32_t hflags; - + int mp_state; } CPUIA64State; #define CPUState CPUIA64State diff --git a/qemu/target-ia64/machine.c b/qemu/target-ia64/machine.c index 4dc5d5e..a32b01a 100644 --- a/qemu/target-ia64/machine.c +++ b/qemu/target-ia64/machine.c @@ -11,9 +11,21 @@ void register_machines(void) void cpu_save(QEMUFile *f, void *opaque) { + CPUState *env = opaque; + + if (kvm_enabled()) { + kvm_save_registers(env); + kvm_save_mpstate(env); + } } int cpu_load(QEMUFile *f, void *opaque, int version_id) { + CPUState *env = opaque; + + if (kvm_enabled()) { + kvm_load_registers(env); + kvm_load_mpstate(env); + } return 0; } -- 1.5.1
Attachment:
0001-kvm-ia64-Qemu-Add-get-set_mpstate-for-Ipf.patch
Description: 0001-kvm-ia64-Qemu-Add-get-set_mpstate-for-Ipf.patch