[Pdbg] [PATCH v4 00/30] Add system device tree to libpdbg

Amitay Isaacs amitay at ozlabs.org
Thu Oct 3 14:18:39 AEST 2019


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 "system-path" property (denoting the attachment
point in the system device tree view) or by adding nodes to backend
device tree without "compatible" property.

V2 changes:
 - Fix dt_find_by_path()
 - Rename argument virtual to system (avoid using reserved keywords)
 - Fix __pdbg_next_targe() by adding system flag
 - Fix pdbg_target_probe()
 - Add more tests for probe, child traverse, parent traverse
 - Do not drop argument to pdbg_targets_init()

V3 changes:
 - Refactor dt_link_virtual()
 - Simplify pdbg_targets_init_virtual()
 - Add comments to child/parent traverse routines
 - Rename pdbg_target_match_next() -> target_map_child()
 - Move get_parent() to libpdbg.c
 - Add more tree tests
 - Fix copy-paste errors in dtb.c

V4 change:
 - add convenience functions target_is_virtual(), target_to_real(),
   target_to_virtual() to improve readability
 - Fix traverse routines to correctly handle different system tree layout
   (Thanks to Rashmica for testing)
 - Add additional possible fake device tree layout and tests


Amitay Isaacs (30):
  libpdbg: Do not assume device tree hierarchy
  libpdbg: Drop unused function require_target_parent
  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: Add a function to check if a target is virtual
  libpdbg: Add a function to map virtual target to real
  libpdbg: Add a function to map real target to virtual
  libpdbg: Support paths including virtual nodes
  libpdbg: Construct unique path based on virtual nodes
  libpdbg: Create virtual nodes based on system-path property
  libpdbg: Child traversal should handle virtual nodes correctly
  libpdbg: Parent retrieval should handle virtual nodes correctly
  libpdbg: Add functions to get parent in backend or system tree
  libpdbg: Probe should traverse virtual nodes also
  main: Use dn_name for printing virtual nodes
  main: Avoid printing top level "proc" if no child is enabled
  fake: Add virtual nodes for pib targets
  fake: Add additional device tree for testing
  tests: Add device tree traversal tests
  libpdbg: Pass root node to dt_expand
  libpdbg: Return status 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                     |  19 +-
 fake.dts.m4                     |  68 +++---
 fake2.dts.m4                    | 108 +++++++++
 libpdbg/cfam.c                  |   4 +-
 libpdbg/device.c                | 167 ++++++++++++--
 libpdbg/dtb.c                   | 236 ++++++++++++-------
 libpdbg/libpdbg.c               | 164 ++++++++++++--
 libpdbg/libpdbg.h               |  27 ++-
 libpdbg/p9chip.c                |   4 +-
 libpdbg/target.c                |  39 +++-
 libpdbg/target.h                |  14 +-
 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                      |  34 ++-
 src/scom.c                      |   2 +-
 src/tests/libpdbg_dtree_test.c  | 117 ++++++++++
 src/tests/libpdbg_probe_test.c  |  25 +-
 src/tests/libpdbg_target_test.c |  54 +++--
 src/thread.c                    |   4 +-
 tests/test_selection.sh         |  98 +++++++-
 tests/test_selection2.sh        | 178 +++++++++++++--
 tests/test_tree.sh              | 387 +++++++++++++++++++++++++++++++
 tests/test_tree2.sh             | 389 ++++++++++++++++++++++++++++++++
 34 files changed, 2050 insertions(+), 340 deletions(-)
 create mode 100644 fake2.dts.m4
 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
 create mode 100755 tests/test_tree2.sh

-- 
2.21.0



More information about the Pdbg mailing list