Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp3712429imj; Tue, 12 Feb 2019 03:27:24 -0800 (PST) X-Google-Smtp-Source: AHgI3Ia+N+BY8n0Dnjflb9cPnhrojxbNza6ht/83xR7ZdP1ZeUVNDi3zHnQ4DfY6hGU+PItT5B5q X-Received: by 2002:a62:4851:: with SMTP id v78mr3483411pfa.97.1549970844629; Tue, 12 Feb 2019 03:27:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549970844; cv=none; d=google.com; s=arc-20160816; b=Cjp/eKsCcLKNMBu9kEyC2VyGqD4byFmKdhthvBpDeGxOpeQzitUl1Ro7scNV7SOE0X Y7ysn5gZ20Ks4yq+rwdbdTwjiKFsseYQzbkyTMgnSGuqCinr6lwxgwbTjNEeSkLYcsAO oww1oz4rE5oh0oMxcpQyajdK4paOYJ87N+DRb1h7bODPTAL+c3yhq4jRJaGthplIw25V Jf8i9klitow8UBtLOEr3A5GCQ5MPP6pogFocj/lBJ5XHdsp77lMPtAg6iyXblP2XX82m S/JkWdKn7LsYWxpnZHAIS3Vh5is40xkEffFJynZsMgUHkS3BniaB292Lq4PJtrFVY4L/ BeCg== 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=XeBiDTZbXAErvGrOu9A2wVmM/EFZOTyNH3haE3SwBRtTgbkcN7V4P2bpYBTjPNJ0Jr 73oeIu4zYW/QZ0cPC+39lFkJ3k7x3Q6Iyuzf/O4hhEyRr26ATmky3663TfA98tpBM7wm JjIIhb6+A7KwxiielbCYacqBfdxSjiHdYf0Ff8HzK9RnXEzS3twdZHDw8jLNlDUCkwyj ZBJ5OUB4NEWLxMghN6bu8UT/yASREeNYT4nYRp26b5M/di5rulg8VGpq9a2hyDkbbqbh McOS3b/O/Ealvi4lAiIbsm4Fba0Nhv9PfwiVKjCvUYafCr29m+MJvYi1TmHsN6187uDI qowA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=Tzq+FqO2; 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 l67si13074325pfc.147.2019.02.12.03.27.08; Tue, 12 Feb 2019 03:27:24 -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=Tzq+FqO2; 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 S1729378AbfBLLK6 (ORCPT + 99 others); Tue, 12 Feb 2019 06:10:58 -0500 Received: from esa2.hgst.iphmx.com ([68.232.143.124]:42874 "EHLO esa2.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729300AbfBLLKd (ORCPT ); Tue, 12 Feb 2019 06:10:33 -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=1549969890; x=1581505890; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=8ACS64L8kLVdF8msWr97l0gsAFThAeL/KOxtN4a6b6E=; b=Tzq+FqO2loTP1FOcHwSSQeYpGtzQTmF/YC/GZO9uS1WZSFb5NNUGNnyj k/JkfCrWsc/Owfn2BHI+IIY5+mbVEJMkLgkpEo7Uzj2+KsinAesbTjVub diWGPasTIBpS7OSGSAHeLLBkiiHrOZlqhD0WAsdaTG9jBsSF3b8yEmI9Y b6V2VtfQPXdNFTXkbNiY6I/hRi9RW2V9LVnQrmOL+jjt2jnHwHX3vo95x juR7UkNyUm9MVNKYV3pD3/kHqRXELI9Zzgq7NbI2CMAKTDUQuyXhd3CuG sVHraZYK50r10D9nUJZQsoEkMXOrQyyowGhTFEU2nIIcl9ZFZn2PPHVG3 w==; X-IronPort-AV: E=Sophos;i="5.58,361,1544457600"; d="scan'208";a="199201839" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 12 Feb 2019 19:11:12 +0800 Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP; 12 Feb 2019 02:50:58 -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; 12 Feb 2019 03:10:23 -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 , Johan Hovold , linux-kernel@vger.kernel.org, Marc Zyngier , Palmer Dabbelt , Paul Walmsley , Rob Herring , Thomas Gleixner Subject: [v4 PATCH 7/8] irqchip/irq-sifive-plic: Check and continue in case of an invalid cpuid. Date: Tue, 12 Feb 2019 03:10:11 -0800 Message-Id: <1549969812-22502-8-git-send-email-atish.patra@wdc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1549969812-22502-1-git-send-email-atish.patra@wdc.com> References: <1549969812-22502-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