From patchwork Wed Apr 10 23:04:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Atish Patra X-Patchwork-Id: 10894845 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C34D21515 for ; Wed, 10 Apr 2019 23:05:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A7C1C28B8E for ; Wed, 10 Apr 2019 23:05:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9BD3628B96; Wed, 10 Apr 2019 23:05:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 516A428B8E for ; Wed, 10 Apr 2019 23:05:14 +0000 (UTC) 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=PXW7ziHsvA884V5EjUzlWEYX6mcjkGhRzuCC1R8oLBw=; b=riXWrrj5ssknpj 92hWDnsE3AKPGQ4tT52DE4rBI3JwQF3Y/ccsCQKr4Js+zVCAOginp8hCxvBXi6PlyLYJUutcnENW7 HaT+ld6q7J5foAtlrR1Z5Zr93Cjij3B0vO8k2WR/sEhdNgQOiPO3SeDeA3c79qae3Xh19akFU/lkT XgoPxUHqnRj7cXXbxqh0NDshi8Tx/FTRQhaemXFHpal62IhUUU4kBkhMz/U8bg+f4TlT3aK2jOMpW NBKvbE60wrE0P/KnJQiCkjl+i7arnFE2ExtgnaaKH/AVJJbwTfbdrZ6e3Lxo48GrF6jxRuZUcmYzQ uB0C+pw/bztI1HJOBYKQ==; 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 1hEMHG-0000ox-F1; Wed, 10 Apr 2019 23:05:10 +0000 Received: from esa6.hgst.iphmx.com ([216.71.154.45]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hEMHA-0008Va-By for linux-riscv@lists.infradead.org; Wed, 10 Apr 2019 23:05:06 +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=1554937505; x=1586473505; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=JjopVQqYQkhD6l4s3VEoAfhP+7o2iPgtr6wnHHzUroc=; b=aoLRBfmpbnmvj5gyR5MzQN1OPzGBG4/sBvfkB6TOzNO3bpUwUOSDhWeS LuUE+1IBvUzXq4y8BOg+O9Pn6VVamS/8AATmZN11ygbReDcdZYiATe69G nYS2p4Dz/K14IclVhIICaYjApbuqw7rUPhlyGuZ0yFj0Pl1Re76clqqvw CWeJWq+leOdW9d3vSkZ/opJl0bQvzWWvjfh1hGX6YX8uYeUd140efvBII /AShZr95C2Rvxc6D0LF92XOCO26wslgo1+l+zXQgx9fCEtYqaGC4dpBIv LGKNyAjaldWOF8coGPTjgdCBrARozNtaikT/zlC0VebzhJ6+X65WSjlA5 g==; X-IronPort-AV: E=Sophos;i="5.60,335,1549900800"; d="scan'208";a="107205241" 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; 11 Apr 2019 07:05:01 +0800 IronPort-SDR: ow2TC0TEPUDRfEgphpZd428DNzHct+sqLXw447AaVMrgSU2MRmZbsS2Q5i7npiNsjvJ6oRcS2N Y9rh8sPpnaUnt1t5+wsp2nkD4HlEcWDUgrHJrSH9IDLv1KxXCBg8ndwbPpmdBtQNdOUpa732wV 2XzblMdaMLYsnjQ4YAH+JGhJoLkmW+UYqEPs/aGLJNMf75EPhgkhP+4Pia01ET/gjvZLdbVQNR DWwCFnq+hFGW81frpQi+iwhZwrQYOqjK6CVF0aAcQS9n06iAPANVF+NXCaCSUTlFl9BXGALlmE eeeNeWaLflDDC2puqzEZ5L+d Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP; 10 Apr 2019 15:41:54 -0700 IronPort-SDR: 1rhuCQOXGyrTbb0RHFHg7EKFscG147dVhrFBG9rilY0kCpsui/ZWQxzgO8c8Jl6MdofD6mrrax f3wOq8hA7zaAnrPLK5D0oLbZM1v7s7twoqcePEr52xfKBKwI/7Naa/k1VoCFmFcv7wHPY5unvF lgq/WyLEtGXeGfXr/nSEFr249Fi+cFsIxHgyu6ZEaBMsPH4geSAdaR4xcu1i8k02HUZfPEu6s2 LpJt5Kw/LGzHseboHMUGGByu6apGavWdMjVAN3qVteTzTf7GxySd4U+YVlbS8ddxCXOWgrHbBr p3M= Received: from jedi-01.sdcorp.global.sandisk.com (HELO jedi-01.int.fusionio.com) ([10.11.143.218]) by uls-op-cesaip01.wdc.com with ESMTP; 10 Apr 2019 16:04:59 -0700 From: Atish Patra To: linux-kernel@vger.kernel.org Subject: [PATCH v2 4/4] RISC-V: Support nr_cpus command line option. Date: Wed, 10 Apr 2019 16:04:43 -0700 Message-Id: <20190410230443.15729-5-atish.patra@wdc.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190410230443.15729-1-atish.patra@wdc.com> References: <20190410230443.15729-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-20190410_160504_556047_23D7B91D X-CRM114-Status: GOOD ( 11.68 ) 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: Albert Ou , Dmitriy Cherkasov , Anup Patel , Palmer Dabbelt , Johan Hovold , Atish Patra , Paul Walmsley , Andreas Schwab , linux-riscv@lists.infradead.org Sender: "linux-riscv" Errors-To: linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP If nr_cpus command line option is set, maximum possible cpu should be set to that value. Signed-off-by: Atish Patra --- 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)