All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Warren <swarren@wwwdotorg.org>
To: Gerd Hoffmann <kraxel@redhat.com>,
	Peter Crosthwaite <crosthwaitepeter@gmail.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
	Markus Armbruster <armbru@redhat.com>,
	Andrew Baumann <Andrew.Baumann@microsoft.com>,
	QEMU Developers <qemu-devel@nongnu.org>,
	qemu-arm <qemu-arm@nongnu.org>,
	Sylvain Garrigues <sylvain@sylvaingarrigues.com>,
	Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [Qemu-arm] [Qemu-devel] [PATCH] bcm2835_property: use cached values when querying framebuffer
Date: Fri, 22 Apr 2016 09:43:23 -0600	[thread overview]
Message-ID: <571A469B.5050501@wwwdotorg.org> (raw)
In-Reply-To: <1461311177.28204.67.camel@redhat.com>

On 04/22/2016 01:46 AM, Gerd Hoffmann wrote:
>    Hi,
>
>>> Ideally as was mentioned earlier this would be done by simply executing the
>>> existing bootloader under emulation, rather than building all that code into
>>> qemu. However, in the Pi case, the bootloader runs on the VideoCore (a
>>> separate non-ARM CPU), so isn't (and likely won't be since IIUC it isn't
>>> fully documented) emulated by qemu. by the time the ARM CPU runs, everything
>>> (kernel, DTB/ATAGS, ARM boot stub, ...) is already loaded into RAM, the
>>> display is already probed over HDMI and the controller scanning out a dummy
>>> image, etc.
>>>
>>> So I think if that were to be supported, it'd have to be coded into qemu. Is
>>> that something that could happen, or would such patches not fit qemu's model
>>> well?
>>
>> I made half a start on this project but had to shelve it.
>>
>> The hard part is the FAT filesystem. The basic approach I started on
>> was to link in the relevant bits of the GNU mtools so QEMU can poke
>> around in a FAT filesystem hosted on a block device. Then just mount
>> the SD card and emulate the boot logic of the VideoCore bootloader.
>> This amount of new code should actually be pretty small, as the FS
>> driver is handled by mtools and the SDHCI can be shorted by just
>> having this alternate bootloader go direct to the block device (fish
>> the blockdev out from the SD card).
>
> Alternatively we can just go for a later boot loader stage, i.e. put a
> u-boot build for rpi2 to pc-bios/ (we already have one for ppc there)
> and run that by default.

The disadvantage here is that people might expect all their options in 
config.txt (e.g. kernel command-line, load address, DTB overlays, GPU 
RAM size, etc.) to be honored on any Pi platform. If we jump straight 
into U-Boot, they won't be, at least not in the typical Pi way.

> Our sdcard emulation seems to have problems though:
>
>     U-Boot 2016.05-rc2 (Apr 22 2016 - 09:11:45 +0200)
>
>     DRAM:  960 MiB
>     RPI 2 Model B (0xa21041)
>     MMC:   <uboot hangs here>

This particular issue is because the bcm2835 timer isn't emulated, and 
the U-Boot MMC driver call udelay or similar, which is implemented by 
waiting for that timer to tick. There's a patch in Andrew's github tree 
that implements the timer, and with that U-Boot at least gets to its 
shell prompt, or did the last time I tested it.

WARNING: multiple messages have this Message-ID (diff)
From: Stephen Warren <swarren@wwwdotorg.org>
To: Gerd Hoffmann <kraxel@redhat.com>,
	Peter Crosthwaite <crosthwaitepeter@gmail.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
	Markus Armbruster <armbru@redhat.com>,
	Andrew Baumann <Andrew.Baumann@microsoft.com>,
	QEMU Developers <qemu-devel@nongnu.org>,
	qemu-arm <qemu-arm@nongnu.org>,
	Sylvain Garrigues <sylvain@sylvaingarrigues.com>,
	Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [Qemu-devel] [Qemu-arm] [PATCH] bcm2835_property: use cached values when querying framebuffer
Date: Fri, 22 Apr 2016 09:43:23 -0600	[thread overview]
Message-ID: <571A469B.5050501@wwwdotorg.org> (raw)
In-Reply-To: <1461311177.28204.67.camel@redhat.com>

On 04/22/2016 01:46 AM, Gerd Hoffmann wrote:
>    Hi,
>
>>> Ideally as was mentioned earlier this would be done by simply executing the
>>> existing bootloader under emulation, rather than building all that code into
>>> qemu. However, in the Pi case, the bootloader runs on the VideoCore (a
>>> separate non-ARM CPU), so isn't (and likely won't be since IIUC it isn't
>>> fully documented) emulated by qemu. by the time the ARM CPU runs, everything
>>> (kernel, DTB/ATAGS, ARM boot stub, ...) is already loaded into RAM, the
>>> display is already probed over HDMI and the controller scanning out a dummy
>>> image, etc.
>>>
>>> So I think if that were to be supported, it'd have to be coded into qemu. Is
>>> that something that could happen, or would such patches not fit qemu's model
>>> well?
>>
>> I made half a start on this project but had to shelve it.
>>
>> The hard part is the FAT filesystem. The basic approach I started on
>> was to link in the relevant bits of the GNU mtools so QEMU can poke
>> around in a FAT filesystem hosted on a block device. Then just mount
>> the SD card and emulate the boot logic of the VideoCore bootloader.
>> This amount of new code should actually be pretty small, as the FS
>> driver is handled by mtools and the SDHCI can be shorted by just
>> having this alternate bootloader go direct to the block device (fish
>> the blockdev out from the SD card).
>
> Alternatively we can just go for a later boot loader stage, i.e. put a
> u-boot build for rpi2 to pc-bios/ (we already have one for ppc there)
> and run that by default.

