diff options
author | Michael S. Tsirkin <mst@redhat.com> | 2014-05-07 09:29:48 -0400 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2014-05-07 12:00:49 -0400 |
commit | b63cf42fd1d8c18fab71222321aaf356f63089c9 (patch) | |
tree | 6a2f42a81adb0895f6b823c87a8b62700d2f7d82 /arch/x86/kvm | |
parent | 5f7dde7bbb3c628766676cbd63c0a1834035d6fa (diff) |
kvm/x86: implement hv EOI assist
It seems that it's easy to implement the EOI assist
on top of the PV EOI feature: simply convert the
page address to the format expected by PV EOI.
Notes:
-"No EOI required" is set only if interrupt injected
is edge triggered; this is true because level interrupts are going
through IOAPIC which disables PV EOI.
In any case, if guest triggers EOI the bit will get cleared on exit.
-For migration, set of HV_X64_MSR_APIC_ASSIST_PAGE sets
KVM_PV_EOI_EN internally, so restoring HV_X64_MSR_APIC_ASSIST_PAGE
seems sufficient
In any case, bit is cleared on exit so worst case it's never re-enabled
-no handling of PV EOI data is performed at HV_X64_MSR_EOI write;
HV_X64_MSR_EOI is a separate optimization - it's an X2APIC
replacement that lets you do EOI with an MSR and not IO.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch/x86/kvm')
-rw-r--r-- | arch/x86/kvm/x86.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index de0931cb3f58..41f673facf2f 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -1917,6 +1917,8 @@ static int set_msr_hyperv(struct kvm_vcpu *vcpu, u32 msr, u64 data) | |||
1917 | 1917 | ||
1918 | if (!(data & HV_X64_MSR_APIC_ASSIST_PAGE_ENABLE)) { | 1918 | if (!(data & HV_X64_MSR_APIC_ASSIST_PAGE_ENABLE)) { |
1919 | vcpu->arch.hv_vapic = data; | 1919 | vcpu->arch.hv_vapic = data; |
1920 | if (kvm_lapic_enable_pv_eoi(vcpu, 0)) | ||
1921 | return 1; | ||
1920 | break; | 1922 | break; |
1921 | } | 1923 | } |
1922 | gfn = data >> HV_X64_MSR_APIC_ASSIST_PAGE_ADDRESS_SHIFT; | 1924 | gfn = data >> HV_X64_MSR_APIC_ASSIST_PAGE_ADDRESS_SHIFT; |
@@ -1927,6 +1929,8 @@ static int set_msr_hyperv(struct kvm_vcpu *vcpu, u32 msr, u64 data) | |||
1927 | return 1; | 1929 | return 1; |
1928 | vcpu->arch.hv_vapic = data; | 1930 | vcpu->arch.hv_vapic = data; |
1929 | mark_page_dirty(vcpu->kvm, gfn); | 1931 | mark_page_dirty(vcpu->kvm, gfn); |
1932 | if (kvm_lapic_enable_pv_eoi(vcpu, gfn_to_gpa(gfn) | KVM_MSR_ENABLED)) | ||
1933 | return 1; | ||
1930 | break; | 1934 | break; |
1931 | } | 1935 | } |
1932 | case HV_X64_MSR_EOI: | 1936 | case HV_X64_MSR_EOI: |