qemu-riscv
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v3 12/16] target/riscv: move 'cboz_blocksize' to riscv_cpu_pr


From: Alistair Francis
Subject: Re: [PATCH v3 12/16] target/riscv: move 'cboz_blocksize' to riscv_cpu_properties[]
Date: Fri, 5 Jan 2024 14:57:22 +1000

On Thu, Jan 4, 2024 at 4:56 AM Daniel Henrique Barboza
<dbarboza@ventanamicro.com> wrote:
>
> Do the same we did with 'cbom_blocksize' in the previous patch.
>
> Remove the now unused kvm_cpu_set_cbomz_blksize() setter.
>
> Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>

Alistair

> ---
>  target/riscv/cpu.c         | 38 +++++++++++++++++++++++++++++++++++++-
>  target/riscv/kvm/kvm-cpu.c | 28 ----------------------------
>  2 files changed, 37 insertions(+), 29 deletions(-)
>
> diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
> index b510cb94fc..1e35b73e40 100644
> --- a/target/riscv/cpu.c
> +++ b/target/riscv/cpu.c
> @@ -1277,6 +1277,7 @@ static void riscv_cpu_init(Object *obj)
>      cpu->cfg.vlen = 128;
>      cpu->cfg.elen = 64;
>      cpu->cfg.cbom_blocksize = 64;
> +    cpu->cfg.cboz_blocksize = 64;
>      cpu->env.vext_ver = VEXT_VERSION_1_00_0;
>  }
>
> @@ -1858,8 +1859,42 @@ static const PropertyInfo prop_cbom_blksize = {
>      .set = prop_cbom_blksize_set,
>  };
>
> +static void prop_cboz_blksize_set(Object *obj, Visitor *v, const char *name,
> +                                  void *opaque, Error **errp)
> +{
> +    RISCVCPU *cpu = RISCV_CPU(obj);
> +    uint16_t value;
> +
> +    if (!visit_type_uint16(v, name, &value, errp)) {
> +        return;
> +    }
> +
> +    if (value != cpu->cfg.cboz_blocksize && riscv_cpu_is_vendor(obj)) {
> +        cpu_set_prop_err(cpu, name, errp);
> +        error_append_hint(errp, "Current '%s' val: %u\n",
> +                          name, cpu->cfg.cboz_blocksize);
> +        return;
> +    }
> +
> +    cpu_option_add_user_setting(name, value);
> +    cpu->cfg.cboz_blocksize = value;
> +}
> +
> +static void prop_cboz_blksize_get(Object *obj, Visitor *v, const char *name,
> +                         void *opaque, Error **errp)
> +{
> +    uint16_t value = RISCV_CPU(obj)->cfg.cboz_blocksize;
> +
> +    visit_type_uint16(v, name, &value, errp);
> +}
> +
> +static const PropertyInfo prop_cboz_blksize = {
> +    .name = "cboz_blocksize",
> +    .get = prop_cboz_blksize_get,
> +    .set = prop_cboz_blksize_set,
> +};
> +
>  Property riscv_cpu_options[] = {
> -    DEFINE_PROP_UINT16("cboz_blocksize", RISCVCPU, cfg.cboz_blocksize, 64),
>
>      DEFINE_PROP_END_OF_LIST(),
>  };
> @@ -1880,6 +1915,7 @@ static Property riscv_cpu_properties[] = {
>      {.name = "elen", .info = &prop_elen},
>
>      {.name = "cbom_blocksize", .info = &prop_cbom_blksize},
> +    {.name = "cboz_blocksize", .info = &prop_cboz_blksize},
>
>  #ifndef CONFIG_USER_ONLY
>      DEFINE_PROP_UINT64("resetvec", RISCVCPU, env.resetvec, DEFAULT_RSTVEC),
> diff --git a/target/riscv/kvm/kvm-cpu.c b/target/riscv/kvm/kvm-cpu.c
> index 1866b56913..137a8ab2bb 100644
> --- a/target/riscv/kvm/kvm-cpu.c
> +++ b/target/riscv/kvm/kvm-cpu.c
> @@ -343,30 +343,6 @@ static KVMCPUConfig kvm_cboz_blocksize = {
>      .kvm_reg_id = KVM_REG_RISCV_CONFIG_REG(zicboz_block_size)
>  };
>
> -static void kvm_cpu_set_cbomz_blksize(Object *obj, Visitor *v,
> -                                      const char *name,
> -                                      void *opaque, Error **errp)
> -{
> -    KVMCPUConfig *cbomz_cfg = opaque;
> -    RISCVCPU *cpu = RISCV_CPU(obj);
> -    uint16_t value, *host_val;
> -
> -    if (!visit_type_uint16(v, name, &value, errp)) {
> -        return;
> -    }
> -
> -    host_val = kvmconfig_get_cfg_addr(cpu, cbomz_cfg);
> -
> -    if (value != *host_val) {
> -        error_report("Unable to set %s to a different value than "
> -                     "the host (%u)",
> -                     cbomz_cfg->name, *host_val);
> -        exit(EXIT_FAILURE);
> -    }
> -
> -    cbomz_cfg->user_set = true;
> -}
> -
>  static void kvm_riscv_update_cpu_cfg_isa_ext(RISCVCPU *cpu, CPUState *cs)
>  {
>      CPURISCVState *env = &cpu->env;
> @@ -484,10 +460,6 @@ static void kvm_riscv_add_cpu_user_properties(Object 
> *cpu_obj)
>                              NULL, multi_cfg);
>      }
>
> -    object_property_add(cpu_obj, "cboz_blocksize", "uint16",
> -                        NULL, kvm_cpu_set_cbomz_blksize,
> -                        NULL, &kvm_cboz_blocksize);
> -
>      riscv_cpu_add_kvm_unavail_prop_array(cpu_obj, riscv_cpu_extensions);
>      riscv_cpu_add_kvm_unavail_prop_array(cpu_obj, riscv_cpu_vendor_exts);
>      riscv_cpu_add_kvm_unavail_prop_array(cpu_obj, 
> riscv_cpu_experimental_exts);
> --
> 2.43.0
>
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]