From patchwork Mon Oct 22 06:53:42 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 1624011 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 2B30640D5E for ; Mon, 22 Oct 2012 06:53:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753814Ab2JVGxf (ORCPT ); Mon, 22 Oct 2012 02:53:35 -0400 Received: from mail-vc0-f174.google.com ([209.85.220.174]:48490 "EHLO mail-vc0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753275Ab2JVGxd (ORCPT ); Mon, 22 Oct 2012 02:53:33 -0400 Received: by mail-vc0-f174.google.com with SMTP id fk26so2578272vcb.19 for ; Sun, 21 Oct 2012 23:53:33 -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=rLFTOcfO1+Va2M2/XDOgWtCJQrTL3DP05vB52YCqOIw=; b=GprMypCYHCG0JXVbc12rOX1XQiPxrtuddsFGxr9lXyw3qfqXNPOhfKqhJcR1oGO2SY vRjnXgEulJZTUP0L9RoG8A3COl9jIhrbpzSYRrP5sq0FnyXDeLux83pxYPnwP10B95Kj uQA28t3N5XtD6oKNEZ7UxOPVFYNqqs9xwrs6hsSqZEOdu2aeyn+Auf+6zbDlUoHWg8gF 905Pl9tkkYHNyniz33fVbdPxVKs6w9nKiPrt84ktfie3NGJ+QVmyXKOotwn2cEyPs/sS RkNSbUDzrpJwX/4VD9vJycYAN1RZUyGcfZX2yrfUqfgWGtSa6HUojkYxSys7tImi0HF7 /+WA== Received: by 10.221.2.10 with SMTP id ns10mr13263659vcb.25.1350888813349; Sun, 21 Oct 2012 23:53:33 -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 v17sm9487130vdi.17.2012.10.21.23.53.32 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 21 Oct 2012 23:53:33 -0700 (PDT) Subject: [PATCH v3 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, 22 Oct 2012 02:53:42 -0400 Message-ID: <20121022065342.18883.72127.stgit@ubuntu> In-Reply-To: <20121022065301.18883.35308.stgit@ubuntu> References: <20121022065301.18883.35308.stgit@ubuntu> User-Agent: StGit/0.15 MIME-Version: 1.0 X-Gm-Message-State: ALoCoQmOIZ5nW9punPKwDD3rpG/vYjquQbHPA1A3qF+ryoyCks6i1HAHnNzWkyFUX7NKF6osolDx 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 | 1 + 4 files changed, 20 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 3370c09..6b19e5c 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 mmio.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 09b7072..69bec17 100644 --- a/arch/arm/kvm/arm.c +++ b/arch/arm/kvm/arm.c @@ -286,6 +286,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); } @@ -323,6 +324,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; } @@ -1047,6 +1051,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 146de1d..090ea79 100644 --- a/arch/arm/kvm/vgic.c +++ b/arch/arm/kvm/vgic.c @@ -1168,6 +1168,7 @@ int kvm_vgic_init(struct kvm *kvm) for (i = 32; i < VGIC_NR_IRQS; i += 4) vgic_set_target_reg(kvm, 0, i); + kvm_timer_init(kvm); kvm->arch.vgic.ready = true; out: mutex_unlock(&kvm->lock);