Re: [Qemu-devel] [PATCH v3 0/5] Raspberry Pi framebuffer, DMA and Windows support

2016-03-20 Thread Peter Maydell
On 16 March 2016 at 23:01, Andrew Baumann  wrote:
> However, I don't seem to be able to repro this. What exactly were
> you booting?

This was the Ubuntu kernel from the 2015-04-06-ubuntu-trusty.zip
which is linked to from https://wiki.ubuntu.com/ARM/RaspberryPi

thanks
-- PMM



Re: [Qemu-devel] [PATCH v3 0/5] Raspberry Pi framebuffer, DMA and Windows support

2016-03-20 Thread Peter Maydell
On 8 March 2016 at 20:05, Andrew Baumann  wrote:
> This patch series adds support for the AUX (second UART), framebuffer
> and DMA controller on Raspberry Pi 2, and enables booting Windows on
> this device. As with the previous series, it is heavily based on the
> original (out of tree) work of Gregory Estrade, Stefan Weil and others
> to support Raspberry Pi 1.
>
> After this series, it is possible to boot Windows by following the
> instructions at https://github.com/0xabu/qemu/wiki. You also boot
> Raspbian to the GUI using a command such as:
>
>   qemu-system-arm -M raspi2 -kernel raspbian-boot/kernel7.img -sd
>   2015-09-24-raspbian-jessie.img -append "rw earlyprintk loglevel=8
>   console=ttyAMA0 dwc_otg.lpm_enable=0 root=/dev/mmcblk0p2 rootwait"
>   -dtb raspbian-boot/bcm2709-rpi-2-b.dtb -serial stdio

So I tried something like this, and the kernel gives a WARNING with
a backtrace, and then hangs:

[5.413943] VFP support v0.3: implementor 41 architecture 4 part 30
variant f rev 0
[5.976888] pinctrl core: initialized pinctrl subsystem
[6.171197] NET: Registered protocol family 16
[6.286799] DMA: preallocated 4096 KiB pool for atomic coherent allocations
[6.366889] cpuidle: using governor ladder
[6.391665] cpuidle: using governor menu
[6.401604] bcm2709.uart_clock = 300
[6.478063] [ cut here ]
[6.481052] WARNING: CPU: 0 PID: 1 at
/build/buildd/linux-3.18.0/arch/arm/mach-bcm2709/armctrl.c:148
armctrl_xlate+0x188/0x274()
[6.484474] Modules linked in:
[6.489783] CPU: 0 PID: 1 Comm: swapper/0 Not tainted
3.18.0-20-rpi2 #21-Ubuntu
[6.502781] [<80016ab0>] (unwind_backtrace) from [<800129d0>]
(show_stack+0x10/0x14)
[6.506355] [<800129d0>] (show_stack) from [<805fee10>]
(dump_stack+0x9c/0xd4)
[6.508946] [<805fee10>] (dump_stack) from [<80026ed8>]
(warn_slowpath_common+0x70/0x8c)
[6.511251] [<80026ed8>] (warn_slowpath_common) from [<80026f90>]
(warn_slowpath_null+0x1c/0x24)
[6.512797] [<80026f90>] (warn_slowpath_null) from [<80022044>]
(armctrl_xlate+0x188/0x274)
[6.514558] [<80022044>] (armctrl_xlate) from [<8007399c>]
(irq_create_of_mapping+0x64/0x110)
[6.517173] [<8007399c>] (irq_create_of_mapping) from [<804c4ef4>]
(irq_of_parse_and_map+0x24/0x2c)
[6.518741] [<804c4ef4>] (irq_of_parse_and_map) from [<804c4f14>]
(of_irq_to_resource+0x18/0xb8)
[6.520209] [<804c4f14>] (of_irq_to_resource) from [<804c4ff0>]
(of_irq_to_resource_table+0x3c/0x54)
[6.523598] [<804c4ff0>] (of_irq_to_resource_table) from
[<804c25b8>] (of_device_alloc+0xd8/0x180)
[6.528838] [<804c25b8>] (of_device_alloc) from [<804c26a8>]
(of_platform_device_create_pdata+0x48/0x98)
[6.535352] [<804c26a8>] (of_platform_device_create_pdata) from
[<804c27f0>] (of_platform_bus_create+0xec/0x3ac)
[6.539440] [<804c27f0>] (of_platform_bus_create) from [<804c2860>]
(of_platform_bus_create+0x15c/0x3ac)
[6.541217] [<804c2860>] (of_platform_bus_create) from [<804c2c28>]
(of_platform_populate+0x5c/0xa0)
[6.542770] [<804c2c28>] (of_platform_populate) from [<8088cad8>]
(bcm2709_init+0x64/0x3fc)
[6.546211] [<8088cad8>] (bcm2709_init) from [<8070>]
(customize_machine+0x20/0x40)
[6.547711] [<8070>] (customize_machine) from [<800088bc>]
(do_one_initcall+0xd8/0x208)
[6.549200] [<800088bc>] (do_one_initcall) from [<80885ef4>]
(kernel_init_freeable+0x1fc/0x29c)
[6.551771] [<80885ef4>] (kernel_init_freeable) from [<805f9298>]
(kernel_init+0x8/0xf0)
[6.553319] [<805f9298>] (kernel_init) from [<8000efe8>]
(ret_from_fork+0x14/0x2c)
[6.556670] ---[ end trace 088ba587f0a009cc ]---
[6.649948] No ATAGs?
[6.658029] hw-breakpoint: found 5 (+1 reserved) breakpoint and 4
watchpoint registers.
[6.660393] hw-breakpoint: maximum watchpoint size is 8 bytes.
[6.664206] mailbox: Broadcom VideoCore Mailbox driver
[6.693912] bcm2708_vcio: mailbox at f300b880
[6.703745] bcm_power: Broadcom power driver
[6.707642] bcm_power_open() -> 0
[6.708671] bcm_power_request(0, 8)

