Re: [PATCH v2 12/13] hw/arm/raspi: Add the Raspberry Pi B+ machine

2020-09-21 Thread Philippe Mathieu-Daudé
On 2/24/20 9:55 AM, Philippe Mathieu-Daudé wrote:
> On 2/22/20 11:19 PM, Niek Linnenbank wrote:
>> Hey Philippe,
>>
>> Very nice to see that the Raspberry 1 will be supported again, thanks
>> for contributing this!
>>
>> I tried to bring up the machine using raspbian 2019-09-26. It ran
>> throught the early kernel initialisation
>> but for me it gets stuck at this point:
>>
>> ./arm-softmmu/qemu-system-arm -M raspi1b -kernel
>> $HOME/raspi/boot/kernel.img -append 'printk.time=0
>> earlycon=pl011,0x20201000 console=ttyAMA0 rootwait root=/dev/mmcblk0p2' \
>> -dtb $HOME/raspi/boot/bcm2708-rpi-b-plus.dtb -m 512 -sd
>> $HOME/raspi/2019-09-26-raspbian-buster-lite.img -serial stdio -s
>>
>> [    0.00] Booting Linux on physical CPU 0x0
>> [    0.00] Linux version 4.19.75+ (dom@buildbot) (gcc version
>> 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611)) #1270 Tue Sep 24
>> 18:38:54 BST 2019
>> [    0.00] CPU: ARMv6-compatible processor [410fb767] revision 7
>> (ARMv7), cr=00c5387d
>> [    0.00] CPU: VIPT aliasing data cache, unknown instruction cache
>> [    0.00] OF: fdt: Machine model: Raspberry Pi Model B+
>> [    0.00] earlycon: pl11 at MMIO 0x20201000 (options '')
>> [    0.00] bootconsole [pl11] enabled
>> [    0.00] Memory policy: Data cache writeback
>> [    0.00] cma: Reserved 8 MiB at 0x1b80
>> [    0.00] random: get_random_bytes called from
>> start_kernel+0x8c/0x49c with crng_init=0
>> [    0.00] Built 1 zonelists, mobility grouping on.  Total pages:
>> 113680
>> [    0.00] Kernel command line: printk.time=0
>> earlycon=pl011,0x20201000 console=ttyAMA0 rootwait root=/dev/mmcblk0p2
>> Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
>> Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
>> Memory: 434380K/458752K available (6973K kernel code, 635K rwdata,
>> 2080K rodata, 464K init, 797K bss, 16180K reserved, 8192K cma-reserved)
>> Virtual kernel memory layout:
>>      vector  : 0x - 0x1000   (   4 kB)
>>      fixmap  : 0xffc0 - 0xfff0   (3072 kB)
>>      vmalloc : 0xdc80 - 0xff80   ( 560 MB)
>>      lowmem  : 0xc000 - 0xdc00   ( 448 MB)
>>      modules : 0xbf00 - 0xc000   (  16 MB)
>>        .text : 0x(ptrval) - 0x(ptrval)   (6975 kB)
>>        .init : 0x(ptrval) - 0x(ptrval)   ( 464 kB)
>>        .data : 0x(ptrval) - 0x(ptrval)   ( 636 kB)
>>         .bss : 0x(ptrval) - 0x(ptrval)   ( 798 kB)
>> SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
>> ftrace: allocating 25197 entries in 74 pages
>> NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
>> sched_clock: 32 bits at 1000kHz, resolution 1000ns, wraps every
>> 2147483647500ns
>> clocksource: timer: mask: 0x max_cycles: 0x,
>> max_idle_ns: 1911260446275 ns
>> bcm2835: system timer (irq = 27)
>> Console: colour dummy device 80x30
>>
>> Maybe it should switch to the graphical console here, but I dont see
>> the boot splash logo either (when using -stdio instead of -nographic).
>> With -M raspi2 and -dtb bcm2709-rpi-2-b.dtb the same raspbian image
>> can fully boot to the login console.
> 
> Argh this is because I split this of a bigger series and didn't included
> changes related to the GPU 'properties', sorry.

Actually it was missing SYS_timer changes, now rebased/posted:
https://www.mail-archive.com/qemu-devel@nongnu.org/msg742694.html

> 
>>
>> Regards,
>> Niek
>>
>>
>>
>> On Mon, Feb 17, 2020 at 12:51 PM Philippe Mathieu-Daudé
>> mailto:f4...@amsat.org>> wrote:
>>
>>    $ qemu-system-arm -M raspi1b -serial stdio \
>>        -kernel raspberrypi/firmware/boot/kernel.img \
>>        -dtb raspberrypi/firmware/boot/bcm2708-rpi-b.dtb \
>>        -append 'printk.time=0 earlycon=pl011,0x20201000
>> console=ttyAMA0'
>>    [    0.00] Booting Linux on physical CPU 0x0
>>    [    0.00] Linux version 4.19.69+ (dom@buildbot) (gcc version
>>     4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611)) #1261 Tue Sep
>>     3 20:21:01 BST 2019
>>    [    0.00] CPU: ARMv6-compatible processor [410fb767]
>>     revision 7 (ARMv7), cr=00c5387d
>>    [    0.00] CPU: VIPT aliasing data cache, unknown instruction
>>     cache
>>    [    0.00] OF: fdt: Machine model: Raspberry Pi Model B
>>    [    0.00] earlycon: pl11 at MMIO 0x20201000 (options '')
>>    [    0.00] bootconsole [pl11] enabled
>>    [    0.00] Memory policy: Data cache writeback
>>    [    0.00] cma: Reserved 8 MiB at 0x1b80
>>    [    0.00] random: get_random_bytes called from
>>     start_kernel+0x8c/0x49c with crng_init=0
>>    [    0.00] Built 1 zonelists, mobility grouping on.  Total
>>     pages: 113680
>>    [    0.00] Kernel command line: printk.time=0
>>     earlycon=pl011,0x20201000 console=ttyAMA0
>>    Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
>>    Inode-cache hash table entries: 32768 (order: 5, 131072 byt

Re: [PATCH v2 12/13] hw/arm/raspi: Add the Raspberry Pi B+ machine

2020-02-24 Thread Philippe Mathieu-Daudé

On 2/22/20 11:19 PM, Niek Linnenbank wrote:

Hey Philippe,

Very nice to see that the Raspberry 1 will be supported again, thanks 
for contributing this!


I tried to bring up the machine using raspbian 2019-09-26. It ran 
throught the early kernel initialisation

but for me it gets stuck at this point:

./arm-softmmu/qemu-system-arm -M raspi1b -kernel 
$HOME/raspi/boot/kernel.img -append 'printk.time=0 
earlycon=pl011,0x20201000 console=ttyAMA0 rootwait root=/dev/mmcblk0p2' \
-dtb $HOME/raspi/boot/bcm2708-rpi-b-plus.dtb -m 512 -sd 
$HOME/raspi/2019-09-26-raspbian-buster-lite.img -serial stdio -s


[    0.00] Booting Linux on physical CPU 0x0
[    0.00] Linux version 4.19.75+ (dom@buildbot) (gcc version 4.9.3 
(crosstool-NG crosstool-ng-1.22.0-88-g8460611)) #1270 Tue Sep 24 
18:38:54 BST 2019
[    0.00] CPU: ARMv6-compatible processor [410fb767] revision 7 
(ARMv7), cr=00c5387d

[    0.00] CPU: VIPT aliasing data cache, unknown instruction cache
[    0.00] OF: fdt: Machine model: Raspberry Pi Model B+
[    0.00] earlycon: pl11 at MMIO 0x20201000 (options '')
[    0.00] bootconsole [pl11] enabled
[    0.00] Memory policy: Data cache writeback
[    0.00] cma: Reserved 8 MiB at 0x1b80
[    0.00] random: get_random_bytes called from 
start_kernel+0x8c/0x49c with crng_init=0

[    0.00] Built 1 zonelists, mobility grouping on.  Total pages: 113680
[    0.00] Kernel command line: printk.time=0 
earlycon=pl011,0x20201000 console=ttyAMA0 rootwait root=/dev/mmcblk0p2

Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
Memory: 434380K/458752K available (6973K kernel code, 635K rwdata, 2080K 
rodata, 464K init, 797K bss, 16180K reserved, 8192K cma-reserved)

Virtual kernel memory layout:
     vector  : 0x - 0x1000   (   4 kB)
     fixmap  : 0xffc0 - 0xfff0   (3072 kB)
     vmalloc : 0xdc80 - 0xff80   ( 560 MB)
     lowmem  : 0xc000 - 0xdc00   ( 448 MB)
     modules : 0xbf00 - 0xc000   (  16 MB)
       .text : 0x(ptrval) - 0x(ptrval)   (6975 kB)
       .init : 0x(ptrval) - 0x(ptrval)   ( 464 kB)
       .data : 0x(ptrval) - 0x(ptrval)   ( 636 kB)
        .bss : 0x(ptrval) - 0x(ptrval)   ( 798 kB)
SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
ftrace: allocating 25197 entries in 74 pages
NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
sched_clock: 32 bits at 1000kHz, resolution 1000ns, wraps every 
2147483647500ns
clocksource: timer: mask: 0x max_cycles: 0x, 
max_idle_ns: 1911260446275 ns

bcm2835: system timer (irq = 27)
Console: colour dummy device 80x30

Maybe it should switch to the graphical console here, but I dont see the 
boot splash logo either (when using -stdio instead of -nographic).
With -M raspi2 and -dtb bcm2709-rpi-2-b.dtb the same raspbian image can 
fully boot to the login console.


Argh this is because I split this of a bigger series and didn't included 
changes related to the GPU 'properties', sorry.




Regards,
Niek



On Mon, Feb 17, 2020 at 12:51 PM Philippe Mathieu-Daudé > wrote:


   $ qemu-system-arm -M raspi1b -serial stdio \
       -kernel raspberrypi/firmware/boot/kernel.img \
       -dtb raspberrypi/firmware/boot/bcm2708-rpi-b.dtb \
       -append 'printk.time=0 earlycon=pl011,0x20201000 console=ttyAMA0'
   [    0.00] Booting Linux on physical CPU 0x0
   [    0.00] Linux version 4.19.69+ (dom@buildbot) (gcc version
4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611)) #1261 Tue Sep
3 20:21:01 BST 2019
   [    0.00] CPU: ARMv6-compatible processor [410fb767]
