Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp6846530ybi; Wed, 29 May 2019 14:18:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqxXgfUKH0wr6wVMnhIX+FMKw+gyyfk/vTmJ0JbbVkZxiSnucQe28JOEiW+aIzJNHFLL17sM X-Received: by 2002:a17:90a:1959:: with SMTP id 25mr15180588pjh.113.1559164707309; Wed, 29 May 2019 14:18:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559164707; cv=none; d=google.com; s=arc-20160816; b=V9gnkC3krftHA3/2Zm4+zxN64K3mSi6uyGMqIWA43xoPOJut0ITK2/4hHEN0c00dpq xq9F0T9EtkPfnLOOcS+l1xDm8BFLP21mDSpO3WFBUmoCSEnzwFW2NNwIJvDll6I7bihs G4+2fu2cOw4I3RvHrl5b4sGSJSiP+vmZMobpbC99Hqd9QNe4iHr6onS28mbUpzXRhgQN R134GdIgbJK/a/gKbBtmWu5JNsrg54QL0I+NGkKe5GofH00qpNSA1UdHaDzjLRmnZZ0f Gnz5TxuVcCDURRwvDlMB+73MEZSFAQ6UXrkucmwauQhOwMXPhQu9jrd9+f01UT6wyVeV 3RAQ== 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=VGYt5tgjpHfYW4UAc05dbIg5cLVTNrj0ArdvH4uZW+Y=; b=s5yFLd3WPi+8Gbbzt+iglm3pg9xCYMCG4d2blUXDFV5jQtrx/jBm7HMrtrBcINBW3d 30QXkt6xWiVOnFETg4ZC95LJru1NVLSAnUjAV9iI6mgqTugJp2BRFvLUyTyo/UBD9mdW K4aXc2CMzUppVkMNQ3RH9+OUrxMxHT0z5i2C9kvgHE0yo5YJevpcf4n0C6zSSwxEBFQ0 JkPDJ9gz1Cc7m8d+eB7U8oExyPJ8Q3fAigzh8W3c0CLbxlzz6yX6b+0mA3Yp8Bqc+cwf c9KJi1QlN0Akg06HHGLIAEvL2d9wMlhgn6BF6IgF+8Zsq9smcYuD/9x4hP0UM2cUETf2 Tnfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=dz4k9tCC; 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 w4si753851plp.223.2019.05.29.14.18.08; Wed, 29 May 2019 14:18:27 -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=dz4k9tCC; 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 S1726540AbfE2VQj (ORCPT + 99 others); Wed, 29 May 2019 17:16:39 -0400 Received: from esa3.hgst.iphmx.com ([216.71.153.141]:29169 "EHLO esa3.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726043AbfE2VQj (ORCPT ); Wed, 29 May 2019 17:16:39 -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=1559164598; x=1590700598; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=amOjgDh6kVgGSeqvAP+D7/HG3VWV3i7Or4bw+vBidq8=; b=dz4k9tCCghnwphSTHGl7MRnR5Fwis1ShaUBBFdDuT4EoJpt8T06MFf3Q VmME81Phlj+uv7M8dTpz1nUu0e4/c4dRcjg8A8k/KehP2lWMIN1rdpOgU czyBiYaUfRENK8NuxesuIoqB/9W7YXIvZFsrV4MZ64wub/2QOcJcu4YWY bhrVQDT7Gt6BQywe4jie+O2lbiuz962foCy1NlmUcy2024JUFiCIfSdPc 0WaMTrvOwQg590sd5hppPsU6QIvLUiVVntLe2lh40EQ26IUjgYNGqoR0w HFpuH6PPRJY4sVN1cMPU0SbAdDL0WnISMP+NEO0jcBEmaxdoHxlc8PF4e A==; X-IronPort-AV: E=Sophos;i="5.60,527,1549900800"; d="scan'208";a="114299087" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 30 May 2019 05:16:38 +0800 IronPort-SDR: FHwHQ7X0CIWMgJJCzAC4KbI5yYFVDAb4jfjS1Wm0pQIekyZw1zXcKSN/f53H1eEL7QpOrCBRQl sScDrWWiNeOrfUrJS9Y2DVYNIuUG4KpLu2m92z5pV0xq9H1No4rFL3OF2q0xNIO/Gt7EV+OPPq atW95YC2EhF3XTgexJyTIR0xys9V4IMjcjjNctE7GXaXFp+P7W7l3bwQs3zKosLs+5CyEkadl9 k9Ma9yIRN06eHdvb9aCfKhBpsv6ynCxs/0jT6L4wo1x7bvzE6lQlSD5bSjE/NX1yCG6uybxBLU 6BdIuJR38limzh/W2k9D77Uf Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP; 29 May 2019 13:51:48 -0700 IronPort-SDR: BuJEcp7kpiVfH+44FML9Wz7261edwcWa349N3tzjS8K9ckVv1NEsLMReMStYKUXuAzA7EBBfq+ RSt2rSO4M91JdhcnpsONOcJa61Cu3xOHj0zVEwSQar1iiieDhUgyl/lL0JVGEOkgpi2TN5Wuhw 7MpMzkbrbsKz1AJvwNJggovpU+SfTQ3y2nA8zO4IGw/9kDxdYB0InSB0sn2oIbQmto8/AGeocn ahk0+S0pT06vDa5j3crtO0igUd4/6Q4DGvPWOtp5/XSrj4wYbHPf53pyDUOWFh6hfMOvi/hjwE QBw= 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 May 2019 14:16:38 -0700 From: Atish Patra To: linux-kernel@vger.kernel.org, Russell King Cc: Atish Patra , Sudeep Holla , Albert Ou , Anup Patel , Catalin Marinas , "David S. Miller" , devicetree@vger.kernel.org, Greg Kroah-Hartman , Ingo Molnar , Jeremy Linton , Linus Walleij , linux-riscv@lists.infradead.org, Mark Rutland , Mauro Carvalho Chehab , Morten Rasmussen , Otto Sabart , Palmer Dabbelt , Paul Walmsley , "Peter Zijlstra (Intel)" , "Rafael J. Wysocki" , Rob Herring , Thomas Gleixner , Will Deacon , linux-arm-kernel@lists.infradead.org Subject: [PATCH v6 5/7] RISC-V: Parse cpu topology during boot. Date: Wed, 29 May 2019 14:13:38 -0700 Message-Id: <20190529211340.17087-6-atish.patra@wdc.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190529211340.17087-1-atish.patra@wdc.com> References: <20190529211340.17087-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 --- 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 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