From: Anup Patel <anup@brainfault.org>
To: Palmer Dabbelt <palmerdabbelt@google.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
"open list:RISC-V" <qemu-riscv@nongnu.org>,
Sagar Karandikar <sagark@eecs.berkeley.edu>,
Anup Patel <Anup.Patel@wdc.com>,
QEMU Developers <qemu-devel@nongnu.org>,
Atish Patra <Atish.Patra@wdc.com>,
Alistair Francis <Alistair.Francis@wdc.com>
Subject: Re: [PATCH v2 2/2] hw/riscv: Provide rdtime callback for TCG in CLINT emulation
Date: Thu, 30 Jan 2020 20:57:45 +0530 [thread overview]
Message-ID: <CAAhSdy24G9WTN42J65DfbsFXTf2vVyO8oinHD2ZoeZU311P_ng@mail.gmail.com> (raw)
In-Reply-To: <mhng-89da94b9-64c1-43e7-ae24-5a21ffc6d695@palmerdabbelt-glaptop1>
On Thu, Jan 30, 2020 at 8:19 PM Palmer Dabbelt <palmerdabbelt@google.com> wrote:
>
> On Wed, 22 Jan 2020 11:30:36 GMT (+0000), Anup Patel wrote:
> > This patch extends CLINT emulation to provide rdtime callback for
> > TCG. This rdtime callback will be called wheneven TIME CSRs are
> > read in privileged modes.
> >
> > Signed-off-by: Anup Patel <anup.patel@wdc.com>
> > Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
> > ---
> > hw/riscv/sifive_clint.c | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/hw/riscv/sifive_clint.c b/hw/riscv/sifive_clint.c
> > index e5a8f75cee..805503dc27 100644
> > --- a/hw/riscv/sifive_clint.c
> > +++ b/hw/riscv/sifive_clint.c
> > @@ -236,6 +236,7 @@ DeviceState *sifive_clint_create(hwaddr addr, hwaddr size, uint32_t num_harts,
> > if (!env) {
> > continue;
> > }
> > + riscv_cpu_set_rdtime_fn(env, cpu_riscv_read_rtc);
> > env->timer = timer_new_ns(QEMU_CLOCK_VIRTUAL,
> > &sifive_clint_timer_cb, cpu);
> > env->timecmp = 0;
> > --
> > 2.17.1
>
> Can you make this optional? Ideally via a command-line argument, but at a
> minimum as via the board configuration files. As it stands this will enable
> the direct rdtime implemnetation everywhere, and while that's sensible for the
> virt board I'd prefer to avoid changing the behavior of the sifive_u board in
> ways that differ from the hardware when that's easy.
Command-line will unnecessary make things complicated for users.
I think the better option is to make it board specific so that we can
emulate exact HW behaviour in QEMU. This way since real-world
SiFive unleashed board does not have TIME CSR even QEMU will
not emulate TIME CSR for "sifive_u" machine. For now, we should
definitely emulate TIME CSR for virt machine because of the
performance improvement.
Regards,
Anup
prev parent reply other threads:[~2020-01-30 15:28 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-22 11:30 [PATCH v2 0/2] RISC-V TIME CSR for privileged mode Anup Patel
2020-01-22 11:30 ` [PATCH v2 1/2] target/riscv: Emulate TIME CSRs " Anup Patel
2020-01-22 11:30 ` [PATCH v2 2/2] hw/riscv: Provide rdtime callback for TCG in CLINT emulation Anup Patel
2020-01-30 14:44 ` [PATCH v2 1/2] target/riscv: Emulate TIME CSRs for privileged mode Palmer Dabbelt
2020-01-30 15:22 ` Anup Patel
2020-01-30 14:49 ` [PATCH v2 2/2] hw/riscv: Provide rdtime callback for TCG in CLINT emulation Palmer Dabbelt
2020-01-30 15:27 ` Anup Patel [this message]
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=CAAhSdy24G9WTN42J65DfbsFXTf2vVyO8oinHD2ZoeZU311P_ng@mail.gmail.com \
--to=anup@brainfault.org \
--cc=Alistair.Francis@wdc.com \
--cc=Anup.Patel@wdc.com \
--cc=Atish.Patra@wdc.com \
--cc=palmerdabbelt@google.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-riscv@nongnu.org \
--cc=sagark@eecs.berkeley.edu \
/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).