Skip to contentSkip to conversation

ACPI: Support for platform initiated graceful shutdown

PATCH Superseded Prashanth Prakash 3 participants 11 messages Mar 16, 2016 – May 11, 2016

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover ACPI: Support for platform initiated graceful shutdown

This patch-set adds support for platform initited graceful shutdown as described in the sections 5.6.6(Table-143) and 6.3.5.1 of ACPI 6.1 spec

Jonathan (Zhixiong) Zhang (1):
ACPI: move ACPI_SYSTEM_HID to acpi_drivers.h

Prashanth Prakash (2):
ACPI / sybus: add a driver for LNXSYBUS device
ACPI: update the definition of common notification values

 drivers/acpi/Kconfig        |   6 +++
 drivers/acpi/Makefile       |   1 +
 drivers/acpi/scan.c         |   3 +-
 drivers/acpi/sybus.c        | 116 ++++++++++++++++++++++++++++++++++++++++++++
 include/acpi/acpi_drivers.h |   1 +
 include/acpi/actypes.h      |   2 +-
 6 files changed, 127 insertions(+), 2 deletions(-)
 create mode 100644 drivers/acpi/sybus.c
Signature · 3 lines
Qualcomm Technologies, Inc. on behalf
of the Qualcomm Innovation Center, Inc.  The Qualcomm Innovation Center, Inc. 
is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.
#1 lore raw

PATCH 1/3 ACPI: move ACPI_SYSTEM_HID to acpi_drivers.h

From: "Jonathan (Zhixiong) Zhang" <[email protected]>

ACPI_SYSTEM_HID is defined in drivers/acpi/bus.c out-of-band.

Move the definition to include/acpi/acpi_drivers.h, together with other Linux specific HIDs, so that it can be used by other code.

---
 drivers/acpi/scan.c         | 3 ++-
 include/acpi/acpi_drivers.h | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/acpi/scan.c +2 -1
index 407a376..358e3c8 100644
@@ -13,6 +13,8 @@
 #include <linux/nls.h>
 #include <linux/dma-mapping.h>
 
+#include <acpi/acpi_drivers.h>
+
 #include <asm/pgtable.h>
 
 #include "internal.h"
@@ -22,7 +24,6 @@ ACPI_MODULE_NAME("scan");
 extern struct acpi_device *acpi_root;
 
 #define ACPI_BUS_CLASS			"system_bus"
-#define ACPI_BUS_HID			"LNXSYBUS"
 #define ACPI_BUS_DEVICE_NAME		"System Bus"
 
 #define ACPI_IS_ROOT_DEVICE(device)    (!(device)->parent)
include/acpi/acpi_drivers.h +1 -0
index 29c6912..3638f6f 100644
@@ -52,6 +52,7 @@
 #define ACPI_POWER_HID			"LNXPOWER"
 #define ACPI_PROCESSOR_OBJECT_HID	"LNXCPU"
 #define ACPI_SYSTEM_HID			"LNXSYSTM"
+#define ACPI_BUS_HID			"LNXSYBUS"
 #define ACPI_THERMAL_HID		"LNXTHERM"
 #define ACPI_BUTTON_HID_POWERF		"LNXPWRBN"
 #define ACPI_BUTTON_HID_SLEEPF		"LNXSLPBN"
Signature · 3 lines
Qualcomm Technologies, Inc. on behalf
of the Qualcomm Innovation Center, Inc.  The Qualcomm Innovation Center, Inc. 
is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.
#2 lore raw

Re: [PATCH 1/3] ACPI: move ACPI_SYSTEM_HID to acpi_drivers.h

Quoted 28 lines · Prashanth Prakash

From: "Jonathan (Zhixiong) Zhang" <[email protected]>

ACPI_SYSTEM_HID is defined in drivers/acpi/bus.c out-of-band.

Move the definition to include/acpi/acpi_drivers.h, together with other Linux specific HIDs, so that it can be used by other code.

---
 drivers/acpi/scan.c         | 3 ++-
 include/acpi/acpi_drivers.h | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/acpi/scan.c +2 -0
index 407a376..358e3c8 100644
@@ -13,6 +13,8 @@
 #include <linux/nls.h>
 #include <linux/dma-mapping.h>
 
