From 5487bff69b85ca9bde7884655e2e45997d947acb Mon Sep 17 00:00:00 2001 From: Suzuki K Poulose Date: Fri, 2 Oct 2026 07:15:03 +0100 Subject: PM: hibernate: Add an arch hook for preventing hibernation Add a hook to allow arch code disable hibernation. On arm64, with an RMM active, there could be pages that are delegated to the "Realm" security state. Any access to them are fatal (e.g., hibernate save image or restoring an image to a delegated page). pKVM host also has its restrictions on enabling hibernation. Add a weak arch hook to let the architectures have a say. Cc: "Rafael J. Wysocki" Cc: Len Brown Cc: Pavel Machek Cc: linux-pm@vger.kernel.org Cc: Sudeep Holla Suggested-by: Catalin Marinas Signed-off-by: Suzuki K Poulose Reviewed-by: Catalin Marinas Reviewed-by: Sudeep Holla Signed-off-by: Catalin Marinas --- kernel/power/hibernate.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'kernel') diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c index d2479c69d71a..9d9d53828542 100644 --- a/kernel/power/hibernate.c +++ b/kernel/power/hibernate.c @@ -106,11 +106,17 @@ bool hibernation_in_progress(void) return !atomic_read(&hibernate_atomic); } +__weak bool arch_hibernation_available(void) +{ + return true; +} + bool hibernation_available(void) { return nohibernate == 0 && !security_locked_down(LOCKDOWN_HIBERNATION) && - !secretmem_active() && !cxl_mem_active(); + !secretmem_active() && !cxl_mem_active() && + arch_hibernation_available(); } /** -- cgit v1.2.3