Bug 494075 - openbios bug causes qemu-system-ppc "invalid/unsupported opcode" failure
Summary: openbios bug causes qemu-system-ppc "invalid/unsupported opcode" failure
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: openbios
Version: rawhide
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Glauber Costa
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: F11VirtTarget
TreeView+ depends on / blocked
 
Reported: 2009-04-04 01:19 UTC by Adam Goode
Modified: 2009-06-05 11:00 UTC (History)
11 users (show)

Fixed In Version: 1.0-1.fc11
Clone Of:
Environment:
Last Closed: 2009-06-05 11:00:19 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
openbios-ppc, r482, working (265.08 KB, application/octet-stream)
2009-04-12 05:26 UTC, Pavel Roskin
no flags Details
Fix for the bug (736 bytes, patch)
2009-05-16 23:50 UTC, Pavel Roskin
no flags Details | Diff
openbios-ppc, r487, working, compiled by F10 binutils (273.08 KB, application/octet-stream)
2009-05-16 23:52 UTC, Pavel Roskin
no flags Details
openbios-ppc, r487, not working, compiled by F11 binutils (272.79 KB, text/plain)
2009-05-16 23:53 UTC, Pavel Roskin
no flags Details
openbios-ppc, r487 with the sbss fix, working, compiled by F11 binutils (272.75 KB, application/octet-stream)
2009-05-16 23:53 UTC, Pavel Roskin
no flags Details
Simpler fix - just merge .sbss and .sbss.* into .bss (634 bytes, patch)
2009-05-17 01:06 UTC, Pavel Roskin
no flags Details | Diff

Description Adam Goode 2009-04-04 01:19:43 UTC
Description of problem:
I am trying to boot a PPC Fedora image. This version worked:
2:qemu-system-ppc-0.10-0.12.kvm20090323git.fc11.x86_64, but now it fails with:

invalid/unsupported opcode: 00 - 18 - 01 (00004070) 00000004 1
invalid/unsupported opcode: 00 - 04 - 17 (000095c8) 000095ec 0



Version-Release number of selected component (if applicable):
qemu-system-ppc-0.10-4.fc11.x86_64


How reproducible:
Always.

Steps to Reproduce:
$ qemu-system-ppc -cdrom Fedora-10-ppc-netinst.iso

Comment 1 Adam Goode 2009-04-05 19:19:56 UTC
Also with this release, qemu-system-arm stopped working:

$ qemu-system-arm -M versatilepb rootfs-f10-dev -kernel zImage-versatile-2.6.24-rc7.armv5tel


#0  0x0000003ad6a17f07 in SDL_memcpySSE (to=<value optimized out>, 
    from=<value optimized out>, len=<value optimized out>)
    at src/video/SDL_blit.c:141
#1  SDL_BlitCopy (to=<value optimized out>, from=<value optimized out>, 
    len=<value optimized out>) at src/video/SDL_blit.c:172
#2  0x0000003ad6a17d4a in SDL_SoftBlit (src=0x2dd8f60, 
    srcrect=<value optimized out>, dst=0x2dc4010, dstrect=0x7fff18391dc0)
    at src/video/SDL_blit.c:97
#3  0x0000003ad6a2e0ec in SDL_LowerBlit (src=0x2dd8f60, srcrect=0x7fff18391d70, 
    dst=0xa00, dstrect=0xa00) at src/video/SDL_surface.c:440
#4  0x0000003ad6a2e2c7 in SDL_UpperBlit (src=0x7f9d013ea000, 
    srcrect=<value optimized out>, dst=0xa00, dstrect=0xa00)
    at src/video/SDL_surface.c:530
#5  0x00000000004c4cdf in sdl_update (ds=<value optimized out>, x=0, y=0, w=640, 
    h=<value optimized out>) at sdl.c:66
#6  0x000000000043c650 in dpy_update (h=<value optimized out>, 
    w=<value optimized out>, y=<value optimized out>, x=<value optimized out>, 
    s=<value optimized out>) at ../console.h:156
#7  pl110_update_display (h=<value optimized out>, w=<value optimized out>, 
    y=<value optimized out>, x=<value optimized out>, s=<value optimized out>)
    at /usr/src/debug/qemu-kvm-0.10/qemu/hw/pl110.c:225
#8  0x00000000004c4d4a in sdl_refresh (ds=0x2d24f80) at sdl.c:417
#9  0x00000000004087ce in dpy_refresh (s=<value optimized out>)
    at /usr/src/debug/qemu-kvm-0.10/qemu/console.h:183
