2 #include "config-host.h"
10 #include <sys/utsname.h>
13 extern kvm_context_t kvm_context
;
15 int kvm_arch_qemu_create_context(void)
20 void kvm_arch_load_regs(CPUState
*env
)
25 void kvm_arch_save_regs(CPUState
*env
)
29 int kvm_arch_qemu_init_env(CPUState
*cenv
)
34 int kvm_arch_halt(void *opaque
, int vcpu
)
36 CPUState
*env
= cpu_single_env
;
37 env
->hflags
|= HF_HALTED_MASK
;
38 env
->exception_index
= EXCP_HLT
;
42 void kvm_arch_pre_kvm_run(void *opaque
, CPUState
*env
)
46 void kvm_arch_post_kvm_run(void *opaque
, CPUState
*env
)
50 int kvm_arch_has_work(CPUState
*env
)
55 int kvm_arch_try_push_interrupts(void *opaque
)
60 void kvm_arch_push_nmi(void *opaque
)
64 void kvm_arch_update_regs_for_sipi(CPUState
*env
)
68 void kvm_save_mpstate(CPUState
*env
)
70 #ifdef KVM_CAP_MP_STATE
72 struct kvm_mp_state mp_state
;
74 r
= kvm_get_mpstate(kvm_context
, env
->cpu_index
, &mp_state
);
78 env
->mp_state
= mp_state
.mp_state
;
82 void kvm_load_mpstate(CPUState
*env
)
84 #ifdef KVM_CAP_MP_STATE
85 struct kvm_mp_state mp_state
= { .mp_state
= env
->mp_state
};
88 * -1 indicates that the host did not support GET_MP_STATE ioctl,
91 if (env
->mp_state
!= -1)
92 kvm_set_mpstate(kvm_context
, env
->cpu_index
, &mp_state
);
96 void kvm_arch_cpu_reset(CPUState
*env
)
98 if (kvm_irqchip_in_kernel(kvm_context
)) {
99 #ifdef KVM_CAP_MP_STATE
100 kvm_reset_mpstate(kvm_context
, env
->cpu_index
);
103 env
->interrupt_request
&= ~CPU_INTERRUPT_HARD
;
105 env
->exception_index
= EXCP_HLT
;
109 void kvm_arch_do_ioperm(void *_data
)
111 struct ioperm_data
*data
= _data
;
112 ioperm(data
->start_port
, data
->num
, data
->turn_on
);