Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2201174yba; Sat, 27 Apr 2019 17:29:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqzRw+RM99DZjbKqWuq7HF9j3cTqW12COBz9h2Ud1wbtqDQVI3GAc/oRkbYmpT8EKUJIqBzv X-Received: by 2002:a63:79cf:: with SMTP id u198mr37214002pgc.34.1556411363106; Sat, 27 Apr 2019 17:29:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556411363; cv=none; d=google.com; s=arc-20160816; b=h25Gmt3dpLGVxUpcelyQBxQ6xNFQ4943J6uw7zYr98s4t+tueXvOpAcM79WGZYIHx8 Vd1ysap6qDtqjfNH+ju2zAmTiRFoZM0ITDgfhtIHHgYO0sL+7mSTMqtXb7EQ9OYwVdUC pYe/HkwVnknr5T5svJCG/GIiS4WUsyHcKTnye7R44qFOg0CsRXmOkiCGcdxNd+VJXWA8 0vfVIVuOnJ760cTHgSP4bBZleqmPUkpwShctvc/+s+3oKz9FADHAGnBvs8FQAjagar8Q mLM7VnikQH6eYEAvsr2cWOhGpoxe70IhCErfgEFt2LJ3nLSVFk8iNINXZ9+hlaS9uNiA ihKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :ironport-sdr:ironport-sdr:dkim-signature; bh=IkrFgBrTAmWZuqKo0AB3BsPwuOg47qxSXodxJjIB7V4=; b=gqGasfIOTuOAMJl92b6EC8nhffuT+ak38VQZ6Q/7D/q342Kke8PIePFH5vRxkLlnX/ Wbfe8G9d8g5+XGgyOyHWM9kWAdB5AoMPui9jGtG4C0xbGmtvDQgWyYXIoRP0g/4wY5Tq +6OV3+HCrXuJQvYhJgJtrwh1Avd8vGuUXMWlaAGRB1LYjVAVK6Ta4Y5cNDedc2F1sk3D O15iVY9oCjUZWp52Ifpp/Pd2COemhhNOw9rKyvFBumGVTZJLMQgItUJGQOLQy1Yrfndi 8tMgyLHLdQh41utdzFVKyqMgFJW2cPGa1SljhCsgKF0GUiQwsLXZDpDzCMU8mztKXqcq W+5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=QCwt9Cjp; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=wdc.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f23si28944306pfn.136.2019.04.27.17.28.33; Sat, 27 Apr 2019 17:29:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=QCwt9Cjp; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=wdc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726474AbfD1A0X (ORCPT + 99 others); Sat, 27 Apr 2019 20:26:23 -0400 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:14542 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726352AbfD1A0F (ORCPT ); Sat, 27 Apr 2019 20:26:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1556411165; x=1587947165; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=C0s3Q/O8qn11niz50wHDStN1x4FtZC5KPQ7JENLP8SA=; b=QCwt9CjpujtTCIr5Ae9LGaZXlI35nZ9ah1X2fClj0CFtkDoRDfxQGalR +obDXNguXanH8O5DQUSO/wAP2ZL8f2H3UZ3mFiDL8CSZ0tHeg3RCns1lh G4tQFtqIjBfCwUgDRzyOJZ0iNffKbaXVNZdNhOAbS7ynaC1QnnBLXReDj hR4aTBkVuPWav4kzrmTH99uu1EWYs6uyIcGztKWFcG8wal8z1bqmd2Rp0 3uK496ATnkvJfDhYlP0ijeKrfq/Zbvoohu5t+USoTPC3mF28UsieeeKJa 2RJEfpxOIO3go9fZ6A9WUQrenbNaa5DXrZIo66LMsKrxg0rRAr5ISCNAZ g==; X-IronPort-AV: E=Sophos;i="5.60,403,1549900800"; d="scan'208";a="106993915" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 28 Apr 2019 08:26:04 +0800 IronPort-SDR: LZ87IoNllupGmvnKgEnnWe22Arr03Qwpq1k/5YnxKGlUY4h8L5VRUP/2cKZQiollVpq63vWblY Isv8Rl0PoJPPKzX6ShUbS18LurUPCslrm0M5uoWbmdfGiwvB715KBbCOMEQ+76Vf4g8Wg1JwZS UAq4vSAVbfuJKduL8Fov+HbQJaR6dnk4tFL85OkyAZZzErg/1OD/sbOUzVrAsXWl7Ogk5PlKkK frIdCXkM7HO8ouqMeoHt/KBGY1yHRLJN02W09rZ8aDJzC0KNPnL7CRtH0QRKR4iy2phD3C1cuh 0ERn/gfQYAPV4rOL542p8uab Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP; 27 Apr 2019 17:04:38 -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 Cc: Atish Patra , Albert Ou , Andreas Schwab , Anup Patel , Ard Biesheuvel , Catalin Marinas , devicetree@vger.kernel.org, Greg Kroah-Hartman , Ingo Molnar , Jeremy Linton , linux-riscv@lists.infradead.org, Mark Rutland , Morten Rasmussen , Otto Sabart , Palmer Dabbelt , Paul Walmsley , "Peter Zijlstra (Intel)" , "Rafael J. Wysocki" , Rob Herring , Sudeep Holla , Thomas Gleixner , Will Deacon , linux-arm-kernel@lists.infradead.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 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 -- 2.21.0