280 lines · plain
1.. SPDX-License-Identifier: GPL-2.02.. include:: <isonum.txt>3 4============================================================5Linuxized ACPICA - Introduction to ACPICA Release Automation6============================================================7 8:Copyright: |copy| 2013-2016, Intel Corporation9 10:Author: Lv Zheng <lv.zheng@intel.com>11 12 13Abstract14========15This document describes the ACPICA project and the relationship between16ACPICA and Linux. It also describes how ACPICA code in drivers/acpi/acpica,17include/acpi and tools/power/acpi is automatically updated to follow the18upstream.19 20ACPICA Project21==============22 23The ACPI Component Architecture (ACPICA) project provides an operating24system (OS)-independent reference implementation of the Advanced25Configuration and Power Interface Specification (ACPI). It has been26adapted by various host OSes. By directly integrating ACPICA, Linux can27also benefit from the application experiences of ACPICA from other host28OSes.29 30The homepage of ACPICA project is: www.acpica.org, it is maintained and31supported by Intel Corporation.32 33The following figure depicts the Linux ACPI subsystem where the ACPICA34adaptation is included::35 36 +---------------------------------------------------------+37 | |38 | +---------------------------------------------------+ |39 | | +------------------+ | |40 | | | Table Management | | |41 | | +------------------+ | |42 | | +----------------------+ | |43 | | | Namespace Management | | |44 | | +----------------------+ | |45 | | +------------------+ ACPICA Components | |46 | | | Event Management | | |47 | | +------------------+ | |48 | | +---------------------+ | |49 | | | Resource Management | | |50 | | +---------------------+ | |51 | | +---------------------+ | |52 | | | Hardware Management | | |53 | | +---------------------+ | |54 | +---------------------------------------------------+ | |55 | | | +------------------+ | | |56 | | | | OS Service Layer | | | |57 | | | +------------------+ | | |58 | | +-------------------------------------------------|-+ |59 | | +--------------------+ | |60 | | | Device Enumeration | | |61 | | +--------------------+ | |62 | | +------------------+ | |63 | | | Power Management | | |64 | | +------------------+ Linux/ACPI Components | |65 | | +--------------------+ | |66 | | | Thermal Management | | |67 | | +--------------------+ | |68 | | +--------------------------+ | |69 | | | Drivers for ACPI Devices | | |70 | | +--------------------------+ | |71 | | +--------+ | |72 | | | ...... | | |73 | | +--------+ | |74 | +---------------------------------------------------+ |75 | |76 +---------------------------------------------------------+77 78 Figure 1. Linux ACPI Software Components79 80.. note::81 A. OS Service Layer - Provided by Linux to offer OS dependent82 implementation of the predefined ACPICA interfaces (acpi_os_*).83 ::84 85 include/acpi/acpiosxf.h86 drivers/acpi/osl.c87 include/acpi/platform88 include/asm/acenv.h89 B. ACPICA Functionality - Released from ACPICA code base to offer90 OS independent implementation of the ACPICA interfaces (acpi_*).91 ::92 93 drivers/acpi/acpica94 include/acpi/ac*.h95 tools/power/acpi96 C. Linux/ACPI Functionality - Providing Linux specific ACPI97 functionality to the other Linux kernel subsystems and user space98 programs.99 ::100 101 drivers/acpi102 include/linux/acpi.h103 include/linux/acpi*.h104 include/acpi105 tools/power/acpi106 D. Architecture Specific ACPICA/ACPI Functionalities - Provided by the107 ACPI subsystem to offer architecture specific implementation of the108 ACPI interfaces. They are Linux specific components and are out of109 the scope of this document.110 ::111 112 include/asm/acpi.h113 include/asm/acpi*.h114 arch/*/acpi115 116ACPICA Release117==============118 119The ACPICA project maintains its code base at the following repository URL:120https://github.com/acpica/acpica.git. As a rule, a release is made every121month.122 123As the coding style adopted by the ACPICA project is not acceptable by124Linux, there is a release process to convert the ACPICA git commits into125Linux patches. The patches generated by this process are referred to as126"linuxized ACPICA patches". The release process is carried out on a local127copy the ACPICA git repository. Each commit in the monthly release is128converted into a linuxized ACPICA patch. Together, they form the monthly129ACPICA release patchset for the Linux ACPI community. This process is130illustrated in the following figure::131 132 +-----------------------------+133 | acpica / master (-) commits |134 +-----------------------------+135 /|\ |136 | \|/137 | /---------------------\ +----------------------+138 | < Linuxize repo Utility >-->| old linuxized acpica |--+139 | \---------------------/ +----------------------+ |140 | |141 /---------\ |142 < git reset > \143 \---------/ \144 /|\ /+-+145 | / |146 +-----------------------------+ | |147 | acpica / master (+) commits | | |148 +-----------------------------+ | |149 | | |150 \|/ | |151 /-----------------------\ +----------------------+ | |152 < Linuxize repo Utilities >-->| new linuxized acpica |--+ |153 \-----------------------/ +----------------------+ |154 \|/155 +--------------------------+ /----------------------\156 | Linuxized ACPICA Patches |<----------------< Linuxize patch Utility >157 +--------------------------+ \----------------------/158 |159 \|/160 /---------------------------\161 < Linux ACPI Community Review >162 \---------------------------/163 |164 \|/165 +-----------------------+ /------------------\ +----------------+166 | linux-pm / linux-next |-->< Linux Merge Window >-->| linux / master |167 +-----------------------+ \------------------/ +----------------+168 169 Figure 2. ACPICA -> Linux Upstream Process170 171.. note::172 A. Linuxize Utilities - Provided by the ACPICA repository, including a173 utility located in source/tools/acpisrc folder and a number of174 scripts located in generate/linux folder.175 B. acpica / master - "master" branch of the git repository at176 <https://github.com/acpica/acpica.git>.177 C. linux-pm / linux-next - "linux-next" branch of the git repository at178 <https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git>.179 D. linux / master - "master" branch of the git repository at180 <https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git>.181 182 Before the linuxized ACPICA patches are sent to the Linux ACPI community183 for review, there is a quality assurance build test process to reduce184 porting issues. Currently this build process only takes care of the185 following kernel configuration options:186 CONFIG_ACPI/CONFIG_ACPI_DEBUG/CONFIG_ACPI_DEBUGGER187 188ACPICA Divergences189==================190 191Ideally, all of the ACPICA commits should be converted into Linux patches192automatically without manual modifications, the "linux / master" tree should193contain the ACPICA code that exactly corresponds to the ACPICA code194contained in "new linuxized acpica" tree and it should be possible to run195the release process fully automatically.196 197As a matter of fact, however, there are source code differences between198the ACPICA code in Linux and the upstream ACPICA code, referred to as199"ACPICA Divergences".200 201The various sources of ACPICA divergences include:202 1. Legacy divergences - Before the current ACPICA release process was203 established, there already had been divergences between Linux and204 ACPICA. Over the past several years those divergences have been greatly205 reduced, but there still are several ones and it takes time to figure206 out the underlying reasons for their existence.207 2. Manual modifications - Any manual modification (eg. coding style fixes)208 made directly in the Linux sources obviously hurts the ACPICA release209 automation. Thus it is recommended to fix such issues in the ACPICA210 upstream source code and generate the linuxized fix using the ACPICA211 release utilities (please refer to Section 4 below for the details).212 3. Linux specific features - Sometimes it's impossible to use the213 current ACPICA APIs to implement features required by the Linux kernel,214 so Linux developers occasionally have to change ACPICA code directly.215 Those changes may not be acceptable by ACPICA upstream and in such cases216 they are left as committed ACPICA divergences unless the ACPICA side can217 implement new mechanisms as replacements for them.218 4. ACPICA release fixups - ACPICA only tests commits using a set of the219 user space simulation utilities, thus the linuxized ACPICA patches may220 break the Linux kernel, leaving us build/boot failures. In order to221 avoid breaking Linux bisection, fixes are applied directly to the222 linuxized ACPICA patches during the release process. When the release223 fixups are backported to the upstream ACPICA sources, they must follow224 the upstream ACPICA rules and so further modifications may appear.225 That may result in the appearance of new divergences.226 5. Fast tracking of ACPICA commits - Some ACPICA commits are regression227 fixes or stable-candidate material, so they are applied in advance with228 respect to the ACPICA release process. If such commits are reverted or229 rebased on the ACPICA side in order to offer better solutions, new ACPICA230 divergences are generated.231 232ACPICA Development233==================234 235This paragraph guides Linux developers to use the ACPICA upstream release236utilities to obtain Linux patches corresponding to upstream ACPICA commits237before they become available from the ACPICA release process.238 239 1. Cherry-pick an ACPICA commit240 241 First you need to git clone the ACPICA repository and the ACPICA change242 you want to cherry pick must be committed into the local repository.243 244 Then the gen-patch.sh command can help to cherry-pick an ACPICA commit245 from the ACPICA local repository::246 247 $ git clone https://github.com/acpica/acpica248 $ cd acpica249 $ generate/linux/gen-patch.sh -u [commit ID]250 251 Here the commit ID is the ACPICA local repository commit ID you want to252 cherry pick. It can be omitted if the commit is "HEAD".253 254 2. Cherry-pick recent ACPICA commits255 256 Sometimes you need to rebase your code on top of the most recent ACPICA257 changes that haven't been applied to Linux yet.258 259 You can generate the ACPICA release series yourself and rebase your code on260 top of the generated ACPICA release patches::261 262 $ git clone https://github.com/acpica/acpica263 $ cd acpica264 $ generate/linux/make-patches.sh -u [commit ID]265 266 The commit ID should be the last ACPICA commit accepted by Linux. Usually,267 it is the commit modifying ACPI_CA_VERSION. It can be found by executing268 "git blame source/include/acpixf.h" and referencing the line that contains269 "ACPI_CA_VERSION".270 271 3. Inspect the current divergences272 273 If you have local copies of both Linux and upstream ACPICA, you can generate274 a diff file indicating the state of the current divergences::275 276 # git clone https://github.com/acpica/acpica277 # git clone https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git278 # cd acpica279 # generate/linux/divergence.sh -s ../linux280