Skip to content

qemu: generate acpi tables for the guest

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

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v9 Latest27 patches 3 repliesIn review
  2. v826 patches 4 repliesSuperseded
  3. v7 posting 2/226 patches 0 repliesSuperseded
Earlier versions · 7
VersionPostedPatchesRepliesStatus
v7 posting 1/227 patches6 repliesSuperseded
v626 patches17 repliesSuperseded
v523 patches14 repliesSuperseded
v423 patches17 repliesSuperseded
v314 patches54 repliesSuperseded
v29 patches24 repliesSuperseded
v1 RFC13 patches26 repliesSuperseded

Changes in v9 from the cover letter

- remove an unused function
- fix typo in error message, reported by Igor
- don't assert when adding a 4 byte value
(we don't use this now but it's useful for follow-up bridge hotplug patches)
- fix numa node reporting for hotplugged cpus, reported by Igor

Patches in v9 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/27cleanup object.h: include error.h directlyinclude/qom/object.h+1 -10 replies
2/27qom: cleanup struct Error referencesinclude/qom/object.h+25 -250 replies
3/27qom: add pointer to int property helpersinclude/qom/object.h qom/object.c+81 -00 replies
4/27pci: fix up w64 size calculation helperhw/pci/pci.c+12 -80 replies
5/27fw_cfg: interface to trigger callback on readhw/nvram/fw_cfg.c include/hw/nvram/fw_cfg.h+32 -50 replies
6/27loader: support for unmapped ROM blobshw/core/loader.c hw/lm32/lm32_hwsetup.h include/hw/loader.h+25 -70 replies
7/27pcie_host: expose UNMAPPED macrohw/pci/pcie_host.c include/hw/pci/pcie_host.h+3 -30 replies
8/27pcie_host: expose address formathw/pci/pcie_host.c include/hw/pci/pcie_host.h+21 -210 replies
9/27q35: use macro for MCFG property namehw/pci-host/q35.c include/hw/pci/pcie_host.h+3 -10 replies
10/27q35: expose mmcfg size as a propertyhw/pci-host/q35.c include/hw/pci/pcie_host.h+15 -00 replies
11/27i386: add ACPI table files from seabioshw/i386/acpi-dsdt-cpu-hotplug.dsl hw/i386/acpi-dsdt-dbug.dsl hw/i386/acpi-dsdt-hpet.dsl +9 more+1848 -00 replies
12/27acpi: add rules to compile ASL sourceconfigure hw/i386/Makefile.objs scripts/update-acpi.sh+34 -10 replies
13/27acpi: pre-compiled ASL fileshw/i386/acpi-dsdt.hex.generated hw/i386/q35-acpi-dsdt.hex.generated hw/i386/ssdt-misc.hex.generated +2 more+12383 -00 replies
14/27acpi: ssdt pcihp: updat generated filehw/i386/ssdt-pcihp.hex.generated+4 -40 replies
15/27loader: use file path size from fw_cfg.hhw/core/loader.c include/hw/nvram/fw_cfg.h+4 -20 replies
16/27i386: add bios linker/loaderhw/i386/Makefile.objs hw/i386/bios-linker-loader.c hw/i386/bios-linker-loader.h+186 -00 replies
17/27loader: allow adding ROMs in done callbackshw/core/loader.c include/hw/loader.h vl.c+9 -10 replies
18/27i386: define pc guest infohw/i386/pc.c include/hw/i386/pc.h+30 -00 replies
19/27acpi/piix: add macros for acpi property nameshw/acpi/piix4.c include/hw/i386/pc.h+13 -30 replies
20/27piix: APIs for pc guest infohw/acpi/piix4.c hw/pci-host/piix.c include/hw/acpi/piix4.h +1 more+57 -40 replies
21/27ich9: APIs for pc guest infohw/acpi/ich9.c hw/isa/lpc_ich9.c hw/pci-host/q35.c +3 more+80 -00 replies
22/27pvpanic: add API to access io porthw/misc/pvpanic.c include/hw/i386/pc.h+13 -10 replies
23/27hpet: add API to find ithw/timer/hpet.c include/hw/timer/hpet.h+7 -00 replies
24/27i386: ACPI table generation code from seabioshw/i386/Makefile.objs hw/i386/acpi-build.c hw/i386/acpi-build.h +5 more+1560 -00 replies
25/27ssdt: fix PBLK lengthhw/i386/ssdt-proc.dsl+1 -10 replies
26/27ssdt-proc: update generated filehw/i386/ssdt-proc.hex.generated+5 -50 replies
27/27don't post me: update biospc-bios/acpi-dsdt.aml pc-bios/bios.bin pc-bios/q35-acpi-dsdt.aml+0 -00 replies

Reviews trailers per patch

