Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp63963ybp; Thu, 3 Oct 2019 10:13:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqzc1hsNWVxtNN4GPpblsl1xwzMLsZ8Y1PiSpgOlA62rYHplYbmrdxHTl/JkwPPxTsJAC7oj X-Received: by 2002:a50:91d0:: with SMTP id h16mr11022489eda.152.1570122789086; Thu, 03 Oct 2019 10:13:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570122789; cv=none; d=google.com; s=arc-20160816; b=raIkqWQxxz7PqvILDYdbx9OJyggM24g1FyLIFrTWVBF2BnZKcUytQpxGLQuw9sRWSj w4s/99fcIJX2GiAY/E7JkK/yN1WPGp9nKJodXYMW4TeL/Ww1x0kZi5ymo0BILJYIW8UC TzytGeHgNrjTVPkomQGRcB6802+JyOO7S6m45Xaw8WD/rch57pumXhRlbQoLXtXg9BiP XeMoJ34PWRfrtNwA75U3z2fq3D2JfH2Ind8n+n4iKRN8mSasoemUEIM2haSE1IwpwhAd +pBW9bbDAIkRjtDhejYYuyKGFaAekY8ppaXUo4I4X34U61DfEXO8UHpbKNkEIEUzqaiF PBSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=pUcW3xI+lVlTq2GhBQf3+55t6gGR+VxqjcPzfLas+w0=; b=dg6y1Oqshtx63nHw4CnlKA7v4IlWJup6Ic1QB1xJ8SYZoQAp6J6DOG2fU9SA/eoK/W vpLPhIZHZKWzqqM+CIGzRt1bcfiEnz3L9FctonLNGhpCH8/YrRMSZ8btUv9hy+CFs9+g duGkKGOJUqaCIjBhzuST9Q2ouEB9MELGZ8mLir1aMGlQiRYMTQ9JJE2EPkQaLceMQpCl o7lBDfil1/7ISwmpxqeeJHls+RttWPGBXvj0UO1wfoz6s/n0C1lX7wn/BvO7fkc/kbXT v6rp8t6vcKLhdSqPF/33Y22715xwZ3fXe3Lbdx9CUfuoJ1uNuNrJ6QsiFwXJjQthJ5jX By1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=eU805n9z; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i12si1614823ejj.119.2019.10.03.10.12.44; Thu, 03 Oct 2019 10:13:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=eU805n9z; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2393445AbfJCRLP (ORCPT + 99 others); Thu, 3 Oct 2019 13:11:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:39420 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2403936AbfJCQcC (ORCPT ); Thu, 3 Oct 2019 12:32:02 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B2F97215EA; Thu, 3 Oct 2019 16:32:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570120322; bh=UcXwOX4Q3s/OeMb0P6GUol/4vmnAyQo333LJD65XGZo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eU805n9zDFqUAmYvyA4VxROxSzc+7E0B9A/XwiAXbJV9Kk7BOOHL3lb00H0rAQFoj jKrQ7TBjGrKieHc93G3AbwJHrTGOAFXh5moR/g+fwxBcx04LcqU+/cOR+aa1dfkGRU HP3nJbfnVCvYmF4J8Hhsi83RQyNHf8v/2qhpxWLI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christoph Hellwig , Marc Zyngier , Paul Walmsley , Sasha Levin Subject: [PATCH 5.2 179/313] irqchip/sifive-plic: set max threshold for ignored handlers Date: Thu, 3 Oct 2019 17:52:37 +0200 Message-Id: <20191003154550.638931413@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191003154533.590915454@linuxfoundation.org> References: <20191003154533.590915454@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Christoph Hellwig [ Upstream commit 9ce06497c2722a0f9109e4cc3ce35b7a69617886 ] When running in M-mode, the S-mode plic handlers are still listed in the device tree. Ignore them by setting the maximum threshold. Signed-off-by: Christoph Hellwig Acked-by: Marc Zyngier Signed-off-by: Paul Walmsley Signed-off-by: Sasha Levin --- drivers/irqchip/irq-sifive-plic.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/irqchip/irq-sifive-plic.c b/drivers/irqchip/irq-sifive-plic.c index cf755964f2f8b..c72c036aea768 100644 --- a/drivers/irqchip/irq-sifive-plic.c +++ b/drivers/irqchip/irq-sifive-plic.c @@ -244,6 +244,7 @@ static int __init plic_init(struct device_node *node, struct plic_handler *handler; irq_hw_number_t hwirq; int cpu, hartid; + u32 threshold = 0; if (of_irq_parse_one(node, i, &parent)) { pr_err("failed to parse parent for context %d.\n", i); @@ -266,10 +267,16 @@ static int __init plic_init(struct device_node *node, continue; } + /* + * When running in M-mode we need to ignore the S-mode handler. + * Here we assume it always comes later, but that might be a + * little fragile. + */ handler = per_cpu_ptr(&plic_handlers, cpu); if (handler->present) { pr_warn("handler already present for context %d.\n", i); - continue; + threshold = 0xffffffff; + goto done; } handler->present = true; @@ -279,8 +286,9 @@ static int __init plic_init(struct device_node *node, handler->enable_base = plic_regs + ENABLE_BASE + i * ENABLE_PER_HART; +done: /* priority must be > threshold to trigger an interrupt */ - writel(0, handler->hart_base + CONTEXT_THRESHOLD); + writel(threshold, handler->hart_base + CONTEXT_THRESHOLD); for (hwirq = 1; hwirq <= nr_irqs; hwirq++) plic_toggle(handler, hwirq, 0); nr_handlers++; -- 2.20.1