Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp1063166imj; Thu, 14 Feb 2019 00:14:13 -0800 (PST) X-Google-Smtp-Source: AHgI3IYQAcVkpWHWqQza24PE72PrKX4JAdPrioAG3YRpFDSy7GV8AqjysdmgiaSD+QqSpGkFHQZv X-Received: by 2002:a17:902:bd42:: with SMTP id b2mr2869006plx.27.1550132053347; Thu, 14 Feb 2019 00:14:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550132053; cv=none; d=google.com; s=arc-20160816; b=b91/OAuT4EMTEAh38C/UnlJS5TDg1LMH5yRm82GnS6JBnPbCI1vDud+Da6TYK+/0ry mKAP/NxrW6jhYUxCFrrylOBwsMOz2PO19xHvlL+RCJiuWmZhjCMBfjFyGlvbF2FxMi9n J4w8K/4mU+HJi9NTzeQQuhMwuaXAJk6uqNfO2eBsb372L/DuzUGdNtEcRkdaZ6Qu7Ru/ dEJmLHKgXw97aLwKzzUm7EjHa3b11cIOzSGa1mYuJCd3NTsDsblDJOnE4Q4KBPQmzrz9 8c/fjFc3teaovaeNgvlhV0MB8rhUXZG1NpSFvk34IaSasyqqgZyM/QOZuDB6KuGd7M4u 4TMg== 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=o+VEzNF9VfiHnjq/kcbz/QkUCA/mzm6Bkf7erp3MM90=; b=jchwheaGj9DKW4kusP6MMU00o9FLbM7YkxIlzmzLlGuw9gQZGYcPQSR9eFcMHnogiC /KNwHpcVoDeBOaisPnzD+28YP6S5hKQTkWW7qD3e3bD/DTLF6q+rc5z9aHOarzRiSMw3 M/0mxWHApbmG1rcwAA5K/+uQE20AAv0IKLJQJ+vdJYwyRh0fxtDeviRWzLWIsvv+hxc3 S/QsktiV2UsfdeUKR8Ccomq6DAFLKER0EXWWf5Xtb2facvLkSTuiGlURMP0QMPGioJjz gupfk0ryHIXpBWann29ebTdKDAOXGCD5OOLl7Cnj0GkhYVpmih9CKNHhXKiFNMUCzyqT Bgfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=VVxUIGPn; 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 d10si1815121pgf.136.2019.02.14.00.13.57; Thu, 14 Feb 2019 00:14:13 -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=VVxUIGPn; 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 S2394594AbfBMUS3 (ORCPT + 99 others); Wed, 13 Feb 2019 15:18:29 -0500 Received: from esa3.hgst.iphmx.com ([216.71.153.141]:65229 "EHLO esa3.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2394565AbfBMUSW (ORCPT ); Wed, 13 Feb 2019 15:18:22 -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=1550089102; x=1581625102; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=8ACS64L8kLVdF8msWr97l0gsAFThAeL/KOxtN4a6b6E=; b=VVxUIGPnrPsTshRj2d39qcXvB8IUX9kdL1ZMD5cPZsKNOcCGyReuq97Z wbPGBVjJTV4AyrPlWj5dmbEoUL08aJzKiORZS8LH5zr9HhkXafg52y+V6 mE/ly+kjyrNCZlLEndNH4ZNqg3J8vvo5ui27S6RQ78Ou7EGyyjdl729yE 1Gy+A9BP1r49AXi8fxep25y+QlGcDUZykzTyGU/GaHug4reHSkVoCDJcS SvfG51aJvg0wzZqdBf6aBzq7NSq6XkC7waJ4UrBkeDEaqd5NH0C9im4SK u/H3EtBrqylJw80/ZROdOz5FW7DkIBCP2NJIF8aDXtnxbPMHiVWLehqB4 w==; X-IronPort-AV: E=Sophos;i="5.58,366,1544457600"; d="scan'208";a="106167289" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 14 Feb 2019 04:18:21 +0800 Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP; 13 Feb 2019 11:58:56 -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; 13 Feb 2019 12:18:22 -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 , Guenter Roeck , Jason Cooper , Johan Hovold , linux-kernel@vger.kernel.org, Marc Zyngier , Palmer Dabbelt , Paul Walmsley , Thomas Gleixner Subject: [v5 PATCH 7/8] irqchip/irq-sifive-plic: Check and continue in case of an invalid cpuid. Date: Wed, 13 Feb 2019 12:18:11 -0800 Message-Id: <1550089092-28783-8-git-send-email-atish.patra@wdc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1550089092-28783-1-git-send-email-atish.patra@wdc.com> References: <1550089092-28783-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