From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.7 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9A3FEC04EB9 for ; Mon, 3 Dec 2018 20:58:05 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6729420850 for ; Mon, 3 Dec 2018 20:58:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Ry4o5B1H"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="SYZxwrfW" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6729420850 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-riscv-bounces+infradead-linux-riscv=archiver.kernel.org@lists.infradead.org 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=qKu+HUhTkUM/m4PvSetyRERBVYZ3JjkfGD/JkGQEesY=; b=Ry4o5B1HbdqU74dzJ/Wrax84uw /tjyXp/PtJinNT0sT4RbiTfnF6yjHYyjZX4p0cjFtRf0qWsZtzz7uoaZAH+t+D9qsrUcBoSkeBawY 4w0X56QQm7DsZvZ3O2eRPfPNn/h5h5/N5283hrQ91UuqABEKje0+/bCu1TaId9mPnHMV9etKmt5x3 h8DbeOri3eIBrDIZ904Q1qmxHbwhZMoCbO0VWubLn/derT6EM68yxTUjV6VJB8R5eqHkjPI9fjGlZ ON0UUj/eTd9hZuv9BPuaxSvHtaJPEWs1Et+lXy2efWGeB1SPb7LN+FU73r65iiJiCp3MDWEG8fFNR Ts6h/ERQ==; 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 1gTvI4-0002sh-QO; Mon, 03 Dec 2018 20:58:04 +0000 Received: from esa4.hgst.iphmx.com ([216.71.154.42]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gTvI1-0002k7-KI for linux-riscv@lists.infradead.org; Mon, 03 Dec 2018 20:58:02 +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=1543870682; x=1575406682; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=BSOlOVz1k4WQ8zp+c29OSEXPkk6Skbx3t6enWZR9980=; b=SYZxwrfWoAvnQy5T6DA1S9yDEDqc0XANwk0dke/iLRl/GPazTsTSAUkF nm+pygSg7mTVBmWd0VxEpNdBeM8lCqvmmX+M3wwYfN5tyMj4ZUfdircrw 3+Dz/Mc+ZbfOxLoQCvsxzyrUrenmGEXXVFeofUNhpld7PlTQj0wNIF6V+ utVSUFlNYRqpsEy+9Hje4Zsp97zYAObUzP/VnO2JwUro2kRZQ/C8ACxVm Y2MOOmeDlky9WTGhByfCu8yLnlt8iHV1KrkmTM9XRjDWMx0sfkcSHIz7U gSnxEWGpiTjuw2zBszco+IoOp7hmhe6cvJZFuMlrnYRq8/I8+7wivKrGp Q==; X-IronPort-AV: E=Sophos;i="5.56,311,1539619200"; d="scan'208";a="95690462" 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; 04 Dec 2018 04:57:40 +0800 Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP; 03 Dec 2018 12:39: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; 03 Dec 2018 12:57:40 -0800 From: Atish Patra To: linux-kernel@vger.kernel.org Subject: [PATCH 4/4] RISC-V: Fix non-smp kernel boot on SMP systems Date: Mon, 3 Dec 2018 12:57:31 -0800 Message-Id: <1543870651-16669-5-git-send-email-atish.patra@wdc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1543870651-16669-1-git-send-email-atish.patra@wdc.com> References: <1543870651-16669-1-git-send-email-atish.patra@wdc.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181203_125801_710435_CA79D8B5 X-CRM114-Status: GOOD ( 11.85 ) 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: Mark Rutland , devicetree@vger.kernel.org, Damien Le Moal , Albert Ou , Dmitriy Cherkasov , Anup Patel , Daniel Lezcano , Atish Patra , Rob Herring , Palmer Dabbelt , linux-riscv@lists.infradead.org, Thomas Gleixner MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" Errors-To: linux-riscv-bounces+infradead-linux-riscv=archiver.kernel.org@lists.infradead.org Currently, clocksource registration happens for an invalid cpu for non-smp kernels. This lead to kernel panic as cpu hotplug registration will fail for those cpus. Do not proceed if hartid is invalid. Take this opprtunity to print appropriate error strings for different failure cases. Signed-off-by: Atish Patra --- drivers/clocksource/riscv_timer.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/clocksource/riscv_timer.c b/drivers/clocksource/riscv_timer.c index 39de6e49..4af4af47 100644 --- a/drivers/clocksource/riscv_timer.c +++ b/drivers/clocksource/riscv_timer.c @@ -108,6 +108,8 @@ static int __init riscv_timer_init_dt(struct device_node *n) int cpuid, hartid, error; hartid = riscv_of_processor_hartid(n); + if (hartid < 0) + return hartid; cpuid = riscv_hartid_to_cpuid(hartid); if (cpuid != smp_processor_id()) @@ -115,14 +117,19 @@ static int __init riscv_timer_init_dt(struct device_node *n) /* This should be called only for boot cpu */ riscv_timebase = riscv_timebase_frequency(n); - clocksource_register_hz(&riscv_clocksource, riscv_timebase); + error = clocksource_register_hz(&riscv_clocksource, riscv_timebase); + if (error) { + pr_err("RISCV timer register failed [%d] for cpu = [%d]\n", + error, cpuid); + return error; + } error = cpuhp_setup_state(CPUHP_AP_RISCV_TIMER_STARTING, "clockevents/riscv/timer:starting", riscv_timer_starting_cpu, riscv_timer_dying_cpu); if (error) - pr_err("RISCV timer register failed [%d] for cpu = [%d]\n", - error, cpuid); + pr_err("cpu hp setup state failed for RISCV timer [%d]\n", + error); return error; } -- 2.7.4 _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv