qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: Blue Swirl <blauwirbel@gmail.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] Reorganize option rom (+linux kernel) loading.
Date: Thu, 01 Oct 2009 11:11:57 +0200	[thread overview]
Message-ID: <4AC4725D.1020009@redhat.com> (raw)
In-Reply-To: <f43fc5580909301251k63bb5fbqa623ec2aa9045275@mail.gmail.com>

   Hi,

> Nice idea. The implementation seems to be buggy, I only ever see one
> rom

On !pc platforms only elf roms will show up.

> and for example sparc-test crashes when issuing 'info roms'.

Huh?  Works for me.  Details please.  sparc is one of the archs I've 
actually tested:

(qemu) info roms
addr=0000000070000000 size=0x0e4000 name="phdr #0: 
/home/kraxel/projects/qemu/pc-bios/openbios-sparc32"

ppc has two entries from the two elf phdr sections:

(qemu) info roms
addr=00000000fff00000 size=0x052c88 name="phdr #0: 
/home/kraxel/projects/qemu/pc-bios/openbios-ppc"
addr=00000000fffffffc size=0x000004 name="phdr #1: 
/home/kraxel/projects/qemu/pc-bios/openbios-ppc"

pc has multiple entries when loading option roms (for network booting), 
looks like this then:

(qemu) info roms
addr=00000000000c0000 size=0x008c00 name="vgabios-cirrus.bin"
addr=00000000000c9000 size=0x008000 name="pxe-e1000.bin"

Booting linux kernels (pc too) directly will produce even more entries:

(qemu) info roms
addr=0000000000010000 size=0x003800 name="linux-setup"
addr=0000000000020000 size=0x000001 name="linux-cmdline"
addr=00000000000c0000 size=0x008c00 name="vgabios-cirrus.bin"
addr=00000000000c9000 size=0x000200 name="linux-bootsect"
addr=0000000000100000 size=0x342910 
name="/boot/vmlinuz-2.6.30.5-43.fc11.x86_64"

> Perhaps 'info roms' could also check whether the rom has been changed?

Point being?

> On most platforms roms are really read only memories.

Yep, I've noticed on a quick glimpse.  So in that case writing roms on 
reset isn't very useful because the guest shouldn't be able to modify 
them in the first place.  It doesn't harm though, except that we keep a 
copy of the roms around for no reason.  Maybe make restore-on-reset opt-in?

>> +    fd = open(rom->path, O_RDONLY);
>> +    if (-1 == fd) {
>
> Not again!

Oops.  Fixed.

>> +    rom->align    = align;
>> +    rom->min      = min;
>> +    rom->max      = max;
>> +    rom->romsize  = lseek(fd, 0, SEEK_END);
>> +    rom->data     = qemu_mallocz(rom->romsize);
>
> There are plenty of extra spaces.

The vertical alignment makes the code more readable IMHO.

cheers,
   Gerd

  reply	other threads:[~2009-10-01  9:12 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-30 15:43 [Qemu-devel] [PATCH] Reorganize option rom (+linux kernel) loading Gerd Hoffmann
     [not found] ` <m34oqkmf0n.fsf@neno.mitica>
2009-09-30 19:07   ` [Qemu-devel] " Gerd Hoffmann
2009-09-30 19:51 ` [Qemu-devel] " Blue Swirl
2009-10-01  9:11   ` Gerd Hoffmann [this message]
2009-10-01 16:25     ` Blue Swirl
2009-10-02 11:40       ` Gerd Hoffmann
2009-10-02 15:19         ` Gerd Hoffmann
2009-10-02 17:58           ` Blue Swirl
2009-10-06 21:18             ` Gerd Hoffmann
2009-10-02 17:56         ` Blue Swirl
  -- strict thread matches above, loose matches on Subject: below --
2009-10-01 14:42 Gerd Hoffmann

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=4AC4725D.1020009@redhat.com \
    --to=kraxel@redhat.com \
    --cc=blauwirbel@gmail.com \
    --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).