[SeaBIOS] [PATCH v2 0/4] qemu: generate acpi tables for the guest

Michael S. Tsirkin mst at redhat.com
Mon Jul 8 20:30:08 CEST 2013

This patchset moves all generation of ACPI tables
from guest BIOS to the hypervisor.

Please review, and consider for 1.6.

Changes from v1 RFC:
- added code to address cross version compatibility
- rebased to latest bits
- updated acpi tables to latest seabios bits (added pvpanic device)


Although ACPI tables come from a system BIOS on real hw,
it makes sense that the ACPI tables are coupled with the
virtual machine, since they have to abstract the x86 machine to
the OS's.

This is widely desired as a way to avoid the churn
and proliferation of QEMU-specific interfaces
associated with ACPI tables in bios code.

An RFC patchset adding support for hotplug of devices behind
PCI to PCI bridges on top of this infrastructure was sent
to the list a while ago.
Latest version of that patchset will also be re-sent soon.

If you look at the actual code:
 i386: imports ACPI table generation code from seabios
you will see that it's more complex than it
needs to be, with lots of low level casts
and similar tricks.

There's also a bit of duplication where we
already declare similar acpi structures in qemu.

This is the result of code being a direct port from seabios.
Laszlo's patch (build ACPI MADT (APIC) for fw_cfg)
shows how this will be cleaned up by follow-up work.
I think it's best to do it in this order: port
code directly, and apply cleanups and reduce duplication
that results, on top.
This way it's much easier to see that we don't introduce

In particular, for a simple VM with piix,
I booted a guest on qemu with and without the
change, and verified that ACPI tables are
unchanged except for trivial pointer address changes.

Such binary compatibility makes it easier to be
confident that this change won't break things.

Michael S. Tsirkin (4):
  loader: support for unmapped ROM blobs
  loader: allow adding ROMs in done callbacks
  i386: generate pc guest info
  i386: ACPI table generation code from seabios

 hw/acpi/ich9.c               |   7 +-
 hw/acpi/piix4.c              |  44 ++-
 hw/core/loader.c             |  38 ++-
 hw/i386/Makefile.objs        |   4 +
 hw/i386/acpi-build.c         | 723 +++++++++++++++++++++++++++++++++++++++++++
 hw/i386/acpi-defs.h          | 327 +++++++++++++++++++
 hw/i386/pc.c                 |  43 ++-
 hw/i386/pc_piix.c            |  18 +-
 hw/i386/pc_q35.c             |  13 +-
 hw/i386/ssdt-misc.dsl        |  46 +++
 hw/isa/lpc_ich9.c            |  11 +-
 hw/lm32/lm32_hwsetup.h       |   2 +-
 hw/mips/mips_malta.c         |   2 +-
 hw/misc/pvpanic.c            |  12 +-
 hw/pci-host/q35.c            |   1 +
 include/hw/acpi/ich9.h       |   2 +-
 include/hw/i386/acpi-build.h |   9 +
 include/hw/i386/ich9.h       |   3 +-
 include/hw/i386/pc.h         |  38 ++-
 include/hw/loader.h          |   5 +-
 vl.c                         |   3 +
 21 files changed, 1321 insertions(+), 30 deletions(-)
 create mode 100644 hw/i386/acpi-build.c
 create mode 100644 hw/i386/acpi-defs.h
 create mode 100644 include/hw/i386/acpi-build.h


More information about the SeaBIOS mailing list