acpica-devel.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] Support clean reboot after hibernate on Arm64
@ 2024-03-11 12:19 David Woodhouse
  2024-03-11 12:19 ` [PATCH v2 1/2] ACPICA: Detect FACS even for hardware reduced platforms David Woodhouse
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: David Woodhouse @ 2024-03-11 12:19 UTC (permalink / raw)
  To: Catalin Marinas, Will Deacon
  Cc: Robert Moore, Rafael J. Wysocki, Len Brown, Sudeep Holla,
	linux-arm-kernel, linux-kernel, linux-acpi, acpica-devel

When the hardware signature in the ACPI FACS changes, the OS is supposed
to perform a clean reboot instead of attempting to resume on a changed
platform.

Although these patches have a functional dependency, they could be merged
separately. The second patch just won't *see* a FACS table if the ACPICA
fix isn't present.

v2: Now that the ACPICA patch is merged upstream, note its commit ID

David Woodhouse (2):
      ACPICA: Detect FACS even for hardware reduced platforms
      arm64: acpi: Honour firmware_signature field of FACS, if it exists

 arch/arm64/kernel/acpi.c      | 10 ++++++++++
 drivers/acpi/acpica/tbfadt.c  | 30 +++++++++++++-----------------
 drivers/acpi/acpica/tbutils.c |  7 +------
 3 files changed, 24 insertions(+), 23 deletions(-)

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2 1/2] ACPICA: Detect FACS even for hardware reduced platforms
  2024-03-11 12:19 [PATCH v2 0/2] Support clean reboot after hibernate on Arm64 David Woodhouse
@ 2024-03-11 12:19 ` David Woodhouse
  2024-03-11 13:04 ` [PATCH v2 2/2] arm64: acpi: Honour firmware_signature field of FACS, if it exists David Woodhouse
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: David Woodhouse @ 2024-03-11 12:19 UTC (permalink / raw)
  To: Catalin Marinas, Will Deacon
  Cc: Robert Moore, Rafael J. Wysocki, Len Brown, Sudeep Holla,
	linux-arm-kernel, linux-kernel, linux-acpi, acpica-devel

From: David Woodhouse <dwmw@amazon.co.uk>

ACPICA commit 44fc328a1a14b097d92b8be83989e4bf69b6e6cb

The FACS is optional even on hardware reduced platforms, and may exist
for the purpose of communicating the hardware_signature field to provoke
a clean reboot instead of a resume from hibernation.

Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
---
 drivers/acpi/acpica/tbfadt.c  | 30 +++++++++++++-----------------
 drivers/acpi/acpica/tbutils.c |  7 +------
 2 files changed, 14 insertions(+), 23 deletions(-)

diff --git a/drivers/acpi/acpica/tbfadt.c b/drivers/acpi/acpica/tbfadt.c
index 44267a92bce5..3c126c6d306b 100644
--- a/drivers/acpi/acpica/tbfadt.c
+++ b/drivers/acpi/acpica/tbfadt.c
@@ -315,23 +315,19 @@ void acpi_tb_parse_fadt(void)
 				       ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL,
 				       NULL, FALSE, TRUE, &acpi_gbl_dsdt_index);
 
-	/* If Hardware Reduced flag is set, there is no FACS */
-
-	if (!acpi_gbl_reduced_hardware) {
-		if (acpi_gbl_FADT.facs) {
-			acpi_tb_install_standard_table((acpi_physical_address)
-						       acpi_gbl_FADT.facs,
-						       ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL,
-						       NULL, FALSE, TRUE,
-						       &acpi_gbl_facs_index);
-		}
-		if (acpi_gbl_FADT.Xfacs) {
-			acpi_tb_install_standard_table((acpi_physical_address)
-						       acpi_gbl_FADT.Xfacs,
-						       ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL,
-						       NULL, FALSE, TRUE,
-						       &acpi_gbl_xfacs_index);
-		}
+	if (acpi_gbl_FADT.facs) {
+		acpi_tb_install_standard_table((acpi_physical_address)
+					       acpi_gbl_FADT.facs,
+					       ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL,
+					       NULL, FALSE, TRUE,
+					       &acpi_gbl_facs_index);
+	}
+	if (acpi_gbl_FADT.Xfacs) {
+		acpi_tb_install_standard_table((acpi_physical_address)
+					       acpi_gbl_FADT.Xfacs,
+					       ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL,
+					       NULL, FALSE, TRUE,
+					       &acpi_gbl_xfacs_index);
 	}
 }
 
diff --git a/drivers/acpi/acpica/tbutils.c b/drivers/acpi/acpica/tbutils.c
index bb4a56e5673a..15fa68a5ea6e 100644
--- a/drivers/acpi/acpica/tbutils.c
+++ b/drivers/acpi/acpica/tbutils.c
@@ -36,12 +36,7 @@ acpi_status acpi_tb_initialize_facs(void)
 {
 	struct acpi_table_facs *facs;
 
-	/* If Hardware Reduced flag is set, there is no FACS */
-
-	if (acpi_gbl_reduced_hardware) {
-		acpi_gbl_FACS = NULL;
-		return (AE_OK);
-	} else if (acpi_gbl_FADT.Xfacs &&
+	if (acpi_gbl_FADT.Xfacs &&
 		   (!acpi_gbl_FADT.facs
 		    || !acpi_gbl_use32_bit_facs_addresses)) {
 		(void)acpi_get_table_by_index(acpi_gbl_xfacs_index,
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2 2/2] arm64: acpi: Honour firmware_signature field of FACS, if it exists
  2024-03-11 12:19 [PATCH v2 0/2] Support clean reboot after hibernate on Arm64 David Woodhouse
  2024-03-11 12:19 ` [PATCH v2 1/2] ACPICA: Detect FACS even for hardware reduced platforms David Woodhouse
@ 2024-03-11 13:04 ` David Woodhouse
  2024-04-12 14:05 ` [PATCH v2 0/2] Support clean reboot after hibernate on Arm64 Will Deacon
  2024-04-19 15:32 ` Will Deacon
  3 siblings, 0 replies; 8+ messages in thread
From: David Woodhouse @ 2024-03-11 13:04 UTC (permalink / raw)
  To: Catalin Marinas, Will Deacon
  Cc: Robert Moore, Rafael J. Wysocki, Len Brown, Sudeep Holla,
	linux-arm-kernel, linux-kernel, linux-acpi, acpica-devel

From: David Woodhouse <dwmw@amazon.co.uk>

If the firmware_signature changes then OSPM should not attempt to resume
from hibernate, but should instead perform a clean reboot. Set the global
swsusp_hardware_signature to allow the generic code to include the value
in the swsusp header on disk, and perform the appropriate check on resume.

Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
Acked-by: Sudeep Holla <sudeep.holla@arm.com>
---
 arch/arm64/kernel/acpi.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c
index dba8fcec7f33..e0e7b93c16cc 100644
--- a/arch/arm64/kernel/acpi.c
+++ b/arch/arm64/kernel/acpi.c
@@ -26,6 +26,7 @@
 #include <linux/libfdt.h>
 #include <linux/smp.h>
 #include <linux/serial_core.h>
+#include <linux/suspend.h>
 #include <linux/pgtable.h>
 
 #include <acpi/ghes.h>
@@ -227,6 +228,15 @@ void __init acpi_boot_table_init(void)
 		if (earlycon_acpi_spcr_enable)
 			early_init_dt_scan_chosen_stdout();
 	} else {
+#ifdef CONFIG_HIBERNATION
+		struct acpi_table_header *facs = NULL;
+		acpi_get_table(ACPI_SIG_FACS, 1, &facs);
+		if (facs) {
+			swsusp_hardware_signature =
+				((struct acpi_table_facs *)facs)->hardware_signature;
+			acpi_put_table(facs);
+		}
+#endif
 		acpi_parse_spcr(earlycon_acpi_spcr_enable, true);
 		if (IS_ENABLED(CONFIG_ACPI_BGRT))
 			acpi_table_parse(ACPI_SIG_BGRT, acpi_parse_bgrt);
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 0/2] Support clean reboot after hibernate on Arm64
  2024-03-11 12:19 [PATCH v2 0/2] Support clean reboot after hibernate on Arm64 David Woodhouse
  2024-03-11 12:19 ` [PATCH v2 1/2] ACPICA: Detect FACS even for hardware reduced platforms David Woodhouse
  2024-03-11 13:04 ` [PATCH v2 2/2] arm64: acpi: Honour firmware_signature field of FACS, if it exists David Woodhouse
@ 2024-04-12 14:05 ` Will Deacon
  2024-04-12 14:18   ` David Woodhouse
  2024-04-19 15:32 ` Will Deacon
  3 siblings, 1 reply; 8+ messages in thread
From: Will Deacon @ 2024-04-12 14:05 UTC (permalink / raw)
  To: David Woodhouse
  Cc: Catalin Marinas, Robert Moore, Rafael J. Wysocki, Len Brown,
	Sudeep Holla, linux-arm-kernel, linux-kernel, linux-acpi,
	acpica-devel

On Mon, Mar 11, 2024 at 12:19:14PM +0000, David Woodhouse wrote:
> When the hardware signature in the ACPI FACS changes, the OS is supposed
> to perform a clean reboot instead of attempting to resume on a changed
> platform.
> 
> Although these patches have a functional dependency, they could be merged
> separately. The second patch just won't *see* a FACS table if the ACPICA
> fix isn't present.
> 
> v2: Now that the ACPICA patch is merged upstream, note its commit ID
> 
> David Woodhouse (2):
>       ACPICA: Detect FACS even for hardware reduced platforms
>       arm64: acpi: Honour firmware_signature field of FACS, if it exists
> 
>  arch/arm64/kernel/acpi.c      | 10 ++++++++++
>  drivers/acpi/acpica/tbfadt.c  | 30 +++++++++++++-----------------
>  drivers/acpi/acpica/tbutils.c |  7 +------

