Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3931341imu; Fri, 18 Jan 2019 22:00:09 -0800 (PST) X-Google-Smtp-Source: ALg8bN5jhXubG4RodB2awMMlSYC/iBSTmdzEPkaZB53X9JZX+deYCsXb7jZbxpCHmkn75TFGZvM0 X-Received: by 2002:a65:6491:: with SMTP id e17mr20380162pgv.418.1547877609470; Fri, 18 Jan 2019 22:00:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547877609; cv=none; d=google.com; s=arc-20160816; b=PikvApL3u8RBTbkm2g8+x7BXHsDhCZOUeroNoVV2IEkaxjXDbosNZP5PNRUvNmkVLZ TFzqiPrAsl9HdfGWTBmCdv1sZiKuTMqSOYXTqO1ffz0ju11LtcwwdQ9O0ARO247z6eTq 3OzLO2vmDc+JIMzH1J7H0c+RnlJiqfOOHrUpAvFy60NCV4WjbfAqpspy22oCylTb4PNn fW91hVXCVk7IETUQmehsJX60zpDv5LXphoFSGmrrrnXgERl5oI7RbywqfVl4FO9AfwLR 88YvRSA3uW9FBo0ot0JCcFBZ9tfzvgokQK1DF3+pdgmiW8KSe/h0RwBmQjzbv4QGWQ84 VPRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=QPq/o0R9ggNlb2oMRGbkSeTpgM0rzBY83T9WPQ+nWrg=; b=kLsyHnLg2hFHikf07ejD8g/aaWkl05wXYHwNLYf4kTeXeQNF9MfcnWD+fp9Jg6L/vI KXnqbf0+a3OHjibN3N9LhjOqn0D5wG/WZzzGAGpkCjhBo08CSGSzYIgNtt718uD15sKC loDY6P53ISuO5lBezDs3144O0gDkuap5FQz1jMNHBkZrEj4x96FXHp07A1J8FlW+lto6 Zk9zzjtxpNyGtQNjGGnE7MT9zBg7Z298wq/+ADC/iwWhq41eBVJagfpy3rfmfscm4s20 ju+x5ERWRBVEKmLSJYe24OHxa7mUqjZGbZYXRyZQfrzprBTpghKtYgQ3ls8ndHFKqwpc QOmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@brainfault-org.20150623.gappssmtp.com header.s=20150623 header.b=c9iglgff; 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 j91si6571953pld.395.2019.01.18.21.59.53; Fri, 18 Jan 2019 22:00:09 -0800 (PST) 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=@brainfault-org.20150623.gappssmtp.com header.s=20150623 header.b=c9iglgff; 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 S1727589AbfASF5P (ORCPT + 99 others); Sat, 19 Jan 2019 00:57:15 -0500 Received: from mail-pf1-f196.google.com ([209.85.210.196]:37048 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726048AbfASF5O (ORCPT ); Sat, 19 Jan 2019 00:57:14 -0500 Received: by mail-pf1-f196.google.com with SMTP id y126so7642331pfb.4 for ; Fri, 18 Jan 2019 21:57:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brainfault-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=QPq/o0R9ggNlb2oMRGbkSeTpgM0rzBY83T9WPQ+nWrg=; b=c9iglgffLpFLhSbvvzWlFeS/AvjO1P40S00smgVlLs3YsQBwjZMXqbP/aAAXhAhoaU sKCAXePv6bS9r+kmQxgtpiCwwGLxGZXp18KdPCWPBXk+TdXZmD/7a0tuyJQ0d8R87xnr Q07fJcQPr9WP5xf5QruBLirguXjfdTkl/nCWXHQXBo05DtYfxtdR562jSwn/QG2Kt4n9 SXqkAy/msiA/fclUCpM8xKtfjqpzZnHtdmGNkRFjfrx47tJrq76JfHYFCdmYsDT13s7T tdwo5AXFp3mV+gX8qwruOOmNRzuHiJz0djr8IRmL84vE+A5Lpx0b7h/WeDJGL4Spqm87 KbOA== 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=QPq/o0R9ggNlb2oMRGbkSeTpgM0rzBY83T9WPQ+nWrg=; b=Srov1nHBXYUNyzTXZwHnzVEScZxyCswkIwsoda4DL1KGZbvEaR/nw7zBqoPH0WVwCI 8SiWnoBu/WQnm5SNe4UkVhq+XXWRwwF1lmzIg/yGC5Hbjb3BlPqe8diRL7YtB+6IQIJJ vyrQ3qAOVwZN9oxVHelft7ttJp1wkZqjkIdt9WOSxuI4WWx33V9UMk2Ko7nOIKbA91aK B7N/w17VugruzWKbYlUUWHn+HUSUHwKIE+ob/pXVHn56ObI2eCHsLHCEiH54yZ7qIj3a +SvWZfPBqb+cIM3g3IOxwnZvvm+RhaFBfwDKnEYM9jCp4lJH2GjK4PuZsuerheziKsGG J8yw== X-Gm-Message-State: AJcUukfqCuz+mcuCEIh5vUbAbgxxa19l8bG/Hznst3G1MdpJkddi+Xtn uVerwBRjVQK1NmCKkt7YRL12Lw== X-Received: by 2002:a63:f412:: with SMTP id g18mr20671728pgi.262.1547877432781; Fri, 18 Jan 2019 21:57:12 -0800 (PST) Received: from localhost.localdomain ([49.207.51.221]) by smtp.gmail.com with ESMTPSA id c7sm9295535pfh.18.2019.01.18.21.57.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Jan 2019 21:57:12 -0800 (PST) From: Anup Patel To: Palmer Dabbelt , Albert Ou , Daniel Lezcano , Thomas Gleixner , Jason Cooper , Marc Zyngier Cc: Atish Patra , Christoph Hellwig , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Anup Patel Subject: [PATCH v5 3/5] irqchip: sifive-plic: Add warning in plic_init() if handler already present Date: Sat, 19 Jan 2019 11:26:23 +0530 Message-Id: <20190119055625.100054-4-anup@brainfault.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190119055625.100054-1-anup@brainfault.org> References: <20190119055625.100054-1-anup@brainfault.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We have two enteries (one for M-mode and another for S-mode) in the interrupts-extended DT property of PLIC DT node for each HART. It is expected that firmware/bootloader will set M-mode HWIRQ line of each HART to 0xffffffff (i.e. -1) in interrupts-extended DT property because Linux runs in S-mode only. If firmware/bootloader is buggy then it will not correctly update interrupts-extended DT property which might result in a plic_handler configured twice. This patch adds a warning in plic_init() if a plic_handler is already marked present. This warning provides us a hint about incorrectly updated interrupts-extended DT property. Signed-off-by: Anup Patel Reviewed-by: Christoph Hellwig --- drivers/irqchip/irq-sifive-plic.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/irqchip/irq-sifive-plic.c b/drivers/irqchip/irq-sifive-plic.c index 01bbbbffbcae..b9a0bcefe426 100644 --- a/drivers/irqchip/irq-sifive-plic.c +++ b/drivers/irqchip/irq-sifive-plic.c @@ -229,6 +229,11 @@ static int __init plic_init(struct device_node *node, cpu = riscv_hartid_to_cpuid(hartid); handler = per_cpu_ptr(&plic_handlers, cpu); + if (handler->present) { + pr_warn("handler already present for context %d.\n", i); + continue; + } + handler->present = true; handler->hart_base = plic_regs + CONTEXT_BASE + i * CONTEXT_PER_HART; -- 2.17.1