mbox series

[XEN,RFC,00/13] Add Support for dynamic Programming

Message ID 1630562763-390068-1-git-send-email-fnu.vikram@xilinx.com (mailing list archive)
Headers show
Series Add Support for dynamic Programming | expand

Message

Vikram Garhwal Sept. 2, 2021, 6:05 a.m. UTC
Hi,
This RFC patch series is for introducing dynamic programming i.e. add/remove the
devices during run time. Using "xl fpga-add" a device can be added with dtbo.

fdt_overlay.c file is taken from Linux and other existing fdt files are modified
to accommodate the fdt_overlay. The changes w.r.t. existing fdt are kept minimal
i.e. only the required library file/functions from Linux fdt are pulled in.

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).

fpga-add and fpga-del are probably not the best names for these commands. This
was done initially for xilinx FPGA programmable logic block dynamic programming.
I am okay with replacing fpga-add and fpga-del with better names if there are
any suggestions.

Regards,
Vikram

Vikram Garhwal (13):
  device tree: Remove __init from function type
  libfdt: Keep fdt functions after init.
  libfdt: import fdt_overlay from Linux
  libfdt: Copy required libfdt functions from Linux
  libfdt: Change overlay_get_target() type
  device tree: Add dt_print_node_names()
  device tree: Add _dt_find_node_by_path() to find nodes in device tree
  xen/iommu: Introduce iommu_remove_dt_devices function
  xen/arm: Implement device tree node removal functionalities
  xen/arm: Implement device tree node addition functionalities
  tools/libs/ctrl: Implement new xc interfaces for fpga-add and fpga-del
  tools/libs/light: Implement new libxl functions for fpga-add and
    fpga-del
  tools/xl: Add new xl commands fpga-add and fpga-del

 tools/include/libxl.h                 |   5 +
 tools/include/xenctrl.h               |   4 +
 tools/libs/ctrl/Makefile              |   1 +
 tools/libs/ctrl/xc_fpga.c             |  82 ++++
 tools/libs/light/Makefile             |   1 +
 tools/libs/light/libxl_fpga.c         |  73 +++
 tools/xl/xl.h                         |   2 +
 tools/xl/xl_cmdtable.c                |  12 +
 tools/xl/xl_vmcontrol.c               |  51 ++
 xen/arch/arm/Makefile                 |   2 +-
 xen/arch/arm/domain_build.c           |  15 +-
 xen/arch/arm/domctl.c                 | 445 +++++++++++++++++
 xen/common/device_tree.c              | 143 +++++-
 xen/common/libfdt/Makefile            |   1 -
 xen/common/libfdt/Makefile.libfdt     |   2 +-
 xen/common/libfdt/fdt.c               |  35 ++
 xen/common/libfdt/fdt_overlay.c       | 884 ++++++++++++++++++++++++++++++++++
 xen/common/libfdt/fdt_ro.c            |  52 +-
 xen/common/libfdt/fdt_rw.c            |  81 +++-
 xen/common/libfdt/fdt_wip.c           |  20 +
 xen/common/libfdt/libfdt_internal.h   | 130 +++++
 xen/drivers/passthrough/arm/smmu.c    |  53 ++
 xen/drivers/passthrough/device_tree.c |  30 ++
 xen/include/asm-arm/domain_build.h    |  10 +
 xen/include/public/domctl.h           |  16 +
 xen/include/xen/device_tree.h         |  21 +
 xen/include/xen/iommu.h               |   2 +
 xen/include/xen/libfdt/libfdt.h       | 232 ++++++++-
 28 files changed, 2363 insertions(+), 42 deletions(-)
 create mode 100644 tools/libs/ctrl/xc_fpga.c
 create mode 100644 tools/libs/light/libxl_fpga.c
 create mode 100644 xen/common/libfdt/fdt_overlay.c