mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 17:23:56 -06:00
target/riscv: deprecate capital 'Z' CPU properties
At this moment there are eleven CPU extension properties that starts with capital 'Z': Zifencei, Zicsr, Zihintntl, Zihintpause, Zawrs, Zfa, Zfh, Zfhmin, Zve32f, Zve64f and Zve64d. All other extensions are named with lower-case letters. We want all properties to be named with lower-case letters since it's consistent with the riscv-isa string that we create in the FDT. Having these 11 properties to be exceptions can be confusing. Deprecate all of them. Create their lower-case counterpart to be used as maintained CPU properties. When trying to use any deprecated property a warning message will be displayed, recommending users to switch to the lower-case variant: ./build/qemu-system-riscv64 -M virt -cpu rv64,Zifencei=true --nographic qemu-system-riscv64: warning: CPU property 'Zifencei' is deprecated. Please use 'zifencei' instead This will give users some time to change their scripts before we remove the capital 'Z' properties entirely. Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Reviewed-by: Andrew Jones <ajones@ventanamicro.com> Message-ID: <20231009112817.8896-2-dbarboza@ventanamicro.com> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
This commit is contained in:
parent
614c9466a2
commit
8043effd9b
4 changed files with 82 additions and 12 deletions
|
@ -731,6 +731,25 @@ static void riscv_cpu_add_misa_properties(Object *cpu_obj)
|
|||
}
|
||||
}
|
||||
|
||||
static bool cpu_ext_is_deprecated(const char *ext_name)
|
||||
{
|
||||
return isupper(ext_name[0]);
|
||||
}
|
||||
|
||||
/*
|
||||
* String will be allocated in the heap. Caller is responsible
|
||||
* for freeing it.
|
||||
*/
|
||||
static char *cpu_ext_to_lower(const char *ext_name)
|
||||
{
|
||||
char *ret = g_malloc0(strlen(ext_name) + 1);
|
||||
|
||||
strcpy(ret, ext_name);
|
||||
ret[0] = tolower(ret[0]);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void cpu_set_multi_ext_cfg(Object *obj, Visitor *v, const char *name,
|
||||
void *opaque, Error **errp)
|
||||
{
|
||||
|
@ -743,6 +762,13 @@ static void cpu_set_multi_ext_cfg(Object *obj, Visitor *v, const char *name,
|
|||
return;
|
||||
}
|
||||
|
||||
if (cpu_ext_is_deprecated(multi_ext_cfg->name)) {
|
||||
g_autofree char *lower = cpu_ext_to_lower(multi_ext_cfg->name);
|
||||
|
||||
warn_report("CPU property '%s' is deprecated. Please use '%s' instead",
|
||||
multi_ext_cfg->name, lower);
|
||||
}
|
||||
|
||||
g_hash_table_insert(multi_ext_user_opts,
|
||||
GUINT_TO_POINTER(multi_ext_cfg->offset),
|
||||
(gpointer)value);
|
||||
|
@ -776,13 +802,14 @@ static void cpu_add_multi_ext_prop(Object *cpu_obj,
|
|||
const RISCVCPUMultiExtConfig *multi_cfg)
|
||||
{
|
||||
bool generic_cpu = riscv_cpu_is_generic(cpu_obj);
|
||||
bool deprecated_ext = cpu_ext_is_deprecated(multi_cfg->name);
|
||||
|
||||
object_property_add(cpu_obj, multi_cfg->name, "bool",
|
||||
cpu_get_multi_ext_cfg,
|
||||
cpu_set_multi_ext_cfg,
|
||||
NULL, (void *)multi_cfg);
|
||||
|
||||
if (!generic_cpu) {
|
||||
if (!generic_cpu || deprecated_ext) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -825,6 +852,8 @@ static void riscv_cpu_add_user_properties(Object *obj)
|
|||
riscv_cpu_add_multiext_prop_array(obj, riscv_cpu_vendor_exts);
|
||||
riscv_cpu_add_multiext_prop_array(obj, riscv_cpu_experimental_exts);
|
||||
|
||||
riscv_cpu_add_multiext_prop_array(obj, riscv_cpu_deprecated_exts);
|
||||
|
||||
for (Property *prop = riscv_cpu_options; prop && prop->name; prop++) {
|
||||
qdev_property_add_static(DEVICE(obj), prop);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue