qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [RFC 00/47] ACPI refactoring: replace template patching wit


From: Igor Mammedov
Subject: [Qemu-devel] [RFC 00/47] ACPI refactoring: replace template patching with C ASL API
Date: Fri, 19 Dec 2014 02:01:55 +0000

This series refactors SSDT runtime composing and gets rid of:
    * patching AML templates, with related pointer arithmetic magic
    * manual AML composition, i.e. creating AML terms practically
      byte by byte
    * using AML templates for SSDT creation, reducing dependency on IASL.
      as result of above, QEMU source tree doesn't have to carry
      'binary' template blobs that used to be part of SSDT.
    * hand-crafted PCI0._CRSes for pc/q35 machines in DSDT with
      manual hole punching of reserved resources
and adds following:
    * introduces ASL like API for creating AML objects using ASL
      like constructs/terms. API: 
          * provides a necessary minimum set of terms/helpers to
            replace currently used SSDT templates.
          * simplifies AML composition and keeps track of AML
            object contexts, transparently managing their 
            (de)allocation and merging into parent context,
            making composition of SSDT 'almost' like writing
            native ASL definition of the table.
          * hides pointer arithmetic from user when composing
            SSDT.
    * dynamically creates unified PCI0._CRS in SSDT for pc/q35
      machines allowing to reserve resources at runtime vs
      current compile time
    * while adding new API, make it target independed CONFIG_ACPI
      and also make some other utilities for composing ACPI tables
      target independed (i.e. utils on which API depends) so that
      they could be reused for ARM target later without moving
      stuff around uncessarily.

As result of replacing AML templates with ASL API, codebase
reduces on ~1800LOC even with net addition of API 1050LOC counted in.


Tested with XPsp3, WS2012R2, RHEL6/7 guests. 

Depends on:
    [PATCH V2 0/8] pc: acpi: various fixes and cleanups
    http://lists.gnu.org/archive/html/qemu-devel/2014-12/msg02454.html

Git tree for playing with:
    https://github.com/imammedo/qemu/commits/ASL_API_RFC_v1

 
Igor Mammedov (47):
  acpi: introduce AML composer aml_append()
  acpi: add acpi_scope() term
  acpi: add acpi_device() term
  acpi: add acpi_method() term
  acpi: add acpi_if() term
  acpi: add acpi_name() & acpi_name_decl() term
  acpi: factor out ACPI const int packing out build_append_value()
  acpi: extend build_append_{value|int}() to support 64-bit values
  acpi: add acpi_int() term
  acpi: add acpi_return() term
  acpi: add acpi_arg0(), acpi_arg1(), acpi_arg2(), acpi_arg3() terms
  acpi: add acpi_store() term
  acpi: add acpi_and() term
  acpi: add acpi_notify() term
  acpi: add acpi_call1(), acpi_call2(), acpi_call3(), acpi_call4()
    helpers
  pc: acpi-build: drop template patching and create PCI bus tree
    dinamically
  acpi: add acpi_package() term
  pc: acpi-build: drop unsupported PM1b_CNT.SLP_TYP
  pc: acpi-build: generate _S[345] packages dynamically
  acpi: add acpi_buffer() term
  acpi: add acpi_resource_template() helper
  acpi: add acpi_io() helper
  acpi: include PkgLength size only when requested
  acpi: add acpi_operation_region() term
  acpi: add acpi_field() & acpi_named_field() terms
  acpi: add acpi_local0() term
  acpi: add acpi_string() term
  pc: acpi-build: generate pvpanic device description dynamically
  acpi: add acpi_varpackage() term
  acpi: add acpi_equal() term
  acpi: add acpi_processor() term
  acpi: add acpi_eisaid() term
  pc: acpi-build: drop template patching and CPU hotplug objects
    dynamically
  pc: acpi-build: create CPU hotplug IO region dynamically
  acpi: add acpi_reserved_field() term
  pc: acpi-build: drop template patching and memory hotplug objects
    dynamically
  pc: acpi-build: create memory hotplug IO region dynamically
  acpi: add acpi_word_bus_number(), acpi_word_io(), acpi_dword_memory(),
    acpi_qword_memory() terms
  pc: pcihp: expose MMIO base and len as properties
  pc: acpi-build: reserve PCIHP MMIO resources
  pc: acpi-build: create PCI0._CRS dynamically
  acpi: make tables linker-loader available to other targets
  acpi: add acpi_def_block() term
  pc: acpi-build: prepare to make ACPI tables blob opaque for table
    building functions
  pc: acpi-build: drop remaining ssdt_misc template and use
    acpi_def_block()
  pc: acpi: update DSTD blobs
  tests: acpi: update reference DSDT/SSDT tables

 hw/acpi/Makefile.objs                |   2 +-
 hw/acpi/acpi_gen_utils.c             | 670 ++++++++++++++++++++++++++++--
 hw/acpi/bios-linker-loader.c         | 157 +++++++
 hw/acpi/pcihp.c                      |  18 +-
 hw/acpi/piix4.c                      |   2 +-
 hw/i386/Makefile.objs                |   5 +-
 hw/i386/acpi-build.c                 | 785 ++++++++++++++++++-----------------
 hw/i386/acpi-dsdt-cpu-hotplug.dsl    |  17 +-
 hw/i386/acpi-dsdt-mem-hotplug.dsl    |  36 +-
 hw/i386/acpi-dsdt-pci-crs.dsl        |  92 ----
 hw/i386/acpi-dsdt.dsl                |  45 --
 hw/i386/acpi-dsdt.hex.generated      | 678 +++---------------------------
 hw/i386/bios-linker-loader.c         | 157 -------
 hw/i386/bios-linker-loader.h         |  27 --
 hw/i386/q35-acpi-dsdt.dsl            |  18 -
 hw/i386/q35-acpi-dsdt.hex.generated  | 616 ++-------------------------
 hw/i386/ssdt-mem.dsl                 |  77 ----
 hw/i386/ssdt-mem.hex.generated       | 213 ----------
 hw/i386/ssdt-misc.dsl                | 122 ------
 hw/i386/ssdt-misc.hex.generated      | 399 ------------------
 hw/i386/ssdt-pcihp.dsl               | 100 -----
 hw/i386/ssdt-pcihp.hex.generated     | 251 -----------
 hw/i386/ssdt-proc.dsl                |  63 ---
 hw/i386/ssdt-proc.hex.generated      | 134 ------
 include/hw/acpi/acpi_gen_utils.h     | 167 +++++++-
 include/hw/acpi/bios-linker-loader.h |  27 ++
 include/hw/acpi/pc-hotplug.h         |   1 +
 include/hw/acpi/pcihp.h              |   7 +-
 tests/acpi-test-data/pc/DSDT         | Bin 3592 -> 3016 bytes
 tests/acpi-test-data/pc/SSDT         | Bin 2279 -> 2406 bytes
 tests/acpi-test-data/q35/DSDT        | Bin 8182 -> 7654 bytes
 tests/acpi-test-data/q35/SSDT        | Bin 560 -> 635 bytes
 32 files changed, 1527 insertions(+), 3359 deletions(-)
 create mode 100644 hw/acpi/bios-linker-loader.c
 delete mode 100644 hw/i386/acpi-dsdt-pci-crs.dsl
 delete mode 100644 hw/i386/bios-linker-loader.c
 delete mode 100644 hw/i386/bios-linker-loader.h
 delete mode 100644 hw/i386/ssdt-mem.dsl
 delete mode 100644 hw/i386/ssdt-mem.hex.generated
 delete mode 100644 hw/i386/ssdt-misc.dsl
 delete mode 100644 hw/i386/ssdt-misc.hex.generated
 delete mode 100644 hw/i386/ssdt-pcihp.dsl
 delete mode 100644 hw/i386/ssdt-pcihp.hex.generated
 delete mode 100644 hw/i386/ssdt-proc.dsl
 delete mode 100644 hw/i386/ssdt-proc.hex.generated
 create mode 100644 include/hw/acpi/bios-linker-loader.h

-- 
1.8.3.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]