qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: Andrew Jones <drjones@redhat.com>,
	qemu-devel@nongnu.org, qemu-arm@nongnu.org
Cc: peter.maydell@linaro.org, armbru@redhat.com,
	eric.auger@redhat.com, imammedo@redhat.com,
	alex.bennee@linaro.org, Dave.Martin@arm.com
Subject: Re: [PATCH v4 4/9] target/arm/cpu64: max cpu: Introduce sve<N> properties
Date: Thu, 26 Sep 2019 12:07:54 -0700	[thread overview]
Message-ID: <2beb840f-99cf-d928-0926-c284933c78d9@linaro.org> (raw)
In-Reply-To: <20190924113105.19076-5-drjones@redhat.com>

On 9/24/19 4:31 AM, Andrew Jones wrote:
> +static uint32_t sve_zcr_get_valid_len(ARMCPU *cpu, uint32_t start_len)
> +{
> +    uint32_t start_vq = (start_len & 0xf) + 1;
> +
> +    return arm_cpu_vq_map_next_smaller(cpu, start_vq + 1) - 1;
> +}
> +
>  /*
>   * Given that SVE is enabled, return the vector length for EL.
>   */
> @@ -5360,13 +5367,13 @@ uint32_t sve_zcr_len_for_el(CPUARMState *env, int el)
>      uint32_t zcr_len = cpu->sve_max_vq - 1;
>  
>      if (el <= 1) {
> -        zcr_len = MIN(zcr_len, 0xf & (uint32_t)env->vfp.zcr_el[1]);
> +        zcr_len = sve_zcr_get_valid_len(cpu, env->vfp.zcr_el[1]);
>      }
>      if (el <= 2 && arm_feature(env, ARM_FEATURE_EL2)) {
> -        zcr_len = MIN(zcr_len, 0xf & (uint32_t)env->vfp.zcr_el[2]);
> +        zcr_len = sve_zcr_get_valid_len(cpu, env->vfp.zcr_el[2]);
>      }
>      if (arm_feature(env, ARM_FEATURE_EL3)) {
> -        zcr_len = MIN(zcr_len, 0xf & (uint32_t)env->vfp.zcr_el[3]);
> +        zcr_len = sve_zcr_get_valid_len(cpu, env->vfp.zcr_el[3]);

This has lost the MIN relation between these 3 registers.
One possible solution is to keep these 3 if statements as-is,
but make one call

    zcr_len = arm_cpu_vq_map_next_smaller(cpu, zcr_len);

at the end.

> +#if __SIZEOF_LONG__ == 8
> +#define BIT(n) (1UL << (n))
> +#else
> +#define BIT(n) (1ULL << (n))
> +#endif

There's no reason not to always use 1ULL is there?


r~


  parent reply	other threads:[~2019-09-26 19:31 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-24 11:30 [PATCH v4 0/9] target/arm/kvm: enable SVE in guests Andrew Jones
2019-09-24 11:30 ` [PATCH v4 1/9] target/arm/monitor: Introduce qmp_query_cpu_model_expansion Andrew Jones
2019-09-24 15:06   ` Auger Eric
2019-09-24 11:30 ` [PATCH v4 2/9] tests: arm: Introduce cpu feature tests Andrew Jones
2019-09-24 11:30 ` [PATCH v4 3/9] target/arm: Allow SVE to be disabled via a CPU property Andrew Jones
2019-09-24 15:06   ` Auger Eric
2019-09-24 11:31 ` [PATCH v4 4/9] target/arm/cpu64: max cpu: Introduce sve<N> properties Andrew Jones
2019-09-24 13:55   ` Andrew Jones
2019-09-25 13:53   ` Auger Eric
2019-09-26  8:21     ` Andrew Jones
2019-09-26  9:34       ` Auger Eric
2019-09-26 11:14         ` Andrew Jones
2019-09-26 19:07   ` Richard Henderson [this message]
2019-09-26 23:50     ` Alex Bennée
2019-09-27  6:51       ` Andrew Jones
2019-09-27  6:45     ` Andrew Jones
2019-09-24 11:31 ` [PATCH v4 5/9] target/arm/kvm64: Add kvm_arch_get/put_sve Andrew Jones
2019-09-25 13:58   ` Auger Eric
2019-09-27 13:00   ` Andrew Jones
2019-10-01  6:53   ` Andrew Jones
2019-09-24 11:31 ` [PATCH v4 6/9] target/arm/kvm64: max cpu: Enable SVE when available Andrew Jones
2019-09-26  6:53   ` Auger Eric
2019-09-24 11:31 ` [PATCH v4 7/9] target/arm/kvm: scratch vcpu: Preserve input kvm_vcpu_init features Andrew Jones
2019-09-24 11:31 ` [PATCH v4 8/9] target/arm/cpu64: max cpu: Support sve properties with KVM Andrew Jones
2019-09-26  6:52   ` Auger Eric
2019-09-26  8:41     ` Andrew Jones
2019-09-26 10:01       ` Auger Eric
2019-09-26 11:40         ` Andrew Jones
2019-09-26 11:50           ` Auger Eric
2019-09-24 11:31 ` [PATCH v4 9/9] target/arm/kvm: host cpu: Add support for sve<N> properties Andrew Jones
2019-09-26  7:07   ` Auger Eric
2019-09-26  8:53     ` Andrew Jones

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=2beb840f-99cf-d928-0926-c284933c78d9@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=Dave.Martin@arm.com \
    --cc=alex.bennee@linaro.org \
    --cc=armbru@redhat.com \
    --cc=drjones@redhat.com \
    --cc=eric.auger@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).