Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3076840imu; Thu, 29 Nov 2018 15:10:51 -0800 (PST) X-Google-Smtp-Source: AFSGD/W8b20qXIF8cBOC1j70EpIesftHURcyX6INVDCoPwWFxTHST/umbOcgEWLERcMMMDNfz9Ka X-Received: by 2002:a17:902:583:: with SMTP id f3mr3489031plf.202.1543533050949; Thu, 29 Nov 2018 15:10:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543533050; cv=none; d=google.com; s=arc-20160816; b=IaOm9+NZtdFFV1IBzdKR91Mv4960yrf71EwPvkrsDXsXdfE0dq1cPpTtooorfxqk0I 1+s99ikqegJZJ6jRzrwuIYQc0gZWCnL1YER9OEujLZa9PNLf41KtW8isxMVmUFG4gj1a BhF3AxzbXPZlu8Wny6uUW60W8RxDNlhrNfX+SoGgYrenID00Ps2pP2LDX/y8aQ4q+Zz8 ts4KQYKMDDItZIdXIlwFgJp77JXLD+5ENNiLBiQNLX74pa1AB2jKNeUlBnkVZQsXUy7Z 1R+qHa1HebmM1iVOFr41911WDlY+Z2mkIVL9xZBd6pE7nyyJIlH42QYi1MHEedg7FQQM osiA== 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:to:from:dkim-signature; bh=cC9sPVfCgJtorE1qq2ORYXYJCwM0i53xxkyQaksqMPs=; b=i1puVc9y8IE3lJtz8sPdctsS1i3QGhSeSEEEasjLK881l5DpG1RTdzatDsy95nLbcm eXsAzo70zpqTwixeKFIpeYTTXZ1Yz90ClQ8mhqrJuYARjEDs7o5Q95Cwu0B5QOM6EJW/ D9xODk0d+XmRlLaT0WBUoMfgD7Pmsc1wX0ro9DFnhFdc0c8rwKbBWTp7eKClwFH2sBF8 O9i/CQ4Ptyiyc7thKG4RnjEfX/rvn8x8RKgQFIdTQmAKTdGSUB6m5MH0P33CAj30yxPJ NLlvEmOjYps2lA+IXUVQuGlaiDibIHR4UZXTe/wqAWdFlM32hVwJkYhZkyISZLuDecaI rA5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=DiifgtTe; 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 e129si3072785pgc.333.2018.11.29.15.10.36; Thu, 29 Nov 2018 15:10:50 -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=DiifgtTe; 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 S1727745AbeK3KQt (ORCPT + 99 others); Fri, 30 Nov 2018 05:16:49 -0500 Received: from esa6.hgst.iphmx.com ([216.71.154.45]:43717 "EHLO esa6.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727303AbeK3KQs (ORCPT ); Fri, 30 Nov 2018 05:16:48 -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=1543532980; x=1575068980; h=from:to:subject:date:message-id:in-reply-to:references; bh=YJWL6o6WgbyRWAjG3a3Oidz8p0yUa8aPZUNi9rTRfRo=; b=DiifgtTecgD3XOrS3Ca4hO57tnQKPsDhNrI4Arf9mpzPuVFjXSGS6DQE GmdaqqWpowjpfaBcMxl9J+ceIqx2mSXSJWbVw5yAF8Mo8r7uY1s3EMMkI tyQ9A2PS/YU5KgdxMnPM7czxJofF2/HK7uO5KMmwzj/Nga4D/ArYwXa9l MD33GYH0Fungd/v9k58PTOBH89xAbArqSTYbd4wx0hvNOMSjmGL1BBqLV 09eKN8D7+z8RKibhU6zM2veDqa+RiqZX4BvX8pg/ZqklimRsZXI9sxnXc ZdUHgsY5qQT+X3j2g1to976Ky2BmLWVbQKT19/ICRfniWHNJqyvL/ECt2 w==; X-IronPort-AV: E=Sophos;i="5.56,296,1539619200"; d="scan'208";a="97183857" 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:09:19 +0800 Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP; 29 Nov 2018 14:52:15 -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:09:19 -0800 From: Atish Patra To: linux-kernel@vger.kernel.org, atish.patra@wdc.com Subject: [RFT PATCH 4/4] RISC-V: Parse cpu topology during boot. Date: Thu, 29 Nov 2018 15:09:17 -0800 Message-Id: <1543532957-22661-5-git-send-email-atish.patra@wdc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1543532957-22661-1-git-send-email-atish.patra@wdc.com> References: <1543532957-22661-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