Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4530131imu; Tue, 8 Jan 2019 01:41:09 -0800 (PST) X-Google-Smtp-Source: ALg8bN517Hnav9n9gPj3el1P93v5+VPpfZfNB5S4G5Cys+Bpiv0XJbadArFiu0q8RlAShu6rk9v/ X-Received: by 2002:a17:902:8a91:: with SMTP id p17mr1042720plo.316.1546940469380; Tue, 08 Jan 2019 01:41:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546940469; cv=none; d=google.com; s=arc-20160816; b=DDhE639At8XqV2nKF1uvqiMS0X9zRgH4y8d1ACD2KkkNkqHkseY0DrmtBqssUi81Ly NRVk+D2eIq9nHeCa4O7GrjnQmf9gqfAq6TR+3iYizQKBPz7fczevQ/yvfYJIbo43bdEY nV5h7kpPXEYG8VmILKYm1/g+KK9sZZkQJWYboX016hHsLHSB9rgOs5AuQAPu4HuUacUO 32LFiEPlMHgtnEGXea8iiL/T5WXc+9hlMddGhsCdmUMrKxzu4vKVw3G4kCOQ0c4Ft3Zi kEJ/7AkFUI1wXEO5byFJ8R9NdkBC0AU5gnbdxXih7ncQUBKi6yZp6dBYgJb+R272Mfr8 91kQ== 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=T1So15QLm+cBUaxg/1KDwXFW4rNPF51aHZDTgmsTH7Q=; b=RXlkXp+NRO4xgH/4BjiOF2I5kZHSXUE9KGfb4bn9np7NcDR+WCTjzLJCsO9M6aegg7 3lF8VKo5VZnGw0i5fXwSzk0EZeRwgU2NIiiSMXguxahSVcoFQ8XrQw7ctEPIX+0uXwxs MRN1/pmg61J46drccmmJYqsRl47WRqUnKyEj0oZtjvMeNY5vySDLkhOGJ86Ip8auwrx9 cCO/Pfnr7hlf230ouQblQCJ5+9Wi0ZslfjWrTLiSf6kPd5MDVubxIVtq2M1P9COONWy4 M6kC/8w23TCtB+IjLuQ/yxl5vcUmSF7j7gFfIKuEaLRiSMO8i2ZDVoVllBqSQiMee27I iC4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=eEPDgjS7; 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 u25si7652515pgm.532.2019.01.08.01.40.54; Tue, 08 Jan 2019 01:41:09 -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=eEPDgjS7; 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 S1728570AbfAHJiz (ORCPT + 99 others); Tue, 8 Jan 2019 04:38:55 -0500 Received: from esa5.hgst.iphmx.com ([216.71.153.144]:8878 "EHLO esa5.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728413AbfAHJit (ORCPT ); Tue, 8 Jan 2019 04:38:49 -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=1546940328; x=1578476328; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=bw1/Vq2gne9LAKNuyEBhQX+XTh+Fz0MdGc7HYnZ0izk=; b=eEPDgjS7mPcdMJtMOFXdfxbV5sYdEoysnHYQNYU5hMsS/PtpKmQOHOva LhEkFHz+maHoTJhr9DsTDWftleNIUWHs6klcT9L+M9+kAjnjNyfhDf3Xd 4kzteiD6Fvjh42newv6wYYWY+tUkfDLW1xfIlOvkCzlBklwqOXTRrUfWU xEpmaQAGgb9B9G3qeqWtRe8yWKID+NRPCltuLSF02tztTXm6j9HsTDOrb rqQL+NKw2BDYGbOwTB2cdO2v7U2wd00zcSzc4c7LIUCZsRKr+z9mXSZH7 IUOMHFxbMYINpiwPek2Fizmq1a7/qfu2VXvpOXUAbDuBkEIQ2W11yaiOm A==; X-IronPort-AV: E=Sophos;i="5.56,453,1539619200"; d="scan'208";a="99458414" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 08 Jan 2019 17:38:48 +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 Cc: Atish Patra , Alan Kao , Albert Ou , Andreas Schwab , Anup Patel , Daniel Lezcano , Dmitriy Cherkasov , Jason Cooper , linux-kernel@vger.kernel.org, Marc Zyngier , Michael Clark , Palmer Dabbelt , =?UTF-8?q?Patrick=20St=C3=A4hlin?= , Thomas Gleixner , Zong Li 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> 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 --- 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