diff mbox series

[RFC,14/14] hw/arm/raspi: Add the Raspberry Pi 4B board

Message ID 20190904171315.8354-15-f4bug@amsat.org (mailing list archive)
State New, archived
Headers show
Series hw/arm: Add the Raspberry Pi 4B | expand

Commit Message

Philippe Mathieu-Daudé Sept. 4, 2019, 5:13 p.m. UTC
The Raspberry Pi 4 uses a BCM2711 SoC (based on a BCM2838).
The SoC can handle up to 8GiB of SDRAM, but we limit it to 4GiB
(no 8GiB models in the market yet).

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 hw/arm/raspi.c | 31 ++++++++++++++++++++++++++++++-
 1 file changed, 30 insertions(+), 1 deletion(-)

Comments

Esteban Bosse Sept. 29, 2019, 3:53 p.m. UTC | #1
El mié, 04-09-2019 a las 19:13 +0200, Philippe Mathieu-Daudé escribió:
> The Raspberry Pi 4 uses a BCM2711 SoC (based on a BCM2838).
> The SoC can handle up to 8GiB of SDRAM, but we limit it to 4GiB
> (no 8GiB models in the market yet).
> 
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  hw/arm/raspi.c | 31 ++++++++++++++++++++++++++++++-
>  1 file changed, 30 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c
> index b4db39661f..59ee2f82b4 100644
> --- a/hw/arm/raspi.c
> +++ b/hw/arm/raspi.c
> @@ -39,11 +39,13 @@ enum BoardIdChip {
>      C_BCM2835 = 0,
>      C_BCM2836 = 1,
>      C_BCM2837 = 2,
> +    C_BCM2711 = 3,
>  };
>  
>  enum BoardIdType {
>      T_2B = 0x04,
>      T_3B = 0x08,
> +    T_4B = 0x11,
>  };
>  
>  enum BoardIdRevision {
> @@ -56,6 +58,7 @@ enum BoardIdRevision {
>  static const char *processor_typename[] = {
>      [C_BCM2836] = TYPE_BCM2836,
>      [C_BCM2837] = TYPE_BCM2837,
> +    [C_BCM2711] = TYPE_BCM2838,
>  };
>  
>  typedef struct BoardInfo BoardInfo;
> @@ -90,6 +93,12 @@ static const BoardInfo bcm283x_boards[] = {
>          .ram_size_min = 1 * GiB,
>          .ram_size_max = 1 * GiB,
>      },
> +    [4] = {
> +        .board_id = 0xc42,
> +        .board_rev = { T_4B, R_1_1, C_BCM2711, M_SONY_UK },
> +        .ram_size_min = 1 * GiB,
> +        .ram_size_max = 4 * GiB,
> +    },
>  };
>  
>  typedef struct RasPiState {
> @@ -336,4 +345,24 @@ static void raspi3_machine_init(MachineClass
> *mc)
>      mc->default_ram_size = 1 * GiB;
>  }
>  DEFINE_MACHINE("raspi3", raspi3_machine_init)
> -#endif
> +
> +static void raspi4_init(MachineState *machine)
> +{
> +    raspi_init(machine, 4);
> +}
> +
> +static void raspi4_machine_init(MachineClass *mc)
> +{
> +    mc->desc = "Raspberry Pi 4B";
> +    mc->init = raspi4_init;
> +    mc->block_default_type = IF_SD;
> +    mc->no_parallel = 1;
> +    mc->no_floppy = 1;
> +    mc->no_cdrom = 1;
> +    mc->max_cpus = BCM283X_NCPUS;
> +    mc->min_cpus = BCM283X_NCPUS;
> +    mc->default_cpus = BCM283X_NCPUS;
> +    mc->default_ram_size = 1 * GiB;
The comercial models are: 1, 2 and 4 GiB. Why do you choose 1 GiB as
default?
> +}
> +DEFINE_MACHINE("raspi4", raspi4_machine_init)
> +#endif /* TARGET_AARCH64 */
Reviewed-by: Esteban Bosse <estebanbosse@gmail.com>
Philippe Mathieu-Daudé Oct. 8, 2019, 9:04 a.m. UTC | #2
Hi Esteban,

On 9/29/19 5:53 PM, Esteban Bosse wrote:
> El mié, 04-09-2019 a las 19:13 +0200, Philippe Mathieu-Daudé escribió:
>> The Raspberry Pi 4 uses a BCM2711 SoC (based on a BCM2838).
>> The SoC can handle up to 8GiB of SDRAM, but we limit it to 4GiB
>> (no 8GiB models in the market yet).
>>
>> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>> ---
>>   hw/arm/raspi.c | 31 ++++++++++++++++++++++++++++++-
>>   1 file changed, 30 insertions(+), 1 deletion(-)
>>
>> diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c
>> index b4db39661f..59ee2f82b4 100644
>> --- a/hw/arm/raspi.c
>> +++ b/hw/arm/raspi.c
>> @@ -39,11 +39,13 @@ enum BoardIdChip {
>>       C_BCM2835 = 0,
>>       C_BCM2836 = 1,
>>       C_BCM2837 = 2,
>> +    C_BCM2711 = 3,
>>   };
>>   
>>   enum BoardIdType {
>>       T_2B = 0x04,
>>       T_3B = 0x08,
>> +    T_4B = 0x11,
>>   };
>>   
>>   enum BoardIdRevision {
>> @@ -56,6 +58,7 @@ enum BoardIdRevision {
>>   static const char *processor_typename[] = {
>>       [C_BCM2836] = TYPE_BCM2836,
>>       [C_BCM2837] = TYPE_BCM2837,
>> +    [C_BCM2711] = TYPE_BCM2838,
>>   };
>>   
>>   typedef struct BoardInfo BoardInfo;
>> @@ -90,6 +93,12 @@ static const BoardInfo bcm283x_boards[] = {
>>           .ram_size_min = 1 * GiB,
>>           .ram_size_max = 1 * GiB,
>>       },
>> +    [4] = {
>> +        .board_id = 0xc42,
>> +        .board_rev = { T_4B, R_1_1, C_BCM2711, M_SONY_UK },
>> +        .ram_size_min = 1 * GiB,
>> +        .ram_size_max = 4 * GiB,
>> +    },
>>   };
>>   
>>   typedef struct RasPiState {
>> @@ -336,4 +345,24 @@ static void raspi3_machine_init(MachineClass
>> *mc)
>>       mc->default_ram_size = 1 * GiB;
>>   }
>>   DEFINE_MACHINE("raspi3", raspi3_machine_init)
>> -#endif
>> +
>> +static void raspi4_init(MachineState *machine)
>> +{
>> +    raspi_init(machine, 4);
>> +}
>> +
>> +static void raspi4_machine_init(MachineClass *mc)
>> +{
>> +    mc->desc = "Raspberry Pi 4B";
>> +    mc->init = raspi4_init;
>> +    mc->block_default_type = IF_SD;
>> +    mc->no_parallel = 1;
>> +    mc->no_floppy = 1;
>> +    mc->no_cdrom = 1;
>> +    mc->max_cpus = BCM283X_NCPUS;
>> +    mc->min_cpus = BCM283X_NCPUS;
>> +    mc->default_cpus = BCM283X_NCPUS;
>> +    mc->default_ram_size = 1 * GiB;
> The comercial models are: 1, 2 and 4 GiB. Why do you choose 1 GiB as
> default?

Well need one default, and 1GiB is the least beefy :)
You can start a VM with more using the '-m' switch.

Note there is also a 8GiB raspi4, but it is not yet launched apparently.

>> +}
>> +DEFINE_MACHINE("raspi4", raspi4_machine_init)
>> +#endif /* TARGET_AARCH64 */
> Reviewed-by: Esteban Bosse <estebanbosse@gmail.com>

Thanks!
Esteban Bosse Oct. 24, 2019, 9:01 a.m. UTC | #3
El mié, 04-09-2019 a las 19:13 +0200, Philippe Mathieu-Daudé escribió:
> The Raspberry Pi 4 uses a BCM2711 SoC (based on a BCM2838).
> The SoC can handle up to 8GiB of SDRAM, but we limit it to 4GiB
> (no 8GiB models in the market yet).
> 
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  hw/arm/raspi.c | 31 ++++++++++++++++++++++++++++++-
>  1 file changed, 30 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c
> index b4db39661f..59ee2f82b4 100644
> --- a/hw/arm/raspi.c
> +++ b/hw/arm/raspi.c
> @@ -39,11 +39,13 @@ enum BoardIdChip {
>      C_BCM2835 = 0,
>      C_BCM2836 = 1,
>      C_BCM2837 = 2,
> +    C_BCM2711 = 3,
>  };
>  
>  enum BoardIdType {
>      T_2B = 0x04,
>      T_3B = 0x08,
> +    T_4B = 0x11,
>  };
>  
>  enum BoardIdRevision {
> @@ -56,6 +58,7 @@ enum BoardIdRevision {
>  static const char *processor_typename[] = {
>      [C_BCM2836] = TYPE_BCM2836,
>      [C_BCM2837] = TYPE_BCM2837,
> +    [C_BCM2711] = TYPE_BCM2838,
>  };
>  
>  typedef struct BoardInfo BoardInfo;
> @@ -90,6 +93,12 @@ static const BoardInfo bcm283x_boards[] = {
>          .ram_size_min = 1 * GiB,
>          .ram_size_max = 1 * GiB,
>      },
> +    [4] = {
> +        .board_id = 0xc42,
> +        .board_rev = { T_4B, R_1_1, C_BCM2711, M_SONY_UK },
> +        .ram_size_min = 1 * GiB,
> +        .ram_size_max = 4 * GiB,
> +    },
>  };
>  
>  typedef struct RasPiState {
> @@ -336,4 +345,24 @@ static void raspi3_machine_init(MachineClass
> *mc)
>      mc->default_ram_size = 1 * GiB;
>  }
>  DEFINE_MACHINE("raspi3", raspi3_machine_init)
> -#endif
> +
> +static void raspi4_init(MachineState *machine)
> +{
> +    raspi_init(machine, 4);
> +}
> +
> +static void raspi4_machine_init(MachineClass *mc)
> +{
> +    mc->desc = "Raspberry Pi 4B";
> +    mc->init = raspi4_init;
> +    mc->block_default_type = IF_SD;
> +    mc->no_parallel = 1;
> +    mc->no_floppy = 1;
> +    mc->no_cdrom = 1;
> +    mc->max_cpus = BCM283X_NCPUS;
> +    mc->min_cpus = BCM283X_NCPUS;
> +    mc->default_cpus = BCM283X_NCPUS;
> +    mc->default_ram_size = 1 * GiB;
> +}
> +DEFINE_MACHINE("raspi4", raspi4_machine_init)
> +#endif /* TARGET_AARCH64 */
Reviewed-by: Esteban Bosse <estebanbosse@gmail.com>
Peter Maydell Oct. 24, 2019, 9:07 a.m. UTC | #4
On Tue, 8 Oct 2019 at 10:04, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>
> Hi Esteban,
>
> On 9/29/19 5:53 PM, Esteban Bosse wrote:
> >> +static void raspi4_machine_init(MachineClass *mc)
> >> +{
> >> +    mc->desc = "Raspberry Pi 4B";
> >> +    mc->init = raspi4_init;
> >> +    mc->block_default_type = IF_SD;
> >> +    mc->no_parallel = 1;
> >> +    mc->no_floppy = 1;
> >> +    mc->no_cdrom = 1;
> >> +    mc->max_cpus = BCM283X_NCPUS;
> >> +    mc->min_cpus = BCM283X_NCPUS;
> >> +    mc->default_cpus = BCM283X_NCPUS;
> >> +    mc->default_ram_size = 1 * GiB;
> > The comercial models are: 1, 2 and 4 GiB. Why do you choose 1 GiB as
> > default?
>
> Well need one default, and 1GiB is the least beefy :)
> You can start a VM with more using the '-m' switch.

Among other things, a 2GB or more board will fail
'make check' on a 32-bit host, because 'make check' tries
to start all board models, and 32-bit hosts can only
handle up to 2047MB of guest RAM.

thanks
-- PMM
Esteban Bosse Oct. 24, 2019, 12:26 p.m. UTC | #5
El jue, 24-10-2019 a las 10:07 +0100, Peter Maydell escribió:
> On Tue, 8 Oct 2019 at 10:04, Philippe Mathieu-Daudé <f4bug@amsat.org>
> wrote:
> > Hi Esteban,
> > 
> > On 9/29/19 5:53 PM, Esteban Bosse wrote:
> > > > +static void raspi4_machine_init(MachineClass *mc)
> > > > +{
> > > > +    mc->desc = "Raspberry Pi 4B";
> > > > +    mc->init = raspi4_init;
> > > > +    mc->block_default_type = IF_SD;
> > > > +    mc->no_parallel = 1;
> > > > +    mc->no_floppy = 1;
> > > > +    mc->no_cdrom = 1;
> > > > +    mc->max_cpus = BCM283X_NCPUS;
> > > > +    mc->min_cpus = BCM283X_NCPUS;
> > > > +    mc->default_cpus = BCM283X_NCPUS;
> > > > +    mc->default_ram_size = 1 * GiB;
> > > The comercial models are: 1, 2 and 4 GiB. Why do you choose 1 GiB
> > > as
> > > default?
> > 
> > Well need one default, and 1GiB is the least beefy :)
> > You can start a VM with more using the '-m' switch.
> 
> Among other things, a 2GB or more board will fail
> 'make check' on a 32-bit host, because 'make check' tries
> to start all board models, and 32-bit hosts can only
> handle up to 2047MB of guest RAM.
> 
> thanks
> -- PMM

Understood, thanks again for the info :).
diff mbox series

Patch

diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c
index b4db39661f..59ee2f82b4 100644
--- a/hw/arm/raspi.c
+++ b/hw/arm/raspi.c
@@ -39,11 +39,13 @@  enum BoardIdChip {
     C_BCM2835 = 0,
     C_BCM2836 = 1,
     C_BCM2837 = 2,
+    C_BCM2711 = 3,
 };
 
 enum BoardIdType {
     T_2B = 0x04,
     T_3B = 0x08,
+    T_4B = 0x11,
 };
 
 enum BoardIdRevision {
@@ -56,6 +58,7 @@  enum BoardIdRevision {
 static const char *processor_typename[] = {
     [C_BCM2836] = TYPE_BCM2836,
     [C_BCM2837] = TYPE_BCM2837,
+    [C_BCM2711] = TYPE_BCM2838,
 };
 
 typedef struct BoardInfo BoardInfo;
@@ -90,6 +93,12 @@  static const BoardInfo bcm283x_boards[] = {
         .ram_size_min = 1 * GiB,
         .ram_size_max = 1 * GiB,
     },
+    [4] = {
+        .board_id = 0xc42,
+        .board_rev = { T_4B, R_1_1, C_BCM2711, M_SONY_UK },
+        .ram_size_min = 1 * GiB,
+        .ram_size_max = 4 * GiB,
+    },
 };
 
 typedef struct RasPiState {
@@ -336,4 +345,24 @@  static void raspi3_machine_init(MachineClass *mc)
     mc->default_ram_size = 1 * GiB;
 }
 DEFINE_MACHINE("raspi3", raspi3_machine_init)
-#endif
+
+static void raspi4_init(MachineState *machine)
+{
+    raspi_init(machine, 4);
+}
+
+static void raspi4_machine_init(MachineClass *mc)
+{
+    mc->desc = "Raspberry Pi 4B";
+    mc->init = raspi4_init;
+    mc->block_default_type = IF_SD;
+    mc->no_parallel = 1;
+    mc->no_floppy = 1;
+    mc->no_cdrom = 1;
+    mc->max_cpus = BCM283X_NCPUS;
+    mc->min_cpus = BCM283X_NCPUS;
+    mc->default_cpus = BCM283X_NCPUS;
+    mc->default_ram_size = 1 * GiB;
+}
+DEFINE_MACHINE("raspi4", raspi4_machine_init)
+#endif /* TARGET_AARCH64 */