#10 gui_update (s=<value optimized out>)
    at /usr/src/debug/qemu-kvm-0.10/qemu/vl.c:3499
#11 0x000000000040908a in qemu_run_timers (current_time=<value optimized out>, 
    ptimer_head=<value optimized out>)
    at /usr/src/debug/qemu-kvm-0.10/qemu/vl.c:1240
#12 main_loop_wait (current_time=<value optimized out>, 
    ptimer_head=<value optimized out>)
    at /usr/src/debug/qemu-kvm-0.10/qemu/vl.c:3812
#13 0x000000000040cbaa in main_loop ()
    at /usr/src/debug/qemu-kvm-0.10/qemu/vl.c:3972
#14 main () at /usr/src/debug/qemu-kvm-0.10/qemu/vl.c:6126

Comment 2 Mark McLoughlin 2009-04-06 09:28:38 UTC
Thanks, it looks like a known bug in libSDL

*** This bug has been marked as a duplicate of bug 487720 ***

Comment 3 Glauber Costa 2009-04-07 14:49:58 UTC
Adam,

Can you include a trace of the ppc crash, for us to be sure about the problem?

Comment 4 Adam Goode 2009-04-07 15:59:01 UTC
ppc doesn't crash, it just produces this message and hangs:

invalid/unsupported opcode: 00 - 18 - 01 (00004070) 00000004 1
invalid/unsupported opcode: 00 - 04 - 17 (000095c8) 000095ec 0


I will test tonight with new SDL.

Comment 5 Adam Goode 2009-04-07 21:48:52 UTC
Oops, this has nothing to do with the SDL crash. I am not sure how to proceed in debugging this problem.

Comment 6 Mark McLoughlin 2009-04-09 15:01:52 UTC
Thanks Adam.

Could you confirm that it boots with -nographic?

If so, then from what I can make out from qemu-devel discussion:

  http://www.archivum.info/qemu-devel@nongnu.org/2009-03/msg01087.html

the bug is in openbios and this should be the fix:

  http://tracker.coreboot.org/trac/openbios/changeset/481

Comment 7 Adam Goode 2009-04-09 15:39:10 UTC
No luck:

$ qemu-system-ppc -nographic Fedora-10-ppc-DVD.iso 
invalid/unsupported opcode: 00 - 18 - 01 (00004070) 00000004 1
invalid/unsupported opcode: 00 - 04 - 17 (000095c8) 000095ec 0

Comment 8 Adam Goode 2009-04-09 15:44:20 UTC
I'm running openbios-ppc-1.0-0.5.svn463.fc11.noarch, according to the message, the fix is in r481?