24 of 27 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchPaolo BonziniGerd HoffmannIgor MammedovLaszlo ErsekJan KiszkaJason BaronDavid WoodhouseGleb NatapovMarcelo TosattiDave FrodinKevin O'ConnorKenji KaneshigeIsaku YamahataMagnus ChristenssonHu TaoEduardo HabkostAndreas Färber
SeriesR-b
1/27
2/27R-b R-b T-b
3/27R-b R-b T-b
4/27T-b
5/27R-b T-b
6/27R-b T-b R-b
7/27R-b T-b
8/27R-b T-b
9/27R-b T-b
10/27R-b T-b
11/27A-b A-b R-b T-b A-b R-b A-b A-b A-b A-b A-b A-b A-b A-b A-b A-b A-b R-b A-b
12/27R-b T-b R-b
13/27R-b T-b
14/27R-b T-b
15/27R-b T-b
16/27R-b T-b
17/27R-b T-b
18/27R-b T-b R-b
19/27R-b T-b
20/27R-b T-b
21/27R-b T-b
22/27R-b T-b
23/27R-b T-b
24/27A-b A-b R-b T-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
25/27R-b T-b
26/27R-b T-b
27/27

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

Read the v9 thread

Cover letter [Qemu-devel] [PATCH v9 00/27] qemu: generate acpi tables for the guest

This code can also be found here:
git://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git acpi

While this patch still uses info not available in QOM, I think it's reasonable to merge it and then refactor as QOM properties cover more ground.

In particular, merging this patchset blocks other projects so I think its preferable to merge now and not wait for all required QOM properties to materialize.

I added QOM properties in ich/piix where I knew how to do this.

If you already reviewed v8 then the only patch that changed significantly is
i386: define pc guest info
it now supplies numa info about all CPUs and not just the ones present at init.
I also made a couple of trivial tweaks to
i386: ACPI table generation code from seabios

If you already reviewed v5 then the only patches that changed are:
i386: define pc guest info
i386: ACPI table generation code from seabios

Gerd, Laszlo, I kept your Reviewed-by and Tested-by tags on these patches to ensure your contribution is recongnized, if you don't like this pls let me know.
Or better yet re-ack this version :)

Patches 1-3 are QOM patches really.
Included here for completeness.

Igor suggested dropping patches 1-2 and including error.h directly. I included his patch and dropped mine.
I hope that's ok.

If everything's in order, I intend to merge this through my tree.

Please review, and comment.

Changes from v8:
- remove an unused function
- fix typo in error message, reported by Igor
- don't assert when adding a 4 byte value
(we don't use this now but it's useful for follow-up bridge hotplug patches)
- fix numa node reporting for hotplugged cpus, reported by Igor

Changes from v7 reposted:
- whitespace fixes - issues reported by Igor
- typo fix in commit log reported by Eric

Changes from v7:
- removed all complex table patching and migration code we now only migrate a single byte "patched/non patched" all tables are simply regenerated on access, rewriting old data
in particular this fixed a bug that Igor noticed:
cpu online status is now updated correctly
- removed bitmask of found cpus - use QOM to calculate it
- dropped changes to typedefs.h - use Igor's patch instead

Changes from v6:
- fix 64 bit window bug reported by Igor
- tweak comments in error.h

Changes from v5:
- update generated files to fix build on systems without iasl
- fix mcfg failure reported by Gerd
Changes from v4:
- address comments by Paolo:
rename loader interface
reuse macro for hpet name
better struct names
move internal headers to hw/i386/
- fix typos resulting in bugs reported by Gerd

Changes from v3:
- reworked code to use QOM properties
some info isn't yet available in QOM, use old-style APIs and lookups by type
- address comments by Gerd: tables are now updated on guest access after pci configuration

Changes from v2 repost:
- address comment by Anthony - convert to use APIs implemented using QOM
- address comment by Anthony - avoid tricky pointer path, use GArray from glib instead
- Address lots of comments by Hu Tao and Laszlo Ersek

Changes from v2:
- added missing patches to make it actually build Changes from v1 RFC:
- added code to address cross version compatibility
- rebased to latest bits
- updated seabios code to latest bits (added pvpanic device)

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

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.

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

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, I booted a guest on qemu with and without the change, and verified that ACPI tables are unchanged except for trivial pointer address changes, and the SSDT P_BLK change in the last patch.

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

Igor Mammedov (1):
cleanup object.h: include error.h directly

Michael S. Tsirkin (26):
qom: cleanup struct Error references
qom: add pointer to int property helpers
pci: fix up w64 size calculation helper
fw_cfg: interface to trigger callback on read
loader: support for unmapped ROM blobs
pcie_host: expose UNMAPPED macro
pcie_host: expose address format
q35: use macro for MCFG property name
q35: expose mmcfg size as a property
i386: add ACPI table files from seabios
acpi: add rules to compile ASL source
acpi: pre-compiled ASL files
acpi: ssdt pcihp: updat generated file
loader: use file path size from fw_cfg.h
i386: add bios linker/loader
loader: allow adding ROMs in done callbacks
i386: define pc guest info
acpi/piix: add macros for acpi property names
piix: APIs for pc guest info
ich9: APIs for pc guest info
pvpanic: add API to access io port
hpet: add API to find it
i386: ACPI table generation code from seabios
ssdt: fix PBLK length
ssdt-proc: update generated file
don't post me: update bios

 configure                           |    9 +-
 hw/i386/acpi-build.h                |    9 +
 hw/i386/acpi-defs.h                 |  331 ++
 hw/i386/bios-linker-loader.h        |   27 +
 hw/lm32/lm32_hwsetup.h              |    2 +-
 include/hw/acpi/ich9.h              |    2 +
 include/hw/acpi/piix4.h             |    8 +
 include/hw/i386/ich9.h              |    2 +
 include/hw/i386/pc.h                |   22 +
 include/hw/loader.h                 |    8 +-
 include/hw/nvram/fw_cfg.h           |    8 +-
 include/hw/pci-host/q35.h           |    2 +
 include/hw/pci/pcie_host.h          |   27 +
 include/hw/timer/hpet.h             |    2 +
 include/qom/object.h                |   73 +-
 hw/acpi/ich9.c                      |   24 +
 hw/acpi/piix4.c                     |   50 +-
 hw/core/loader.c                    |   31 +-
 hw/i386/acpi-build.c                | 1205 ++++++
 hw/i386/bios-linker-loader.c        |  158 +
 hw/i386/pc.c                        |   23 +
 hw/i386/pc_piix.c                   |    5 +
 hw/i386/pc_q35.c                    |    3 +
 hw/isa/lpc_ich9.c                   |   40 +
 hw/misc/pvpanic.c                   |   13 +-
 hw/nvram/fw_cfg.c                   |   33 +-
 hw/pci-host/piix.c                  |    8 +
 hw/pci-host/q35.c                   |   26 +-
 hw/pci/pci.c                        |   20 +-
 hw/pci/pcie_host.c                  |   24 -
 hw/timer/hpet.c                     |    5 +
 qom/object.c                        |   60 +
 vl.c                                |    3 +
 hw/i386/Makefile.objs               |   27 +
 hw/i386/acpi-dsdt-cpu-hotplug.dsl   |   93 +
 hw/i386/acpi-dsdt-dbug.dsl          |   41 +
 hw/i386/acpi-dsdt-hpet.dsl          |   51 +
 hw/i386/acpi-dsdt-isa.dsl           |  117 +
 hw/i386/acpi-dsdt-pci-crs.dsl       |  105 +
 hw/i386/acpi-dsdt.dsl               |  343 ++
 hw/i386/acpi-dsdt.hex.generated     | 4409 +++++++++++++++++++++
 hw/i386/q35-acpi-dsdt.dsl           |  452 +++
 hw/i386/q35-acpi-dsdt.hex.generated | 7346 +++++++++++++++++++++++++++++++++++
 hw/i386/ssdt-misc.dsl               |  119 +
 hw/i386/ssdt-misc.hex.generated     |  386 ++
 hw/i386/ssdt-pcihp.dsl              |   51 +
 hw/i386/ssdt-pcihp.hex.generated    |  108 +
 hw/i386/ssdt-proc.dsl               |   63 +
 hw/i386/ssdt-proc.hex.generated     |  134 +
 pc-bios/acpi-dsdt.aml               |  Bin 4407 -> 4407 bytes
 pc-bios/bios.bin                    |  Bin 131072 -> 262144 bytes
 pc-bios/q35-acpi-dsdt.aml           |  Bin 7344 -> 7344 bytes
 scripts/acpi_extract.py             |  362 ++
 scripts/acpi_extract_preprocess.py  |   51 +
 scripts/update-acpi.sh              |    4 +
 55 files changed, 16442 insertions(+), 83 deletions(-)
 create mode 100644 hw/i386/acpi-build.h
 create mode 100644 hw/i386/acpi-defs.h
 create mode 100644 hw/i386/bios-linker-loader.h
 create mode 100644 include/hw/acpi/piix4.h
 create mode 100644 hw/i386/acpi-build.c
 create mode 100644 hw/i386/bios-linker-loader.c
 create mode 100644 hw/i386/acpi-dsdt-cpu-hotplug.dsl
 create mode 100644 hw/i386/acpi-dsdt-dbug.dsl
 create mode 100644 hw/i386/acpi-dsdt-hpet.dsl
 create mode 100644 hw/i386/acpi-dsdt-isa.dsl
 create mode 100644 hw/i386/acpi-dsdt-pci-crs.dsl
 create mode 100644 hw/i386/acpi-dsdt.dsl
 create mode 100644 hw/i386/acpi-dsdt.hex.generated
 create mode 100644 hw/i386/q35-acpi-dsdt.dsl
 create mode 100644 hw/i386/q35-acpi-dsdt.hex.generated
 create mode 100644 hw/i386/ssdt-misc.dsl
 create mode 100644 hw/i386/ssdt-misc.hex.generated
 create mode 100644 hw/i386/ssdt-pcihp.dsl
 create mode 100644 hw/i386/ssdt-pcihp.hex.generated
 create mode 100644 hw/i386/ssdt-proc.dsl
 create mode 100644 hw/i386/ssdt-proc.hex.generated
 create mode 100755 scripts/acpi_extract.py
 create mode 100755 scripts/acpi_extract_preprocess.py
 create mode 100644 scripts/update-acpi.sh
Signature · 1 line
MST