Does that look familiar? (My first guess is just that it wants some
bit of hardware we haven't got a device model for yet. I haven't
tried to investigate at all yet.)

thanks
-- PMM



Re: [Qemu-devel] [PATCH v3 0/5] Raspberry Pi framebuffer, DMA and Windows support

2016-03-19 Thread Gerd Hoffmann
  Hi,

> [9.167683] mmc0: command never completed.
> [9.172133] mmc0:>cmd op 52 arg 0xc00 flags 0x195 - resp   
>  , err 0
> [9.180379] mmc0: === REGISTER DUMP ===
> [9.187193] mmc0: SDCMD  0x8034
> [9.190113] mmc0: SDARG  0x0c00
> [9.192952] mmc0: SDTOUT 0x00f0
> [9.196064] mmc0: SDCDIV 0x026f
> [9.199091] mmc0: SDRSP0 0x
> [9.201915] mmc0: SDRSP1 0x
> [9.204915] mmc0: SDRSP2 0x
> [9.207672] mmc0: SDRSP3 0x
> [9.210453] mmc0: SDHSTS 0x07f8
> [9.213612] mmc0: SDVDD  0x0001
> [9.216977] mmc0: SDEDM  0x00010800
> [9.219728] mmc0: SDHCFG 0x040a
> [9.222666] mmc0: SDHBCT 0x
> [9.228116] mmc0: SDHBLC 0x
> [9.230866] mmc0: ===

Saw that one too (4.4 kernel).

Also I had to remove the rng from the device tree to come that far in
the first place, otherwise the kernel hangs earlier when trying to
initialize the rng.

cheers,
  Gerd




Re: [Qemu-devel] [PATCH v3 0/5] Raspberry Pi framebuffer, DMA and Windows support

2016-03-19 Thread Peter Maydell
On 8 March 2016 at 20:05, Andrew Baumann  wrote:
> This patch series adds support for the AUX (second UART), framebuffer
> and DMA controller on Raspberry Pi 2, and enables booting Windows on
> this device. As with the previous series, it is heavily based on the
> original (out of tree) work of Gregory Estrade, Stefan Weil and others
> to support Raspberry Pi 1.
>
> After this series, it is possible to boot Windows by following the
> instructions at https://github.com/0xabu/qemu/wiki. You also boot
> Raspbian to the GUI using a command such as:
>
>   qemu-system-arm -M raspi2 -kernel raspbian-boot/kernel7.img -sd
>   2015-09-24-raspbian-jessie.img -append "rw earlyprintk loglevel=8
>   console=ttyAMA0 dwc_otg.lpm_enable=0 root=/dev/mmcblk0p2 rootwait"
>   -dtb raspbian-boot/bcm2709-rpi-2-b.dtb -serial stdio
>
> I plan to add USB, and remaining timers / system devices in
> future patch series, along with support for pi1 (bcm2835). In the
> meantime, the complete code is available at https://github.com/0xabu/qemu

Thanks, applied to target-arm.next.

-- PMM



Re: [Qemu-devel] [PATCH v3 0/5] Raspberry Pi framebuffer, DMA and Windows support

2016-03-19 Thread Andrew Baumann
> From: Peter Maydell [mailto:peter.mayd...@linaro.org]
> Sent: Wednesday, 16 March 2016 9:54 AM
> 
> On 8 March 2016 at 20:05, Andrew Baumann
>  wrote:
> > This patch series adds support for the AUX (second UART), framebuffer
> > and DMA controller on Raspberry Pi 2, and enables booting Windows on
> > this device. As with the previous series, it is heavily based on the
> > original (out of tree) work of Gregory Estrade, Stefan Weil and others
> > to support Raspberry Pi 1.
> >
> > After this series, it is possible to boot Windows by following the
> > instructions at https://github.com/0xabu/qemu/wiki. You also boot
> > Raspbian to the GUI using a command such as:
> >
> >   qemu-system-arm -M raspi2 -kernel raspbian-boot/kernel7.img -sd
> >   2015-09-24-raspbian-jessie.img -append "rw earlyprintk loglevel=8
> >   console=ttyAMA0 dwc_otg.lpm_enable=0 root=/dev/mmcblk0p2
> rootwait"
> >   -dtb raspbian-boot/bcm2709-rpi-2-b.dtb -serial stdio
> 
> So I tried something like this, and the kernel gives a WARNING with
> a backtrace, and then hangs:
> 
> [5.413943] VFP support v0.3: implementor 41 architecture 4 part 30
> variant f rev 0
> [5.976888] pinctrl core: initialized pinctrl subsystem
> [6.171197] NET: Registered protocol family 16
> [6.286799] DMA: preallocated 4096 KiB pool for atomic coherent allocations
> [6.366889] cpuidle: using governor ladder
> [6.391665] cpuidle: using governor menu
> [6.401604] bcm2709.uart_clock = 300
> [6.478063] [ cut here ]
> [6.481052] WARNING: CPU: 0 PID: 1 at
> /build/buildd/linux-3.18.0/arch/arm/mach-bcm2709/armctrl.c:148
> armctrl_xlate+0x188/0x274()
> [6.484474] Modules linked in:
> [6.489783] CPU: 0 PID: 1 Comm: swapper/0 Not tainted
> 3.18.0-20-rpi2 #21-Ubuntu
> [6.502781] [<80016ab0>] (unwind_backtrace) from [<800129d0>]
> (show_stack+0x10/0x14)
> [6.506355] [<800129d0>] (show_stack) from [<805fee10>]
> (dump_stack+0x9c/0xd4)
> [6.508946] [<805fee10>] (dump_stack) from [<80026ed8>]
> (warn_slowpath_common+0x70/0x8c)
> [6.511251] [<80026ed8>] (warn_slowpath_common) from [<80026f90>]
> (warn_slowpath_null+0x1c/0x24)
> [6.512797] [<80026f90>] (warn_slowpath_null) from [<80022044>]
> (armctrl_xlate+0x188/0x274)
> [6.514558] [<80022044>] (armctrl_xlate) from [<8007399c>]
> (irq_create_of_mapping+0x64/0x110)
> [6.517173] [<8007399c>] (irq_create_of_mapping) from [<804c4ef4>]
> (irq_of_parse_and_map+0x24/0x2c)
> [6.518741] [<804c4ef4>] (irq_of_parse_and_map) from [<804c4f14>]
> (of_irq_to_resource+0x18/0xb8)
> [6.520209] [<804c4f14>] (of_irq_to_resource) from [<804c4ff0>]
> (of_irq_to_resource_table+0x3c/0x54)
> [6.523598] [<804c4ff0>] (of_irq_to_resource_table) from
> [<804c25b8>] (of_device_alloc+0xd8/0x180)
> [6.528838] [<804c25b8>] (of_device_alloc) from [<804c26a8>]
> (of_platform_device_create_pdata+0x48/0x98)
> [6.535352] [<804c26a8>] (of_platform_device_create_pdata) from
> [<804c27f0>] (of_platform_bus_create+0xec/0x3ac)
> [6.539440] [<804c27f0>] (of_platform_bus_create) from [<804c2860>]
> (of_platform_bus_create+0x15c/0x3ac)
> [6.541217] [<804c2860>] (of_platform_bus_create) from [<804c2c28>]
> (of_platform_populate+0x5c/0xa0)
> [6.542770] [<804c2c28>] (of_platform_populate) from [<8088cad8>]
> (bcm2709_init+0x64/0x3fc)
> [6.546211] [<8088cad8>] (bcm2709_init) from [<8070>]
> (customize_machine+0x20/0x40)
> [6.547711] [<8070>] (customize_machine) from [<800088bc>]
> (do_one_initcall+0xd8/0x208)
> [6.549200] [<800088bc>] (do_one_initcall) from [<80885ef4>]
> (kernel_init_freeable+0x1fc/0x29c)
> [6.551771] [<80885ef4>] (kernel_init_freeable) from [<805f9298>]
> (kernel_init+0x8/0xf0)
> [6.553319] [<805f9298>] (kernel_init) from [<8000efe8>]
> (ret_from_fork+0x14/0x2c)
> [6.556670] ---[ end trace 088ba587f0a009cc ]---
> [6.649948] No ATAGs?
> [6.658029] hw-breakpoint: found 5 (+1 reserved) breakpoint and 4
> watchpoint registers.
> [6.660393] hw-breakpoint: maximum watchpoint size is 8 bytes.
> [6.664206] mailbox: Broadcom VideoCore Mailbox driver
> [6.693912] bcm2708_vcio: mailbox at f300b880
> [6.703745] bcm_power: Broadcom power driver
> [6.707642] bcm_power_open() -> 0
> [6.708671] bcm_power_request(0, 8)
> 
> Does that look familiar? (My first guess is just that it wants some
> bit of hardware we haven't got a device model for yet. I haven't
> tried to investigate at all yet.)