Rafael, how would you like the handle this series? The arm64 part has
been Acked-by Sudeep, so I'm happy with it.

Will

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 0/2] Support clean reboot after hibernate on Arm64
  2024-04-12 14:05 ` [PATCH v2 0/2] Support clean reboot after hibernate on Arm64 Will Deacon
@ 2024-04-12 14:18   ` David Woodhouse
  2024-04-12 19:25     ` Wysocki, Rafael J
  0 siblings, 1 reply; 8+ messages in thread
From: David Woodhouse @ 2024-04-12 14:18 UTC (permalink / raw)
  To: Will Deacon
  Cc: Catalin Marinas, Robert Moore, Rafael J. Wysocki, Len Brown,
	Sudeep Holla, linux-arm-kernel, linux-kernel, linux-acpi,
	acpica-devel

[-- Attachment #1: Type: text/plain, Size: 1431 bytes --]

On Fri, 2024-04-12 at 15:05 +0100, Will Deacon wrote:
> On Mon, Mar 11, 2024 at 12:19:14PM +0000, David Woodhouse wrote:
> > When the hardware signature in the ACPI FACS changes, the OS is supposed
> > to perform a clean reboot instead of attempting to resume on a changed
> > platform.
> > 
> > Although these patches have a functional dependency, they could be merged
> > separately. The second patch just won't *see* a FACS table if the ACPICA
> > fix isn't present.
> > 
> > v2: Now that the ACPICA patch is merged upstream, note its commit ID
> > 
> > David Woodhouse (2):
> >       ACPICA: Detect FACS even for hardware reduced platforms
> >       arm64: acpi: Honour firmware_signature field of FACS, if it exists
> > 
> >  arch/arm64/kernel/acpi.c      | 10 ++++++++++
> >  drivers/acpi/acpica/tbfadt.c  | 30 +++++++++++++-----------------
> >  drivers/acpi/acpica/tbutils.c |  7 +------
> 
> Rafael, how would you like the handle this series? The arm64 part has
> been Acked-by Sudeep, so I'm happy with it.

Thanks, Will.

Similar question for Rafael on the guest side of the PSCI SYSTEM_OFF2
series, in particular
https://lore.kernel.org/kvm/20240319130957.1050637-6-dwmw2@infradead.org/#Z31kernel:power:hibernate.c
which sets the entering_platform_hibernation flag around the call to
the standard kernel_power_off() function when invoking it for
HIBERNATION_SHUTDOWN.

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5965 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 0/2] Support clean reboot after hibernate on Arm64
  2024-04-12 14:18   ` David Woodhouse
