RISC-V - Dynamic parameterization of RISC-V memory map
Subsystems (2)
PATCH 1/1 RISC-V - Dynamic parameterization of RISC-V memory map
Memory parameters for RISC-V boards can be read from a configuration file using the -readconfig command line option. The configuration file should have a section for the board and memory. The configuration for the VirtIO board has the following configuration variables:
[riscv-virt-mem]
debug-base = "0x0" debug-size = "0x100" mrom-base = "0x1000" mrom-size = "0x11000" test-base = "0x100000" test-size = "0x1000" clint-base = "0x2000000" clint-size = "0x10000" plic-base = "0xc000000" plic-size = "0x4000000" uart0-base = "0x10000000" uart0-size = "0x100" virtio-base = "0x10001000" virtio-size = "0x1000" dram-base = "0x80000000" dram-size = "0x0"
Values must be enclosed within quotes.
Signature · 2 lines
Michael Eager [email protected] 1960 Park Blvd., Palo Alto, CA 94306
Quoted 1 line
From
8011b74e7eadc1b8113d8bdf347ab8ea29d19da8Mon Sep 17 00:00:00 2001
From: Michael Eager <[email protected]>
Date: Thu, 23 Aug 2018 16:58:27 -0700
Subject: [PATCH] RISC-V - Dynamic parameterization of RISC-V memory map
Memory parameters for RISC-V boards can be read from a configuration file using the -readconfig command line option. The configuration file should have a section for the board and memory. The configuration for the VirtIO board has the following configuration variables:
[riscv-virt-mem]
debug-base = "0x0" debug-size = "0x100" mrom-base = "0x1000" mrom-size = "0x11000" test-base = "0x100000" test-size = "0x1000" clint-base = "0x2000000" clint-size = "0x10000" plic-base = "0xc000000" plic-size = "0x4000000" uart0-base = "0x10000000" uart0-size = "0x100" virtio-base = "0x10001000" virtio-size = "0x1000" dram-base = "0x80000000" dram-size = "0x0"
Values must be enclosed within quotes.
--- hw/riscv/riscv.config | 89 +++++++++++++++++++++++++++++++++++++++++ hw/riscv/sifive_e.c | 109 ++++++++++++++++++++++++++++++++++++++++---------- hw/riscv/sifive_u.c | 109 +++++++++++++++++++++++++++++++++++++++++++++----- hw/riscv/spike.c | 75 ++++++++++++++++++++++++++++++++-- hw/riscv/virt.c | 85 ++++++++++++++++++++++++++++++++++----- 5 files changed, 423 insertions(+), 44 deletions(-) create mode 100644 hw/riscv/riscv.config
hw/riscv/riscv.config new file +89 -0
@@ -0,0 +1,89 @@ +# Memory map for RISC-V VirtIO board +[riscv-virt-mem] + debug-base = "0x0" + debug-size = "0x100" + mrom-base = "0x1000" + mrom-size = "0x11000" + test-base = "0x100000" + test-size = "0x1000" + clint-base = "0x2000000" + clint-size = "0x10000" + plic-base = "0xc000000" + plic-size = "0x4000000" + uart0-base = "0x10000000" + uart0-size = "0x100" + virtio-base = "0x10001000" + virtio-size = "0x1000" + dram-base = "0x80000000" + dram-size = "0x0" + +# Memory map for RISC-V Sifive E board +[riscv-sifive-e-mem] + debug-base = "0x0" + debug-size = "0x100" + mrom-base = "0x1000" + mrom-size = "0x2000" + otp-base = "0x20000" + otp-size = "0x2000" + test-base = "0x100000" + test-size = "0x1000" + clint-base = "0x2000000" + clint-size = "0x10000" + plic-base = "0xc000000" + plic-size = "0x4000000" + aon-base = "0x10000000" + aon-size = "0x8000" + prci-base = "0x10008000" + prci-size = "0x8000" + otp_ctrl-base = "0x10010000" + otp_ctrl-size = "0x1000" + gpio0-base = "0x10012000" + gpio0-size = "0x1000" + uart0-base = "0x10013000" + uart0-size = "0x1000" + qspi0-base = "0x10014000" + qspi0-size = "0x1000" + pwm0-base = "0x10015000" + pwm0-size = "0x1000" + uart1-base = "0x10023000" + uart1-size = "0x1000" + qspi1-base = "0x10024000" + qspi1-size = "0x1000" + pwm1-base = "0x10025000" + pwm1-size = "0x1000" + qspi2-base = "0x10034000" + qspi2-size = "0x1000" + pwm2-base = "0x10035000" + pwm2-size = "0x1000" + xip-base = "0x20000000" + xip-size = "0x20000000" + dtim-base = " 0x80000000" + dtim-size = "0x4000" + +[riscv-sifive-u-mem] + debug-base = "0x0" + debug-size = "0x100" + mrom-base = "0x1000" + mrom-size = "0x11000" + test-base = "0x100000" + test-size = "0x1000" + clint-base = "0x2000000" + clint-size = "0x10000" + plic-base = "0xc000000" + plic-size = "0x4000000" + uart0-base = "0x10013000" + uart0-size = "0x1000" + uart1-base = "0x10023000" + uart1-size = "0x1000" + dram-base = "0x80000000" + dram-size = "0x0" + gem-base = "0x100900FC" + gem-size = "0x2000" + +[riscv-spike-mem] + mrom-base = "0x1000" + mrom-spike = "0x11000" + clint-base = "0x2000000" + clint-spike = "0x10000" + dram-base = "0x80000000" + dram-spike = "0x0"
hw/riscv/sifive_e.c +88 -21
135 lines not on this page · raw message
hw/riscv/sifive_u.c +99 -10
137 lines not on this page · raw message
hw/riscv/spike.c +71 -4
101 lines not on this page · raw message
hw/riscv/virt.c +76 -9
111 lines not on this page · raw message
Signature · 1 line
1.8.3.1
Whoops. I just noticed that this patch is against the riscv-qemu
repo on github, not the qemu.org repo. I will rework it for the qemu.org repo. Meanwhile, I welcome any comments.
Quoted 26 lines · Michael Eager
Memory parameters for RISC-V boards can be read from a configuration file using the -readconfig command line option. The configuration file should have a section for the board and memory. The configuration for the VirtIO board has the following configuration variables:
[riscv-virt-mem]
debug-base = "0x0"
debug-size = "0x100"
mrom-base = "0x1000"
mrom-size = "0x11000"
test-base = "0x100000"
test-size = "0x1000"
clint-base = "0x2000000"
clint-size = "0x10000"
plic-base = "0xc000000"
plic-size = "0x4000000"
uart0-base = "0x10000000"
uart0-size = "0x100"
virtio-base = "0x10001000"
virtio-size = "0x1000"
dram-base = "0x80000000"
dram-size = "0x0"Values must be enclosed within quotes.
Signed-off-by Michael Eager <[email protected]>
Signature · 2 lines
Michael Eager [email protected] 1960 Park Blvd., Palo Alto, CA 94306
Corrected patch attached.
Quoted 31 lines · Michael Eager
Whoops. I just noticed that this patch is against the riscv-qemu
repo on github, not the qemu.org repo. I will rework it for the qemu.org repo. Meanwhile, I welcome any comments.Quoted 26 lines · Michael Eager
Memory parameters for RISC-V boards can be read from a configuration file using the -readconfig command line option. The configuration file should have a section for the board and memory. The configuration for the VirtIO board has the following configuration variables:
[riscv-virt-mem]
debug-base = "0x0"
debug-size = "0x100"
mrom-base = "0x1000"
mrom-size = "0x11000"
test-base = "0x100000"
test-size = "0x1000"
clint-base = "0x2000000"
clint-size = "0x10000"
plic-base = "0xc000000"
plic-size = "0x4000000"
uart0-base = "0x10000000"
uart0-size = "0x100"
virtio-base = "0x10001000"
virtio-size = "0x1000"
dram-base = "0x80000000"
dram-size = "0x0"Values must be enclosed within quotes.
Signed-off-by Michael Eager <[email protected]>
Signature · 2 lines
Michael Eager [email protected] 1960 Park Blvd., Palo Alto, CA 94306
Quoted 1 line
From
18f0ef098e6f9ff561d30113e6ca139e66a90f09Mon Sep 17 00:00:00 2001
From: Michael Eager <[email protected]>
Date: Thu, 30 Aug 2018 09:20:54 -0700
Subject: [PATCH] RISC-V - Dynamic parameterization of RISC-V memory map
Memory parameters for RISC-V boards can be read from a configuration file using the -readconfig command line option. The configuration file should have a section for the board and memory. The configuration for the VirtIO board has the following configuration variables:
[riscv-virt-mem]
debug-base = "0x0" debug-size = "0x100" mrom-base = "0x1000" mrom-size = "0x11000" test-base = "0x100000" test-size = "0x1000" clint-base = "0x2000000" clint-size = "0x10000" plic-base = "0xc000000" plic-size = "0x4000000" uart0-base = "0x10000000" uart0-size = "0x100" virtio-base = "0x10001000" virtio-size = "0x1000" dram-base = "0x80000000" dram-size = "0x0"
Values must be enclosed within quotes.
--- hw/riscv/riscv.config | 86 ++++++++++++++++++++++++++++++++++++++++ hw/riscv/sifive_e.c | 107 ++++++++++++++++++++++++++++++++++++++++---------- hw/riscv/sifive_u.c | 96 +++++++++++++++++++++++++++++++++++++++----- hw/riscv/spike.c | 75 +++++++++++++++++++++++++++++++++-- hw/riscv/virt.c | 85 ++++++++++++++++++++++++++++++++++----- 5 files changed, 406 insertions(+), 43 deletions(-) create mode 100644 hw/riscv/riscv.config
hw/riscv/riscv.config new file +86 -0
@@ -0,0 +1,86 @@ +# Memory map for RISC-V VirtIO board +[riscv-virt-mem] + debug-base = "0x0" + debug-size = "0x100" + mrom-base = "0x1000" + mrom-size = "0x11000" + test-base = "0x100000" + test-size = "0x1000" + clint-base = "0x2000000" + clint-size = "0x10000" + plic-base = "0xc000000" + plic-size = "0x4000000" + uart0-base = "0x10000000" + uart0-size = "0x100" + virtio-base = "0x10001000" + virtio-size = "0x1000" + dram-base = "0x80000000" + dram-size = "0x0" + +# Memory map for RISC-V Sifive E board +[riscv-sifive-e-mem] + debug-base = "0x0" + debug-size = "0x100" + mrom-base = "0x1000" + mrom-size = "0x2000" + otp-base = "0x20000" + otp-size = "0x2000" + clint-base = "0x2000000" + clint-size = "0x10000" + plic-base = "0xc000000" + plic-size = "0x4000000" + aon-base = "0x10000000" + aon-size = "0x8000" + prci-base = "0x10008000" + prci-size = "0x8000" + otp_ctrl-base = "0x10010000" + otp_ctrl-size = "0x1000" + gpio0-base = "0x10012000" + gpio0-size = "0x1000" + uart0-base = "0x10013000" + uart0-size = "0x1000" + qspi0-base = "0x10014000" + qspi0-size = "0x1000" + pwm0-base = "0x10015000" + pwm0-size = "0x1000" + uart1-base = "0x10023000" + uart1-size = "0x1000" + qspi1-base = "0x10024000" + qspi1-size = "0x1000" + pwm1-base = "0x10025000" + pwm1-size = "0x1000" + qspi2-base = "0x10034000" + qspi2-size = "0x1000" + pwm2-base = "0x10035000" + pwm2-size = "0x1000" + xip-base = "0x20000000" + xip-size = "0x20000000" + dtim-base = " 0x80000000" + dtim-size = "0x4000" + +[riscv-sifive-u-mem] + debug-base = "0x0" + debug-size = "0x100" + mrom-base = "0x1000" + mrom-size = "0x11000" + clint-base = "0x2000000" + clint-size = "0x10000" + plic-base = "0xc000000" + plic-size = "0x4000000" + uart0-base = "0x10013000" + uart0-size = "0x1000" + uart1-base = "0x10023000" + uart1-size = "0x1000" + dram-base = "0x80000000" + dram-size = "0x0" + gem-base = "0x100900FC" + gem-size = "0x2000" + +[riscv-spike-mem] + mrom-base = "0x1000" + mrom-spike = "0x11000" + clint-base = "0x2000000" + clint-spike = "0x10000" + dram-base = "0x80000000" + dram-spike = "0x0" +
hw/riscv/sifive_e.c +87 -20
133 lines not on this page · raw message
hw/riscv/sifive_u.c +86 -10
128 lines not on this page · raw message
hw/riscv/spike.c +71 -4
101 lines not on this page · raw message
hw/riscv/virt.c +76 -9
111 lines not on this page · raw message
Signature · 1 line
1.8.3.1
Any comments?
Quoted 35 lines · Michael Eager
Corrected patch attached.
Quoted 31 lines · Michael Eager
Whoops. I just noticed that this patch is against the riscv-qemu
repo on github, not the qemu.org repo. I will rework it for the qemu.org repo. Meanwhile, I welcome any comments.Quoted 26 lines · Michael Eager
Memory parameters for RISC-V boards can be read from a configuration file using the -readconfig command line option. The configuration file should have a section for the board and memory. The configuration for the VirtIO board has the following configuration variables:
[riscv-virt-mem]
debug-base = "0x0"
debug-size = "0x100"
mrom-base = "0x1000"
mrom-size = "0x11000"
test-base = "0x100000"
test-size = "0x1000"
clint-base = "0x2000000"
clint-size = "0x10000"
plic-base = "0xc000000"
plic-size = "0x4000000"
uart0-base = "0x10000000"
uart0-size = "0x100"
virtio-base = "0x10001000"
virtio-size = "0x1000"
dram-base = "0x80000000"
dram-size = "0x0"Values must be enclosed within quotes.
Signed-off-by Michael Eager <[email protected]>
Signature · 2 lines
Michael Eager [email protected] 1960 Park Blvd., Palo Alto, CA 94306
Quoted 1 line · Michael Eager
Any comments?
I'd quite like to hear from somebody more familiar with the readconfig/writeconfig stuff than me about whether this very riscv-centric approach makes sense and fits with how the config file is used by other parts of QEMU.
I'm not sure who would be best to do that review, though. Paolo, any suggestions for who knows that bit of the code?
thanks
-- PMM
Quoted 45 lines · Michael Eager
Quoted 39 lines
Corrected patch attached.
Quoted 34 lines · Michael Eager
Whoops. I just noticed that this patch is against the riscv-qemu repo on github, not the qemu.org repo. I will rework it for the qemu.org repo. Meanwhile, I welcome any comments.
Quoted 27 lines · Michael Eager
Memory parameters for RISC-V boards can be read from a configuration file using the -readconfig command line option. The configuration file should have a section for the board and memory. The configuration for the VirtIO board has the following configuration variables:
[riscv-virt-mem]debug-base = "0x0" debug-size = "0x100" mrom-base = "0x1000" mrom-size = "0x11000" test-base = "0x100000" test-size = "0x1000" clint-base = "0x2000000" clint-size = "0x10000" plic-base = "0xc000000" plic-size = "0x4000000" uart0-base = "0x10000000" uart0-size = "0x100" virtio-base = "0x10001000" virtio-size = "0x1000" dram-base = "0x80000000" dram-size = "0x0"Values must be enclosed within quotes.
Signed-off-by Michael Eager <[email protected]>--
Michael Eager [email protected]
1960 Park Blvd., Palo Alto, CA 94306
Quoted 7 lines · Peter Maydell
Quoted 1 line · Michael Eager
Any comments?
I'd quite like to hear from somebody more familiar with the readconfig/writeconfig stuff than me about whether this very riscv-centric approach makes sense and fits with how the config file is used by other parts of QEMU.
Hi Peter --
This patch is specific to RISC-V, but it would be easy to generalize it to any target. It could also be extended to describe other processor features, for example, the number of cores.
Generalizing it would involve refactoring the changes to create a generic routine which could be used in any target.
Quoted 52 lines
I'm not sure who would be best to do that review, though. Paolo, any suggestions for who knows that bit of the code?
thanks
-- PMMQuoted 45 lines · Michael Eager
Quoted 39 lines
Corrected patch attached.
Quoted 34 lines · Michael Eager
Whoops. I just noticed that this patch is against the riscv-qemu repo on github, not the qemu.org repo. I will rework it for the qemu.org repo. Meanwhile, I welcome any comments.
Quoted 27 lines · Michael Eager
Memory parameters for RISC-V boards can be read from a configuration file using the -readconfig command line option. The configuration file should have a section for the board and memory. The configuration for the VirtIO board has the following configuration variables:
[riscv-virt-mem]debug-base = "0x0" debug-size = "0x100" mrom-base = "0x1000" mrom-size = "0x11000" test-base = "0x100000" test-size = "0x1000" clint-base = "0x2000000" clint-size = "0x10000" plic-base = "0xc000000" plic-size = "0x4000000" uart0-base = "0x10000000" uart0-size = "0x100" virtio-base = "0x10001000" virtio-size = "0x1000" dram-base = "0x80000000" dram-size = "0x0"Values must be enclosed within quotes.
Signed-off-by Michael Eager <[email protected]>--
Michael Eager [email protected]
1960 Park Blvd., Palo Alto, CA 94306
Signature · 2 lines
Michael Eager [email protected] 1960 Park Blvd., Palo Alto, CA 94306
Quoted 9 lines · Peter Maydell
Quoted 1 line · Michael Eager
Any comments?
I'd quite like to hear from somebody more familiar with the readconfig/writeconfig stuff than me about whether this very riscv-centric approach makes sense and fits with how the config file is used by other parts of QEMU.
I'm not sure who would be best to do that review, though. Paolo, any suggestions for who knows that bit of the code?
I'm not sure why you need a readconfig-specific section and you cannot just use -machine (adding properties to the RISC-V machine classes). That would be usable through either command line or -readconfig.
Paolo
Quoted 2 lines · Michael Eager
It could also be extended to describe other processor features, for example, the number of cores.
The number of cores is already described via -smp, isn't it?
Paolo