From patchwork Mon Dec 4 14:03:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 10090367 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id EAABC60329 for ; Mon, 4 Dec 2017 14:05:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D3DD22858B for ; Mon, 4 Dec 2017 14:05:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C76B7287C0; Mon, 4 Dec 2017 14:05:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,URIBL_DBL_ABUSE_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 72FF42858B for ; Mon, 4 Dec 2017 14:05:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754165AbdLDOFh (ORCPT ); Mon, 4 Dec 2017 09:05:37 -0500 Received: from mail-wm0-f66.google.com ([74.125.82.66]:44851 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754173AbdLDOEJ (ORCPT ); Mon, 4 Dec 2017 09:04:09 -0500 Received: by mail-wm0-f66.google.com with SMTP id t8so6001812wmc.3 for ; Mon, 04 Dec 2017 06:04:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=christofferdall-dk.20150623.gappssmtp.com; s=20150623; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=fzMEzxruwBcCS9emEm0KigSMRWBvw5790ctX6JSjZz8=; b=gLTQTePt+h4Gsrg9c+FAGjRUjFVziYtIqIH+vOoLr9lrE2lMlaqsqqCBU712PmScNn 1wHweLggILzLbHd+PDG8VAcelvInfjSX0ydL7WsCzJjOqEWJJi4oQ7LDNQunLun87reC nNWIIDTLSFnS104HdrRPJzwcYZcZZ54Tlkj1nPdFwov0FMP+jf8xdI8kI2rjLm4iKsvP JiHIzfwuW2tHzC4dk6d/kzKcKnm7jCm7oF2dx/+FMJxu5P3yEt+sSYIRZrBDAiIUMFYF M5EoDq653WFMg+TgrvtK87ecgMP94xkQBLWh1T7ZrW+ET2fmB9niArnJIpg6rKMqpTmG vLhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=fzMEzxruwBcCS9emEm0KigSMRWBvw5790ctX6JSjZz8=; b=U2eDM4QpnLoK/q93Afootq6+qxCcxLpaYUicgZsDunNnLLVJIaOusiufkU+HQeoJSV pvxPVVbTVnCJWijtoPk4FEe9WFucrc1dsIfB+fZMjC7Vdsm+IMAB2bmCDfI5s6LidRgp CKvlGKbFzxuFwpd0mmGn9SQbNYxO+YdI3z6YX2w2xEkYxVfI06dXnVVw6L0jkA1OQjcW n697BQQOkAoSCCb6aC5+xc4tU8NqvlnfNe2tFOJJZ+t7LsiBr6xulVP5lpeu28GFHvyW qaBGR9wwTacIdzB62da4HM7RqAcBmOg+rcHRFg/Ln0hSajsZdmaftzqot+SCoRkgsVTk B8bQ== X-Gm-Message-State: AJaThX7YfbMT27RIPUrZCQCq+OhPKwn5TVfYffbXEyF1TVJtig8ADWTS 6Mvfk8JmYzqUkrEl4c5HGdKY2g== X-Google-Smtp-Source: AGs4zMZVw+Z1ZP3saWA0IJdjj6bUDMMtwzxfKRZqhnbJPZp6MvKHeVvWwbBhty/2wsZrtLtDAQNJsg== X-Received: by 10.28.70.66 with SMTP id t63mr7000696wma.106.1512396248130; Mon, 04 Dec 2017 06:04:08 -0800 (PST) Received: from localhost.localdomain (x50d2404e.cust.hiper.dk. [80.210.64.78]) by smtp.gmail.com with ESMTPSA id g7sm22794279wra.38.2017.12.04.06.04.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 04 Dec 2017 06:04:07 -0800 (PST) From: Christoffer Dall To: kvmarm@lists.cs.columbia.edu, Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= Cc: linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, Marc Zyngier , Christoffer Dall Subject: [PULL 15/19] KVM: arm/arm64: Avoid attempting to load timer vgic state without a vgic Date: Mon, 4 Dec 2017 15:03:44 +0100 Message-Id: <20171204140348.21965-13-cdall@kernel.org> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171204135637.21620-1-cdall@kernel.org> References: <20171204135637.21620-1-cdall@kernel.org> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Christoffer Dall The timer optimization patches inadvertendly changed the logic to always load the timer state as if we have a vgic, even if we don't have a vgic. Fix this by doing the usual irqchip_in_kernel() check and call the appropriate load function. Signed-off-by: Christoffer Dall --- virt/kvm/arm/arch_timer.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/virt/kvm/arm/arch_timer.c b/virt/kvm/arm/arch_timer.c index 190c99ed1b73..f9555b1e7f15 100644 --- a/virt/kvm/arm/arch_timer.c +++ b/virt/kvm/arm/arch_timer.c @@ -835,7 +835,10 @@ int kvm_timer_enable(struct kvm_vcpu *vcpu) no_vgic: preempt_disable(); timer->enabled = 1; - kvm_timer_vcpu_load_vgic(vcpu); + if (!irqchip_in_kernel(vcpu->kvm)) + kvm_timer_vcpu_load_user(vcpu); + else + kvm_timer_vcpu_load_vgic(vcpu); preempt_enable(); return 0;