From patchwork Wed Apr 24 00:02:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Atish Patra X-Patchwork-Id: 10913891 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 A6B88922 for ; Wed, 24 Apr 2019 00:02:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 96B8A28856 for ; Wed, 24 Apr 2019 00:02:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8A43A289D8; Wed, 24 Apr 2019 00:02:34 +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 3CE7428856 for ; Wed, 24 Apr 2019 00:02:34 +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=b7hx0GWuwGJ0WOpvfzvlZGFBg115fZjICXT84Ha10gg=; b=jPhDAk9qCC171I JIq4zfKFIwuu3wpJNPxacfB8SNzKFxpA1zmNrsvvZQhJrWoz7afXTLjZdGswqX31EPfRTTLgne523 hvkPTuantStIxAq6VJAGfKD91UuCKkd3ThhCvyhRZIRlOYwq/kQsZ5ceDbbSJ4sso0moGxouAlmM1 olI55m5GlSaKwICOFA1qDB5oRcbgv19lComB33P9Igr786WNb5jRlL2MVdWE1q/6lyQEhmW/A++Ts eZVKlw4b9rtkmOWJze7DXc+xNQbkzSzy+EJBkKZnoNfAhszxz3wMZQ4ZKoDB2YHoihDAsKlHHQciF pgTv/oagMwTZWXE0uMWQ==; 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 1hJ5Mt-0006FP-49; Wed, 24 Apr 2019 00:02:31 +0000 Received: from esa2.hgst.iphmx.com ([68.232.143.124]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hJ5Mp-0006Bk-OM for linux-riscv@lists.infradead.org; Wed, 24 Apr 2019 00:02:29 +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=1556064190; x=1587600190; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=TsI1Vv+BQuc7zHn+F6+ygwuhtzAPsWvsEfC04f75S54=; b=NUcg/hWcMD6524noavwA1ijWCxNReYuTw3nmuiC7hMEpdrk7zyuZDcmf NcmT6CU71j95F/Vrl08TSU/wcY1odhlyS/E0IVhZC2MN2vYKDE/N5DSRO 21T8qKtRR1I0zkCMjCu8hTUH9BbE5hLVlLJ9yJ8wbeEa0N6XtU02DYUtE kdCOxLWunUkaRlaV/9nSwR75df7VxAV6PTRLfmtoNcjChM6sA4mG85yAX 2UVIEax7FdDwnmDItztCecRM+J09uQiNdGcqwfXDwwEzBqvFveyF0HOaH H0BJ/CfpLEwoGlXlHVo0dMnZRqpIJlC9BrOAuNy0aTMrrN0mgRGHfMmJu Q==; X-IronPort-AV: E=Sophos;i="5.60,387,1549900800"; d="scan'208";a="205772514" 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; 24 Apr 2019 08:03:03 +0800 IronPort-SDR: 0QAZuZpTKvJuZ6f7s8RSALPfkHIIwaQPryM9dNFojfNWP98Xc9ECTvzKO5UizKJ2MVpwSrox37 GTeNOI2C+ZMcqmxdzHAlqFKEAfJECaB89AKN1nMd4fb5b96tberQyRG7YR1PD3Z8MKqprGnpbr OClcGcCJwY+MJjCWeiwUunjWO0oYDPEdJpdvTPh08TM4Da18E3pulPj2BaoIijL+vSqGZx3m3l pn5TJBIM7WWCNRhSdOjIhxL4+U921H5yDGAeeC9s5YZtkGweF9xmnA7Soi2X4ZIYChZL+dCyqG mmrfeHOq0+DxDzFKZ/Rm702g Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP; 23 Apr 2019 16:38:55 -0700 IronPort-SDR: 8ArrhRcNMCh7vFl00ASwZSp12erSVVdrGP6n/aHcpXoKHZtU/T5W2OuihEo8qL7IL/sR7DAv+m MYNs19kwKsXUGXf9q/W+N+aKrK+nWIDLWENFZiX2A6jCUDCwzqnPoC7QD4w3WLbM04CEzl16mh Q2EzSHZoikUIXA4VjiBbCp7SIh5I5Ssh0/XLZrmvXFrrvP3pi/X8NuTjjVO0WH7dBNV/5ZkGUv oyAU4MrGda9tYZ1yrmHAq/cqy8rFt8k0Z0jlMqbMaGn8UiDY7T2+l8Gm0PtWa8ErXb5mJDKYQY 0hc= 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; 23 Apr 2019 17:02:23 -0700 From: Atish Patra To: linux-kernel@vger.kernel.org Subject: [PATCH v3 1/3] RISC-V: Add RISC-V specific arch_match_cpu_phys_id Date: Tue, 23 Apr 2019 17:02:25 -0700 Message-Id: <20190424000227.3085-2-atish.patra@wdc.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190424000227.3085-1-atish.patra@wdc.com> References: <20190424000227.3085-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-20190423_170227_840019_77487B4B X-CRM114-Status: GOOD ( 11.05 ) 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 , Christoph Hellwig , Atish Patra , Paul Walmsley , Andreas Schwab , linux-riscv@lists.infradead.org, Thomas Gleixner Sender: "linux-riscv" Errors-To: linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP OF/DT core has a hook for architecture specific logical cpuid to hartid mapping. By implementing this, we can pass the logical cpu id to cpu node parsing functions. Fix the instances where logical cpuid is expected as an argument in of_get_cpu_node. Signed-off-by: Atish Patra Reviewed-by: Christoph Hellwig Reviewed-by: Sudeep Holla --- arch/riscv/kernel/cpu.c | 3 +-- arch/riscv/kernel/smp.c | 5 +++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/arch/riscv/kernel/cpu.c b/arch/riscv/kernel/cpu.c index cf2fca12414a..c8d2a3223099 100644 --- a/arch/riscv/kernel/cpu.c +++ b/arch/riscv/kernel/cpu.c @@ -136,8 +136,7 @@ static void c_stop(struct seq_file *m, void *v) static int c_show(struct seq_file *m, void *v) { unsigned long cpu_id = (unsigned long)v - 1; - struct device_node *node = of_get_cpu_node(cpuid_to_hartid_map(cpu_id), - NULL); + struct device_node *node = of_get_cpu_node(cpu_id, NULL); const char *compat, *isa, *mmu; seq_printf(m, "processor\t: %lu\n", cpu_id); diff --git a/arch/riscv/kernel/smp.c b/arch/riscv/kernel/smp.c index 0c41d07ec281..94db72662f60 100644 --- a/arch/riscv/kernel/smp.c +++ b/arch/riscv/kernel/smp.c @@ -70,6 +70,11 @@ void riscv_cpuid_to_hartid_mask(const struct cpumask *in, struct cpumask *out) for_each_cpu(cpu, in) cpumask_set_cpu(cpuid_to_hartid_map(cpu), out); } + +bool arch_match_cpu_phys_id(int cpu, u64 phys_id) +{ + return phys_id == cpuid_to_hartid_map(cpu); +} /* Unsupported */ int setup_profiling_timer(unsigned int multiplier) { From patchwork Wed Apr 24 00:02:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Atish Patra X-Patchwork-Id: 10913893 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 9CB2F922 for ; Wed, 24 Apr 2019 00:02:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8C65528856 for ; Wed, 24 Apr 2019 00:02:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8075A289DC; Wed, 24 Apr 2019 00:02:37 +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 6E86928856 for ; Wed, 24 Apr 2019 00:02:36 +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=QEmIcBCm+yuTEf/KQqnPFoIbu4DeLePYO54f/rpip28=; b=OXc8/9amncM/jP bt7cFGsYiETv+K8E3dpLA2lFMlO2bpSq5DTfpHXto0+4VlLpaVMi0sa+oGqgk1+5GgV607enk56YS Me4paHhlOcCA/P/CpvgJiNiPOL0m5Arefz/sSI1i9F3YvJ7Tsb8JkJe9ZLH76LmBcpyPEJ1g27vvh 38WoaNquUa0g6eOtVjBdXR38Tq57eaDPcEniGbe8/7jtc+JJlbWsK0QOak3b/olUlxQ7P1KJZGt/K gETV8gyNuZ9aOxTh/HMlWRa3i1ZA9yoa0x6mZkU97HWfy6z74wEaMMagklp5z8CG8nMDBgPha29rB zwZcDO2ko050/93oQclg==; 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 1hJ5Mt-0006GP-SW; Wed, 24 Apr 2019 00:02:31 +0000 Received: from esa2.hgst.iphmx.com ([68.232.143.124]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hJ5Mq-0006C8-0e for linux-riscv@lists.infradead.org; Wed, 24 Apr 2019 00:02:29 +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=1556064191; x=1587600191; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=R2/5jwhYTGQ1JCFD91I9OK6vJ4c5B03XruX+Wm8H9FA=; b=TR9CPVKTUhnDX2uq6BxtrvAxf6c6mfh0lFGMr7fk1PbguATXgBqvmg8N /+SJgl2hkSBHV2rfPpBmdqEUqQVj6jrnLrRVA92IJB5KshuqVVvuokI8V HD3BKSxZneMvf+NoJxJkjPDjhlcZvFb02B5V5WDnfz+CtmiupYr6miS3f FcjwbP006G6wIN4JtyV5fmhu8BpdOLntaVurrTqvTU9yPm33UwYNgeVne zBQaNpbfF3TZVporBlw2cTUhUQJQjqXFogPM/19I4QIHVYhI28ygS++3C jz+G3GZrPcPv0AVJwgY2p3NXxt0J4nvJrdCAhm6BBPSNA8pQT+IBZRKY+ Q==; X-IronPort-AV: E=Sophos;i="5.60,387,1549900800"; d="scan'208";a="205772516" 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; 24 Apr 2019 08:03:04 +0800 IronPort-SDR: grBR37vvZXqO1DDdYe/P90/K/CUsfjdRosW1Pp/ob8W/qeusL1wuLASdipAuJNoITaWs+OGcM3 EPwa62LJ21/rQD6XHR0BmdiiuLibzLfo83PPc+Ufzw4CC9ed/WZFNqrCT8bfCds+SnP+gd/8NB EoFGSZQ0eI8UJ1FAyV8PdCCybuDn4Q4lhkR4zyjuikztshtwSf6qjuQSnMEIwYk/XmTnuWYqqZ DD6TA+LxN2Ct8DNy5A5WuAwnUYXDo1EEKIrENHD+uM5WbFaUEnwFx1x0KQtM6B9h2Z6ENjXBOs SW636deoO7sYxDzUQBJwLzlM Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP; 23 Apr 2019 16:38:55 -0700 IronPort-SDR: NOADQjAz6eLB2ulCCRn0+vCTxLNg3viC5jnh/ICSir8Y7r7k2imFel2bN3hhmoRp27+eU3dYJf dczho/LE9GN07SkGgbRHzTsVH8kpxmDjIc59M4xPaySkAJz0YlHVzrkM+bNB9ZrRyHPU+jmjOY 48qdQD3mtEx/LVDzKuxulu/oo9wUD1rI24jeT5GHLO4zUussvi67gVyUoIzqdIfQB7D1Ppmd2W UHd+PMB8bnry9ucwR4iUGlShBY87JUyTKqpTp1EtRzNQmrgDp17hFl1oQG0sd0iKfwEOW01eqC YHE= 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; 23 Apr 2019 17:02:23 -0700 From: Atish Patra To: linux-kernel@vger.kernel.org Subject: [PATCH v3 2/3] RISC-V: Implement nosmp commandline option. Date: Tue, 23 Apr 2019 17:02:26 -0700 Message-Id: <20190424000227.3085-3-atish.patra@wdc.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190424000227.3085-1-atish.patra@wdc.com> References: <20190424000227.3085-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-20190423_170228_100963_485126B3 X-CRM114-Status: GOOD ( 11.00 ) 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 , Christoph Hellwig , Atish Patra , Paul Walmsley , Andreas Schwab , linux-riscv@lists.infradead.org, Thomas Gleixner Sender: "linux-riscv" Errors-To: linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP nosmp command line option sets max_cpus to zero. No secondary harts will boot if this is enabled. But present cpu mask will still point to all possible masks. Fix present cpu mask for nosmp usecase. Signed-off-by: Atish Patra Reviewed-by: Christoph Hellwig --- arch/riscv/kernel/smpboot.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/arch/riscv/kernel/smpboot.c b/arch/riscv/kernel/smpboot.c index eb533b5c2c8c..a8ad200581aa 100644 --- a/arch/riscv/kernel/smpboot.c +++ b/arch/riscv/kernel/smpboot.c @@ -47,6 +47,17 @@ void __init smp_prepare_boot_cpu(void) void __init smp_prepare_cpus(unsigned int max_cpus) { + int cpuid; + + /* This covers non-smp usecase mandated by "nosmp" option */ + if (max_cpus == 0) + return; + + for_each_possible_cpu(cpuid) { + if (cpuid == smp_processor_id()) + continue; + set_cpu_present(cpuid, true); + } } void __init setup_smp(void) @@ -74,7 +85,6 @@ void __init setup_smp(void) cpuid_to_hartid_map(cpuid) = hart; set_cpu_possible(cpuid, true); - set_cpu_present(cpuid, true); cpuid++; } From patchwork Wed Apr 24 00:02:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Atish Patra X-Patchwork-Id: 10913895 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 3ACBB1390 for ; Wed, 24 Apr 2019 00:02:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2A40028856 for ; Wed, 24 Apr 2019 00:02:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1EA38289DC; Wed, 24 Apr 2019 00:02:39 +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 CC46A28856 for ; Wed, 24 Apr 2019 00:02:38 +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=trH0o7Kwsvpj9IHdXxpD/6FvKF1Eds8b8yjVd3iAdO4=; b=gy6ACKfl3M1p1W Zw9EzvtLlh4S39k2kgnGdexE4T7twEa0+jcdwkB9aPawgQAciS2nZvcZQycqNTVr8tWQIxiRMJd24 if8k2nyJ0qk1IaMIKgxg+8BeTfGXAO+vPY3Iwph91lqi3sEVYPiGWgM1iljZs2lv5Z1A253qMvcS9 EQlaysQuSKqkFFNac3Y6eE0rKjggCVp77wTl30e7fjK+PlfygMHnXzpIEt67DYfBWq7xCL+SGTwIH m+HUofbbMGzC/uL6mrp86L8MCbWnDUMn81pxkkRjWICT8QGHBIyBVzO9tMrE4CJnEqQQzDNmcjdaa XvYdxOp8JXpjlFLm0ADA==; 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 1hJ5Mx-0006L0-R8; Wed, 24 Apr 2019 00:02:35 +0000 Received: from esa2.hgst.iphmx.com ([68.232.143.124]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hJ5Mr-0006Bk-5Y for linux-riscv@lists.infradead.org; Wed, 24 Apr 2019 00:02:30 +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=1556064193; x=1587600193; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=K0mjdmCfdkrn3w/zT4aJMYOdZrUml3L58iZRwDuQ/Lw=; b=faZQMjYdtZx1xE6eTXL9IuiSEV9MMekZvrP2BwkDHynVB9x19PE8FDvc NY0d/7QLxbJotfcF1LqSIruCijvbTffmCINHvOqMZ9dLQmHIfXuGAXKOD MvdAXMXLKUWi6JcjqG0o8B/xbimt9KONwKXfyQlZBQJzcozDbYr5Vpdjy 7neGF8xJhf/gSYDpJGh+81n5fZsaHiiifQjvbIqXkoINrafY1SoNZZKZJ HOxLvecz3lfDj1QC1f37BKdxoXfR7aF/ERyWghZ3jLH9SW0mhtMfkSQ9V KWtZKqmGn+yVXfgIuf0Ewy468MdUQ1aLCXK/IKuqPMl+EDXwmyRmLw5Y0 Q==; X-IronPort-AV: E=Sophos;i="5.60,387,1549900800"; d="scan'208";a="205772520" 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; 24 Apr 2019 08:03:04 +0800 IronPort-SDR: NRl+bAOzPRe6cgZgUgbgxYPmG+8qFxowo02ITeM2zE/0dsBVVcYLXp7lsliQeVm7SdMM1cyr5B tbAVfDapX4pBSe3bwWutQiCadP36P9bVBwmJl9a7YlTsGw9lhASZx4zWivQ+m8d+Pg0ilrov2H 7wprxZJu2VA6eRE2lKBG4VI0Hp8B8U5Jk8ea4YG0ulzWPi/q1yshqLZzjcr1yMgRbuK0aA4wFP msjPSCtyrMgwyMVaoVxZQCcITE/YVp/UCsbRmgLANIm3tI6pyYutNDLniM/YGsGb1U+wog9VKo b0nF5SAny9mXQL10rAhACksQ Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP; 23 Apr 2019 16:38:55 -0700 IronPort-SDR: vLxFqYKRUEO2Hyzjha/t/tSa7wtu+8Bjtkknn7qkd7Pfg7hK26rXSp/pUuMj332f7QCLldAZCL bMZ+M8zqf/osPxKB2CaFEk+UaU5/QIBrQet2r8+IxGXh4f4xRcfJ1EOfwo+Vn1u7/tYcnKK/PH OQ9fU/MA3ldp175wqdWGT3ZxJFPMrCo+1loyho64iijURyU37AcvZnG3DzK3LBuswcgQnPfvp2 cY6d17rnQqtblP0Od3oiZRatNJynbfa9EG/sIg3MzedQxPgvtiFmOJA3rb2JpTD9yg0wylIJ2P yd0= 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; 23 Apr 2019 17:02:23 -0700 From: Atish Patra To: linux-kernel@vger.kernel.org Subject: [PATCH v3 3/3] RISC-V: Support nr_cpus command line option. Date: Tue, 23 Apr 2019 17:02:27 -0700 Message-Id: <20190424000227.3085-4-atish.patra@wdc.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190424000227.3085-1-atish.patra@wdc.com> References: <20190424000227.3085-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-20190423_170229_445299_960E30AE X-CRM114-Status: GOOD ( 11.00 ) 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 , Christoph Hellwig , Atish Patra , Paul Walmsley , Andreas Schwab , linux-riscv@lists.infradead.org, Thomas Gleixner 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 Reviewed-by: Christoph Hellwig --- 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.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)