Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp5290577yba; Wed, 10 Apr 2019 16:05:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqzlQZkzgyBLFB4Xz64t5AAQjKNDMya4owmjXEw2K5fJmdKEg4NkTGT/tJExUDHlQYryQpzx X-Received: by 2002:a63:4a5f:: with SMTP id j31mr43832465pgl.369.1554937556311; Wed, 10 Apr 2019 16:05:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554937556; cv=none; d=google.com; s=arc-20160816; b=kEBC2bJn8G//z0J7zEeRL9YWB2DbV/Za4HCOSV2SjTcq4LoBXdXIhy4BtAATeXgR91 r1odXbKvIz4wZehpc9kJLmu+Owg4xuAnrFn1ltjVurZYyg8PEEegfvrfcccvtyE+RhWV 0L3f3x5kGjq/W/W+jdQwlGBJ9kIrNvxeB+vuzgFJ2CeagEgQ28K2krerse52oaoyQhfM Ycu47LSEGAdcKkGZkGfW/OQMVpHfrSH63v1WAE1S0smwxxcYM3V413lSns0/QaVQRS8R mqAY6Eouo3d+gUzsZAcUk+QUN2thiHI1LsdgsR/uZTG7WjiZHg1yr7F7QrDTE7l8MS2w zn5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :ironport-sdr:ironport-sdr:dkim-signature; bh=wIt5oHe4ZwSdTv8+0joUfZ16zVjy4e3uYfOGLiUYEXU=; b=PmOOdgMEgp4anLNIR9qvxtS6bG+y9M5cXIGf30YokZjY3+38n5l1M7ubv3mpnwZ3s7 O86R6zc5fGBNqFQL0luan2dxY8+fpk5a4BPmGXwMa0GRcgv7515g6X6EbeOWf4iDbEAq sEP0nR9apOpSxiGjDrdJtt+Fn5pt7vB2MH9pSXjowt2ft7r1jklJZnTS34yPJwDpSJW9 UktkmtsoAM5wPwv4TE1wtkBiot9wOaDTiL4thCgOndrLEYrCtqeIsgLpz3b7sxANYjWW 5tElwNHk8neB/TqXONuIad0UpJe+TONFELdVXMp0XUo7d/hSiz340StuCDu3ysP3u+0C PANw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=mPWF3++I; 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 o12si3830992plk.310.2019.04.10.16.05.38; Wed, 10 Apr 2019 16:05:56 -0700 (PDT) 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=mPWF3++I; 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 S1726777AbfDJXFD (ORCPT + 99 others); Wed, 10 Apr 2019 19:05:03 -0400 Received: from esa3.hgst.iphmx.com ([216.71.153.141]:61696 "EHLO esa3.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726671AbfDJXFB (ORCPT ); Wed, 10 Apr 2019 19:05:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1554937502; x=1586473502; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=JjopVQqYQkhD6l4s3VEoAfhP+7o2iPgtr6wnHHzUroc=; b=mPWF3++ItqgJNt2a/2UMHglzAfQF5ILlMaZ/aQDNix6mZVAydesM0KHN uvaJ0duan/uhG7p/5Y9qOJK9jbScJlzDXLHto8oYQL8xq5rxDdEZSje7m JH++mXyGknHA026zoWR/PQOdcZU3JNEUrbTPJFDSriM67/EOYEev/wVen eobf2PiULOqLkEsrr+xrXx22qTWymvkkpa29Fh2HfFcE3BxJBnq9/ZYem jDSCU4eLM6C0RUi4bOsi9Czzl7j5WaX+6wGdncXW/tMrdxIwbN9LZ0EPf I7V68CSau2lJwbNzjZh75/S6Tl60LmhR+ShUwSvzN7HIJWx9OK9Z4Rd92 A==; X-IronPort-AV: E=Sophos;i="5.60,335,1549900800"; d="scan'208";a="110531214" Received: from uls-op-cesaip01.wdc.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: 27aSVQWSWns360uOjp19tNIcBoZWsevpjFaMYUaNyYdwivWxNW/ksxvQN5zOBRJW6gmeZEZmWV 1ONeoBYHKyRFn6bWgNUD1o3+wvK1uQtvaQnZtKAe2/ZiQOrerpjSt0bT6po1m+yrmcvKUJe458 XdlzF0OLfpailwI3cfH3bbAo+3byHlOazqh0hRJ83hTbD/5gHOb7cqb8IFbVoqVFmcjjy13EMR /iCX6eJPMB7Ey5GSZ8LFfYb4Z/YxesMpujGYZMtsQt4Dvy4DvxdXZqi4Lkz3nyzLeHyLBCiDcL 4bNZ7OhfGCJgqsozythpIqrQ Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP; 10 Apr 2019 15:41:53 -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 Cc: Atish Patra , Albert Ou , Andreas Schwab , Anup Patel , Dmitriy Cherkasov , Johan Hovold , linux-riscv@lists.infradead.org, Palmer Dabbelt , Paul Walmsley 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 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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) -- 2.21.0