Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp2026498ybd; Sun, 23 Jun 2019 22:45:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqy7pCX0CpVbOGE3c1nUD0bf5+Lp4JaPgfVS4QrKCKmdK6/jY0Lmtij6dP9WwJ/UVkcoKeqz X-Received: by 2002:a17:90a:bc42:: with SMTP id t2mr22646925pjv.121.1561355129240; Sun, 23 Jun 2019 22:45:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561355129; cv=none; d=google.com; s=arc-20160816; b=FvsWuWLhQubXOMYGlMNIEJFh2ID34XhMLB/iGTLLLiSUHjaYXFkPxp/+l2drWQUejp IFWYh5ngeXMA4vi8i4gKNFSiCO4ziBHVcxtPcZdvj/NH5PF3sG91P0TAijxWxnFdPniU /pWbR3EfXnJLwnrlQC/szqGv2k50k2Ug1Cu1lbeZXnFQscv2sqNb9kUgV80qc0KfEEdM L0oFMsScwivnJCNZ8XJqq+7GDwDpjL83GJ7WppUHefK/QsAeY4lsQZYPXlGaqqQZxoZs QTs6sEvMNJpP+VaR6lULx/hKlP9FmJ1leAUtmLkDWtoQwED6Du/TiKZDCJYLn6zDEq/2 UdmA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=vOVF1bL6OtEC3ny1W9eKFWhCTN+KLHMSW/CBbgd+PKs=; b=fAhKPWASZ+KDvDOxouphn0Wqm77QATIm6Oad+FeljeRKuDD9whQcmD5pGPo1NW038Q u0F745GlW8uWtLBT7pHTF4bBNYFJKy52bQGdaNjobAqmURijVI8rrw7Mmp25ogh8dsY0 zcL6Xc0wkXZ9mS+ynPVfbMHk479S7V0L4GXuAc3fyypR+ikvl5OxP80vtNKU5hO/Pxw+ BfnbG4eH//leTWHActJl6oNufjV1jyLlTKTM9Pd6qSIg0wnUHLzrABeCwNLezf87keqQ fN3loY4JcoWxDEcXlZq46KQjVbvh7YcW9Vf8d84Uasb/02OwyEq6qczuNnKpDdPwtIFQ LEeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=fMawuu3O; 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 i62si9847168pge.573.2019.06.23.22.45.13; Sun, 23 Jun 2019 22:45:29 -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=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=fMawuu3O; 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 S1727206AbfFXFnd (ORCPT + 99 others); Mon, 24 Jun 2019 01:43:33 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:35358 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726223AbfFXFnb (ORCPT ); Mon, 24 Jun 2019 01:43:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From :Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=vOVF1bL6OtEC3ny1W9eKFWhCTN+KLHMSW/CBbgd+PKs=; b=fMawuu3Opqat44vDe3HBjfC2NV U5+fXW3mv7s7Jlh5elWKOcphZfFUedF1vGm+7MYpefOZ9keuy6mkobCiyuiWMY5CLEcGsBYr3epoG m757TAQi2HxXtEeXw31FzGZsYfQbEb96/9Ia45hV6LD8/DMRBoIc4DCLBiY6bHE3E/pVumBkLBY5w zQsrCXvA58a8v8QR10iyNRva5OtbMApi6LzDxtYh6XUzs8CFb1qIBB/sbzkWkI0sjoTbtb5hHeHM8 YgjPe0IwJKPuJTnzuw0MJiDrV8RqIWDzx9q3MB2qJlJKHNWksaE9721c9vrJkODjAmgxyXQOo4sY+ 3XbUdhVw==; Received: from 213-225-6-159.nat.highway.a1.net ([213.225.6.159] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1hfHlJ-0006Cb-Dy; Mon, 24 Jun 2019 05:43:29 +0000 From: Christoph Hellwig To: Palmer Dabbelt , Paul Walmsley Cc: Damien Le Moal , linux-riscv@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 04/17] irqchip/sifive-plic: set max threshold for ignored handlers Date: Mon, 24 Jun 2019 07:42:58 +0200 Message-Id: <20190624054311.30256-5-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190624054311.30256-1-hch@lst.de> References: <20190624054311.30256-1-hch@lst.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When running in M-mode we still the S-mode plic handlers in the DT. Ignore them by setting the maximum threshold. Signed-off-by: Christoph Hellwig --- 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 cf755964f2f8..c72c036aea76 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