From patchwork Sat Apr 27 08:09:55 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 2496821 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) by patchwork1.kernel.org (Postfix) with ESMTP id B36073FC64 for ; Sat, 27 Apr 2013 08:10:33 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UW0DI-0000cB-FQ; Sat, 27 Apr 2013 08:10:32 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UW0DG-0002xe-3d; Sat, 27 Apr 2013 08:10:30 +0000 Received: from mail-pa0-f43.google.com ([209.85.220.43]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UW0DD-0002xL-Of for linux-arm-kernel@lists.infradead.org; Sat, 27 Apr 2013 08:10:28 +0000 Received: by mail-pa0-f43.google.com with SMTP id hz1so2905662pad.30 for ; Sat, 27 Apr 2013 01:10:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer :x-gm-message-state; bh=Co6TBUCNRH9EqwyipE3IzjMKz+NvdaVa4s2L+bBKRGA=; b=FAedxZnu245cLry/PwZDw1x3U+v+EzwzdlEZe5U+gn873+lWIyIN/wx8GXjVZYp/0h pFTKJj0R/sqCpkWkaCSGZnfir1QypdMX4VZjW2xiY7F5wXfKkbFHh4HA562aD1Apob7Z FufovKZe7dIPWTqLc6s9txl1MtpNSldZk23GaefZI/RHklTV9RdoaocFKAQefviXGH5u s31AF6rcNBHwK0RLyIH2JeDJd4CsaNDKHE0Ev6ADkutXhgi3+u7jgKTl7hJi0tlQt9bM Es0J/vaB4J39YW/gWzTyFVrgdz4k+ghmehSpo2wByAo5C0r70brUTAa1glYKzPWOb4HF aiwQ== X-Received: by 10.68.180.67 with SMTP id dm3mr62094994pbc.110.1367050226131; Sat, 27 Apr 2013 01:10:26 -0700 (PDT) Received: from pnqlab006.amcc.com ([182.72.18.82]) by mx.google.com with ESMTPSA id k2sm390216pat.7.2013.04.27.01.10.22 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 27 Apr 2013 01:10:25 -0700 (PDT) From: Anup Patel To: kvmarm@lists.cs.columbia.edu Subject: [PATCH] arm64: KVM: Reset arch_timer upon vcpu reset Date: Sat, 27 Apr 2013 13:39:55 +0530 Message-Id: <1367050195-2953-1-git-send-email-anup.patel@linaro.org> X-Mailer: git-send-email 1.7.9.5 X-Gm-Message-State: ALoCoQnQyKzS4vIic2P9Y43ldSoKIIzfiL7cE3EoeWpyrvzHjD6d/OC59rBxyYBJziJnKXIyVAJJ X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130427_041027_904389_F157DE1B X-CRM114-Status: GOOD ( 12.74 ) X-Spam-Score: -0.1 (/) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-0.1 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.220.43 listed in list.dnswl.org] 2.5 SUSPICIOUS_RECIPS Similar addresses in recipient list -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: marc.zyngier@arm.com, linaro-kernel@lists.linaro.org, Anup Patel , linux-arm-kernel@lists.infradead.org, Pranavkumar Sawargaonkar X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org This patch does arch_timer reset (i.e. kvm_timer_vcpu_reset()) when a vcpu resetted by kvm_reset_vcpu(). The kvm_reset_vcpu() also informs guest timer irq number to arch_timer code via kvm_timer_vcpu_reset(). Signed-off-by: Anup Patel Signed-off-by: Pranavkumar Sawargaonkar --- arch/arm64/include/asm/kvm_arch_timer.h | 2 ++ arch/arm64/kvm/reset.c | 11 ++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/arch/arm64/include/asm/kvm_arch_timer.h b/arch/arm64/include/asm/kvm_arch_timer.h index eb02273..04949c6 100644 --- a/arch/arm64/include/asm/kvm_arch_timer.h +++ b/arch/arm64/include/asm/kvm_arch_timer.h @@ -50,6 +50,8 @@ struct arch_timer_cpu { int kvm_timer_hyp_init(void); int kvm_timer_init(struct kvm *kvm); +int kvm_timer_vcpu_reset(struct kvm_vcpu *vcpu, + const struct kvm_irq_level *irq); void kvm_timer_vcpu_init(struct kvm_vcpu *vcpu); void kvm_timer_flush_hwstate(struct kvm_vcpu *vcpu); void kvm_timer_sync_hwstate(struct kvm_vcpu *vcpu); diff --git a/arch/arm64/kvm/reset.c b/arch/arm64/kvm/reset.c index 64e0740..1e255a3 100644 --- a/arch/arm64/kvm/reset.c +++ b/arch/arm64/kvm/reset.c @@ -27,6 +27,7 @@ #include #include #include +#include /* * ARMv8 Reset Values @@ -40,6 +41,11 @@ static struct kvm_regs default_regs_reset32 = { COMPAT_PSR_I_BIT | COMPAT_PSR_F_BIT), }; +static struct kvm_irq_level default_timer_irq = { + .irq = 27, + .level = 1, +}; + static bool cpu_has_32bit_el1(void) { u64 pfr0; @@ -75,6 +81,7 @@ int kvm_arch_dev_ioctl_check_extension(long ext) int kvm_reset_vcpu(struct kvm_vcpu *vcpu) { struct kvm_regs *cpu_reset; + const struct kvm_irq_level *cpu_irq; switch (vcpu->arch.target) { default: @@ -86,6 +93,7 @@ int kvm_reset_vcpu(struct kvm_vcpu *vcpu) } else { cpu_reset = &default_regs_reset; } + cpu_irq = &default_timer_irq; break; } @@ -95,5 +103,6 @@ int kvm_reset_vcpu(struct kvm_vcpu *vcpu) /* Reset system registers */ kvm_reset_sys_regs(vcpu); - return 0; + /* Reset arch_timer context */ + return kvm_timer_vcpu_reset(vcpu, cpu_irq); }