From patchwork Mon Jul 17 14:27:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 9845287 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 6F53760386 for ; Mon, 17 Jul 2017 14:28:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 628612851D for ; Mon, 17 Jul 2017 14:28:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5794A28520; Mon, 17 Jul 2017 14:28:37 +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=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI 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 D16422851D for ; Mon, 17 Jul 2017 14:28:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751595AbdGQO2V (ORCPT ); Mon, 17 Jul 2017 10:28:21 -0400 Received: from mail-wm0-f47.google.com ([74.125.82.47]:35333 "EHLO mail-wm0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751470AbdGQO1b (ORCPT ); Mon, 17 Jul 2017 10:27:31 -0400 Received: by mail-wm0-f47.google.com with SMTP id w126so77795191wme.0 for ; Mon, 17 Jul 2017 07:27:30 -0700 (PDT) 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=7TkxhFVS1KPDhuDzehA8E5UVV7nBl6iavwa5iHCNaH8=; b=LyamvrV5QRN6r4Yn1BEoWcmB2ObdWGtvpWNYx7o4Oy3n/r5c5wekbjV2FE7aDnr6C5 28It35lAtiQGE0KUe/ZKMfv/UOjJseDo9gptNRh7KTAixpFostvhTJOS4DRBffrMOWXH nACvDqdszJ60vKtVGa8tIvxjF+1/A3o4Z9Tj8= 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=7TkxhFVS1KPDhuDzehA8E5UVV7nBl6iavwa5iHCNaH8=; b=KBFx++fvAXND+fOr4Uyjzme+jQ2KA6a3tgQxgIi7i+W+I3GzzfNn9/VuWLwB5KePSk GSVWv58b+Ne85J65ni1C8CJNv6O2vsmMeazLjso048ZesPv5ki9ewxv3vCNNZ7CTZ6pP F+x3mUOBS5pi9Mv1bffNolYHR44tcaHkLOe2ZwK/OxszGTYYk6B4JxKLta4S+4ccvqO4 TB37GmljdZd2Oj2Xm8QafbNVr6tMabtUQZfAClV5amhRKcmyIWQWO/yujCooqkFTGwLD zcBz57XLp2t845E2th2bSnl1eT1mhXZfv1jLqz2X5QtrfB0d5EisB+WkJitWo9URXddG UHow== X-Gm-Message-State: AIVw112d5XmDPoBjbGjHOhFHg3xVul4S2OoZQAImxiNdKk4mORZc9yai SaRf4QwsZbPKag2G X-Received: by 10.80.148.118 with SMTP id q51mr18086456eda.28.1500301649961; Mon, 17 Jul 2017 07:27:29 -0700 (PDT) Received: from localhost.localdomain (xd93ddc2d.cust.hiper.dk. [217.61.220.45]) by smtp.gmail.com with ESMTPSA id b30sm9428952edd.6.2017.07.17.07.27.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 17 Jul 2017 07:27:29 -0700 (PDT) From: Christoffer Dall To: kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Cc: kvm@vger.kernel.org, Marc Zyngier , Christoffer Dall Subject: [RFC PATCH v2 05/19] KVM: arm/arm64: Check that system supports split eoi/deactivate Date: Mon, 17 Jul 2017 16:27:04 +0200 Message-Id: <20170717142718.13853-6-cdall@linaro.org> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20170717142718.13853-1-cdall@linaro.org> References: <20170717142718.13853-1-cdall@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. 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 an in-kernel GIC with the timer changes we about to introduce. This patch makes sure that trying to initialize the KVM GIC code will fail on such systems. Cc: Marc Zyngier Signed-off-by: Christoffer Dall --- drivers/irqchip/irq-gic.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c index 090991f..b7e4fed 100644 --- a/drivers/irqchip/irq-gic.c +++ b/drivers/irqchip/irq-gic.c @@ -1391,7 +1391,8 @@ int gic_of_init_child(struct device *dev, struct gic_chip_data **gic, int irq) return 0; } -static void __init gic_of_setup_kvm_info(struct device_node *node) +static void __init gic_of_setup_kvm_info(struct device_node *node, + bool supports_deactivate) { int ret; struct resource *vctrl_res = &gic_v2_kvm_info.vctrl; @@ -1411,6 +1412,9 @@ static void __init gic_of_setup_kvm_info(struct device_node *node) if (ret) return; + if (!supports_deactivate) + return; + gic_set_kvm_info(&gic_v2_kvm_info); } @@ -1419,6 +1423,7 @@ gic_of_init(struct device_node *node, struct device_node *parent) { struct gic_chip_data *gic; int irq, ret; + bool has_eoimode; if (WARN_ON(!node)) return -ENODEV; @@ -1436,7 +1441,8 @@ gic_of_init(struct device_node *node, struct device_node *parent) * Disable split EOI/Deactivate if either HYP is not available * or the CPU interface is too small. */ - if (gic_cnt == 0 && !gic_check_eoimode(node, &gic->raw_cpu_base)) + has_eoimode = gic_check_eoimode(node, &gic->raw_cpu_base); + if (gic_cnt == 0 && !has_eoimode) static_key_slow_dec(&supports_deactivate); ret = __gic_init_bases(gic, -1, &node->fwnode); @@ -1447,7 +1453,7 @@ gic_of_init(struct device_node *node, struct device_node *parent) if (!gic_cnt) { gic_init_physaddr(node); - gic_of_setup_kvm_info(node); + gic_of_setup_kvm_info(node, has_eoimode); } if (parent) {