Some of the ACPI code is arch-dependent and make the code can't be
compiled on !x86 and !ia64, the first two patches just do some rework
on the idle_boot_override and _PDC related stuff to make the ACPI
code more arch-independent.
The third patch just introduce map_gic_id() for ACPI processor core
followed by the ACPI 5.0 spec.
These three patches are just ACPI related so I send them out as
a separate patch set.
I have compiled the kernel successful after appling this patch set
on x86, ia64 and powerpc(with cross compile tool).
Changes since last RFC version:
a) Remove the RFC tag;
b) Move idle_boot_override out of the arch directory suggested
by Alan;
c) Make these 3 patches as a separate patch set since there are
not not related to the ARM/ARM64 platform.
Hanjun Guo (3):
ACPI / idle: Move idle_boot_override out of the arch directory
ACPI / processor_core: Rework _PDC related stuff to make it more
arch-independent
ACPI: Introduce map_gic_id() to get apic id from MADT or _MAT method
arch/ia64/include/asm/acpi.h | 5 +---
arch/ia64/include/asm/processor.h | 3 ---
arch/ia64/kernel/acpi.c | 17 +++++++++++++
arch/powerpc/include/asm/processor.h | 1 -
arch/x86/include/asm/acpi.h | 19 +--------------
arch/x86/include/asm/processor.h | 3 ---
arch/x86/kernel/acpi/cstate.c | 31 ++++++++++++++++++++++++
arch/x86/kernel/process.c | 1 +
drivers/acpi/processor_core.c | 47 +++++++++++++++++++++---------------
include/linux/cpu.h | 8 ++++++
10 files changed, 87 insertions(+), 48 deletions(-)
--
1.8.2.2
This patch set is based on part1 "Make ACPI core running on ARM64" patch
set.
After we can get the ACPI tables from UEFI, we can use these tables
to initialise the system now.
GIC (means GIC cpu interface) structure and GIC distributor structure in
MADT table contains the information of GIC cpu interface base address
and GIC distributor base address, which can be used to initialise GIC.
Further more, parked address in GIC structure can be used as cpu release
address for spin table SMP initialisation.
This patch set use these information to init SMP and GIC.
Please refer to chapter 5.2.12.14/15 of ACPI 5.0 spec for GIC and GIC
distributor structure information.
Amit Daniel Kachhap (1):
irqdomain: Add a new API irq_create_acpi_mapping()
Hanjun Guo (8):
ARM64 / ACPI: Implement core functions for parsing MADT table
ARM64 / ACPI: Prefill cpu possible/present maps and map logical cpu
id to APIC id
ARM64 / ACPI: Introduce map_gic_id() to get apic id from MADT or _MAT
method
ARM64 / ACPI: Use Parked Address in GIC structure for spin table SMP
initialisation
ACPI: Define ACPI_IRQ_MODEL_GIC needed for arm
Irqchip / gic: Set as default domain so we can access from ACPI
ACPI / ARM64: Update acpi_register_gsi to register with the core IRQ
subsystem
ACPI / GIC: Initialize GIC using the information in MADT
arch/arm64/include/asm/acpi.h | 16 +-
arch/arm64/kernel/irq.c | 5 +
arch/arm64/kernel/setup.c | 2 +
arch/arm64/kernel/smp.c | 2 +
arch/arm64/kernel/smp_spin_table.c | 16 +-
drivers/acpi/bus.c | 3 +
drivers/acpi/plat/arm-core.c | 397 +++++++++++++++++++++++++++++++++++-
drivers/acpi/processor_core.c | 26 +++
drivers/acpi/tables.c | 21 ++
drivers/irqchip/irq-gic.c | 7 +
include/linux/acpi.h | 9 +
kernel/irq/irqdomain.c | 27 +++
12 files changed, 521 insertions(+), 10 deletions(-)
--
1.7.9.5
From: Al Stone <al.stone(a)linaro.org>
ACPI hardware reduced mode exists to allow newer platforms to use a
simpler form of ACPI that does not require supporting legacy versions
of the specification and their associated hardware. This mode was
introduced in the ACPI 5.0 specification.
To enable the hardware reduced mode of ACPI, we need to set the flag
ACPI_REDUCED_HARDWARE to TRUE in the ACPICA source. In order to do
that, we introduce a kernel configuration item to enable or disable
ACPI_REDUCED_HARDWARE. We can then change the kernel configuration
instead of having to modify the kernel source.
Introducing this configuration item is based on suggestions from Lv
Zheng saying that this does not belong in ACPICA, but rather to the
Linux kernel itself. Hence, we introduce this configuration item so
that we can make ACPI_REDUCED_HARDWARE configurable. For the details
of the discussion, please refer to:
http://www.spinics.net/lists/linux-acpi/msg46369.html
Changes for v3:
-- Minimize the changelog.
Changes for v2:
-- Changed test for EXPERT to avoid reported Kconfig warning
Signed-off-by: Hanjun Guo <hanjun.guo(a)linaro.org>
Signed-off-by: Al Stone <al.stone(a)linaro.org>
---
drivers/acpi/Kconfig | 13 +++++++++++++
include/acpi/platform/aclinux.h | 6 ++++++
2 files changed, 19 insertions(+)
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index 4770de5..9fd6a7a 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -343,6 +343,19 @@ config ACPI_BGRT
data from the firmware boot splash. It will appear under
/sys/firmware/acpi/bgrt/ .
+config ACPI_REDUCED_HARDWARE_ONLY
+ bool "Hardware-reduced ACPI support only" if EXPERT
+ def_bool n
+ depends on ACPI
+ help
+ This config item changes the way the ACPI code is built. When this
+ option is selected, the kernel will use a specialized version of
+ ACPICA that ONLY supports the ACPI "reduced hardware" mode. The
+ resulting kernel will be smaller but it will also be restricted to
+ running in ACPI reduced hardware mode ONLY.
+
+ If you are unsure what to do, do not enable this option.
+
source "drivers/acpi/apei/Kconfig"
config ACPI_EXTLOG
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index 28f4f4d..7d71f08 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -52,6 +52,12 @@
#ifdef __KERNEL__
+/* Compile for reduced hardware mode only with this kernel config */
+
+#ifdef CONFIG_ACPI_REDUCED_HARDWARE_ONLY
+#define ACPI_REDUCED_HARDWARE 1
+#endif
+
#include <linux/string.h>
#include <linux/kernel.h>
#include <linux/ctype.h>
--
1.8.4.2
From: Al Stone <al.stone(a)linaro.org>
Hardware reduced mode, despite the name, exists primarily to allow
newer platforms to use a much simpler form of ACPI that does not
require supporting the legacy of previous versions of the specification.
This mode was first introduced in the ACPI 5.0 specification, but because
it is so much simpler and reduces the size of the object code needed to
support ACPI, it is likely to be used more often in the near future.
To enable the hardware reduced mode of ACPI on some platforms (such as
ARM), we need to modify the kernel code and set ACPI_REDUCED_HARDWARE
to TRUE in the ACPICA source. For ARM/ARM64, hardware reduced ACPI
should be the only mode used; legacy mode would require modifications
to SoCs in order to provide several x86-specific hardware features (e.g.,
an NMI and SMI support).
We set ACPI_REDUCED_HARDWARE to TRUE in the ACPICA source by introducing
a kernel config item to enable/disable ACPI_REDUCED_HARDWARE. We can then
change the kernel config instead of having to modify the kernel source
directly to enable the reduced hardware mode of ACPI.
Lv Zheng suggested that this configuration item does not belong in ACPICA,
the upstream source for much of the ACPI internals, but rather to the
Linux kernel itself. Hence, we introduce this flag so that we can make
ACPI_REDUCED_HARDWARE configurable. For the details of the discussion,
please refer to: http://www.spinics.net/lists/linux-acpi/msg46369.html
Even though support for X86 in hardware reduced mode is possible, it
is NOT enabled. Extensive effort has gone into the Linux kernel so that
there is a single kernel image than can run on all x86 hardware; the kernel
changes run-time behavior to adapt to the hardware being used. This is not
currently possible with the existing ACPICA infrastructure but only presents
a problem on achitectures supporting both hardware-reduced and legacy modes
of ACPI -- i.e., on x86 only.
The problem with the current ACPICA code base is that if one builds legacy
ACPI (a proper superset of hardware-reduced), the kernel can run in hardware-
reduced with the proper ACPI tables, but there is still ACPICA code that could
be executed even though it is not allowed by the specification. If one builds
a hardware-reduced only ACPI, the kernel cannot run with ACPI tables that are
for legacy mode. To ensure compliance with ACPI, one must therefore build
two separate kernels. Once this problem has been properly fixed, we can then
enable x86 hardware-reduced mode and use a single kernel.
This patch used to be part of a set to implement stricter conformance with
hardware reduced ACPI. The code changes from that set are being re-thought
in order to handle some non-compliant hardware, but this patch did not depend
on those changes. In the meantime, this patch is needed in order to enable
ACPI core functionality for ARMv8 servers and hence is being submitted
separately in order to aid that effort.
Signed-off-by: Hanjun Guo <hanjun.guo(a)linaro.org>
Signed-off-by: Al Stone <al.stone(a)linaro.org>
---
drivers/acpi/Kconfig | 13 +++++++++++++
include/acpi/platform/aclinux.h | 6 ++++++
2 files changed, 19 insertions(+)
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index 4770de5..961ea9e 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -343,6 +343,19 @@ config ACPI_BGRT
data from the firmware boot splash. It will appear under
/sys/firmware/acpi/bgrt/ .
+config ACPI_REDUCED_HARDWARE_ONLY
+ bool "Hardware-reduced ACPI support only"
+ def_bool n
+ depends on ACPI && EXPERT
+ help
+ This config item changes the way the ACPI code is built. When this
+ option is selected, the kernel will use a specialized version of
+ ACPICA that ONLY supports the ACPI "reduced hardware" mode. The
+ resulting kernel will be smaller but it will also be restricted to
+ running in ACPI reduced hardware mode ONLY.
+
+ If you are unsure what to do, do not enable this option.
+
source "drivers/acpi/apei/Kconfig"
config ACPI_EXTLOG
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index 28f4f4d..7d71f08 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -52,6 +52,12 @@
#ifdef __KERNEL__
+/* Compile for reduced hardware mode only with this kernel config */
+
+#ifdef CONFIG_ACPI_REDUCED_HARDWARE_ONLY
+#define ACPI_REDUCED_HARDWARE 1
+#endif
+
#include <linux/string.h>
#include <linux/kernel.h>
#include <linux/ctype.h>
--
1.8.4.2
From: Al Stone <al.stone(a)linaro.org>
Hardware reduced mode, despite the name, exists primarily to allow
newer platforms to use a much simpler form of ACPI that does not
require supporting the legacy of previous versions of the specification.
This mode was first introduced in the ACPI 5.0 specification, but because
it is so much simpler and reduces the size of the object code needed to
support ACPI, it is likely to be used more often in the near future.
To enable the hardware reduced mode of ACPI on some platforms (such as
ARM), we need to modify the kernel code and set ACPI_REDUCED_HARDWARE
to TRUE in the ACPICA source. For ARM/ARM64, hardware reduced ACPI
should be the only mode used; legacy mode would require modifications
to SoCs in order to provide several x86-specific hardware features (e.g.,
an NMI and SMI support).
We set ACPI_REDUCED_HARDWARE to TRUE in the ACPICA source by introducing
a kernel config item to enable/disable ACPI_REDUCED_HARDWARE. We can then
change the kernel config instead of having to modify the kernel source
directly to enable the reduced hardware mode of ACPI.
Lv Zheng suggested that this configuration item does not belong in ACPICA,
the upstream source for much of the ACPI internals, but rather to the
Linux kernel itself. Hence, we introduce this flag so that we can make
ACPI_REDUCED_HARDWARE configurable. For the details of the discussion,
please refer to: http://www.spinics.net/lists/linux-acpi/msg46369.html
Even though support for X86 in hardware reduced mode is possible, it
is NOT enabled. Extensive effort has gone into the Linux kernel so that
there is a single kernel image than can run on all x86 hardware; the kernel
changes run-time behavior to adapt to the hardware being used. This is not
currently possible with the existing ACPICA infrastructure but only presents
a problem on achitectures supporting both hardware-reduced and legacy modes
of ACPI -- i.e., on x86 only.
The problem with the current ACPICA code base is that if one builds legacy
ACPI (a proper superset of hardware-reduced), the kernel can run in hardware-
reduced with the proper ACPI tables, but there is still ACPICA code that could
be executed even though it is not allowed by the specification. If one builds
a hardware-reduced only ACPI, the kernel cannot run with ACPI tables that are
for legacy mode. To ensure compliance with ACPI, one must therefore build
two separate kernels. Once this problem has been properly fixed, we can then
enable x86 hardware-reduced mode and use a single kernel.
Changes for v2:
-- Changed test for EXPERT to avoid reported Kconfig warning
Signed-off-by: Hanjun Guo <hanjun.guo(a)linaro.org>
Signed-off-by: Al Stone <al.stone(a)linaro.org>
---
drivers/acpi/Kconfig | 13 +++++++++++++
include/acpi/platform/aclinux.h | 6 ++++++
2 files changed, 19 insertions(+)
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index 4770de5..9fd6a7a 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -343,6 +343,19 @@ config ACPI_BGRT
data from the firmware boot splash. It will appear under
/sys/firmware/acpi/bgrt/ .
+config ACPI_REDUCED_HARDWARE_ONLY
+ bool "Hardware-reduced ACPI support only" if EXPERT
+ def_bool n
+ depends on ACPI
+ help
+ This config item changes the way the ACPI code is built. When this
+ option is selected, the kernel will use a specialized version of
+ ACPICA that ONLY supports the ACPI "reduced hardware" mode. The
+ resulting kernel will be smaller but it will also be restricted to
+ running in ACPI reduced hardware mode ONLY.
+
+ If you are unsure what to do, do not enable this option.
+
source "drivers/acpi/apei/Kconfig"
config ACPI_EXTLOG
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index 28f4f4d..7d71f08 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -52,6 +52,12 @@
#ifdef __KERNEL__
+/* Compile for reduced hardware mode only with this kernel config */
+
+#ifdef CONFIG_ACPI_REDUCED_HARDWARE_ONLY
+#define ACPI_REDUCED_HARDWARE 1
+#endif
+
#include <linux/string.h>
#include <linux/kernel.h>
#include <linux/ctype.h>
--
1.8.4.2
Hi Yi,
I prepared couple of pointers for you.
- wiki page about APEI which use SCI mechanism for x86:
https://wiki.linaro.org/LEG/Engineering/Kernel/ACPI/EINJ
- since there is no SCI for ARM we added to our acpi git tree commit
which simulates SCI behaviour for test purposes:
ACPI: Enable SCI_EMULATE to manually simulate physical hotplug testing
You can find SCI emulation usage example on wiki page above.
- JIRA card description which gives brief description of GPIO signalled
events idea for ACPI Hardware Reduced profile:
https://cards.linaro.org/browse/CARD-756
Let me know if you will have any questions.
Tomasz
From: Al Stone <al.stone(a)linaro.org>
These patches are experimental; they do actually compile and they even
seem to execute correctly. They are by no means complete. The reason
for posting them is really just to stir some discussion and see if this
is a truly crazy idea or if it has some potential for easing the ACPI
transition.
These patches introduce GUFI: the Grand Unified Firmware Interface. Okay,
yes, it is a silly name. I didn't spend a lot of time on it. What I'm
most interested in is the idea and whether it is worth pursuing further,
and whether or not there are better ways to do this if it does make sense.
The idea is very simple: introduce a shim layer that looks like a merge of
some sort between ACPI and FDT functionality in the kernel. In that shim
layer, make it possible for a driver to make a single call to a function,
and with that call, retrieve configuration information stored in either
ACPI tables or a DT. Further, allow the kernel to specify which has
priority -- i.e., search through ACPI tables, and then through FDT if
data is not found, or vice versa -- or which is exclusive, either ACPI
or FDT only.
Why would I do this? As a kernel developer, this allows me to make changes
in the direction of either FDT or ACPI as quickly or as slowly as I want to.
Most of my config can be in FDT and I can then piecemeal convert to ACPI
as I figure out ASL and/or any driver changes that may be needed. Secondly,
if I do this well, the changes to convert from FDT to ACPI *should* be very
small; from ACPI to FDT may be more difficult but over time that can likely
be improved as well. If someone was clever, they could even add support for
a specific board file and gradually convert that to FDT or ACPI. Third, in
the really, really long term, maybe someone comes up with yet another hardware
configuration description format that is so cool it provides sharks with
laser beams on their heads and *everyone* wants to convert to it. With this
layer in place, perhaps we can smooth even that transition by abstracting out
the config info that's needed and the API to retrieve it.
So, what do you think?
Changes in v2:
-- Took a completely different approach to the overall structure based
on feedback from Tomasz Nowicki.
-- Changed an assumption: originally, I wanted to absolutely minimize
the changes in API between OF and GUFI. That assumption has been
dropped in favor of defining a more general API that will attempt
to merge the best of ACPI and OF.
-- The changes to vexpress-sysreg are for only one OF call for now.
The previous version was more complete, but this version works. Over
time, further changes will be made as each call is converted to this
newer API.
Al Stone (4):
GUFI: add kernel config options for GUFI
GUFI: introduce the basic framework
ARM64: GUFI: add setup_arch() call to gufi_init()
GUFI: MFD: initial change to use one GUFI API call in vexpress-sysreg
arch/arm64/Kconfig | 6 -
arch/arm64/kernel/setup.c | 5 +
drivers/Kconfig | 2 +
drivers/gufi/Kconfig | 44 +++++++
drivers/gufi/Makefile | 11 ++
drivers/gufi/acpi_protocol.c | 35 +++++
drivers/gufi/acpi_protocol.h | 37 ++++++
drivers/gufi/core.c | 296 ++++++++++++++++++++++++++++++++++++++++++
drivers/gufi/of_protocol.c | 44 +++++++
drivers/gufi/of_protocol.h | 37 ++++++
drivers/mfd/vexpress-sysreg.c | 5 +-
include/linux/gufi.h | 62 +++++++++
12 files changed, 577 insertions(+), 7 deletions(-)
create mode 100644 drivers/gufi/Kconfig
create mode 100644 drivers/gufi/Makefile
create mode 100644 drivers/gufi/acpi_protocol.c
create mode 100644 drivers/gufi/acpi_protocol.h
create mode 100644 drivers/gufi/core.c
create mode 100644 drivers/gufi/of_protocol.c
create mode 100644 drivers/gufi/of_protocol.h
create mode 100644 include/linux/gufi.h
--
1.8.4.2
From: Al Stone <al.stone(a)linaro.org>
This series of patches starts with Hanjun's patch to create a kernel
config item for CONFIG_ACPI_REDUCED_HARDWARE [0]. Building on that, I
then reviewed all of the code that touched any of several fields in the
FADT that the OSPM is supposed to ignore when ACPI is in Hardware Reduced
mode [1]. Any time there was a use of one of the fields to be ignored,
I evaluated whether or not the code was implementing Hardware Reduced
mode correctly. Similarly, for each the flags in the FADT flags field
that are to be ignored in Hardware Reduced mode, the kernel code was again
scanned for proper usage. The remainder of the patches are to fix all of
the situations I could find where the kernel would not behave correctly
in this ACPI mode.
These seem to work just fine on the RTSM model for ARMv7, both with and
without ACPI enabled, and with and without ACPI_REDUCED_HARDWARE enabled;
similarly for the FVP model for ARMv8. The patches for ACPI on ARM
hardware have been submitted elsewhere but they presume that reduced HW
mode is functioning correctly. In the meantime, there's no way I can think
of to test all possible scenarios so feedback would be greatly appreciated.
[0] List at https://wiki.linaro.org/LEG/Engineering/Kernel/ACPI/AcpiReducedHw#Section_5…
[1] Please see the ACPI Specification v5.0 for details on Hardware Reduced
mode (sections 3.11.1, 4.1, 5.2.9, at a minimum).
Changes for v6:
-- Allow selection of CONFIG_ACPI_REDUCED_HARDWARE_ONLY to be more
architecture-independent, but make it harder to accidentally enable.
-- Make sure that ACPI ECs do not use the ACPI global lock when in
hardware reduced mode (I had missed this case in earlier reviews
of the kernel tree).
Changes for v5:
-- Clarify that if the kernel config option to build ACPI hardware reduced
mode is used, it builds a hardware reduced *only* kernel (i.e., full
legacy ACPI mode will no longer work).
Changes for v4:
-- Given the current state of ACPICA, disable CONFIG_ACPI_REDUCED_HARDWARE
for use on anything other than ARM.
-- Replaced #ifdefs with run-time checking for hardware reduced mode,
whenever possible
Changes for v3:
-- Modified enabling ACPI_REDUCED_HARDWARE in ACPICA when using
kernel config item CONFIG_ACPI_REDUCED_HARDWARE; now consistent
with ACPICA code base where needed
-- Enable X86 for CONFIG_ACPI_REDUCED_HARDWARE
-- Minimize bus master reload patching
-- Remove unneeded patch for dmi_check_system() (was 4/6)
-- Correct the patch for removing unneeded map/unmap of FADT fields
Changes for v2:
-- Remove patch that was outside of reduced HW mode changes
-- Simplify CONFIG_ACPI_REDUCED_HARDWARE in Kconfig
-- Simplify use of CONFIG_ACPI_REDUCED_HARDWARE in #ifdefs
-- Ensure changelogs are present
-- Combine and simplify previous patches 8 & 10
Al Stone (6):
ACPI: introduce CONFIG_ACPI_REDUCED_HARDWARE_ONLY to enforce this ACPI
mode
ACPI: bus master reload not supported in reduced HW mode
ACPI: HW reduced mode does not allow use of the FADT sci_interrupt
field
ACPI: in HW reduced mode, using FADT PM information is not allowed.
ACPI: do not map/unmap memory regions for FADT entries in reduced HW
mode
ACPI: make sure ECs do not use the ACPI global lock
drivers/acpi/Kconfig | 12 ++++++++++++
drivers/acpi/bus.c | 30 ++++++++++++++++--------------
drivers/acpi/ec.c | 12 ++++++++++--
drivers/acpi/osl.c | 38 +++++++++++++++++++-------------------
drivers/acpi/pci_link.c | 2 ++
drivers/acpi/processor_idle.c | 14 ++++++++++++--
include/acpi/platform/aclinux.h | 6 ++++++
7 files changed, 77 insertions(+), 37 deletions(-)
--
1.8.4.2