qemu-maemo: beagle model hangs if kernel tries to access NAND via prefetch/dma

Bug #645311 reported by Peter Maydell
22
This bug affects 3 people
Affects Status Importance Assigned to Milestone
qemu-maemo
Fix Released
Undecided
Unassigned

Bug Description

If you try to access the NAND devices in qemu-maemo's beagle model:

# dd if=/dev/mtd1 of=/dev/null bs=4096 count=1

this will hang, because the Linux mtd driver will default to trying to use prefetch and DMA to access the NAND, and hw/omap_gpmc.c is full of TODO comments regarding the prefetch control registers.

If you tell the kernel to use neither prefetch nor DMA (which you can do I think with a command line option and which I did by fiddling with the kernel variables in gdb :)) then access to the mtd devices works fine via the slow path.

Revision history for this message
Peter Maydell (pmaydell) wrote :

Paul Larson points out in bug 652544 that recent images (eg 20100930) now try to access the NAND on startup, so they hang. That makes this more urgent...

Revision history for this message
Peter Maydell (pmaydell) wrote :

> recent images (eg 20100930) now try to access the NAND on startup, so they hang

Gone away again in recent images, I think (eg 20101005), so back down to lower priority.

Revision history for this message
Peter Maydell (pmaydell) wrote :

> Gone away again in recent images, I think

Only true if you have a local hack to fix bug 638966 so we generate the same (working) image in linaro-media-create whether writing to mmc or not, rather than having a special case which writes a different boot command if writing to an image file.

Revision history for this message
Jani Monoses (jani) wrote :

is there a workaround to boot the existing 10.10 omap3 image in qemu-maemo by avoiding the NAND timeout error?

Revision history for this message
Peter Maydell (pmaydell) wrote :

You might see if you can pass the kernel a command line argument to turn off prefetch and DMA for the NAND accesses.

As I say, last time I tried this with a linaro image it worked OK, so if you could provide some brief reproducer instructions for where to get the image you're using and how you're invoking qemu that would be useful.

Revision history for this message
Jani Monoses (jani) wrote :

This is the command I use
qemu-maemo-system-arm -M beagle -m 256 -sd ubuntu-netbook-10.10-preinstalled-netbook-armel+omap.img -serial stdio

Wehre the image is the official Ubuntu 10.10 OMAP3 one
http://cdimage.ubuntu.com/ubuntu-netbook/ports/releases/10.10/release/ubuntu-netbook-10.10-preinstalled-netbook-armel+omap.img.gz

Revision history for this message
Peter Maydell (pmaydell) wrote :

OK, I have reproduced with that image. I've had a look at the OMAP3 TRM regarding the prefetch engine and I think this should not be impossibly difficult to implement, so I'm having a look at it now.

Revision history for this message
Peter Maydell (pmaydell) wrote :

I've implemented some patches to fix this, which you can find in this git branch on gitorious:
http://meego.gitorious.org/~pmaydell/qemu-maemo/pmaydell-qemu-meego/commits/nand-prefetch

and submitted a merge request to upstream:
http://meego.gitorious.org/qemu-maemo/qemu/merge_requests/1

Some notes if you're testing with the Ubuntu image:
(1) you'll need to dd some extra space onto the end of the .img file, otherwise the filesystem can't be resized and lots of things will complain about having no disk space:
dd if=/dev/zero of=ubuntu-netbook-10.10-preinstalled-netbook-armel+omap.img oflag=append conv=notrunc bs=1048576 count=1024

(2) it's pretty slow in places (minutes!), especially initial filesystem resize and setting up swap

(3) I was able to get the image to do the initial boot and setup, then it did its automated reboot, and then failed to start X because python died with a glibc-detected double free or something similar. I haven't investigated this, but the NAND access is pretty clearly working so I think that's a separate issue.

Revision history for this message
Jani Monoses (jani) wrote :

I confirm NAND access works with the new patches from your branch and it no longer hangs there, but as you experienced as well it does not boot fully, I'll file different bugs for those.

Jani Monoses (jani)
Changed in qemu-maemo:
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.