From patchwork Thu Sep 19 02:33:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amitay Isaacs X-Patchwork-Id: 1164323 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46YgsG6Rm9z9sPK for ; Thu, 19 Sep 2019 12:34:10 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=ozlabs.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.b="Q2NjvRTN"; dkim-atps=neutral Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 46YgsF4rszzF35d for ; Thu, 19 Sep 2019 12:34:09 +1000 (AEST) X-Original-To: pdbg@lists.ozlabs.org Delivered-To: pdbg@lists.ozlabs.org Received: from ozlabs.org (bilbo.ozlabs.org [IPv6:2401:3900:2:1::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 46Ygrm5dwPzDsFV for ; Thu, 19 Sep 2019 12:33:44 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=ozlabs.org Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.b="Q2NjvRTN"; dkim-atps=neutral Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 46Ygrl6rNnz9sNF; Thu, 19 Sep 2019 12:33:43 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ozlabs.org; s=201707; t=1568860424; bh=whZ2JbXX+eti2mYF741Y3HD9CQgTnEokBuzgfibYplQ=; h=From:To:Cc:Subject:Date:From; b=Q2NjvRTNUeCdVm+P+PJPw9Fr8qHF0XVOpRG2EWYX+wMSmsycV25QCmTUmdS/WgMFY iBWCSsVfWgVTj3wAsQSGBY3SQk7Qvnt8UfDb/EWijkpqBo5ryu4hw5x38iuPpqOl4Z 8+RVAcs7oE9P0lcC7lS5cK5NfsFcoAb4Ps3uzRwdx9KEPTfN1GPA12A7b9C/U7lAn5 69H/E+tFZYizJ6SmhvuDGzFaDW/pcllQPvSBZR0xFzoXvvw7PlP5jlcwDbE7JuuBK5 gTL/IP2/lrH60jTp79CBbcxuqKknZwomnkwtoISc+2MWlhIHCLmsI1Z/nX42Z1tpkK 48oGXXWu2fX8g== From: Amitay Isaacs To: pdbg@lists.ozlabs.org Date: Thu, 19 Sep 2019 12:33:10 +1000 Message-Id: <20190919023333.5295-1-amitay@ozlabs.org> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Subject: [Pdbg] [PATCH 00/23] Add system device tree to libpdbg X-BeenThere: pdbg@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "mailing list for https://github.com/open-power/pdbg development" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Amitay Isaacs Errors-To: pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Pdbg" In the current design of libpdbg, there are multiple device trees for a system depending on the backend. This means the same hardware unit is represented with different device tree paths based on the backend. It's a problem when trying to assign certain properties to hardware units in a backend agnostic fashion. These patches introduce a system device tree (view) which is overlaid on top of the backend device trees using virtual nodes. The virtual nodes are specified using "device-tree-path" property (denoting the attachment point in the system device tree view) or by adding nodes to backend device tree without "compatible" property. Amitay Isaacs (23): libpdbg: class name and name should be const libpdbg: Drop const from pdbg_target_path() argument libpdbg: Rename function to reflect the functionality libpdbg: Add virtual node target libpdbg: Support paths including virutal nodes libpdbg: Construct unique path based on virtual nodes libpdbg: Create virtual nodes based on device-tree-path property libpdbg: Child traversal should not include virtual nodes libpdbg: Parent retrieval should skip over virtual nodes libpdbg: Use pdbg api to get parent libpdbg: Probe should traverse all nodes main: Use dn_name for printing virtual nodes fake: Add virtual nodes for pib targets tests: Add device tree traversal tests libpdbg: Pass root node to dt_expand libpdbg: Drop argument from pdbg_targets_init() libpdbg: Make pdbg_set_backend() return boolean libpdbg: Do not make pdbg_default_dtb public libpdbg: Add a structure to hold fdt pointer libpdbg: Add parsing of backend device tree dts: Split P8 device trees into system and backend trees dts: Split P9 device trees into system and backend trees libpdbg: Separate backend and system device trees Makefile.am | 13 +- fake.dts.m4 | 53 +++--- libpdbg/cfam.c | 2 +- libpdbg/device.c | 132 ++++++++++++--- libpdbg/dtb.c | 221 ++++++++++++++++--------- libpdbg/libpdbg.c | 78 +++++++-- libpdbg/libpdbg.h | 17 +- libpdbg/target.c | 20 ++- libpdbg/target.h | 7 + p8-cronus.dts.m4 | 64 +++----- p8-fsi.dts.m4 | 9 +- p8-host.dts.m4 | 2 +- p8-i2c.dts.m4 | 8 +- p8-kernel.dts.m4 | 7 +- p8-pib.dts.m4 | 1 + p8.dts.m4 | 55 +++++++ p9-cronus.dts.m4 | 50 ++---- p9-fsi.dtsi.m4 | 7 +- p9-host.dts.m4 | 4 +- p9-kernel.dts.m4 | 13 +- p9-pib.dts.m4 | 5 + p9.dts.m4 | 27 ++++ src/main.c | 16 +- src/scom.c | 2 +- src/tests/libpdbg_dtree_test.c | 85 ++++++++++ src/tests/libpdbg_probe_test.c | 12 +- src/tests/libpdbg_target_test.c | 14 +- tests/test_selection.sh | 98 +++++++++-- tests/test_selection2.sh | 178 ++++++++++++++++++-- tests/test_tree.sh | 278 ++++++++++++++++++++++++++++++++ 30 files changed, 1179 insertions(+), 299 deletions(-) create mode 100644 p8.dts.m4 create mode 100644 p9.dts.m4 create mode 100644 src/tests/libpdbg_dtree_test.c create mode 100755 tests/test_tree.sh