[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v4 4/9] target/arm/cpu64: max cpu: Introduce sve<N> propertie
From: |
Richard Henderson |
Subject: |
Re: [PATCH v4 4/9] target/arm/cpu64: max cpu: Introduce sve<N> properties |
Date: |
Thu, 26 Sep 2019 12:07:54 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 |
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~
[PATCH v4 7/9] target/arm/kvm: scratch vcpu: Preserve input kvm_vcpu_init features, Andrew Jones, 2019/09/24
[PATCH v4 9/9] target/arm/kvm: host cpu: Add support for sve<N> properties, Andrew Jones, 2019/09/24
[PATCH v4 8/9] target/arm/cpu64: max cpu: Support sve properties with KVM, Andrew Jones, 2019/09/24