qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alistair Francis <alistair23@gmail.com>
To: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Cc: qemu-devel@nongnu.org, qemu-riscv@nongnu.org,
	alistair.francis@wdc.com,  bmeng@tinylab.org,
	liwei1518@gmail.com, zhiwei_liu@linux.alibaba.com,
	 palmer@rivosinc.com, ajones@ventanamicro.com
Subject: Re: [PATCH v4 15/17] target/riscv/cpu.c: move 'mvendorid' to riscv_cpu_properties[]
Date: Fri, 12 Jan 2024 11:24:07 +1000	[thread overview]
Message-ID: <CAKmqyKNzLNS7rvw3_j37TCUFi6xXNESBC60DKg7x6OEcsSuBEQ@mail.gmail.com> (raw)
In-Reply-To: <20240105230546.265053-16-dbarboza@ventanamicro.com>

On Sat, Jan 6, 2024 at 9:09 AM Daniel Henrique Barboza
<dbarboza@ventanamicro.com> wrote:
>
> Keep all class properties in riscv_cpu_properties[].
>
> Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>

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

Alistair

> ---
>  target/riscv/cpu.c | 69 +++++++++++++++++++++++++---------------------
>  1 file changed, 37 insertions(+), 32 deletions(-)
>
> diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
> index 9d4243891c..c725a4839d 100644
> --- a/target/riscv/cpu.c
> +++ b/target/riscv/cpu.c
> @@ -1974,6 +1974,41 @@ static const PropertyInfo prop_cboz_blksize = {
>      .set = prop_cboz_blksize_set,
>  };
>
> +static void prop_mvendorid_set(Object *obj, Visitor *v, const char *name,
> +                               void *opaque, Error **errp)
> +{
> +    bool dynamic_cpu = riscv_cpu_is_dynamic(obj);
> +    RISCVCPU *cpu = RISCV_CPU(obj);
> +    uint32_t prev_val = cpu->cfg.mvendorid;
> +    uint32_t value;
> +
> +    if (!visit_type_uint32(v, name, &value, errp)) {
> +        return;
> +    }
> +
> +    if (!dynamic_cpu && prev_val != value) {
> +        error_setg(errp, "Unable to change %s mvendorid (0x%x)",
> +                   object_get_typename(obj), prev_val);
> +        return;
> +    }
> +
> +    cpu->cfg.mvendorid = value;
> +}
> +
> +static void prop_mvendorid_get(Object *obj, Visitor *v, const char *name,
> +                               void *opaque, Error **errp)
> +{
> +    uint32_t value = RISCV_CPU(obj)->cfg.mvendorid;
> +
> +    visit_type_uint32(v, name, &value, errp);
> +}
> +
> +static const PropertyInfo prop_mvendorid = {
> +    .name = "mvendorid",
> +    .get = prop_mvendorid_get,
> +    .set = prop_mvendorid_set,
> +};
> +
>  /*
>   * RVA22U64 defines some 'named features' or 'synthetic extensions'
>   * that are cache related: Za64rs, Zic64b, Ziccif, Ziccrse, Ziccamoa
> @@ -2060,6 +2095,8 @@ static Property riscv_cpu_properties[] = {
>      {.name = "cbop_blocksize", .info = &prop_cbop_blksize},
>      {.name = "cboz_blocksize", .info = &prop_cboz_blksize},
>
> +     {.name = "mvendorid", .info = &prop_mvendorid},
> +
>  #ifndef CONFIG_USER_ONLY
>      DEFINE_PROP_UINT64("resetvec", RISCVCPU, env.resetvec, DEFAULT_RSTVEC),
>  #endif
> @@ -2140,35 +2177,6 @@ static const struct SysemuCPUOps riscv_sysemu_ops = {
>  };
>  #endif
>
> -static void cpu_set_mvendorid(Object *obj, Visitor *v, const char *name,
> -                              void *opaque, Error **errp)
> -{
> -    bool dynamic_cpu = riscv_cpu_is_dynamic(obj);
> -    RISCVCPU *cpu = RISCV_CPU(obj);
> -    uint32_t prev_val = cpu->cfg.mvendorid;
> -    uint32_t value;
> -
> -    if (!visit_type_uint32(v, name, &value, errp)) {
> -        return;
> -    }
> -
> -    if (!dynamic_cpu && prev_val != value) {
> -        error_setg(errp, "Unable to change %s mvendorid (0x%x)",
> -                   object_get_typename(obj), prev_val);
> -        return;
> -    }
> -
> -    cpu->cfg.mvendorid = value;
> -}
> -
> -static void cpu_get_mvendorid(Object *obj, Visitor *v, const char *name,
> -                              void *opaque, Error **errp)
> -{
> -    uint32_t value = RISCV_CPU(obj)->cfg.mvendorid;
> -
> -    visit_type_uint32(v, name, &value, errp);
> -}
> -
>  static void cpu_set_mimpid(Object *obj, Visitor *v, const char *name,
>                             void *opaque, Error **errp)
>  {
> @@ -2278,9 +2286,6 @@ static void riscv_cpu_class_init(ObjectClass *c, void *data)
>      cc->gdb_arch_name = riscv_gdb_arch_name;
>      cc->gdb_get_dynamic_xml = riscv_gdb_get_dynamic_xml;
>
> -    object_class_property_add(c, "mvendorid", "uint32", cpu_get_mvendorid,
> -                              cpu_set_mvendorid, NULL, NULL);
> -
>      object_class_property_add(c, "mimpid", "uint64", cpu_get_mimpid,
>                                cpu_set_mimpid, NULL, NULL);
>
> --
> 2.43.0
>
>


  reply	other threads:[~2024-01-12  1:24 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-05 23:05 [PATCH v4 00/17] target/riscv: deprecate riscv_cpu_options[] Daniel Henrique Barboza
2024-01-05 23:05 ` [PATCH v4 01/17] target/riscv/cpu_cfg.h: remove unused fields Daniel Henrique Barboza
2024-01-05 23:05 ` [PATCH v4 02/17] target/riscv: make riscv_cpu_is_vendor() public Daniel Henrique Barboza
2024-01-05 23:05 ` [PATCH v4 03/17] target/riscv: move 'pmu-mask' and 'pmu-num' to riscv_cpu_properties[] Daniel Henrique Barboza
2024-01-05 23:05 ` [PATCH v4 04/17] target/riscv: move 'mmu' " Daniel Henrique Barboza
2024-01-05 23:05 ` [PATCH v4 05/17] target/riscv: move 'pmp' " Daniel Henrique Barboza
2024-01-05 23:05 ` [PATCH v4 06/17] target/riscv: rework 'priv_spec' Daniel Henrique Barboza
2024-01-05 23:05 ` [PATCH v4 07/17] target/riscv: rework 'vext_spec' Daniel Henrique Barboza
2024-01-05 23:05 ` [PATCH v4 08/17] target/riscv: move 'vlen' to riscv_cpu_properties[] Daniel Henrique Barboza
2024-01-05 23:05 ` [PATCH v4 09/17] target/riscv: move 'elen' " Daniel Henrique Barboza
2024-01-05 23:05 ` [PATCH v4 10/17] target/riscv: create finalize_features() for KVM Daniel Henrique Barboza
2024-01-11 23:33   ` Alistair Francis
2024-01-05 23:05 ` [PATCH v4 11/17] target/riscv: move 'cbom_blocksize' to riscv_cpu_properties[] Daniel Henrique Barboza
2024-01-05 23:05 ` [PATCH v4 12/17] target/riscv: move 'cbop_blocksize' " Daniel Henrique Barboza
2024-01-11 23:44   ` Alistair Francis
2024-01-05 23:05 ` [PATCH v4 13/17] target/riscv: move 'cboz_blocksize' " Daniel Henrique Barboza
2024-01-05 23:05 ` [PATCH v4 14/17] target/riscv: remove riscv_cpu_options[] Daniel Henrique Barboza
2024-01-05 23:05 ` [PATCH v4 15/17] target/riscv/cpu.c: move 'mvendorid' to riscv_cpu_properties[] Daniel Henrique Barboza
2024-01-12  1:24   ` Alistair Francis [this message]
2024-01-05 23:05 ` [PATCH v4 16/17] target/riscv/cpu.c: move 'mimpid' " Daniel Henrique Barboza
2024-01-12  1:29   ` Alistair Francis
2024-01-05 23:05 ` [PATCH v4 17/17] target/riscv/cpu.c: move 'marchid' " Daniel Henrique Barboza
2024-01-12  1:37   ` Alistair Francis
2024-01-09 16:35 ` [PATCH v4 00/17] target/riscv: deprecate riscv_cpu_options[] Vladimir Isaev
2024-01-12  3:16 ` Alistair Francis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAKmqyKNzLNS7rvw3_j37TCUFi6xXNESBC60DKg7x6OEcsSuBEQ@mail.gmail.com \
    --to=alistair23@gmail.com \
    --cc=ajones@ventanamicro.com \
    --cc=alistair.francis@wdc.com \
    --cc=bmeng@tinylab.org \
    --cc=dbarboza@ventanamicro.com \
    --cc=liwei1518@gmail.com \
    --cc=palmer@rivosinc.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-riscv@nongnu.org \
    --cc=zhiwei_liu@linux.alibaba.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).