From patchwork Sun Aug 30 13:54:26 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 52864 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f197.google.com (mail-lb0-f197.google.com [209.85.217.197]) by patches.linaro.org (Postfix) with ESMTPS id 66F9C2127E for ; Sun, 30 Aug 2015 13:56:11 +0000 (UTC) Received: by lbcli1 with SMTP id li1sf30432461lbc.2 for ; Sun, 30 Aug 2015 06:56:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id :in-reply-to:references:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:cc:mime-version :content-type:content-transfer-encoding:sender:errors-to :x-original-sender:x-original-authentication-results:mailing-list; bh=mH64gnpT/sKl3rrTGskDoE2mESTV5pxtD44AX9EIPBk=; b=L9JBUw3tJf0Dmnjj697GeKZbKalDXLH1a3s2vX4MukIER/6g8B79qneYg4cd+HwK7P ox6rZ3mG9z0wy99TpXt+oMO7ueg2PF5EId1YsaVCagHQE6PnnX2B/t+RHhdmv7nkHg7t zPNjB6mrDZQKnUDvARGkstvgZDGTRg6p5YrUw5GJGBklBKVNWwtIKxC1069AWr8m18ws e+DVN5kqd+G+h2wETjlZCLEldtHvCALHqjLv7bsdQWsFJVtDv9jMsTU/ccftm3Eonm4G gBTF+7UqjtdeoSNmjsnqtMLjsjnJGpZzoRpRDSR3sYEszA7EUrKmzXIDvMlVUOEWU/We JZyA== X-Gm-Message-State: ALoCoQk5iyN8pjBLbb7B62ZGjBEa6wKlg2bsBUoa/6fUto6kGaT5vZ4jjTL4fHNZr347UJWiOwZA X-Received: by 10.112.139.137 with SMTP id qy9mr5045260lbb.17.1440942970371; Sun, 30 Aug 2015 06:56:10 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.6.133 with SMTP id b5ls139017laa.99.gmail; Sun, 30 Aug 2015 06:56:10 -0700 (PDT) X-Received: by 10.152.6.133 with SMTP id b5mr8298942laa.33.1440942970239; Sun, 30 Aug 2015 06:56:10 -0700 (PDT) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com. [209.85.217.182]) by mx.google.com with ESMTPS id 6si10921880lai.40.2015.08.30.06.56.10 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 30 Aug 2015 06:56:10 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) client-ip=209.85.217.182; Received: by lbvd4 with SMTP id d4so12595027lbv.3 for ; Sun, 30 Aug 2015 06:56:10 -0700 (PDT) X-Received: by 10.152.170.230 with SMTP id ap6mr8562202lac.73.1440942970130; Sun, 30 Aug 2015 06:56:10 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.151.194 with SMTP id us2csp1078990lbb; Sun, 30 Aug 2015 06:56:09 -0700 (PDT) X-Received: by 10.66.102.102 with SMTP id fn6mr30595612pab.13.1440942969076; Sun, 30 Aug 2015 06:56:09 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id qy7si19671175pab.12.2015.08.30.06.56.08 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 30 Aug 2015 06:56:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZW34U-00048g-TC; Sun, 30 Aug 2015 13:54:58 +0000 Received: from mail-la0-f51.google.com ([209.85.215.51]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZW33O-0003H5-FL for linux-arm-kernel@lists.infradead.org; Sun, 30 Aug 2015 13:53:51 +0000 Received: by laba3 with SMTP id a3so56883139lab.1 for ; Sun, 30 Aug 2015 06:53:27 -0700 (PDT) X-Received: by 10.152.23.132 with SMTP id m4mr8067925laf.107.1440942807587; Sun, 30 Aug 2015 06:53:27 -0700 (PDT) Received: from localhost.localdomain (0187900153.0.fullrate.dk. [2.110.55.193]) by smtp.gmail.com with ESMTPSA id qm6sm3069212lbb.23.2015.08.30.06.53.26 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 30 Aug 2015 06:53:27 -0700 (PDT) From: Christoffer Dall To: kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org Subject: [PATCH 9/9] arm/arm64: KVM: arch timer: Reset CNTV_CTL to 0 Date: Sun, 30 Aug 2015 15:54:26 +0200 Message-Id: <1440942866-23802-10-git-send-email-christoffer.dall@linaro.org> X-Mailer: git-send-email 2.1.2.330.g565301e.dirty In-Reply-To: <1440942866-23802-1-git-send-email-christoffer.dall@linaro.org> References: <1440942866-23802-1-git-send-email-christoffer.dall@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150830_065350_742291_0087DBD3 X-CRM114-Status: GOOD ( 12.11 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.215.51 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [209.85.215.51 listed in wl.mailspike.net] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Cc: Wei Huang , Peter Maydell , Drew Jones , Ard Biesheuvel , Laszlo Ersek , Christoffer Dall MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: christoffer.dall@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Provide a better quality of implementation and be architecture compliant on ARMv7 for the architected timer by resetting the CNTV_CTL to 0 on reset of the timer, and call kvm_timer_update_state(vcpu) at the same time, ensuring the timer output is not asserted after, for example, a PSCI system reset. This change alone fixes the UEFI reset issue reported by Laszlo back in February. Cc: Laszlo Ersek Cc: Ard Biesheuvel Cc: Drew Jones Cc: Wei Huang Cc: Peter Maydell Signed-off-by: Christoffer Dall Reviewed-by: Marc Zyngier --- virt/kvm/arm/arch_timer.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/virt/kvm/arm/arch_timer.c b/virt/kvm/arm/arch_timer.c index 747302f..8a0fdfc 100644 --- a/virt/kvm/arm/arch_timer.c +++ b/virt/kvm/arm/arch_timer.c @@ -255,6 +255,15 @@ int kvm_timer_vcpu_reset(struct kvm_vcpu *vcpu, timer->irq.irq = irq->irq; /* + * The bits in CNTV_CTL are architecturally reset to UNKNOWN for ARMv8 + * and to 0 for ARMv7. We provide an implementation that always + * resets the timer to be disabled and unmasked and is compliant with + * the ARMv7 architecture. + */ + timer->cntv_ctl = 0; + kvm_timer_update_state(vcpu); + + /* * Tell the VGIC that the virtual interrupt is tied to a * physical interrupt. We do that once per VCPU. */