The disadvantage here is that people might expect all their options in 
config.txt (e.g. kernel command-line, load address, DTB overlays, GPU 
RAM size, etc.) to be honored on any Pi platform. If we jump straight 
into U-Boot, they won't be, at least not in the typical Pi way.

> Our sdcard emulation seems to have problems though:
>
>     U-Boot 2016.05-rc2 (Apr 22 2016 - 09:11:45 +0200)
>
>     DRAM:  960 MiB
>     RPI 2 Model B (0xa21041)
>     MMC:   <uboot hangs here>

This particular issue is because the bcm2835 timer isn't emulated, and 
the U-Boot MMC driver call udelay or similar, which is implemented by 
waiting for that timer to tick. There's a patch in Andrew's github tree 
that implements the timer, and with that U-Boot at least gets to its 
shell prompt, or did the last time I tested it.

  parent reply	other threads:[~2016-04-22 15:43 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-21 10:41 [Qemu-devel] [PATCH] bcm2835_property: use cached values when querying framebuffer Sylvain Garrigues
2016-04-21 10:41 ` Sylvain Garrigues
2016-04-21 12:45 ` [Qemu-arm] " Peter Maydell
2016-04-21 12:45   ` [Qemu-devel] " Peter Maydell
2016-04-21 12:50   ` [Qemu-arm] " Sylvain Garrigues
2016-04-21 12:50     ` [Qemu-devel] " Sylvain Garrigues
2016-04-21 12:54     ` Peter Maydell
2016-04-21 12:54       ` Peter Maydell
2016-04-21 13:15       ` [Qemu-arm] " Sylvain Garrigues
2016-04-21 13:15         ` [Qemu-devel] " Sylvain Garrigues
2016-04-21 13:42         ` [Qemu-arm] " Peter Maydell
2016-04-21 13:42           ` [Qemu-devel] " Peter Maydell
2016-04-21 14:07           ` [Qemu-arm] " Sylvain Garrigues
2016-04-21 14:07             ` [Qemu-devel] " Sylvain Garrigues
2016-04-21 16:06             ` [Qemu-arm] " Stephen Warren
2016-04-21 16:06               ` [Qemu-devel] " Stephen Warren
2016-04-22  7:17               ` Peter Crosthwaite
2016-04-22  7:17                 ` [Qemu-devel] " Peter Crosthwaite
2016-04-22  7:46                 ` [Qemu-arm] [Qemu-devel] " Gerd Hoffmann
2016-04-22  7:46                   ` [Qemu-devel] [Qemu-arm] " Gerd Hoffmann
2016-04-22 11:56                   ` Andrew Baumann
2016-04-22 11:56                     ` Andrew Baumann
2016-04-22 15:43                   ` Stephen Warren [this message]
2016-04-22 15:43                     ` Stephen Warren
2016-04-22 16:50                   ` [Qemu-arm] [Qemu-devel] " Peter Crosthwaite
2016-04-22 16:50                     ` [Qemu-devel] [Qemu-arm] " Peter Crosthwaite
2016-04-22 11:44                 ` Andrew Baumann
2016-04-22 11:44                   ` [Qemu-devel] " Andrew Baumann
2016-04-22 16:55                   ` Peter Crosthwaite
2016-04-22 16:55                     ` [Qemu-devel] " Peter Crosthwaite
2016-04-22 18:09                   ` Sylvain Garrigues
2016-04-22 18:09                     ` Sylvain Garrigues
2016-04-22 11:22 ` [Qemu-arm] [Qemu-devel] " Andrew Baumann
2016-04-22 11:22   ` Andrew Baumann
2016-04-22 11:26   ` [Qemu-arm] " Sylvain Garrigues
2016-04-22 11:26     ` Sylvain Garrigues
2016-04-22 11:30     ` [Qemu-arm] " Andrew Baumann
2016-04-22 11:30       ` Andrew Baumann
2016-04-22 12:12       ` [Qemu-arm] " Sylvain Garrigues
2016-04-22 12:12         ` Sylvain Garrigues
2016-05-09 10:27       ` [Qemu-arm] " Paolo Bonzini
2016-05-09 10:27         ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=571A469B.5050501@wwwdotorg.org \
    --to=swarren@wwwdotorg.org \
    --cc=Andrew.Baumann@microsoft.com \
    --cc=armbru@redhat.com \
    --cc=crosthwaitepeter@gmail.com \
    --cc=kraxel@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=sylvain@sylvaingarrigues.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.