Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp3803029imj; Tue, 12 Feb 2019 05:03:48 -0800 (PST) X-Google-Smtp-Source: AHgI3IYbYsu/hNod4EXa6J+1ule4ao/kYqko3xQzSUIpKd1nSylP1I+ACI588skRwO2N18TCms1a X-Received: by 2002:a62:76c9:: with SMTP id r192mr3916255pfc.251.1549976628556; Tue, 12 Feb 2019 05:03:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549976628; cv=none; d=google.com; s=arc-20160816; b=I/ecsgzhauwPXVKHHFpfuTFKq71LUNeffFc1pgapUO31NMnGVi394f3v1KNfxYs/9w rrQv2KeYAxBDMZ94qXajRWuORri+1sqrkyptQwBO+itmlQHQ9lOzGxWXjaWYOdCr+o+T io6P0U465T+PF8YH/PU9FQFmfZsFNTKQLOykttTS3MP5xjv7xbJ1gsHnIsexA+UuK4wh dZKyi3e9tQosRbsGyXw7cup8JV5Vstx5Teds3aW4Nb3dGwD0Y24zDsumOQXHt7xKcqEs jXHVTyHiiHWt9UBtDDB7dyuK3dcqFkqvvmE0new/PP1pBtRKVbGU5/3nz/nZX+3kB6FJ 7BNg== 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=KN7W2zftQeNZmthGr7261iLl0/Bm6gqlbkD5vYrU3Gg=; b=UGzMHsEDkMszj1lyXV4b/htkhmSWeyCZ306y8Q/7W672K4lmHHsIFKaiKFkMOotdEb 5dVtKClpys7QRb60HlblYNf+y2r/KGmES3MUvuuY+tQgN1eICA2TjIaKDCrDxmtXDJ1o J/NsVHVbb8qOpjOgXQnLWcQ4SxFO6QMAC5F5gjc/ts6bnYu7mqcBE6IXpjS805+uyDZQ CNPAH2viNCBBID0idcgOIKCt03WScB2fJsYIduz0J2w2Y8yhmRPrdfVX/xSnFc5XQyvG GuyGDEc9AoYJK5Z7TYbLqJq6KUeoB8niTyXOhQGrb6eyhQeF1rOlINJgymu5CyMW45rl hiJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@brainfault-org.20150623.gappssmtp.com header.s=20150623 header.b=clu9Clm+; 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 g11si13075922pgn.32.2019.02.12.05.03.27; Tue, 12 Feb 2019 05:03:48 -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=clu9Clm+; 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 S1729456AbfBLMxL (ORCPT + 99 others); Tue, 12 Feb 2019 07:53:11 -0500 Received: from mail-pl1-f195.google.com ([209.85.214.195]:34916 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728546AbfBLMxL (ORCPT ); Tue, 12 Feb 2019 07:53:11 -0500 Received: by mail-pl1-f195.google.com with SMTP id p8so1275039plo.2 for ; Tue, 12 Feb 2019 04:53:10 -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=KN7W2zftQeNZmthGr7261iLl0/Bm6gqlbkD5vYrU3Gg=; b=clu9Clm+93UAt2QM1XWrn1vYPSq8oKz3lHcIePW3ElbCv/vD1r/1EAYTg4Dsy8ZvyV PzCZ7vqUm9CIxcohKr3rfqfPZPBiNLyr9MYaqSiWF8zX9o9Kzeb00pXDXUIk+uQ+EBCF +Oh/zxkUTtWxZHDLdCNVbt4CivKTEBMeosjUlv8wIrXzaWiyN0zI26MRyg/OGMoiU84K lmDfJ6Kdqt5+hSGJg3U7R/49sSxcfwwZYCzCaKwoVLXP6n9ZeGmzQjTLQ2epB0JNxKVa WAuThza2V7FR07Xmco8aD1OZR5aLpGz2hx3HVz88gT9TklF6RP6Y/hGESlTNI28YJqah oXBA== 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=KN7W2zftQeNZmthGr7261iLl0/Bm6gqlbkD5vYrU3Gg=; b=HOpnKSwkWdGPht2Jpfdtd/CwXXU7cS31DJhkZAbbhms1duCKyxlzJewe1DTjFacg6a EYsFM8qIlV19UiTgrooZYiqJ4H6NGT37R1TZGFVHtLDeXh/umiD7dpcut3LL7Qjr6Vuq 9sUh1IThSMVXQlxLIoqVVytwuKonNgN1c33islfWyU5eg81Ms9yryD4eLADU6idZGwUo AC2qg11LpiwN7Jl2nepTq6hpFYX7UblPdlT+2QSi1Tkooke4PksHp+H7G3FXc5LHmLB0 2xreTbUv3YKvxnbq2HOKFblmHfGrXH7tAF3QBV5ZRbEpVerwALJYwjtz/XGh1hP9z6R3 QCgQ== X-Gm-Message-State: AHQUAuZg6RK248kbjsF8KVhsqUBYVGN70gGNta+k+PpiDQOCotX+0I2H NKd1tmw5iacXNMikA6nDbg8HBA== X-Received: by 2002:a17:902:8303:: with SMTP id bd3mr4030967plb.10.1549975990187; Tue, 12 Feb 2019 04:53:10 -0800 (PST) Received: from localhost.localdomain ([49.207.48.205]) by smtp.gmail.com with ESMTPSA id z67sm27894828pfd.188.2019.02.12.04.53.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Feb 2019 04:53:09 -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 v6 2/4] irqchip: sifive-plic: Add warning in plic_init() if handler already present Date: Tue, 12 Feb 2019 18:22:44 +0530 Message-Id: <20190212125246.69239-3-anup@brainfault.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190212125246.69239-1-anup@brainfault.org> References: <20190212125246.69239-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 c23a293a2aae..da09f46fad64 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