Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3092292imu; Thu, 29 Nov 2018 15:29:31 -0800 (PST) X-Google-Smtp-Source: AFSGD/UZXtqagqQAdCI1GPfoRJ8MVGe1Oa/tJHsX+ZxR6xUpiNZMoXz0H+MU2aJrYxXLLihez8cB X-Received: by 2002:a17:902:6bc7:: with SMTP id m7mr3524447plt.106.1543534171909; Thu, 29 Nov 2018 15:29:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543534171; cv=none; d=google.com; s=arc-20160816; b=xMS/wU0AY5HCKwDHtEhneFAsDZxLzUm2x3Aw0XXPV+G9a5psvVAodp7STJCrlJyHRA vKFfaN1/xhm0Dc+KEf7oFvqtIg1Qh2iW0tiaPga1BrVJ/L5pFz3ktWX7qaDIkYqA1rO3 K+vBqk5lnhNVJ4AXSqgywVhAXP6Vbcjiw7qh+OJJbwBhAlRPcx6WosAnoy/cTxLWdxTw vVaYmZ753EGxedypFt89BDuCJ/Q5mIPhvbdUJcGcZet+495MdzJYlOYnaaP8dod0WG6N bwFGWpd5O6jSWtLfDlJEEvGbdCrRki9VZy9+heG2gnA7ttdS2RFzCTUa2sJU/2JY+MZA QV+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=cC9sPVfCgJtorE1qq2ORYXYJCwM0i53xxkyQaksqMPs=; b=KgelivKboqSILFtHGi6wPf6i2fBaGSOLL7w/V4B5LHnvo0uypfAuilH0HFyzENuzN8 KE2zYCARVG8Bvy+kXMKpQOdlSkWI/eN5ayYh2KFXSuSLMZWytBeuFWS1tEwI03p++xCc /SRZPlpaFzqIEg3dL3Gu7M1/ubWxeoJkr3P/mnibYZwL3Y9k37OoyxqOPF14O1PXC2XO 9lIRy1L+LmIah8zjwV7axq+TkmIu+qgG69GG7RWF1FdkRlHmKybj+ZxpxJD1OaBKrnfk VczNPxWp5NAZzZjErdpBeDDhQdQvFYupeZxvW6qmdx48AqDwtNH/PJiBIXSz2+dVNEtn XtjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=KNlQ5p9i; 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 j11si3601953plb.253.2018.11.29.15.29.17; Thu, 29 Nov 2018 15:29:31 -0800 (PST) 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=KNlQ5p9i; 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 S1727207AbeK3Kft (ORCPT + 99 others); Fri, 30 Nov 2018 05:35:49 -0500 Received: from esa5.hgst.iphmx.com ([216.71.153.144]:50484 "EHLO esa5.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726393AbeK3Kft (ORCPT ); Fri, 30 Nov 2018 05:35:49 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1543534116; x=1575070116; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=YJWL6o6WgbyRWAjG3a3Oidz8p0yUa8aPZUNi9rTRfRo=; b=KNlQ5p9i7/+Hf2GdWZgOGpPeFlasolR0JSdoNsEUYpBIuuUssx4cL5fY pxOd1CjQs2DacZUCEK2Iv+O7zaTL+ebpe9xKymGuj9OIAR9a1tzARSCJr BLhRZt5Idl3P6Wt5rMUvQ/9tYAgug/RQ2lMHh57y0eikprI8hKoNQGaX8 6kypNqa46nxo8rwYO39FVyJXbvSQ31bLU0bnQfpa8o9VwqfgyyVyrebAR NKTJyDG5azYppelPOb/ee3+asjm1RvaSuCVGPF+SuaU/Z1/buf9CxZprx a85IClwNrPwoXqgWxudh6OInXrgoKTFbDQiCGJfDnbfgz1w72T5Wefi9i A==; X-IronPort-AV: E=Sophos;i="5.56,296,1539619200"; d="scan'208";a="96644317" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 30 Nov 2018 07:28:36 +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 Cc: Atish Patra , Albert Ou , Anup Patel , Ard Biesheuvel , Catalin Marinas , devicetree@vger.kernel.org, Dmitriy Cherkasov , Greg Kroah-Hartman , Ingo Molnar , Jeremy Linton , Juri Lelli , linux-arm-kernel@lists.infradead.org (moderated list:ARM64 PORT (AARCH64 ARCHITECTURE)), linux-riscv@lists.infradead.org, Mark Rutland , Morten Rasmussen , Palmer Dabbelt , "Peter Zijlstra (Intel)" , "Rafael J. Wysocki" , Rob Herring , Sudeep Holla , Thomas Gleixner , Will Deacon 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> 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 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 -- 2.7.4