qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* why various devices are loading x86 roms on non-x86 architectures?
@ 2024-01-31 10:28 Michael Tokarev
  2024-01-31 10:54 ` Jiaxun Yang
  2024-01-31 13:00 ` Peter Maydell
  0 siblings, 2 replies; 5+ messages in thread
From: Michael Tokarev @ 2024-01-31 10:28 UTC (permalink / raw)
  To: QEMU Developers

Hi!

qemu-system-aarch64 -device virtio-vga

this one loads vgabios-virtio.bin.  Why?
Does this bios work on aarch64 (or any other non-x86 arch)?
Should there may be some conditional in this and similar places?
The same is true for x86 pxe roms and other x86-only roms.

Thanks,

/mjt


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: why various devices are loading x86 roms on non-x86 architectures?
  2024-01-31 10:28 why various devices are loading x86 roms on non-x86 architectures? Michael Tokarev
@ 2024-01-31 10:54 ` Jiaxun Yang
  2024-01-31 13:00 ` Peter Maydell
  1 sibling, 0 replies; 5+ messages in thread
From: Jiaxun Yang @ 2024-01-31 10:54 UTC (permalink / raw)
  To: qemu-devel



在 2024/1/31 10:28, Michael Tokarev 写道:
> Hi!
>
> qemu-system-aarch64 -device virtio-vga
>
> this one loads vgabios-virtio.bin.  Why?
> Does this bios work on aarch64 (or any other non-x86 arch)?
> Should there may be some conditional in this and similar places?
> The same is true for x86 pxe roms and other x86-only roms.

FYI on some systems they use x86emu (or biosemu) to run x86 only
OpROMs, this is at least true for u-boot (u-boot/drivers/bios_emulator),
PMON (MIPS/Loongson) and coreboot.

Thanks
- Jiaxun

>
> Thanks,
>
> /mjt
>

-- 
---
Jiaxun Yang



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: why various devices are loading x86 roms on non-x86 architectures?
  2024-01-31 10:28 why various devices are loading x86 roms on non-x86 architectures? Michael Tokarev
  2024-01-31 10:54 ` Jiaxun Yang
@ 2024-01-31 13:00 ` Peter Maydell
  2024-01-31 13:22   ` BALATON Zoltan
  1 sibling, 1 reply; 5+ messages in thread
From: Peter Maydell @ 2024-01-31 13:00 UTC (permalink / raw)
  To: Michael Tokarev; +Cc: QEMU Developers

On Wed, 31 Jan 2024 at 10:29, Michael Tokarev <mjt@tls.msk.ru> wrote:
> qemu-system-aarch64 -device virtio-vga
>
> this one loads vgabios-virtio.bin.  Why?
> Does this bios work on aarch64 (or any other non-x86 arch)?
> Should there may be some conditional in this and similar places?
> The same is true for x86 pxe roms and other x86-only roms.

For the same reason that if you plug a PCI card with an
x86 BIOS ROM on it into a non-x86 system with a PCI bus,
the x86 code is still on the ROM, even if it's never
executed :-) Mostly the ROM is ignored and the guest kernel
drives the hardware directly without it.

For stuff we control like virtio-vga it would probably be
helpful to be able to drop the requirement for the binary
blob, just as a practical convenience for users.

thanks
-- PMM


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: why various devices are loading x86 roms on non-x86 architectures?
  2024-01-31 13:00 ` Peter Maydell
@ 2024-01-31 13:22   ` BALATON Zoltan
  2024-02-01 10:08     ` Gerd Hoffmann
  0 siblings, 1 reply; 5+ messages in thread
From: BALATON Zoltan @ 2024-01-31 13:22 UTC (permalink / raw)
  To: Peter Maydell; +Cc: Michael Tokarev, QEMU Developers

On Wed, 31 Jan 2024, Peter Maydell wrote:
> On Wed, 31 Jan 2024 at 10:29, Michael Tokarev <mjt@tls.msk.ru> wrote:
>> qemu-system-aarch64 -device virtio-vga
>>
>> this one loads vgabios-virtio.bin.  Why?
>> Does this bios work on aarch64 (or any other non-x86 arch)?
>> Should there may be some conditional in this and similar places?
>> The same is true for x86 pxe roms and other x86-only roms.
>
> For the same reason that if you plug a PCI card with an
> x86 BIOS ROM on it into a non-x86 system with a PCI bus,
> the x86 code is still on the ROM, even if it's never
> executed :-) Mostly the ROM is ignored and the guest kernel
> drives the hardware directly without it.
>
> For stuff we control like virtio-vga it would probably be
> helpful to be able to drop the requirement for the binary
> blob, just as a practical convenience for users.

One way to omit ROM per machine could be like in this patch:

https://patchew.org/QEMU/cover.1672868854.git.balaton@eik.bme.hu/e8d6aa41eeb0461d285fa4c12e0fff05d366e8fa.1672868854.git.balaton@eik.bme.hu/

maybe this could also work per device if the romfile property can be set 
from realize or reset method but would need to distinguish between default 
value or user provided value to not override the latter.

There are also some PPC machines that have BIOS emulator in firmware and 
would need the ROM to init the device but these have problems with QEMU's 
gcc compiled ROMs that contain i386 opcodes and can't run these.

Also ati-vga has some tables in the card ROM about timings that drivers 
read even if the machine did not run the ROM and there are Mac versions of 
cards with different ROMs so this may be something dependent on each 
device rather than machine architecture. We can say that devices that QEMU 
emulate are primarily PC cards so they come with a PC option ROM.

Regards,
BALATON Zoltan


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Re: why various devices are loading x86 roms on non-x86 architectures?
  2024-01-31 13:22   ` BALATON Zoltan
@ 2024-02-01 10:08     ` Gerd Hoffmann
  0 siblings, 0 replies; 5+ messages in thread
From: Gerd Hoffmann @ 2024-02-01 10:08 UTC (permalink / raw)
  To: BALATON Zoltan; +Cc: Peter Maydell, Michael Tokarev, QEMU Developers

  Hi,

> There are also some PPC machines that have BIOS emulator in firmware and
> would need the ROM to init the device but these have problems with QEMU's
> gcc compiled ROMs that contain i386 opcodes and can't run these.

That used to be standard practice in linux.  Before we got kernel mode
setting the Xserver ran the vgabios code to set video modes.  On i386 in
vm86 mode, on all other architectures (including x86_64) in an emulator
(x86emu fork IIRC).

Fun fact:  There are a bunch of hacks in seabios to avoid certain
instructions in vgabios binaries, to workaround emulator limitations.
And, yes, i386 opcodes are problematic, even though at least the Xserver
emulator became better over time.

take care,
  Gerd



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-02-01 10:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-31 10:28 why various devices are loading x86 roms on non-x86 architectures? Michael Tokarev
2024-01-31 10:54 ` Jiaxun Yang
2024-01-31 13:00 ` Peter Maydell
2024-01-31 13:22   ` BALATON Zoltan
2024-02-01 10:08     ` Gerd Hoffmann

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).