+#include <acpi/acpi_drivers.h>
+
 #include <asm/pgtable.h>
 
 #include "internal.h"

drivers/acpi/scan.c ACPI_MODULE_NAME("scan"); · line 25

Quoted 4 lines
drivers/acpi/scan.c +0 -1
@@ -22,7 +24,6 @@ ACPI_MODULE_NAME("scan");
 extern struct acpi_device *acpi_root;
 
 #define ACPI_BUS_CLASS                 "system_bus"
-#define ACPI_BUS_HID                   "LNXSYBUS"

No.

This is not a valid device ID and should never be used as such.

Thanks,
Rafael

#3 lore raw

Re: [PATCH 1/3] ACPI: move ACPI_SYSTEM_HID to acpi_drivers.h

Hi Rafael,

Quoted 9 lines · Rafael J. Wysocki

#include "internal.h"

drivers/acpi/scan.c +0 -1
@@ -22,7 +24,6 @@ ACPI_MODULE_NAME("scan");
 extern struct acpi_device *acpi_root;
 
 #define ACPI_BUS_CLASS                 "system_bus"
-#define ACPI_BUS_HID                   "LNXSYBUS"

No.

This is not a valid device ID and should never be used as such.

Section 5.6.6 in ACPI 6.1 is defining the notification value for the graceful shutdown request as a ACPI device specific value(0x81) and it is targeting the system bus(\_SB), so we took the current approach of creating a sybus driver to handle the notifications targeting the system bus.

Let me go through the code again and see if we can avoid using the ACPI_BUS_HID. In the meantime, if you have any specific thoughts on how this should be handled, please let us know.

Thanks,
Prashanth

#4 lore raw

Re: [PATCH 1/3] ACPI: move ACPI_SYSTEM_HID to acpi_drivers.h

Quoted 11 lines · Prashanth

Hi Rafael,

Quoted 8 lines · Rafael J. Wysocki

#include "internal.h"

drivers/acpi/scan.c +0 -1
@@ -22,7 +24,6 @@ ACPI_MODULE_NAME("scan");
 extern struct acpi_device *acpi_root;
 
 #define ACPI_BUS_CLASS                 "system_bus"
-#define ACPI_BUS_HID                   "LNXSYBUS"

No.

Quoted 8 lines
Quoted 1 line

This is not a valid device ID and should never be used as such.

Section 5.6.6 in ACPI 6.1 is defining the notification value for the graceful shutdown request as a ACPI device specific value(0x81) and it is targeting the system bus(\_SB), so we took the current approach of creating a sybus driver to handle the notifications targeting the system bus.

Let me go through the code again and see if we can avoid using the ACPI_BUS_HID.

You can.

Quoted 2 lines

In the meantime, if you have any specific thoughts on how this should be handled, please let us know.

Your goal is relatively simple. You want to register a notify handler for the \_SB object. You don't need a driver for that, because the \_SB object is always present, so you don't need to enumerate it or wait for it to show up etc.

I'd just scan the namespace 1 level below the root and install the handler for the object with the matching name (not a fake device ID).

Thanks,
Rafael

#5 lore raw

Re: [PATCH 1/3] ACPI: move ACPI_SYSTEM_HID to acpi_drivers.h

Than

Quoted 25 lines · Rafael J. Wysocki
Quoted 11 lines · Prashanth

Hi Rafael,

Quoted 8 lines · Rafael J. Wysocki

#include "internal.h"

drivers/acpi/scan.c +0 -1
@@ -22,7 +24,6 @@ ACPI_MODULE_NAME("scan");
 extern struct acpi_device *acpi_root;
 
 #define ACPI_BUS_CLASS                 "system_bus"
-#define ACPI_BUS_HID                   "LNXSYBUS"

No.

Quoted 8 lines
Quoted 1 line

This is not a valid device ID and should never be used as such.

Section 5.6.6 in ACPI 6.1 is defining the notification value for the graceful shutdown request as a ACPI device specific value(0x81) and it is targeting the system bus(\_SB), so we took the current approach of creating a sybus driver to handle the notifications targeting the system bus.

Let me go through the code again and see if we can avoid using the ACPI_BUS_HID.

