[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v5 1/2] riscv: Pass Object to register_cpu_props instead of D
From: |
Alistair Francis |
Subject: |
Re: [PATCH v5 1/2] riscv: Pass Object to register_cpu_props instead of DeviceState |
Date: |
Mon, 16 Jan 2023 14:06:48 +1000 |
On Fri, Jan 13, 2023 at 8:36 PM Alexandre Ghiti <alexghiti@rivosinc.com> wrote:
>
> One can extract the DeviceState pointer from the Object pointer, so pass
> the Object for future commits to access other fields of Object.
>
> No functional changes intended.
>
> Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Alistair
> ---
> target/riscv/cpu.c | 15 ++++++++-------
> 1 file changed, 8 insertions(+), 7 deletions(-)
>
> diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
> index cc75ca7667..7181b34f86 100644
> --- a/target/riscv/cpu.c
> +++ b/target/riscv/cpu.c
> @@ -200,7 +200,7 @@ static const char * const riscv_intr_names[] = {
> "reserved"
> };
>
> -static void register_cpu_props(DeviceState *dev);
> +static void register_cpu_props(Object *obj);
>
> const char *riscv_cpu_get_trap_name(target_ulong cause, bool async)
> {
> @@ -238,7 +238,7 @@ static void riscv_any_cpu_init(Object *obj)
> set_misa(env, MXL_RV64, RVI | RVM | RVA | RVF | RVD | RVC | RVU);
> #endif
> set_priv_version(env, PRIV_VERSION_1_12_0);
> - register_cpu_props(DEVICE(obj));
> + register_cpu_props(obj);
> }
>
> #if defined(TARGET_RISCV64)
> @@ -247,7 +247,7 @@ static void rv64_base_cpu_init(Object *obj)
> CPURISCVState *env = &RISCV_CPU(obj)->env;
> /* We set this in the realise function */
> set_misa(env, MXL_RV64, 0);
> - register_cpu_props(DEVICE(obj));
> + register_cpu_props(obj);
> /* Set latest version of privileged specification */
> set_priv_version(env, PRIV_VERSION_1_12_0);
> }
> @@ -280,7 +280,7 @@ static void rv128_base_cpu_init(Object *obj)
> CPURISCVState *env = &RISCV_CPU(obj)->env;
> /* We set this in the realise function */
> set_misa(env, MXL_RV128, 0);
> - register_cpu_props(DEVICE(obj));
> + register_cpu_props(obj);
> /* Set latest version of privileged specification */
> set_priv_version(env, PRIV_VERSION_1_12_0);
> }
> @@ -290,7 +290,7 @@ static void rv32_base_cpu_init(Object *obj)
> CPURISCVState *env = &RISCV_CPU(obj)->env;
> /* We set this in the realise function */
> set_misa(env, MXL_RV32, 0);
> - register_cpu_props(DEVICE(obj));
> + register_cpu_props(obj);
> /* Set latest version of privileged specification */
> set_priv_version(env, PRIV_VERSION_1_12_0);
> }
> @@ -343,7 +343,7 @@ static void riscv_host_cpu_init(Object *obj)
> #elif defined(TARGET_RISCV64)
> set_misa(env, MXL_RV64, 0);
> #endif
> - register_cpu_props(DEVICE(obj));
> + register_cpu_props(obj);
> }
> #endif
>
> @@ -1083,9 +1083,10 @@ static Property riscv_cpu_extensions[] = {
> DEFINE_PROP_END_OF_LIST(),
> };
>
> -static void register_cpu_props(DeviceState *dev)
> +static void register_cpu_props(Object *obj)
> {
> Property *prop;
> + DeviceState *dev = DEVICE(obj);
>
> for (prop = riscv_cpu_extensions; prop && prop->name; prop++) {
> qdev_property_add_static(dev, prop);
> --
> 2.37.2
>
>
- [PATCH v5 0/2] riscv: Allow user to set the satp mode, Alexandre Ghiti, 2023/01/13
- [PATCH v5 1/2] riscv: Pass Object to register_cpu_props instead of DeviceState, Alexandre Ghiti, 2023/01/13
- [PATCH v5 2/2] riscv: Allow user to set the satp mode, Alexandre Ghiti, 2023/01/13
- Re: [PATCH v5 2/2] riscv: Allow user to set the satp mode, Andrew Jones, 2023/01/17
- Re: [PATCH v5 2/2] riscv: Allow user to set the satp mode, Alistair Francis, 2023/01/17
- Re: [PATCH v5 2/2] riscv: Allow user to set the satp mode, Andrew Jones, 2023/01/18
- Re: [PATCH v5 2/2] riscv: Allow user to set the satp mode, Alistair Francis, 2023/01/18
- Re: [PATCH v5 2/2] riscv: Allow user to set the satp mode, Alexandre Ghiti, 2023/01/19
- Re: [PATCH v5 2/2] riscv: Allow user to set the satp mode, Andrew Jones, 2023/01/19
- Re: [PATCH v5 2/2] riscv: Allow user to set the satp mode, Alistair Francis, 2023/01/19