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

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


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Luca Fancellu <Luca.Fancellu@xxxxxxx>
  • Date: Wed, 22 Mar 2023 07:07:30 +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=zx67raBl15RTTLZh5+eCLx2dxPgny+lf0JL25kdUpAM=; b=C6JEGsfE7fZq4l3Zvb3hGfFsFpsniteldnq8atYeNoTK/6qHyr9dX8Fqsv5yafn2idx8o7wIUuSOLn7dX5vQsHNxzkOATFHlgOi/ncaJubqRqr/WgOlvAHAWvKMBbozb8RfM3uyqaSTvMSF2mhntU+MMEuFpMEXi1PilvrnlmQP3KXQy18qTAmx5DkMnaaFAhG5NWt8kVZnWeKd2QFGAFz/lP85UFP4jK4R5U2O4RQ809DqlBWcZ6sz0pvc2aYlaZHV2UN+CrsJE+F5A+o1av9egitEKUYLQFZYCBjPZM6lC++TS9Mh7ujX00xU3tBbSsfnsXHGXW/KPQMM1KXs9Tw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PMU6uDQ8e0W8QZLipdhhcRpLoHGFA4AbRidQew5eZ+2riDUtQMlaYSbRLIIpArKI9efIZRx1vesydMY+SJ03hivirLC4ariFvxQYURVebKUI39NZuvvAkAuPw0QB9miDsStgr6mC/3VEwW8R1kf2xcxIrjPvmZwuNE05sDBgEgJglQwBdh+xONQpwju3fUA43c9Bk7qM3t8twcph/nOqAMTlTcEuTwmAciWCXKLuskWG2t24kA6Q2uMHhXvNaXMC78i3yYuUCl7MpPRHQY+we8Ay+QDb4IuYKz1sVI+WLf33Fhn/nB+HY8qlEKSTBzYQpegD+w1dAwJ884+JEIPTDA==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Wei Chen <Wei.Chen@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Wed, 22 Mar 2023 07:07:50 +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: AQHZWNND7RB779g4ZEeiitO407LYja8DZZUAgAMCpoA=
  • Thread-topic: [PATCH v3 02/10] xen/arm: add SVE vector length field to the domain


> On 20 Mar 2023, at 09:09, Jan Beulich <jbeulich@xxxxxxxx> wrote:
> 
> On 17.03.2023 14:19, Luca Fancellu wrote:
>> @@ -744,6 +773,9 @@ int arch_domain_create(struct domain *d,
>>     if ( (rc = domain_vpci_init(d)) != 0 )
>>         goto fail;
>> 
>> +    /* Copy and decode sve_vl from the domain configuration */
>> +    d->arch.sve_vl_bits = domainconfig_decode_vl(config->arch.sve_vl);
> 
> Considering that you now "encode" and "decode" the value when coming in /
> going out for a hypercall, wouldn't it make sense to also have in internally
> stored value in the same more compact format?

At the beginning I thought it was more useful the plain format, but probably
It’s better to keep that structure small. I’ll change it.

> 
>> --- a/xen/arch/arm/include/asm/arm64/sve.h
>> +++ b/xen/arch/arm/include/asm/arm64/sve.h
>> @@ -13,10 +13,23 @@
>> /* Vector length must be multiple of 128 */
>> #define SVE_VL_MULTIPLE_VAL (128U)
>> 
>> +static inline bool is_vl_valid(uint16_t vl)
>> +{
>> +    /* SVE vector length is multiple of 128 and maximum 2048 */
>> +    return ((vl % SVE_VL_MULTIPLE_VAL) == 0) && (vl <= SVE_VL_MAX_BITS);
>> +}
>> +
>> +static inline uint16_t domainconfig_decode_vl(uint8_t sve_vl)
>> +{
>> +    /* SVE vector length is stored as VL/128 in xen_arch_domainconfig */
>> +    return sve_vl * SVE_VL_MULTIPLE_VAL;
>> +}
>> +
>> #ifdef CONFIG_ARM64_SVE
>> 
>> register_t compute_max_zcr(void);
>> register_t vl_to_zcr(uint16_t vl);
>> +uint16_t get_sys_vl_len(void);
>> 
>> #else /* !CONFIG_ARM64_SVE */
>> 
>> @@ -30,6 +43,11 @@ static inline register_t vl_to_zcr(uint16_t vl)
>>     return 0;
>> }
>> 
>> +static inline uint16_t get_sys_vl_len(void)
>> +{
>> +    return 0;
>> +}
> 
> Throughout here: Style - please limit the use of fixed width types to
> cases where they're actually necessary to use to achieve a certain
> effect (see ./CODING_STYLE). None of the cases above look to match that
> criteria, merely ...

Ok I’ll change them

> 
>> @@ -114,6 +116,9 @@ struct arch_domain
>>     void *tee;
>> #endif
>> 
>> +    /* max SVE vector length in bits */
>> +    uint16_t sve_vl_bits;
> 
> ... this may be justified (for space efficiency), while ...
> 
>> +
>> }  __cacheline_aligned;
> 
> (nit: stray insertion of a blank line)

Ack

> 
>> --- a/xen/include/public/arch-arm.h
>> +++ b/xen/include/public/arch-arm.h
>> @@ -300,6 +300,8 @@ DEFINE_XEN_GUEST_HANDLE(vcpu_guest_context_t);
>> struct xen_arch_domainconfig {
>>     /* IN/OUT */
>>     uint8_t gic_version;
>> +    /* IN - Contains SVE vector length divided by 128 */
>> +    uint8_t sve_vl;
> 
> ... in the public interface it's of course mandatory to use.
> 
> Jan


 


Rackspace

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