From patchwork Wed Apr 24 21:47:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Atish Patra X-Patchwork-Id: 10915753 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 AEB6F13B5 for ; Wed, 24 Apr 2019 21:48:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 908A728861 for ; Wed, 24 Apr 2019 21:48:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 80A5C28ACB; Wed, 24 Apr 2019 21:48:23 +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 0E18628861 for ; Wed, 24 Apr 2019 21:48:22 +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=ZhzruJOjhod8LIOd1LQAFm7CCQDmbaIZZxoBrNUyYNs=; b=RWYNNneFYqU6qg wvOuBK/xPJoGSvh2XovrFisqHiQVs07Bu22+YahzB1gqiq+tjC4bBlI+L8oQYhmzdTw7vyt5nBq9z x3BnauEtaBlfvAsXy7yYTa4UEa439Y2di81o6nzDGVWQ/LYIjBOTx0vgGK4Zeynks++LEGugsEDYe okTzJIlT59+Wx3GPA1Ei1K095RDwk6QETEDV31AmEpMhsrMPaZudKmlJ1ZpQEmSzhbkj59GouakFb BUJXNB2K1SY/TutM2e7j3pkZYDNhS/124/DIkWU1UO3ZXt54fy0so8sZ6bDPYedM3qmAkLqBV7ylP 15M6MZkcR2OFVGTJorEQ==; 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 1hJPkY-00012P-Ea; Wed, 24 Apr 2019 21:48:18 +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 1hJPkU-0000zv-Sw for linux-riscv@lists.infradead.org; Wed, 24 Apr 2019 21:48:16 +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=1556142494; x=1587678494; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ptio9EMvYP5f+ORUvvZuKR6bpx8beU1V6Uj718zf84I=; b=PqV5G4HWfi+BfTChUrhjYgIFAt+WLvY1/lC/dU4mieAYJf+ac1Nknntw mgmLT+19tufxBjnJM4MDlQ9JOD5U34+8OZwitQn8oZCUwi20oLLjftFAt nYbf6iEV1jeFH0bkTtVLS/hXA+ftl/AVh0x5/QxK1SBFtwD7adUpNq76U QK1whfpRV1YbZdZyC1opkfeGJVPBX/XMKfTQiDWPxZ4Ge6973M2eQWIMY q5mlypABpuyznyPFrYjxLaYAQMT5Re0k2G2RKmNSxT4MSq+jBsvRu9S/r zSZ7keH4ZxNCOhD0uXBEHIM+d3PzCXAQbXvGyJM6EmfivXHVbC3Qf4lXm Q==; X-IronPort-AV: E=Sophos;i="5.60,391,1549900800"; d="scan'208";a="212581725" 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:12 +0800 IronPort-SDR: gb1wYxazq+ABpdmesxX2hVADf3uRkH14xRNWSAboigGvFKu5cTO/kEKPS+x8LmL/d3tPShGbtZ MjxGU0bssDGwQbhTcnoo/5VOROyYjZa3hcwkASY45AvIgdoWDLUEQAmVrANz+7xSoZjEEfKJVp kkOzMHKJEsjDgF+Z78f5Dl2IwgTYWr5rnYYxlrQXbyAe3pmJcaYLeHmVJJLhjnBwYZ3995hlPz Bit37sy67h0sJ79nLLelk1rYTkVrKfsQRbR/YJklpoZaREfUtNgquNXGK+qdenBQTMjFANcthj bY1yRTRnU1YnZUm8RRiO8gpt Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP; 24 Apr 2019 14:24:43 -0700 IronPort-SDR: quCW3b+lX1Ndy1Wt7UxWgfVqe8zOsHY0ctGiHEEhl8VQViFsLHwbAKApNMc4MLDnJ71TfEvJhG 5fmonddg2oJW1G2U9rn9a7BumtehvKQptK86BofNA8471TxgDQT6rF/2i9WS+QuFMkU9GAFp4o 2y/UkPjhmrIk5VUtMBi1zS00v9Ohr9fgMct/lsRVpT7EixYquKGXVPDBGRyLy2P1hCDHLp/J7W 5424QVAXORveZ4zm0dLvUkuzw8uFB6G1HdmrcfKGv0ancXO1BgZz7LAfvAcEfa1WjJDwpUSMj7 lLc= 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:12 -0700 From: Atish Patra To: linux-kernel@vger.kernel.org Subject: [PATCH 1/4] RISC-V: Add RISC-V specific arch_match_cpu_phys_id Date: Wed, 24 Apr 2019 14:47:58 -0700 Message-Id: <20190424214801.18880-2-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_144815_074656_403052EC X-CRM114-Status: GOOD ( 11.19 ) 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 , Sudeep Holla , Johan Hovold , Atish Patra , Palmer Dabbelt , Paul Walmsley , Andreas Schwab , linux-riscv@lists.infradead.org, Christoph Hellwig 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 | 6 ++++++ 2 files changed, 7 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..89251f8ab754 100644 --- a/arch/riscv/kernel/smp.c +++ b/arch/riscv/kernel/smp.c @@ -70,6 +70,12 @@ 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 21:47:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Atish Patra X-Patchwork-Id: 10915757 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 8906B922 for ; Wed, 24 Apr 2019 21:48:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 77A2D28861 for ; Wed, 24 Apr 2019 21:48:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6BBD428ABE; Wed, 24 Apr 2019 21:48:24 +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 3161D28A3D for ; Wed, 24 Apr 2019 21:48:23 +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=m9f9rnSOT6G4QkammUTS6Yvbavx4jPJrKrIDCc5btvE=; b=RL0xmjzzs7R1vS cHIWowcfLLc/2TcoLysWn8dkgbSZyg/gw0CPSomhqhxrRoHqC9SCywz1CnKaUyLaOhUfEI2/GSPsG Zvp/skz3ccpbANd9wi82nHi5o+UFUcowI6FFylcXzFm//0gKjftP0YzK+J0HKDVR+V2K0Kea1SPZy M9iHwHz5qOYN1DztHcPuM3BVDS95ZoWF3A6ReDEAEin6WtKkHA5htrrJoZo71Vi1XgU9M9TjDp9rL YXWZveiPXtMTo0MjdiE9z1HqKOCMzzeLlZmihs8v4NHpElqqli0pa2BV7mFvPa7LE+2h+1voEbl6R v+nIQ2s1M1k3Ro9M/ZlA==; 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 1hJPkZ-00013V-Cl; Wed, 24 Apr 2019 21:48:19 +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 1hJPkV-00010m-IN 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=1556142495; x=1587678495; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=HLJmdPo2DIDSxK8iquvXyeVmtyscqRTd/8goqoSULLM=; b=kueSs2qPbwaUOXHeQHa9N0O/HcNYoxYYwGBYKvgkU0lVfFp/0J442OWt 806wWTI2ZsqK3PTbBRenq1eBTBHqifh1HvBAe7H/oDHZPMGNyacr3ALX4 rTMSNAJQ2W7mRx1mRZ/TW75Sf90S/EYR8d+ksnKMJeGKDiqS2fnboWdko /AmNEylHbkbqDYRkCpZ4SCWN0+OL7a256P3KMrpOSdYl44mdBgJyrUk88 LcPs3twy+DgdkXp02hSjaY1SM/sco06zofqsSn9cfBvit3KXrPGDKQ+cH KdIttJQVVzCmnkKYdBrq1bDUrzKPLldGHpBtfrY8SKwwTpDz0F9LSNXqG g==; X-IronPort-AV: E=Sophos;i="5.60,391,1549900800"; d="scan'208";a="212581732" 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:14 +0800 IronPort-SDR: orJLCyCNUxFsRnIRjqN3NUCNzJOpz6AoswjcYoz89q4b/R6bccFypyagOcr8ocD8HWL2bTU9Hc FzXmZzOctvvByhIx7Ta8EHpnaup+zHJLJWHP5FAF2uXol6/Mx6nNlF4E6w77wCxpWXlhSqi61k MvA+tCPGRKBC5LcwnCYyGwkBagpPJbpQU4pNNzN60gGMe3JQgmkEkfeJ/KQMk1hFGuYiiwkKuh T3gEKkWgWK+/7FWuto6nKJnpgH4iR5pGfjWiRP2m2KewmlG4qvwux9U4Nt+q0zPjmo56s1lQ2y OCRzeYec017msvxqWWHl/GjI Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP; 24 Apr 2019 14:24:46 -0700 IronPort-SDR: jlBo3KgjjCtfbZ0C2//CHKveriNkLa5ePBIwBiiz2JWS4EEMAwAa6wBKMMCcn5W3PQiQnO0oug qmSDOSi3AE1owkEmlOwzrBqH9elQKwPCqBhB3pjdxc8htom8fSSvoo3fNHZyzZ1GirqPmjBSul QeFlIQ2sZFSSbZ71SvqCn/m64Z4C39umiG7jv4VwJNWv4mhk3K+I8rBp7cf2eTnkhMuGiJHt07 dsiJNgj+HO2VeYO677yy/xVmHT/gmMZFsZ6Q25AmJ3uRbeA4BFKaYBuNH8ryQxBtX7dwVToil2 4WQ= 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:14 -0700 From: Atish Patra To: linux-kernel@vger.kernel.org Subject: [PATCH 2/4] RISC-V: Implement nosmp commandline option. Date: Wed, 24 Apr 2019 14:47:59 -0700 Message-Id: <20190424214801.18880-3-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_144815_719659_6C3C8070 X-CRM114-Status: GOOD ( 10.71 ) 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 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 Reviewed-by: Sudeep Holla --- 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 21:48:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Atish Patra X-Patchwork-Id: 10915759 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 B7B82922 for ; Wed, 24 Apr 2019 21:48:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A704328861 for ; Wed, 24 Apr 2019 21:48:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 98E6428ABE; Wed, 24 Apr 2019 21:48:25 +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 4B9D928861 for ; Wed, 24 Apr 2019 21:48:25 +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=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 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 Reviewed-by: Sudeep Holla --- 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) From patchwork Wed Apr 24 21:48:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Atish Patra X-Patchwork-Id: 10915761 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 A4A2213B5 for ; Wed, 24 Apr 2019 21:48:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9384F28861 for ; Wed, 24 Apr 2019 21:48:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8795B28ABE; Wed, 24 Apr 2019 21:48:27 +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 4106B28861 for ; Wed, 24 Apr 2019 21:48:27 +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=wwAGPUz6NFg/1Dv2krzZTJv1ZUXSZ/Vi1UoLBEWwQM4=; b=X/jTZKIWWjYfxq JZ7RAVPr6VHqxuQMAOcqUVlltZzmIf7b31FJOKxY9w9cTxSrPhufYbdJX/eIOoaLUw8/f9XydXRC4 SPFPYM+LcLT1cQLvfxqmqMHfRJhYMuSNkmbo7ah0I6dX9tcu+lpZOYF/VK9W1kRtAJCS+ddYKeyGC Vt+yFFV+D57l5cimuozMP6SPEleWOYQPbXrMO5eH0XA+CgpB9ghdgPkcbX37mHHfR9AeLtwEWIdnM +ByaNuMIqO1aohyg96SLMGCcU1ju3sMeOBYGYIxl+qO7Icflttk4VwIBnKBWIvGPHX9K70LqtCGcO 1Ht7O/jR/ajt74L9666g==; 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 1hJPkd-0001AI-C8; Wed, 24 Apr 2019 21:48:23 +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 1hJPkX-0000zv-K1 for linux-riscv@lists.infradead.org; Wed, 24 Apr 2019 21:48:19 +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=1556142497; x=1587678497; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=7eoJvuEAlEQu53EigOZxTNOMHIT8YN9ACuKN9mjmCeQ=; b=I3Jwr2863IwvTyt8rIesT5B4EmUN6ZSp9+nE03iCMcHrjBZdHlSmspNb dH8q+N4S2CI6Dd6uBU7T/cHP7zFQi3T6MPevN0oJkrcPPZDLoIL6LECOd zQlJM699JJ2oahSnsVTTynuCsJua3RVAGNApG+SKPz48UtqOqI/CZfcvc 7o3NtcX00RoLEZ8ya9e4LFTeJDyDRpp7idLhOU+Rwv4YXj7lpWwOlVz8c CtuJcBbJDNe8fhunXKgvcXvqtWEJgZjGRK7/b5iU6Kuo9/72yS3CYUbQ1 7Xg0DPemV/63iMJwFHWfpM3jVP65tZBGd+q8SGSO3h7kAgm38tniEXkno Q==; X-IronPort-AV: E=Sophos;i="5.60,391,1549900800"; d="scan'208";a="212581735" 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:17 +0800 IronPort-SDR: TJuS1WCOBVYuUYtHFSBCKQesB1Clo8zQed/I1EYcbRJlgcR1BKc+rxt85Eommls0G786/QpcoJ Th8SnQX0j10G7So75YZ+DvuCdOpZWVkZJ9fqyaHS2TCkhc+Klkp/CEHmRQEtkmeW5Q3kaTQ5ho unsBkd3oxF5DFMAaO58QIMmp6cJ+hFCk4WQQCX7d0OMGPylwSAMPOHnWE+MPZX9xq20XFc5ynk esS9W02I98bJhBBIJ2wRY04ZaIVIrz+xlqWYS+wsFXisu/RoXkbpFScf9RATHwBgWP2idbES8W VvrB1YivInhPyYDoz42tVTa7 Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP; 24 Apr 2019 14:24:48 -0700 IronPort-SDR: cA8Pn8xMaeGPLKD0hC4+vltHoBCtchkGIiqudpnESp8NmKBaTjoiXKS41bTiOiNWrzF7vWkZ7P m8Z0xCcmbaR1LRGGoj68XUI7WmCKUQCNpEKcom1TGicssBlz1FNCC4nSu3sRDZE8ePpKOjrG1p kZAqSRIqoIgjihiiuQjlAyo/+INIAK1vY5MnN6vr4QBnvjRCjM2OON8m/g6eCQnjO0Gx7H3hbQ r0WTx5mjEwHSukDLGK/tUkbMz/RfhbGRlH0QGYAGQWbEiTjr9Tl7el00az5DdhISI86+RvmW7H KrY= 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:17 -0700 From: Atish Patra To: linux-kernel@vger.kernel.org Subject: [PATCH 4/4] RISC-V: Fix minor checkpatch issues. Date: Wed, 24 Apr 2019 14:48:01 -0700 Message-Id: <20190424214801.18880-5-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_144817_942000_8AE744FA X-CRM114-Status: GOOD ( 11.20 ) 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 Sender: "linux-riscv" Errors-To: linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP While working on the patches, I found some minor checkpatch issues. Signed-off-by: Atish Patra Reviewed-by: Christoph Hellwig --- arch/riscv/kernel/smp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/riscv/kernel/smp.c b/arch/riscv/kernel/smp.c index 89251f8ab754..0115db1368a4 100644 --- a/arch/riscv/kernel/smp.c +++ b/arch/riscv/kernel/smp.c @@ -42,7 +42,7 @@ unsigned long __cpuid_to_hartid_map[NR_CPUS] = { void __init smp_setup_processor_id(void) { - cpuid_to_hartid_map(0) = boot_cpu_hartid; + cpuid_to_hartid_map(0) = boot_cpu_hartid; } /* A collection of single bit ipi messages. */ @@ -53,7 +53,7 @@ static struct { int riscv_hartid_to_cpuid(int hartid) { - int i = -1; + int i; for (i = 0; i < NR_CPUS; i++) if (cpuid_to_hartid_map(i) == hartid)