Skip to contentSkip to conversation

arm: aspeed: Set SDRAM size

PATCH Superseded Joel Stanley 5 participants 8 messages May 1, 2019 Arm/Aspeed machine support

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Joel Stanley

author maintainer
#0 lore raw

PATCH 1/1 arm: aspeed: Set SDRAM size

We currently use Qemu's default of 128MB. As we know how much ram each machine ships with, make it easier on users by setting a default.

It can still be overridden with -m on the command line.

---
 hw/arm/aspeed.c         | 6 ++++++
 include/hw/arm/aspeed.h | 1 +
 2 files changed, 7 insertions(+)
hw/arm/aspeed.c +6 -0
index 1c23ebd99252..3f3d4162b3c5 100644
@@ -331,6 +331,8 @@ static void aspeed_machine_class_init(ObjectClass *oc, void *data)
     mc->no_floppy = 1;
     mc->no_cdrom = 1;
     mc->no_parallel = 1;
+    if (board->ram)
+        mc->default_ram_size = board->ram;
     amc->board = board;
 }
 
@@ -352,6 +354,7 @@ static const AspeedBoardConfig aspeed_boards[] = {
         .spi_model = "mx25l25635e",
         .num_cs    = 1,
         .i2c_init  = palmetto_bmc_i2c_init,
+        .ram       = 256 << 20,
     }, {
         .name      = MACHINE_TYPE_NAME("ast2500-evb"),
         .desc      = "Aspeed AST2500 EVB (ARM1176)",
@@ -361,6 +364,7 @@ static const AspeedBoardConfig aspeed_boards[] = {
         .spi_model = "mx25l25635e",
         .num_cs    = 1,
         .i2c_init  = ast2500_evb_i2c_init,
+        .ram       = 512 << 20,
     }, {
         .name      = MACHINE_TYPE_NAME("romulus-bmc"),
         .desc      = "OpenPOWER Romulus BMC (ARM1176)",
@@ -370,6 +374,7 @@ static const AspeedBoardConfig aspeed_boards[] = {
         .spi_model = "mx66l1g45g",
         .num_cs    = 2,
         .i2c_init  = romulus_bmc_i2c_init,
+        .ram       = 512 << 20,
     }, {
         .name      = MACHINE_TYPE_NAME("witherspoon-bmc"),
         .desc      = "OpenPOWER Witherspoon BMC (ARM1176)",
@@ -379,6 +384,7 @@ static const AspeedBoardConfig aspeed_boards[] = {
         .spi_model = "mx66l1g45g",
         .num_cs    = 2,
         .i2c_init  = witherspoon_bmc_i2c_init,
+        .ram       = 512 << 20,
     },
 };
 
include/hw/arm/aspeed.h +1 -0
index 325c091d09e4..02073a6b4d61 100644
@@ -22,6 +22,7 @@ typedef struct AspeedBoardConfig {
     const char *spi_model;
     uint32_t num_cs;
     void (*i2c_init)(AspeedBoardState *bmc);
+    uint32_t ram;
 } AspeedBoardConfig;
 
 #define TYPE_ASPEED_MACHINE       MACHINE_TYPE_NAME("aspeed")
Signature · 1 line
2.20.1
#1 lore raw
Patchew URL: https://patchew.org/QEMU/[email protected]/

Patchew URL: https://patchew.org/QEMU/[email protected]/

Hi,

This series seems to have some coding style problems. See output below for more information:

Type: series
Message-id: [email protected]
Subject: [Qemu-devel] [PATCH] arm: aspeed: Set SDRAM size

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
* [new tag] patchew/[email protected] -> patchew/[email protected]
Switched to a new branch 'test'
32e0f59c5d arm: aspeed: Set SDRAM size

=== OUTPUT BEGIN ===
ERROR: braces {} are necessary for all arms of this statement #23: FILE: hw/arm/aspeed.c:334:
+ if (board->ram)
[...]

total: 1 errors, 0 warnings, 43 lines checked

Commit 32e0f59c5d90 (arm: aspeed: Set SDRAM size) has style problems, please review. If any of these errors are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
=== OUTPUT END ===

Test command exited with code: 1

The full log is available at
http://patchew.org/logs/[email protected]/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]

Reviewed-by on v1 1/1
#2 lore raw
In reply to Joel Stanley
Quoted 6 lines · Joel Stanley

We currently use Qemu's default of 128MB. As we know how much ram each machine ships with, make it easier on users by setting a default.

It can still be overridden with -m on the command line.

Quoted 67 lines
---
 hw/arm/aspeed.c         | 6 ++++++
 include/hw/arm/aspeed.h | 1 +
 2 files changed, 7 insertions(+)
hw/arm/aspeed.c +6 -0
index 1c23ebd99252..3f3d4162b3c5 100644
@@ -331,6 +331,8 @@ static void aspeed_machine_class_init(ObjectClass 
 *oc, void *data)
     mc->no_floppy = 1;
     mc->no_cdrom = 1;
     mc->no_parallel = 1;
+    if (board->ram)
+        mc->default_ram_size = board->ram;
     amc->board = board;
 }
@@ -352,6 +354,7 @@ static const AspeedBoardConfig aspeed_boards[] = {
         .spi_model = "mx25l25635e",
         .num_cs    = 1,
         .i2c_init  = palmetto_bmc_i2c_init,
+        .ram       = 256 << 20,
     }, {
         .name      = MACHINE_TYPE_NAME("ast2500-evb"),
         .desc      = "Aspeed AST2500 EVB (ARM1176)",
@@ -361,6 +364,7 @@ static const AspeedBoardConfig aspeed_boards[] = {
         .spi_model = "mx25l25635e",
         .num_cs    = 1,
         .i2c_init  = ast2500_evb_i2c_init,
+        .ram       = 512 << 20,
     }, {
         .name      = MACHINE_TYPE_NAME("romulus-bmc"),
         .desc      = "OpenPOWER Romulus BMC (ARM1176)",
@@ -370,6 +374,7 @@ static const AspeedBoardConfig aspeed_boards[] = {
         .spi_model = "mx66l1g45g",
         .num_cs    = 2,
         .i2c_init  = romulus_bmc_i2c_init,
+        .ram       = 512 << 20,
     }, {
         .name      = MACHINE_TYPE_NAME("witherspoon-bmc"),
         .desc      = "OpenPOWER Witherspoon BMC (ARM1176)",
@@ -379,6 +384,7 @@ static const AspeedBoardConfig aspeed_boards[] = {
         .spi_model = "mx66l1g45g",
         .num_cs    = 2,
         .i2c_init  = witherspoon_bmc_i2c_init,
+        .ram       = 512 << 20,
     },
 };
 
include/hw/arm/aspeed.h +1 -0
index 325c091d09e4..02073a6b4d61 100644
@@ -22,6 +22,7 @@ typedef struct AspeedBoardConfig {
     const char *spi_model;
     uint32_t num_cs;
     void (*i2c_init)(AspeedBoardState *bmc);
+    uint32_t ram;
 } AspeedBoardConfig;
 
 #define TYPE_ASPEED_MACHINE       MACHINE_TYPE_NAME("aspeed")
Signature · 1 line
2.20.1
#3 lore raw
In reply to Joel Stanley
Patchew URL: https://patchew.org/QEMU/[email protected]/

Patchew URL: https://patchew.org/QEMU/[email protected]/

Hi,

This series seems to have some coding style problems. See output below for more information:

Type: series
Message-id: [email protected]
Subject: [Qemu-devel] [PATCH] arm: aspeed: Set SDRAM size

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
t [tag update] patchew/[email protected] -> patchew/[email protected]
Switched to a new branch 'test'
a98b29e581 arm: aspeed: Set SDRAM size

=== OUTPUT BEGIN ===
ERROR: braces {} are necessary for all arms of this statement #24: FILE: hw/arm/aspeed.c:334:
+ if (board->ram)
[...]

total: 1 errors, 0 warnings, 43 lines checked

Commit a98b29e58144 (arm: aspeed: Set SDRAM size) has style problems, please review. If any of these errors are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
=== OUTPUT END ===

Test command exited with code: 1

The full log is available at
http://patchew.org/logs/[email protected]/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]

Reviewed-by on v1 1/1
#4 lore raw
In reply to Joel Stanley

hw/arm/aspeed.c static void aspeed_machine_class_init(ObjectClass *oc, void *data) · line 335

Quoted 3 lines · Joel Stanley
     mc->no_parallel = 1;
hw/arm/aspeed.c +2 -0
+    if (board->ram)
+        mc->default_ram_size = board->ram;

In addition to the braces, for which patchew will have sent you nag mail...

Quoted 1 line

+ .ram = 256 << 20,

In <qemu/units.h> there are some defines to make this more readable as

.ram = 256 * MiB,

Otherwise,

r~

#5 lore raw
In reply to Joel Stanley
Patchew URL: https://patchew.org/QEMU/[email protected]/

Patchew URL: https://patchew.org/QEMU/[email protected]/

Hi,

This series seems to have some coding style problems. See output below for more information:

Type: series
Message-id: [email protected]
Subject: [Qemu-devel] [PATCH] arm: aspeed: Set SDRAM size

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
t [tag update] patchew/[email protected] -> patchew/[email protected]
Switched to a new branch 'test'
5788c65fda arm: aspeed: Set SDRAM size

=== OUTPUT BEGIN ===
ERROR: braces {} are necessary for all arms of this statement #25: FILE: hw/arm/aspeed.c:334:
+ if (board->ram)
[...]

total: 1 errors, 0 warnings, 43 lines checked

Commit 5788c65fda2a (arm: aspeed: Set SDRAM size) has style problems, please review. If any of these errors are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
=== OUTPUT END ===

Test command exited with code: 1

The full log is available at
http://patchew.org/logs/[email protected]/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]

Reviewed-by on v1 1/1
#6 lore raw
In reply to Joel Stanley
Quoted 61 lines · Joel Stanley

We currently use Qemu's default of 128MB. As we know how much ram each machine ships with, make it easier on users by setting a default.

It can still be overridden with -m on the command line.

---
 hw/arm/aspeed.c         | 6 ++++++
 include/hw/arm/aspeed.h | 1 +
 2 files changed, 7 insertions(+)
hw/arm/aspeed.c +6 -0
index 1c23ebd99252..3f3d4162b3c5 100644
@@ -331,6 +331,8 @@ static void aspeed_machine_class_init(ObjectClass *oc, void *data)
     mc->no_floppy = 1;
     mc->no_cdrom = 1;
     mc->no_parallel = 1;
+    if (board->ram)
+        mc->default_ram_size = board->ram;
     amc->board = board;
 }
 
@@ -352,6 +354,7 @@ static const AspeedBoardConfig aspeed_boards[] = {
         .spi_model = "mx25l25635e",
         .num_cs    = 1,
         .i2c_init  = palmetto_bmc_i2c_init,
+        .ram       = 256 << 20,
     }, {
         .name      = MACHINE_TYPE_NAME("ast2500-evb"),
         .desc      = "Aspeed AST2500 EVB (ARM1176)",
@@ -361,6 +364,7 @@ static const AspeedBoardConfig aspeed_boards[] = {
         .spi_model = "mx25l25635e",
         .num_cs    = 1,
         .i2c_init  = ast2500_evb_i2c_init,
+        .ram       = 512 << 20,
     }, {
         .name      = MACHINE_TYPE_NAME("romulus-bmc"),
         .desc      = "OpenPOWER Romulus BMC (ARM1176)",
@@ -370,6 +374,7 @@ static const AspeedBoardConfig aspeed_boards[] = {
         .spi_model = "mx66l1g45g",
         .num_cs    = 2,
         .i2c_init  = romulus_bmc_i2c_init,
+        .ram       = 512 << 20,
     }, {
         .name      = MACHINE_TYPE_NAME("witherspoon-bmc"),
         .desc      = "OpenPOWER Witherspoon BMC (ARM1176)",
@@ -379,6 +384,7 @@ static const AspeedBoardConfig aspeed_boards[] = {
         .spi_model = "mx66l1g45g",
         .num_cs    = 2,
         .i2c_init  = witherspoon_bmc_i2c_init,
+        .ram       = 512 << 20,
     },
 };
 
include/hw/arm/aspeed.h +0 -0
index 325c091d09e4..02073a6b4d61 100644

include/hw/arm/aspeed.h typedef struct AspeedBoardConfig { · line 25

Quoted 4 lines
include/hw/arm/aspeed.h +1 -0
@@ -22,6 +22,7 @@ typedef struct AspeedBoardConfig {
     const char *spi_model;
     uint32_t num_cs;
     void (*i2c_init)(AspeedBoardState *bmc);
+    uint32_t ram;

default_ram_size is of type 'const ram_addr_t', can you use the same type here?

include/hw/arm/aspeed.h typedef struct AspeedBoardConfig { · line 28

Quoted 4 lines
include/hw/arm/aspeed.h +0 -0
 } AspeedBoardConfig;
 
 #define TYPE_ASPEED_MACHINE       MACHINE_TYPE_NAME("aspeed")

Using macros from "qemu/units.h" as suggested by Richard:

#7 lore raw
In reply to Joel Stanley
Patchew URL: https://patchew.org/QEMU/[email protected]/

Patchew URL: https://patchew.org/QEMU/[email protected]/

Hi,

This series seems to have some coding style problems. See output below for more information:

Type: series
Message-id: [email protected]
Subject: [Qemu-devel] [PATCH] arm: aspeed: Set SDRAM size

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
t [tag update] patchew/[email protected] -> patchew/[email protected]
Switched to a new branch 'test'
e5bcc1ef55 arm: aspeed: Set SDRAM size

=== OUTPUT BEGIN ===
ERROR: braces {} are necessary for all arms of this statement #26: FILE: hw/arm/aspeed.c:334:
+ if (board->ram)
[...]

total: 1 errors, 0 warnings, 43 lines checked

Commit e5bcc1ef551e (arm: aspeed: Set SDRAM size) has style problems, please review. If any of these errors are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
=== OUTPUT END ===

Test command exited with code: 1

The full log is available at
http://patchew.org/logs/[email protected]/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]