* [PATCH] hw/riscv: Setting address of vector reset is improved
@ 2022-08-15 17:30 Maksim Perov
0 siblings, 0 replies; 3+ messages in thread
From: Maksim Perov @ 2022-08-15 17:30 UTC (permalink / raw)
To: qemu-riscv, qemu-devel; +Cc: Maksim Perov
Previously address is set by default value 0x1000 which is hardcoded in target/riscv/cpu_bits.h
If add to new RISC-V Machine in which ROM area is based on 0x1000 address than there is problem of running simulation
Signed-off-by: Maksim Perov <coder@frtk.ru>
---
hw/riscv/boot.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/hw/riscv/boot.c b/hw/riscv/boot.c
index 06b4fc5ac3..5e2438d39a 100644
--- a/hw/riscv/boot.c
+++ b/hw/riscv/boot.c
@@ -327,6 +327,10 @@ void riscv_setup_rom_reset_vec(MachineState *machine, RISCVHartArrayState *harts
riscv_rom_copy_firmware_info(machine, rom_base, rom_size, sizeof(reset_vec),
kernel_entry);
+ /* change reset vector address */
+ for (i = 0; i < harts->num_harts; i++) {
+ harts->harts[i].env.resetvec = rom_base;
+ }
return;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* [PATCH] hw/riscv: Setting address of vector reset is improved
@ 2022-08-15 17:41 Maksim Perov
2022-08-15 23:47 ` Alistair Francis
0 siblings, 1 reply; 3+ messages in thread
From: Maksim Perov @ 2022-08-15 17:41 UTC (permalink / raw)
To: qemu-riscv, qemu-devel; +Cc: Maksim Perov
Previously address is set by default value 0x1000 which is hardcoded in target/riscv/cpu_bits.h
If add to new RISC-V Machine in which ROM area is not based on 0x1000 address than there is problem of running simulation
Signed-off-by: Maksim Perov <coder@frtk.ru>
---
hw/riscv/boot.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/hw/riscv/boot.c b/hw/riscv/boot.c
index 06b4fc5ac3..5e2438d39a 100644
--- a/hw/riscv/boot.c
+++ b/hw/riscv/boot.c
@@ -327,6 +327,10 @@ void riscv_setup_rom_reset_vec(MachineState *machine, RISCVHartArrayState *harts
riscv_rom_copy_firmware_info(machine, rom_base, rom_size, sizeof(reset_vec),
kernel_entry);
+ /* change reset vector address */
+ for (i = 0; i < harts->num_harts; i++) {
+ harts->harts[i].env.resetvec = rom_base;
+ }
return;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] hw/riscv: Setting address of vector reset is improved
2022-08-15 17:41 Maksim Perov
@ 2022-08-15 23:47 ` Alistair Francis
0 siblings, 0 replies; 3+ messages in thread
From: Alistair Francis @ 2022-08-15 23:47 UTC (permalink / raw)
To: Maksim Perov; +Cc: open list:RISC-V, qemu-devel@nongnu.org Developers
On Tue, Aug 16, 2022 at 6:15 AM Maksim Perov <coder@frtk.ru> wrote:
>
> Previously address is set by default value 0x1000 which is hardcoded in target/riscv/cpu_bits.h
> If add to new RISC-V Machine in which ROM area is not based on 0x1000 address than there is problem of running simulation
>
> Signed-off-by: Maksim Perov <coder@frtk.ru>
> ---
> hw/riscv/boot.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/hw/riscv/boot.c b/hw/riscv/boot.c
> index 06b4fc5ac3..5e2438d39a 100644
> --- a/hw/riscv/boot.c
> +++ b/hw/riscv/boot.c
> @@ -327,6 +327,10 @@ void riscv_setup_rom_reset_vec(MachineState *machine, RISCVHartArrayState *harts
> riscv_rom_copy_firmware_info(machine, rom_base, rom_size, sizeof(reset_vec),
> kernel_entry);
>
> + /* change reset vector address */
> + for (i = 0; i < harts->num_harts; i++) {
> + harts->harts[i].env.resetvec = rom_base;
> + }
Thanks for the patch!
We don't want to do this though. The reset vector is part of the
hardware design, we don't want to change the reset vector based on the
software that is loaded.
The reset vector is exposed as a property (resetvec) and can be
configured from a board. You could also configure it from the command
line if you wanted to (although it might be overridden, I haven't
checked).
Alistair
> return;
> }
>
> --
> 2.17.1
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-08-15 23:49 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-15 17:30 [PATCH] hw/riscv: Setting address of vector reset is improved Maksim Perov
-- strict thread matches above, loose matches on Subject: below --
2022-08-15 17:41 Maksim Perov
2022-08-15 23:47 ` Alistair Francis
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).