You can.

Quoted 2 lines

In the meantime, if you have any specific thoughts on how this should be handled, please let us know.

Quoted 7 lines

Your goal is relatively simple. You want to register a notify handler for the \_SB object. You don't need a driver for that, because the \_SB object is always present, so you don't need to enumerate it or wait for it to show up etc.

I'd just scan the namespace 1 level below the root and install the handler for the object with the matching name (not a fake device ID).

Thanks Rafael! I will update the patch using the above approach.

-Prashanth

Quoted 4 lines

Thanks,
Rafael

#6 lore raw

PATCH 2/3 ACPI / sybus: add a driver for LNXSYBUS device

In reply to Prashanth Prakash

This patch adds a bus driver to handle the graceful shutdown requests as described in the section 6.3.5.1, section 5.6.6 and table 5-143 of ACPI spec 6.1

The OSPM will get a graceful shutdown request via a Notify operator on \_SB device with a value of 0x81 per section 5.6.6. Following the shutdown request from platform the OSPM needs to follow the processing sequence described in section 6.2.5.1 - "Processing Sequence for Graceful Shutdown Request"

---
 drivers/acpi/Kconfig  |   6 +++
 drivers/acpi/Makefile |   1 +
 drivers/acpi/sybus.c  | 116 ++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 123 insertions(+)
 create mode 100644 drivers/acpi/sybus.c
drivers/acpi/Kconfig +6 -0
index 82b96ee..78cf770 100644
@@ -209,6 +209,12 @@ config ACPI_DOCK
 	  This driver supports ACPI-controlled docking stations and removable
 	  drive bays such as the IBM Ultrabay and the Dell Module Bay.
 
+config ACPI_SYBUS
+	bool "System Bus"
+	help
+	  This driver handles the events on system bus which includes
+	  support for a graceful shutdown request from the platform.
+
 config ACPI_CPU_FREQ_PSS
 	bool
 	select THERMAL
drivers/acpi/Makefile +1 -0
index cb648a4..fe56427 100644
@@ -80,6 +80,7 @@ obj-$(CONFIG_ACPI_CUSTOM_METHOD)+= custom_method.o
 obj-$(CONFIG_ACPI_BGRT)		+= bgrt.o
 obj-$(CONFIG_ACPI_CPPC_LIB)	+= cppc_acpi.o
 obj-$(CONFIG_ACPI_DEBUGGER_USER) += acpi_dbg.o
+obj-$(CONFIG_ACPI_SYBUS)	+= sybus.o
 
 # processor has its own "processor." module_param namespace
 processor-y			:= processor_driver.o
drivers/acpi/sybus.c new file +116 -0

116 lines not on this page · raw message

Signature · 3 lines
Qualcomm Technologies, Inc. on behalf
of the Qualcomm Innovation Center, Inc.  The Qualcomm Innovation Center, Inc. 
is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.
#7 lore raw

PATCH 3/3 ACPI: update the definition of common notification values

In reply to Prashanth Prakash

Per ACPI spec 6.1, the device object notification value of 0x0C is now reserved, so updating the definition to reflect the same.

---
 include/acpi/actypes.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/acpi/actypes.h +1 -1
index db46546..4553300 100644
@@ -627,7 +627,7 @@ typedef u64 acpi_integer;
 #define ACPI_NOTIFY_DEVICE_PLD_CHECK    (u8) 0x09
 #define ACPI_NOTIFY_RESERVED            (u8) 0x0A
 #define ACPI_NOTIFY_LOCALITY_UPDATE     (u8) 0x0B
-#define ACPI_NOTIFY_SHUTDOWN_REQUEST    (u8) 0x0C
+#define ACPI_NOTIFY_RESERVED_2          (u8) 0x0C
 #define ACPI_NOTIFY_AFFINITY_UPDATE     (u8) 0x0D
 
 #define ACPI_NOTIFY_MAX                 0x0D
Signature · 3 lines
Qualcomm Technologies, Inc. on behalf
of the Qualcomm Innovation Center, Inc.  The Qualcomm Innovation Center, Inc. 
is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.
#8 lore raw
In reply to Prashanth Prakash
Quoted 10 lines · Prashanth Prakash

