From patchwork Wed Nov 29 16:30:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 10082757 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 F16D16020B for ; Wed, 29 Nov 2017 16:30:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DAB7F29B45 for ; Wed, 29 Nov 2017 16:30:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CF97329B47; Wed, 29 Nov 2017 16:30:41 +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.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 64A2629B46 for ; Wed, 29 Nov 2017 16:30:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=UV82WKrozP3JXgSSx+TpbOL4UOsjv2SVkeILU8z4+Qs=; b=Aq/ +Oxn3kzAc0no9IqscFYCwE/n3Zqn2ZI1IFFzvYjsFCzPocXvj8NS9x3oH+SWdAA+M/BddNybJFv8c dIyfLHsGBG8L0zxO+Xrr1MjFSHmRkl6V3VMLsuvfP0e3nkuzviLTJxGzM/O85dKlt010ADV3UTzXr UwbW+QmzewRmeSZ2OzK6fKKhqTVfWdUpe2HvR2G0OoCeO/OudnN2Eg13yH7AwNKnu9KuTmbq2HItk mbgbbSoqAf/Hgo4KfmmXv/Pxv7oDEMff/cPZ2o+rsneBzuOJtyRnKLKoOSpDlotjsL7SvRIMpBvdc /izW6Uh+Iw7M2pJ0++GxSMIyF+XLBYQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1eK5Fw-0006wa-GS; Wed, 29 Nov 2017 16:30:40 +0000 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eK5Fr-0006uo-7A for linux-arm-kernel@lists.infradead.org; Wed, 29 Nov 2017 16:30:39 +0000 Received: by mail-wm0-x241.google.com with SMTP id f140so7127076wmd.2 for ; Wed, 29 Nov 2017 08:30:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=vCCH63xJOGIOaoVh2Qga2zVqC2x0n2mjPl0Ml6sLO0o=; b=YSydbuaFYmxlA697SKWNh8GVAZfC6udVKkdadF3r7IEZrngCutSEH29L17PEHlRV2t q4ocOg9ce+ImWnZtWqUgYKJtpfbFYtctpwV/Ir0N36ikgvaxIcjEocY6f4a259VnGxAy H6oKHcQATXGITQBlE6ZcpKPGAerXNfJqiQRP0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=vCCH63xJOGIOaoVh2Qga2zVqC2x0n2mjPl0Ml6sLO0o=; b=NreDwN4hqvula4tnTFzMfVtTCrUUkO07ejru64VkjR80YcJGohlZd9JHnRjdGthF2q JxUAEhLvTpLjMld3xTrVQd78iVoYi3/YitffWDWDg3/ihshiFAvJ0Qs6n3hDjOTZ9T7P Is8fihSLbAC6N/3DcP8aAoVSLvXQjSos7tVlWNi6emj10dQN5PKtHknkKckaOJROQ4z0 yDrL4XuDx6cQujq2xnx/JH0hipLgBgSRY8oKZUzkvYkOQOLOkMJucR9nRggKIt2ynpvn eladIiJxUsjujOCHbmCNLlmlkguSBeWhBxOA6Om+kvP238L3rdbipec+M6Q6hq4PqBFm MB0g== X-Gm-Message-State: AJaThX663Rxydbyg3Dbq+deFcJ1RXO265JVeCOcaqA3JA2BPc+7SI7hd sgcek9Hv90JDVj0FP0DemSgiXw== X-Google-Smtp-Source: AGs4zMZ6oIVyg7MRUz+nFJZlfGUS+jaOh5V/OhgFVf8FnYtCC2f+qXNZh9H9J+0RCUGEfMNgrOEPgw== X-Received: by 10.28.22.204 with SMTP id 195mr2969389wmw.11.1511973013270; Wed, 29 Nov 2017 08:30:13 -0800 (PST) Received: from localhost.localdomain (78.163-31-62.static.virginmediabusiness.co.uk. [62.31.163.78]) by smtp.gmail.com with ESMTPSA id 26sm2836720wrw.19.2017.11.29.08.30.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 29 Nov 2017 08:30:12 -0800 (PST) From: Christoffer Dall To: kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Subject: [PATCH] KVM: arm/arm64: Avoid attempting to load timer vgic state without a vgic Date: Wed, 29 Nov 2017 17:30:09 +0100 Message-Id: <1511973009-56442-1-git-send-email-christoffer.dall@linaro.org> X-Mailer: git-send-email 2.7.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171129_083035_485182_BA1E2928 X-CRM114-Status: GOOD ( 12.62 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marc Zyngier , Christoffer Dall , kvm@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- I'm aware that this looks slightly ugly following the no_vgic label, but this code is about to disappear with the vcpu_load/vcpu_put series, so it's just a fix for the current version. 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 190c99e..f9555b1 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;