From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Michael S. Tsirkin" Subject: [PATCH RFC untested] kvm/x86: implement hv EOI assist Date: Sun, 13 Apr 2014 16:10:22 +0300 Message-ID: <20140413131021.GA19125@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: vrozenfe@redhat.com, pbonzini@redhat.com, kvm@vger.kernel.org To: Ronen Hod Return-path: Received: from mx1.redhat.com ([209.132.183.28]:50934 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754100AbaDMNJj (ORCPT ); Sun, 13 Apr 2014 09:09:39 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s3DD9dpl001602 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Sun, 13 Apr 2014 09:09:39 -0400 Content-Disposition: inline Sender: kvm-owner@vger.kernel.org List-ID: 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. Signed-off-by: Michael S. Tsirkin --- Warning: untested! As I'll be off-line for a couple of days, sending this out for early review. Review/comments/flames/testing reports welcome. diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 8ae1ff5..d84d750fc 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -1890,6 +1890,8 @@ static int set_msr_hyperv(struct kvm_vcpu *vcpu, u32 msr, u64 data) if (!(data & HV_X64_MSR_APIC_ASSIST_PAGE_ENABLE)) { vcpu->arch.hv_vapic = data; + if (kvm_lapic_enable_pv_eoi(vcpu, 0)) + return 1; break; } gfn = data >> HV_X64_MSR_APIC_ASSIST_PAGE_ADDRESS_SHIFT; @@ -1900,6 +1902,8 @@ static int set_msr_hyperv(struct kvm_vcpu *vcpu, u32 msr, u64 data) return 1; vcpu->arch.hv_vapic = data; mark_page_dirty(vcpu->kvm, gfn); + if (kvm_lapic_enable_pv_eoi(vcpu, gfn_to_gpa(gfn) | KVM_MSR_ENABLED)) + return 1; break; } case HV_X64_MSR_EOI: