Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp2468830ybd; Thu, 27 Jun 2019 12:55:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqyL+PBjmOkZOsnei8vnvGaMFMgzLjFr/8ya6GHFjVC+wkIJmLMvVtmtciYabYbEHJqN0CmN X-Received: by 2002:a17:902:74c7:: with SMTP id f7mr6589304plt.329.1561665357560; Thu, 27 Jun 2019 12:55:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561665357; cv=none; d=google.com; s=arc-20160816; b=dvVhYnXDVRyoJwkGscMAuGrAuATaFYOsAVTfE+9RHs46avSQrG/xBHM8sGBSGijMdS pTDBaBH+oJnYbnkFJ+0t9n2+YO6eOgS1MuA1EYtkUvPVcjDrgXWczjQoJ4FdS5YQUDvV OHlrX1Qwc2HdVeBhuWp1ZSQx3/tMHLgzXbUOJQ3rv2RQ3FNrRegLF2BJn8cFyYJQluj5 r8Sw9M32bhpPeGvrQd8S/GKPBfDqB9qO/XxqF8jD80bln92jSr9dwKQZp+XWvfDTabl1 R8IZppFKn/oBizE2InOaBj4ecEeXmK5CZ055TVsDjvc1uF/TM5b70XQ3Zn6jRMbZIo6H wT0A== 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=2ciqEM+UwlmWyioIQg3+qI5Cdwch0pJboA9MrZKnLc4=; b=pDO9rF/EHrBXG7KOzCPyEPrCalvk1Hn3+68dD4rqv7OyDgCEM4zEzhLOIlSAtIcike 2kOyPzhmtiHbR71/L14Q5G/6rsdNPoCb4ups2Ng9M+e/lS2G1rP0xl6Gpy1qx+wRRSn8 huR9bFeR0yZHO+R67a4JNKXhZbpSgQ33uV3GgJXDmzJxbnxp672HGFEuYFIKTF3O3xIL TgQn0RwVV8OZgQ2qSS+Z5cX1D6wTV4p3c5/tcCXIiBNT1mkVKrwgHsCE4n1YbiYqim9m PrXumGuPXplCpukezZy1TFEA6NO8J31y0Ye2/OAPQLRI0WlqjPCgOa5vPZtP0eO+9J8O qY+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=JX3l8AN4; 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 i97si3363763plb.50.2019.06.27.12.55.41; Thu, 27 Jun 2019 12:55:57 -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=JX3l8AN4; 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 S1726659AbfF0Tza (ORCPT + 99 others); Thu, 27 Jun 2019 15:55:30 -0400 Received: from esa5.hgst.iphmx.com ([216.71.153.144]:23412 "EHLO esa5.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726616AbfF0Tz1 (ORCPT ); Thu, 27 Jun 2019 15:55:27 -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=1561665327; x=1593201327; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=FdusRwcmVMWHwhKYZKA8Sg9X99lDeoGVE78siWre56A=; b=JX3l8AN45vC+lbi5Dt6PYvzRmzL6LqbSFJhyFNV6wk/mojay1/8SZ5Bj QgHDWlZx4RhsVa929ni804NZejGBwyFyyU+IwSvybu3LVQgeBIhJJtCni RrK+Om9jGroa7ktNtsiHb639SBWYB1rAKr+Yq08CBeZYvv9wVJQgXlIrO ow0VVua0synWiEcHrPSSXSHWTRXoi9CLff9CkU33L7w2Mj7+QeRrjqgtc aBRN5eWXhlAYd/QJWm5a5ZwEJOZE6qz5tDOxpYSMuiFqe1/qsHkfUQXCx DdywiG9bfxv4Bt/RUeyyKKqPm0kh7HlsY54b7C3yrmvpfCHjUVuu1TYcW w==; X-IronPort-AV: E=Sophos;i="5.63,424,1557158400"; d="scan'208";a="112927450" 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; 28 Jun 2019 03:55:27 +0800 IronPort-SDR: Qdmkp33cQxW+NE2zr0XSQxnbFewo2ZZkviZaZprliJAwTrFbOei6FLmZRLtSUCo2Nh1IELDtCL wewiII49M7HWxSTHyyOKog3KoXL2vjmC7AfYVD7GNDJ9ezV7gTNCxg3wtPdHyl3kBUXvpFsCXS IEBUDWxYB9NvlXVkRb0vkF8Co9GByMgFruRmGhQgMbx/a9wWieL48v63h7HEPdD3Y7p/ooncVs Ew9DSEZDBmG2UmUHGQhKM1LatXXCoqrxSDnJHZqYujT0z0iRe53MdzEr3wVP9/vLjZm+hYLODo KgancvFWSIiCvyFG1SeRgG88 Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP; 27 Jun 2019 12:54:40 -0700 IronPort-SDR: d1yMyLnC7Wu1GshTWNxTIlhczi+9O2jjCAHWfUDPztekbDm4XE3u04aDnlpTjRMmeh1CKLfui8 P5UxBmYCTr8owGXsaC1vRfQs8i60QviKT47INux220RIG///tw1U65SK0XPTNY5dFv1fHZ+wEA Fhcra5QKct/RqS2YsuHLX3+i0hct8lXif7gbGJ3496ZQwlw8OY00Puha2jArrzVWz3BeTvE8zE zdOurgEpIZtkLqdZ98a+B+F3gbW2gJPkJ0jf1xfnBRk+3cJuhLtM9pz9qONTyZKb5acHeakOf+ vm4= Received: from jedi-01.sdcorp.global.sandisk.com (HELO jedi-01.int.fusionio.com) ([10.11.143.218]) by uls-op-cesaip01.wdc.com with ESMTP; 27 Jun 2019 12:55:27 -0700 From: Atish Patra To: linux-kernel@vger.kernel.org Cc: Atish Patra , Sudeep Holla , Paul Walmsley , Albert Ou , Anup Patel , Catalin Marinas , "David S. Miller" , devicetree@vger.kernel.org, Greg Kroah-Hartman , Ingo Molnar , Johan Hovold , Linus Walleij , linux-riscv@lists.infradead.org, Mark Rutland , Mauro Carvalho Chehab , Morten Rasmussen , Otto Sabart , Palmer Dabbelt , "Peter Zijlstra (Intel)" , "Rafael J. Wysocki" , Rob Herring , Thomas Gleixner , Will Deacon , Will Deacon , linux-arm-kernel@lists.infradead.org, Russell King Subject: [PATCH v8 5/7] RISC-V: Parse cpu topology during boot. Date: Thu, 27 Jun 2019 12:53:00 -0700 Message-Id: <20190627195302.28300-6-atish.patra@wdc.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190627195302.28300-1-atish.patra@wdc.com> References: <20190627195302.28300-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 Acked-by: Sudeep Holla Acked-by: Paul Walmsley --- 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 0c4b12205632..2d8a16299a85 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 ARCH_HAS_MMIOWB select HAVE_EBPF_JIT if 64BIT diff --git a/arch/riscv/kernel/smpboot.c b/arch/riscv/kernel/smpboot.c index 7462a44304fe..18ae6da5115e 100644 --- a/arch/riscv/kernel/smpboot.c +++ b/arch/riscv/kernel/smpboot.c @@ -8,6 +8,7 @@ * Copyright (C) 2017 SiFive */ +#include #include #include #include @@ -35,6 +36,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) @@ -138,6 +140,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