From patchwork Tue Jan 8 09:38:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Atish Patra X-Patchwork-Id: 10751727 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EC41414DE for ; Tue, 8 Jan 2019 09:39:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DA49C2625B for ; Tue, 8 Jan 2019 09:39:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CE9B328864; Tue, 8 Jan 2019 09:39:04 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8C0CB2625B for ; Tue, 8 Jan 2019 09:39:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=Hn8tPbLs5wq7OnIXj8LC4XthZctS8qwMEG9+VR2o1cY=; b=ZG1KVoQImgKwb0pbkcOiupUv5P fgQh0yjFYk39fXD+1MKJXN4yFDJia7q/UeolycGxEWWl+xiCgn9048QEbscpgve39CB7f95Jov2sq XpwYhgsQ/GPkJ3f6kIhw1XbHYn8Bs/wctWysQUlJm9HZtUhj65vu05Tjgd4lpgpeFj/KFykuMeW8p 0rN6WZPu41F0w+4BrkpsuSXVRMqOx/Eq7gt5SMfDk6mLOHQQi3zgIH+Lp0ApWiYlkaZ6gbkz3AIW0 7404cxVQzEYcC2n8kBi+xTwiC+JrH6+2of5GyQCULZo9/BCq7pjPA6zE+f71iwsQJjoY+uKEEl/TR pAJ8mCdg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1ggnqh-000425-9f; Tue, 08 Jan 2019 09:39:03 +0000 Received: from esa6.hgst.iphmx.com ([216.71.154.45]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1ggnqV-0003lv-0S for linux-riscv@lists.infradead.org; Tue, 08 Jan 2019 09:38:56 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1546940332; x=1578476332; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=bw1/Vq2gne9LAKNuyEBhQX+XTh+Fz0MdGc7HYnZ0izk=; b=DSRG03E9Ba1K7rcKXlL2HzxhKoZLZgRTGeyMZPBV/GFxMIQGbPfx9CtF dR0+ky3g17XHhGxoUCIDZOZQyZxdxFSF8CsySMFarKh8NWHC+reZjAKzx kI6sUKxeyWBXCofAcVec4cbR8qxHaa6WtVuA4dnDjiWfBYbobov4wY/en EJGCOBsyRllzsFJYMQVRx1k2hG1GbGCY8a+pzunBbDWbLpmtEkQsnKkU0 cDrXO1aqfpjUGeVgMBBB1E5r02uEfrGPO54W1dNbKPppdTY97/F6RH92r q6E+6N+3sIcusm2CCb+Lr13N8MiNic7xZ/feSncSdJQ1iCTWRgKI3UnMl A==; X-IronPort-AV: E=Sophos;i="5.56,453,1539619200"; d="scan'208";a="100000261" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 08 Jan 2019 17:38:49 +0800 Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP; 08 Jan 2019 01:18:53 -0800 Received: from jedi-01.sdcorp.global.sandisk.com (HELO jedi-01.int.fusionio.com) ([10.11.143.218]) by uls-op-cesaip02.wdc.com with ESMTP; 08 Jan 2019 01:38:47 -0800 From: Atish Patra To: linux-riscv@lists.infradead.org Subject: [PATCH v2 7/8] RISC-V: Check and continue in case of an invalid cpuid. Date: Tue, 8 Jan 2019 01:38:37 -0800 Message-Id: <1546940318-9752-8-git-send-email-atish.patra@wdc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1546940318-9752-1-git-send-email-atish.patra@wdc.com> References: <1546940318-9752-1-git-send-email-atish.patra@wdc.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190108_013851_184931_C4B7D8FE X-CRM114-Status: GOOD ( 10.57 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Patrick_St=C3=A4hlin?= , Albert Ou , Jason Cooper , Alan Kao , Dmitriy Cherkasov , Anup Patel , Daniel Lezcano , linux-kernel@vger.kernel.org, Michael Clark , Atish Patra , Palmer Dabbelt , Andreas Schwab , Marc Zyngier , Thomas Gleixner , Zong Li MIME-Version: 1.0 Sender: "linux-riscv" Errors-To: linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP riscv_hartid_to_cpuid can return invalid cpuid for a hart that is present in DT but was never brought up. Print the appropriate warning message and continue. Signed-off-by: Atish Patra Reviewed-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 357e9daf..254ecd76 100644 --- a/drivers/irqchip/irq-sifive-plic.c +++ b/drivers/irqchip/irq-sifive-plic.c @@ -237,6 +237,11 @@ static int __init plic_init(struct device_node *node, } cpu = riscv_hartid_to_cpuid(hartid); + if (cpu < 0) { + pr_warn("Invalid cpuid for context %d\n", i); + continue; + } + handler = per_cpu_ptr(&plic_handlers, cpu); handler->present = true; handler->ctxid = i;