From patchwork Sat Nov 15 08:19:10 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Smarduch X-Patchwork-Id: 5311061 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 36EA0C11AC for ; Sat, 15 Nov 2014 08:24:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4348A20155 for ; Sat, 15 Nov 2014 08:24:20 +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 C98C52014A for ; Sat, 15 Nov 2014 08:24:17 +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 1XpYal-00079G-Ig; Sat, 15 Nov 2014 08:20:23 +0000 Received: from mailout2.w2.samsung.com ([211.189.100.12] helo=usmailout2.samsung.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XpYab-0005zj-1l for linux-arm-kernel@lists.infradead.org; Sat, 15 Nov 2014 08:20:13 +0000 Received: from uscpsbgex4.samsung.com (u125.gpu85.samsung.co.kr [203.254.195.125]) by mailout2.w2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NF200C44N5FQG90@mailout2.w2.samsung.com> for linux-arm-kernel@lists.infradead.org; Sat, 15 Nov 2014 03:20:03 -0500 (EST) X-AuditID: cbfec37d-b7f3b6d000005695-8f-54670cb3f555 Received: from usmmp2.samsung.com ( [203.254.195.78]) by uscpsbgex4.samsung.com (USCPEXMTA) with SMTP id D8.DB.22165.3BC07645; Sat, 15 Nov 2014 03:20:03 -0500 (EST) 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 <0NF200DD5N5FAY50@usmmp2.samsung.com>; Sat, 15 Nov 2014 03:20:03 -0500 (EST) Received: from mjsmard-530U3C-530U4C-532U3C.sisa.samsung.com (105.144.129.79) by SISAEX02SJ.sisa.samsung.com (105.144.21.116) with Microsoft SMTP Server (TLS) id 14.3.123.3; Sat, 15 Nov 2014 00:20:02 -0800 From: m.smarduch@samsung.com To: christoffer.dall@linaro.org, marc.zyngier@arm.com Subject: [PATCH v2 3/3] KVM: arm/arm64: Enable Dirty Page logging for ARMv8 Date: Sat, 15 Nov 2014 00:19:10 -0800 Message-id: <1416039550-28125-4-git-send-email-m.smarduch@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1416039550-28125-1-git-send-email-m.smarduch@samsung.com> References: <1416039550-28125-1-git-send-email-m.smarduch@samsung.com> MIME-version: 1.0 X-Originating-IP: [105.144.129.79] X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrDLMWRmVeSWpSXmKPExsVy+t9hP93NPOkhBlM26Vq8X9bDaPHi9T9G izlTCy0+njrObrHp8TVWi793/rFZ7N/2j9WB3WPNvDWMHneu7WHzOL9pDbPH5iX1Hu/3XWXz +LxJLoAtissmJTUnsyy1SN8ugSujc9tO1oKFChX/TyxlbGDcItXFyMkhIWAisWj5fnYIW0zi wr31bF2MXBxCAssYJaZcOsAE4fQySby+MQUqc5FR4sK5BUwgLWwCMhIPpzcBJTg4RARMJZrb OEBqmAW2MUr8ePGcGaRGWMBbYsvF82wgNouAqkTjn2tg63gF3CSenL/NBNIrIaAgMWeSDUiY U8BdYs/x7SwgthBQyY7Xz9kgygUlfky+xwJSziwgIfH8sxJEiarEtpvPGSEeUJKYdvgq+wRG oVlIOmYhdCxgZFrFKFZanFxQnJSeWmGiV5yYW1yal66XnJ+7iRESA7U7GO9/tTnEKMDBqMTD e2FSWogQa2JZcWXuIUYJDmYlEd4JXOkhQrwpiZVVqUX58UWlOanFhxiZODilGhg9apojhDPc wv5acM82OflEX1w/bYPAlDuTVy744BBtFh7y5gSf27Eul78m6dnCdyd9W7frjIaT94EZbYoe gXkc2ySnsOxSnWfL9zohi8/0WETf5Df1OrIXyiL4BePeH/a8UaQm9vWgX2vISjeRnEmydc1K pyXuvsvYbWfpz8XwTP65iK9UmRJLcUaioRZzUXEiAKikfYJfAgAA X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141115_002013_172890_921A957A X-CRM114-Status: UNSURE ( 9.96 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -5.0 (-----) Cc: kvm@vger.kernel.org, catalin.marinas@arm.com, pbonzini@redhat.com, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, Mario Smarduch X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 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.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, T_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 From: Mario Smarduch This patch enables ARMv8 ditry page logging support. Plugs ARMv8 into generic layer through Kconfig symbol, and drops earlier ARM64 constraints to enable logging at architecture layer. Signed-off-by: Mario Smarduch --- arch/arm/include/asm/kvm_host.h | 12 ------------ arch/arm/kvm/arm.c | 4 ---- arch/arm/kvm/mmu.c | 20 +++++++++++--------- arch/arm64/kvm/Kconfig | 2 ++ 4 files changed, 13 insertions(+), 25 deletions(-) diff --git a/arch/arm/include/asm/kvm_host.h b/arch/arm/include/asm/kvm_host.h index 8fa6238..21f828e 100644 --- a/arch/arm/include/asm/kvm_host.h +++ b/arch/arm/include/asm/kvm_host.h @@ -220,18 +220,6 @@ static inline void __cpu_init_hyp_mode(phys_addr_t boot_pgd_ptr, kvm_call_hyp((void*)hyp_stack_ptr, vector_ptr, pgd_ptr); } -/** - * kvm_flush_remote_tlbs() - flush all VM TLB entries - * @kvm: pointer to kvm structure. - * - * Interface to HYP function to flush all VM TLB entries without address - * parameter. - */ -static inline void kvm_flush_remote_tlbs(struct kvm *kvm) -{ - kvm_call_hyp(__kvm_tlb_flush_vmid, kvm); -} - static inline int kvm_arch_dev_ioctl_check_extension(long ext) { return 0; diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c index 040c0f3..8d27e94 100644 --- a/arch/arm/kvm/arm.c +++ b/arch/arm/kvm/arm.c @@ -759,7 +759,6 @@ long kvm_arch_vcpu_ioctl(struct file *filp, */ int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm, struct kvm_dirty_log *log) { -#ifdef CONFIG_ARM int r; bool is_dirty = false; @@ -783,9 +782,6 @@ out: mutex_unlock(&kvm->slots_lock); return r; -#else /* ARM64 */ - return -EINVAL; -#endif } static int kvm_vm_ioctl_set_device_addr(struct kvm *kvm, diff --git a/arch/arm/kvm/mmu.c b/arch/arm/kvm/mmu.c index d29de77..95df040 100644 --- a/arch/arm/kvm/mmu.c +++ b/arch/arm/kvm/mmu.c @@ -52,11 +52,18 @@ static phys_addr_t hyp_idmap_vector; static bool kvm_get_logging_state(struct kvm_memory_slot *memslot) { -#ifdef CONFIG_ARM return !!memslot->dirty_bitmap; -#else - return false; -#endif +} + +/** + * kvm_flush_remote_tlbs() - flush all VM TLB entries for v7/8 + * @kvm: pointer to kvm structure. + * + * Interface to HYP function to flush all VM TLB entries + */ +inline void kvm_flush_remote_tlbs(struct kvm *kvm) +{ + kvm_call_hyp(__kvm_tlb_flush_vmid, kvm); } static void kvm_tlb_flush_vmid_ipa(struct kvm *kvm, phys_addr_t ipa) @@ -775,7 +782,6 @@ static bool transparent_hugepage_adjust(pfn_t *pfnp, phys_addr_t *ipap) return false; } -#ifdef CONFIG_ARM /** * stage2_wp_ptes - write protect PMD range * @pmd: pointer to pmd entry @@ -920,7 +926,6 @@ void kvm_arch_mmu_write_protect_pt_masked(struct kvm *kvm, stage2_wp_range(kvm, start, end); } -#endif static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa, struct kvm_memory_slot *memslot, @@ -1323,7 +1328,6 @@ void kvm_arch_commit_memory_region(struct kvm *kvm, spin_unlock(&kvm->mmu_lock); } -#ifdef CONFIG_ARM /* * At this point memslot has been committed and there is an * allocated dirty_bitmap[], dirty pages will be be tracked while the @@ -1332,8 +1336,6 @@ void kvm_arch_commit_memory_region(struct kvm *kvm, if (change != KVM_MR_DELETE && change != KVM_MR_MOVE && mem->flags & KVM_MEM_LOG_DIRTY_PAGES) kvm_mmu_wp_memory_region(kvm, mem->slot); -#endif - } int kvm_arch_prepare_memory_region(struct kvm *kvm, diff --git a/arch/arm64/kvm/Kconfig b/arch/arm64/kvm/Kconfig index 8ba85e9..3ce389b 100644 --- a/arch/arm64/kvm/Kconfig +++ b/arch/arm64/kvm/Kconfig @@ -22,10 +22,12 @@ config KVM select PREEMPT_NOTIFIERS select ANON_INODES select HAVE_KVM_CPU_RELAX_INTERCEPT + select HAVE_KVM_ARCH_TLB_FLUSH_ALL select KVM_MMIO select KVM_ARM_HOST select KVM_ARM_VGIC select KVM_ARM_TIMER + select KVM_GENERIC_DIRTYLOG_READ_PROTECT ---help--- Support hosting virtualized guest machines.