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: 87583 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp950532qgi; Sat, 10 Dec 2016 12:49:27 -0800 (PST) X-Received: by 10.99.120.13 with SMTP id t13mr150339056pgc.17.1481402966963; Sat, 10 Dec 2016 12:49:26 -0800 (PST) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id r39si2830654pld.50.2016.12.10.12.49.26 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 10 Dec 2016 12:49:26 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) smtp.mailfrom=linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1cFoZA-0002D8-18; Sat, 10 Dec 2016 20:48:20 +0000 Received: from mail-lf0-x229.google.com ([2a00:1450:4010:c07::229]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1cFoYN-0001u7-I8 for linux-arm-kernel@lists.infradead.org; Sat, 10 Dec 2016 20:47:33 +0000 Received: by mail-lf0-x229.google.com with SMTP id y21so21797228lfa.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=Krw9ubU+5/lqX3BGkjyS+SM+KIj+xPzUDoPIN7X0jbiJS7ThgmjZd5ZS//qo7qOwWu WxPUNmZ/P0EX5xRCGC00mSHbm016I/OPsEEYe0e8NuPEWYSwXmmzF5Zb4RBf3GipMuse 8hMlcaV71dquZvIPn0vPcjqtqcQelC8IkTI/r1gxuDpzlMVEMwUABjQKerSOyu75kF5x iZGb2keijZruXRbnim3PgD1qxWuW9f6arE2hYO2osTJd1CGJLeLXWPVdAHGm5gmIyHBD ZBnkmfF8v6NzkRjt/PXEGUM9X8q94YawntNkbBdbw6dPLDndiDdv8qaEQXdaKrMX+wjc 27Lw== X-Gm-Message-State: AKaTC03aIFckjQkOIeqbnpL4XAfcFVko9PP1/EYuO6o+fZKIQHQCys3SsMK0RhlAE7lbepPj 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161210_124731_884178_452B170A X-CRM114-Status: GOOD ( 12.61 ) X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2a00:1450:4010:c07:0:0:0:229 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marc Zyngier , Christoffer Dall MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org 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(+) -- 2.9.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel 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,