All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: Luca Fancellu <luca.fancellu@arm.com>
Cc: bertrand.marquis@arm.com, wei.chen@arm.com,
	Stefano Stabellini <sstabellini@kernel.org>,
	Julien Grall <julien@xen.org>,
	Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	George Dunlap <george.dunlap@citrix.com>, Wei Liu <wl@xen.org>,
	xen-devel@lists.xenproject.org
Subject: Re: [PATCH v3 02/10] xen/arm: add SVE vector length field to the domain
Date: Mon, 20 Mar 2023 10:09:04 +0100	[thread overview]
Message-ID: <204dbe14-c1e9-8d56-4923-4a867c3d2c4b@suse.com> (raw)
In-Reply-To: <20230317131949.4031014-3-luca.fancellu@arm.com>

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?

> --- 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 ...

> @@ -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)

> --- 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


  reply	other threads:[~2023-03-20  9:09 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-17 13:19 [PATCH v3 00/10] SVE feature for arm guests Luca Fancellu
2023-03-17 13:19 ` [PATCH v3 01/10] xen/arm: enable SVE extension for Xen Luca Fancellu
2023-03-17 13:19 ` [PATCH v3 02/10] xen/arm: add SVE vector length field to the domain Luca Fancellu
2023-03-20  9:09   ` Jan Beulich [this message]
2023-03-22  7:07     ` Luca Fancellu
2023-03-17 13:19 ` [PATCH v3 03/10] xen/arm: Expose SVE feature to the guest Luca Fancellu
2023-03-17 13:19 ` [PATCH v3 04/10] xen/arm: add SVE exception class handling Luca Fancellu
2023-03-17 13:19 ` [PATCH v3 05/10] arm/sve: save/restore SVE context switch Luca Fancellu
2023-03-17 13:19 ` [PATCH v3 06/10] xen/arm: enable Dom0 to use SVE feature Luca Fancellu
2023-03-20  9:13   ` Jan Beulich
2023-03-22  7:32     ` Luca Fancellu
2023-03-22  7:51       ` Jan Beulich
2023-03-17 13:19 ` [PATCH v3 07/10] xen/physinfo: encode Arm SVE vector length in arch_capabilities Luca Fancellu
2023-03-17 13:19 ` [PATCH v3 08/10] tools: add physinfo arch_capabilities handling for Arm Luca Fancellu
2023-03-20 10:30   ` George Dunlap
2023-03-20 11:01   ` Christian Lindig
2023-03-22  7:02     ` Luca Fancellu
2023-03-22  8:47       ` Christian Lindig
2023-03-17 13:19 ` [PATCH v3 09/10] xen/tools: add sve parameter in XL configuration Luca Fancellu
2023-03-17 13:19 ` [PATCH v3 10/10] xen/arm: add sve property for dom0less domUs Luca Fancellu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=204dbe14-c1e9-8d56-4923-4a867c3d2c4b@suse.com \
    --to=jbeulich@suse.com \
    --cc=Volodymyr_Babchuk@epam.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=bertrand.marquis@arm.com \
    --cc=george.dunlap@citrix.com \
    --cc=julien@xen.org \
    --cc=luca.fancellu@arm.com \
    --cc=sstabellini@kernel.org \
    --cc=wei.chen@arm.com \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.