I haven't seen that, probably because I was doing all my testing with an older 
release (2015-09-24). There appear to be two problems. The warning is something 
related to the interrupt controller, but it's hard to tell exactly what's wrong 
there because the function in question (armctl_xlate) doesn't appear to do any 
hardware access. The bcm_power_request wedge should be expected for anything 
that tries to interact with power management, because we don't model 

[Qemu-devel] [PATCH v3 0/5] Raspberry Pi framebuffer, DMA and Windows support

2016-03-08 Thread Andrew Baumann
This patch series adds support for the AUX (second UART), framebuffer
and DMA controller on Raspberry Pi 2, and enables booting Windows on
this device. As with the previous series, it is heavily based on the
original (out of tree) work of Gregory Estrade, Stefan Weil and others
to support Raspberry Pi 1.

After this series, it is possible to boot Windows by following the
instructions at https://github.com/0xabu/qemu/wiki. You also boot
Raspbian to the GUI using a command such as:

  qemu-system-arm -M raspi2 -kernel raspbian-boot/kernel7.img -sd
  2015-09-24-raspbian-jessie.img -append "rw earlyprintk loglevel=8
  console=ttyAMA0 dwc_otg.lpm_enable=0 root=/dev/mmcblk0p2 rootwait"
  -dtb raspbian-boot/bcm2709-rpi-2-b.dtb -serial stdio

I plan to add USB, and remaining timers / system devices in
future patch series, along with support for pi1 (bcm2835). In the
meantime, the complete code is available at https://github.com/0xabu/qemu

v2:
 * added DMA controller
 * revised per PMM's review feedback
 * rebased on top of the patch for fixing ldl_phys/stl_phys in raspi
   devices, presently in target-arm.next

v3:
 * tweaked instantiation of uart1 char device
 * identified Gregory as primary author of framebuffer and DMA emulation

Cheers,
Andrew

Andrew Baumann (2):
  bcm2835_peripherals: enable sdhci pending-insert quirk for raspberry
pi
  bcm2835_aux: add emulation of BCM2835 AUX (aka UART1) block

Grégory ESTRADE (3):
  bcm2835_fb: add framebuffer device for Raspberry Pi
  bcm2835_property: implement framebuffer control/configuration
properties
  bcm2835_dma: add emulation of Raspberry Pi DMA controller

 hw/arm/bcm2835_peripherals.c | 103 -
 hw/arm/bcm2836.c |   2 +
 hw/arm/raspi.c   |  12 +-
 hw/char/Makefile.objs|   1 +
 hw/char/bcm2835_aux.c| 316 ++
 hw/display/Makefile.objs |   1 +
 hw/display/bcm2835_fb.c  | 424 +++
 hw/dma/Makefile.objs |   1 +
 hw/dma/bcm2835_dma.c | 408 +
 hw/misc/bcm2835_property.c   | 139 +++-
 include/hw/arm/bcm2835_peripherals.h |   6 +
 include/hw/char/bcm2835_aux.h|  33 +++
 include/hw/display/bcm2835_fb.h  |  47 
 include/hw/dma/bcm2835_dma.h |  47 
 include/hw/misc/bcm2835_property.h   |   5 +-
 15 files changed, 1532 insertions(+), 13 deletions(-)
 create mode 100644 hw/char/bcm2835_aux.c
 create mode 100644 hw/display/bcm2835_fb.c
 create mode 100644 hw/dma/bcm2835_dma.c
 create mode 100644 include/hw/char/bcm2835_aux.h
 create mode 100644 include/hw/display/bcm2835_fb.h
 create mode 100644 include/hw/dma/bcm2835_dma.h

-- 
2.7.0