From: Alistair Francis <alistair23@gmail.com>
To: Djordje Todorovic <Djordje.Todorovic@htecgroup.com>
Cc: "qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
"qemu-riscv@nongnu.org" <qemu-riscv@nongnu.org>,
"cfu@mips.com" <cfu@mips.com>, "mst@redhat.com" <mst@redhat.com>,
"marcel.apfelbaum@gmail.com" <marcel.apfelbaum@gmail.com>,
"dbarboza@ventanamicro.com" <dbarboza@ventanamicro.com>,
"philmd@linaro.org" <philmd@linaro.org>
Subject: Re: [PATCH v9 02/13] target/riscv: Add cpu_set_exception_base
Date: Thu, 2 Oct 2025 11:25:04 +1000 [thread overview]
Message-ID: <CAKmqyKNvLrdgXFe9Tu-f6V70Cv5piNwNVT8nQZGLt35vAfOGbw@mail.gmail.com> (raw)
In-Reply-To: <20251001094859.2030290-3-djordje.todorovic@htecgroup.com>
On Wed, Oct 1, 2025 at 7:49 PM Djordje Todorovic
<Djordje.Todorovic@htecgroup.com> wrote:
>
> Add a new function, so we can change reset vector from platforms
> during runtime.
>
> Signed-off-by: Chao-ying Fu <cfu@mips.com>
> Signed-off-by: Djordje Todorovic <djordje.todorovic@htecgroup.com>
> Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
> ---
> target/riscv/cpu.c | 14 ++++++++++++++
> target/riscv/cpu.h | 4 ++++
> 2 files changed, 18 insertions(+)
>
> diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
> index d055ddf462..74728c5371 100644
> --- a/target/riscv/cpu.c
> +++ b/target/riscv/cpu.c
> @@ -73,6 +73,20 @@ bool riscv_cpu_option_set(const char *optname)
> return g_hash_table_contains(general_user_opts, optname);
> }
>
> +#ifndef CONFIG_USER_ONLY
> +void cpu_set_exception_base(int vp_index, target_ulong address)
This should probably have some documentation saying that it's only for
runtime usage
Alistair
> +{
> + CPUState *cpu_state = qemu_get_cpu(vp_index);
> + if (cpu_state == NULL) {
> + qemu_log_mask(LOG_GUEST_ERROR,
> + "cpu_set_exception_base: invalid vp_index: %u",
> + vp_index);
> + }
> + RISCVCPU *vp = RISCV_CPU(cpu_state);
> + vp->env.resetvec = address;
> +}
> +#endif
> +
> static void riscv_cpu_cfg_merge(RISCVCPUConfig *dest, const RISCVCPUConfig *src)
> {
> #define BOOL_FIELD(x) dest->x |= src->x;
> diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h
> index 4a862da615..34751bd414 100644
> --- a/target/riscv/cpu.h
> +++ b/target/riscv/cpu.h
> @@ -672,6 +672,10 @@ G_NORETURN void riscv_raise_exception(CPURISCVState *env,
> target_ulong riscv_cpu_get_fflags(CPURISCVState *env);
> void riscv_cpu_set_fflags(CPURISCVState *env, target_ulong);
>
> +#ifndef CONFIG_USER_ONLY
> +void cpu_set_exception_base(int vp_index, target_ulong address);
> +#endif
> +
> FIELD(TB_FLAGS, MEM_IDX, 0, 3)
> FIELD(TB_FLAGS, FS, 3, 2)
> /* Vector flags */
> --
> 2.34.1
next prev parent reply other threads:[~2025-10-02 1:28 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-01 9:49 [PATCH v9 00/13] riscv: Add support for MIPS P8700 CPU Djordje Todorovic
2025-10-01 9:49 ` [PATCH v9 01/13] hw/intc: Allow gaps in hartids for aclint and aplic Djordje Todorovic
2025-10-01 9:49 ` [PATCH v9 02/13] target/riscv: Add cpu_set_exception_base Djordje Todorovic
2025-10-02 1:25 ` Alistair Francis [this message]
2025-10-03 10:40 ` Djordje Todorovic
2025-10-01 9:49 ` [PATCH v9 04/13] target/riscv: Add MIPS P8700 CSRs Djordje Todorovic
2025-10-01 9:49 ` [PATCH v9 03/13] target/riscv: Add MIPS P8700 CPU Djordje Todorovic
2025-10-01 9:49 ` [PATCH v9 07/13] target/riscv: Add Xmipslsp instructions Djordje Todorovic
2025-10-02 1:35 ` Alistair Francis
2025-10-01 9:49 ` [PATCH v9 06/13] target/riscv: Add mips.pref instruction Djordje Todorovic
2025-10-02 1:31 ` Alistair Francis
2025-10-01 9:49 ` [PATCH v9 05/13] target/riscv: Add mips.ccmov instruction Djordje Todorovic
2025-10-01 9:49 ` [PATCH v9 09/13] hw/misc: Add RISC-V CPC device implementation Djordje Todorovic
2025-10-01 9:49 ` [PATCH v9 08/13] hw/misc: Add RISC-V CMGCR " Djordje Todorovic
2025-10-01 9:49 ` [PATCH v9 11/13] hw/riscv: Add support for MIPS Boston-aia board mode Djordje Todorovic
2025-10-01 9:49 ` [PATCH v9 10/13] hw/riscv: Add support for RISCV CPS Djordje Todorovic
2025-10-01 9:49 ` [PATCH v9 12/13] riscv/boston-aia: Add an e1000e NIC in slot 0 func 1 Djordje Todorovic
2025-10-01 9:49 ` [PATCH v9 13/13] test/functional: Add test for boston-aia board Djordje Todorovic
2025-10-01 11:15 ` Thomas Huth
2025-10-03 10:31 ` Djordje Todorovic
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=CAKmqyKNvLrdgXFe9Tu-f6V70Cv5piNwNVT8nQZGLt35vAfOGbw@mail.gmail.com \
--to=alistair23@gmail.com \
--cc=Djordje.Todorovic@htecgroup.com \
--cc=cfu@mips.com \
--cc=dbarboza@ventanamicro.com \
--cc=marcel.apfelbaum@gmail.com \
--cc=mst@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-riscv@nongnu.org \
/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).