target/xtensa: xtfpga: provide default memory sizes
PATCH v2 1/1 target/xtensa: xtfpga: provide default memory sizes
Provide default RAM sizes for all XTFPGA boards, so that when started without -m option they do the right thing.
---
Changes v1->v2:
- fix memory sizes for ml605 and kc705 with MMU
hw/xtensa/xtfpga.c | 8 ++++++++ 1 file changed, 8 insertions(+)
hw/xtensa/xtfpga.c +8 -0
@@ -568,6 +568,7 @@ static void xtfpga_lx60_class_init(ObjectClass *oc, void *data) mc->init = xtfpga_lx60_init; mc->max_cpus =4 ; mc->default_cpu_type =XTENSA_DEFAULT_CPU_TYPE ; + mc->default_ram_size =64 * MiB; }static const TypeInfo xtfpga_lx60_type = {
@@ -584,6 +585,7 @@ static void xtfpga_lx60_nommu_class_init(ObjectClass *oc, void *data) mc->init = xtfpga_lx60_nommu_init; mc->max_cpus =4 ; mc->default_cpu_type =XTENSA_DEFAULT_CPU_NOMMU_TYPE ; + mc->default_ram_size =64 * MiB; }static const TypeInfo xtfpga_lx60_nommu_type = {
@@ -600,6 +602,7 @@ static void xtfpga_lx200_class_init(ObjectClass *oc, void *data) mc->init = xtfpga_lx200_init; mc->max_cpus =4 ; mc->default_cpu_type =XTENSA_DEFAULT_CPU_TYPE ; + mc->default_ram_size =96 * MiB; }static const TypeInfo xtfpga_lx200_type = {
@@ -616,6 +619,7 @@ static void xtfpga_lx200_nommu_class_init(ObjectClass *oc, void *data) mc->init = xtfpga_lx200_nommu_init; mc->max_cpus =4 ; mc->default_cpu_type =XTENSA_DEFAULT_CPU_NOMMU_TYPE ; + mc->default_ram_size =96 * MiB; }static const TypeInfo xtfpga_lx200_nommu_type = {
@@ -632,6 +636,7 @@ static void xtfpga_ml605_class_init(ObjectClass *oc, void *data) mc->init = xtfpga_ml605_init; mc->max_cpus =4 ; mc->default_cpu_type =XTENSA_DEFAULT_CPU_TYPE ; + mc->default_ram_size =384 * MiB; }static const TypeInfo xtfpga_ml605_type = {
@@ -648,6 +653,7 @@ static void xtfpga_ml605_nommu_class_init(ObjectClass *oc, void *data) mc->init = xtfpga_ml605_nommu_init; mc->max_cpus =4 ; mc->default_cpu_type =XTENSA_DEFAULT_CPU_NOMMU_TYPE ; + mc->default_ram_size =256 * MiB; }static const TypeInfo xtfpga_ml605_nommu_type = {
@@ -664,6 +670,7 @@ static void xtfpga_kc705_class_init(ObjectClass *oc, void *data) mc->init = xtfpga_kc705_init; mc->max_cpus =4 ; mc->default_cpu_type =XTENSA_DEFAULT_CPU_TYPE ; + mc->default_ram_size =896 * MiB; }static const TypeInfo xtfpga_kc705_type = {
@@ -680,6 +687,7 @@ static void xtfpga_kc705_nommu_class_init(ObjectClass *oc, void *data) mc->init = xtfpga_kc705_nommu_init; mc->max_cpus =4 ; mc->default_cpu_type =XTENSA_DEFAULT_CPU_NOMMU_TYPE ; + mc->default_ram_size =256 * MiB; }static const TypeInfo xtfpga_kc705_nommu_type = {
Signature · 1 line
2.11.0
Quoted 48 lines · Max Filippov
Provide default RAM sizes for all XTFPGA boards, so that when started without -m option they do the right thing.
Signed-off-by Max Filippov <[email protected]>---
Changesv1->v2:
- fix memory sizes for ml605 and kc705 with MMUhw/xtensa/xtfpga.c | 8 ++++++++ 1 file changed, 8 insertions(+)hw/xtensa/xtfpga.c +4
-0@@ -568,6 +568,7 @@ static void xtfpga_lx60_class_init(ObjectClass *oc, void *data) mc->init = xtfpga_lx60_init; mc->max_cpus =4 ; mc->default_cpu_type =XTENSA_DEFAULT_CPU_TYPE ; + mc->default_ram_size =64 * MiB; }static const TypeInfo xtfpga_lx60_type = {@@ -584,6 +585,7 @@ static void xtfpga_lx60_nommu_class_init(ObjectClass *oc, void *data) mc->init = xtfpga_lx60_nommu_init; mc->max_cpus =4 ; mc->default_cpu_type =XTENSA_DEFAULT_CPU_NOMMU_TYPE ; + mc->default_ram_size =64 * MiB; }static const TypeInfo xtfpga_lx60_nommu_type = {@@ -600,6 +602,7 @@ static void xtfpga_lx200_class_init(ObjectClass *oc, void *data) mc->init = xtfpga_lx200_init; mc->max_cpus =4 ; mc->default_cpu_type =XTENSA_DEFAULT_CPU_TYPE ; + mc->default_ram_size =96 * MiB; }static const TypeInfo xtfpga_lx200_type = {@@ -616,6 +619,7 @@ static void xtfpga_lx200_nommu_class_init(ObjectClass *oc, void *data) mc->init = xtfpga_lx200_nommu_init; mc->max_cpus =4 ; mc->default_cpu_type =XTENSA_DEFAULT_CPU_NOMMU_TYPE ; + mc->default_ram_size =96 * MiB; }static const TypeInfo xtfpga_lx200_nommu_type = {
hw/xtensa/xtfpga.c static void xtfpga_ml605_class_init(ObjectClass *oc, void *data) · line 639
Quoted 4 lines
hw/xtensa/xtfpga.c +1
-0@@ -632,6 +636,7 @@ static void xtfpga_ml605_class_init(ObjectClass *oc, void *data) mc->init = xtfpga_ml605_init; mc->max_cpus =4 ; mc->default_cpu_type =XTENSA_DEFAULT_CPU_TYPE ; + mc->default_ram_size =384 * MiB;
Hmm this is now correct but I feel we are hidding information to further reviewers/developers. Without reading your v1 comment and looking at the new code I'd wonder why 384 and not 512.
What about adding a definition such:
#define XTENSA_CPU_MMU_RESERVED_IO_SIZE (128 * MiB)
Then use:
mc->default_ram_size = 512 * MiB - XTENSA_CPU_MMU_RESERVED_IO_SIZE;
Quoted 12 lines
hw/xtensa/xtfpga.c +1
-0}static const TypeInfo xtfpga_ml605_type = {@@ -648,6 +653,7 @@ static void xtfpga_ml605_nommu_class_init(ObjectClass *oc, void *data) mc->init = xtfpga_ml605_nommu_init; mc->max_cpus =4 ; mc->default_cpu_type =XTENSA_DEFAULT_CPU_NOMMU_TYPE ; + mc->default_ram_size =256 * MiB; }static const TypeInfo xtfpga_ml605_nommu_type = {
hw/xtensa/xtfpga.c static void xtfpga_kc705_class_init(ObjectClass *oc, void *data) · line 673
Quoted 4 lines
hw/xtensa/xtfpga.c +1
-0@@ -664,6 +670,7 @@ static void xtfpga_kc705_class_init(ObjectClass *oc, void *data) mc->init = xtfpga_kc705_init; mc->max_cpus =4 ; mc->default_cpu_type =XTENSA_DEFAULT_CPU_TYPE ; + mc->default_ram_size =896 * MiB;
Ditto:
mc->default_ram_size = 1 * GiB - XTENSA_CPU_MMU_RESERVED_IO_SIZE;
hw/xtensa/xtfpga.c static void xtfpga_kc705_nommu_class_init(ObjectClass *oc, void *data) · line 693
Quoted 12 lines
hw/xtensa/xtfpga.c +1
-0}static const TypeInfo xtfpga_kc705_type = {@@ -680,6 +687,7 @@ static void xtfpga_kc705_nommu_class_init(ObjectClass *oc, void *data) mc->init = xtfpga_kc705_nommu_init; mc->max_cpus =4 ; mc->default_cpu_type =XTENSA_DEFAULT_CPU_NOMMU_TYPE ; + mc->default_ram_size =256 * MiB; }static const TypeInfo xtfpga_kc705_nommu_type = {
If this patch goes thru your tree and you agree with the suggested changes, then you can directly add:
Regards,
Phil.
Quoted 11 lines · Philippe Mathieu-Daudé
hw/xtensa/xtfpga.c static void xtfpga_ml605_class_init(ObjectClass *oc, void *data) · line 639
Quoted 6 lines
static const TypeInfo xtfpga_lx200_nommu_type = {hw/xtensa/xtfpga.c +1
-0@@ -632,6 +636,7 @@ static void xtfpga_ml605_class_init(ObjectClass *oc, void *data) mc->init = xtfpga_ml605_init; mc->max_cpus =4 ; mc->default_cpu_type =XTENSA_DEFAULT_CPU_TYPE ; + mc->default_ram_size =384 * MiB;Hmm this is now correct but I feel we are hiding information to further reviewers/developers. Without reading your v1 comment and looking at the new code I'd wonder why 384 and not 512.
Quoted 7 lines
What about adding a definition such:
#define
XTENSA_CPU_MMU_RESERVED_IO_SIZE(128 * MiB)Then use:
mc->default_ram_size = 512 * MiB - XTENSA_CPU_MMU_RESERVED_IO_SIZE;
I'm not sure what's the reason that 128MB are reserved, and I'm sure it's not a property of the CPU, but rather how it's wired to the board. I'll call itXTFPGA_MMU_RESERVED_MEMORY_SIZE
in the v3.
Quoted 3 lines
If this patch goes thru your tree and you agree with the suggested changes, then you can directly add:
Reviewed-by Philippe Mathieu-Daudé <[email protected]>
Signature · 2 lines
Thanks. -- Max