From patchwork Mon Dec 18 10:00:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 10118693 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 97EA36019C for ; Mon, 18 Dec 2017 10:03:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 84E8D28DB1 for ; Mon, 18 Dec 2017 10:03:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7888D28E35; Mon, 18 Dec 2017 10:03:25 +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=unavailable 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 03F6A28DB1 for ; Mon, 18 Dec 2017 10:03:25 +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=O64463wbv6cFlNVHlv8DbGJxlNA8Jx9RkQpO3BLOVMM=; b=OfZYxvXTb9dpznfd9LoHPHCkBQ bXfAwdzRE4pz7Q0Kit9QwOfMEMb7bacSirAAJucqosq+SqQnS3ohMRPFifmoyXLPhI7xcwI9BLTky rQG8K5v8NxlGxYq7evrTUCk7mdONggIkZwFtlMikzi/3QPaZSy7NPU8yZMDSp9CKmnzr4efJ06gTT hFuMkheQzR3VDKB1nvSqE5oSSDIg8lgXAhVUBmZ6bge97w9KDrIEo0h8SOCyCNWV2ysoz154zGT/U lUr31afLK9j6VgzS8O/V80ADrdfMH3DvjqpUTr8Yb40w6HunqAT9faSieJDIYS64TG1AgC9KUfpKl dQgZw3Pw==; 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 1eQsGZ-00007F-MH; Mon, 18 Dec 2017 10:03:23 +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 1eQsEw-0006to-7T for linux-arm-kernel@lists.infradead.org; Mon, 18 Dec 2017 10:01:54 +0000 Received: by mail-wm0-x242.google.com with SMTP id r78so28109237wme.5 for ; Mon, 18 Dec 2017 02:01:21 -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:in-reply-to:references; bh=Nde2QOteinOCFwOpv2kAK3EKPwH1gm/UNL5fqmzMJPs=; b=NLTUaJCkDxc2mGzV565+skwwOZ3m4yDU8X3EC5rN/uexIuBb6Y0L5Vk3FRiAzWUV8o I3vfTbNCtnHhmYZj37e44TmecexE+7QbuK2rDSbNvPq0y5V28iEJF7V0dyJWuf7rbjVM P6dwpPjMHVRx2nibQmEfSgI0ikPjNiCX6W0Vs= 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:in-reply-to :references; bh=Nde2QOteinOCFwOpv2kAK3EKPwH1gm/UNL5fqmzMJPs=; b=uctUmJOZOLM9EJDUD3wLXs6EBuEpCKgpIExwvZDCGnau1MmO6Nex5wdB4He42Vtbga KUHYKNlNyTj85xIDbk3useJQ5TSpSt4lFCP99AJF6DZzvAiULYxrULefAa55Q/IoHJQO bqv4AlUlc9g7Spijynmk7e4Qp+Z+Eb//iyLCqU1MQ7XIuEPrZ1Nsvi1xDfwb+Iv5hYiZ bIejEy/7PLUQY669d8k3saodA+smT8LFK0nMe4lvJYK8GHwDRZPvCEEv6+wp0Kx+c24e S2Gvru/7TYa7qjLqmAfVdWI5wQsn6HlOgEaymbQLfwiNbMUoTmlLwhMakPHCPA1R+QBE +zlA== X-Gm-Message-State: AKGB3mJmZP0Er8TIAJniyHtUJpqvhK1e8QFebbcS4W16bMVgiynwJasa pUqIQ0mhbIjiJsqrLA04jkAwsg== X-Google-Smtp-Source: ACJfBotaGX2/1LAwkTfixmfiyR9s/ft+V/q26GPgbXIaUlc1ExtLIR5EKCQ6gOQNyCjDXUoxrD9g/w== X-Received: by 10.80.188.20 with SMTP id j20mr28534796edh.243.1513591280385; Mon, 18 Dec 2017 02:01:20 -0800 (PST) Received: from localhost.localdomain (x50d2404e.cust.hiper.dk. [80.210.64.78]) by smtp.gmail.com with ESMTPSA id h16sm10403130edj.34.2017.12.18.02.01.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Dec 2017 02:01:19 -0800 (PST) From: Christoffer Dall To: Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= Subject: [PULL 3/5] KVM: arm/arm64: timer: Don't set irq as forwarded if no usable GIC Date: Mon, 18 Dec 2017 11:00:55 +0100 Message-Id: <20171218100057.7839-4-christoffer.dall@linaro.org> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171218100057.7839-1-christoffer.dall@linaro.org> References: <20171218100057.7839-1-christoffer.dall@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171218_020142_894367_2D1728A1 X-CRM114-Status: GOOD ( 13.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 , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, 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 From: Marc Zyngier If we don't have a usable GIC, do not try to set the vcpu affinity as this is guaranteed to fail. Reported-by: Andre Przywara Reviewed-by: Andre Przywara Tested-by: Andre Przywara Reviewed-by: Christoffer Dall Signed-off-by: Marc Zyngier Signed-off-by: Christoffer Dall --- include/kvm/arm_arch_timer.h | 2 +- virt/kvm/arm/arch_timer.c | 13 ++++++++----- virt/kvm/arm/arm.c | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/include/kvm/arm_arch_timer.h b/include/kvm/arm_arch_timer.h index 6e45608b2399..9da6ce22803f 100644 --- a/include/kvm/arm_arch_timer.h +++ b/include/kvm/arm_arch_timer.h @@ -62,7 +62,7 @@ struct arch_timer_cpu { bool enabled; }; -int kvm_timer_hyp_init(void); +int kvm_timer_hyp_init(bool); int kvm_timer_enable(struct kvm_vcpu *vcpu); int kvm_timer_vcpu_reset(struct kvm_vcpu *vcpu); void kvm_timer_vcpu_init(struct kvm_vcpu *vcpu); diff --git a/virt/kvm/arm/arch_timer.c b/virt/kvm/arm/arch_timer.c index f9555b1e7f15..aa9adfafe12b 100644 --- a/virt/kvm/arm/arch_timer.c +++ b/virt/kvm/arm/arch_timer.c @@ -720,7 +720,7 @@ static int kvm_timer_dying_cpu(unsigned int cpu) return 0; } -int kvm_timer_hyp_init(void) +int kvm_timer_hyp_init(bool has_gic) { struct arch_timer_kvm_info *info; int err; @@ -756,10 +756,13 @@ int kvm_timer_hyp_init(void) return err; } - err = irq_set_vcpu_affinity(host_vtimer_irq, kvm_get_running_vcpus()); - if (err) { - kvm_err("kvm_arch_timer: error setting vcpu affinity\n"); - goto out_free_irq; + if (has_gic) { + err = irq_set_vcpu_affinity(host_vtimer_irq, + kvm_get_running_vcpus()); + if (err) { + kvm_err("kvm_arch_timer: error setting vcpu affinity\n"); + goto out_free_irq; + } } kvm_info("virtual timer IRQ%d\n", host_vtimer_irq); diff --git a/virt/kvm/arm/arm.c b/virt/kvm/arm/arm.c index 6b60c98a6e22..2e43f9d42bd5 100644 --- a/virt/kvm/arm/arm.c +++ b/virt/kvm/arm/arm.c @@ -1326,7 +1326,7 @@ static int init_subsystems(void) /* * Init HYP architected timer support */ - err = kvm_timer_hyp_init(); + err = kvm_timer_hyp_init(vgic_present); if (err) goto out;