target/arm: Generalize cpu_arm_{get, set}_default_vec_len
Rename from cpu_arm_{get,set}_sve_default_vec_len, and take the pointer to default_vq from opaque. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20220620175235.60881-15-richard.henderson@linaro.org Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
parent
0f40784eac
commit
515816a82c
@ -638,11 +638,11 @@ static void cpu_arm_set_sve(Object *obj, bool value, Error **errp)
|
||||
|
||||
#ifdef CONFIG_USER_ONLY
|
||||
/* Mirror linux /proc/sys/abi/sve_default_vector_length. */
|
||||
static void cpu_arm_set_sve_default_vec_len(Object *obj, Visitor *v,
|
||||
const char *name, void *opaque,
|
||||
Error **errp)
|
||||
static void cpu_arm_set_default_vec_len(Object *obj, Visitor *v,
|
||||
const char *name, void *opaque,
|
||||
Error **errp)
|
||||
{
|
||||
ARMCPU *cpu = ARM_CPU(obj);
|
||||
uint32_t *ptr_default_vq = opaque;
|
||||
int32_t default_len, default_vq, remainder;
|
||||
|
||||
if (!visit_type_int32(v, name, &default_len, errp)) {
|
||||
@ -651,7 +651,7 @@ static void cpu_arm_set_sve_default_vec_len(Object *obj, Visitor *v,
|
||||
|
||||
/* Undocumented, but the kernel allows -1 to indicate "maximum". */
|
||||
if (default_len == -1) {
|
||||
cpu->sve_default_vq = ARM_MAX_VQ;
|
||||
*ptr_default_vq = ARM_MAX_VQ;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -675,15 +675,15 @@ static void cpu_arm_set_sve_default_vec_len(Object *obj, Visitor *v,
|
||||
return;
|
||||
}
|
||||
|
||||
cpu->sve_default_vq = default_vq;
|
||||
*ptr_default_vq = default_vq;
|
||||
}
|
||||
|
||||
static void cpu_arm_get_sve_default_vec_len(Object *obj, Visitor *v,
|
||||
const char *name, void *opaque,
|
||||
Error **errp)
|
||||
static void cpu_arm_get_default_vec_len(Object *obj, Visitor *v,
|
||||
const char *name, void *opaque,
|
||||
Error **errp)
|
||||
{
|
||||
ARMCPU *cpu = ARM_CPU(obj);
|
||||
int32_t value = cpu->sve_default_vq * 16;
|
||||
uint32_t *ptr_default_vq = opaque;
|
||||
int32_t value = *ptr_default_vq * 16;
|
||||
|
||||
visit_type_int32(v, name, &value, errp);
|
||||
}
|
||||
@ -706,8 +706,9 @@ void aarch64_add_sve_properties(Object *obj)
|
||||
#ifdef CONFIG_USER_ONLY
|
||||
/* Mirror linux /proc/sys/abi/sve_default_vector_length. */
|
||||
object_property_add(obj, "sve-default-vector-length", "int32",
|
||||
cpu_arm_get_sve_default_vec_len,
|
||||
cpu_arm_set_sve_default_vec_len, NULL, NULL);
|
||||
cpu_arm_get_default_vec_len,
|
||||
cpu_arm_set_default_vec_len, NULL,
|
||||
&cpu->sve_default_vq);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user