This is a note to let you know that I've just added the patch titled PM: base: power: don't try to use non-existing RTC for storing data to the 5.14-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: pm-base-power-don-t-try-to-use-non-existing-rtc-for-storing-data.patch and it can be found in the queue-5.14 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 0560204b360a332c321124dbc5cdfd3364533a74 Mon Sep 17 00:00:00 2001 From: Juergen Gross <jgross@xxxxxxxx> Date: Fri, 3 Sep 2021 10:49:36 +0200 Subject: PM: base: power: don't try to use non-existing RTC for storing data From: Juergen Gross <jgross@xxxxxxxx> commit 0560204b360a332c321124dbc5cdfd3364533a74 upstream. If there is no legacy RTC device, don't try to use it for storing trace data across suspend/resume. Cc: <stable@xxxxxxxxxxxxxxx> Signed-off-by: Juergen Gross <jgross@xxxxxxxx> Reviewed-by: Rafael J. Wysocki <rafael@xxxxxxxxxx> Link: https://lore.kernel.org/r/20210903084937.19392-2-jgross@xxxxxxxx Signed-off-by: Juergen Gross <jgross@xxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/base/power/trace.c | 10 ++++++++++ 1 file changed, 10 insertions(+) --- a/drivers/base/power/trace.c +++ b/drivers/base/power/trace.c @@ -13,6 +13,7 @@ #include <linux/export.h> #include <linux/rtc.h> #include <linux/suspend.h> +#include <linux/init.h> #include <linux/mc146818rtc.h> @@ -165,6 +166,9 @@ void generate_pm_trace(const void *trace const char *file = *(const char **)(tracedata + 2); unsigned int user_hash_value, file_hash_value; + if (!x86_platform.legacy.rtc) + return; + user_hash_value = user % USERHASH; file_hash_value = hash_string(lineno, file, FILEHASH); set_magic_time(user_hash_value, file_hash_value, dev_hash_value); @@ -267,6 +271,9 @@ static struct notifier_block pm_trace_nb static int __init early_resume_init(void) { + if (!x86_platform.legacy.rtc) + return 0; + hash_value_early_read = read_magic_time(); register_pm_notifier(&pm_trace_nb); return 0; @@ -277,6 +284,9 @@ static int __init late_resume_init(void) unsigned int val = hash_value_early_read; unsigned int user, file, dev; + if (!x86_platform.legacy.rtc) + return 0; + user = val % USERHASH; val = val / USERHASH; file = val % FILEHASH; Patches currently in stable-queue which might be from jgross@xxxxxxxx are queue-5.14/pm-base-power-don-t-try-to-use-non-existing-rtc-for-storing-data.patch queue-5.14/swiotlb-xen-fix-late-init-retry.patch queue-5.14/swiotlb-xen-avoid-double-free.patch queue-5.14/xen-fix-usage-of-pmd_populate-in-mremap-for-pv-guests.patch queue-5.14/xen-reset-legacy-rtc-flag-for-pv-domu.patch