qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Weiwei Li <liweiwei@iscas.ac.cn>
To: Tommy Wu <tommy.wu@sifive.com>
Cc: liweiwei@iscas.ac.cn, qemu-devel@nongnu.org,
	qemu-riscv@nongnu.org, frank.chang@sifive.com,
	alistair.francis@wdc.com, apatel@ventanamicro.com,
	palmer@rivosinc.com, dbarboza@ventanamicro.com,
	bin.meng@windriver.com, zhiwei_liu@linux.alibaba.com
Subject: Re: [PATCH 2/2] hw/intc: riscv_imsic: Refresh the CSRs xml after updating the state of the cpu.
Date: Wed, 24 May 2023 10:34:28 +0800	[thread overview]
Message-ID: <858ea86b-0bd7-5101-2948-6d3f5aa55aec@iscas.ac.cn> (raw)
In-Reply-To: <CANj3q_nn5puBEdfzCgwUtT9bkhUUzopf-2qa0xC7LcRs_i_uhw@mail.gmail.com>


On 2023/5/24 09:51, Tommy Wu wrote:
> Hi Weiwei Li,
> Yes, you're right,  `riscv_refresh_dynamic_csr_xml()`  can only be 
> called when
> cpu->dyn_csr_xml isn't a NULL pointer here.
>
> The cpu->dyn_csr_xml will be set when the cpu is realized.

Yeah, It will  be set only when Zicsr is supported.  And I think aia 
requires Zicsr.

However, another question:  whether we should add a check in 
riscv_imsic.c that it requires Zicsr?

Regards,

Weiwei Li

>
> Best Regards,
> Tommy
>
>
> On Tue, May 23, 2023 at 10:44 PM Weiwei Li <liweiwei@iscas.ac.cn> wrote:
>
>
>     On 2023/5/23 19:44, Tommy Wu wrote:
>     > Originally, when we set the ext_smaia to true, we still cannot
>     print the
>     > AIA CSRs in the remote gdb debugger, because the dynamic CSR xml is
>     > generated when the cpu is realized.
>     >
>     > This patch refreshes the dynamic CSR xml after we update the
>     ext_smaia,
>     > so that we can print the AIA CSRs in the remote gdb debugger.
>     >
>     > Signed-off-by: Tommy Wu <tommy.wu@sifive.com>
>     > Reviewed-by: Frank Chang <frank.chang@sifive.com>
>     > ---
>     >   hw/intc/riscv_imsic.c | 4 ++++
>     >   1 file changed, 4 insertions(+)
>     >
>     > diff --git a/hw/intc/riscv_imsic.c b/hw/intc/riscv_imsic.c
>     > index fea3385b51..97a51d535b 100644
>     > --- a/hw/intc/riscv_imsic.c
>     > +++ b/hw/intc/riscv_imsic.c
>     > @@ -350,6 +350,10 @@ static void riscv_imsic_realize(DeviceState
>     *dev, Error **errp)
>     >           } else {
>     >               rcpu->cfg.ext_smaia = true;
>     >           }
>     > +
>     > +        /* Refresh the dynamic csr xml for the gdbstub. */
>     > +        riscv_refresh_dynamic_csr_xml(cpu);
>     > +
>
>     There is an assert in riscv_refresh_dynamic_csr_xml():
>
>     +    if (!cpu->dyn_csr_xml) {
>     +        g_assert_not_reached();
>     +    }
>
>     So I think riscv_refresh_dynamic_csr_xml() can only be called when
>     cpu->dyn_csr_xml is true here.
>
>     Regards,
>
>     Weiwei Li
>
>     >           riscv_cpu_set_aia_ireg_rmw_fn(env, (imsic->mmode) ?
>     PRV_M : PRV_S,
>     >                                         riscv_imsic_rmw, imsic);
>     >       }
>



  reply	other threads:[~2023-05-24  2:35 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-23 11:44 [PATCH 0/2] Refresh the dynamic CSR xml after updating the state of the cpu Tommy Wu
2023-05-23 11:44 ` [PATCH 1/2] target/riscv: Add a function to refresh the dynamic CSRs xml Tommy Wu
2023-05-23 14:37   ` Weiwei Li
2023-05-24  1:59     ` Tommy Wu
2023-05-24  2:10       ` Weiwei Li
2023-05-24  5:35         ` Tommy Wu
2023-05-24  6:18           ` Weiwei Li
2023-05-25  2:33   ` Alistair Francis
2023-06-09  8:37     ` Tommy Wu
2023-06-12  2:52       ` Alistair Francis
2023-05-23 11:44 ` [PATCH 2/2] hw/intc: riscv_imsic: Refresh the CSRs xml after updating the state of the cpu Tommy Wu
2023-05-23 14:43   ` Weiwei Li
2023-05-24  1:51     ` Tommy Wu
2023-05-24  2:34       ` Weiwei Li [this message]
2023-05-24  5:46         ` Tommy Wu

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=858ea86b-0bd7-5101-2948-6d3f5aa55aec@iscas.ac.cn \
    --to=liweiwei@iscas.ac.cn \
    --cc=alistair.francis@wdc.com \
    --cc=apatel@ventanamicro.com \
    --cc=bin.meng@windriver.com \
    --cc=dbarboza@ventanamicro.com \
    --cc=frank.chang@sifive.com \
    --cc=palmer@rivosinc.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-riscv@nongnu.org \
    --cc=tommy.wu@sifive.com \
    --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).