From patchwork Mon Oct 1 09:16:33 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 1530181 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 51E3ADFE80 for ; Mon, 1 Oct 2012 09:16:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752829Ab2JAJQg (ORCPT ); Mon, 1 Oct 2012 05:16:36 -0400 Received: from mail-qa0-f46.google.com ([209.85.216.46]:37501 "EHLO mail-qa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752429Ab2JAJQf (ORCPT ); Mon, 1 Oct 2012 05:16:35 -0400 Received: by mail-qa0-f46.google.com with SMTP id c26so1408438qad.19 for ; Mon, 01 Oct 2012 02:16:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=subject:to:from:cc:date:message-id:in-reply-to:references :user-agent:mime-version:content-type:content-transfer-encoding :x-gm-message-state; bh=0gL0AeW+IloUZJaAw5hxsVh0R/fRynZZA5VQGUtMVEE=; b=jyF+qs+ANVobNA/8m/fVHkpV9aRXIKS9xvKuulrhw/iSQjWJbjfIF7XQOjZxc/ahq0 21fmhqJEnuZU527c+GEfCLYZ51nGSQP6yi6+185OtNl4YUk40Q9R1rpi6njYIJkNKMVD dpmCrrJvp7cijlmNQpgOD591t3uAFP6IE+MgYVNyUsNenVlzpcwlxvNkXeGvynBE2jO1 B+vjk1dOF0vkjU7EMpcWdLm2pctxPg7WsaCfJj+IJXMOcDmHPWy27VB7t6XPpRQHXinb v7T3x/g7lpOm0p392ZERIecrANwH3mqvjSLDvUE6LgFHctaDku2BUtvSssuFkvlvifFM Lghw== Received: by 10.224.9.9 with SMTP id j9mr35398813qaj.32.1349082995171; Mon, 01 Oct 2012 02:16:35 -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 y18sm23791955qaa.15.2012.10.01.02.16.33 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 01 Oct 2012 02:16:34 -0700 (PDT) Subject: [PATCH v2 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 Cc: Marc Zyngier Date: Mon, 01 Oct 2012 05:16:33 -0400 Message-ID: <20121001091633.49694.98982.stgit@ubuntu> In-Reply-To: <20121001091528.49694.69990.stgit@ubuntu> References: <20121001091528.49694.69990.stgit@ubuntu> User-Agent: StGit/0.15 MIME-Version: 1.0 X-Gm-Message-State: ALoCoQlOiEvEufq4m0KC2cBzLbkaqBew4oVAkYv3OCX1fmtjATrJ13gIGc4bqXEKwl/bYK254V+E 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 89608c0..8f4aa02 100644 --- a/arch/arm/kvm/Makefile +++ b/arch/arm/kvm/Makefile @@ -21,3 +21,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 obj-$(CONFIG_KVM_ARM_HOST) += coproc.o coproc_a15.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 c62bf28..f8c377b 100644 --- a/arch/arm/kvm/arm.c +++ b/arch/arm/kvm/arm.c @@ -283,6 +283,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); } @@ -320,6 +321,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; } @@ -1010,6 +1014,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; }