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: 10090409 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 24FC060329 for ; Mon, 4 Dec 2017 14:10:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B180428C3B for ; Mon, 4 Dec 2017 14:10:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AFE5F28CDF; Mon, 4 Dec 2017 14:10:18 +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=-2.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_MED, URIBL_DBL_ABUSE_SPAM 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 19B5B29099 for ; Mon, 4 Dec 2017 14:10:12 +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:References: In-Reply-To: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:List-Owner; bh=yaEXFPJ53WMSUjSzVGNdls/lkS6aMjuAlHt+I0dTEQA=; b=uO2RTlayd6WU6WPk/E3nE3PijR 9uJuKJqOyGbqjP3yeG1aLDKLcTosON67mgtmDCRWt5C/VX7DNMUEPeAb+avjTB4Tn6+0Hw+2+2Ezr p7b6NytQkphqzmtv7wcpYZfeorqz12nPNmFmv9GzQ4ORscgbA2MgDWOzYTFcp5D5G5fxPMEA5ax56 +CgQMDH2/h09rlrV3Wp4pa7uc+zKE8/pqSChHaQK61Je6UwPBS3N6BExH5n2NZ2sgsKiXrc+UyJqf 0pv5KykX88IpSOhUBMHaX9gqZX0Eqow23ykiIcQqfxj3cxOUvo8Mp2fDmVJ4a3iVFtDSE8GXBRkcG NMjb90tw==; 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 1eLrRj-0000Uj-3K; Mon, 04 Dec 2017 14:10:11 +0000 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eLrMA-0002Pf-67 for linux-arm-kernel@lists.infradead.org; Mon, 04 Dec 2017 14:04:41 +0000 Received: by mail-wm0-x242.google.com with SMTP id i11so14462935wmf.4 for ; Mon, 04 Dec 2017 06:04:09 -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=l39kPRcPwTKuSKJyHIvDsGBYz9BCkA8vlKsPKkzMBmAb6gpwGBdrzVaQiYuezhnoHn QU8x9wYAJ55OQ/cc6REztShIbdNQ9OQFpjGdLRZY2BAh7siE3SK8L8UhKGHRq2nJC76a 1nMHPxrzAhn1hoLJ3vJ129JFWNlotvEoY5LzubomXCDdAcPAkAi2rI5p+QND5IVWRlq+ /5LNclX67O81SPY/1qJJp1CbP2/2+7iLcikrNoQ9AtsV4UDGcwAszMRGObbYh2JtY6SU uSnql+OceLptOEDHJwwpo/7RjXuuH6S83nfMm5yfAsvMmDVhbidUWRj1WnSjjLAD1+JR 0qiA== X-Gm-Message-State: AJaThX4ljA1/2HB69aoJ2GeRHkV2zJj1XqdOOjjtIN8SRq2XrlZnnQFo FqklA7NcEtYewky9/VBOEp9CtA45tBY= 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?= 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171204_060427_003306_A11062F4 X-CRM114-Status: GOOD ( 11.04 ) 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, linux-arm-kernel@lists.infradead.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 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;