Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED]qemu - use seabios runtime config with -fw_cfg
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
sdauth
Guru
Guru


Joined: 19 Sep 2018
Posts: 569
Location: Ásgarðr

PostPosted: Fri Jan 05, 2024 8:38 pm    Post subject: [SOLVED]qemu - use seabios runtime config with -fw_cfg Reply with quote

Hello,
I'd like to use this seabios runtime config option (https://www.seabios.org/Runtime_config) :
Code:
pci-optionrom-exec
with value "1"
Controls option ROM execution for roms found on PCI devices (as opposed to roms found in CBFS/fw_cfg). Valid values are 0: Execute no ROMs, 1: Execute only VGA ROMs, 2: Execute all ROMs. The default is 2 (execute all ROMs).

The seabios page says :
When SeaBIOS runs natively on QEMU the files are passed from QEMU via the fw_cfg interface.

What's the correct syntax ?
I found this example (using ovmf) :
Code:
-fw_cfg name=opt/ovmf/X-PciMmio64Mb,string=65536


But I can't make it work with seabios, I tried
Code:
-fw_cfg name=opt/seabios/etc/pci-optionrom-exec,string=1

but the optionrom on my PCI card (a 4 SATA ports "RAID" card with SIL3114 chipset) is still loading when seabios starts on my vm. (vfio-pci)

edit:
As a workaround, I compiled my own seabios (loaded with -bios switch) with :
Code:
# CONFIG_OPTIONROMS is not set

in Makefile
The VM boots fine, although obviously with no video output until Windows starts.

Thanks.


Last edited by sdauth on Sat Jan 06, 2024 1:53 pm; edited 1 time in total
Back to top
View user's profile Send private message
sdauth
Guru
Guru


Joined: 19 Sep 2018
Posts: 569
Location: Ásgarðr

PostPosted: Fri Jan 05, 2024 11:24 pm    Post subject: Reply with quote

I tried on my laptop, can't try now on my desktop. (busy with updates)

seabios debug output (using -fw_cfg name=etc/pci-optionrom-exec,string=1)

Code:
qemu-system-x86_64 -M q35 -m 1G -nic none -boot menu=on -bios seabios/out/bios.bin -chardev pipe,path=seabios.log,id=seabios -device isa-debugcon,iobase=0x402,chardev=seabios -fw_cfg name=etc/pci-optionrom-exec,string=1


Code:
SeaBIOS (version rel-1.16.3-0-ga6ed6b70)
BUILD: gcc: (Gentoo Hardened 12.3.1_p20230825 p2) 12.3.1 20230825 binutils: (Gentoo 2.41 p2) 2.41.0
No Xen hypervisor found.
enabling shadow ram
Running on QEMU (q35)
physbits: signature="AuthenticAMD", pae=yes, lm=yes, phys-bits=40, valid=yes
cpuid 0x40000000: eax 40000001, signature 'TCGTCGTCGTCG'
Found QEMU fw_cfg
QEMU fw_cfg DMA interface supported
qemu/e820: addr 0x000000fd00000000 len 0x0000000300000000 [reserved]
qemu/e820: addr 0x0000000000000000 len 0x0000000040000000 [RAM]
qemu/e820: RamSize: 0x40000000
qemu/e820: RamSizeOver4G: 0x0000000000000000
malloc preinit
Relocating init from 0x000d0280 to 0x3efea120 (size 89664)
malloc init
Add romfile: etc/show-boot-menu (size=2)
Add romfile: etc/irq0-override (size=1)
Add romfile: etc/max-cpus (size=2)
Add romfile: etc/numa-cpu-map (size=8)
Add romfile: etc/numa-nodes (size=0)
Add romfile: bios-geometry (size=0)
Add romfile: bootorder (size=0)
Add romfile: etc/acpi/rsdp (size=20)
Add romfile: etc/acpi/tables (size=131072)
Add romfile: etc/boot-fail-wait (size=4)
Add romfile: etc/e820 (size=40)
Add romfile: etc/pci-optionrom-exec (size=1)
Add romfile: etc/smbios/smbios-anchor (size=31)
Add romfile: etc/smbios/smbios-tables (size=309)
Add romfile: etc/smi/features-ok (size=1)
Add romfile: etc/smi/requested-features (size=8)
Add romfile: etc/smi/supported-features (size=8)
Add romfile: etc/system-states (size=6)
Add romfile: etc/table-loader (size=4096)
Add romfile: etc/tpm/log (size=0)
Add romfile: genroms/kvmvapic.bin (size=9216)
Moving pm_base to 0x600
init ivt
init bda
init bios32
init PMM
init PNPBIOS table
init keyboard
init mouse
init pic
math cp init
pci setup
[...]


With a little warning :
Code:
qemu-system-x86_64: -fw_cfg name=etc/pci-optionrom-exec,string=1: warning: externally provided fw_cfg item names should be prefixed with "opt/"


It seems to be correctly registered as you can see:
Code:
Add romfile: etc/pci-optionrom-exec (size=1)


I will update this post later.
Back to top
View user's profile Send private message
sdauth
Guru
Guru


Joined: 19 Sep 2018
Posts: 569
Location: Ásgarðr

PostPosted: Sat Jan 06, 2024 3:22 am    Post subject: Reply with quote

Success!
I used :
Code:
-fw_cfg name=etc/pci-optionrom-exec,file=pci-optionrom-exec


As you can see, the "string" option is gone and was not correct, seabios still loaded the optionrom with a warning in the log:
Code:
WARNING! Found unaligned PCI rom (vd=1095:3114)


So to make it work, you need to replace it with the "file" option
Use encoderint.py (in seabios/scripts) to create the file with the value desired.
Example:
Code:
python3 encodeint.py pci-optionrom-exec 1


The VM starts fine, the "raid" configuration menu doesn't show up anymore in seabios.
The drive attached to the card works just fine as well without the optionrom. 8)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum