From patchwork Sun Apr 28 00:25:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Atish Patra X-Patchwork-Id: 10920561 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 0341F933 for ; Sun, 28 Apr 2019 00:27:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E7EE72890F for ; Sun, 28 Apr 2019 00:27:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DB90628AE0; Sun, 28 Apr 2019 00:27:30 +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 825712890F for ; Sun, 28 Apr 2019 00:27:30 +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=RvcaDuz9HxsZQbxGoaoQCww1m2XZvqU/j3bhYHmq4cw=; b=SMM2UZNPfM9A1n eRsUASp391ooTk5nkgK8z9Dvl62EKI0aOLZADDEtZPtqKKHgGYOcy0Nw1xaCmeJDp7dX8c8IvK/jd f7FbeV279jt8KFS9Ro4E+9uhuqN1w0pOx1QXc4adAtqjodoLwHZs1sEGi9dm0eHXmljq/yvCkv09U wIV1cnQQOjVu2IB2UPRorZ2BjInDEjjnjQ6JuOrZ1uUfAdlLHEo3sMDelomUon+dNeyllWspQdZZ0 +KGYh1SNjdj12De/3drWg87y3LxSATtp9Xuua63xVUM28D/S7aiGtd6Zn0rOZQYcz55HhLr1J9fmO LHyVPvLXplL3bqb9Ji5A==; 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 1hKXfA-0001QZ-1Q; Sun, 28 Apr 2019 00:27:24 +0000 Received: from esa6.hgst.iphmx.com ([216.71.154.45]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hKXdy-0008R0-2V; Sun, 28 Apr 2019 00:26: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=1556411170; x=1587947170; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=C0s3Q/O8qn11niz50wHDStN1x4FtZC5KPQ7JENLP8SA=; b=f8Q/8sLXqm5kv//s7084dCHvPRN2BSXskDOkoWx+F3xU3Xm0sFmh5suI CpYHPuqWTEVzL55ID5DZlgjvRQfBjYcudvJm6m0sVFbAoSYv10yNFM57w gkD7kkD5Y7sxMfcNJM7RB1n40eCnObmWPkfkO7msrfvbcYDlGmFU6e0DS m7GfjR6Mx9TQtNX0yS/0p16KrV0dayfZI9HSazfLxPJu69WMyio/UFFId nyhGlYstZZRp40laMkTyiK7blQAm6cCg26b8fpVo+Aqyior77YYRws/rM UEZt90vjC3gs6M9VFIdwzRiHwTFPYDfM7HdPCUYfpUkA/QFRjvC8NVxVe Q==; X-IronPort-AV: E=Sophos;i="5.60,403,1549900800"; d="scan'208";a="108718389" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 28 Apr 2019 08:26:04 +0800 IronPort-SDR: 8xR/kLryhpH78TMGHLaGOgBqsKRyZqnshO9Iyp0TQ31f7mmxYOT0lnAIqSWOUsutxzexi8MXEI DZd5vebsAHPesnIA3MCxsex9RPAbJbZqZoPalH+tPxS899nTXixJO3Y9VCfsk86zukrKFuYCQ+ jCSqDt7fyIObePeKLXoQEwnBSSTUp8IcntFPNr6H0CSbS89z+FJXTezLJhngcghdVED3iafWJQ U5FhzDSpJxz2kbMUTkHwAl71ToHGaVUsgfm/mIRnNqD0cz8GrV6pLNzr3vOK3Acmdvoc10WH9Z iRZ7/Mj27gNZKeYlRJ9hKadj Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP; 27 Apr 2019 17:02:29 -0700 IronPort-SDR: u+PFeKWQ12BYmx3wQh9/mn/2Jk/YxiB/FZFzUhp1CfGT2zYs87b7FKeA2xAuTzBL67IrB/ypud qMKsr2v84TUS/6VgObI6p4xN2I2QLG+R2s5vhYjBdiGqVLOEOMLhEhbUhc4bUe2aNgPNbjoaDn fuQ4f8jQyBFgFX0t3E6vQKXZbvFXyb20iSBKq/PcY8aj87kfnlfD1W7hSm3gVLScMDySvcIk/Z RVCuNCHM5kYv36nRZ51PdPGml/aQjENIbLElzMLTel/h9jgUfORwcE590tLWEWafyZOi8yr7Qt 6yI= 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; 27 Apr 2019 17:26:04 -0700 From: Atish Patra To: linux-kernel@vger.kernel.org Subject: [RFT PATCH v4 5/5] RISC-V: Parse cpu topology during boot. Date: Sat, 27 Apr 2019 17:25:29 -0700 Message-Id: <20190428002529.14229-6-atish.patra@wdc.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190428002529.14229-1-atish.patra@wdc.com> References: <20190428002529.14229-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-20190427_172610_328362_DCABB36B X-CRM114-Status: GOOD ( 12.10 ) 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 , Anup Patel , Ingo Molnar , devicetree@vger.kernel.org, Albert Ou , Sudeep Holla , Rob Herring , Paul Walmsley , Thomas Gleixner , linux-arm-kernel@lists.infradead.org, Ard Biesheuvel , Greg Kroah-Hartman , Jeremy Linton , Otto Sabart , Andreas Schwab 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 --- 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 eb56c82d8aa1..ac87a0ec8b5c 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -47,6 +47,7 @@ config RISCV select PCI_MSI if PCI select RISCV_TIMER select GENERIC_IRQ_MULTI_HANDLER + select GENERIC_ARCH_TOPOLOGY if SMP select ARCH_HAS_PTE_SPECIAL select HAVE_EBPF_JIT if 64BIT diff --git a/arch/riscv/kernel/smpboot.c b/arch/riscv/kernel/smpboot.c index 7a0b62252524..54f89d5b19ba 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 @@ -43,6 +44,7 @@ static DECLARE_COMPLETION(cpu_running); void __init smp_prepare_boot_cpu(void) { + init_cpu_topology(); } void __init smp_prepare_cpus(unsigned int max_cpus) @@ -146,6 +148,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