Support per-device arguments and device factory reuse #1655
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Device arguments (or
sargs
) is a new feature introduced in #1522. It allows passing extrasargs
from CLI--device=factory[,sargs]
option down to MMIO device plugins.While the use case is definitely sound, previous implementation does not really support instantiating multiple devices from the same factory with different sets of arguments. Another limitation (of previous implementation), is that -- due to the injection of per-device
sargs
globally intodevice_factory_t
-- it prohibits device factory resue across multiplesim_t
instances.As proposed in #1652, we have created this PR to address the above limitations. The fix is three fold,
sargs
fromdevice_factory_t
, and introduced a new type aliasdevice_factory_sargs_t
to capture <device_factory_t *
,sargs
> pairs, this is used to instantiatesim_t
instances;device_factory_t::generate_fdt
/device_factory_t::parse_from_fdt
to take on an extrasargs
argument, for instantiating devices with per-device arguments;device_factory_t
const and potentially resuable across multiplesim_t
instances.