From patchwork Tue Jan 8 18:43:34 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 1947401 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 7C823DF23A for ; Tue, 8 Jan 2013 18:43:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757162Ab3AHSni (ORCPT ); Tue, 8 Jan 2013 13:43:38 -0500 Received: from mail-vb0-f52.google.com ([209.85.212.52]:48362 "EHLO mail-vb0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757091Ab3AHSnh (ORCPT ); Tue, 8 Jan 2013 13:43:37 -0500 Received: by mail-vb0-f52.google.com with SMTP id ez10so722688vbb.39 for ; Tue, 08 Jan 2013 10:43:36 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received: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=N94JvOnXKED43RJumSPnMqwFEL84k6c0+MfauaUMthw=; b=T9QqEK2ymM/eOVlURuwWN1brwXO18Eyy86Cg9CZwt8PZw0GBOD+JTNUvz8TJTHTaQr ZmTldym4GZanZXWxhks19TA9/bgR+8MH0iHITFqyQWCbWGN7Sod4Lielxkx1VZd7cd+T +R3lU0/t2GhAhaOstPs5Eco7mbffXA9JKHAK4PB9UDa1W4uj+Pg4eu26Hvw4r7VLWAXX GKg4ow9DeZUBv0yXal+Szn90RU97WYzswdKewK4r49b2A9TqraNxD+iqElA1e+sg9g8a NJ5fFzkesd0mTi87sn30nhpRUu3rPh2KQRfRTcwReAkjA9TsSeyn7Ekq93aTSBbjFCtF KyEQ== X-Received: by 10.58.49.130 with SMTP id u2mr90921824ven.0.1357670616387; Tue, 08 Jan 2013 10:43:36 -0800 (PST) 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 cv19sm54269138vdb.5.2013.01.08.10.43.35 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 08 Jan 2013 10:43:35 -0800 (PST) Subject: [PATCH v5 4/4] 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: Tue, 08 Jan 2013 13:43:34 -0500 Message-ID: <20130108184334.46758.93766.stgit@ubuntu> In-Reply-To: <20130108184259.46758.17939.stgit@ubuntu> References: <20130108184259.46758.17939.stgit@ubuntu> User-Agent: StGit/0.15 MIME-Version: 1.0 X-Gm-Message-State: ALoCoQncvyXDMhBT12NvYIq4VI4iWQ+Pfr+VV3fX9hFoswlYPq+y7Cs1W8cKKvcxYGZfF5RpcdHX 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 | 8 ++++++++ arch/arm/kvm/Makefile | 1 + arch/arm/kvm/arm.c | 11 +++++++++++ arch/arm/kvm/vgic.c | 1 + 4 files changed, 21 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 d32e33f..739500b 100644 --- a/arch/arm/kvm/Kconfig +++ b/arch/arm/kvm/Kconfig @@ -59,6 +59,14 @@ 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 + default y + ---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 3c6620c..43c4cad 100644 --- a/arch/arm/kvm/Makefile +++ b/arch/arm/kvm/Makefile @@ -20,3 +20,4 @@ obj-y += kvm-arm.o init.o interrupts.o obj-y += arm.o guest.o mmu.o emulate.o reset.o obj-y += coproc.o coproc_a15.o mmio.o decode.o obj-$(CONFIG_KVM_ARM_VGIC) += vgic.o +obj-$(CONFIG_KVM_ARM_TIMER) += arch_timer.o diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c index 22f39d6..38ad78a 100644 --- a/arch/arm/kvm/arm.c +++ b/arch/arm/kvm/arm.c @@ -287,6 +287,7 @@ int kvm_arch_vcpu_postcreate(struct kvm_vcpu *vcpu) 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); } @@ -328,6 +329,9 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu) if (ret) return ret; + /* Set up the timer */ + kvm_timer_vcpu_init(vcpu); + return 0; } @@ -1084,6 +1088,13 @@ static int init_hyp_mode(void) vgic_present = true; #endif + /* + * Init HYP architected timer support + */ + err = kvm_timer_hyp_init(); + if (err) + goto out_free_mappings; + kvm_info("Hyp mode initialized successfully\n"); return 0; out_free_vfp: diff --git a/arch/arm/kvm/vgic.c b/arch/arm/kvm/vgic.c index 083639b..7eb94fa 100644 --- a/arch/arm/kvm/vgic.c +++ b/arch/arm/kvm/vgic.c @@ -1405,6 +1405,7 @@ int kvm_vgic_init(struct kvm *kvm) for (i = VGIC_NR_PRIVATE_IRQS; 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);