diff mbox

Re: [SeaBIOS] [PATCH 0/8] option rom loading overhaul.

Message ID 4B2BB7E6.9040705@codemonkey.ws
State New
Headers show

Commit Message

Anthony Liguori Dec. 18, 2009, 5:12 p.m. UTC
Gerd Hoffmann wrote:
> On 12/18/09 17:42, Anthony Liguori wrote:
>>> Do we need to do something for -M pc-0.11? Like loading the pci roms
>>> via fw_cfg too so the guest doesn't see the new pci rom bar?
>>
>> Yes, we do. We can fix that problem as a stable-0.12 update though.
>> Right now, migration with pc-0.11 is broken in other areas too.
>
> Ok.  When it is fine to defer this to stable-0.12 then I have no 
> objections to merge it for 0.12 (assuming the seabios folks ack+merge 
> the seabios changes).

Note, I also needed this to quiet things a bit.

     return 1;

> Note that I'll be offline for x-mas and newyear starting tomorrow, so 
> I will not be able to work on that until January.

No problem.

>> It's really unclear to me the best way to handle live migration. The
>> rom_offset is not enough because unfortunately it's not stable after
>> invocations of qemu. I think we're going to have to actually save the
>> some contents with the PCIDevices.
>
> With hotplug this will become a issue indeed.

Yup.

> Lets see how this works out in practice ...

BTW, the following works:

sudo x86_64-softmmu/qemu-system-x86_64 -hda ~/images/linux.img -snapshot 
-m 512 -net nic,model=rtl8139,macaddr=56:54:32:12:34:56 -net 
nic,model=e1000,macaddr=56:54:32:12:34:57 -net 
nic,model=virtio,macaddr=56:54:32:12:34:58 -boot menu=on -net tap 
-kernel /boot/vmlinuz-2.6.27.38-170.2.113.fc10.x86_64 -initrd 
/boot/initrd-2.6.27.38-170.2.113.fc10.x86_64.img -append "ro"

Using the F12 menu, I can select any of the three option roms and it 
network boots or I can select 'Legacy Option ROM' and it will boot from 
-kernel.  That is exceedingly cool :-)  We just need to give it a proper 
PnP header and advertise it as a BEV device so that we can give it a 
meaningful name.

Regards,

Anthony Liguori

Comments

Kevin O'Connor Dec. 19, 2009, 1:48 a.m. UTC | #1
On Fri, Dec 18, 2009 at 11:12:06AM -0600, Anthony Liguori wrote:
> BTW, the following works:
>
> sudo x86_64-softmmu/qemu-system-x86_64 -hda ~/images/linux.img -snapshot  
> -m 512 -net nic,model=rtl8139,macaddr=56:54:32:12:34:56 -net  
> nic,model=e1000,macaddr=56:54:32:12:34:57 -net  
> nic,model=virtio,macaddr=56:54:32:12:34:58 -boot menu=on -net tap  
> -kernel /boot/vmlinuz-2.6.27.38-170.2.113.fc10.x86_64 -initrd  
> /boot/initrd-2.6.27.38-170.2.113.fc10.x86_64.img -append "ro"
>
> Using the F12 menu, I can select any of the three option roms and it  
> network boots or I can select 'Legacy Option ROM' and it will boot from  
> -kernel.  That is exceedingly cool :-)  We just need to give it a proper  
> PnP header and advertise it as a BEV device so that we can give it a  
> meaningful name.

As it stands now, if the command line has -kernel, it will always boot
from the kernel regardless of the item one selects in the boot menu.
(Legacy roms are always run - the boot menu only selects the order wrt
BCVs.)  However, converting the rom into a BEV will indeed make it
selectable.

Also, to see a truly interesting boot menu - try appending something
like the following to the command line:

-fda disk.dsk -fdb odin1440.img -hdd dos-drivec -cdrom ../../iso/win-vista.iso -drive file=../../iso/win-xp.iso,media=cdrom,index=1

SeaBIOS allows one to boot from either floppy, any harddrive, and any
cdrom.

-Kevin
Anthony Liguori Dec. 19, 2009, 3:07 a.m. UTC | #2
Kevin O'Connor wrote:
> On Fri, Dec 18, 2009 at 11:12:06AM -0600, Anthony Liguori wrote:
>   
>> BTW, the following works:
>>
>> sudo x86_64-softmmu/qemu-system-x86_64 -hda ~/images/linux.img -snapshot  
>> -m 512 -net nic,model=rtl8139,macaddr=56:54:32:12:34:56 -net  
>> nic,model=e1000,macaddr=56:54:32:12:34:57 -net  
>> nic,model=virtio,macaddr=56:54:32:12:34:58 -boot menu=on -net tap  
>> -kernel /boot/vmlinuz-2.6.27.38-170.2.113.fc10.x86_64 -initrd  
>> /boot/initrd-2.6.27.38-170.2.113.fc10.x86_64.img -append "ro"
>>
>> Using the F12 menu, I can select any of the three option roms and it  
>> network boots or I can select 'Legacy Option ROM' and it will boot from  
>> -kernel.  That is exceedingly cool :-)  We just need to give it a proper  
>> PnP header and advertise it as a BEV device so that we can give it a  
>> meaningful name.
>>     
>
> As it stands now, if the command line has -kernel, it will always boot
> from the kernel regardless of the item one selects in the boot menu.
>   
Ah, I spoke too soon, you are indeed correct.

I was wondering how that could possibly work :-)
> (Legacy roms are always run - the boot menu only selects the order wrt
> BCVs.)  However, converting the rom into a BEV will indeed make it
> selectable.
>
> Also, to see a truly interesting boot menu - try appending something
> like the following to the command line:
>
> -fda disk.dsk -fdb odin1440.img -hdd dos-drivec -cdrom ../../iso/win-vista.iso -drive file=../../iso/win-xp.iso,media=cdrom,index=1
>
> SeaBIOS allows one to boot from either floppy, any harddrive, and any
> cdrom.
>   

Very cool stuff!  We just have to figure out a way to let a user specify 
which of these devices they want to boot from via the qemu command 
line.   Maybe something that encodes a bus type and then an address on 
the bus or something like that.  I think that works okay for PCI and IDE 
buses.  For fw_cfg roms, I guess we could also just expose the filename 
as the address on the fw_cfg bus.

Regards,

Anthony Liguori
diff mbox

Patch

diff --git a/hw/fw_cfg.c b/hw/fw_cfg.c
index 0492f5f..fe9c527 100644
--- a/hw/fw_cfg.c
+++ b/hw/fw_cfg.c
@@ -309,8 +309,8 @@  int fw_cfg_add_file(FWCfgState *s,  const char *dir, 
const c
     }
     s->files->f[index].size   = cpu_to_be32(len);
     s->files->f[index].select = cpu_to_be16(FW_CFG_FILE_FIRST + index);
-    fprintf(stderr, "%s: #%d: %s (%d bytes)\n", __FUNCTION__,
-            index, s->files->f[index].name, len);
+    FW_CFG_DPRINTF("%s: #%d: %s (%d bytes)\n", __FUNCTION__,
+                   index, s->files->f[index].name, len);
 
     s->files->count = cpu_to_be32(index+1);