Support for configuring bootconsole and console via the ACPI tables
DBG2 (Debug Port Table 2) [1] and SPCR (Serial Port Console Redirection
Table) [2], defined by Microsoft, has been discussed on and off over the
years.
[1] https://msdn.microsoft.com/en-us/library/windows/hardware/dn639131(v=vs.85)…
[2] https://msdn.microsoft.com/en-us/library/windows/hardware/dn639132(v=vs.85)…
Licensing concerns have prevented this happening in the past, but as of
10 August 2015, these tables have both been released also under OWF 1.0
(http://www.openwebfoundation.org/legal/the-owf-1-0-agreements/owfa-1-0)
which is think is noncontroversially GPL-compatible?
This set is a first attempt at implementing this.
Submitting as an RFC since the SPCR handling currently depends on the
console driver being initialized after subsystem initcalls. Workaround
to enable testing surrounding infrastructure in 5/5, _really_ not
intended to be merged.
(Suggestions for acceptable ways of working around this appreciated.)
For testing the DBG2 stuff with pl011, you would need:
- A patch to unbreak pl011 earlycon, like
http://permalink.gmane.org/gmane.linux.ports.arm.kernel/433219
- A QEMU that generates DBG2 tables, like current HEAD with the
addition of
http://lists.nongnu.org/archive/html/qemu-devel/2015-09/msg01719.html
SPCR support is included in QEMU's ARM mach-virt since 2.4 release.
DBG2 support has an Intel copyright notice added to it since my starting
point was Lv Zheng's 2012 DBGP/DBG2 set (although not much of the
original remains - this is quite a cut-down version).
Leif Lindholm (4):
arm64: move acpi/dt decision earlier in boot process
of/serial: move earlycon early_param handling to serial
acpi/serial: add DBG2 earlycon support
HACK: serial: move pl011 initcall to device_initcall
Torez Smith (1):
tty/console: use SPCR table to define console
arch/arm64/kernel/acpi.c | 55 +++++----
drivers/acpi/Makefile | 1 +
drivers/acpi/console.c | 260 +++++++++++++++++++++++++++++++++++++++
drivers/of/fdt.c | 13 +-
drivers/tty/serial/amba-pl011.c | 2 +-
drivers/tty/serial/earlycon.c | 18 ++-
drivers/tty/serial/serial_core.c | 14 ++-
include/linux/acpi.h | 13 ++
include/linux/of_fdt.h | 1 +
include/linux/serial_core.h | 9 +-
10 files changed, 337 insertions(+), 49 deletions(-)
create mode 100644 drivers/acpi/console.c
--
2.1.4
From: Fu Wei <fu.wei(a)linaro.org>
ACPI/APEI is designed to verifiy/report H/W errors, like Corrected
Error(CE) and Uncorrected Error(UC). It contains four tables: HEST,
ERST, EINJ and BERT. The first three tables have been merged for
a long time, but because of lacking BIOS support for BERT, the
support for BERT is pending until now. Recently on ARM 64 platform
it is has been supported. So here we come.
The following log is a BERT record after system reboot because of
hitting a fatal error.
BERT: Obtained BERT iomem region <00000000fe801000-00000000fe802000> for BERT.
[Hardware Error]: Error record from previous boot:
[Hardware Error]: event severity: fatal
[Hardware Error]: Error 0, type: fatal
[Hardware Error]: section_type: memory error
[Hardware Error]: physical_address: 0x00000000fe800000
[Hardware Error]: physical_address_mask: 0x0000000000000fff
[Hardware Error]: card: 0 module: 1 bank: 0 device: 1 row: 1 column: 1 bit_pos
Changelog:
v2: Delete EXPORT_SYMBOL_GPL(bert_disable), because "bert_disable" is only used
in bert.c for now.
Do some code-style cleanups.
v1: The first upstream version submitted in linux-acpi mailing list:
http://www.spinics.net/lists/linux-acpi/msg57384.html
Huang Ying (1):
ACPI, APEI, Boot Error Record Table (BERT) support
Tomasz Nowicki (1):
acpi, apei, bert: Clear error status at the end of error handling
Documentation/kernel-parameters.txt | 3 +
drivers/acpi/apei/Makefile | 2 +-
drivers/acpi/apei/bert.c | 165 ++++++++++++++++++++++++++++++++++++
include/acpi/apei.h | 1 +
4 files changed, 170 insertions(+), 1 deletion(-)
create mode 100644 drivers/acpi/apei/bert.c
--
2.4.3
This patch set is introducing ARM64 PCI hostbridge init based on ACPI,
which based on Jiang Liu's patch set "Consolidate ACPI PCI root common
code into ACPI core":
https://lkml.org/lkml/2015/5/14/98
This patch set including three parts:
- the first part is PATCH 1, which should be merged into Jiang Liu's
patch set to fix the compile error on ARM64 when ACPI enabled.
- the senconed part is the refactoring of mmconfig to let that mechanism
can be used for ARM64 too, it's Tomasz's work but he is moving to other
work and pretty busy for now, so I will take care of those patches,
Tomasz will show up when some comments need to be addressed :)
In this version of mmconfig refactor patches, I removed the rename
of mmconfig -> ecam patch, because mmconfig is in multi places, and need
much more effort to convert them all to ecam, Bjorn, if you don't
like it, I can add them back.
- The third part is about the ARM64 PCI hostbridge init based on ACPI,
first I fixed a compile error for XEN PCI on ARM64 when PCI_MMCONFIG=y,
and then introduce PCI init based on Jiang Liu and Tomasz's patch set.
patch for ARM64 ACPI PCI still reserve the bus sysdata to get the domain
number, because Yijing's patch set is still under review, will be removed
when Yijing's patch set hits upstream.
This patch set was tested by Suravee on Seattle board with legacy interrupt
(not MSI), and it works, also tested on qemu by Graeme.
You can get the code from:
git://git.linaro.org/leg/acpi/acpi.git, devel branch
Comments are welcomed.
Thanks
Hanjun
Hanjun Guo (3):
ARM64 / PCI: introduce struct pci_controller for ACPI
XEN / PCI: Remove the dependence on arch x86 when PCI_MMCONFIG=y
ARM64 / PCI / ACPI: support for ACPI based PCI hostbridge init
Tomasz Nowicki (8):
x86, pci: Clean up comment about buggy MMIO config space access for
AMD Fam10h CPUs.
x86, pci: Abstract PCI config accessors and use AMD Fam10h workaround
exclusively.
x86, pci: Reorder logic of pci_mmconfig_insert() function
x86, pci, acpi: Move arch-agnostic MMCONFIG (aka ECAM) and ACPI code
out of arch/x86/ directory
pci, acpi, mcfg: Provide generic implementation of MCFG code
initialization.
x86, pci: mmconfig_{32,64}.c code refactoring - remove code
duplication.
x86, pci, ecam: mmconfig_64.c becomes default implementation for ECAM
driver.
pci, acpi, mcfg: Share ACPI PCI config space accessors.
arch/arm64/Kconfig | 7 +
arch/arm64/include/asm/pci.h | 10 ++
arch/arm64/kernel/pci.c | 245 ++++++++++++++++++++++++++--
arch/x86/Kconfig | 4 +
arch/x86/include/asm/pci_x86.h | 34 +---
arch/x86/pci/Makefile | 4 +-
arch/x86/pci/acpi.c | 1 +
arch/x86/pci/mmconfig-shared.c | 301 +++++++++++-----------------------
arch/x86/pci/mmconfig_32.c | 35 +---
arch/x86/pci/mmconfig_64.c | 153 ------------------
arch/x86/pci/numachip.c | 25 +--
drivers/acpi/Makefile | 1 +
drivers/acpi/mcfg.c | 103 ++++++++++++
drivers/pci/Kconfig | 10 ++
drivers/pci/Makefile | 5 +
drivers/pci/ecam.c | 358 +++++++++++++++++++++++++++++++++++++++++
drivers/pci/pci.c | 26 +--
drivers/xen/pci.c | 7 +-
include/linux/acpi.h | 2 +
include/linux/ecam.h | 56 +++++++
20 files changed, 923 insertions(+), 464 deletions(-)
delete mode 100644 arch/x86/pci/mmconfig_64.c
create mode 100644 drivers/acpi/mcfg.c
create mode 100644 drivers/pci/ecam.c
create mode 100644 include/linux/ecam.h
--
1.9.1
NB: this patch set is for use against the linux-pm bleeding edge branch.
Currently, the BAD_MADT_ENTRY macro is used to do a very simple sanity
check on the various subtables that are defined for the MADT. The check
compares the size of the subtable data structure as defined by ACPICA to
the length entry in the subtable. If they are not the same, the assumption
is that the subtable is incorrect.
Over time, the ACPI spec has allowed for MADT subtables where this can
never be true (the local SAPIC subtable, for example). Or, more recently,
the spec has accumulated some minor flaws where there are three possible
sizes for a subtable, all of which are valid, but only for specific versions
of the spec (the GICC subtable). In both cases, BAD_MADT_ENTRY reports these
subtables as bad when they are not. In order to retain some sanity check
on the MADT subtables, we now have to special case these subtables. Of
necessity, these special cases have ended up in arch-dependent code (arm64)
or an arch has simply decided to forgo the check (ia64).
This patch set replaces the BAD_MADT_ENTRY macro with a function called
bad_madt_entry(). This function uses a data set of details about the
subtables to provide more sanity checking than before:
-- is the subtable legal for the version given in the FADT?
-- is the subtable legal for the revision of the MADT in use?
-- is the subtable of the proper length (including checking
on the one variable length subtable that is currently ignored),
given the FADT version and the MADT revision?
Further, this patch set adds in the call to bad_madt_entry() from the
acpi_table_parse_madt() function, allowing it to be used consistently
by all architectures, for all subtables, and removing the need for each
of the subtable traversal callback functions to use BAD_MADT_ENTRY.
In theory, as the ACPI specification changes, we would only have to add
additional information to the data set describing the MADT subtables in
order to continue providing sanity checks, even when new subtables are
added.
These patches have been tested on an APM Mustang (arm64) and are known to
work there. They have also been cross-compiled for x86 and ia64 with no
known failures.
Changes for v5:
-- 0-day found incorrect data in the table describing allowed MADT
subtables; this only affected ACPI 1.0 firmware. Corrected the
data to meet the 1.0b spec.
-- Rebase to bleeding-edge branch for Rafael Wysocki; this patch set
now requires that a patch set from Marc Zyngier be applied first:
https://lkml.org/lkml/2015/9/28/421
-- Tested on AMD Seattle (linux-pm tree) also
Changes for v4:
-- Remove extraneous white space change (Graeme Gregory)
-- acpi_parse_entries() changes also needed a check to make sure that
only MADT entries used bad_madt_entry() (Sudeep Holla)
-- inadvertent use of 01day build noted that bad_madt_entry() can be
static, so added it (Sudeep Holla, Fengguang Wu)
Changes for v3:
-- Reviewed-and-tested-by from Sudeep Holla for arm64 parts
-- Clearer language in error messages (Graeme Gregory, Timur Tabi)
-- Double checked that inserting call to bad_madt_entry() into the
function acpi_parse_entries() does not impact current behavior
(Sudeep Holla)
Changes for v2:
-- Acked-by on 2/5 from Marc Zyngier and Catalin Marinas for ARM
-- Correct faulty end of loop test found by Timur Tabi
Al Stone (5):
ACPI: add in a bad_madt_entry() function to eventually replace the
macro
ACPI / ARM64: remove usage of BAD_MADT_ENTRY/BAD_MADT_GICC_ENTRY
ACPI / IA64: remove usage of BAD_MADT_ENTRY
ACPI / X86: remove usage of BAD_MADT_ENTRY
ACPI: remove definition of BAD_MADT_ENTRY macro
arch/arm64/include/asm/acpi.h | 8 --
arch/arm64/kernel/smp.c | 2 -
arch/ia64/kernel/acpi.c | 20 ----
arch/x86/kernel/acpi/boot.c | 27 -----
drivers/acpi/tables.c | 247 +++++++++++++++++++++++++++++++++++++++++-
drivers/irqchip/irq-gic.c | 3 -
include/linux/acpi.h | 4 -
7 files changed, 246 insertions(+), 65 deletions(-)
--
2.4.3
CPPC:
====
CPPC (Collaborative Processor Performance Control) is a new way to control CPU
performance using an abstract continous scale as against a discretized P-state scale
which is tied to CPU frequency only. It is defined in the ACPI 5.0+ spec. In brief,
the basic operation involves:
- OS makes a CPU performance request. (Can provide min and max tolerable bounds)
- Platform (such as BMC) is free to optimize request within requested bounds depending
on power/thermal budgets etc.
- Platform conveys its decision back to OS
The communication between OS and platform occurs through another medium called (PCC)
Platform communication Channel. This is a generic mailbox like mechanism which includes
doorbell semantics to indicate register updates. See drivers/mailbox/pcc.c
This patchset introduces a CPPC based CPUFreq driver that works with existing governors
such as ondemand. The CPPC table parsing and the CPPC communication semantics are
abstracted into separate files to allow future CPPC based drivers to implement their
own governors if required.
Initial patchsets included an adaptation of the PID governor from intel_pstate.c. However
recent experiments led to extensive modifications of the algorithm to calculate CPU
busyness. Until it is verified that these changes are worthwhile, the existing governors
should provide for a good enough starting point for ARM64 servers.
Finer details about the PCC and CPPC spec are available in the latest ACPI 5.1
specification.[2]
Testing:
=======
This was tested on an SBSA compatible ARMv8 server with CPPCv2
firmware running on a remote processor. I verified that each CPUs
performance limits were detected and that new performance requests
were made by the on-demand governor proportional to the load on each
CPU. I also verified that using the acpi_processor driver correctly
maps the physical CPU ids to logical CPU ids, which helps in picking
up the proper _CPC details from a processor object, in the case where
CPU physical ids may not be contiguous.
Changes since V8:
- Fixed up several debug prints, return types and comments.
- Simplified read/write ops using existing ACPI core API.
- Removed ->get() from cpufreq driver for now.
- Fixed bug introduced by copy-paste err in set_perf.
Changes since V7:
- Simplied new kconfig options for PSS and idle.
- Separated patch to enable acpi processor on ARM64.
- Removed redundant kconfig cross deps on PCC.
- Decoupled processor_perflib from new PSS kconfig option.
Changes since V6:
- Separated PSS and CST from ACPI processor driver in two patches.
- Made new Kconfig symbols auto selectable from Arch Kconfigs.
Changes since V5:
- Checkpatch cleanups.
- Change pss_init to pss_perf_init. Rec by Srinivas Pandruvada.
- Explicit comment explaining why postcore_initcall to pcc mailbox.
- Fold acpi_processor_syscore_init/exit into CONFIG_ACPI_CST.
- Added patch with dummy functions used by ACPI_HOTPLUG_CPU.
Changes since V4:
- Misc cleanups. Addressed feedback from Rafael.
- Made acpi_processor.c independent of C-states, P-states and others.
- Per CPU scanning for _CPC is now made from acpi_processor.c
- Added new Kconfig options for legacy C states and P states to enable future
support for newer alternatives as defined in the ACPI spec 6.0.
Changes since V3:
- Split CPPC backend methods into separate files.
- Add frontend driver which plugs into existing CPUfreq governors.
- Simplify PCC driver by moving communication space mapping and read/write
into client drivers.
Changes since V2:
- Select driver if !X86, since intel_pstate will use HWP extensions instead.
- Added more comments.
- Added Freq domain awareness and PSD parsing.
Changes since V1:
- Create a new driver based on Dirks suggestion.
- Fold in CPPC backend hooks into main driver.
Changes since V0: [1]
- Split intel_pstate.c into a generic PID governor and platform specific backend.
- Add CPPC accessors as PID backend.
[1] - http://lwn.net/Articles/608715/
[2] - http://www.uefi.org/sites/default/files/resources/ACPI_5_1release.pdf
[3] - https://patches.linaro.org/40705/
Ashwin Chaugule (5):
ACPI: Introduce CPU performance controls using CPPC
CPPC: Add a CPUFreq driver for use with CPPC
ACPI: Add weak routines for ACPI CPU Hotplug
CPPC: Probe for CPPC tables for each ACPI Processor object
ACPI: Allow selection of the ACPI processor driver for ARM64
drivers/acpi/Kconfig | 20 +-
drivers/acpi/Makefile | 1 +
drivers/acpi/acpi_processor.c | 18 +
drivers/acpi/cppc_acpi.c | 755 ++++++++++++++++++++++++++++++++++++++++
drivers/acpi/processor_driver.c | 6 +
drivers/cpufreq/Kconfig.arm | 17 +
drivers/cpufreq/Makefile | 2 +
drivers/cpufreq/cppc_cpufreq.c | 169 +++++++++
include/acpi/cppc_acpi.h | 138 ++++++++
include/acpi/processor.h | 14 +
10 files changed, 1137 insertions(+), 3 deletions(-)
create mode 100644 drivers/acpi/cppc_acpi.c
create mode 100644 drivers/cpufreq/cppc_cpufreq.c
create mode 100644 include/acpi/cppc_acpi.h
--
1.9.1
From: Fu Wei <fu.wei(a)linaro.org>
This patchset:
(1)Introduce Documentation/devicetree/bindings/watchdog/sbsa-gwdt.txt
for FDT info of SBSA Generic Watchdog, and give two examples of
adding SBSA Generic Watchdog device node into the dts files:
foundation-v8.dts and amd-seattle-soc.dtsi.
(2)Introduce "pretimeout" into the watchdog framework, and update
Documentation/watchdog/watchdog-kernel-api.txt to introduce:
(1)the new elements in the watchdog_device and watchdog_ops struct;
(2)the new API "watchdog_init_timeouts".
(3)Introduce ARM SBSA watchdog driver:
a.Use linux kernel watchdog framework;
b.Work with FDT on ARM64;
c.Use "pretimeout" in watchdog framework;
d.Support getting timeout and pretimeout from parameter and FDT
at the driver init stage.
e.In the first timeout, do panic to save system context;
f.In the second stage, user can still feed the dog without
cleaning WS0. By this feature, we can avoid the panic infinite
loops, while backing up a large system context in a server.
g.In the second stage, can trigger WS1 by setting pretimeout = 0
if necessary.
(4)Introduce ACPI GTDT parser: drivers/acpi/gtdt.c
Parse SBSA Generic Watchdog Structure in GTDT table of ACPI,
and create a platform device with that information.
This platform device can be used by This Watchdog driver.
drivers/clocksource/arm_arch_timer.c is simplified by this GTDT support.
This patchset has been tested with watchdog daemon
(ACPI/FDT, module/build-in) on the following platforms:
(1)ARM Foundation v8 model
Changelog:
v7: Rebase to latest kernel version(4.2-rc7).
Improve FDT support: geting resource by order, instead of name.
According to the FDT support, Update the example dts file, gtdt.c
and sbsa_gwdt.c.
Pass the sparse test, and fix the warning.
Fix the max_pretimeout and max_timeout value overflow bug.
Delete the WCV output value.
v6: Improve the dtb example files: reduce the register frame size to 4K.
Improve pretimeout support:
(1) improve watchdog_init_timeouts function
(2) rename watchdog_check_min_max_timeouts back to the original name
(1) improve watchdog_timeout_invalid/watchdog_pretimeout_invalid
Add the new features in the sbsa_gwdt driver:
(1) In the second stage, user can feed the dog without cleaning WS0.
(2) In the second stage, user can trigger WS1 by setting pretimeout = 0.
(3) expand the max value of pretimeout, in case 10 second is not enough
for a kdump kernel reboot in panic.
v5: Improve pretimeout support:
(1)fix typo in documentation and comments.
(2)fix the timeout limits validation bug.
Simplify sbsa_gwdt driver:
(1)integrate all the registers access functions into caller.
v4: Refactor GTDT support code: remove it from arch/arm64/kernel/acpi.c,
put it into drivers/acpi/gtdt.c file.
Integrate the GTDT code of drivers/clocksource/arm_arch_timer.c into
drivers/acpi/gtdt.c.
Improve pretimeout support, fix "pretimeout == 0" problem.
Simplify sbsa_gwdt driver:
(1)timeout/pretimeout limits setup;
(2)keepalive function;
(3)delete "clk == 0" check;
(4)delete WS0 status bit check in interrupt routine;
(5)sbsa_gwdt_set_wcv function.
v3: Delete "export arch_timer_get_rate" patch.
Driver back to use arch_timer_get_cntfrq.
Improve watchdog_init_timeouts function and update relevant documentation.
Improve watchdog_timeout_invalid and watchdog_pretimeout_invalid.
Improve foundation-v8.dts: delete the unnecessary tag of device node.
Remove "ARM64 || COMPILE_TEST" from Kconfig.
Add comments in arch/arm64/kernel/acpi.c
Fix typoes and incorrect comments.
v2: Improve watchdog-kernel-api.txt documentation for pretimeout support.
Export "arch_timer_get_rate" in arm_arch_timer.c.
Add watchdog_init_timeouts API for pretimeout support in framework.
Improve suspend and resume foundation in driver
Improve timeout/pretimeout values init code in driver.
Delete unnecessary items of the sbsa_gwdt struct and #define.
Delete all unnecessary debug info in driver.
Fix 64bit division bug.
Use the arch_timer interface to get watchdog clock rate.
Add MODULE_DEVICE_TABLE for platform device id.
Fix typoes.
v1: The first version upstream patchset to linux mailing list.
Fu Wei (8):
Documentation: add sbsa-gwdt.txt documentation
ARM64: add SBSA Generic Watchdog device node in foundation-v8.dts
ARM64: add SBSA Generic Watchdog device node in amd-seattle-soc.dtsi
Watchdog: introdouce "pretimeout" into framework
Watchdog: introduce ARM SBSA watchdog driver
ACPI: add GTDT table parse driver into ACPI driver
Watchdog: enable ACPI GTDT support for ARM SBSA watchdog driver
clocksource: simplify ACPI code in arm_arch_timer.c
.../devicetree/bindings/watchdog/sbsa-gwdt.txt | 32 ++
Documentation/watchdog/watchdog-kernel-api.txt | 47 ++-
arch/arm64/boot/dts/amd/amd-seattle-soc.dtsi | 8 +
arch/arm64/boot/dts/arm/foundation-v8.dts | 7 +
arch/arm64/kernel/time.c | 4 +-
drivers/acpi/Kconfig | 9 +
drivers/acpi/Makefile | 1 +
drivers/acpi/gtdt.c | 178 ++++++++
drivers/clocksource/Kconfig | 1 +
drivers/clocksource/arm_arch_timer.c | 60 +--
drivers/watchdog/Kconfig | 15 +
drivers/watchdog/Makefile | 1 +
drivers/watchdog/sbsa_gwdt.c | 459 +++++++++++++++++++++
drivers/watchdog/watchdog_core.c | 98 +++--
drivers/watchdog/watchdog_dev.c | 53 +++
include/clocksource/arm_arch_timer.h | 8 +
include/linux/acpi.h | 5 +
include/linux/clocksource.h | 4 +-
include/linux/watchdog.h | 39 +-
19 files changed, 939 insertions(+), 90 deletions(-)
create mode 100644 Documentation/devicetree/bindings/watchdog/sbsa-gwdt.txt
create mode 100644 drivers/acpi/gtdt.c
create mode 100644 drivers/watchdog/sbsa_gwdt.c
--
2.4.3
IRQ controllers and timers are the two types of device the kernel
requires before being able to use the device driver model.
The Device Tree infrastructure makes it very easy to make these
discoverable by the rest of the kernel. For example, each interrupt
controller driver has at least one entry like this:
IRQCHIP_DECLARE(gic_400, "arm,gic-400", gic_of_init);
which says: if you find a node having "arm,gic-400" as a compatible
string in the device tree, then call gic_of_init with this node as a
parameter. The probing itself is done by the OF layer when the
architecture code calls of_irq_init() (usually via irqchip_init).
This has a number of benefits:
- The irqchip code is self-contained. No architecture specific entry
point, no exposed symbols. Just a standard interface.
- The low-level architecture code doesn't have to know about which
interrupt controller is present. It just calls into the firmware
interface (of_irq_init) which is going to sort things out.
Similar infrastructure is provided for the timers/clock sources. Note
that this is not a replacement for the device model, but acts as a
probing infrastructure for things that are required too early for the
device infrastructure to be available.
What I'm aiming for is to introduce the same level of abstraction for
ACPI, or at least for the few bits that are required before a full blown
ACPI/device model can be used. For this, I introduce something vaguely
similar:
IRQCHIP_ACPI_DECLARE(gic_v2, ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR,
gic_validate_dist, ACPI_MADT_GIC_VERSION_V2,
gic_v2_acpi_init);
which says: if you find a ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR entry in
MADT (implied by the macro), and that entry is of type
ACPI_MADT_GIC_VERSION_V2 (as checked by gic_validate_dist), then call
gic_v2_acpi_init with the entry as a parameter. A bit more convoluted,
but still without any special entry point.
The various interrupt controller drivers can then implement the above,
and the arch code can use a firmware-specific call to get the probing
done, still oblivious to what interrupt controller is being used. It
also makes the adaptation of a DT driver to ACPI easier.
It turns out that providing such a probing infrastructure is rather
easy, and provides a much deserved cleanup in both the arch code, the
GIC driver, and the architected timer driver. An additional (and very
much optional) patch renames files and symbols to make it obvious that
the infrastructure is not just for DT anymore.
I'm sure there is some more code to be deleted, and one can only
wonder why this wasn't done before the arm64 code was initially merged
(the diffstat says it all...).
Patches are against Rafael's bleeding-edge branch, and a branch is
available at
git://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms.git acpi/device-probing-v3
* From v2:
- Addressed Rafael's comments (title for patch #1, macro/field names)
- New config symbols for clocksources
- Additional and optional last patch to get rid of the apparent
dependency between the probing infrastructure and DT.
* From the initial version:
- Make the infrastructure more DT like by providing an
acpi_probe_entry array per "device type" (one for irqchips, one
for clocksources). This means that entries can depend on any ACPI
static table.
- Use some cpp magic to reduce the amount of code added to an
absolute minimum.
- Rebased on v4.3-rc1
Marc Zyngier (7):
acpi: Add early device probing infrastructure
irqchip/acpi: Add probing infrastructure for ACPI-based irqchips
irqchip/gic: Convert the GIC driver to ACPI probing
clocksource/acpi: Add probing infrastructure for ACPI-based
clocksources
clocksource: Add new CLKSRC_{PROBE,ACPI} config symbols
clocksource/arm_arch_timer: Convert to ACPI probing
clocksource: cosmetic: Drop OF 'dependency' from symbols
arch/arm/kernel/time.c | 2 +-
arch/arm/mach-omap2/timer.c | 4 +-
arch/arm/mach-rockchip/rockchip.c | 2 +-
arch/arm/mach-shmobile/setup-r8a7779.c | 2 +-
arch/arm/mach-shmobile/setup-rcar-gen2.c | 2 +-
arch/arm/mach-spear/spear13xx.c | 2 +-
arch/arm/mach-sunxi/sunxi.c | 2 +-
arch/arm/mach-u300/core.c | 2 +-
arch/arm/mach-ux500/timer.c | 2 +-
arch/arm/mach-zynq/common.c | 2 +-
arch/arm64/include/asm/acpi.h | 1 -
arch/arm64/include/asm/irq.h | 13 ----
arch/arm64/kernel/acpi.c | 25 --------
arch/arm64/kernel/time.c | 8 +--
arch/microblaze/kernel/setup.c | 2 +-
arch/mips/pistachio/time.c | 2 +-
arch/mips/ralink/clk.c | 2 +-
arch/nios2/kernel/time.c | 2 +-
arch/xtensa/kernel/time.c | 2 +-
drivers/acpi/scan.c | 39 ++++++++++++
drivers/clocksource/Kconfig | 9 +++
drivers/clocksource/Makefile | 2 +-
drivers/clocksource/arm_arch_timer.c | 10 +---
.../clocksource/{clksrc-of.c => clksrc-probe.c} | 6 +-
drivers/irqchip/irq-gic.c | 69 +++++++++++-----------
drivers/irqchip/irqchip.c | 5 +-
include/asm-generic/vmlinux.lds.h | 12 ++++
include/linux/acpi.h | 66 +++++++++++++++++++++
include/linux/acpi_irq.h | 10 ----
include/linux/clocksource.h | 13 ++--
include/linux/irqchip.h | 17 ++++++
include/linux/irqchip/arm-gic-acpi.h | 31 ----------
32 files changed, 209 insertions(+), 159 deletions(-)
rename drivers/clocksource/{clksrc-of.c => clksrc-probe.c} (91%)
delete mode 100644 include/linux/acpi_irq.h
delete mode 100644 include/linux/irqchip/arm-gic-acpi.h
--
2.1.4
Currently, the BAD_MADT_ENTRY macro is used to do a very simple sanity
check on the various subtables that are defined for the MADT. The check
compares the size of the subtable data structure as defined by ACPICA to
the length entry in the subtable. If they are not the same, the assumption
is that the subtable is incorrect.
Over time, the ACPI spec has allowed for MADT subtables where this can
never be true (the local SAPIC subtable, for example). Or, more recently,
the spec has accumulated some minor flaws where there are three possible
sizes for a subtable, all of which are valid, but only for specific versions
of the spec (the GICC subtable). In both cases, BAD_MADT_ENTRY reports these
subtables as bad when they are not. In order to retain some sanity check
on the MADT subtables, we now have to special case these subtables. Of
necessity, these special cases have ended up in arch-dependent code (arm64)
or an arch has simply decided to forgo the check (ia64).
This patch set replaces the BAD_MADT_ENTRY macro with a function called
bad_madt_entry(). This function uses a data set of details about the
subtables to provide more sanity checking than before:
-- is the subtable legal for the version given in the FADT?
-- is the subtable legal for the revision of the MADT in use?
-- is the subtable of the proper length (including checking
on the one variable length subtable that is currently ignored),
given the FADT version and the MADT revision?
Further, this patch set adds in the call to bad_madt_entry() from the
acpi_table_parse_madt() function, allowing it to be used consistently
by all architectures, for all subtables, and removing the need for each
of the subtable traversal callback functions to use BAD_MADT_ENTRY.
In theory, as the ACPI specification changes, we would only have to add
additional information to the data set describing the MADT subtables in
order to continue providing sanity checks, even when new subtables are
added.
These patches have been tested on an APM Mustang (arm64) and are known to
work there. They have also been cross-compiled for x86 and ia64 with no
known failures.
Changes for v4:
-- Remove extraneous white space change (Graeme Gregory)
-- acpi_parse_entries() changes also needed a check to make sure that
only MADT entries used bad_madt_entry() (Sudeep Holla)
-- inadvertent use of 01day build noted that bad_madt_entry() can be
static, so added it (Sudeep Holla, Fengguang Wu)
Changes for v3:
-- Reviewed-and-tested-by from Sudeep Holla for arm64 parts
-- Clearer language in error messages (Graeme Gregory, Timur Tabi)
-- Double checked that inserting call to bad_madt_entry() into the
function acpi_parse_entries() does not impact current behavior
(Sudeep Holla)
Changes for v2:
-- Acked-by on 2/5 from Marc Zyngier and Catalin Marinas for ARM
-- Correct faulty end of loop test found by Timur Tabi
Al Stone (5):
ACPI: add in a bad_madt_entry() function to eventually replace the
macro
ACPI / ARM64: remove usage of BAD_MADT_ENTRY/BAD_MADT_GICC_ENTRY
ACPI / IA64: remove usage of BAD_MADT_ENTRY
ACPI / X86: remove usage of BAD_MADT_ENTRY
ACPI: remove definition of BAD_MADT_ENTRY macro
arch/arm64/include/asm/acpi.h | 8 --
arch/arm64/kernel/smp.c | 2 -
arch/ia64/kernel/acpi.c | 20 ----
arch/x86/kernel/acpi/boot.c | 27 -----
drivers/acpi/tables.c | 244 ++++++++++++++++++++++++++++++++++++++++++
drivers/irqchip/irq-gic.c | 6 --
include/linux/acpi.h | 4 -
7 files changed, 244 insertions(+), 67 deletions(-)
--
2.4.3
IRQ controllers and timers are the two types of device the kernel
requires before being able to use the device driver model.
The Device Tree infrastructure makes it very easy to make these
discoverable by the rest of the kernel. For example, each interrupt
controller driver has at least one entry like this:
IRQCHIP_DECLARE(gic_400, "arm,gic-400", gic_of_init);
which says: if you find a node having "arm,gic-400" as a compatible
string in the device tree, then call gic_of_init with this node as a
parameter. The probing itself is done by the OF layer when the
architecture code calls of_irq_init() (usually via irqchip_init).
This has a number of benefits:
- The irqchip code is self-contained. No architecture specific entry
point, no exposed symbols. Just a standard interface.
- The low-level architecture code doesn't have to know about which
interrupt controller is present. It just calls into the firmware
interface (of_irq_init) which is going to sort things out.
Similar infrastructure is provided for the timers/clock sources. Note
that this is not a replacement for the device model, but acts as a
probing infrastructure for things that are required too early for the
device infrastructure to be available.
What I'm aiming for is to introduce the same level of abstraction for
ACPI, or at least for the few bits that are required before a full blown
ACPI/device model can be used. For this, I introduce something vaguely
similar:
IRQCHIP_ACPI_DECLARE(gic_v2, ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR,
gic_validate_dist, ACPI_MADT_GIC_VERSION_V2,
gic_v2_acpi_init);
which says: if you find a ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR entry in
MADT (implied by the macro), and that entry is of type
ACPI_MADT_GIC_VERSION_V2 (as checked by gic_validate_dist), then call
gic_v2_acpi_init with the entry as a parameter. A bit more convoluted,
but still without any special entry point.
The various interrupt controller drivers can then implement the above,
and the arch code can use a firmware-specific call to get the probing
done, still oblivious to what interrupt controller is being used. It
also makes the adaptation of a DT driver to ACPI easier.
It turns out that providing such a probing infrastructure is rather
easy, and provides a much deserved cleanup in both the arch code, the
GIC driver, and the architected timer driver.
I'm sure there is some more code to be deleted, and one can only
wonder why this wasn't done before the arm64 code was initially merged
(the diffstat says it all...).
Patches are against v4.3-rc1, and a branch is available at
git://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms.git acpi/device-probing-v2
* From the initial version:
- Make the infrastructure more DT like by providing an
acpi_probe_entry array per "device type" (one for irqchips, one
for clocksources). This means that entries can depend on any ACPI
static table.
- Use some cpp magic to reduce the amount of code added to an
absolute minimum.
- Rebased on v4.3-rc1
Marc Zyngier (5):
acpi: Add basic device probing infrastructure
irqchip/acpi: Add probing infrastructure for ACPI-based irqchips
irqchip/gic: Convert the GIC driver to ACPI probing
clocksource/acpi: Add probing infrastructure for ACPI-based
clocksources
clocksource/arm_arch_timer: Convert to ACPI probing
arch/arm64/include/asm/acpi.h | 1 -
arch/arm64/include/asm/irq.h | 13 -------
arch/arm64/kernel/acpi.c | 25 -------------
arch/arm64/kernel/time.c | 6 ----
drivers/acpi/scan.c | 39 ++++++++++++++++++++
drivers/clocksource/arm_arch_timer.c | 10 +-----
drivers/clocksource/clksrc-of.c | 4 +++
drivers/irqchip/irq-gic.c | 69 ++++++++++++++++++------------------
drivers/irqchip/irqchip.c | 5 ++-
include/asm-generic/vmlinux.lds.h | 12 +++++++
include/linux/acpi.h | 65 +++++++++++++++++++++++++++++++++
include/linux/acpi_irq.h | 10 ------
include/linux/clocksource.h | 7 ++--
include/linux/irqchip.h | 16 +++++++++
include/linux/irqchip/arm-gic-acpi.h | 31 ----------------
15 files changed, 176 insertions(+), 137 deletions(-)
delete mode 100644 include/linux/acpi_irq.h
delete mode 100644 include/linux/irqchip/arm-gic-acpi.h
--
2.1.4