Features Download
From: Jiang Liu <liuj97 <at> gmail.com>
Subject: [RFC PATCH 0/3] ACPI based system device hotplug framework
Newsgroups: gmane.linux.kernel.pci
Date: Saturday 28th July 2012 11:42:49 UTC (over 5 years ago)
From: Jiang Liu 

The patchset is based on v3.5-rc6 and you may pull them from:

Modern high-end server may support advanced hotplug features for system
devices, including physical processor, memory board, IO extension board
and/or computer node. The ACPI specifications have provided standard
interfaces between firmware and OS to support device hotplug at runtime.
This patch series provide an ACPI based hotplug framework to support system
device hotplug at runtime, which will replace current existing ACPI device
driver based CPU/memory/CONTAINER hotplug mechanism.

The new ACPI based hotplug framework is modelled after PCI hotplug
architecture and target to achieve following goals:
1) Provide a mechanism to detect hotplug slots by checking ACPI _EJ0
ACPI PRCT (platform RAS capabilities table) and other platform specific

2) Unify the way to enumerate ACPI based hotplug slots. All hotplug slots
will be enumerated by the enumeration driver, instead of by ACPI device

3) Dynamically create/destroy ACPI hotplug slots. For example, new ACPI
hotplug slots may be created when hot-adding a computer node if the node
contains some memory hotplug slots.

4) Unify the way to handle ACPI hotplug events. All ACPI hotplug events
for system devices will be handled by a generic ACPI hotplug driver,
instead of handled by ACPI device drivers.

5) Solve dependencies among hotplug slots. You need first to remove the
memory device before removing a physical processor if a hotpluggable memory
device is connected to a hotpluggable physical processor.

6) Provide better error handling and recover.

7) Provide interface to cancel ongoing hotplug operations. It may take a
very long time to remove a memory device, so provide interface to cancel
the operation.

8) Support new RAS features, such as socket/memory migration.

9) Provide better user interfaces to the hotplug functionalities.

The new hotplug framework includes four logical components.

The first is an ACPI hotplug slot enumerator, which enumerates ACPI hotplug
slots on load and provides callbacks to manage those hotplug slots. An ACPI
hotplug slot is an abstraction of receptacles, where a group of system
devices could be connected to.

The second is a device class for ACPI hotplug slots, named
All ACPI hotplug slot devices will be associated with acpihp_slot_class.

The third is a platform independent class driver for ACPI hotplug slots,
which registers itself onto acpihp_slot_class and manages all ACPI hotplug
slots in system. This hotplug driver handles ACPI hotplug events, processes
user requests and manages slot state machine accoring to user requests.

The fourth is a series of ACPI device drivers, for CPU, memory, PCI host
bridge, IOAPIC and ACPI CONTAINER. These ACPI device drivers provide device
specific callbacks for the hotplug driver to add/remove system devices at

This patch set implements the first and second parts, which enumerates
hotplug slots and creates sysfs entries for each slot as below.

linux-drf:/sys/devices/LNXSYSTM:00/acpihp # ll
drwxr-xr-x 4 root root 0 Jul 28 16:00 NODE00
drwxr-xr-x 3 root root 0 Jul 28 16:00 NODE01
drwxr-xr-x 3 root root 0 Jul 28 16:00 NODE02

linux-drf:/sys/devices/LNXSYSTM:00/acpihp/NODE00 # ll
drwxr-xr-x 3 root root     0 Jul 28 16:00 IOX01
-r--r--r-- 1 root root 65536 Jul 28 16:01 capabilities
lrwxrwxrwx 1 root root     0 Jul 28 16:00 device -> ../../../LNXSYSTM:00
-r--r--r-- 1 root root 65536 Jul 28 16:01 object
drwxr-xr-x 2 root root     0 Jul 28 16:01 power
-r--r--r-- 1 root root 65536 Jul 28 16:01 state
-r--r--r-- 1 root root 65536 Jul 28 16:01 status
lrwxrwxrwx 1 root root     0 Jul 28 16:00 subsystem ->
-r--r--r-- 1 root root 65536 Jul 28 16:01 type
-rw-r--r-- 1 root root 65536 Jul 28 16:01 uevent

linux-drf:/sys/bus/acpi/acpihp # ls

linux-drf:/sys/bus/acpi/acpihp # ll
lrwxrwxrwx 1 root root 0 Jul 28 16:03 NODE00 ->
lrwxrwxrwx 1 root root 0 Jul 28 16:03 NODE00.IOX01 ->
lrwxrwxrwx 1 root root 0 Jul 28 16:03 NODE01 ->
lrwxrwxrwx 1 root root 0 Jul 28 16:03 NODE02 ->

Jiang Liu (3):
  ACPIHP: introduce a framework for ACPI based system device hotplug
  ACPIHP: ACPI system device hotplug slot enumerator
  ACPIHP: detect ACPI hotplug slots by checking ACPI _EJ0 method

 drivers/acpi/Kconfig                 |   33 ++
 drivers/acpi/Makefile                |    2 +
 drivers/acpi/hotplug/Makefile        |   10 +
 drivers/acpi/hotplug/core.c          |  590
 drivers/acpi/hotplug/slot_enum.c     |  469 +++++++++++++++++++++++++++
 drivers/acpi/hotplug/slot_enum_ej0.c |  113 +++++++
 include/acpi/acpi_hotplug.h          |  191 +++++++++++
 7 files changed, 1408 insertions(+)
 create mode 100644 drivers/acpi/hotplug/Makefile
 create mode 100644 drivers/acpi/hotplug/core.c
 create mode 100644 drivers/acpi/hotplug/slot_enum.c
 create mode 100644 drivers/acpi/hotplug/slot_enum_ej0.c
 create mode 100644 include/acpi/acpi_hotplug.h

CD: 3ms