qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Vladimir Isaev <vladimir.isaev@syntacore.com>
To: <qemu-riscv@nongnu.org>
Cc: <qemu-devel@nongnu.org>, <dbarboza@ventanamicro.com>,
	<zhiwei_liu@linux.alibaba.com>, <liwei1518@gmail.com>,
	<bin.meng@windriver.com>, <alistair.francis@wdc.com>,
	<palmer@dabbelt.com>,
	Vladimir Isaev <vladimir.isaev@syntacore.com>
Subject: [PATCH] target/riscv/tcg: do not set defaults for non-generic
Date: Fri, 29 Dec 2023 11:02:52 +0300	[thread overview]
Message-ID: <20231229080302.125418-1-vladimir.isaev@syntacore.com> (raw)

riscv_cpu_options[] are exported using qdev and some of them are defined
with default values. This is unfortunate since riscv_cpu_add_user_properties()
is called after CPU instance init and there is no clear way to disable MMU/PMP
for some CPUs.

Can't define them as NODEFAULT since we still need defaults for generic CPU.

Signed-off-by: Vladimir Isaev <vladimir.isaev@syntacore.com>
---
 target/riscv/tcg/tcg-cpu.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/target/riscv/tcg/tcg-cpu.c b/target/riscv/tcg/tcg-cpu.c
index 8a35683a345d..9ffce1c9f7b0 100644
--- a/target/riscv/tcg/tcg-cpu.c
+++ b/target/riscv/tcg/tcg-cpu.c
@@ -937,6 +937,8 @@ static void riscv_cpu_add_multiext_prop_array(Object *obj,
  */
 static void riscv_cpu_add_user_properties(Object *obj)
 {
+    bool use_def_vals = riscv_cpu_is_generic(obj);
+
 #ifndef CONFIG_USER_ONLY
     riscv_add_satp_mode_properties(obj);
 #endif
@@ -950,6 +952,8 @@ static void riscv_cpu_add_user_properties(Object *obj)
     riscv_cpu_add_multiext_prop_array(obj, riscv_cpu_deprecated_exts);
 
     for (Property *prop = riscv_cpu_options; prop && prop->name; prop++) {
+        prop->set_default = prop->set_default && use_def_vals;
+
         qdev_property_add_static(DEVICE(obj), prop);
     }
 }
-- 
2.43.0



             reply	other threads:[~2023-12-29  8:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-29  8:02 Vladimir Isaev [this message]
2023-12-29  9:15 ` [PATCH] target/riscv/tcg: do not set defaults for non-generic Daniel Henrique Barboza
2023-12-29  9:54   ` Vladimir Isaev

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=20231229080302.125418-1-vladimir.isaev@syntacore.com \
    --to=vladimir.isaev@syntacore.com \
    --cc=alistair.francis@wdc.com \
    --cc=bin.meng@windriver.com \
    --cc=dbarboza@ventanamicro.com \
    --cc=liwei1518@gmail.com \
    --cc=palmer@dabbelt.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).