diff mbox series

[RFC,v1,4/5] tools/arm: add "scmi_smc" option to xl.cfg

Message ID 7aa3e21a3285b3af92ad87a4b039b4bd7696ac88.1639472078.git.oleksii_moisieiev@epam.com (mailing list archive)
State Superseded
Headers show
Series Introduce SCI-mediator feature | expand

Commit Message

Oleksii Moisieiev Dec. 14, 2021, 9:34 a.m. UTC
This enumeration sets SCI type for the domain. Currently there is
two possible options: either 'none' or 'scmi_smc'.

'none' is the default value and it disables SCI support at all.

'scmi_smc' enables access to the Firmware from the domains using SCMI
protocol and SMC as transport.

Signed-off-by: Oleksii Moisieiev <oleksii_moisieiev@epam.com>
---
 docs/man/xl.cfg.5.pod.in         | 22 ++++++++++++++++++++++
 tools/include/libxl.h            |  5 +++++
 tools/libs/light/libxl_types.idl |  6 ++++++
 tools/xl/xl_parse.c              |  9 +++++++++
 4 files changed, 42 insertions(+)

Comments

Oleksandr Tyshchenko Dec. 15, 2021, 9:51 p.m. UTC | #1
On 14.12.21 11:34, Oleksii Moisieiev wrote:


Hi Oleksii

