diff mbox series

[v4,24/24] ppc/ppc405: Add check on minimum RAM size

Message ID 20220809153904.485018-25-clg@kaod.org
State Changes Requested
Headers show
Series ppc: QOM'ify 405 board | expand

Commit Message

Cédric Le Goater Aug. 9, 2022, 3:39 p.m. UTC
The check on invalid RAM size is now performed in the SDRAM controller
but not all values will boot a machine. A minimum of 2*16 is required.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
 hw/ppc/ppc405_boards.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

Comments

BALATON Zoltan Aug. 9, 2022, 5:55 p.m. UTC | #1
On Tue, 9 Aug 2022, Cédric Le Goater wrote:
> The check on invalid RAM size is now performed in the SDRAM controller
> but not all values will boot a machine. A minimum of 2*16 is required.

2*16 or 16 MiB? The code has the latter which does not match commit 
message.

Regards,
BALATON Zoltan

>
> Signed-off-by: Cédric Le Goater <clg@kaod.org>
> ---
> hw/ppc/ppc405_boards.c | 7 ++-----
> 1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/hw/ppc/ppc405_boards.c b/hw/ppc/ppc405_boards.c
> index 4ff6715f3533..9a3fec38cce1 100644
> --- a/hw/ppc/ppc405_boards.c
> +++ b/hw/ppc/ppc405_boards.c
> @@ -251,14 +251,11 @@ static void boot_from_kernel(MachineState *machine, PowerPCCPU *cpu)
> static void ppc405_init(MachineState *machine)
> {
>     Ppc405MachineState *ppc405 = PPC405_MACHINE(machine);
> -    MachineClass *mc = MACHINE_GET_CLASS(machine);
>     const char *kernel_filename = machine->kernel_filename;
>     MemoryRegion *sysmem = get_system_memory();
>
> -    if (machine->ram_size != mc->default_ram_size) {
> -        char *sz = size_to_str(mc->default_ram_size);
> -        error_report("Invalid RAM size, should be %s", sz);
> -        g_free(sz);
> +    if (machine->ram_size < 16 * MiB) {
> +        error_report("Not enough RAM !");
>         exit(EXIT_FAILURE);
>     }
>
>
Cédric Le Goater Aug. 10, 2022, 6:24 a.m. UTC | #2
On 8/9/22 19:55, BALATON Zoltan wrote:
> On Tue, 9 Aug 2022, Cédric Le Goater wrote:
>> The check on invalid RAM size is now performed in the SDRAM controller
>> but not all values will boot a machine. A minimum of 2*16 is required.
> 
> 2*16 or 16 MiB? The code has the latter which does not match commit message.

Indeed. It should be 32MB below.

Thanks,

C.

> 
> Regards,
> BALATON Zoltan
> 
>>
>> Signed-off-by: Cédric Le Goater <clg@kaod.org>
>> ---
>> hw/ppc/ppc405_boards.c | 7 ++-----
>> 1 file changed, 2 insertions(+), 5 deletions(-)
>>
>> diff --git a/hw/ppc/ppc405_boards.c b/hw/ppc/ppc405_boards.c
>> index 4ff6715f3533..9a3fec38cce1 100644
>> --- a/hw/ppc/ppc405_boards.c
>> +++ b/hw/ppc/ppc405_boards.c
>> @@ -251,14 +251,11 @@ static void boot_from_kernel(MachineState *machine, PowerPCCPU *cpu)
>> static void ppc405_init(MachineState *machine)
>> {
>>     Ppc405MachineState *ppc405 = PPC405_MACHINE(machine);
>> -    MachineClass *mc = MACHINE_GET_CLASS(machine);
>>     const char *kernel_filename = machine->kernel_filename;
>>     MemoryRegion *sysmem = get_system_memory();
>>
>> -    if (machine->ram_size != mc->default_ram_size) {
>> -        char *sz = size_to_str(mc->default_ram_size);
>> -        error_report("Invalid RAM size, should be %s", sz);
>> -        g_free(sz);
>> +    if (machine->ram_size < 16 * MiB) {
>> +        error_report("Not enough RAM !");
>>         exit(EXIT_FAILURE);
>>     }
>>
>>
diff mbox series

Patch

diff --git a/hw/ppc/ppc405_boards.c b/hw/ppc/ppc405_boards.c
index 4ff6715f3533..9a3fec38cce1 100644
--- a/hw/ppc/ppc405_boards.c
+++ b/hw/ppc/ppc405_boards.c
@@ -251,14 +251,11 @@  static void boot_from_kernel(MachineState *machine, PowerPCCPU *cpu)
 static void ppc405_init(MachineState *machine)
 {
     Ppc405MachineState *ppc405 = PPC405_MACHINE(machine);
-    MachineClass *mc = MACHINE_GET_CLASS(machine);
     const char *kernel_filename = machine->kernel_filename;
     MemoryRegion *sysmem = get_system_memory();
 
-    if (machine->ram_size != mc->default_ram_size) {
-        char *sz = size_to_str(mc->default_ram_size);
-        error_report("Invalid RAM size, should be %s", sz);
-        g_free(sz);
+    if (machine->ram_size < 16 * MiB) {
+        error_report("Not enough RAM !");
         exit(EXIT_FAILURE);
     }