Skip to content

RFC ACPI[CA]: fix ECDT EC probe ordering issues

Hans de Goede acpica-devel linux-acpi 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 RFC Latest4 patches 4 repliesIn review
  2. v2 RFC2 patches 0 repliesSuperseded
  3. v1 RFC4 patches 9 repliesSuperseded

Changes in v3 from the cover letter

- Add a prep patch to fix an indentation issue in Linux' acpixf.h to fix the patch from ACPICA's script not applying
- Add 2 new functions to ACPICA for this instead of a flags argument
1. acpi_install_address_space_handler_no_reg()
2. acpi_execute_reg_methods()
- Add a patch to fix EC handler removal in the ECDT case

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4ACPICA: include/acpi/acpixf.h: Fix indentationinclude/acpi/acpixf.h+60 -600 replies
2/4ACPICA: Allow address_space_handler Install and _REG execution as 2 separate stepsdrivers/acpi/acpica/evxfregn.c include/acpi/acpixf.h+95 -70 replies
3/4ACPI: EC: Fix EC address space handler unregistrationdrivers/acpi/ec.c drivers/acpi/internal.h+4 -10 replies
4/4ACPI: EC: fix ECDT probe ordering issuesdrivers/acpi/ec.c+18 -102 replies

Reviews trailers per patch

None of the 4 patches has a Reviewed-by or Acked-by.

PatchJohannes Penßel
1/4
2/4Reported-and-tested-by
3/4
4/4Reported-and-tested-by

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [RFC v3 0/4] ACPI[CA]: fix ECDT EC probe ordering issues

Hi All,

Here is v3 of my series fixing some ECDT EC probe ordering issues which are causing issues om some laptops:

https://bugzilla.kernel.org/show_bug.cgi?id=214899

This is a RFC because fixing this requires some ACPICA changes which obviously need to go upstream through the ACPICA project:
https://github.com/acpica/acpica/pull/786

The problem this fixed is best described by the commit message of patch 4:

ACPI-2.0 says that the EC OpRegion handler must be available immediately (like the standard default OpRegion handlers):

Quoting from the ACPI spec version 6.3: "6.5.4 _REG (Region) ...
2. OSPM must make Embedded Controller operation regions, accessed via the Embedded Controllers described in ECDT, available before executing any control method. These operation regions may become inaccessible after OSPM runs _REG(EmbeddedControl, 0)."

So acpi_bus_init() calls acpi_ec_ecdt_probe(), which calls acpi_install_address_space_handler() to install the EC's OpRegion handler, early on.

This not only installs the OpRegion handler, but also calls the EC's _REG method. The _REG method call is a problem because it may rely on initialization done by the _INI methods of one of the PCI / _SB root devs, see for example: https://bugzilla.kernel.org/show_bug.cgi?id=214899 .

Generally speaking _REG methods are executed when the ACPI-device they are part of has a driver bound to it. Where as _INI methods must be executed at table load time (according to the spec). The problem here is that the early acpi_install_address_space_handler() call causes the _REG handler to run too early.

To allow fixing this the ACPICA code now allows to split the OpRegion handler installation and the executing of _REG into 2 separate steps.

This commit uses this ACPICA functionality to fix the EC probe ordering by delaying the executing of _REG for ECDT described ECs till the matching EC device in the DSDT gets parsed and acpi_ec_add() for it gets called. This moves the calling of _REG for the EC on devices with an ECDT to the same point in time where it is called on devices without an ECDT table.

Changes in v3:
- Add a prep patch to fix an indentation issue in Linux' acpixf.h to fix the patch from ACPICA's script not applying
- Add 2 new functions to ACPICA for this instead of a flags argument
1. acpi_install_address_space_handler_no_reg()
2. acpi_execute_reg_methods()
- Add a patch to fix EC handler removal in the ECDT case

From my pov this series is ready for merging once the ACPICA changes are accepted.

Regards,

Hans

Hans de Goede (4):
ACPICA: include/acpi/acpixf.h: Fix indentation
ACPICA: Allow address_space_handler Install and _REG execution as 2
separate steps
ACPI: EC: Fix EC address space handler unregistration
ACPI: EC: fix ECDT probe ordering issues

 drivers/acpi/acpica/evxfregn.c |  92 +++++++++++++++++++++--
 drivers/acpi/ec.c              |  32 +++++---
 drivers/acpi/internal.h        |   1 +
 include/acpi/acpixf.h          | 130 ++++++++++++++++++---------------
 4 files changed, 177 insertions(+), 78 deletions(-)
Signature · 1 line
2.37.3