mbox series

[XEN,RFC,v2,00/12] dynamic node programming using overlay dtbo

Message ID 1636441347-133850-1-git-send-email-fnu.vikram@xilinx.com (mailing list archive)
Headers show
Series dynamic node programming using overlay dtbo | expand

Message

Vikram Garhwal Nov. 9, 2021, 7:02 a.m. UTC
Hi,
This RFC patch series is for introducing dynamic programming i.e. add/remove the
devices during run time. Using "xl overlay" a device can be added/removed with dtbo.

For adding a node using dynamic programming:
    1. flatten device tree overlay node will be added to a fdt
    2. Updated fdt will be unflattened to a new dt_host_new
    3. Extract the newly added node information from dt_host_new
    4. Add the added node under correct parent in original dt_host.
    3. Map interrupt and iomem region as required.

For removing a node:
    1. Find the node with given path.
    2. Check if the node is used by any of dom0 or domus. Removes the node
only when it's not used by any domain.
    3. Removes IRQ permissions and MMIO access.
    5. Find the node in dt_host and delete the device node entry from dt_host.
    6. Free the overlay_tracker entry which means free dt_host_new also(created
in adding node step).

Question: I am not sure how to enable CONFIG_OVERLAY_DTB in tool stack like the
way we do in xen using menuconfig or editing .config file. Would it be possible
for someone in tool stack expertise to guide me?

Reminder: This patch series has dependency on libfdt v1.6.1. A patch for libfdt
upgrade was already sent earlier with below subject:
    [XEN][PATCH v2 0/1] Update libfdt to v1.6.1

Change Log:
 v1 -> v2:
    Add support for multiple node addition/removal using dtbo.
    Replaced fpga-add and fpga-remove with one hypercall overlay_op.
    Moved common domain_build.c function to device.c
    Add OVERLAY_DTB configuration.
    Renamed overlay_get_target() to fdt_overlay_get_target().
    Split remove_device patch into two patches.
    Moved overlay_add/remove code to sysctl and changed it from domctl to sysctl.
    Added all overlay code under CONFIG_OVERLAY_DTB
    Renamed all tool domains fpga function to overlay
    Addressed code issues from v1 review.

Regards,
Vikram

Vikram Garhwal (12):
  device tree: Remove __init from function type
  xen: arm: Add CONFIG_OVERLAY_DTB
  libfdt: Keep fdt functions after init for CONFIG_OVERLAY_DTB.
  libfdt: Add fdt_ prefix to overlay_get_target()
  device tree: Add _dt_find_node_by_path() to find nodes in device tree
  xen/smmu: Add remove_device callback for smmu_iommu ops
  xen/smmu: Add remove_device callback for smmu_iommu ops
  xen/arm: Implement device tree node removal functionalities
  xen/arm: Implement device tree node addition functionalities
  tools/libs/ctrl: Implement new xc interfaces for dt overlay
  tools/libs/light: Implement new libxl functions for device tree
    overlay ops
  tools/xl: Add new xl command overlay

 tools/include/libxl.h                 |   5 +
 tools/include/xenctrl.h               |   5 +
 tools/libs/ctrl/Makefile              |   1 +
 tools/libs/ctrl/xc_overlay.c          |  51 +++
 tools/libs/light/Makefile             |   3 +
 tools/libs/light/libxl_overlay.c      |  65 ++++
 tools/xl/xl.h                         |   8 +
 tools/xl/xl_cmdtable.c                |   8 +
 tools/xl/xl_vmcontrol.c               |  47 +++
 xen/arch/arm/Kconfig                  |   8 +
 xen/arch/arm/device.c                 | 146 +++++++++
 xen/arch/arm/domain_build.c           | 150 ---------
 xen/common/device_tree.c              | 122 +++++++-
 xen/common/libfdt/Makefile            |   3 +
 xen/common/libfdt/fdt_overlay.c       |  12 +-
 xen/common/sysctl.c                   | 571 ++++++++++++++++++++++++++++++++++
 xen/drivers/passthrough/arm/smmu.c    |  54 ++++
 xen/drivers/passthrough/device_tree.c |  30 ++
 xen/include/asm-arm/domain_build.h    |  10 +
 xen/include/public/sysctl.h           |  23 ++
 xen/include/xen/device_tree.h         |  20 ++
 xen/include/xen/iommu.h               |   2 +
 xen/include/xen/libfdt/libfdt.h       |   3 +
 23 files changed, 1180 insertions(+), 167 deletions(-)
 create mode 100644 tools/libs/ctrl/xc_overlay.c
 create mode 100644 tools/libs/light/libxl_overlay.c