From patchwork Sat Sep 15 15:39:47 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 1462101 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 6C7BCDF264 for ; Sat, 15 Sep 2012 15:39:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752897Ab2IOPju (ORCPT ); Sat, 15 Sep 2012 11:39:50 -0400 Received: from mail-qa0-f53.google.com ([209.85.216.53]:54839 "EHLO mail-qa0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751234Ab2IOPjt (ORCPT ); Sat, 15 Sep 2012 11:39:49 -0400 Received: by qaas11 with SMTP id s11so600712qaa.19 for ; Sat, 15 Sep 2012 08:39:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=subject:to:from:date:message-id:in-reply-to:references:user-agent :mime-version:content-type:content-transfer-encoding :x-gm-message-state; bh=FLXF9TVz8Jmi87JSZFa5hMKJsHqk8cbFptQS5rfgKhA=; b=j4ZuyiBz2IdsQ4wpLZlxNipDNLbvmCOLvXD1p/NkOWdsfi4SwaqMo1tMz4PZjM1Lzp s+B0bXGPDWLwaC29xYHmEpbPihrrVK5wyiydR7O72hUTrJnlWGIQKC1unATeJoKZFQ2k EcFUgL752AX0Pz8XcZAZmoJRHdNfpHh/yC/5C60dmWb0j+Sa2Dftp79vSCPwCUenCzyL I+bJ7RDIEPPdy+3w/1TebyZ7nhkuyQ4N9oeHp8v+kQNnrfsmPf++TYaYCwj1ZEt25Q6P dakYTNQxi38LwjooGmC5Mkt8NjSBUJuxO9DAZX3Y+k1rnztXxvYhcwDkC70VsYXXIN5g yaZA== Received: by 10.224.197.10 with SMTP id ei10mr15323381qab.49.1347723588811; Sat, 15 Sep 2012 08:39:48 -0700 (PDT) Received: from [127.0.1.1] (pool-72-80-83-148.nycmny.fios.verizon.net. [72.80.83.148]) by mx.google.com with ESMTPS id fl3sm7024378qab.3.2012.09.15.08.39.48 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 15 Sep 2012 08:39:48 -0700 (PDT) Subject: [PATCH 5/5] ARM: KVM: arch_timers: Wire the init code and config option To: kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu From: Christoffer Dall Date: Sat, 15 Sep 2012 11:39:47 -0400 Message-ID: <20120915153947.21673.48043.stgit@ubuntu> In-Reply-To: <20120915153902.21673.37552.stgit@ubuntu> References: <20120915153902.21673.37552.stgit@ubuntu> User-Agent: StGit/0.15 MIME-Version: 1.0 X-Gm-Message-State: ALoCoQmdfdvHDWU1PatJ7S8t0Lw410bQqX4xqoUdYR3+eZBY5no3WkKRNd1mxGJ+YwT+6hbCufdZ Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Marc Zyngier It is now possible to select CONFIG_KVM_ARM_TIMER to enable the KVM architected timer support. Signed-off-by: Marc Zyngier Signed-off-by: Christoffer Dall --- arch/arm/kvm/Kconfig | 7 +++++++ arch/arm/kvm/Makefile | 1 + arch/arm/kvm/arm.c | 11 +++++++++++ arch/arm/kvm/vgic.c | 4 ++++ 4 files changed, 23 insertions(+) -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/arm/kvm/Kconfig b/arch/arm/kvm/Kconfig index 867551e..ade2673 100644 --- a/arch/arm/kvm/Kconfig +++ b/arch/arm/kvm/Kconfig @@ -47,6 +47,13 @@ config KVM_ARM_VGIC ---help--- Adds support for a hardware assisted, in-kernel GIC emulation. +config KVM_ARM_TIMER + bool "KVM support for Architected Timers" + depends on KVM_ARM_VGIC && ARM_ARCH_TIMER + select HAVE_KVM_IRQCHIP + ---help--- + Adds support for the Architected Timers in virtual machines + source drivers/virtio/Kconfig endif # VIRTUALIZATION diff --git a/arch/arm/kvm/Makefile b/arch/arm/kvm/Makefile index 0917695..916c1eb 100644 --- a/arch/arm/kvm/Makefile +++ b/arch/arm/kvm/Makefile @@ -20,3 +20,4 @@ obj-$(CONFIG_KVM_ARM_HOST) += $(addprefix ../../../virt/kvm/, kvm_main.o coalesc obj-$(CONFIG_KVM_ARM_HOST) += arm.o guest.o mmu.o emulate.o reset.o coproc.o obj-$(CONFIG_KVM_ARM_VGIC) += vgic.o +obj-$(CONFIG_KVM_ARM_TIMER) += timer.o diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c index af71560..45b4dc3 100644 --- a/arch/arm/kvm/arm.c +++ b/arch/arm/kvm/arm.c @@ -285,6 +285,7 @@ out: void kvm_arch_vcpu_free(struct kvm_vcpu *vcpu) { kvm_mmu_free_memory_caches(vcpu); + kvm_timer_vcpu_terminate(vcpu); kmem_cache_free(kvm_vcpu_cache, vcpu); } @@ -316,6 +317,9 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu) /* Set up VGIC */ kvm_vgic_vcpu_init(vcpu); + /* Set up the timer */ + kvm_timer_vcpu_init(vcpu); + return 0; } @@ -1016,6 +1020,13 @@ static int init_hyp_mode(void) if (!err) vgic_present = true; + /* + * Init HYP architected timer support + */ + err = kvm_timer_hyp_init(); + if (err) + goto out_free_mappings; + return 0; out_free_vfp: free_percpu(kvm_host_vfp_state); diff --git a/arch/arm/kvm/vgic.c b/arch/arm/kvm/vgic.c index 63fe0dd..494d94d 100644 --- a/arch/arm/kvm/vgic.c +++ b/arch/arm/kvm/vgic.c @@ -1111,5 +1111,9 @@ int kvm_vgic_init(struct kvm *kvm) out: mutex_unlock(&kvm->lock); + + if (!ret) + kvm_timer_init(kvm); + return ret; }