From patchwork Thu Mar 5 12:12:31 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joerg Roedel X-Patchwork-Id: 10023 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 n25CD9tT021671 for ; Thu, 5 Mar 2009 12:13:09 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754439AbZCEMNH (ORCPT ); Thu, 5 Mar 2009 07:13:07 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753425AbZCEMMz (ORCPT ); Thu, 5 Mar 2009 07:12:55 -0500 Received: from va3ehsobe002.messaging.microsoft.com ([216.32.180.12]:22332 "EHLO VA3EHSOBE002.bigfish.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753133AbZCEMMx (ORCPT ); Thu, 5 Mar 2009 07:12:53 -0500 Received: from mail85-va3-R.bigfish.com (10.7.14.241) by VA3EHSOBE002.bigfish.com (10.7.40.22) with Microsoft SMTP Server id 8.1.340.0; Thu, 5 Mar 2009 12:12:51 +0000 Received: from mail85-va3 (localhost.localdomain [127.0.0.1]) by mail85-va3-R.bigfish.com (Postfix) with ESMTP id 74952D88252; Thu, 5 Mar 2009 12:12:51 +0000 (UTC) X-BigFish: VPS2(zba6izzzzzz32i62h) X-Spam-TCS-SCL: 1:0 X-FB-SS: 5, Received: by mail85-va3 (MessageSwitch) id 1236255169825107_20845; Thu, 5 Mar 2009 12:12:49 +0000 (UCT) Received: from ausb3extmailp01.amd.com (unknown [163.181.251.8]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail85-va3.bigfish.com (Postfix) with ESMTP id B052C178053; Thu, 5 Mar 2009 12:12:49 +0000 (UTC) Received: from ausb3twp02.amd.com ([163.181.250.38]) by ausb3extmailp01.amd.com (Switch-3.2.7/Switch-3.2.7) with ESMTP id n25CCiiS006455; Thu, 5 Mar 2009 06:12:47 -0600 X-WSS-ID: 0KG18L3-02-DEE-01 Received: from sausexbh2.amd.com (SAUSEXBH2.amd.com [163.181.22.102]) by ausb3twp02.amd.com (Tumbleweed MailGate 3.5.1) with ESMTP id 2E75616A03C2; Thu, 5 Mar 2009 06:12:39 -0600 (CST) Received: from sausexmb1.amd.com ([163.181.3.156]) by sausexbh2.amd.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 5 Mar 2009 06:12:44 -0600 Received: from SDRSEXMB1.amd.com ([172.20.3.116]) by sausexmb1.amd.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 5 Mar 2009 06:12:44 -0600 Received: from seurexmb1.amd.com ([165.204.82.130]) by SDRSEXMB1.amd.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 5 Mar 2009 13:12:34 +0100 Received: from lemmy.amd.com ([165.204.85.93]) by seurexmb1.amd.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 5 Mar 2009 13:12:33 +0100 Received: by lemmy.amd.com (Postfix, from userid 41430) id B662D5392D; Thu, 5 Mar 2009 13:12:33 +0100 (CET) From: Joerg Roedel To: Avi Kivity , Marcelo Tosatti CC: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Joerg Roedel Subject: [PATCH 4/6] kvm/x86/mmu: handle invlpg on large pages Date: Thu, 5 Mar 2009 13:12:31 +0100 Message-ID: <1236255153-4432-5-git-send-email-joerg.roedel@amd.com> X-Mailer: git-send-email 1.5.6.4 In-Reply-To: <1236255153-4432-1-git-send-email-joerg.roedel@amd.com> References: <1236255153-4432-1-git-send-email-joerg.roedel@amd.com> X-OriginalArrivalTime: 05 Mar 2009 12:12:33.0796 (UTC) FILETIME=[AA2E8440:01C99D8B] MIME-Version: 1.0 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Signed-off-by: Joerg Roedel --- arch/x86/kvm/paging_tmpl.h | 12 +++++++++--- 1 files changed, 9 insertions(+), 3 deletions(-) diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h index 79668ba..aa79396 100644 --- a/arch/x86/kvm/paging_tmpl.h +++ b/arch/x86/kvm/paging_tmpl.h @@ -441,6 +441,7 @@ out_unlock: static void FNAME(invlpg)(struct kvm_vcpu *vcpu, gva_t gva) { struct kvm_shadow_walk_iterator iterator; + struct kvm_mmu_page *sp; pt_element_t gpte; gpa_t pte_gpa = -1; int level; @@ -451,12 +452,17 @@ static void FNAME(invlpg)(struct kvm_vcpu *vcpu, gva_t gva) for_each_shadow_entry(vcpu, gva, iterator) { level = iterator.level; sptep = iterator.sptep; + sp = page_header(__pa(sptep)); + + if (sp->role.direct) { + /* mapped from a guest's large_pte */ + kvm_mmu_zap_page(vcpu->kvm, sp); + kvm_flush_remote_tlbs(vcpu->kvm); + return; + } - /* FIXME: properly handle invlpg on large guest pages */ if (level == PT_PAGE_TABLE_LEVEL || ((level == PT_DIRECTORY_LEVEL) && is_large_pte(*sptep))) { - struct kvm_mmu_page *sp = page_header(__pa(sptep)); - pte_gpa = (sp->gfn << PAGE_SHIFT); pte_gpa += (sptep - sp->spt) * sizeof(pt_element_t);