@ 2024-04-12 19:25     ` Wysocki, Rafael J
  0 siblings, 0 replies; 8+ messages in thread
From: Wysocki, Rafael J @ 2024-04-12 19:25 UTC (permalink / raw)
  To: David Woodhouse, Will Deacon
  Cc: Catalin Marinas, Robert Moore, Len Brown, Sudeep Holla,
	linux-arm-kernel, linux-kernel, linux-acpi, acpica-devel,
	Rafael J. Wysocki

On 4/12/2024 4:18 PM, David Woodhouse wrote:
> On Fri, 2024-04-12 at 15:05 +0100, Will Deacon wrote:
>> On Mon, Mar 11, 2024 at 12:19:14PM +0000, David Woodhouse wrote:
>>> When the hardware signature in the ACPI FACS changes, the OS is supposed
>>> to perform a clean reboot instead of attempting to resume on a changed
>>> platform.
>>>
>>> Although these patches have a functional dependency, they could be merged
>>> separately. The second patch just won't *see* a FACS table if the ACPICA
>>> fix isn't present.
>>>
>>> v2: Now that the ACPICA patch is merged upstream, note its commit ID
>>>
>>> David Woodhouse (2):
>>>        ACPICA: Detect FACS even for hardware reduced platforms
>>>        arm64: acpi: Honour firmware_signature field of FACS, if it exists
>>>
>>>   arch/arm64/kernel/acpi.c      | 10 ++++++++++
>>>   drivers/acpi/acpica/tbfadt.c  | 30 +++++++++++++-----------------
>>>   drivers/acpi/acpica/tbutils.c |  7 +------
>> Rafael, how would you like the handle this series? The arm64 part has
>> been Acked-by Sudeep, so I'm happy with it.
> Thanks, Will.
>
> Similar question for Rafael on the guest side of the PSCI SYSTEM_OFF2
> series, in particular
> https://lore.kernel.org/kvm/20240319130957.1050637-6-dwmw2@infradead.org/#Z31kernel:power:hibernate.c
> which sets the entering_platform_hibernation flag around the call to
> the standard kernel_power_off() function when invoking it for
> HIBERNATION_SHUTDOWN.

In both cases, please feel free to route the patches as it is convenient 
and add

Acked-by: Rafael J. Wysocki <rafael@kernel.org>

to both of them.



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 0/2] Support clean reboot after hibernate on Arm64
  2024-03-11 12:19 [PATCH v2 0/2] Support clean reboot after hibernate on Arm64 David Woodhouse
                   ` (2 preceding siblings ...)
  2024-04-12 14:05 ` [PATCH v2 0/2] Support clean reboot after hibernate on Arm64 Will Deacon
@ 2024-04-19 15:32 ` Will Deacon
  2024-04-19 15:39   ` David Woodhouse
  3 siblings, 1 reply; 8+ messages in thread
From: Will Deacon @ 2024-04-19 15:32 UTC (permalink / raw)
  To: Catalin Marinas, David Woodhouse
  Cc: kernel-team, Will Deacon, Robert Moore, Rafael J. Wysocki,
	Len Brown, Sudeep Holla, linux-arm-kernel, linux-kernel,
	linux-acpi, acpica-devel

On Mon, 11 Mar 2024 12:19:14 +0000, David Woodhouse wrote:
> When the hardware signature in the ACPI FACS changes, the OS is supposed
> to perform a clean reboot instead of attempting to resume on a changed
> platform.
> 
> Although these patches have a functional dependency, they could be merged
> separately. The second patch just won't *see* a FACS table if the ACPICA
> fix isn't present.
> 
> [...]

Applied to arm64 (for-next/acpi), thanks!

[1/2] ACPICA: Detect FACS even for hardware reduced platforms
      https://git.kernel.org/arm64/c/bc5b492ac305
[2/2] arm64: acpi: Honour firmware_signature field of FACS, if it exists
      https://git.kernel.org/arm64/c/fbaad243b536

Cheers,
-- 
Will

https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 0/2] Support clean reboot after hibernate on Arm64
  2024-04-19 15:32 ` Will Deacon
@ 2024-04-19 15:39   ` David Woodhouse
  0 siblings, 0 replies; 8+ messages in thread
From: David Woodhouse @ 2024-04-19 15:39 UTC (permalink / raw)
  To: Will Deacon, Catalin Marinas
  Cc: kernel-team, Robert Moore, Rafael J. Wysocki, Len Brown,
	Sudeep Holla, linux-arm-kernel, linux-kernel, linux-acpi,
	acpica-devel

[-- Attachment #1: Type: text/plain, Size: 1110 bytes --]

On Fri, 2024-04-19 at 16:32 +0100, Will Deacon wrote:
> On Mon, 11 Mar 2024 12:19:14 +0000, David Woodhouse wrote:
> > When the hardware signature in the ACPI FACS changes, the OS is supposed
> > to perform a clean reboot instead of attempting to resume on a changed
> > platform.
> > 
> > Although these patches have a functional dependency, they could be merged
> > separately. The second patch just won't *see* a FACS table if the ACPICA
> > fix isn't present.
> > 
> > [...]
> 
> Applied to arm64 (for-next/acpi), thanks!
> 
> [1/2] ACPICA: Detect FACS even for hardware reduced platforms
>       https://git.kernel.org/arm64/c/bc5b492ac305
> [2/2] arm64: acpi: Honour firmware_signature field of FACS, if it exists
>       https://git.kernel.org/arm64/c/fbaad243b536

Thanks. I've rebased the remaining SYSTEM_OFF2 patches on top of that:
https://git.infradead.org/users/dwmw2/linux.git/shortlog/refs/heads/psci-hibernate

I've added Rafael's Acked-by: to the last commit in that series too.

Will repost them when the final version of the PSCI 1.3 spec is published.


[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5965 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-04-19 15:40 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-11 12:19 [PATCH v2 0/2] Support clean reboot after hibernate on Arm64 David Woodhouse
2024-03-11 12:19 ` [PATCH v2 1/2] ACPICA: Detect FACS even for hardware reduced platforms David Woodhouse
2024-03-11 13:04 ` [PATCH v2 2/2] arm64: acpi: Honour firmware_signature field of FACS, if it exists David Woodhouse
2024-04-12 14:05 ` [PATCH v2 0/2] Support clean reboot after hibernate on Arm64 Will Deacon
2024-04-12 14:18   ` David Woodhouse
2024-04-12 19:25     ` Wysocki, Rafael J
2024-04-19 15:32 ` Will Deacon
2024-04-19 15:39   ` David Woodhouse

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).