From patchwork Mon Jun 17 18:59:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Atish Patra X-Patchwork-Id: 11000237 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8443214DB for ; Mon, 17 Jun 2019 19:01:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 756BD289D7 for ; Mon, 17 Jun 2019 19:01:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 68DB3289DD; Mon, 17 Jun 2019 19:01:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D5C87289D7 for ; Mon, 17 Jun 2019 19:01:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=mAM9zKdZ+uMY2i0uava10h5udZmTMXLrlDAwsdc91Ng=; b=bwDw5rUU0OkPJO sh8qmjRBEYPQSzP69SBfRG9XgEIF9UAWUiX+0RqoUzow/3b1ADxOMCNJoFCuwBJ+6udt7cFe5f0T2 ICgbkZM6zgEbiNnq4icIBBJzP2qq/pIq3qIXNMMAPYvQooA+8cz1jzDKW23YB6UKc+25kZyspz/un qvtBdTBkv/QILMlCCNFY4MNr+FGiOi46opIcup3qDeCow2irYkKvYrn4/7vq6xdtQsUv37USyXsBM RaAjrT+vz5H7WwNJa5PwEggj2WCWXqYxUpMWhlfJeR7bMxjrOCTvzCPw64wqf9SbuSN66XN30KVV1 6G3R2XyModk5jn4//RwQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hcwso-000405-FI; Mon, 17 Jun 2019 19:01:34 +0000 Received: from esa3.hgst.iphmx.com ([216.71.153.141]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hcwrL-0001go-2k; Mon, 17 Jun 2019 19:00:06 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1560798004; x=1592334004; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=4gsxyypkDkZeEPMfmtQxEkRSX1iwXhYxZdPR6g9XGVc=; b=V4ArLp27qLF2YCUtVaOWMQWfT96Q78ju1cy2b5wG5VetcN/VoILtUXM2 KIC2lrvDfsSRAqBrYrwjpcqeSEvFY8XmJEeUmI9J8g9PgWUpq80RQjWY1 fWw/9czfD0MOalcZChF1XfH0lF3fNmoBzWr9aeB8lOJ6F8x22VM5pi+Hc C97cNfE5zkVziexXL5wjBNzUCS3xMveMRXXrMzCeJ4HAh48VVwKCDHNK5 3l1BmO6fsMfvMjYOIzcqBAHTizMBQ5sSEclyvxQ9mPWeZ1uhieLkXEqGI +T3C/RKG2QyeiiVeQCWEQbBey635W8UAa68ya8t1mbKMDOu7QhIoLoefT A==; X-IronPort-AV: E=Sophos;i="5.63,386,1557158400"; d="scan'208";a="115695371" 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; 18 Jun 2019 02:59:56 +0800 IronPort-SDR: Ud8on+IaMVIIUVjByxdNoKU18mrGM3M5wfD+he5Kio+keycg/cF8KClDFD8tdGNfPCrlU+8DZu cVT40pzz9fvcJ1BkSvTleMlggtGl8mXqZPe82e05FiIPylExDKrlsMUT2Q89C32/dTKp8IpMQU jR5cXs3XxXkxqi/GgTXe0I5bnJZciyoCM4WTP6xC0Cb3q7O/uUFfZXxy8gh434FHL+XQ8p2svp Rf7RTg4auNMwn23j6+zAvS6LZLhNEAIPGh+CQi4r2B6EFyXC4YbRa8cJsKITQ4dadSxsWyQWPd 8zHEdcsFwQ01mfdVIcLWrn0z Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP; 17 Jun 2019 11:59:26 -0700 IronPort-SDR: rf9zdZSYllUoDZSjIGKlJyFrk3+jHCW0uMuhJDcO3oUablZz06zS5vUYxDAc1e5wHt0RVBa1Yj vpJC9lvyV0577zFg84pDpuJ4wLIPPVz9YQY5yIAdeGL7rU3pOU80+hl6B4jfSVaHG3H8svdDMg ROnzXWVSVLq7HPYqWwNVwVHbXwHziHw5B0DydW3hbiCAT+C+dnKVqqthxRyUKywWtqHTgHB8bb lrs3Rjkz9SwyIjaR4F6FZyLZSlm0I1/K9xL+82zj/gud4kvW0R7yiaiLVQ/XaOzNxTMue+7nE/ /OQ= 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; 17 Jun 2019 11:59:54 -0700 From: Atish Patra To: linux-kernel@vger.kernel.org Subject: [PATCH v7 0/7] Unify CPU topology across ARM & RISC-V Date: Mon, 17 Jun 2019 11:59:13 -0700 Message-Id: <20190617185920.29581-1-atish.patra@wdc.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190617_120003_253062_5199DE73 X-CRM114-Status: GOOD ( 17.50 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , "Rafael J. Wysocki" , "Peter Zijlstra \(Intel\)" , Catalin Marinas , Linus Walleij , Palmer Dabbelt , Will Deacon , Richard Fontana , Mauro Carvalho Chehab , linux-riscv@lists.infradead.org, Ingo Molnar , Anup Patel , Russell King , Morten Rasmussen , devicetree@vger.kernel.org, Albert Ou , Rob Herring , Paul Walmsley , Jonathan Cameron , Thomas Gleixner , linux-arm-kernel@lists.infradead.org, Atish Patra , Greg Kroah-Hartman , Jeremy Linton , Otto Sabart , Sudeep Holla , "David S. Miller" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The cpu-map DT entry in ARM can describe the CPU topology in much better way compared to other existing approaches. RISC-V can easily adopt this binding to represent its own CPU topology. Thus, both cpu-map DT binding and topology parsing code can be moved to a common location so that RISC-V or any other architecture can leverage that. The relevant discussion regarding unifying cpu topology can be found in [1]. arch_topology seems to be a perfect place to move the common code. I have not introduced any significant functional changes in the moved code. The only downside in this approach is that the capacity code will be executed for RISC-V as well. But, it will exit immediately after not able to find the appropriate DT node. If the overhead is considered too much, we can always compile out capacity related functions under a different config for the architectures that do not support them. There was an opportunity to unify topology data structure for ARM32 done by patch 3/4. But, I refrained from making any other changes as I am not very well versed with original intention for some functions that are present in arch_topology.c. I hope this patch series can be served as a baseline for such changes in the future. The patches have been tested for RISC-V and compile tested for ARM64, ARM32 & x86. From Jeremy, "I applied these to 5.2rc2, along with my PPTT/MT change and verified the system & scheduler topology/etc on DAWN and ThunderX2 using ACPI on arm64. They appear to be working correctly. so for the series, Tested-by: Jeremy Linton " The socket change[2] is also now part of this series. [1] https://lkml.org/lkml/2018/11/6/19 [2] https://lkml.org/lkml/2018/11/7/918 QEMU changes for RISC-V topology are available at https://github.com/atishp04/qemu/tree/riscv_topology_dt HiFive Unleashed DT with topology node is available here. https://github.com/atishp04/opensbi/tree/HiFive_unleashed_topology It can be verified with OpenSBI with following additional compile time option. FW_PAYLOAD_FDT="unleashed_topology.dtb" Changes from v6->v7 1. Added socket to HiFive Unleashed topology example. 2. Added Acked-by & Reviewed-by. Changes from v5->v6 1. Added two more patches from Sudeep about maintainership of arch_topology.c and Kconfig update. 2. Added Tested-by & Reviewed-by 3. Fixed a nit (reordering of variables) Changes from v4-v5 1. Removed the arch_topology.h header inclusion from topology.c and arch_topology.c file. Added it in linux/topology.h. 2. core_id is set to -1 upon reset. Otherwise, ARM topology store function does not work. Changes from v3->v4 1. Get rid of ARM32 specific information in topology structure. 2. Remove redundant functions from ARM32 and use common code instead. Changes from v2->v3 1. Cover letter update with experiment DT for topology changes. 2. Added the patch for [2]. Changes from v1->v2 1. ARM32 can now use the common code as well. Atish Patra (4): dt-binding: cpu-topology: Move cpu-map to a common binding. cpu-topology: Move cpu topology code to common code. arm: Use common cpu_topology structure and functions. RISC-V: Parse cpu topology during boot. Sudeep Holla (3): Documentation: DT: arm: add support for sockets defining package boundaries base: arch_topology: update Kconfig help description MAINTAINERS: Add an entry for generic architecture topology .../topology.txt => cpu/cpu-topology.txt} | 136 ++++++-- MAINTAINERS | 7 + arch/arm/include/asm/topology.h | 20 -- arch/arm/kernel/topology.c | 60 +--- arch/arm64/include/asm/topology.h | 23 -- arch/arm64/kernel/topology.c | 303 +----------------- arch/riscv/Kconfig | 1 + arch/riscv/kernel/smpboot.c | 3 + drivers/base/Kconfig | 2 +- drivers/base/arch_topology.c | 298 +++++++++++++++++ include/linux/arch_topology.h | 26 ++ include/linux/topology.h | 1 + 12 files changed, 454 insertions(+), 426 deletions(-) rename Documentation/devicetree/bindings/{arm/topology.txt => cpu/cpu-topology.txt} (66%) --- 2.21.0