revision 7 (ARMv7), cr=00c5387d
   [    0.00] CPU: VIPT aliasing data cache, unknown instruction
cache
   [    0.00] OF: fdt: Machine model: Raspberry Pi Model B
   [    0.00] earlycon: pl11 at MMIO 0x20201000 (options '')
   [    0.00] bootconsole [pl11] enabled
   [    0.00] Memory policy: Data cache writeback
   [    0.00] cma: Reserved 8 MiB at 0x1b80
   [    0.00] random: get_random_bytes called from
start_kernel+0x8c/0x49c with crng_init=0
   [    0.00] Built 1 zonelists, mobility grouping on.  Total
pages: 113680
   [    0.00] Kernel command line: printk.time=0
earlycon=pl011,0x20201000 console=ttyAMA0
   Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
   Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
   Memory: 434380K/458752K available (6971K kernel code, 635K
rwdata, 2080K rodata, 464K init, 797K bss, 16180K reserved, 8192K
cma-reserved)
   ...

Signed-off-by: Philippe Mathieu-Daudé mailto:f4...@amsat.org>>
---
  hw/arm/raspi.c | 13 +
  1 file changed, 13 insertions(+)

diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c
index 3537a329ac..2d9f4e3085 100644
--- a/hw/arm/raspi.c

Re: [PATCH v2 12/13] hw/arm/raspi: Add the Raspberry Pi B+ machine

2020-02-22 Thread Niek Linnenbank
Hey Philippe,

Very nice to see that the Raspberry 1 will be supported again, thanks for
contributing this!

I tried to bring up the machine using raspbian 2019-09-26. It ran throught
the early kernel initialisation
but for me it gets stuck at this point:

./arm-softmmu/qemu-system-arm -M raspi1b -kernel
$HOME/raspi/boot/kernel.img -append 'printk.time=0
earlycon=pl011,0x20201000 console=ttyAMA0 rootwait root=/dev/mmcblk0p2' \
-dtb $HOME/raspi/boot/bcm2708-rpi-b-plus.dtb -m 512 -sd
$HOME/raspi/2019-09-26-raspbian-buster-lite.img -serial stdio -s

[0.00] Booting Linux on physical CPU 0x0
[0.00] Linux version 4.19.75+ (dom@buildbot) (gcc version 4.9.3
(crosstool-NG crosstool-ng-1.22.0-88-g8460611)) #1270 Tue Sep 24 18:38:54
BST 2019
[0.00] CPU: ARMv6-compatible processor [410fb767] revision 7
(ARMv7), cr=00c5387d
[0.00] CPU: VIPT aliasing data cache, unknown instruction cache
[0.00] OF: fdt: Machine model: Raspberry Pi Model B+
[0.00] earlycon: pl11 at MMIO 0x20201000 (options '')
[0.00] bootconsole [pl11] enabled
[0.00] Memory policy: Data cache writeback
[0.00] cma: Reserved 8 MiB at 0x1b80
[0.00] random: get_random_bytes called from start_kernel+0x8c/0x49c
with crng_init=0
[0.00] Built 1 zonelists, mobility grouping on.  Total pages: 113680
[0.00] Kernel command line: printk.time=0 earlycon=pl011,0x20201000
console=ttyAMA0 rootwait root=/dev/mmcblk0p2
Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
Memory: 434380K/458752K available (6973K kernel code, 635K rwdata, 2080K
rodata, 464K init, 797K bss, 16180K reserved, 8192K cma-reserved)
Virtual kernel memory layout:
vector  : 0x - 0x1000   (   4 kB)
fixmap  : 0xffc0 - 0xfff0   (3072 kB)
vmalloc : 0xdc80 - 0xff80   ( 560 MB)
lowmem  : 0xc000 - 0xdc00   ( 448 MB)
modules : 0xbf00 - 0xc000   (  16 MB)
  .text : 0x(ptrval) - 0x(ptrval)   (6975 kB)
  .init : 0x(ptrval) - 0x(ptrval)   ( 464 kB)
  .data : 0x(ptrval) - 0x(ptrval)   ( 636 kB)
   .bss : 0x(ptrval) - 0x(ptrval)   ( 798 kB)
SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
ftrace: allocating 25197 entries in 74 pages
NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
sched_clock: 32 bits at 1000kHz, resolution 1000ns, wraps every
2147483647500ns
clocksource: timer: mask: 0x max_cycles: 0x, max_idle_ns:
1911260446275 ns
bcm2835: system timer (irq = 27)
Console: colour dummy device 80x30

Maybe it should switch to the graphical console here, but I dont see the
boot splash logo either (when using -stdio instead of -nographic).
With -M raspi2 and -dtb bcm2709-rpi-2-b.dtb the same raspbian image can
fully boot to the login console.

Regards,
Niek



On Mon, Feb 17, 2020 at 12:51 PM Philippe Mathieu-Daudé 
wrote:

>   $ qemu-system-arm -M raspi1b -serial stdio \
>   -kernel raspberrypi/firmware/boot/kernel.img \
>   -dtb raspberrypi/firmware/boot/bcm2708-rpi-b.dtb \
>   -append 'printk.time=0 earlycon=pl011,0x20201000 console=ttyAMA0'
>   [0.00] Booting Linux on physical CPU 0x0
>   [0.00] Linux version 4.19.69+ (dom@buildbot) (gcc version 4.9.3
> (crosstool-NG crosstool-ng-1.22.0-88-g8460611)) #1261 Tue Sep 3 20:21:01
> BST 2019
>   [0.00] CPU: ARMv6-compatible processor [410fb767] revision 7
> (ARMv7), cr=00c5387d
>   [0.00] CPU: VIPT aliasing data cache, unknown instruction cache
>   [0.00] OF: fdt: Machine model: Raspberry Pi Model B
>   [0.00] earlycon: pl11 at MMIO 0x20201000 (options '')
>   [0.00] bootconsole [pl11] enabled
>   [0.00] Memory policy: Data cache writeback
>   [0.00] cma: Reserved 8 MiB at 0x1b80
>   [0.00] random: get_random_bytes called from
> start_kernel+0x8c/0x49c with crng_init=0
>   [0.00] Built 1 zonelists, mobility grouping on.  Total pages:
> 113680
>   [0.00] Kernel command line: printk.time=0
> earlycon=pl011,0x20201000 console=ttyAMA0
>   Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
>   Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
>   Memory: 434380K/458752K available (6971K kernel code, 635K rwdata, 2080K
> rodata, 464K init, 797K bss, 16180K reserved, 8192K cma-reserved)
>   ...
>
> Signed-off-by: Philippe Mathieu-Daudé 
> ---
>  hw/arm/raspi.c | 13 +
>  1 file changed, 13 insertions(+)
>
> diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c
> index 3537a329ac..2d9f4e3085 100644
> --- a/hw/arm/raspi.c
> +++ b/hw/arm/raspi.c
> @@ -324,6 +324,15 @@ static void
> raspi_machine_class_common_init(MachineClass *mc,
>  mc->default_ram_size = board_ram_size(board_rev);
>  };
>
> +static void raspi1b_machine_class_init(ObjectClass *oc, void *data)
> +{
> +MachineClass *mc = MACHINE_CLASS(oc);
> +RaspiMachineClass *rmc = RASPI_MACHINE_CLASS(oc

Re: [PATCH v2 12/13] hw/arm/raspi: Add the Raspberry Pi B+ machine

2020-02-21 Thread Eduardo Habkost
On Tue, Feb 18, 2020 at 10:35:43AM +0100, Philippe Mathieu-Daudé wrote:
> Cc'ing Eduardo/Igor.
> 
> On 2/18/20 9:48 AM, Luc Michel wrote:
> > On 2/17/20 12:45 PM, Philippe Mathieu-Daudé wrote:
> > >$ qemu-system-arm -M raspi1b -serial stdio \
> > >-kernel raspberrypi/firmware/boot/kernel.img \
> > >-dtb raspberrypi/firmware/boot/bcm2708-rpi-b.dtb \
> > >-append 'printk.time=0 earlycon=pl011,0x20201000 console=ttyAMA0'
> > >[0.00] Booting Linux on physical CPU 0x0
> > >[0.00] Linux version 4.19.69+ (dom@buildbot) (gcc version 
> > > 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611)) #1261 Tue Sep 3 
> > > 20:21:01 BST 2019
> > >[0.00] CPU: ARMv6-compatible processor [410fb767] revision 7 
> > > (ARMv7), cr=00c5387d
> > >[0.00] CPU: VIPT aliasing data cache, unknown instruction cache
> > >[0.00] OF: fdt: Machine model: Raspberry Pi Model B
> > >[0.00] earlycon: pl11 at MMIO 0x20201000 (options '')
> > >[0.00] bootconsole [pl11] enabled
> > >[0.00] Memory policy: Data cache writeback
> > >[0.00] cma: Reserved 8 MiB at 0x1b80
> > >[0.00] random: get_random_bytes called from 
> > > start_kernel+0x8c/0x49c with crng_init=0
> > >[0.00] Built 1 zonelists, mobility grouping on.  Total pages: 
> > > 113680
> > >[0.00] Kernel command line: printk.time=0 
> > > earlycon=pl011,0x20201000 console=ttyAMA0
> > >Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
> > >Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
> > >Memory: 434380K/458752K available (6971K kernel code, 635K rwdata, 
> > > 2080K rodata, 464K init, 797K bss, 16180K reserved, 8192K cma-reserved)
> > >...
> > > 
> > > Signed-off-by: Philippe Mathieu-Daudé 
> > > ---
> > >   hw/arm/raspi.c | 13 +
> > >   1 file changed, 13 insertions(+)
> > > 
> > > diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c
> > > index 3537a329ac..2d9f4e3085 100644
> > > --- a/hw/arm/raspi.c
> > > +++ b/hw/arm/raspi.c
> > > @@ -324,6 +324,15 @@ static void 
> > > raspi_machine_class_common_init(MachineClass *mc,
> > >   mc->default_ram_size = board_ram_size(board_rev);
> > >   };
> > > +static void raspi1b_machine_class_init(ObjectClass *oc, void *data)
> > > +{
> > > +MachineClass *mc = MACHINE_CLASS(oc);
> > > +RaspiMachineClass *rmc = RASPI_MACHINE_CLASS(oc);
> > > +
> > > +rmc->board_rev = 0x900032;
> > > +raspi_machine_class_common_init(mc, rmc->board_rev);
> > > +};
> > > +
> > >   static void raspi2b_machine_class_init(ObjectClass *oc, void *data)
> > >   {
> > >   MachineClass *mc = MACHINE_CLASS(oc);
> > > @@ -348,6 +357,10 @@ static void raspi3b_machine_class_init(ObjectClass 
> > > *oc, void *data)
> > >   static const TypeInfo raspi_machine_types[] = {
> > >   {
> > > +.name   = MACHINE_TYPE_NAME("raspi1b"),
> > If it's the B+ model, why not call it raspi1b+ ?
> 
> I thought about it (and prefer it), but I'm not sure this can have some
> side-effect.
> 
> Eduardo, Igor, is that OK to use a '+' in a machine name?

It would probably work, but I would prefer to avoid that.

> 
> So far the names used match [a-zA-Z0-9-].
> 
> > 
> > > +.parent = TYPE_RASPI_MACHINE,
> > > +.class_init = raspi1b_machine_class_init,
> > > +}, {
> > >   .name   = MACHINE_TYPE_NAME("raspi2b"),
> > >   .parent = TYPE_RASPI_MACHINE,
> > >   .class_init = raspi2b_machine_class_init,
> > > 
> > 
> 

-- 
Eduardo




Re: [PATCH v2 12/13] hw/arm/raspi: Add the Raspberry Pi B+ machine

2020-02-18 Thread Igor Mammedov
On Tue, 18 Feb 2020 10:35:43 +0100
Philippe Mathieu-Daudé  wrote:

> Cc'ing Eduardo/Igor.
> 
> On 2/18/20 9:48 AM, Luc Michel wrote:
> > On 2/17/20 12:45 PM, Philippe Mathieu-Daudé wrote:  
> >>$ qemu-system-arm -M raspi1b -serial stdio \
> >>-kernel raspberrypi/firmware/boot/kernel.img \
> >>-dtb raspberrypi/firmware/boot/bcm2708-rpi-b.dtb \
> >>-append 'printk.time=0 earlycon=pl011,0x20201000 console=ttyAMA0'
> >>[0.00] Booting Linux on physical CPU 0x0
> >>[0.00] Linux version 4.19.69+ (dom@buildbot) (gcc version 4.9.3 
> >> (crosstool-NG crosstool-ng-1.22.0-88-g8460611)) #1261 Tue Sep 3 20:21:01 
> >> BST 2019
> >>[0.00] CPU: ARMv6-compatible processor [410fb767] revision 7 
> >> (ARMv7), cr=00c5387d
> >>[0.00] CPU: VIPT aliasing data cache, unknown instruction cache
> >>[0.00] OF: fdt: Machine model: Raspberry Pi Model B
> >>[0.00] earlycon: pl11 at MMIO 0x20201000 (options '')
> >>[0.00] bootconsole [pl11] enabled
> >>[0.00] Memory policy: Data cache writeback
> >>[0.00] cma: Reserved 8 MiB at 0x1b80
> >>[0.00] random: get_random_bytes called from 
> >> start_kernel+0x8c/0x49c with crng_init=0
> >>[0.00] Built 1 zonelists, mobility grouping on.  Total pages: 
> >> 113680
> >>[0.00] Kernel command line: printk.time=0 
> >> earlycon=pl011,0x20201000 console=ttyAMA0
> >>Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
> >>Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
> >>Memory: 434380K/458752K available (6971K kernel code, 635K rwdata, 
> >> 2080K rodata, 464K init, 797K bss, 16180K reserved, 8192K cma-reserved)
> >>...
> >>
> >> Signed-off-by: Philippe Mathieu-Daudé 
> >> ---
> >>   hw/arm/raspi.c | 13 +
> >>   1 file changed, 13 insertions(+)
> >>
> >> diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c
> >> index 3537a329ac..2d9f4e3085 100644
> >> --- a/hw/arm/raspi.c
> >> +++ b/hw/arm/raspi.c
> >> @@ -324,6 +324,15 @@ static void 
> >> raspi_machine_class_common_init(MachineClass *mc,
> >>   mc->default_ram_size = board_ram_size(board_rev);
> >>   };
> >>   
> >> +static void raspi1b_machine_class_init(ObjectClass *oc, void *data)
> >> +{
> >> +MachineClass *mc = MACHINE_CLASS(oc);
> >> +RaspiMachineClass *rmc = RASPI_MACHINE_CLASS(oc);
> >> +
> >> +rmc->board_rev = 0x900032;
> >> +raspi_machine_class_common_init(mc, rmc->board_rev);
> >> +};
> >> +
> >>   static void raspi2b_machine_class_init(ObjectClass *oc, void *data)
> >>   {
> >>   MachineClass *mc = MACHINE_CLASS(oc);
> >> @@ -348,6 +357,10 @@ static void raspi3b_machine_class_init(ObjectClass 
> >> *oc, void *data)
> >>   
> >>   static const TypeInfo raspi_machine_types[] = {
> >>   {
> >> +.name   = MACHINE_TYPE_NAME("raspi1b"),  
> > If it's the B+ model, why not call it raspi1b+ ?  
> 
> I thought about it (and prefer it), but I'm not sure this can have some 
> side-effect.
> 
> Eduardo, Igor, is that OK to use a '+' in a machine name?
> 
> So far the names used match [a-zA-Z0-9-].
That was my impression as well.
How about "raspi1-plus"

 
> >   
> >> +.parent = TYPE_RASPI_MACHINE,
> >> +.class_init = raspi1b_machine_class_init,
> >> +}, {
> >>   .name   = MACHINE_TYPE_NAME("raspi2b"),
> >>   .parent = TYPE_RASPI_MACHINE,
> >>   .class_init = raspi2b_machine_class_init,
> >>  
> >   
> 




Re: [PATCH v2 12/13] hw/arm/raspi: Add the Raspberry Pi B+ machine

2020-02-18 Thread Philippe Mathieu-Daudé

Cc'ing Eduardo/Igor.

On 2/18/20 9:48 AM, Luc Michel wrote:

On 2/17/20 12:45 PM, Philippe Mathieu-Daudé wrote:

   $ qemu-system-arm -M raspi1b -serial stdio \
   -kernel raspberrypi/firmware/boot/kernel.img \
   -dtb raspberrypi/firmware/boot/bcm2708-rpi-b.dtb \
   -append 'printk.time=0 earlycon=pl011,0x20201000 console=ttyAMA0'
   [0.00] Booting Linux on physical CPU 0x0
   [0.00] Linux version 4.19.69+ (dom@buildbot) (gcc version 4.9.3 
(crosstool-NG crosstool-ng-1.22.0-88-g8460611)) #1261 Tue Sep 3 20:21:01 BST 
2019
   [0.00] CPU: ARMv6-compatible processor [410fb767] revision 7 
(ARMv7), cr=00c5387d
   [0.00] CPU: VIPT aliasing data cache, unknown instruction cache
   [0.00] OF: fdt: Machine model: Raspberry Pi Model B
   [0.00] earlycon: pl11 at MMIO 0x20201000 (options '')
   [0.00] bootconsole [pl11] enabled
   [0.00] Memory policy: Data cache writeback
   [0.00] cma: Reserved 8 MiB at 0x1b80
   [0.00] random: get_random_bytes called from start_kernel+0x8c/0x49c 
with crng_init=0
   [0.00] Built 1 zonelists, mobility grouping on.  Total pages: 113680
   [0.00] Kernel command line: printk.time=0 earlycon=pl011,0x20201000 
console=ttyAMA0
   Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
   Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
   Memory: 434380K/458752K available (6971K kernel code, 635K rwdata, 2080K 
rodata, 464K init, 797K bss, 16180K reserved, 8192K cma-reserved)
   ...

Signed-off-by: Philippe Mathieu-Daudé 
---
  hw/arm/raspi.c | 13 +
  1 file changed, 13 insertions(+)

diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c
index 3537a329ac..2d9f4e3085 100644
--- a/hw/arm/raspi.c
+++ b/hw/arm/raspi.c
@@ -324,6 +324,15 @@ static void raspi_machine_class_common_init(MachineClass 
*mc,
  mc->default_ram_size = board_ram_size(board_rev);
  };
  
+static void raspi1b_machine_class_init(ObjectClass *oc, void *data)

+{
+MachineClass *mc = MACHINE_CLASS(oc);
+RaspiMachineClass *rmc = RASPI_MACHINE_CLASS(oc);
+
+rmc->board_rev = 0x900032;
+raspi_machine_class_common_init(mc, rmc->board_rev);
+};
+
  static void raspi2b_machine_class_init(ObjectClass *oc, void *data)
  {
  MachineClass *mc = MACHINE_CLASS(oc);
@@ -348,6 +357,10 @@ static void raspi3b_machine_class_init(ObjectClass *oc, 
void *data)
  
  static const TypeInfo raspi_machine_types[] = {

  {
+.name   = MACHINE_TYPE_NAME("raspi1b"),

If it's the B+ model, why not call it raspi1b+ ?


I thought about it (and prefer it), but I'm not sure this can have some 
side-effect.


Eduardo, Igor, is that OK to use a '+' in a machine name?

So far the names used match [a-zA-Z0-9-].




+.parent = TYPE_RASPI_MACHINE,
+.class_init = raspi1b_machine_class_init,
+}, {
  .name   = MACHINE_TYPE_NAME("raspi2b"),
  .parent = TYPE_RASPI_MACHINE,
  .class_init = raspi2b_machine_class_init,








Re: [PATCH v2 12/13] hw/arm/raspi: Add the Raspberry Pi B+ machine

2020-02-18 Thread Luc Michel
On 2/17/20 12:45 PM, Philippe Mathieu-Daudé wrote:
>   $ qemu-system-arm -M raspi1b -serial stdio \
>   -kernel raspberrypi/firmware/boot/kernel.img \
>   -dtb raspberrypi/firmware/boot/bcm2708-rpi-b.dtb \
>   -append 'printk.time=0 earlycon=pl011,0x20201000 console=ttyAMA0'
>   [0.00] Booting Linux on physical CPU 0x0
>   [0.00] Linux version 4.19.69+ (dom@buildbot) (gcc version 4.9.3 
> (crosstool-NG crosstool-ng-1.22.0-88-g8460611)) #1261 Tue Sep 3 20:21:01 BST 
> 2019
>   [0.00] CPU: ARMv6-compatible processor [410fb767] revision 7 
> (ARMv7), cr=00c5387d
>   [0.00] CPU: VIPT aliasing data cache, unknown instruction cache
>   [0.00] OF: fdt: Machine model: Raspberry Pi Model B
>   [0.00] earlycon: pl11 at MMIO 0x20201000 (options '')
>   [0.00] bootconsole [pl11] enabled
>   [0.00] Memory policy: Data cache writeback
>   [0.00] cma: Reserved 8 MiB at 0x1b80
>   [0.00] random: get_random_bytes called from start_kernel+0x8c/0x49c 
> with crng_init=0
>   [0.00] Built 1 zonelists, mobility grouping on.  Total pages: 113680
>   [0.00] Kernel command line: printk.time=0 earlycon=pl011,0x20201000 
> console=ttyAMA0
>   Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
>   Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
>   Memory: 434380K/458752K available (6971K kernel code, 635K rwdata, 2080K 
> rodata, 464K init, 797K bss, 16180K reserved, 8192K cma-reserved)
>   ...
> 
> Signed-off-by: Philippe Mathieu-Daudé 
> ---
>  hw/arm/raspi.c | 13 +
>  1 file changed, 13 insertions(+)
> 
> diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c
> index 3537a329ac..2d9f4e3085 100644
> --- a/hw/arm/raspi.c
> +++ b/hw/arm/raspi.c
> @@ -324,6 +324,15 @@ static void raspi_machine_class_common_init(MachineClass 
> *mc,
>  mc->default_ram_size = board_ram_size(board_rev);
>  };
>  
> +static void raspi1b_machine_class_init(ObjectClass *oc, void *data)
> +{
> +MachineClass *mc = MACHINE_CLASS(oc);
> +RaspiMachineClass *rmc = RASPI_MACHINE_CLASS(oc);
> +
> +rmc->board_rev = 0x900032;
> +raspi_machine_class_common_init(mc, rmc->board_rev);
> +};
> +
>  static void raspi2b_machine_class_init(ObjectClass *oc, void *data)
>  {
>  MachineClass *mc = MACHINE_CLASS(oc);
> @@ -348,6 +357,10 @@ static void raspi3b_machine_class_init(ObjectClass *oc, 
> void *data)
>  
>  static const TypeInfo raspi_machine_types[] = {
>  {
> +.name   = MACHINE_TYPE_NAME("raspi1b"),
If it's the B+ model, why not call it raspi1b+ ?

> +.parent = TYPE_RASPI_MACHINE,
> +.class_init = raspi1b_machine_class_init,
> +}, {
>  .name   = MACHINE_TYPE_NAME("raspi2b"),
>  .parent = TYPE_RASPI_MACHINE,
>  .class_init = raspi2b_machine_class_init,
> 



[PATCH v2 12/13] hw/arm/raspi: Add the Raspberry Pi B+ machine

2020-02-17 Thread Philippe Mathieu-Daudé
  $ qemu-system-arm -M raspi1b -serial stdio \
  -kernel raspberrypi/firmware/boot/kernel.img \
  -dtb raspberrypi/firmware/boot/bcm2708-rpi-b.dtb \
  -append 'printk.time=0 earlycon=pl011,0x20201000 console=ttyAMA0'
  [0.00] Booting Linux on physical CPU 0x0
  [0.00] Linux version 4.19.69+ (dom@buildbot) (gcc version 4.9.3 
(crosstool-NG crosstool-ng-1.22.0-88-g8460611)) #1261 Tue Sep 3 20:21:01 BST 
2019
  [0.00] CPU: ARMv6-compatible processor [410fb767] revision 7 (ARMv7), 
cr=00c5387d
  [0.00] CPU: VIPT aliasing data cache, unknown instruction cache
  [0.00] OF: fdt: Machine model: Raspberry Pi Model B
  [0.00] earlycon: pl11 at MMIO 0x20201000 (options '')
  [0.00] bootconsole [pl11] enabled
  [0.00] Memory policy: Data cache writeback
  [0.00] cma: Reserved 8 MiB at 0x1b80
  [0.00] random: get_random_bytes called from start_kernel+0x8c/0x49c 
with crng_init=0
  [0.00] Built 1 zonelists, mobility grouping on.  Total pages: 113680
  [0.00] Kernel command line: printk.time=0 earlycon=pl011,0x20201000 
console=ttyAMA0
  Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
  Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
  Memory: 434380K/458752K available (6971K kernel code, 635K rwdata, 2080K 
rodata, 464K init, 797K bss, 16180K reserved, 8192K cma-reserved)
  ...

Signed-off-by: Philippe Mathieu-Daudé 
---
 hw/arm/raspi.c | 13 +
 1 file changed, 13 insertions(+)

diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c
index 3537a329ac..2d9f4e3085 100644
--- a/hw/arm/raspi.c
+++ b/hw/arm/raspi.c
@@ -324,6 +324,15 @@ static void raspi_machine_class_common_init(MachineClass 
*mc,
 mc->default_ram_size = board_ram_size(board_rev);
 };
 
+static void raspi1b_machine_class_init(ObjectClass *oc, void *data)
+{
+MachineClass *mc = MACHINE_CLASS(oc);
+RaspiMachineClass *rmc = RASPI_MACHINE_CLASS(oc);
+
+rmc->board_rev = 0x900032;
+raspi_machine_class_common_init(mc, rmc->board_rev);
+};
+
 static void raspi2b_machine_class_init(ObjectClass *oc, void *data)
 {
 MachineClass *mc = MACHINE_CLASS(oc);
@@ -348,6 +357,10 @@ static void raspi3b_machine_class_init(ObjectClass *oc, 
void *data)
 
 static const TypeInfo raspi_machine_types[] = {
 {
+.name   = MACHINE_TYPE_NAME("raspi1b"),
+.parent = TYPE_RASPI_MACHINE,
+.class_init = raspi1b_machine_class_init,
+}, {
 .name   = MACHINE_TYPE_NAME("raspi2b"),
 .parent = TYPE_RASPI_MACHINE,
 .class_init = raspi2b_machine_class_init,
-- 
2.21.1