This patch-set adds support for platform initited graceful shutdown as described in the sections 5.6.6(Table-143) and 6.3.5.1 of ACPI 6.1 spec

Jonathan (Zhixiong) Zhang (1):
ACPI: move ACPI_SYSTEM_HID to acpi_drivers.h

Prashanth Prakash (2):
ACPI / sybus: add a driver for LNXSYBUS device
ACPI: update the definition of common notification values

Quoted 9 lines
 drivers/acpi/Kconfig        |   6 +++
 drivers/acpi/Makefile       |   1 +
 drivers/acpi/scan.c         |   3 +-
 drivers/acpi/sybus.c        | 116 ++++++++++++++++++++++++++++++++++++++++++++
 include/acpi/acpi_drivers.h |   1 +
 include/acpi/actypes.h      |   2 +-
 6 files changed, 127 insertions(+), 2 deletions(-)
 create mode 100644 drivers/acpi/sybus.c

Is v2 coming along soon? I'd like to try these out on a couple of systems. Thanks, Prashanth.

Signature · 8 lines
ciao,
al
-----------------------------------
Al Stone
Software Engineer
Red Hat, Inc.
[email protected]
-----------------------------------
#9 lore raw

Hi Al,

I should have v2 sometime next week.

Sorry about the delay. Vacation and couple of other issues kept me little busy and couldn't update this patch set in a timely manner.

Thanks,
Prashanth

Quoted 23 lines · Al Stone
Quoted 10 lines · Prashanth Prakash

This patch-set adds support for platform initited graceful shutdown as described in the sections 5.6.6(Table-143) and 6.3.5.1 of ACPI 6.1 spec

Jonathan (Zhixiong) Zhang (1):
ACPI: move ACPI_SYSTEM_HID to acpi_drivers.h

Prashanth Prakash (2):
ACPI / sybus: add a driver for LNXSYBUS device
ACPI: update the definition of common notification values

Quoted 9 lines
 drivers/acpi/Kconfig        |   6 +++
 drivers/acpi/Makefile       |   1 +
 drivers/acpi/scan.c         |   3 +-
 drivers/acpi/sybus.c        | 116 ++++++++++++++++++++++++++++++++++++++++++++
 include/acpi/acpi_drivers.h |   1 +
 include/acpi/actypes.h      |   2 +-
 6 files changed, 127 insertions(+), 2 deletions(-)
 create mode 100644 drivers/acpi/sybus.c

Is v2 coming along soon? I'd like to try these out on a couple of systems. Thanks, Prashanth.

#10 lore raw
Quoted 8 lines · Prashanth

Hi Al,

I should have v2 sometime next week.

Sorry about the delay. Vacation and couple of other issues kept me little busy and couldn't update this patch set in a timely manner.

Thanks,
Prashanth

No worries, Prashanth. Just curiosity, on my part. Thanks for posting these.

Quoted 25 lines · Al Stone
Quoted 23 lines · Prashanth Prakash
Quoted 10 lines

This patch-set adds support for platform initited graceful shutdown as described in the sections 5.6.6(Table-143) and 6.3.5.1 of ACPI 6.1 spec

Jonathan (Zhixiong) Zhang (1):
ACPI: move ACPI_SYSTEM_HID to acpi_drivers.h

Prashanth Prakash (2):
ACPI / sybus: add a driver for LNXSYBUS device
ACPI: update the definition of common notification values

Quoted 9 lines
 drivers/acpi/Kconfig        |   6 +++
 drivers/acpi/Makefile       |   1 +
 drivers/acpi/scan.c         |   3 +-
 drivers/acpi/sybus.c        | 116 ++++++++++++++++++++++++++++++++++++++++++++
 include/acpi/acpi_drivers.h |   1 +
 include/acpi/actypes.h      |   2 +-
 6 files changed, 127 insertions(+), 2 deletions(-)
 create mode 100644 drivers/acpi/sybus.c

Is v2 coming along soon? I'd like to try these out on a couple of systems. Thanks, Prashanth.

Signature · 8 lines
ciao,
al
-----------------------------------
Al Stone
Software Engineer
Red Hat, Inc.
[email protected]
-----------------------------------