[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v5 02/12] xen/arm: add SVE vector length field to the domain


  • To: Julien Grall <julien@xxxxxxx>
  • From: Luca Fancellu <Luca.Fancellu@xxxxxxx>
  • Date: Thu, 13 Apr 2023 13:24:46 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=XDlP7wrlTDsn66ctfF6VxZhhr/8wAWkk0cmlLOo5TMI=; b=PhE3l549RZ1MKWMzN0ReFqWcZNk5upO0uXOTVVvrJXwlpIe0pzWY9GJUWcosS+NxgLG1vHZcAtvIDKUeyEOzNzThfTyBSTIxnjsumrUDW0uNWkTmZjq7hQ4JoikD45/xY2HmTlg+R1Zs6IIaj7IW+LBtrkFP1MZXYNbuKt3pCiqdyXeRodypeMs4Eu0CpR4KjhADMZxZoTwU3FgfaKrPdZA27oAkBFIsis+olZco4jWzGzqJrF4fCU5R8/kIveJGLhuRvyxxQ1VW/rL40BKwMw9NGZvn/RZZyWKyIGyR/wj1XHU8zbiwtarU3OWGpNp+RsVKTcFxHXb6sn14SiaoFQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IrjZY6LJfv6PRH38ESwI4vnco6mFZp0yT6SYgYTI3luB0mizJxar5ARwViZKp+qe5Zu1ZXC0Fh3wEkoU4WJagq4JxbHeVaoCoJZWOKSwvhdszctlMHx9jZhEsoSxu6kFylXKioulH0gvOvMAd/tm9KD/xINN9jM5pIAC2WtqhRziWhcFYaIBTF/EaQNrCqh6hu5lBmdKXDrERTWUI4MVSsCIRg7y4hRpV73+CIIjP2cQ9rDwB98x1VLO90eG1oOag6DMyHNX0l3JngcUlnb48NSCPyUZdWuE6sXTl1BRj7E9+3xdFVoDFxCPHxH4kguGipZyUavG172FtL+EqmAFEA==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Wei Chen <Wei.Chen@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Thu, 13 Apr 2023 13:25:26 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHZbSQ9GJqCFHqaX0uCiT+EC9U7s68pNK+AgAAHnIA=
  • Thread-topic: [PATCH v5 02/12] xen/arm: add SVE vector length field to the domain

Hi Julien,


>>  @@ -594,6 +597,7 @@ int arch_sanitise_domain_config(struct 
>> xen_domctl_createdomain *config)
>>      unsigned int max_vcpus;
>>      unsigned int flags_required = (XEN_DOMCTL_CDF_hvm | XEN_DOMCTL_CDF_hap);
>>      unsigned int flags_optional = (XEN_DOMCTL_CDF_iommu | 
>> XEN_DOMCTL_CDF_vpmu);
>> +    unsigned int sve_vl_bits = sve_decode_vl(config->arch.sve_vl);
>>        if ( (config->flags & ~flags_optional) != flags_required )
>>      {
>> @@ -602,6 +606,26 @@ int arch_sanitise_domain_config(struct 
>> xen_domctl_createdomain *config)
>>          return -EINVAL;
>>      }
>>  +    /* Check feature flags */
>> +    if ( sve_vl_bits > 0 )
>> +    {
>> +        unsigned int zcr_max_bits = get_sys_vl_len();
>> +
>> +        if ( !zcr_max_bits )
>> +        {
>> +            dprintk(XENLOG_INFO, "SVE is unsupported on this machine.\n");
>> +            return -EINVAL;
>> +        }
>> +
>> +        if ( sve_vl_bits > zcr_max_bits )
>> +        {
>> +            dprintk(XENLOG_INFO,
>> +                    "Requested SVE vector length (%u) > supported length 
>> (%u)\n",
>> +                    sve_vl_bits, zcr_max_bits);
>> +            return -EINVAL;
>> +        }
> 
> Is SVE supported for 32-bit guest? If not, then you should had a check here 
> to prevent the creation of the domain if sve_vl_bits is set.

No SVE is not supported for 32 bit guests, here I think we will get “SVE is 
unsupported on this machine” because get_sys_vl_len() will return 0.

I can however put everything inside #ifdef CONFIG_ARM64_SVE or CONFIG_ARM_64 if 
you prefer

>> 
>> diff --git a/xen/arch/arm/include/asm/domain.h 
>> b/xen/arch/arm/include/asm/domain.h
>> index e776ee704b7d..78cc2da3d4e5 100644
>> --- a/xen/arch/arm/include/asm/domain.h
>> +++ b/xen/arch/arm/include/asm/domain.h
>> @@ -31,6 +31,8 @@ enum domain_type {
>>    #define is_domain_direct_mapped(d) ((d)->cdf & CDF_directmap)
>>  +#define is_sve_domain(d) ((d)->arch.sve_vl > 0)
>> +
>>  /*
>>   * Is the domain using the host memory layout?
>>   *
>> @@ -67,6 +69,9 @@ struct arch_domain
>>      enum domain_type type;
>>  #endif
>>  +    /* max SVE encoded vector length */
>> +    uint8_t sve_vl;
>> +
> Can we move this somewhere else to avoid adding extra padding? Also shouldn't 
> this be protected with #ifdef CONFIG_ARM_64 to make clear this is not 
> supported on Xen 32-bit?

Yes, I’ll move it and protect with CONFIG_ARM_64, is it ok for you if I move it 
after:

/* Monitor options */
struct {
    uint8_t privileged_call_enabled : 1;
} monitor;




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.