Re: [Qemu-devel] Booting Raspbian on RPi emulation

2018-12-18 Thread Ben Hekster via Qemu-devel
Hi, Zoltan—

> On Thu, 29 Nov 2018, Guenter Roeck wrote:
> On 11/29/18 6:42 PM, BALATON Zoltan wrote:
> On Thu, 29 Nov 2018, Guenter Roeck wrote:
> On 11/29/18 4:43 PM, Philippe Mathieu-Daudé wrote:
> Hi Zoltan,
> 
> On 29/11/18 21:29, BALATON Zoltan wrote:
> Hello,
> 
> I could not boot Raspbian on QEMU's raspi emulation and I'm not sure why
> it fails. So question is if this is supposed to work or am I doing
> something wrong or any clues what may be missing? I'm trying with this
> command line with v3.1.0-rc3:
> 
> qemu-system-arm -M raspi2 -serial stdio \
> -kernel rpi-kernel7.img -dtb bcm2709-rpi-2-b.dtb \
> -append "rw earlyprintk loglevel=8 console=ttyAMA0,115200
> dwc_otg.lpm_enable=0 root=/dev/mmcblk0p2" \
> -drive file=2018-10-09-raspbian-stretch-lite.img,format=raw,if=sd
> 
> Kernel starts to boot, I see raspberries on the guest screen and log
> output to serial:
> 
> Booting Linux on physical CPU 0xf00
> Linux version 4.14.71-v7+ (address@hidden) (gcc version 4.9.3
> (crosstool-NG crosstool-ng-1.22.0-88-g8460611)) #1145 SMP Fri Sep 21
> 15:38:35 BST 2018
> CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7), cr=10c5387d
> [...]
> 
> My version (https://github.com/groeck/qemu ) 
> seems to work, using
> Tried with your v3.1.0-local branch but got same results (does not find 
> mmcblk0 on raspi2, nothing on raspi3) so probably it's not one of the patches 
> in your tree that's missing.
> multi_v7_defconfig.
> Then maybe it's your kernel config that's different? Do you have compiled 
> kernels available that I could try?
> Shouldn't be, but I attached my configuration. This time with v4.14.84 and
> "make ARCH-arm savedefconfig" after building the image. The output is 
> identical
> to "make ARCH=arm multi_v7_defconfig; make ARCH=arm savedefconfig".
> 
> Oh, and here is my qemu configuration.
> 
> --disable-user --disable-gnutls --disable-docs \
>--disable-nettle --disable-gcrypt --disable-vnc-png \
>--disable-xen --disable-xen-pci-passthrough \
>--enable-debug --disable-strip
> 
> That should not make a difference either, but who knows.
> Just to be sure, I copied a kernel and a root file system
> to http://server.roeck-us.net/qemu/arm-raspi2/ 
> 
> It boots with your kernel (also the raspbian-lite image) so it's likely that 
> the config of the Raspbian kernel is different and that causes the problem. 
> Unfortunately I don't know what config their kernels use. If I'm not mistaken 
> this is the raspbian kernel repo:
> https://github.com/raspberrypi/linux/ 
> 
> My guesses would be bcm2835_defconfig or some other bcm*config? Or something 
> completely different?
> Regards,
> BALATON Zoltan

I had the exact same issue; for me it was just the addition of Günther's 
"rootwait" option that resolved it, so:

$ qemu-system-arm \
-m 256m \
-M raspi2 \
-cpu cortex-a7 \
-append "console=ttyAMA0,115200 root=/dev/mmcblk0p2 rootwait rw" \
-dtb bcm2709-rpi-2-b.dtb \
-drive file=2018-11-13-raspbian-stretch-lite.img,if=sd,format=raw \
-kernel kernel7.img \
-nographic

Did it for me using stock QEMU 3.1.0.  (I need "-nographic" because the OS X 
port crashes without it)

Ben



Re: [Qemu-devel] Booting Raspbian on RPi emulation

2018-12-19 Thread Ben Hekster via Qemu-devel
> On Dec 19, 2018, at 05:17, Peter Maydell  wrote:
> 
> 
> OSX works for me, though I don't test it thoroughly. If you
> are getting a crash that you can reproduce, please could
> you repro it under a debugger with a debug build of QEMU
> and send the all-threads backtrace for the crash?
> 
> thanks
> -- PMM

Still reproducible with current master on OS X Mojave 10.14.1.  Command line:

$ arm-softmmu/qemu-system-arm -M raspi2 -append "console=ttyAMA0,115200 
root=/dev/mmcblk0p2 rootwait rw" -cpu cortex-a7 -dtb bcm2709-rpi-2-b.dtb -drive 
file=2018-11-13-raspbian-stretch-lite.img,if=sd,format=raw -kernel kernel7.img 
-m 256m -no-reboot

Stack trace of crashing thread:

2018-12-19 09:33:01.348 qemu-system-arm[93254:2731556] *** Terminating app due 
to uncaught exception 'NSInternalInconsistencyException', reason: 'NSWindow 
drag regions should only be invalidated on the Main Thread!'
*** First throw call stack:
(
0   CoreFoundation  0x7fff35291e65 
__exceptionPreprocess + 256
1   libobjc.A.dylib 0x7fff612ed720 
objc_exception_throw + 48
2   CoreFoundation  0x7fff352ab8e5 
-[NSException raise] + 9
3   AppKit  0x7fff327b07e6 
-[NSWindow(NSWindow_Theme) 
_postWindowNeedsToResetDragMarginsUnlessPostingDisabled] + 324
4   AppKit  0x7fff327b5c40 -[NSView 
setFrameSize:] + 2082
5   AppKit  0x7fff32826975 
-[NSVisualEffectView setFrameSize:] + 171
6   AppKit  0x7fff328806a5 
-[NSTitlebarView setFrameSize:] + 84
7   AppKit  0x7fff327b4c49 -[NSView 
setFrame:] + 478
8   AppKit  0x7fff32880648 
-[NSTitlebarView resizeWithOldSuperviewSize:] + 100
9   AppKit  0x7fff327bbde6 -[NSView 
resizeSubviewsWithOldSize:] + 502
10  AppKit  0x7fff327b5ac9 -[NSView 
setFrameSize:] + 1707
11  AppKit  0x7fff3317604c 
-[NSTitlebarContainerView setFrameSize:] + 142
12  AppKit  0x7fff327b4c49 -[NSView 
setFrame:] + 478
13  AppKit  0x7fff327bc23d -[NSView 
resizeWithOldSuperviewSize:] + 776
14  AppKit  0x7fff327bbde6 -[NSView 
resizeSubviewsWithOldSize:] + 502
15  AppKit  0x7fff327b5ac9 -[NSView 
setFrameSize:] + 1707
16  AppKit  0x7fff32823a5e 
-[NSThemeFrame setFrameSize:] + 495
17  AppKit  0x7fff3281070b -[NSWindow 
_setFrame:updateBorderViewSize:] + 966
18  AppKit  0x7fff3281002e -[NSWindow 
_oldPlaceWindow:] + 547
19  AppKit  0x7fff3280f639 -[NSWindow 
_setFrameCommon:display:stashSize:] + 3006
20  AppKit  0x7fff3280ea65 -[NSWindow 
_setFrame:display:allowImplicitAnimation:stashSize:] + 192
21  AppKit  0x7fff3280e99e -[NSWindow 
setFrame:display:] + 51
22  AppKit  0x7fff3281932f -[NSWindow 
setFrame:display:animate:] + 130
23  qemu-system-arm 0x0001035cb13a 
-[QemuCocoaView switchSurface:] + 2282
24  qemu-system-arm 0x0001035d102e cocoa_switch 
+ 94
25  qemu-system-arm 0x0001035bfa46 
dpy_gfx_replace_surface + 278
26  qemu-system-arm 0x0001035c1721 
qemu_console_resize + 209
27  qemu-system-arm 0x00010310be80 
bcm2835_fb_reconfigure + 112
28  qemu-system-arm 0x00010315a65c 
bcm2835_property_mbox_push + 4156
29  qemu-system-arm 0x000103159584 
bcm2835_property_write + 148
30  qemu-system-arm 0x000103097cf3 
memory_region_write_accessor + 243
31  qemu-system-arm 0x000103097bd6 
access_with_adjusted_size + 454
32  qemu-system-arm 0x000103097702 
memory_region_dispatch_write + 258
33  qemu-system-arm 0x00010301bb84 
address_space_stl_internal + 212
34  qemu-system-arm 0x00010301bca7 
address_space_stl_le + 55
35  qemu-system-arm 0x000103158fd4 stl_le_phys 
+ 84
36  qemu-system-arm 0x000103158a6c 
bcm2835_mbox_write + 428
37  qemu-system-arm 0x000103097cf3 
memory_region_write_accessor + 243
38  qemu-system-arm 0x000103097bd6 
access_with_adjusted_size + 454

Re: [Qemu-devel] Booting Raspbian on RPi emulation

2018-12-19 Thread Ben Hekster via Qemu-devel
Checked out tag patchew/20181201123056.432-1-peter.mayd...@linaro.org from 
https://github.com/patchew-project/qemu and verified the crash no longer 
occurs.  It does indeed appear that the crash previously happened right around 
the time where I can now see the window being resized.

I've attached a screenshot here for you; not sure if this will make it through 
to the mailing list...

Ben

> On Dec 19, 2018, at 10:43, Peter Maydell  wrote:
> 
> On Wed, 19 Dec 2018 at 17:46, Ben Hekster  wrote:
>> probably a manifestation of https://bugs.launchpad.net/qemu/+bug/1802684
> 
> Yep. If you could test the patchset at
> http://patchew.org/QEMU/20181201123056.432-1-peter.mayd...@linaro.org/
> and confirm that it fixes the problem that would be great.
> 
> thanks
> -- PMM



Re: [Qemu-devel] Booting Raspbian on RPi emulation

2018-12-19 Thread Ben Hekster via Qemu-devel
Should have tested a little more:

While the crashing has stopped, the window isn't responsive to 
keystrokes.  This includes the frame buffer emulation itself (so I can't 
actually log in) as well as the QEMU Monitor; nothing I type has any effect in 
either.

Ben

> On Dec 19, 2018, at 11:36, Ben Hekster  wrote:
> 
> Checked out tag patchew/20181201123056.432-1-peter.mayd...@linaro.org 
>  from 
> https://github.com/patchew-project/qemu 
>  and verified the crash no longer 
> occurs.  It does indeed appear that the crash previously happened right 
> around the time where I can now see the window being resized.
> 
> I've attached a screenshot here for you; not sure if this will make it 
> through to the mailing list...
> 
> Ben
> 
>> On Dec 19, 2018, at 10:43, Peter Maydell > > wrote:
>> 
>> On Wed, 19 Dec 2018 at 17:46, Ben Hekster > > wrote:
>>> probably a manifestation of https://bugs.launchpad.net/qemu/+bug/1802684 
>>> 
>> Yep. If you could test the patchset at
>> http://patchew.org/QEMU/20181201123056.432-1-peter.mayd...@linaro.org/ 
>> 
>> and confirm that it fixes the problem that would be great.
>> 
>> thanks
>> -- PMM
> 
>