From patchwork Sat Dec 10 20:47:09 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 9469473 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 CADA560234 for ; Sat, 10 Dec 2016 20:47:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BF5AA284E6 for ; Sat, 10 Dec 2016 20:47:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B3FD1284E9; Sat, 10 Dec 2016 20:47:21 +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=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID 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 57F9B27F4B for ; Sat, 10 Dec 2016 20:47:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752844AbcLJUrN (ORCPT ); Sat, 10 Dec 2016 15:47:13 -0500 Received: from mail-lf0-f52.google.com ([209.85.215.52]:34369 "EHLO mail-lf0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752585AbcLJUrL (ORCPT ); Sat, 10 Dec 2016 15:47:11 -0500 Received: by mail-lf0-f52.google.com with SMTP id y21so21797226lfa.1 for ; Sat, 10 Dec 2016 12:47:10 -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=nLP7IOuLQTnBp+JzDw3q0+UJIj5TEqU1Tm9dUF70P4o=; b=ZUnPdiVTtsEttaSeFQ2rdWxCFVbZEpCnHN9VF5z8/k91Tfc6I/WyYfXkOyzk1VHfYf VkQpSi+nHu4AQYy0vAd3pdviOPKhLLbwrymurLb7hA61vtk8XkyM+ViJgC/YxskvDpOD oZEQjCF8y+5rsoLOFV6GX/cEs9i6ojf6bd+js= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=nLP7IOuLQTnBp+JzDw3q0+UJIj5TEqU1Tm9dUF70P4o=; b=RcqTX+aZnKw4oHsMqIDqko8yOAxfvz7elONAOf+AnTUBkoXo0qKvUiaEQJSoFCgK0I SAdcMN09YAObB1Pt0BZUdtCLdFSUU9knLmzktc8WPvFW1caA04gVTYJ61tvGo9Aocnza Bgp/c+hAoxK9Nzmq7eaD7nKhmPXQzbsaA4OBeASO3sBKagrmbkNa0vwVC1PfZXPOr1S1 Pr7DtBa+iOmImWuquwReuydbwSAh+USRRN8O6rvVRVlUrb7t23tXByPIiIoqdEpWM8m2 yLN6SY8soY1ImGBe4Q4N0ihUsaHbIecjbjdyhPH9khVC5ioxkH0nezw+5rP/uRNxLf0O htqQ== X-Gm-Message-State: AKaTC02vE1a/Dk+EbnMTAq3twSNxGWNTbAaW7jYnPqwOfGOQqpNmIFNPzNqfUTwm/eHSfjpW X-Received: by 10.46.32.7 with SMTP id g7mr32988795ljg.35.1481402829323; Sat, 10 Dec 2016 12:47:09 -0800 (PST) Received: from localhost.localdomain (x1-6-50-6a-03-de-ec-c2.cpe.webspeed.dk. [2.108.209.202]) by smtp.gmail.com with ESMTPSA id 29sm7578325lft.43.2016.12.10.12.47.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 10 Dec 2016 12:47:08 -0800 (PST) From: Christoffer Dall To: kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org Cc: Marc Zyngier , Christoffer Dall Subject: [RFC PATCH 4/7] KVM: arm/arm64: Check that system supports split eoi/deactivate Date: Sat, 10 Dec 2016 21:47:09 +0100 Message-Id: <20161210204712.21830-5-christoffer.dall@linaro.org> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20161210204712.21830-1-christoffer.dall@linaro.org> References: <20161210204712.21830-1-christoffer.dall@linaro.org> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Some systems without proper firmware and/or hardware description data don't support the split EOI and deactivate operation and therefore don't provide an irq_set_vcpu_affinity implementation. On such systems, we cannot leave the physical interrupt active after the timer handler on the host has run, so we cannot support KVM with the timer changes we about to introduce. Signed-off-by: Christoffer Dall --- virt/kvm/arm/arch_timer.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/virt/kvm/arm/arch_timer.c b/virt/kvm/arm/arch_timer.c index c7c3bfd..f27a086 100644 --- a/virt/kvm/arm/arch_timer.c +++ b/virt/kvm/arm/arch_timer.c @@ -418,6 +418,31 @@ static int kvm_timer_dying_cpu(unsigned int cpu) return 0; } +static bool has_split_eoi_deactivate_support(void) +{ + struct irq_desc *desc; + struct irq_data *data; + struct irq_chip *chip; + + /* + * Check if split EOI and deactivate is supported on this machine. + */ + desc = irq_to_desc(host_vtimer_irq); + if (!desc) { + kvm_err("kvm_arch_timer: no host_vtimer_irq descriptor\n"); + return false; + } + + data = irq_desc_get_irq_data(desc); + chip = irq_data_get_irq_chip(data); + if (!chip || !chip->irq_set_vcpu_affinity) { + kvm_err("kvm_arch_timer: no split EOI/deactivate; abort\n"); + return false; + } + + return true; +} + int kvm_timer_hyp_init(void) { struct arch_timer_kvm_info *info; @@ -449,6 +474,11 @@ int kvm_timer_hyp_init(void) return err; } + if (!has_split_eoi_deactivate_support()) { + disable_percpu_irq(host_vtimer_irq); + return -ENODEV; + } + kvm_info("virtual timer IRQ%d\n", host_vtimer_irq); cpuhp_setup_state(CPUHP_AP_KVM_ARM_TIMER_STARTING,