Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp80448img; Tue, 19 Mar 2019 18:24:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqz3b8m0Ak86I4+RXpXJNt3sVC2eUOZLRGxcvczkAotXrO5qdMwN5uNa4IX3l9TD8QvKFyap X-Received: by 2002:a17:902:112c:: with SMTP id d41mr5170655pla.177.1553045056027; Tue, 19 Mar 2019 18:24:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553045056; cv=none; d=google.com; s=arc-20160816; b=dxLXJKjiUJv8U6FxbalZNayZEzHAKyfSGgSQcMlVk46aqsuh1ayi/XI2CYRUMcgS9g oko8pUm9q5ky2BRIusYrgk5NtBsfacF7NtGBlUDAjWh+roXm6d8fpNhOqjwBAMJpeznW X2Y3JtsSO6brOqh7n6wvqNZCoE51d0b/P2p+loFhVKABjXZE9RWbvJ8q/nzeoZRK4VeF ockB7U9PYiyWzMRx7YMb9KNtyzCC9ca+snZH/TD5bQudWHct36LvD9mE+qSojnTDjcJQ JqO0N1dkmZ3C446+ZMldb9LUhACRh7XH0w4q64DXpGBVtJzC0lVKfH5cz0aI4fcBiYty kuQg== 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=eLdTE8Ct3EI+hiiuLn/2SFxS0jvmdYopZWCxdbJfZAs=; b=S+rethM/FLMcmTAdM83Ee8i02Y8ureMxMCUttVa2ZJmwz9YWqRpZx5w3DpBZWZL14N D+/ah5ty5YpgK/9Sd7OrsQDRx7+kEUC0m0ggu5ajMYR148cmcxKAaTrXhKVowxJ1NN8n uX9bg0k9wNly2gFWB+992KgIlewvPOS5FoMx5aVj4aaGz9z3RgBuLqJtv+EHVonyJpDS GcAFHQgG4BNECYfcwS3zb8WUSGUgKCedrQssm1hS5feJrXKcil3L+BTP6xGjS9tK+YA8 HFHTR9qfAzWDdg4A6KjsSm9j0yCZJdEWbqoeYXJTUGRAsYVUIEQpjGDE6DrF6w+j3UlG hcAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b="p/mmDdoj"; 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 10si411428pfi.183.2019.03.19.18.24.01; Tue, 19 Mar 2019 18:24:16 -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="p/mmDdoj"; 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 S1727522AbfCTBXT (ORCPT + 99 others); Tue, 19 Mar 2019 21:23:19 -0400 Received: from esa1.hgst.iphmx.com ([68.232.141.245]:58805 "EHLO esa1.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727362AbfCTBXM (ORCPT ); Tue, 19 Mar 2019 21:23:12 -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=1553044991; x=1584580991; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=s8sajK0+Y5Qxk3l9f3FRoReqL4ztyr9hMhYSgl8VlYs=; b=p/mmDdojvPDaxAT2GZoO/7X7qcbydkokC3wY4ZQhSjAs62yNY/vgXWzE M7pJvnIArF6GgEXoGm4ogDMl6xJMTid7u4klX2KlIa+EG8S24CDPoouju QVYNxZxd+tEuRqyJAIl+VzjtqyrScg1QtZNCo3BejGoGyw5K/OUFt+L+/ UFsFxK7tuDuu+zjwszklvXq/oGWmLrQD4ZkUh+6E8stMxebi0i93NYK96 ZAJzjQIkPnGY4IKoJdMr+7F6fAl9Fdstiz3OxZEhR8B1jvLSlWqGj8bMH aOLob8h/gGJk4G/Kvg7FOG4KHIVbk+OkKoQRF4VgGETS92UyCkE95/EXH Q==; X-IronPort-AV: E=Sophos;i="5.58,498,1544457600"; d="scan'208";a="209334033" 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; 20 Mar 2019 09:23:01 +0800 IronPort-SDR: ZSCjO78nagcTKoKZGF15Ft3F+6Vqpkkh+FMP28J69Ouki3QURLwHm8J4flo6ihGyH98itzmbIp AT466zEOPrT+tI2IF1BFJGT7C+6bWQcNmM7ilXkjSTTWkoNhJ2IA9o3VC1Ug3tWf4OVHeCs1ke qYig5nsvO5Mg3gBZAPCSqRwiE+XvqfW9+OTwSvhUScYPpge9MRqYYBng7r1a2GjPE7Mwm2Gd4O z+EfFhBBbygVuaktNquv/40dsntycpqNVpcJvKr8uFXRcYG7OZn2Z1MdvVHTBdM4/2WsHJGpdO CZs= Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP; 19 Mar 2019 18:02:39 -0700 IronPort-SDR: 7ewcJGwtdw1Bf+9Hx8qbkswK2bQ36UhDlgzsirbxYImQVPyGxNNSJ08RkKvFY5C56vHTnOHLK+ 0BFpINbW/yBhvuKyV+dc3ltHSxuu2PupuxExbrh9S1/cfGpJ98NMYQxiJ21g0KPoxZI31SOkun itoqAjWahzU2c5kgbwEy71+MG4c971MaZyTBaESpHrzVp+4tYPNat80yjSmkoVyMGiHKBXjKrq EQexS25nFe0rWbGhOl/pGyWsOpkW+dj2+rarvgGLoa9Ge8ryMlswwOL4x2kT3i7X1qXk5xl+NK iYY= 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; 19 Mar 2019 18:23:00 -0700 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 , 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 Subject: [RFT/RFC PATCH v2 4/4] RISC-V: Parse cpu topology during boot. Date: Tue, 19 Mar 2019 18:22:51 -0700 Message-Id: <20190320012251.2728-5-atish.patra@wdc.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190320012251.2728-1-atish.patra@wdc.com> References: <20190320012251.2728-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 eb56c82d..ac87a0ec 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 f41eb193..a8fe590c 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