[PATCH v22 07/10] kernel: hibernate: Add an arch hook for preventing hiberation
Rafael J. Wysocki (Intel)
rafael at kernel.org
Mon Oct 12 12:11:34 PDT 2026
On Fri, Oct 2, 2026 at 1:03 PM Catalin Marinas <catalin.marinas at arm.com> wrote:
>
> On Fri, Oct 02, 2026 at 07:15:03AM +0100, Suzuki K Poulose wrote:
> > 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" <rafael at kernel.org>
> > Cc: Len Brown <lenb at kernel.org>
> > Cc: Pavel Machek <pavel at kernel.org>
> > Cc: linux-pm at vger.kernel.org
> > Cc: Sudeep Holla <sudeep.holla at kernel.org>
> > Suggested-by: Catalin Marinas <catalin.marinas at arm.com>
> > Signed-off-by: Suzuki K Poulose <suzuki.poulose at arm.com>
>
> Nit: the subject prefix for kernel/power/ usually is
>
> PM: hibernate: ....
>
> I can fix it locally, no need to respin (and probably the wrap the long
> lines in the commit log, we tend to keep them shorter).
>
> > ---
> > include/linux/suspend.h | 1 +
> > kernel/power/hibernate.c | 8 +++++++-
> > 2 files changed, 8 insertions(+), 1 deletion(-)
> >
> > diff --git a/include/linux/suspend.h b/include/linux/suspend.h
> > index b02876f1ae38a..a3815027773c5 100644
> > --- a/include/linux/suspend.h
> > +++ b/include/linux/suspend.h
> > @@ -401,6 +401,7 @@ int hibernate_quiet_exec(int (*func)(void *data), void *data);
> > int hibernate_resume_nonboot_cpu_disable(void);
> > int arch_hibernation_header_save(void *addr, unsigned int max_size);
> > int arch_hibernation_header_restore(void *addr);
> > +bool arch_hibernation_available(void);
> >
> > #else /* CONFIG_HIBERNATION */
> > static inline void register_nosave_region(unsigned long b, unsigned long e) {}
> > diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
> > index d2479c69d71a4..9d9d53828542f 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();
>
> Reviewed-by: Catalin Marinas <catalin.marinas at arm.com>
>
> Raphael, any objection to this patch going in through the arm64 tree? It
> matches the style of other __weak functions in this file.
No objection, and feel free to add an ACK from me to this one.
Thanks!
More information about the linux-arm-kernel
mailing list