> This enumeration sets SCI type for the domain. Currently there is
> two possible options: either 'none' or 'scmi_smc'.
>
> 'none' is the default value and it disables SCI support at all.
>
> 'scmi_smc' enables access to the Firmware from the domains using SCMI
> protocol and SMC as transport.
>
> Signed-off-by: Oleksii Moisieiev <oleksii_moisieiev@epam.com>
> ---
>   docs/man/xl.cfg.5.pod.in         | 22 ++++++++++++++++++++++
>   tools/include/libxl.h            |  5 +++++
>   tools/libs/light/libxl_types.idl |  6 ++++++
>   tools/xl/xl_parse.c              |  9 +++++++++
>   4 files changed, 42 insertions(+)
>
> diff --git a/docs/man/xl.cfg.5.pod.in b/docs/man/xl.cfg.5.pod.in
> index b98d161398..92d0593875 100644
> --- a/docs/man/xl.cfg.5.pod.in
> +++ b/docs/man/xl.cfg.5.pod.in
> @@ -1614,6 +1614,28 @@ This feature is a B<technology preview>.
>   
>   =back
>   
> +=item B<sci="STRING">
> +
> +B<Arm only> Set SCI type for the guest. SCI is System Control Protocol -
> +allows domain to manage various functions that are provided by HW platform.
> +
> +=over 4
> +
> +=item B<none>
> +
> +Don't allow guest to use SCI if present on the platform. This is the default
> +value.
> +
> +=item B<scmi_smc>
> +
> +Enables SCMI-SMC support for the guest. SCMI is System Control Management
> +Inferface - allows domain to manage various functions that are provided by HW
> +platform, such as clocks, resets and power-domains. Xen will mediate access to
> +clocks, power-domains and resets between Domains and ATF. Disabled by default.
> +SMC is used as transport.
> +
> +=back
> +
>   =back
>   
>   =head2 Paravirtualised (PV) Guest Specific Options
> diff --git a/tools/include/libxl.h b/tools/include/libxl.h
> index 2bbbd21f0b..30e5aee119 100644
> --- a/tools/include/libxl.h
> +++ b/tools/include/libxl.h
> @@ -278,6 +278,11 @@
>    */
>   #define LIBXL_HAVE_BUILDINFO_ARCH_ARM_TEE 1
>   
> +/*
> + * libxl_domain_build_info has the arch_arm.sci field.
> + */
> +#define LIBXL_HAVE_BUILDINFO_ARCH_ARM_SCI 1
> +
>   /*
>    * LIBXL_HAVE_SOFT_RESET indicates that libxl supports performing
>    * 'soft reset' for domains and there is 'soft_reset' shutdown reason
> diff --git a/tools/libs/light/libxl_types.idl b/tools/libs/light/libxl_types.idl
> index 2a42da2f7d..9067b509f4 100644
> --- a/tools/libs/light/libxl_types.idl
> +++ b/tools/libs/light/libxl_types.idl

I assume that at least goland bindings want updating.


> @@ -480,6 +480,11 @@ libxl_tee_type = Enumeration("tee_type", [
>       (1, "optee")
>       ], init_val = "LIBXL_TEE_TYPE_NONE")
>   
> +libxl_sci_type = Enumeration("sci_type", [
> +    (0, "none"),
> +    (1, "scmi_smc")
> +    ], init_val = "LIBXL_SCI_TYPE_NONE")
> +
>   libxl_rdm_reserve = Struct("rdm_reserve", [
>       ("strategy",    libxl_rdm_reserve_strategy),
>       ("policy",      libxl_rdm_reserve_policy),
> @@ -564,6 +569,7 @@ libxl_domain_build_info = Struct("domain_build_info",[
>       ("apic",             libxl_defbool),
>       ("dm_restrict",      libxl_defbool),
>       ("tee",              libxl_tee_type),
> +    ("sci",              libxl_sci_type),
>       ("u", KeyedUnion(None, libxl_domain_type, "type",
>                   [("hvm", Struct(None, [("firmware",         string),
>                                          ("bios",             libxl_bios_type),
> diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c
> index 117fcdcb2b..c37bf6298b 100644
> --- a/tools/xl/xl_parse.c
> +++ b/tools/xl/xl_parse.c
> @@ -2747,6 +2747,15 @@ skip_usbdev:
>           }
>       }
>   
> +    if (!xlu_cfg_get_string (config, "sci", &buf, 1)) {
> +        e = libxl_sci_type_from_string(buf, &b_info->sci);
> +        if (e) {
> +            fprintf(stderr,
> +                    "Unknown sci \"%s\" specified\n", buf);
> +            exit(-ERROR_FAIL);
> +        }
> +    }
> +
>       parse_vkb_list(config, d_config);
>   
>       xlu_cfg_get_defbool(config, "xend_suspend_evtchn_compat",
Oleksii Moisieiev Dec. 17, 2021, 11 a.m. UTC | #2
Hi Oleksandr,

On Wed, Dec 15, 2021 at 11:51:01PM +0200, Oleksandr wrote:
> 
> On 14.12.21 11:34, Oleksii Moisieiev wrote:
> 
> 
> Hi Oleksii
> 
> > This enumeration sets SCI type for the domain. Currently there is
> > two possible options: either 'none' or 'scmi_smc'.
> > 
> > 'none' is the default value and it disables SCI support at all.
> > 
> > 'scmi_smc' enables access to the Firmware from the domains using SCMI
> > protocol and SMC as transport.
> > 
> > Signed-off-by: Oleksii Moisieiev <oleksii_moisieiev@epam.com>
> > ---
> >   docs/man/xl.cfg.5.pod.in         | 22 ++++++++++++++++++++++
> >   tools/include/libxl.h            |  5 +++++
> >   tools/libs/light/libxl_types.idl |  6 ++++++
> >   tools/xl/xl_parse.c              |  9 +++++++++
> >   4 files changed, 42 insertions(+)
> > 
> > diff --git a/docs/man/xl.cfg.5.pod.in b/docs/man/xl.cfg.5.pod.in
> > index b98d161398..92d0593875 100644
> > --- a/docs/man/xl.cfg.5.pod.in
> > +++ b/docs/man/xl.cfg.5.pod.in
> > @@ -1614,6 +1614,28 @@ This feature is a B<technology preview>.
> >   =back
> > +=item B<sci="STRING">
> > +
> > +B<Arm only> Set SCI type for the guest. SCI is System Control Protocol -
> > +allows domain to manage various functions that are provided by HW platform.
> > +
> > +=over 4
> > +
> > +=item B<none>
> > +
> > +Don't allow guest to use SCI if present on the platform. This is the default
> > +value.
> > +
> > +=item B<scmi_smc>
> > +
> > +Enables SCMI-SMC support for the guest. SCMI is System Control Management
> > +Inferface - allows domain to manage various functions that are provided by HW
> > +platform, such as clocks, resets and power-domains. Xen will mediate access to
> > +clocks, power-domains and resets between Domains and ATF. Disabled by default.
> > +SMC is used as transport.
> > +
> > +=back
> > +
> >   =back
> >   =head2 Paravirtualised (PV) Guest Specific Options
> > diff --git a/tools/include/libxl.h b/tools/include/libxl.h
> > index 2bbbd21f0b..30e5aee119 100644
> > --- a/tools/include/libxl.h
> > +++ b/tools/include/libxl.h
> > @@ -278,6 +278,11 @@
> >    */
> >   #define LIBXL_HAVE_BUILDINFO_ARCH_ARM_TEE 1
> > +/*
> > + * libxl_domain_build_info has the arch_arm.sci field.
> > + */
> > +#define LIBXL_HAVE_BUILDINFO_ARCH_ARM_SCI 1
> > +
> >   /*
> >    * LIBXL_HAVE_SOFT_RESET indicates that libxl supports performing
> >    * 'soft reset' for domains and there is 'soft_reset' shutdown reason
> > diff --git a/tools/libs/light/libxl_types.idl b/tools/libs/light/libxl_types.idl
> > index 2a42da2f7d..9067b509f4 100644
> > --- a/tools/libs/light/libxl_types.idl
> > +++ b/tools/libs/light/libxl_types.idl
> 
> I assume that at least goland bindings want updating.
> 

Thanks for the notice. I will fix that in v2.

> 
> > @@ -480,6 +480,11 @@ libxl_tee_type = Enumeration("tee_type", [
> >       (1, "optee")
> >       ], init_val = "LIBXL_TEE_TYPE_NONE")
> > +libxl_sci_type = Enumeration("sci_type", [
> > +    (0, "none"),
> > +    (1, "scmi_smc")
> > +    ], init_val = "LIBXL_SCI_TYPE_NONE")
> > +
> >   libxl_rdm_reserve = Struct("rdm_reserve", [
> >       ("strategy",    libxl_rdm_reserve_strategy),
> >       ("policy",      libxl_rdm_reserve_policy),
> > @@ -564,6 +569,7 @@ libxl_domain_build_info = Struct("domain_build_info",[
> >       ("apic",             libxl_defbool),
> >       ("dm_restrict",      libxl_defbool),
> >       ("tee",              libxl_tee_type),
> > +    ("sci",              libxl_sci_type),
> >       ("u", KeyedUnion(None, libxl_domain_type, "type",
> >                   [("hvm", Struct(None, [("firmware",         string),
> >                                          ("bios",             libxl_bios_type),
> > diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c
> > index 117fcdcb2b..c37bf6298b 100644
> > --- a/tools/xl/xl_parse.c
> > +++ b/tools/xl/xl_parse.c
> > @@ -2747,6 +2747,15 @@ skip_usbdev:
> >           }
> >       }
> > +    if (!xlu_cfg_get_string (config, "sci", &buf, 1)) {
> > +        e = libxl_sci_type_from_string(buf, &b_info->sci);
> > +        if (e) {
> > +            fprintf(stderr,
> > +                    "Unknown sci \"%s\" specified\n", buf);
> > +            exit(-ERROR_FAIL);
> > +        }
> > +    }
> > +
> >       parse_vkb_list(config, d_config);
> >       xlu_cfg_get_defbool(config, "xend_suspend_evtchn_compat",
> 
> -- 
> Regards,
> 
> Oleksandr Tyshchenko
>
Stefano Stabellini Dec. 21, 2021, 12:54 a.m. UTC | #3
On Tue, 14 Dec 2021, Oleksii Moisieiev wrote:
> This enumeration sets SCI type for the domain. Currently there is
> two possible options: either 'none' or 'scmi_smc'.
> 
> 'none' is the default value and it disables SCI support at all.
> 
> 'scmi_smc' enables access to the Firmware from the domains using SCMI
> protocol and SMC as transport.
> 
> Signed-off-by: Oleksii Moisieiev <oleksii_moisieiev@epam.com>
> ---
>  docs/man/xl.cfg.5.pod.in         | 22 ++++++++++++++++++++++
>  tools/include/libxl.h            |  5 +++++
>  tools/libs/light/libxl_types.idl |  6 ++++++
>  tools/xl/xl_parse.c              |  9 +++++++++
>  4 files changed, 42 insertions(+)
> 
> diff --git a/docs/man/xl.cfg.5.pod.in b/docs/man/xl.cfg.5.pod.in
> index b98d161398..92d0593875 100644
> --- a/docs/man/xl.cfg.5.pod.in
> +++ b/docs/man/xl.cfg.5.pod.in
> @@ -1614,6 +1614,28 @@ This feature is a B<technology preview>.
>  
>  =back
>  
> +=item B<sci="STRING">
> +
> +B<Arm only> Set SCI type for the guest. SCI is System Control Protocol -
> +allows domain to manage various functions that are provided by HW platform.
> +
> +=over 4
> +
> +=item B<none>
> +
> +Don't allow guest to use SCI if present on the platform. This is the default
> +value.
> +
> +=item B<scmi_smc>
> +
> +Enables SCMI-SMC support for the guest. SCMI is System Control Management
> +Inferface - allows domain to manage various functions that are provided by HW
> +platform, such as clocks, resets and power-domains. Xen will mediate access to
> +clocks, power-domains and resets between Domains and ATF. Disabled by default.
> +SMC is used as transport.

Would it make sense to actually enable SCMI-SMC support for the guest by
default if the guest has any devices directly assigned?
Anthony PERARD Dec. 21, 2021, 1:27 p.m. UTC | #4
On Tue, Dec 14, 2021 at 09:34:28AM +0000, Oleksii Moisieiev wrote:
> This enumeration sets SCI type for the domain. Currently there is
> two possible options: either 'none' or 'scmi_smc'.
> 
> 'none' is the default value and it disables SCI support at all.
> 
> 'scmi_smc' enables access to the Firmware from the domains using SCMI
> protocol and SMC as transport.
> 
> Signed-off-by: Oleksii Moisieiev <oleksii_moisieiev@epam.com>
> ---

Thanks for the patch, it looks good too me.

But it is kind of weird that the manual describes something that isn't
implemented yet. Could you maybe add in the patch description that the
feature isn't implemented yet or that the feature is implemented in
follow-up patches?

Also, about the golang binding thingy, could you add a note after a line
of a three dash "---" that let know the committer to regenerate
everything that needs re-generating due to change in the *.idl file,
just in case?

Thanks,
Oleksii Moisieiev Dec. 22, 2021, 10:24 a.m. UTC | #5
On Mon, Dec 20, 2021 at 04:54:25PM -0800, Stefano Stabellini wrote:
> On Tue, 14 Dec 2021, Oleksii Moisieiev wrote:
> > This enumeration sets SCI type for the domain. Currently there is
> > two possible options: either 'none' or 'scmi_smc'.
> > 
> > 'none' is the default value and it disables SCI support at all.
> > 
> > 'scmi_smc' enables access to the Firmware from the domains using SCMI
> > protocol and SMC as transport.
> > 
> > Signed-off-by: Oleksii Moisieiev <oleksii_moisieiev@epam.com>
> > ---
> >  docs/man/xl.cfg.5.pod.in         | 22 ++++++++++++++++++++++
> >  tools/include/libxl.h            |  5 +++++
> >  tools/libs/light/libxl_types.idl |  6 ++++++
> >  tools/xl/xl_parse.c              |  9 +++++++++
> >  4 files changed, 42 insertions(+)
> > 
> > diff --git a/docs/man/xl.cfg.5.pod.in b/docs/man/xl.cfg.5.pod.in
> > index b98d161398..92d0593875 100644
> > --- a/docs/man/xl.cfg.5.pod.in
> > +++ b/docs/man/xl.cfg.5.pod.in
> > @@ -1614,6 +1614,28 @@ This feature is a B<technology preview>.
> >  
> >  =back
> >  
> > +=item B<sci="STRING">
> > +
> > +B<Arm only> Set SCI type for the guest. SCI is System Control Protocol -
> > +allows domain to manage various functions that are provided by HW platform.
> > +
> > +=over 4
> > +
> > +=item B<none>
> > +
> > +Don't allow guest to use SCI if present on the platform. This is the default
> > +value.
> > +
> > +=item B<scmi_smc>
> > +
> > +Enables SCMI-SMC support for the guest. SCMI is System Control Management
> > +Inferface - allows domain to manage various functions that are provided by HW
> > +platform, such as clocks, resets and power-domains. Xen will mediate access to
> > +clocks, power-domains and resets between Domains and ATF. Disabled by default.
> > +SMC is used as transport.
> 
> Would it make sense to actually enable SCMI-SMC support for the guest by
> default if the guest has any devices directly assigned?

Hi Stefano,

Previously we discussed with Oleksandr about introducing new dom.cfg
parameter, such as scidev[] lists all sci related nodes, which will help to
avoid extra domctl calls.

But there is still a question how mediator types should be set for
different domains? I know currently system supports only one mediator
type, but different implementation should be also possible.

For example, if we have to start dom0 and domd using scmi_mailbox
mediator and domU using scmi_smc, because our system supports only 2
mailboxes.

Best regards,
Oleksii.
Oleksii Moisieiev Dec. 22, 2021, 12:20 p.m. UTC | #6
On Tue, Dec 21, 2021 at 01:27:11PM +0000, Anthony PERARD wrote:
> On Tue, Dec 14, 2021 at 09:34:28AM +0000, Oleksii Moisieiev wrote:
> > This enumeration sets SCI type for the domain. Currently there is
> > two possible options: either 'none' or 'scmi_smc'.
> > 
> > 'none' is the default value and it disables SCI support at all.
> > 
> > 'scmi_smc' enables access to the Firmware from the domains using SCMI
> > protocol and SMC as transport.
> > 
> > Signed-off-by: Oleksii Moisieiev <oleksii_moisieiev@epam.com>
> > ---
> 
> Thanks for the patch, it looks good too me.
> 
> But it is kind of weird that the manual describes something that isn't
> implemented yet. Could you maybe add in the patch description that the
> feature isn't implemented yet or that the feature is implemented in
> follow-up patches?
> 
> Also, about the golang binding thingy, could you add a note after a line
> of a three dash "---" that let know the committer to regenerate
> everything that needs re-generating due to change in the *.idl file,
> just in case?
> 

Hi Anthony,
I will add golang bindings in v2.
As for the scmi_smc description - is sounds reasonable. I will refactor
it in v2.
Stefano Stabellini Dec. 23, 2021, 2:23 a.m. UTC | #7
On Wed, 22 Dec 2021, Oleksii Moisieiev wrote:
> On Mon, Dec 20, 2021 at 04:54:25PM -0800, Stefano Stabellini wrote:
> > On Tue, 14 Dec 2021, Oleksii Moisieiev wrote:
> > > This enumeration sets SCI type for the domain. Currently there is
> > > two possible options: either 'none' or 'scmi_smc'.
> > > 
> > > 'none' is the default value and it disables SCI support at all.
> > > 
> > > 'scmi_smc' enables access to the Firmware from the domains using SCMI
> > > protocol and SMC as transport.
> > > 
> > > Signed-off-by: Oleksii Moisieiev <oleksii_moisieiev@epam.com>
> > > ---
> > >  docs/man/xl.cfg.5.pod.in         | 22 ++++++++++++++++++++++
> > >  tools/include/libxl.h            |  5 +++++
> > >  tools/libs/light/libxl_types.idl |  6 ++++++
> > >  tools/xl/xl_parse.c              |  9 +++++++++
> > >  4 files changed, 42 insertions(+)
> > > 
> > > diff --git a/docs/man/xl.cfg.5.pod.in b/docs/man/xl.cfg.5.pod.in
> > > index b98d161398..92d0593875 100644
> > > --- a/docs/man/xl.cfg.5.pod.in
> > > +++ b/docs/man/xl.cfg.5.pod.in
> > > @@ -1614,6 +1614,28 @@ This feature is a B<technology preview>.
> > >  
> > >  =back
> > >  
> > > +=item B<sci="STRING">
> > > +
> > > +B<Arm only> Set SCI type for the guest. SCI is System Control Protocol -
> > > +allows domain to manage various functions that are provided by HW platform.
> > > +
> > > +=over 4
> > > +
> > > +=item B<none>
> > > +
> > > +Don't allow guest to use SCI if present on the platform. This is the default
> > > +value.
> > > +
> > > +=item B<scmi_smc>
> > > +
> > > +Enables SCMI-SMC support for the guest. SCMI is System Control Management
> > > +Inferface - allows domain to manage various functions that are provided by HW
> > > +platform, such as clocks, resets and power-domains. Xen will mediate access to
> > > +clocks, power-domains and resets between Domains and ATF. Disabled by default.
> > > +SMC is used as transport.
> > 
> > Would it make sense to actually enable SCMI-SMC support for the guest by
> > default if the guest has any devices directly assigned?
> 
> Hi Stefano,
> 
> Previously we discussed with Oleksandr about introducing new dom.cfg
> parameter, such as scidev[] lists all sci related nodes, which will help to
> avoid extra domctl calls.

The concerning part is (too much) information the user needs to provide
in device tree or dom.cfg. We can be flexible with the number of extra
domctl calls, but of course it would be good to avoid them too.


> But there is still a question how mediator types should be set for
> different domains? I know currently system supports only one mediator
> type, but different implementation should be also possible.

I think it is fine to have an option sci="scmi_smc" in dom.cfg, that is
not a problem. The issue is a detailed list of SCMI IDs or a second list
of device tree paths, because those are far harder to write correctly.


> For example, if we have to start dom0 and domd using scmi_mailbox
> mediator and domU using scmi_smc, because our system supports only 2
> mailboxes.

Yeah that's fine, it could be done with the sci option you are
suggesting.
Oleksii Moisieiev Dec. 23, 2021, 7:13 p.m. UTC | #8
Hi Stefano,

On Wed, Dec 22, 2021 at 06:23:33PM -0800, Stefano Stabellini wrote:
> On Wed, 22 Dec 2021, Oleksii Moisieiev wrote:
> > On Mon, Dec 20, 2021 at 04:54:25PM -0800, Stefano Stabellini wrote:
> > > On Tue, 14 Dec 2021, Oleksii Moisieiev wrote:
> > > > This enumeration sets SCI type for the domain. Currently there is
> > > > two possible options: either 'none' or 'scmi_smc'.
> > > > 
> > > > 'none' is the default value and it disables SCI support at all.
> > > > 
> > > > 'scmi_smc' enables access to the Firmware from the domains using SCMI
> > > > protocol and SMC as transport.
> > > > 
> > > > Signed-off-by: Oleksii Moisieiev <oleksii_moisieiev@epam.com>
> > > > ---
> > > >  docs/man/xl.cfg.5.pod.in         | 22 ++++++++++++++++++++++
> > > >  tools/include/libxl.h            |  5 +++++
> > > >  tools/libs/light/libxl_types.idl |  6 ++++++
> > > >  tools/xl/xl_parse.c              |  9 +++++++++
> > > >  4 files changed, 42 insertions(+)
> > > > 
> > > > diff --git a/docs/man/xl.cfg.5.pod.in b/docs/man/xl.cfg.5.pod.in
> > > > index b98d161398..92d0593875 100644
> > > > --- a/docs/man/xl.cfg.5.pod.in
> > > > +++ b/docs/man/xl.cfg.5.pod.in
> > > > @@ -1614,6 +1614,28 @@ This feature is a B<technology preview>.
> > > >  
> > > >  =back
> > > >  
> > > > +=item B<sci="STRING">
> > > > +
> > > > +B<Arm only> Set SCI type for the guest. SCI is System Control Protocol -
> > > > +allows domain to manage various functions that are provided by HW platform.
> > > > +
> > > > +=over 4
> > > > +
> > > > +=item B<none>
> > > > +
> > > > +Don't allow guest to use SCI if present on the platform. This is the default
> > > > +value.
> > > > +
> > > > +=item B<scmi_smc>
> > > > +
> > > > +Enables SCMI-SMC support for the guest. SCMI is System Control Management
> > > > +Inferface - allows domain to manage various functions that are provided by HW
> > > > +platform, such as clocks, resets and power-domains. Xen will mediate access to
> > > > +clocks, power-domains and resets between Domains and ATF. Disabled by default.
> > > > +SMC is used as transport.
> > > 
> > > Would it make sense to actually enable SCMI-SMC support for the guest by
> > > default if the guest has any devices directly assigned?
> > 
> > Hi Stefano,
> > 
> > Previously we discussed with Oleksandr about introducing new dom.cfg
> > parameter, such as scidev[] lists all sci related nodes, which will help to
> > avoid extra domctl calls.
> 
> The concerning part is (too much) information the user needs to provide
> in device tree or dom.cfg. We can be flexible with the number of extra
> domctl calls, but of course it would be good to avoid them too.
> 
> 
> > But there is still a question how mediator types should be set for
> > different domains? I know currently system supports only one mediator
> > type, but different implementation should be also possible.
> 
> I think it is fine to have an option sci="scmi_smc" in dom.cfg, that is
> not a problem. The issue is a detailed list of SCMI IDs or a second list
> of device tree paths, because those are far harder to write correctly.
> 
> 
> > For example, if we have to start dom0 and domd using scmi_mailbox
> > mediator and domU using scmi_smc, because our system supports only 2
> > mailboxes.
> 
> Yeah that's fine, it could be done with the sci option you are
> suggesting.

Thank you for suggestions. I will use this approach in v2.
diff mbox series

Patch

diff --git a/docs/man/xl.cfg.5.pod.in b/docs/man/xl.cfg.5.pod.in
index b98d161398..92d0593875 100644
--- a/docs/man/xl.cfg.5.pod.in
+++ b/docs/man/xl.cfg.5.pod.in
@@ -1614,6 +1614,28 @@  This feature is a B<technology preview>.
 
 =back
 
+=item B<sci="STRING">
+
+B<Arm only> Set SCI type for the guest. SCI is System Control Protocol -
+allows domain to manage various functions that are provided by HW platform.
+
+=over 4
+
+=item B<none>
+
+Don't allow guest to use SCI if present on the platform. This is the default
+value.
+
+=item B<scmi_smc>
+
+Enables SCMI-SMC support for the guest. SCMI is System Control Management
+Inferface - allows domain to manage various functions that are provided by HW
+platform, such as clocks, resets and power-domains. Xen will mediate access to
+clocks, power-domains and resets between Domains and ATF. Disabled by default.
+SMC is used as transport.
+
+=back
+
 =back
 
 =head2 Paravirtualised (PV) Guest Specific Options
diff --git a/tools/include/libxl.h b/tools/include/libxl.h
index 2bbbd21f0b..30e5aee119 100644
--- a/tools/include/libxl.h
+++ b/tools/include/libxl.h
@@ -278,6 +278,11 @@ 
  */
 #define LIBXL_HAVE_BUILDINFO_ARCH_ARM_TEE 1
 
