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=-9.0 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 116E2C10F11 for ; Wed, 24 Apr 2019 21:48:27 +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 CFB3D20811 for ; Wed, 24 Apr 2019 21:48:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="JTkysST9"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="aaFpN9yt" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CFB3D20811 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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=drlGnHiiB4RI9cMbT1FHA/Nc5k5WjaZMx8JCy+GnvaM=; b=JTkysST9KkTwvg 1phpUx1vTE06ZaPaC7HSbfNPxpHFo6zYIy12jTmzIbVRS85djCM0Be8DFr7QGrDYcUNyAt+Y1WrLV QM1AAHTxlDUPOcwkQlSTO2K6D3RpZKDun9+ciS5Yh4io5JXxiM4xeNIFi8Gw10+wQP6ohcvXHsBmY 6G6F+rx+9VMigCy1brWmDpx3JGDZOlTr0a361jVtSuohZssqPRg6o8xdrwKm7Pq55G1UKB0mHl5UB Ipbmfihcyj7nkQRBF1/8s1nm/jPYmoXldEDcBhHFMjDE/iqDCaJRM5f4N9rn1nt73VzeF/h+jeXb2 dvo+z6CHMeCnmz8zi/Fw==; 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 1hJPkc-00018E-9K; Wed, 24 Apr 2019 21:48:22 +0000 Received: from esa1.hgst.iphmx.com ([68.232.141.245]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hJPkW-0000zs-EG for linux-riscv@lists.infradead.org; Wed, 24 Apr 2019 21:48:17 +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=1556142496; x=1587678496; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=2fCFVaYWBA6mxTZYwLA4+2kqo2897IxJIIto5p08bMM=; b=aaFpN9yta2IA3hAcnAcT2pRPQox8ckV354X+S5s0jXVi+x7YEQbjZiRg mJkAbkji+pIBXgVUkxE81aGHhMF9qfYQ8Pn50XZOQBPLwDjzea8gqsIlG jFNwrnpOL2trXIM3Dn32/m/oA2mZdBOGQULBmU23ZV4YrhFKrtkJDHWH8 qZ7caN6q81+uZjBPjV2PiUEcSYpk92TQlJG/W5+/6921FsIo0jNl/OdJD SnVqQ6a+zXAViwdT9Eu4kqsd7qG6HMMejj98/p6p1Q9hSg4Wh+BPshVEj 7zJftVPWCE0P4dya1nYO3vMJEu8jns2tE54wAU/EItAcZbdhUPoVB17Ta Q==; X-IronPort-AV: E=Sophos;i="5.60,391,1549900800"; d="scan'208";a="212581734" 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; 25 Apr 2019 05:48:16 +0800 IronPort-SDR: ZVTpWIyeujADA8CNionT4bQvgVXnu3LK4gNceV+Wqb0/GBPDAU3LVgEwecKWdejhCzSGEOCjk8 9a3/pV469bLUS+Sj9OmJDCD4kJUTFgk3CzyHYidw1jT1R8UQYWiXyNZgm/xo/EGp17ADEUE0MM /+2HbQMOWeWenIjGuub5rgABk1F1dF8ShevQX9Mp824XNnWK6SUtvMgVuqDpoodY2BfJEoeORk 3qhYn3OXP2fVF/YZ+whqPqyzphCangnTdCx2unJPTrfeJi9U48fNSDxU/Qcy04ZwkCj7eP7t2d sODwKLLahQ/b1P9FYd6n8NOb Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP; 24 Apr 2019 14:24:47 -0700 IronPort-SDR: 1YarVtGkK4lQ7rq37ypwtAajEaQ363xFfuvu4paXwIQHsqZg8cDFm7MI28OzpMvaLF89rTThKU 4u/I//deqUBS29OkAuke6diSTtNn9/FNOfEY7lGrtUwVW82L0Yr2iY/JAFWPGLGMvbrI8De3X2 MC9SMOSCDpBRKmphMsSRFOakcI/QcQo7YLPf/EFdbF7jAoGIjMvIdVubAoWigeODdjFc/VZR1J bfLbK8WWyccJVyLTiAVVJeI3Hc1Z2apQiTT7vnA+KkzlUypEhOPb8GfSCaaP8HVuheejwPhzXo pLU= 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; 24 Apr 2019 14:48:16 -0700 From: Atish Patra To: linux-kernel@vger.kernel.org Subject: [PATCH 3/4] RISC-V: Support nr_cpus command line option. Date: Wed, 24 Apr 2019 14:48:00 -0700 Message-Id: <20190424214801.18880-4-atish.patra@wdc.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190424214801.18880-1-atish.patra@wdc.com> References: <20190424214801.18880-1-atish.patra@wdc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190424_144816_603422_23F88298 X-CRM114-Status: GOOD ( 11.24 ) 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: Damien Le Moal , Albert Ou , Anup Patel , Palmer Dabbelt , Johan Hovold , Sudeep Holla , Atish Patra , Paul Walmsley , Andreas Schwab , linux-riscv@lists.infradead.org, Christoph Hellwig 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 If nr_cpus command line option is set, maximum possible cpu should be set to that value. Signed-off-by: Atish Patra Reviewed-by: Christoph Hellwig --- arch/riscv/kernel/smpboot. | 0 arch/riscv/kernel/smpboot.c | 10 +++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 arch/riscv/kernel/smpboot. diff --git a/arch/riscv/kernel/smpboot. b/arch/riscv/kernel/smpboot. new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/arch/riscv/kernel/smpboot.c b/arch/riscv/kernel/smpboot.c index a8ad200581aa..7a0b62252524 100644 --- a/arch/riscv/kernel/smpboot.c +++ b/arch/riscv/kernel/smpboot.c @@ -84,11 +84,19 @@ void __init setup_smp(void) } cpuid_to_hartid_map(cpuid) = hart; - set_cpu_possible(cpuid, true); cpuid++; } BUG_ON(!found_boot_cpu); + + if (cpuid > nr_cpu_ids) + pr_warn("Total number of cpus [%d] is greater than nr_cpus option value [%d]\n", + cpuid, nr_cpu_ids); + + for (cpuid = 1; cpuid < nr_cpu_ids; cpuid++) { + if (cpuid_to_hartid_map(cpuid) != INVALID_HARTID) + set_cpu_possible(cpuid, true); + } } int __cpu_up(unsigned int cpu, struct task_struct *tidle) -- 2.21.0 _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv