From patchwork Mon Jul 6 13:42:52 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Dong, Eddie" X-Patchwork-Id: 34244 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n66DkdgI008236 for ; Mon, 6 Jul 2009 13:46:39 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753102AbZGFNqa (ORCPT ); Mon, 6 Jul 2009 09:46:30 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753188AbZGFNqa (ORCPT ); Mon, 6 Jul 2009 09:46:30 -0400 Received: from mga11.intel.com ([192.55.52.93]:35367 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752428AbZGFNq3 (ORCPT ); Mon, 6 Jul 2009 09:46:29 -0400 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP; 06 Jul 2009 06:38:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.42,356,1243839600"; d="scan'208";a="705334784" Received: from pgsmsx602.gar.corp.intel.com ([10.221.43.81]) by fmsmga001.fm.intel.com with ESMTP; 06 Jul 2009 06:49:51 -0700 Received: from pdsmsx602.ccr.corp.intel.com (172.16.12.184) by pgsmsx602.gar.corp.intel.com (10.221.43.81) with Microsoft SMTP Server (TLS) id 8.1.358.0; Mon, 6 Jul 2009 21:46:31 +0800 Received: from pdsmsx503.ccr.corp.intel.com ([172.16.12.95]) by pdsmsx602.ccr.corp.intel.com ([172.16.12.184]) with mapi; Mon, 6 Jul 2009 21:46:30 +0800 From: "Dong, Eddie" CC: "kvm@vger.kernel.org" , "Dong, Eddie" Date: Mon, 6 Jul 2009 21:42:52 +0800 Subject: EOI acceleration for high bandwidth IO Thread-Topic: EOI acceleration for high bandwidth IO Thread-Index: Acn+MFP0xJWTqoLdT2CLRAxmI8Dd+wADwoSQ Message-ID: <9832F13BD22FB94A829F798DA4A8280501B9CF542E@pdsmsx503.ccr.corp.intel.com> References: <1246872854.11177.1.camel@bl3aed4p.de.ibm.com> <4A51E5AB.7070103@redhat.com> In-Reply-To: <4A51E5AB.7070103@redhat.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: yes X-MS-TNEF-Correlator: acceptlanguage: en-US MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org EOI is one of key VM Exit at high bandwidth IO such as VT-d with 10Gb/s NIC. This patch accelerate guest EOI emulation utilizing HW VM Exit information. Signed-off-by: Eddie Dong diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c index ccafe0d..b63138f 100644 --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c @@ -875,6 +875,15 @@ void kvm_lapic_set_tpr(struct kvm_vcpu *vcpu, unsigned long cr8) | (apic_get_reg(apic, APIC_TASKPRI) & 4)); } +void kvm_lapic_set_eoi(struct kvm_vcpu *vcpu) +{ + struct kvm_lapic *apic = vcpu->arch.apic; + + if (apic) + apic_set_eoi(apic); +} +EXPORT_SYMBOL_GPL(kvm_lapic_set_eoi); + u64 kvm_lapic_get_cr8(struct kvm_vcpu *vcpu) { struct kvm_lapic *apic = vcpu->arch.apic; diff --git a/arch/x86/kvm/lapic.h b/arch/x86/kvm/lapic.h index 40010b0..3a7a29a 100644 --- a/arch/x86/kvm/lapic.h +++ b/arch/x86/kvm/lapic.h @@ -27,6 +27,7 @@ int kvm_get_apic_interrupt(struct kvm_vcpu *vcpu); void kvm_lapic_reset(struct kvm_vcpu *vcpu); u64 kvm_lapic_get_cr8(struct kvm_vcpu *vcpu); void kvm_lapic_set_tpr(struct kvm_vcpu *vcpu, unsigned long cr8); +void kvm_lapic_set_eoi(struct kvm_vcpu *vcpu); void kvm_lapic_set_base(struct kvm_vcpu *vcpu, u64 value); u64 kvm_lapic_get_base(struct kvm_vcpu *vcpu); void kvm_apic_set_version(struct kvm_vcpu *vcpu); diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 3a75db3..6eea29d 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -3125,6 +3125,12 @@ static int handle_apic_access(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) exit_qualification = vmcs_readl(EXIT_QUALIFICATION); offset = exit_qualification & 0xffful; + if ((exit_qualification >> 12) & 0xf == 1 && + offset == APIC_EOI) { /* EOI write */ + kvm_lapic_set_eoi(vcpu); + skip_emulated_instruction(vcpu); + return 1; + } er = emulate_instruction(vcpu, kvm_run, 0, 0, 0);