From patchwork Thu Nov 29 23:28:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Atish Patra X-Patchwork-Id: 10705541 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 DE69113BF for ; Thu, 29 Nov 2018 23:29:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CF0D12FAFA for ; Thu, 29 Nov 2018 23:29:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C26C12FAFF; Thu, 29 Nov 2018 23:29: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 6F13C2FAFA for ; Thu, 29 Nov 2018 23:29: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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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=6fT88800mX9QJ8XHJD6a8lPz5TlycVi+xFfwemuw3RE=; b=lDEdVXtOg5o8p9cPOD24M/4Fcz +t01KU5lREcE9hFXYCAC7VttJ2myaeo3MQL91ap7yXR5CNUp1e2AhhHvkRiEsZqVyh4IuTU04TUVj txZJ3TjsMxa2mGNd5TiEvEkAZEI7AVn5uySmva2LLGqWUayRbuRsiW7U8j842HTCMx7fgJ0LEwiDA hNA9jTfQLFdd79n+QZ4R553mx0y3wuKFTrCuup+6lvcdCH2qLNWUFHNQdyfX4XDbN3lPmU/qBeZdE 9BZBU5tUCUri1joM6Rgu260mq28lOHfmsqZ7mrooZ3+Gl32jWJnZeLkegVH1ZJl+UUsPdYM96jv8w pDsj8wQg==; 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 1gSVkb-0005sR-Kw; Thu, 29 Nov 2018 23:29:41 +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 1gSVjc-0004vG-Qk; Thu, 29 Nov 2018 23:28:42 +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=1543534312; x=1575070312; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=YJWL6o6WgbyRWAjG3a3Oidz8p0yUa8aPZUNi9rTRfRo=; b=JQlkCFOYOMgMy7w+7XI0gEMITiU1uQ63Ey+qIh5koYEX4n+mVKE7yV/0 d79oOzMEDlyZjdEQqv7YwTLpbujjQ2br2TtR5kWBbc24caEuWQUulUafJ 2sVBSaojX+Xm1pkLz530bTgEpBDBYpIKeND5UNi/L/SwBWhRFN0dBFXpl 4o6RtapZCF3BCstCE13myI29OBO4dGR6f1v7AfTvTO5StnyCI8zmdqSIn tP7SVRjETzsvbdMNCPUr9ea1zu/htI5i/clDRfmtk3F1hIydUZcdedwYG NJ8BTJ/y9I1kTpzwaoQ1q+qenHBN7lwKlIkeAG2p+IGhpBFy/90F0UgJy g==; X-IronPort-AV: E=Sophos;i="5.56,296,1539619200"; d="scan'208";a="193267119" 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; 30 Nov 2018 07:31:45 +0800 Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP; 29 Nov 2018 15:11:33 -0800 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; 29 Nov 2018 15:28:35 -0800 From: Atish Patra To: linux-kernel@vger.kernel.org Subject: [RFT PATCH v1 4/4] RISC-V: Parse cpu topology during boot. Date: Thu, 29 Nov 2018 15:28:20 -0800 Message-Id: <1543534100-3654-5-git-send-email-atish.patra@wdc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1543534100-3654-1-git-send-email-atish.patra@wdc.com> References: <1543534100-3654-1-git-send-email-atish.patra@wdc.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181129_152841_127158_814DA951 X-CRM114-Status: GOOD ( 10.72 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , "Rafael J. Wysocki" , "Peter Zijlstra \(Intel\)" , Catalin Marinas , Palmer Dabbelt , Will Deacon , Atish Patra , linux-riscv@lists.infradead.org, Morten Rasmussen , Juri Lelli , Dmitriy Cherkasov , Anup Patel , Ingo Molnar , devicetree@vger.kernel.org, Albert Ou , Rob Herring , Thomas Gleixner , "moderated list:ARM64 PORT AARCH64 ARCHITECTURE" , Ard Biesheuvel , Greg Kroah-Hartman , Jeremy Linton , Sudeep Holla MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Currently, there are no topology defined for RISC-V. Parse the cpu-map node from device tree and setup the cpu topology. CPU topology after applying the patch. $cat /sys/devices/system/cpu/cpu2/topology/core_siblings_list 0-3 $cat /sys/devices/system/cpu/cpu3/topology/core_siblings_list 0-3 $cat /sys/devices/system/cpu/cpu3/topology/physical_package_id 0 $cat /sys/devices/system/cpu/cpu3/topology/core_id 3 Signed-off-by: Atish Patra Acked-by:Sudeep Holla --- arch/riscv/Kconfig | 1 + arch/riscv/kernel/smpboot.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index 55da93f4..b0b1fe1a 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -42,6 +42,7 @@ config RISCV select THREAD_INFO_IN_TASK select RISCV_TIMER select GENERIC_IRQ_MULTI_HANDLER + select GENERIC_ARCH_TOPOLOGY if SMP select ARCH_HAS_PTE_SPECIAL config MMU diff --git a/arch/riscv/kernel/smpboot.c b/arch/riscv/kernel/smpboot.c index 18cda0e8..5f435af7 100644 --- a/arch/riscv/kernel/smpboot.c +++ b/arch/riscv/kernel/smpboot.c @@ -16,6 +16,7 @@ * GNU General Public License for more details. */ +#include #include #include #include @@ -42,6 +43,7 @@ void *__cpu_up_task_pointer[NR_CPUS]; void __init smp_prepare_boot_cpu(void) { + init_cpu_topology(); } void __init smp_prepare_cpus(unsigned int max_cpus) @@ -115,6 +117,7 @@ asmlinkage void __init smp_callin(void) trap_init(); notify_cpu_starting(smp_processor_id()); + update_siblings_masks(smp_processor_id()); set_cpu_online(smp_processor_id(), 1); /* * Remote TLB flushes are ignored while the CPU is offline, so emit