From 9f09faa20038ae223bc270961b3963d105925770 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Sat, 6 May 2023 15:30:16 +0900 Subject: [PATCH] 4.19-stable patches added patches: debugfs-regset32-add-runtime-pm-support.patch --- ...ugfs-regset32-add-runtime-pm-support.patch | 68 +++++++++++++++++++ queue-4.19/series | 2 +- 2 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 queue-4.19/debugfs-regset32-add-runtime-pm-support.patch diff --git a/queue-4.19/debugfs-regset32-add-runtime-pm-support.patch b/queue-4.19/debugfs-regset32-add-runtime-pm-support.patch new file mode 100644 index 00000000000..b5556bf64b4 --- /dev/null +++ b/queue-4.19/debugfs-regset32-add-runtime-pm-support.patch @@ -0,0 +1,68 @@ +From 30332eeefec8f83afcea00c360f99ef64b87f220 Mon Sep 17 00:00:00 2001 +From: Geert Uytterhoeven +Date: Tue, 11 Feb 2020 19:18:55 +0100 +Subject: debugfs: regset32: Add Runtime PM support +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Geert Uytterhoeven + +commit 30332eeefec8f83afcea00c360f99ef64b87f220 upstream. + +Hardware registers of devices under control of power management cannot +be accessed at all times. If such a device is suspended, register +accesses may lead to undefined behavior, like reading bogus values, or +causing exceptions or system lock-ups. + +Extend struct debugfs_regset32 with an optional field to let device +drivers specify the device the registers in the set belong to. This +allows debugfs_show_regset32() to make sure the device is resumed while +its registers are being read. + +Signed-off-by: Geert Uytterhoeven +Reviewed-by: Niklas Söderlund +Reviewed-by: Greg Kroah-Hartman +Acked-by: Rafael J. Wysocki +Signed-off-by: Herbert Xu +Signed-off-by: Greg Kroah-Hartman +--- + fs/debugfs/file.c | 8 ++++++++ + include/linux/debugfs.h | 1 + + 2 files changed, 9 insertions(+) + +--- a/fs/debugfs/file.c ++++ b/fs/debugfs/file.c +@@ -18,6 +18,7 @@ + #include + #include + #include ++#include + #include + + #include "internal.h" +@@ -1084,7 +1085,14 @@ static int debugfs_show_regset32(struct + { + struct debugfs_regset32 *regset = s->private; + ++ if (regset->dev) ++ pm_runtime_get_sync(regset->dev); ++ + debugfs_print_regs32(s, regset->regs, regset->nregs, regset->base, ""); ++ ++ if (regset->dev) ++ pm_runtime_put(regset->dev); ++ + return 0; + } + +--- a/include/linux/debugfs.h ++++ b/include/linux/debugfs.h +@@ -35,6 +35,7 @@ struct debugfs_regset32 { + const struct debugfs_reg32 *regs; + int nregs; + void __iomem *base; ++ struct device *dev; /* Optional device for Runtime PM */ + }; + + extern struct dentry *arch_debugfs_dir; diff --git a/queue-4.19/series b/queue-4.19/series index 8df51128bc6..49f7465a077 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -8,9 +8,9 @@ ima-allow-fix-uml-builds.patch usb-dwc3-fix-runtime-pm-imbalance-on-unbind.patch perf-sched-cast-pthread_stack_min-to-int-as-it-may-turn-into-sysconf-__sc_thread_stack_min_value.patch staging-iio-resolver-ads1210-fix-config-mode.patch +debugfs-regset32-add-runtime-pm-support.patch xhci-fix-debugfs-register-accesses-while-suspended.patch mips-fw-allow-firmware-to-pass-a-empty-env.patch -ipmi-fix-ssif-not-responding-under-certain-cond.patch pwm-meson-fix-axg-ao-mux-parents.patch ring-buffer-sync-irq-works-before-buffer-destruction.patch crypto-api-demote-bug_on-in-crypto_unregister_alg-to-a-warn_on.patch -- 2.47.3