Skip to content

qemu: generate acpi tables for the guest

Michael S. Tsirkin qemu-devel 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest4 patches 15 repliesIn review
  2. v1 RFC3 patches 0 repliesSuperseded

Changes in v2 from the cover letter

- added code to address cross version compatibility
- rebased to latest bits
- updated acpi tables to latest seabios bits (added pvpanic device)

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4loader: support for unmapped ROM blobshw/core/loader.c hw/lm32/lm32_hwsetup.h include/hw/loader.h+32 -60 replies
2/4loader: allow adding ROMs in done callbackshw/core/loader.c include/hw/loader.h vl.c+9 -10 replies
3/4i386: generate pc guest infohw/acpi/ich9.c hw/acpi/piix4.c hw/i386/Makefile.objs +10 more+164 -2310 replies
4/4i386: ACPI table generation code from seabioshw/i386/Makefile.objs hw/i386/acpi-build.c hw/i386/acpi-defs.h +6 more+1116 -02 replies

Reviews trailers per patch

1 of 4 patches has a Reviewed-by or Acked-by.

PatchGerd HoffmannJan KiszkaJason BaronDavid WoodhouseGleb NatapovMarcelo TosattiDave FrodinPaolo BonziniKevin O'ConnorLaszlo ErsekKenji KaneshigeIsaku YamahataMagnus ChristenssonHu TaoEduardo Habkost
1/4
2/4
3/4
4/4A-b A-b A-b A-b A-b A-b A-b A-b A-b A-b A-b A-b A-b A-b A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 15 reviewers.

Read the v2 thread

Cover letter [Qemu-devel] [PATCH v2 0/4] qemu: generate acpi tables for the guest

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)

Comments:

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

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
Signature · 1 line
MST