From patchwork Thu May 15 18:27:28 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Smarduch X-Patchwork-Id: 4185051 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 2C4ED9F1C0 for ; Thu, 15 May 2014 18:30:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4DACE20380 for ; Thu, 15 May 2014 18:30:57 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 69DA42034B for ; Thu, 15 May 2014 18:30:56 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Wl0Ow-0002Sz-2h; Thu, 15 May 2014 18:29:06 +0000 Received: from mailout3.w2.samsung.com ([211.189.100.13] helo=usmailout3.samsung.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Wl0Ob-0001cN-HV for linux-arm-kernel@lists.infradead.org; Thu, 15 May 2014 18:28:45 +0000 Received: from uscpsbgex2.samsung.com (u123.gpu85.samsung.co.kr [203.254.195.123]) by usmailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N5M0037LONA3TA0@usmailout3.samsung.com> for linux-arm-kernel@lists.infradead.org; Thu, 15 May 2014 14:28:22 -0400 (EDT) X-AuditID: cbfec37b-b7fc26d0000070ab-0f-537507463c17 Received: from usmmp2.samsung.com ( [203.254.195.78]) by uscpsbgex2.samsung.com (USCPEXMTA) with SMTP id F8.ED.28843.64705735; Thu, 15 May 2014 14:28:22 -0400 (EDT) Received: from sisasmtp.sisa.samsung.com ([105.144.21.116]) by usmmp2.samsung.com (Oracle Communications Messaging Server 7u4-27.01(7.0.4.27.0) 64bit (built Aug 30 2012)) with ESMTP id <0N5M004E3ONAWI30@usmmp2.samsung.com>; Thu, 15 May 2014 14:28:22 -0400 (EDT) Received: from mjsmard-530U3C-530U4C-532U3C.sisa.samsung.com (105.144.129.76) by SISAEX02SJ.sisa.samsung.com (105.144.21.116) with Microsoft SMTP Server (TLS) id 14.1.421.2; Thu, 15 May 2014 11:28:21 -0700 From: Mario Smarduch To: kvmarm@lists.cs.columbia.edu, marc.zyngier@arm.com, christoffer.dall@linaro.org Subject: [PATCH v6 1/4] add ARMv7 HYP API to flush VM TLBs without address param Date: Thu, 15 May 2014 11:27:28 -0700 Message-id: <1400178451-4984-2-git-send-email-m.smarduch@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1400178451-4984-1-git-send-email-m.smarduch@samsung.com> References: <1400178451-4984-1-git-send-email-m.smarduch@samsung.com> MIME-version: 1.0 X-Originating-IP: [105.144.129.76] X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrALMWRmVeSWpSXmKPExsVy+t9hP1039tJgg01tyhYvXv9jtOj9f5HV 4v7V74wWc6YWWnw8dZzdYtPja6wWf+/8Y7OYc+YBi8WkN9uYLD7MWMnowOWxZt4aRo9ZDb1s Hneu7WHzOL9pDbPH5iX1Hn1bVjF6fN4kF8AexWWTkpqTWZZapG+XwJWxZfIG5oKDYhVruu8z NzDeEepi5OSQEDCR+H7kIDOELSZx4d56ti5GLg4hgWWMEquWLWWBcHqZJI7ca2KEcC4ySuw6 cpQJpIVNQFdi/72N7CC2iECoxPW/jUwgRcwCzxklfr19A1YkLBAgcb13FiuIzSKgKrF39zMW EJtXwFWiefc2oN0cQLsVJOZMsgEJcwq4Sfz5eR6sXAio5Mr66awQ5YISPybfYwEpZxaQkHj+ WQmiRFVi283njBBTlCRWHzGfwCg0C0nDLISGBYxMqxjFSouTC4qT0lMrjPSKE3OLS/PS9ZLz czcxQmKlegfj3a82hxgFOBiVeHgdxEqChVgTy4orcw8xSnAwK4nwevwCCvGmJFZWpRblxxeV 5qQWH2Jk4uCUamBs2X9t5ZyGwPPzHx20P9szQ+NSrAVPxUuzoo7Nt09diIuYH/C/7EfYN7kf 3QKfhIvv136aalPOWWz1bPPiZVXyjAdO6AYnTC+R4vdiCH6rFqGRmn1V51zzJKdW1XlZMx62 JBeIf7rL5ikpetOqNe/fRfvJzWH/XrNvVD6+WfEN++qHqWsv26oosRRnJBpqMRcVJwIApKdk jXMCAAA= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140515_112845_657950_8DE06287 X-CRM114-Status: GOOD ( 10.07 ) X-Spam-Score: -5.7 (-----) Cc: peter.maydell@linaro.org, kvm@vger.kernel.org, steve.capper@arm.com, linux-arm-kernel@lists.infradead.org, jays.lee@samsung.com, sungjinn.chung@samsung.com, gavin.guo@canonical.com, Mario Smarduch X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Patch adds HYP interface for global VM TLB invalidation without address parameter. Added ARM version of kvm_flush_remote_tlbs(), made generic one weak. Signed-off-by: Mario Smarduch --- arch/arm/include/asm/kvm_asm.h | 1 + arch/arm/kvm/interrupts.S | 11 +++++++++++ arch/arm/kvm/mmu.c | 15 +++++++++++++++ virt/kvm/kvm_main.c | 2 +- 4 files changed, 28 insertions(+), 1 deletion(-) diff --git a/arch/arm/include/asm/kvm_asm.h b/arch/arm/include/asm/kvm_asm.h index 53b3c4a..21bc519 100644 --- a/arch/arm/include/asm/kvm_asm.h +++ b/arch/arm/include/asm/kvm_asm.h @@ -78,6 +78,7 @@ extern char __kvm_hyp_code_end[]; extern void __kvm_flush_vm_context(void); extern void __kvm_tlb_flush_vmid_ipa(struct kvm *kvm, phys_addr_t ipa); +extern void __kvm_tlb_flush_vmid(struct kvm *kvm); extern int __kvm_vcpu_run(struct kvm_vcpu *vcpu); #endif diff --git a/arch/arm/kvm/interrupts.S b/arch/arm/kvm/interrupts.S index 0d68d40..bddc66b 100644 --- a/arch/arm/kvm/interrupts.S +++ b/arch/arm/kvm/interrupts.S @@ -66,6 +66,17 @@ ENTRY(__kvm_tlb_flush_vmid_ipa) bx lr ENDPROC(__kvm_tlb_flush_vmid_ipa) +/** + * void __kvm_tlb_flush_vmid(struct kvm *kvm) - Flush per-VMID TLBs + * + * Reuses __kvm_tlb_flush_vmid_ipa() for ARMv7, without passing address + * parameter + */ + +ENTRY(__kvm_tlb_flush_vmid) + b __kvm_tlb_flush_vmid_ipa +ENDPROC(__kvm_tlb_flush_vmid) + /******************************************************************** * Flush TLBs and instruction caches of all CPUs inside the inner-shareable * domain, for all VMIDs diff --git a/arch/arm/kvm/mmu.c b/arch/arm/kvm/mmu.c index 80bb1e6..eea3f0a 100644 --- a/arch/arm/kvm/mmu.c +++ b/arch/arm/kvm/mmu.c @@ -56,6 +56,21 @@ static void kvm_tlb_flush_vmid_ipa(struct kvm *kvm, phys_addr_t ipa) kvm_call_hyp(__kvm_tlb_flush_vmid_ipa, kvm, ipa); } +/** + * kvm_flush_remote_tlbs() - flush all VM TLB entries + * + * Interface to HYP function to flush all VM TLB entries without address + * parameter. In HYP mode reuses __kvm_tlb_flush_vmid_ipa() function used by + * kvm_tlb_flush_vmid_ipa(). + * + * @kvm: pointer to kvm structure. + */ +void kvm_flush_remote_tlbs(struct kvm *kvm) +{ + if (kvm) + kvm_call_hyp(__kvm_tlb_flush_vmid, kvm); +} + static int mmu_topup_memory_cache(struct kvm_mmu_memory_cache *cache, int min, int max) { diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index fa70c6e..ba25765 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -184,7 +184,7 @@ static bool make_all_cpus_request(struct kvm *kvm, unsigned int req) return called; } -void kvm_flush_remote_tlbs(struct kvm *kvm) +void __weak kvm_flush_remote_tlbs(struct kvm *kvm) { long dirty_count = kvm->tlbs_dirty;