From: Stefan Weil <sw@weilnetz.de>
To: Andrew Baumann <Andrew.Baumann@microsoft.com>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
"qemu-arm@nongnu.org" <qemu-arm@nongnu.org>,
"Jan Petrouš" <jan.petrous@tieto.com>,
"Grégory ESTRADE" <gregory.estrade@gmail.com>
Subject: Re: [Qemu-devel] RFC: raspberry pi / pi2 / Windows-on-ARM support
Date: Tue, 17 Nov 2015 07:01:38 +0100 [thread overview]
Message-ID: <564AC2C2.5040708@weilnetz.de> (raw)
In-Reply-To: <BLUPR0301MB20343673123489A408C987859E1E0@BLUPR0301MB2034.namprd03.prod.outlook.com>
Am 16.11.2015 um 23:22 schrieb Andrew Baumann:
> Hi all,
>
> I have been working on Raspberry Pi 2 emulation, building on the previous work of Gregory Estrade, Stefan Weil and others on the original Raspberry Pi target. My current working tree (based off a recent master) is here:
> https://github.com/0xabu/qemu/tree/raspi
>
> The present status is:
> * The original Raspberry Pi (-M raspi) support works only with older kernels from Raspbian releases up to 2014-09-09, for unknown reasons that I haven't investigated. [1]
> * Pi 2 (-M raspi2) supports both Raspbian and Windows.
> * Raspbian boots on pi2, but fails on an implemented SETEND instruction in early userspace. I'm told there are patches/workarounds for this floating around, but have not tried them.
> * The Windows IoT image [2] boots completely, but the USB emulation is broken, so the only IO devices are framebuffer and serial console (which can be used for a kernel debugger).
> * All four Pi2 cores must be enabled for Windows, since the bootloader panics if the expected cores are not present. Conversely, Raspbian fails to boot if multiple cores are enabled, but I haven't debugged this, since qemu is faster with a single-core guest.
>
> I realise that getting this code integrated will require a series of smaller patches, but wanted to solicit any early feedback before I start doing that. I've verified that checkpatch.pl is happy, but if there are other stylistic or general problems with the code it would be helpful to know about them sooner rather than later :) If anyone has specific suggestions for how to split up the patch, that would also be welcome. If not, I will start submitting patches for the individual pieces, probably starting with the machine definition and then the larger devices, followed by the Windows-specific fixes described below.
>
> There are also a couple of significant (non Pi-specific) changes that I made in order to boot a Windows on ARM guest, which also I plan to submit:
> 1. UEFI (TianoCore / EDK2) has a couple of bugs in its MMC support -- it assumes support for CMD23 (set multiple block count, which is supposed to be optional), and also fails to initialise correctly if the card is ready immediately upon issuing ACMD41. My tree includes workarounds for both issues -- I implemented CMD23, and modelled a small delay when initialising the SD card.
> 2. For better or worse, Windows relies on taking alignment faults on a misaligned LDREX, however qemu doesn't perform any alignment checks, leading to a bluescreen very early in boot. The changes in target-arm implement a generic infrastructure for testing/raising alignment exceptions, and add a suitable check to LDREX. (This is almost certainly applicable to arm64 as well, but I don't have a means to test it.)
>
> Here's the current diffstat (ignore the minor unrelated bugfixes in lan9118 and tap-win32):
> default-configs/arm-softmmu.mak | 1 +
> hw/arm/Makefile.objs | 1 +
> hw/arm/raspi.c | 514 ++++++++++++++++
> hw/char/Makefile.objs | 1 +
> hw/char/bcm2835_aux.c | 250 ++++++++
> hw/display/Makefile.objs | 1 +
> hw/display/bcm2835_fb.c | 384 ++++++++++++
> hw/dma/Makefile.objs | 1 +
> hw/dma/bcm2835_dma.c | 352 +++++++++++
> hw/intc/Makefile.objs | 1 +
> hw/intc/bcm2835_ic.c | 248 ++++++++
> hw/intc/bcm2836_control.c | 373 ++++++++++++
> hw/misc/Makefile.objs | 5 +
> hw/misc/bcm2835_mphi.c | 176 ++++++
> hw/misc/bcm2835_power.c | 113 ++++
> hw/misc/bcm2835_property.c | 409 +++++++++++++
> hw/misc/bcm2835_sbm.c | 294 ++++++++++
> hw/misc/bcm2835_vchiq.c | 113 ++++
> hw/net/lan9118.c | 18 +-
> hw/sd/Makefile.objs | 1 +
> hw/sd/bcm2835_emmc.c | 844 +++++++++++++++++++++++++++
> hw/sd/sd.c | 78 ++-
> hw/timer/Makefile.objs | 2 +
> hw/timer/arm_timer.c | 39 ++
> hw/timer/bcm2835_st.c | 201 +++++++
> hw/timer/bcm2835_timer.c | 242 ++++++++
> hw/usb/Makefile.objs | 2 +
> hw/usb/bcm2835_usb.c | 655 +++++++++++++++++++++
> hw/usb/bcm2835_usb_regs.h | 1061 ++++++++++++++++++++++++++++++++++
> include/hw/arm/bcm2835_arm_control.h | 481 +++++++++++++++
> include/hw/arm/bcm2835_common.h | 35 ++
> include/hw/arm/raspi_platform.h | 155 +++++
> net/tap-win32.c | 51 +-
> target-arm/helper.c | 8 +
> target-arm/helper.h | 1 +
> target-arm/internals.h | 3 +
> target-arm/op_helper.c | 21 +
> target-arm/translate.c | 29 +
> 38 files changed, 7141 insertions(+), 23 deletions(-)
>
> The command line I've used for Raspbian is:
> qemu-system-arm -M raspi2 -m 1024 -kernel kernel7.img -sd 2015-09-24-raspbian-jessie.img -append "rw earlyprintk loglevel=8 bcm2708_fb.fbwidth=1024 bcm2708_fb.fbheight=768 bcm2708.boardrev=0xf bcm2708.serial=0xcad0eedf vc_mem.mem_base=0x1c000000 vc_mem.mem_size=0x20000000 dwc_otg.lpm_enable=0 root=/dev/mmcblk0p2"
>
> The command line for Windows is:
> qemu-system-arm -M raspi2 -smp 4 -m 1024 -bios kernel.img -sd th2preview_pi2_iot.vhd
> (where kernel.img is the EDK2 bootloader from the first partition of the Windows image).
>
> Cheers,
> Andrew
>
> [1] https://www.raspberrypi.org/forums/viewtopic.php?f=72&t=26561&start=125
> [2] http://ms-iot.github.io/content/en-US/Downloads.htm
>
Hi Andrew,
thanks for this great overview of your activities regarding QEMU with
Raspberry Pi 2 support.
The QEMU development is currently preparing the new version 2.5 (see
http://wiki.qemu.org/Planning/2.5, http://wiki.qemu.org/ChangeLog/2.5).
This should be finished until 2015-12-10 (maybe a little later).
New patches for RPi can be discussed earlier, but won't be applied
to Git master before version 2.5 is finished.
I wish you good luck and hope RPi will be available to all QEMU users
soon. This target should be added to http://wiki.qemu.org/Planning/2.6
(or will it be http://wiki.qemu.org/Planning/3.0?), so nobody forgets
it. :-)
Kind regards,
Stefan
next prev parent reply other threads:[~2015-11-17 6:01 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-16 22:22 [Qemu-devel] RFC: raspberry pi / pi2 / Windows-on-ARM support Andrew Baumann
2015-11-17 6:01 ` Stefan Weil [this message]
2015-11-18 7:51 ` Peter Crosthwaite
2015-11-18 18:16 ` Andrew Baumann
2015-11-18 19:35 ` Peter Crosthwaite
2015-11-25 0:00 ` Andrew Baumann
2015-11-25 6:04 ` Peter Crosthwaite
2015-11-25 9:11 ` Peter Maydell
2015-11-25 18:14 ` Andrew Baumann
2015-11-26 16:53 ` Paolo Bonzini
2015-11-25 18:02 ` Andrew Baumann
2015-11-26 19:38 ` Peter Crosthwaite
2015-11-26 20:49 ` Andrew Baumann
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=564AC2C2.5040708@weilnetz.de \
--to=sw@weilnetz.de \
--cc=Andrew.Baumann@microsoft.com \
--cc=gregory.estrade@gmail.com \
--cc=jan.petrous@tieto.com \
--cc=pbonzini@redhat.com \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).