Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp1105190imj; Thu, 7 Feb 2019 17:52:35 -0800 (PST) X-Google-Smtp-Source: AHgI3IZm3c0cBX+DgnOUiohW3unMg/CmxNM2mxPPA2Bcs+fx3DQreNUBWgY46wfMqhNYakZrZSdZ X-Received: by 2002:a63:f444:: with SMTP id p4mr2828989pgk.124.1549590755259; Thu, 07 Feb 2019 17:52:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549590755; cv=none; d=google.com; s=arc-20160816; b=Q6DVSUQm1LmYFv5w2X+4wZucfJT9hoWzSpc4NCFBPshy5eDZ1V6Pc1+3PSPTdjA+db 2C0WOyZ7aoi3NAOJVHC3+vsmVlwXDbAxIswngT5url0vXXwJ9a+DDOqLeQ1q2S35OZPA DXddyMCgwBaVIE8NNI2fo2QBTSJw2Ao2le+Ua7lOXWl06ibkrBe+u4m+j9umS1M+FoNt 4FmbJhr/gn+N+HZwzpsYdBCFhyV1HKk/adN4dGqqT1wbqeY395rGaUj4tzzz2fSC3730 HYxOKS+WgIz5n0r8a7vTtlrc8WfrPL43AFtbnMA9goirqdCqHURHmGKyIxRfud9M+ZVA /coA== 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=KVKXsjcVKkVdmwlxj/29FYqkjjsTc2UvBu/+UdKP9Ss=; b=KF7KeYEfQgjRulfGMQIf0shBsLur8il7kEWdMJk9lwaYRd+H7gJokUWCTxvDP4D/WW y+zrgV+Hplr1DsAHa0HUc5PYIZHgCiPvVZd4bGRJL28f+G5Ai17ex/lQZjLP4iNeXKKB 7RgJRsRy/NYI5PGB/u4MbTDNRYP7wVUVNntSgA0G1rxYdU+XsAEgNEfkLQIy8a1MpAmK SMWghG+W6GPwAonyc8658gPoVmAB2HRE3zLXoARd0o50WF0VbxQ3tf4FIBlLD61uMEmc ltDq+J3rX6r34zC6BbFssmR+Ac3qTwTAb7ji7kuKfFOhM0GJhXob6yjYgLH1JUdScbbJ BUVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=IBf7WKps; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=wdc.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ay4si713177plb.235.2019.02.07.17.52.19; Thu, 07 Feb 2019 17:52:35 -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=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=IBf7WKps; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=wdc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727308AbfBHBvy (ORCPT + 99 others); Thu, 7 Feb 2019 20:51:54 -0500 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:13327 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727223AbfBHBvi (ORCPT ); Thu, 7 Feb 2019 20:51:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1549590698; x=1581126698; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=yFxyFB1JVE6e5EMBaqk5nHsWdldjjgWU0zDphOBw+f8=; b=IBf7WKpsyRS1Xc/frW0W6c+9LHK4GVcRkqMlkNPPE/cbiyBfKZJaR0xf zCwPE8g5ABWJ6CAajTLUBmryp7hDFmqtQrulRpq/TKs1aU16Uqcrw6seD rjRiAG9pr50S7SPILEj91PEAtp21DpWqvHYRur05cxdZU+YDU2r+I/zH/ fw7BsvzgIujfEI84ba0b9xxnl8Ko1nfFw0DYMJGExLj46tEP2jpPxHYj0 XFcy/6c8Drna6rHb1I6KuJqSBlSDCGqfMYKfh4k4nrPeOOVPhybIasCA0 g59V87Rd161cYIJ/3XiONsdmYlN2ZHOOMIdqJG/LQmOOMGC6MOkRyPeCG A==; X-IronPort-AV: E=Sophos;i="5.58,346,1544457600"; d="scan'208";a="100752820" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 08 Feb 2019 09:51:38 +0800 Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP; 07 Feb 2019 17:32:21 -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; 07 Feb 2019 17:51:37 -0800 From: Atish Patra To: linux-riscv@lists.infradead.org Cc: Atish Patra , Alan Kao , Albert Ou , Andreas Schwab , Anup Patel , Daniel Lezcano , Dmitriy Cherkasov , Jason Cooper , linux-kernel@vger.kernel.org, Marc Zyngier , Palmer Dabbelt , =?UTF-8?q?Patrick=20St=C3=A4hlin?= , Paul Walmsley , Thomas Gleixner , Zong Li , Damien Le Moal Subject: [v3 PATCH 7/8] irqchip/irq-sifive-plic:: Check and continue in case of an invalid cpuid. Date: Thu, 7 Feb 2019 17:51:20 -0800 Message-Id: <1549590681-24125-8-git-send-email-atish.patra@wdc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1549590681-24125-1-git-send-email-atish.patra@wdc.com> References: <1549590681-24125-1-git-send-email-atish.patra@wdc.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; -- 2.7.4