> On 8 Mar 2022, at 19:47, Vikram Garhwal <fnu.vik...@xilinx.com> wrote:
> 
> Signed-off-by: Vikram Garhwal <fnu.vik...@xilinx.com>
> ---
> tools/xl/xl.h           |  4 ++++
> tools/xl/xl_cmdtable.c  |  6 ++++++
> tools/xl/xl_vmcontrol.c | 45 +++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 55 insertions(+)
> 
> diff --git a/tools/xl/xl.h b/tools/xl/xl.h
> index c5c4bedbdd..604fd5bb94 100644
> --- a/tools/xl/xl.h
> +++ b/tools/xl/xl.h
> @@ -97,6 +97,9 @@ struct save_file_header {
> 
> #define SAVEFILE_BYTEORDER_VALUE ((uint32_t)0x01020304UL)
> 
> +#define XL_DT_OVERLAY_ADD                   1
> +#define XL_DT_OVERLAY_REMOVE                2

Maybe you can get rid of them and ...

> +
> void save_domain_core_begin(uint32_t domid,
>                             int preserve_domid,
>                             const char *override_config_file,
> @@ -139,6 +142,7 @@ int main_shutdown(int argc, char **argv);
> int main_reboot(int argc, char **argv);
> int main_list(int argc, char **argv);
> int main_vm_list(int argc, char **argv);
> +int main_dt_overlay(int argc, char **argv);
> int main_create(int argc, char **argv);
> int main_config_update(int argc, char **argv);
> int main_button_press(int argc, char **argv);
> diff --git a/tools/xl/xl_cmdtable.c b/tools/xl/xl_cmdtable.c
> index 661323d488..5812d19db8 100644
> --- a/tools/xl/xl_cmdtable.c
> +++ b/tools/xl/xl_cmdtable.c
> @@ -20,6 +20,12 @@
> #include "xl.h"
> 
> const struct cmd_spec cmd_table[] = {
> +    { "overlay",
> +      &main_dt_overlay, 1, 1,
> +      "Add/Remove a device tree overlay",
> +      "add/remove <.dtbo>"
> +      "-h print this help\n"
> +    },
>     { "create",
>       &main_create, 1, 1,
>       "Create a domain from config file <filename>",
> diff --git a/tools/xl/xl_vmcontrol.c b/tools/xl/xl_vmcontrol.c
> index 435155a033..76b969dc33 100644
> --- a/tools/xl/xl_vmcontrol.c
> +++ b/tools/xl/xl_vmcontrol.c
> @@ -1262,6 +1262,51 @@ int main_create(int argc, char **argv)
>     return 0;
> }
> 
> +int main_dt_overlay(int argc, char **argv)
> +{
> +    const char *overlay_ops = argv[1];
> +    const char *overlay_config_file = argv[2];
> +    void *overlay_dtb = NULL;
> +    int rc;
> +    uint8_t op;
> +    int overlay_dtb_size = 0;
> +
> +    if (overlay_ops == NULL) {
> +        fprintf(stderr, "No overlay operation mode provided\n");
> +        return ERROR_FAIL;
> +    }
> +
> +    if (strcmp(overlay_ops, "add") == 0)
> +        op = XL_DT_OVERLAY_ADD;
> +    else if (strcmp(overlay_ops, "remove") == 0)
> +        op = XL_DT_OVERLAY_REMOVE;

Use them there, maybe defining const int <name> = <value>

Since these values are only used there



Reply via email to