mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 15:23:53 -06:00
kvm: support TSC deadline MSR with subsection
KVM add emulation of lapic tsc deadline timer for guest. This patch is co-operation work at qemu side. Use subsections to save/restore the field (mtosatti). Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
This commit is contained in:
parent
38d2c27ea6
commit
aa82ba549a
3 changed files with 37 additions and 0 deletions
|
@ -59,6 +59,7 @@ const KVMCapabilityInfo kvm_arch_required_capabilities[] = {
|
|||
|
||||
static bool has_msr_star;
|
||||
static bool has_msr_hsave_pa;
|
||||
static bool has_msr_tsc_deadline;
|
||||
static bool has_msr_async_pf_en;
|
||||
static int lm_capable_kernel;
|
||||
|
||||
|
@ -568,6 +569,10 @@ static int kvm_get_supported_msrs(KVMState *s)
|
|||
has_msr_hsave_pa = true;
|
||||
continue;
|
||||
}
|
||||
if (kvm_msr_list->indices[i] == MSR_IA32_TSCDEADLINE) {
|
||||
has_msr_tsc_deadline = true;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -881,6 +886,9 @@ static int kvm_put_msrs(CPUState *env, int level)
|
|||
if (has_msr_hsave_pa) {
|
||||
kvm_msr_entry_set(&msrs[n++], MSR_VM_HSAVE_PA, env->vm_hsave);
|
||||
}
|
||||
if (has_msr_tsc_deadline) {
|
||||
kvm_msr_entry_set(&msrs[n++], MSR_IA32_TSCDEADLINE, env->tsc_deadline);
|
||||
}
|
||||
#ifdef TARGET_X86_64
|
||||
if (lm_capable_kernel) {
|
||||
kvm_msr_entry_set(&msrs[n++], MSR_CSTAR, env->cstar);
|
||||
|
@ -1127,6 +1135,9 @@ static int kvm_get_msrs(CPUState *env)
|
|||
if (has_msr_hsave_pa) {
|
||||
msrs[n++].index = MSR_VM_HSAVE_PA;
|
||||
}
|
||||
if (has_msr_tsc_deadline) {
|
||||
msrs[n++].index = MSR_IA32_TSCDEADLINE;
|
||||
}
|
||||
|
||||
if (!env->tsc_valid) {
|
||||
msrs[n++].index = MSR_IA32_TSC;
|
||||
|
@ -1195,6 +1206,9 @@ static int kvm_get_msrs(CPUState *env)
|
|||
case MSR_IA32_TSC:
|
||||
env->tsc = msrs[i].data;
|
||||
break;
|
||||
case MSR_IA32_TSCDEADLINE:
|
||||
env->tsc_deadline = msrs[i].data;
|
||||
break;
|
||||
case MSR_VM_HSAVE_PA:
|
||||
env->vm_hsave = msrs[i].data;
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue