Skip to content

Feature request: Add --dtb-discovery flag for direct DTB device discovery #2154

@FrancescoScappatura-Ax

Description

@FrancescoScappatura-Ax

Feature Request: Add --dtb-discovery flag for direct DTB device discovery

Description

I'd like to propose adding a --dtb-discovery flag that enables direct device discovery from the device tree blob (DTB), allowing Spike to automatically instantiate devices defined in the DTB without requiring individual --device flags for each instance.

Motivation

Currently, when working with multiple instances of the same device type or with a relevant number of devices in general, each instance must be specified separately via --device flags:

spike --device=counter,0x30000000,0x1000 \
      --device=counter,0x30001000,0x1000 \
      --device=counter,0x30002000,0x1000 \
      ...

This becomes cumbersome with many devices. A DTB-based approach would be IMHO cleaner:

counter@30000000 { 
  compatible = "counter";
  reg = <0x0 0x30000000 0x0 0x1000>;
  spike,plugin-params = "0x30000000,0x1000";
};
counter@30001000 { 
  compatible = "counter";
  reg = <0x0 0x30001000 0x0 0x1000>;
  spike,plugin-params = "0x30001000,0x1000";
};
spike --dtb=system.dtb --dtb-direct fw_payload.elf

Proposed Behavior

  • --dtb-direct: Enable direct device discovery from DTB
  • Requires --dtb to be specified
  • Incompatible with --device (conflicting specification methods)
  • Spike would scan the DTB and instantiate devices based on their compatible properties
  • Custom plugin parameters can be passed via spike_plugin_params property in the device tree node, which would be parsed and passed to the plugin's initialization function

Questions

  • Does this feature make sense for Spike's architecture?
  • Are there any concerns or edge cases I'm missing?
  • If this seems reasonable, I'd be happy to work on implementing it and submit a PR

Thank you for considering this request!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions