target/riscv/cpu.c: add riscv_cpu_add_qdev_prop_array()
The code inside riscv_cpu_add_user_properties() became quite repetitive after recent changes. Add a helper to hide the repetition away. Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com> Reviewed-by: Andrew Jones <ajones@ventanamicro.com> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-ID: <20230912132423.268494-8-dbarboza@ventanamicro.com> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
This commit is contained in:
parent
82822b5d5a
commit
370d7c8ef8
@ -1928,6 +1928,15 @@ static Property riscv_cpu_options[] = {
|
||||
DEFINE_PROP_END_OF_LIST(),
|
||||
};
|
||||
|
||||
static void riscv_cpu_add_qdev_prop_array(DeviceState *dev, Property *array)
|
||||
{
|
||||
g_assert(array);
|
||||
|
||||
for (Property *prop = array; prop && prop->name; prop++) {
|
||||
qdev_property_add_static(dev, prop);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CONFIG_KVM
|
||||
static void cpu_set_cfg_unavailable(Object *obj, Visitor *v,
|
||||
const char *name,
|
||||
@ -2001,7 +2010,6 @@ void kvm_riscv_cpu_add_kvm_properties(Object *obj)
|
||||
*/
|
||||
static void riscv_cpu_add_user_properties(Object *obj)
|
||||
{
|
||||
Property *prop;
|
||||
DeviceState *dev = DEVICE(obj);
|
||||
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
@ -2015,21 +2023,10 @@ static void riscv_cpu_add_user_properties(Object *obj)
|
||||
|
||||
riscv_cpu_add_misa_properties(obj);
|
||||
|
||||
for (prop = riscv_cpu_extensions; prop && prop->name; prop++) {
|
||||
qdev_property_add_static(dev, prop);
|
||||
}
|
||||
|
||||
for (prop = riscv_cpu_options; prop && prop->name; prop++) {
|
||||
qdev_property_add_static(dev, prop);
|
||||
}
|
||||
|
||||
for (prop = riscv_cpu_vendor_exts; prop && prop->name; prop++) {
|
||||
qdev_property_add_static(dev, prop);
|
||||
}
|
||||
|
||||
for (prop = riscv_cpu_experimental_exts; prop && prop->name; prop++) {
|
||||
qdev_property_add_static(dev, prop);
|
||||
}
|
||||
riscv_cpu_add_qdev_prop_array(dev, riscv_cpu_extensions);
|
||||
riscv_cpu_add_qdev_prop_array(dev, riscv_cpu_options);
|
||||
riscv_cpu_add_qdev_prop_array(dev, riscv_cpu_vendor_exts);
|
||||
riscv_cpu_add_qdev_prop_array(dev, riscv_cpu_experimental_exts);
|
||||
}
|
||||
|
||||
static Property riscv_cpu_properties[] = {
|
||||
|
Loading…
Reference in New Issue
Block a user