On Tue, 18 Feb 2025, Gerd Hoffmann wrote:
On Tue, Feb 18, 2025 at 01:38:42PM +0300, Michael Tokarev wrote:
Hi!

Qemu system-mode emulation, when used with a NIC, loads a ROM file
for network booting (and fails to start if such file is not provided).
ROMs shipped in the source tarball are x86-only, so such loading does
nothing on non-x86, where we just wasting guest memory, - since the
ROM code can not be executed on the target architecture anyway.

These days, ipxe provides (UEFI) ROM files for architectures other than
x86.  And these ROMs actually works, making it possible to network-boot
qemu guests in UEFI mode.

edk2 ships a virtio-net driver, so network boot support does not depend
on ipxe.

Using nics other than virtio-net on aarch64/riscv64/loongarch64 looks
pointless to me.  All these architectures are younger than virtio-net,
so there are no compatibility concerns.

Would it be possible to make ROMs target-arch-specific, and drop the
ROM dependency/loading on non-x86 if there's no arch-specific ROM found?

I think this can be done with compat properties today.  IIRC this is
already done for one of the VGA devices to load a macos driver instead
of vgabios into the rom bar.

Unfortunately it's not. I proposed such patch which I think would have simplified this and allowed real Mac ROM to work eventually but it wasn't accepted in OpenBIOS so instead the driver is still passed through fw_cfg. But this would be possible and I've tested that before and submitted patches for Mac machines emulation.

Given that the roms are mostly needed on x86 I think the simplest
approach would be to turn them off by default and enable for x86
machine types using compat properties.

I don't know if anything uses NIC ROMs, some drivers may need some data or get MAC address from there or something like that so maybe not all ROMs can be disabled but maybe could be done one by one for each card after testing. Or just disable it for virtio-net?

For VGA cards some ROM is usually needed and machine firmwares may have BIOS and x86 emulation to run them even on non x86 machines. All the old PPC machines I emulate have such emulator in firmware but they can't run the current QEMU supplied ROMs so this is mostly relevant for passed through cards. It works with Bochs vgabios as documented here:
https://www.qemu.org/docs/master/system/ppc/amigang.html#eyetech-amigaone-mai-logic-teron-amigaone

Regards,
BALATON Zoltan

Reply via email to