Add a device tree property in the dom0less domU configuration
to enable the guest to use SVE.
Update documentation.
Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
---
Changes from v4:
- Now it is possible to specify the property "sve" for dom0less
device tree node without any value, that means the platform
supported VL will be used.
Changes from v3:
- Now domainconfig_encode_vl is named sve_encode_vl
Changes from v2:
- xen_domctl_createdomain field name has changed into sve_vl
and its value is the VL/128, use domainconfig_encode_vl
to encode a plain VL in bits.
Changes from v1:
- No changes
Changes from RFC:
- Changed documentation
---
docs/misc/arm/device-tree/booting.txt | 11 +++++++++++
xen/arch/arm/domain_build.c | 24 ++++++++++++++++++++++++
2 files changed, 35 insertions(+)
diff --git a/docs/misc/arm/device-tree/booting.txt b/docs/misc/arm/device-tree/booting.txt
index 3879340b5e0a..f9d2ecdda48a 100644
--- a/docs/misc/arm/device-tree/booting.txt
+++ b/docs/misc/arm/device-tree/booting.txt
@@ -193,6 +193,17 @@ with the following properties:
Optional. Handle to a xen,cpupool device tree node that identifies the
cpupool where the guest will be started at boot.
+- sve
+
+ Optional. A number that, when above 0, enables SVE for this guest and sets
+ its maximum SVE vector length. The default value is 0, that means this
+ guest is not allowed to use SVE, the maximum value allowed is 2048, any
+ other value must be multiple of 128.
+ Please note that if the platform supports a lower value of bits, then the
+ domain creation will fail.
+ Specifying this property with no value, means that the SVE vector length
+ will be set equal to the maximum vector length supported by the platform.
+
- xen,enhanced
A string property. Possible property values are:
diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 3f30ef5c37b6..c1f0d1d78431 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -4004,6 +4004,30 @@ void __init create_domUs(void)
d_cfg.max_maptrack_frames = val;
}
+ if ( dt_get_property(node, "sve", &val) )
+ {
+ unsigned int sve_vl_bits;
+
+ if ( !val )
+ {
+ /* Property found with no value, means max HW VL supported */
+ rc = sve_sanitize_vl_param(-1, &sve_vl_bits);
+ }
+ else
+ {
+ if ( dt_property_read_u32(node, "sve", &val) )
+ rc = sve_sanitize_vl_param(val, &sve_vl_bits);
+ else
+ panic("Error reading 'sve' property");
+ }
+
+ if ( !rc )
+ d_cfg.arch.sve_vl = sve_encode_vl(sve_vl_bits);
+ else
+ printk(XENLOG_WARNING
+ "SVE vector length error, disable feature for Dom0less DomU\n");
+ }
+
/*
* The variable max_init_domid is initialized with zero, so here it's
* very important to use the pre-increment operator to call
--
2.34.1
Hi Luca,
> On 12 Apr 2023, at 11:49, Luca Fancellu <Luca.Fancellu@arm.com> wrote:
>
> Add a device tree property in the dom0less domU configuration
> to enable the guest to use SVE.
>
> Update documentation.
>
> Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
Cheers
Bertrand
> ---
> Changes from v4:
> - Now it is possible to specify the property "sve" for dom0less
> device tree node without any value, that means the platform
> supported VL will be used.
> Changes from v3:
> - Now domainconfig_encode_vl is named sve_encode_vl
> Changes from v2:
> - xen_domctl_createdomain field name has changed into sve_vl
> and its value is the VL/128, use domainconfig_encode_vl
> to encode a plain VL in bits.
> Changes from v1:
> - No changes
> Changes from RFC:
> - Changed documentation
> ---
> docs/misc/arm/device-tree/booting.txt | 11 +++++++++++
> xen/arch/arm/domain_build.c | 24 ++++++++++++++++++++++++
> 2 files changed, 35 insertions(+)
>
> diff --git a/docs/misc/arm/device-tree/booting.txt b/docs/misc/arm/device-tree/booting.txt
> index 3879340b5e0a..f9d2ecdda48a 100644
> --- a/docs/misc/arm/device-tree/booting.txt
> +++ b/docs/misc/arm/device-tree/booting.txt
> @@ -193,6 +193,17 @@ with the following properties:
> Optional. Handle to a xen,cpupool device tree node that identifies the
> cpupool where the guest will be started at boot.
>
> +- sve
> +
> + Optional. A number that, when above 0, enables SVE for this guest and sets
> + its maximum SVE vector length. The default value is 0, that means this
> + guest is not allowed to use SVE, the maximum value allowed is 2048, any
> + other value must be multiple of 128.
> + Please note that if the platform supports a lower value of bits, then the
> + domain creation will fail.
> + Specifying this property with no value, means that the SVE vector length
> + will be set equal to the maximum vector length supported by the platform.
> +
> - xen,enhanced
>
> A string property. Possible property values are:
> diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
> index 3f30ef5c37b6..c1f0d1d78431 100644
> --- a/xen/arch/arm/domain_build.c
> +++ b/xen/arch/arm/domain_build.c
> @@ -4004,6 +4004,30 @@ void __init create_domUs(void)
> d_cfg.max_maptrack_frames = val;
> }
>
> + if ( dt_get_property(node, "sve", &val) )
> + {
> + unsigned int sve_vl_bits;
> +
> + if ( !val )
> + {
> + /* Property found with no value, means max HW VL supported */
> + rc = sve_sanitize_vl_param(-1, &sve_vl_bits);
> + }
> + else
> + {
> + if ( dt_property_read_u32(node, "sve", &val) )
> + rc = sve_sanitize_vl_param(val, &sve_vl_bits);
> + else
> + panic("Error reading 'sve' property");
> + }
> +
> + if ( !rc )
> + d_cfg.arch.sve_vl = sve_encode_vl(sve_vl_bits);
> + else
> + printk(XENLOG_WARNING
> + "SVE vector length error, disable feature for Dom0less DomU\n");
> + }
> +
> /*
> * The variable max_init_domid is initialized with zero, so here it's
> * very important to use the pre-increment operator to call
> --
> 2.34.1
>
Hi,
> On 18 Apr 2023, at 14:55, Bertrand Marquis <Bertrand.Marquis@arm.com> wrote:
>
> Hi Luca,
>
>> On 12 Apr 2023, at 11:49, Luca Fancellu <Luca.Fancellu@arm.com> wrote:
>>
>> Add a device tree property in the dom0less domU configuration
>> to enable the guest to use SVE.
>>
>> Update documentation.
>>
>> Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
> Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
In fact the doc needs fixing as the domain creation does not fail.
@Luca thanks for mentioning that to me
So please fix that and you can keep my R-b (unless some changes are
needed after the discussion on parameter handling).
Cheers
Bertrand
>
> Cheers
> Bertrand
>
>> ---
>> Changes from v4:
>> - Now it is possible to specify the property "sve" for dom0less
>> device tree node without any value, that means the platform
>> supported VL will be used.
>> Changes from v3:
>> - Now domainconfig_encode_vl is named sve_encode_vl
>> Changes from v2:
>> - xen_domctl_createdomain field name has changed into sve_vl
>> and its value is the VL/128, use domainconfig_encode_vl
>> to encode a plain VL in bits.
>> Changes from v1:
>> - No changes
>> Changes from RFC:
>> - Changed documentation
>> ---
>> docs/misc/arm/device-tree/booting.txt | 11 +++++++++++
>> xen/arch/arm/domain_build.c | 24 ++++++++++++++++++++++++
>> 2 files changed, 35 insertions(+)
>>
>> diff --git a/docs/misc/arm/device-tree/booting.txt b/docs/misc/arm/device-tree/booting.txt
>> index 3879340b5e0a..f9d2ecdda48a 100644
>> --- a/docs/misc/arm/device-tree/booting.txt
>> +++ b/docs/misc/arm/device-tree/booting.txt
>> @@ -193,6 +193,17 @@ with the following properties:
>> Optional. Handle to a xen,cpupool device tree node that identifies the
>> cpupool where the guest will be started at boot.
>>
>> +- sve
>> +
>> + Optional. A number that, when above 0, enables SVE for this guest and sets
>> + its maximum SVE vector length. The default value is 0, that means this
>> + guest is not allowed to use SVE, the maximum value allowed is 2048, any
>> + other value must be multiple of 128.
>> + Please note that if the platform supports a lower value of bits, then the
>> + domain creation will fail.
>> + Specifying this property with no value, means that the SVE vector length
>> + will be set equal to the maximum vector length supported by the platform.
>> +
>> - xen,enhanced
>>
>> A string property. Possible property values are:
>> diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
>> index 3f30ef5c37b6..c1f0d1d78431 100644
>> --- a/xen/arch/arm/domain_build.c
>> +++ b/xen/arch/arm/domain_build.c
>> @@ -4004,6 +4004,30 @@ void __init create_domUs(void)
>> d_cfg.max_maptrack_frames = val;
>> }
>>
>> + if ( dt_get_property(node, "sve", &val) )
>> + {
>> + unsigned int sve_vl_bits;
>> +
>> + if ( !val )
>> + {
>> + /* Property found with no value, means max HW VL supported */
>> + rc = sve_sanitize_vl_param(-1, &sve_vl_bits);
>> + }
>> + else
>> + {
>> + if ( dt_property_read_u32(node, "sve", &val) )
>> + rc = sve_sanitize_vl_param(val, &sve_vl_bits);
>> + else
>> + panic("Error reading 'sve' property");
>> + }
>> +
>> + if ( !rc )
>> + d_cfg.arch.sve_vl = sve_encode_vl(sve_vl_bits);
>> + else
>> + printk(XENLOG_WARNING
>> + "SVE vector length error, disable feature for Dom0less DomU\n");
>> + }
>> +
>> /*
>> * The variable max_init_domid is initialized with zero, so here it's
>> * very important to use the pre-increment operator to call
>> --
>> 2.34.1
>>
>
>
© 2016 - 2026 Red Hat, Inc.