Comment 9 Mark McLoughlin 2009-04-09 15:54:39 UTC
(In reply to comment #8)
> I'm running openbios-ppc-1.0-0.5.svn463.fc11.noarch, according to the message,
> the fix is in r481?

Well, according to the message, if it was the same problem it should go away when you use -nographic.

Sounds like we're on an arbitrary svn snapshot, though.

Glauber, do you think it would be worthwhile updating to latest svn? Do you know if they have any plans to do a release?

Comment 10 Adam Goode 2009-04-09 16:01:28 UTC
Can you do a scratch build of the latest openbios? Happy to test it.

Comment 11 Pavel Roskin 2009-04-12 05:24:34 UTC
I've rebuild openbios from the source RPM on a PowerPC system (Fedora 10 PPC, G3 Blue & White) and it's working for me.  The binary from Rawhide is failing in exactly the same way as for the reported.  The binary must be miscompiled.

Comment 12 Pavel Roskin 2009-04-12 05:26:51 UTC
Created attachment 339211 [details]
openbios-ppc, r482, working

Comment 13 Glauber Costa 2009-04-14 17:16:12 UTC
r463 is not arbitrary. It _is_ the release (as odly as it seems).

If you go to openbios website, and try to get the "1.0" release, you'll get to this link:

http://tracker.coreboot.org/trac/openbios/changeset/463/openbios-devel?old_path=%2F&old=463&format=zip

Note the /changeset/463

There are no tarballs. I can update the revision, But I'd prefer to leave it this way, and apply this patch.

Comment 14 Adam Goode 2009-04-16 03:55:59 UTC
Not working for me:

$ rpm -q openbios-ppc
openbios-ppc-1.0-0.6.svn463.fc11.noarch

$ qemu-system-ppc Fedora-10-ppc-DVD.iso 
invalid/unsupported opcode: 00 - 18 - 01 (00004070) 00000004 1
invalid/unsupported opcode: 00 - 04 - 17 (000095c8) 000095ec 0

Comment 15 Mark McLoughlin 2009-04-19 15:01:37 UTC
(In reply to comment #13)
> There are no tarballs. I can update the revision, But I'd prefer to leave it
> this way

That's fine, thanks, I just didn't realize

(In reply to comment #14)
> Not working for me:
> 
> $ rpm -q openbios-ppc
> openbios-ppc-1.0-0.6.svn463.fc11.noarch
> 
> $ qemu-system-ppc Fedora-10-ppc-DVD.iso 
> invalid/unsupported opcode: 00 - 18 - 01 (00004070) 00000004 1
> invalid/unsupported opcode: 00 - 04 - 17 (000095c8) 000095ec 0  

Adam - could you report this to the upstream mailing list?

Comment 16 Mark McLoughlin 2009-04-19 15:04:12 UTC
> (In reply to comment #14)
> > Not working for me:
> > 
> > $ rpm -q openbios-ppc
> > openbios-ppc-1.0-0.6.svn463.fc11.noarch
> > 
> > $ qemu-system-ppc Fedora-10-ppc-DVD.iso 
> > invalid/unsupported opcode: 00 - 18 - 01 (00004070) 00000004 1
> > invalid/unsupported opcode: 00 - 04 - 17 (000095c8) 000095ec 0  
> 
> Adam - could you report this to the upstream mailing list?  

Sorry, I misread - could you confirm that Pavel's build in comment #12 works for you?

Comment 17 Adam Goode 2009-04-19 18:03:54 UTC
Sorry! Yes, Pavel's build works.

Comment 18 Henri Zikken 2009-05-05 12:29:10 UTC
That build works, however contains a new bug. Using that openbios version, my kernel doesn't boot at all. It will boot from CD-rom, but not with a -kernel option.

I was using:

qemu-system-ppc -hda hd.img -cdrom cd.iso -kernel vmlinux -initrd initrd.img -append "root=/dev/hdc3"

I want to use -nographic but versions < 482 give the mentioned error. This version does not give an error, but does not boot either.

Versions < 482 do boot with the above commandline.

Comment 19 Mark McLoughlin 2009-05-05 13:22:12 UTC
Henri, Adam, Pavel - the best way to get this resolved is to work with upstream to find a fix

Comment 20 Pavel Roskin 2009-05-05 16:54:19 UTC
I'm afraid we have drifted from the original problem.  The problem with reading iso images is present upstream.  I believe it has never worked, so it's not a "new bug".

But the problem with invalid opcode is not present upstream, not even in the release 1.0.  It must be caused by the Fedora build system and it's still not fixed.  The current version 0:1.0-0.6.svn463.fc11 is still broken.

Comment 21 Mark McLoughlin 2009-05-05 17:28:01 UTC
(In reply to comment #20)

> But the problem with invalid opcode is not present upstream, not even in the
> release 1.0.  It must be caused by the Fedora build system and it's still not
> fixed.

Agreed; I posted this request for help upstream a while back:

  http://lists.gnu.org/archive/html/qemu-devel/2009-04/msg01227.html

Just a suggestion to you guys to follow up with upstream and see if the problem can be narrowed down enough to confirm that it's a compiler issue

Comment 22 Henri Zikken 2009-05-05 18:29:18 UTC
To clarify: I don't get the opcode bug with the r482 build.

I'm getting the qemu prompt, instead of linux booting.

This boots from the CD-rom without errors (v482):

qemu-system-ppc -hda hd.img -cdrom cd.iso -kernel vmlinux -initrd initrd.img
-append "root=/dev/hdc3" -boot d -nographic

This boots without errors (V463):

qemu-system-ppc -hda hd.img -cdrom cd.iso -kernel vmlinux -initrd initrd.img
-append "root=/dev/hdc3"

This doesn't load the kernel, just loads the qemu prompt (v482):

qemu-system-ppc -hda hd.img -cdrom cd.iso -kernel vmlinux -initrd initrd.img
-append "root=/dev/hdc3"

So does this:

qemu-system-ppc -hda hd.img -cdrom cd.iso -kernel vmlinux -initrd initrd.img
-append "root=/dev/hdc3" -nographic

So the opcode bug was fixed, the -nographic option now works, but the fix broke the booting from a kernel.

I'll try 'upstream'..

Comment 23 Pavel Roskin 2009-05-06 15:59:39 UTC
It's not gcc, it's binutils.  Upgrading gcc from 4.3.2 to 4.4.0 from rawhide doesn't cause the invalid opcode.  However, upgrading binutils from 2.18.50.0.9 to 2.19.51.0.2 does cause it!

Comment 24 Mark McLoughlin 2009-05-06 17:54:13 UTC
Great stuff Pavel, moving to binutils

Comment 25 Nick Clifton 2009-05-08 10:18:50 UTC
Hi Guys,

  Would it be possible for someone to post a copy of the openbios-ppc file that is broken, so that I can compare it to the working r482 version ?

  One thing that has changed with the 2.19.51.0.2 binutils rpm is the addition of support for version 2.06 of the PowerPC ISA.  (This is the binutils-2.19.51.0.2-IBM.patch in the rpm).  You might like to try removing this patch from the sources and then rebuilding the binutils.  This may allow you to build a working bios image, (and help me isolate where the bug can be found).

Cheers
  Nick

Comment 26 Roman Rakus 2009-05-15 14:53:32 UTC
I have tried attachment -> not working
I have tried rebuild binutils without binutils-2.19.51.0.2-IBM.patch and then rebuilt openbios -> not working.

Comment 27 Pavel Roskin 2009-05-16 23:36:03 UTC
Rebuilding binutils without binutils-2.19.51.0.2-IBM.patch doesn't help.  Rebuilding binutils without any Fedora patches doesn't help either.  I'm still getting "invalid opcode".

I've patched r487 to fix a warning in the IDE code (the code was indeed buggy, to put it mildly) and to fix or suppress strict aliasing warnings.  Then I compared the "objdump -x" output for the binaries made with the F10 binutils and the F11 binutils.  The former has many sections starting with .sbss followed by a number.  The later has one .sbss section.  Also, the F11 version had an extra segment with vaddr 0x00000000:

    LOAD off    0x000000b4 vaddr 0x00000000 paddr 0x00000000 align 2**2
         filesz 0x00000000 memsz 0x00000044 flags rw-

I changed the linker script to consolidate and align the .sbss sections, and it helped!  The resulting binary has one .sbss section and no extra segment.  The "invalid opcode" error is gone.

Comment 28 Pavel Roskin 2009-05-16 23:50:31 UTC
Created attachment 344302 [details]
Fix for the bug

Comment 29 Pavel Roskin 2009-05-16 23:52:20 UTC
Created attachment 344303 [details]
openbios-ppc, r487, working, compiled by F10 binutils

Comment 30 Pavel Roskin 2009-05-16 23:53:01 UTC
Created attachment 344304 [details]
openbios-ppc, r487, not working, compiled by F11 binutils

Comment 31 Pavel Roskin 2009-05-16 23:53:45 UTC
Created attachment 344305 [details]
openbios-ppc, r487 with the sbss fix, working, compiled by F11 binutils

Comment 32 Pavel Roskin 2009-05-17 01:06:36 UTC
Created attachment 344309 [details]
Simpler fix - just merge .sbss and .sbss.* into .bss

Comment 33 Richard W.M. Jones 2009-05-18 17:34:52 UTC
Just a note that I'm seeing failures of libguestfs on
ppc and ppc64, apparently because of this.  Some
sample builds which have failed:

http://koji.fedoraproject.org/koji/taskinfo?taskID=1361259
http://koji.fedoraproject.org/koji/taskinfo?taskID=1361261

Comment 34 Pavel Roskin 2009-05-19 00:54:18 UTC
The bug is fixed upstream in r488.  You probably want to pull r489 as well, as it fixes the ATA breakage.  Actually, I still cannot get OpenBIOS to read any filesystem in qemu, but your mileage may vary.

Comment 35 Roman Rakus 2009-05-20 13:59:52 UTC
I have tried:
svn export -r489 svn://openbios.org/openbios/trunk/openbios-devel openbios-devel
cd openbios-devel
config/scripts/switch-arch ppc
make
cp obj-ppc/openbios-qemu.elf /usr/share/openbios/openbios-ppc

but I still get invalid/unsupported opcode...

Comment 36 Pavel Roskin 2009-05-20 20:59:05 UTC
I can reproduce your problem, but it's a separate bug.

qemu-system-ppc appears to be broken on PowerPC.  That's how it fails:

# qemu-system-ppc -hda noboot.iso
*** WARNING: no opcode defined !
invalid/unsupported opcode: 12 - 1e - 0d (4bf0237d) fffffffc 0

Note that the "WARNING" is absent on x86_64.  I believe it means that no opcodes are known to the emulator.  The invalid opcode is found at the position 0xfffffffc, which is the start address for PowerPC.  It comes from the .romentry section.

Disassembling openbios-ppc with objdump gives:

fffffffc <.romentry>:
fffffffc:       4b f0 23 7d     bl      0xfff02378

Thus, 4b f0 23 7d is a valid instruction, but qemu-system-ppc fails to interpret it.

This bug is about an error on x86_64.  In this case, there is no "WARNING" and the error is:

invalid/unsupported opcode: 00 - 18 - 01 (00004070) 00000004 1

I believe it's caused by qemu starting at the position 0 because it finds a segment at that address corresponding to the .sbss section.  Grouping .sbss with .bss eliminates that segment.

Comment 37 Mark McLoughlin 2009-05-21 16:07:46 UTC
Thanks Pavel, I'm pushing an update with your fix:

* Thu May 21 2009 Mark McLoughlin <markmc> - 1.0-1
- Replace previous attempt to fix bug #494075 with fix from Pavel Roskin
- Drop the 0.x.463 numbering; we are using official upstream 1.0


Adam, Henri, Roman - please test out this new version and file new bugs for any issues other than:

  invalid/unsupported opcode: 00 - 18 - 01 (00004070) 00000004 1

Things just get way to confusing if we mix different issues up in the one bug report

Comment 38 Richard W.M. Jones 2009-05-21 16:28:36 UTC
I'm very confused here ...  Which bug is qemu-system-ppc running
on PPC failing with:

invalid/unsupported opcode: 00 - 18 - 01 (00004070) 00000004 1
invalid/unsupported opcode: 00 - 04 - 17 (000095c8) 000095ec 0

Or do we need to open another bug for that?

Comment 39 Fedora Update System 2009-05-21 16:38:49 UTC
openbios-1.0-1.fc11 has been submitted as an update for Fedora 11.
http://admin.fedoraproject.org/updates/openbios-1.0-1.fc11

Comment 40 Mark McLoughlin 2009-05-21 17:40:58 UTC
(In reply to comment #38)
> I'm very confused here ...  Which bug is qemu-system-ppc running
> on PPC failing with:
> 
> invalid/unsupported opcode: 00 - 18 - 01 (00004070) 00000004 1
> invalid/unsupported opcode: 00 - 04 - 17 (000095c8) 000095ec 0
> 
> Or do we need to open another bug for that?  

This update should fix that issue, just make sure you have openbios-ppc-1.0-1.fc11.noarch installed

(The horribly confusing thing is that this is built on ppc using ppc binutils, but it's actually shipped as a noarch package installable on all arches)

Comment 41 Fedora Update System 2009-05-25 21:24:00 UTC
openbios-1.0-1.fc11 has been pushed to the Fedora 11 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update openbios'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F11/FEDORA-2009-5394

Comment 42 Fedora Update System 2009-06-04 21:14:48 UTC
openbios-1.0-1.fc11 has been pushed to the Fedora 11 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 43 Roman Rakus 2009-06-05 10:35:37 UTC
Still not working here.
[rrakus@localhost ~]$ rpm -q openbios-ppc
openbios-ppc-1.0-1.fc11.noarch
[rrakus@localhost ~]$ qemu-system-ppc -boot d -m 256 -hda rhel-5 -cdrom RHEL5.3-Server-20090106.0-ppc-DVD.iso -M prep
*** WARNING: no opcode defined !
invalid/unsupported opcode: 12 - 02 - 18 (4bfffe05) fffffffc 0
invalid/unsupported opcode: 00 - 00 - 00 (00000000) 00000700 0

Comment 44 Mark McLoughlin 2009-06-05 11:00:19 UTC
Roman: I think you're testing on qemu-system-ppc on a ppc host? This bug is about qemu-system-ppc on an x86_64 host.

See what Pavel said above:

(In reply to comment #36)
> I can reproduce your problem, but it's a separate bug.
> 
> qemu-system-ppc appears to be broken on PowerPC.  That's how it fails:
> 
> # qemu-system-ppc -hda noboot.iso
> *** WARNING: no opcode defined !
> invalid/unsupported opcode: 12 - 1e - 0d (4bf0237d) fffffffc 0
> 
> Note that the "WARNING" is absent on x86_64.

Please file a new bug for this issue


Note You need to log in before you can comment on or make changes to this bug.