+/*
+ * libxl_domain_build_info has the arch_arm.sci field.
+ */
+#define LIBXL_HAVE_BUILDINFO_ARCH_ARM_SCI 1
+
 /*
  * LIBXL_HAVE_SOFT_RESET indicates that libxl supports performing
  * 'soft reset' for domains and there is 'soft_reset' shutdown reason
diff --git a/tools/libs/light/libxl_types.idl b/tools/libs/light/libxl_types.idl
index 2a42da2f7d..9067b509f4 100644
--- a/tools/libs/light/libxl_types.idl
+++ b/tools/libs/light/libxl_types.idl
@@ -480,6 +480,11 @@  libxl_tee_type = Enumeration("tee_type", [
     (1, "optee")
     ], init_val = "LIBXL_TEE_TYPE_NONE")
 
+libxl_sci_type = Enumeration("sci_type", [
+    (0, "none"),
+    (1, "scmi_smc")
+    ], init_val = "LIBXL_SCI_TYPE_NONE")
+
 libxl_rdm_reserve = Struct("rdm_reserve", [
     ("strategy",    libxl_rdm_reserve_strategy),
     ("policy",      libxl_rdm_reserve_policy),
@@ -564,6 +569,7 @@  libxl_domain_build_info = Struct("domain_build_info",[
     ("apic",             libxl_defbool),
     ("dm_restrict",      libxl_defbool),
     ("tee",              libxl_tee_type),
+    ("sci",              libxl_sci_type),
     ("u", KeyedUnion(None, libxl_domain_type, "type",
                 [("hvm", Struct(None, [("firmware",         string),
                                        ("bios",             libxl_bios_type),
diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c
index 117fcdcb2b..c37bf6298b 100644
--- a/tools/xl/xl_parse.c
+++ b/tools/xl/xl_parse.c
@@ -2747,6 +2747,15 @@  skip_usbdev:
         }
     }
 
+    if (!xlu_cfg_get_string (config, "sci", &buf, 1)) {
+        e = libxl_sci_type_from_string(buf, &b_info->sci);
+        if (e) {
+            fprintf(stderr,
+                    "Unknown sci \"%s\" specified\n", buf);
+            exit(-ERROR_FAIL);
+        }
+    }
+
     parse_vkb_list(config, d_config);
 
     xlu_cfg_get_defbool(config, "xend_suspend_evtchn_compat",