From patchwork Tue Mar 19 22:20: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: 10860537 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 36DB01390 for ; Tue, 19 Mar 2019 22:20:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1122D29873 for ; Tue, 19 Mar 2019 22:20:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F3C1129871; Tue, 19 Mar 2019 22:20:48 +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 9449229871 for ; Tue, 19 Mar 2019 22:20:48 +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: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:In-Reply-To:References: List-Owner; bh=aYHz0gTg7PR434LFLE3+6wxULUfdevmBJoQUxH2vkYc=; b=giZTWWYD6sFEt/ jn3XB7gZl/nxFKJzkxEdOAVFSiqZEqH/R3Q/7L7RdpZQu5A7LNIEKVSTLFN8voSrUMIGJhI+32Uta MUIEwlYrsfdkMz1CpFFO3612m5EBzRsJ7idOOCkmsNUEb60GTp+bd7sRdMPtoOMhT2l95/JoXGerW aX+tZljN/awcEj87anmqkvWvEgNexnyDSZTxXfOZlyz50Ys5NgP1zKxNbMtsibuYH/fwHKHpR+YIQ 67MfLmxsGZfrlMBdenE/Nx16KPxUCp7z6ttDk89UfcKDZlom/by/csqY24jlfvGxMWMBGP0PsjQJl DqLTB6pdehv7fpAxERpQ==; 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 1h6N6D-0003MN-KP; Tue, 19 Mar 2019 22:20:45 +0000 Received: from esa5.hgst.iphmx.com ([216.71.153.144]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h6N6B-0003KZ-Bt for linux-riscv@lists.infradead.org; Tue, 19 Mar 2019 22:20:44 +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=1553034044; x=1584570044; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=k5J6+qgl1gVFESf4xZxUc40mWhR5uxNVP8yAnN65YwE=; b=hW+iLtQuYptUrl1YlU5mKEw3pHYE+P1cbPWAUqNbbi+jbziZHL/2E+Kf xZ77klASAV7EGROhjnRmseH1JY+MidCZI3R3kWZxVhv4OKXni4aVUGvFd qMnUiCACGSt4d9AmhIKQ1fZ4miPO7wcrlkBvJXJ6exUq4jXsRF9Rrza3A VT9mfBqeJHpcDakuFohAnuzv8JH0vd4YrZ8x4MzARyjVxV3xDY1s5x+0U 6PMG216PXc+9d5FDF84RwQpPxOyt70EfY6JYTPS3ORfviiffpqRIUG73O 0jOHG0wnw233INZ4zv1VEafeNZwqIh23i+JIedtU7iI/83JK4nZCNBKxB g==; X-IronPort-AV: E=Sophos;i="5.60,246,1549900800"; d="scan'208";a="105129860" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 20 Mar 2019 06:20:40 +0800 IronPort-SDR: yurOmEFR4ub94mvxTxyWyDnFZ/g6eBZd/0qHoCbzYJ5dajoMagvxKFmD3Fs9tqHnRYM51EFABy PskokzM8N9zHXIEkl0z0dMvu8U1LcJPvBKdc559+onjXdVujNaObhAxyZ0yLXSVsNzJ3W8jbgG LFTHfJlPgMY4qfPgeN8VksHdsUcGZDO3b1ET3TJrOFljS7Scby3AF/xP2xtUnmWsngaH81ucWo ru48pirHLamBNKWwez8Cmu0ZGNPZw1aTiL5fcwgMnk8v7u6eEU+I/th2fufw7xfhdCzhLuIVld m9EXXjJayEzsrijsgsEpvFzL Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP; 19 Mar 2019 15:00:19 -0700 IronPort-SDR: iJF5s9z2RM1Gs19kaUvUD5unDJN293ZLp/MqfQP3gOIefu9Ty5hAtL7oTZ4jpOqI1rPcrnkscw D6Z6Kex/Y8Px1wAl2xc6DRa688BM+FO6ZQL370tlwMjC14HeL8ePhTagAubF2I/GyjgI3EQH0l gzpf69KuXQrrgkMu6KhIJobF4JaxTybKdBfK5izQxnQXLqOkP55+CnSv8arb8fxZS42zhY0126 dUWJLTgESMXUV1AXh3l9AsieAIeuOsEIRE3u+zSkmPqioAiOvU9Jo9znCgZBbpuwpSXr7aEkkT VxM= 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; 19 Mar 2019 15:20:40 -0700 From: Atish Patra To: linux-riscv@lists.infradead.org Subject: [v1 PATCH 1/4] RISC-V: Add RISC-V specific arch_match_cpu_phys_id Date: Tue, 19 Mar 2019 15:20:25 -0700 Message-Id: <20190319222028.4293-1-atish.patra@wdc.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190319_152043_540760_1983FB72 X-CRM114-Status: UNSURE ( 6.92 ) X-CRM114-Notice: Please train this message. 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 , Dmitriy Cherkasov , Anup Patel , Palmer Dabbelt , Johan Hovold , linux-kernel@vger.kernel.org, Atish Patra , Anup Patel , Paul Walmsley , Andreas Schwab 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. Signed-off-by: Atish Patra --- arch/riscv/kernel/smp.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/riscv/kernel/smp.c b/arch/riscv/kernel/smp.c index 0c41d07e..94db7266 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 Tue Mar 19 22:20: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: 10860539 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 61D6C13B5 for ; Tue, 19 Mar 2019 22:20:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 41A5E29871 for ; Tue, 19 Mar 2019 22:20:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 35149298C6; Tue, 19 Mar 2019 22:20:49 +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 E22B52988A for ; Tue, 19 Mar 2019 22:20:48 +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=AmmL5yh07q3t0RUJrDte3IWcNvcJHjjNEz+yr6yLNRE=; b=JKjOWEfkvSsirh ryOhVvHdUMw2/uphxo6sk8OlJKey46ZH54LMDi5DgGDtb9R5azfhbVW5e/fTM1aIrsFbqF++YkyBa 9ADpJlz9aCiPlP1ZV0E5sZCStw5s8HHXm1Xa1KsiRKxzXcOMqxyMoCutXJQD3XId/YTUC1bI2wh8f jDr2LzxojxkWuWHgWizCquFMh/lmn8fkl5ASLsTuER+FgCIzoKns6ZJVHjLOsgBBTnJNLa+uye21R qMJoRGzYDzysT8OCe96lMBYlZfM4MQTOZS7zA/PJcfLSqRF3GSIwbN0nUQsKrh1YszXshN7A4wgCq I34rdMj3kkcZhpjR65UQ==; 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 1h6N6E-0003Mt-9I; Tue, 19 Mar 2019 22:20:46 +0000 Received: from esa5.hgst.iphmx.com ([216.71.153.144]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h6N6B-0003Kc-Gw for linux-riscv@lists.infradead.org; Tue, 19 Mar 2019 22:20:45 +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=1553034044; x=1584570044; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=JHyZqNF9UsH7+ClJFH5uWEO14tdxMwlKOp4HiqDbalc=; b=r8wLxPQgh+JsAfoBlUbCWvjJ34DCPU3b1XMoc4nWrKsFiD9H1QuLG1/K dTTSQ4vvhxgNDT2+nqGRCh4abED7hkwelf8h9EwSJ3gIMQvFzJ6qSvXFa h5MqWiWkLMXig3AZUin+K10XS3Xikr93I3FabG9jqEfneYYPlsoLEqnl9 U8Nvy2ht1b7Z5thGYPHdWqyeEwr43B0r2N/IpkriSzf2VZulZ28vmXlNX j5i6MfLsr8G/vvFsuDVIYoAhcOSRGE2Ur+UVeEtzTO0bb/7udJzdv4hFW 7VeHrhW4Id6bVQa+hLUUCW7mvjK/ru0Pejz5lk7NPRNCNVp+55VrDKLgI Q==; X-IronPort-AV: E=Sophos;i="5.60,246,1549900800"; d="scan'208";a="105129862" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 20 Mar 2019 06:20:43 +0800 IronPort-SDR: oU7LW156C8n/Utl1BlQOTTegMCUKO3+xrgJ/4yncZvf0oapMJJzdIUfm0/2kVQzkjDyVLVThw9 sIDjekReKtZFe5+SFM0jvqgcS9KhBp2RCodAdcu940vdJAvIEYXgUtDKevOntvl3XSzjE8xUdc NuqSSXVa0vZDKOuCeAeRIR40PFmC8Fh/t54uGm6aMCC073KZYc7xvdz7Pg4iqMe16day5eZ9+g VWyPQjJk8msupDWDZwn8reXGxr23gGxUnrOP++/g4ZyXjMsLVAf6R7BEc2XUH+w28b8R6VMpWB BfPYyTnNtQODhmmhoQL7CspE Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP; 19 Mar 2019 15:00:22 -0700 IronPort-SDR: S/UjAAnMnYpTs6jw+2waR06og3vocMTSGYhml767rgnlKG6Me1JB88TbVoMAk17uXmElwqXLaA gI4TXxJd1JDa65Y2Bq/3HjT2BiVEMRBwAWuhKY0hh9C0dQM75Fy4eAPBB42p1sm14vdcOJSIp6 cH8FQfT41ZIQw3GTWW+6CRUmPTyjza1E2p85LNIeZy/EqtO82bpQv5Wk1FJKFJ13KgivPq1SDq QdsxQB5aMRkfQ43vPujqsRVFIPbwqmIGRza9NhQTmbO2aFNY3wosWgiWP1AwcUAmYMUxrQf5zP sSo= 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; 19 Mar 2019 15:20:43 -0700 From: Atish Patra To: linux-riscv@lists.infradead.org Subject: [v1 PATCH 2/4] RISC-V: Fix of_get_cpu_node usage Date: Tue, 19 Mar 2019 15:20:26 -0700 Message-Id: <20190319222028.4293-2-atish.patra@wdc.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190319222028.4293-1-atish.patra@wdc.com> References: <20190319222028.4293-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-20190319_152043_794833_DF8D1852 X-CRM114-Status: GOOD ( 10.48 ) 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 , Dmitriy Cherkasov , Anup Patel , Palmer Dabbelt , Johan Hovold , linux-kernel@vger.kernel.org, Atish Patra , Anup Patel , Paul Walmsley , Andreas Schwab Sender: "linux-riscv" Errors-To: linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP of_get_cpu_node expects a logical cpu id not a hartid. Signed-off-by: Atish Patra --- arch/riscv/kernel/cpu.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/riscv/kernel/cpu.c b/arch/riscv/kernel/cpu.c index cf2fca12..c8d2a322 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); From patchwork Tue Mar 19 22:20: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: 10860541 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 D93251390 for ; Tue, 19 Mar 2019 22:20:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B88C129871 for ; Tue, 19 Mar 2019 22:20:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AC3172988A; Tue, 19 Mar 2019 22:20:51 +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 6414C29871 for ; Tue, 19 Mar 2019 22:20:51 +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=BlFRjNYL7sMV+rPYm5GRya/aa284hpuEYaloSFH+zdA=; b=N054tl1BlmDSVz 6qpmrFJ1jjEj/VGCrlF9YC3cs1reWGWRS21GlHFRUEjvJQ7TzuWVhI73f2tnSNgAGLYkZEtrknV3Q A+gYMd8Vj0IwSUMLtu2/zfNSQ9qT4k7SbeKpQUNgekT0OIGmSH86zpVumyaL0QYylajUlbuFIiMkL shhp4dhZsq3TFIG0tU15mYRRMUY6oQW+AhH6G6H4UE02DHoym0d/AOlYjfS1dF7NbNQP8qwkemV86 qWACVCIUFKyy9J8cJMaOt5SFsvJighiotiD3eVazmnhTrmg3PD4c98IVRmzV3PrXlMBBjJC46+Ald S/JjkuZxB4eF4HPcRavA==; 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 1h6N6G-0003PE-7p; Tue, 19 Mar 2019 22:20:48 +0000 Received: from esa5.hgst.iphmx.com ([216.71.153.144]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h6N6C-0003KZ-Ee for linux-riscv@lists.infradead.org; Tue, 19 Mar 2019 22:20:45 +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=1553034045; x=1584570045; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=L+ofvLBu3teqXjyuNvizoBfdnh+2OK/Hq+Is5NyQizk=; b=dlorfKHu+Ntt80nj145DPLqByx976xbVfEeqnv9fiQUoHjR3JGJvXzFM wv3FXMySIpXvRh3z3hUMmLGMYEy1drWHhtaUowv+Fk7aI9MeurjtQit2E p7rHuzuahz/ZdE0mNjDy4bYsQbK7QCdaay2S0x+NFKHATQTIgc5AS6O3I zZ6oDPtS6Dw7uiM0m61Vzk397cCKgjw9LSSEQqJ5iR9ngHRCI9cgBvIfc nzf5MIGFlKnyX2CHihF4eVOUAtmYNvKkEnw4Z5B1ks7T5CYuvmrRrn3FL j0pH4BK0Ev9gWYaTDIzyolYTioqaNV5p2lajviWzi8XIoCMwsZBobOW2C w==; X-IronPort-AV: E=Sophos;i="5.60,246,1549900800"; d="scan'208";a="105129864" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 20 Mar 2019 06:20:43 +0800 IronPort-SDR: S4Axhll0eBzNndjrNgg1twzTK3phMeq5hU4W+7xHQ8QrrlAhERpLuJML1At9F7y8SGgTC+VrmK uPuZJvhVxXzpwXh8iEd1JmuzlVKURBiwtoKx8srhCfo6iaHQfe04a7LFyhT3ThUtU+lOPKOlCI P0R6BEYqVeRuplbgMqV45HTA0+TUHADhOjPtpomF+LuSDzwMOt23Sixq1FyxiosKCOm+H4CkAQ yxmi7+gM/MIE5kZWH5siR8abO8imSNcc1mjEiZneDUZW9dEB/KyMGl5XGstAGedNuUP53Tc/tA /CStxmwgLB6ZFvNtd09TDXxJ Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP; 19 Mar 2019 15:00:22 -0700 IronPort-SDR: VcKq2dqPDs/FdGnf+fVnkyRVToeqlLSVJ7/l5js6EPxjNkDWo3KcMkYjyoDiiKm3LHkTogiUMY hgdWkDLRevhuHVM/JAMf7UpjznW7YtgYFW+Rctq/nGIdMxFXJbsqJKbYvqAicMDbZeCE2WGyZZ pSGv3d3vuGALE0Q1j6Ka21To44+GFz8Y9qb/jRlHbjyNvMhxyNpAmVagm7pHNemcnQFehPk5an z/PG4qc1fPR6YWIA8dgIxTHiHQ1YCYdSuPqP2bi+OKDkN4mXXP7mvJV9dJHuHoMUnxj42IyT5s EgY= 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; 19 Mar 2019 15:20:43 -0700 From: Atish Patra To: linux-riscv@lists.infradead.org Subject: [v1 PATCH 3/4] RISC-V: Implement nosmp commandline option. Date: Tue, 19 Mar 2019 15:20:27 -0700 Message-Id: <20190319222028.4293-3-atish.patra@wdc.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190319222028.4293-1-atish.patra@wdc.com> References: <20190319222028.4293-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-20190319_152044_622224_31BDC1F3 X-CRM114-Status: GOOD ( 10.02 ) 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 , Dmitriy Cherkasov , Anup Patel , Palmer Dabbelt , Johan Hovold , linux-kernel@vger.kernel.org, Atish Patra , Anup Patel , Paul Walmsley , Andreas Schwab 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 --- 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 df353199..609475c5 100644 --- a/arch/riscv/kernel/smpboot.c +++ b/arch/riscv/kernel/smpboot.c @@ -49,6 +49,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) @@ -76,7 +87,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 Tue Mar 19 22:20:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Atish Patra X-Patchwork-Id: 10860543 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 31FBD13B5 for ; Tue, 19 Mar 2019 22:20:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1022A29871 for ; Tue, 19 Mar 2019 22:20:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 03AB42988A; Tue, 19 Mar 2019 22:20:53 +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 F1BAD29871 for ; Tue, 19 Mar 2019 22:20:51 +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=urlIsUpkeyjMlx67y+X44wDkYVsVjOO3Y0wuPnd0UlQ=; b=MDLp3mOs68EU+1 9TUf9iXEWL3KHSCVjfx+3la72owULInnQO+oQl/5wNw2KrRzfNv6oOcD5AolzGSO/uEN9hG7xwjmz izdgIl1hOtw0Rn6K64jyIg5/LoCd6hQ0sHvcGxby/OTMtLubHL7Gk28NYRA9JaIqVeW42KSUeyGNr CnTeanJQc3nfgUgqAPalrL49GZURgnmH8Wa/j5i6zmUi29djrd/27ZrfOwmDajvz+fSBKz1cL/iLy 66uP2EcC+KQQ2HXYJ7uOBGnzAsJLpJ7M+m44b0uV8ligl2/msViydK81hvnTgJCdCy10Mhxm5m9PL tkFoqUGihRoLkhnvNMzQ==; 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 1h6N6H-0003QI-0m; Tue, 19 Mar 2019 22:20:49 +0000 Received: from esa5.hgst.iphmx.com ([216.71.153.144]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h6N6C-0003LS-Ry for linux-riscv@lists.infradead.org; Tue, 19 Mar 2019 22:20:46 +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=1553034045; x=1584570045; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Zb/1pIZ8wgWkzLDrZtCT/oGYWbugSzEwVSqAOP9Qfzs=; b=e6P852uXycUGyLHTrKaVBtOoVaDdaPgoNoq4dao6tDayfRm6Z48x23SX 66vSMAbESAID2nOeV3GKyLOmG66m0SWKOQyU4o2YVl9ZExZ6karqX9Vnb PdpZyRFj5LiFRI8DutEECZqJZxSczimTnSBW3wFwObaqKkXMwcmIh+hd/ QJLzsuOPSrnvR1o8hfcD6RH9413bb5AsCEWyfbvEPfOlxgcocpvvCB+Zq 1dD/CbMHcxMgl97uocyxqkkUmq0uosSfcZ02ED4c/TrA9dKPDgEn4GRt7 vgWH5qrvwwcDquXVEsx4P59MOE575/QwB+XqiQEhGNvEVzJ1rSuBCQW+V w==; X-IronPort-AV: E=Sophos;i="5.60,246,1549900800"; d="scan'208";a="105129865" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 20 Mar 2019 06:20:44 +0800 IronPort-SDR: 60Kn9YRkAIXtmXRZ4Hmk57inSkPaFwKJR0oL3eeMs8V3+qc6/X5jj7YgqclbbXaoYKsO/X6Dx6 VJOvo2GulPx67dZWasiKUSGfdRGutmIancdcRyup3yP7ZWfj4NLfy0HpSGk+efnFoPk9owTTif oEiihspIHIGazzBf01s8HebmRrnVULT08FwneboVWC4r6gvUHMgaR/PF7Z7X8kVRpiuu5E0ndQ KEnnrVYfJaDdHoulJUZvIZ2cvjUFdRpczJvYWHkJYHi/aEQdf7vgoCnGIlOJoA1dmIempd4lr3 92HbHQz07TwRuWn9cyNlIR/T Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP; 19 Mar 2019 15:00:23 -0700 IronPort-SDR: ZqfseJXtlCgxX/y9yOpnz26+OVA7vw79c8S5Wvk4id9ZnGowhbkrLDNUyeARLOrwKE9xABFfUj pMybza0z2dYmwZCVImxV21rq0LoVslWT0Y8pmVyJdqXdA4AJTdnsfvirXteY/M7n3gr0dXR+OQ MfC6/JToQILOUi/MuYUu6V0sJzeDB/+uRGS0iavAvtCZbp1seqPk9o/iUR/sBO2jkFgHaTmObK UBWS13K/ValG5+qOWcR88c6yjcREHCPc7i+nASzfgg0Rqz4zOsTlsGjeFPoAJ4Z6DefdQ4IIvs wuw= 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; 19 Mar 2019 15:20:44 -0700 From: Atish Patra To: linux-riscv@lists.infradead.org Subject: [v1 PATCH 4/4] RISC-V: Support nr_cpus command line option. Date: Tue, 19 Mar 2019 15:20:28 -0700 Message-Id: <20190319222028.4293-4-atish.patra@wdc.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190319222028.4293-1-atish.patra@wdc.com> References: <20190319222028.4293-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-20190319_152045_011679_E367F5E9 X-CRM114-Status: GOOD ( 10.26 ) 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 , Dmitriy Cherkasov , Anup Patel , Palmer Dabbelt , Johan Hovold , linux-kernel@vger.kernel.org, Atish Patra , Anup Patel , Paul Walmsley , Andreas Schwab 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.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/arch/riscv/kernel/smpboot.c b/arch/riscv/kernel/smpboot.c index 609475c5..a8fe590c 100644 --- a/arch/riscv/kernel/smpboot.c +++ b/arch/riscv/kernel/smpboot.c @@ -86,11 +86,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] are greater than configured via nr_cpus [%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)