From 969e3f4dec944c0b5e7459356c81c1f4c98fbdd9 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 20 Apr 2018 17:13:27 +0200 Subject: [PATCH] 3.18-stable patches added patches: asoc-ssm2602-replace-reg_default_raw-with-reg_default.patch jbd2-if-the-journal-is-aborted-then-don-t-allow-update-of-the-log-tail.patch powerpc-64-fix-smp_wmb-barrier-definition-use-use-lwsync-consistently.patch powerpc-powernv-fix-opal-nvram-driver-opal_busy-loops.patch powerpc-powernv-handle-unknown-opal-errors-in-opal_nvram_write.patch random-use-a-tighter-cap-in-credit_entropy_bits_safe.patch thunderbolt-resume-control-channel-after-hibernation-image-is-created.patch --- ...ace-reg_default_raw-with-reg_default.patch | 77 +++++++++++++++++++ ...n-don-t-allow-update-of-the-log-tail.patch | 41 ++++++++++ ...finition-use-use-lwsync-consistently.patch | 53 +++++++++++++ ...ix-opal-nvram-driver-opal_busy-loops.patch | 52 +++++++++++++ ...nown-opal-errors-in-opal_nvram_write.patch | 38 +++++++++ ...hter-cap-in-credit_entropy_bits_safe.patch | 38 +++++++++ queue-3.18/series | 7 ++ ...l-after-hibernation-image-is-created.patch | 38 +++++++++ 8 files changed, 344 insertions(+) create mode 100644 queue-3.18/asoc-ssm2602-replace-reg_default_raw-with-reg_default.patch create mode 100644 queue-3.18/jbd2-if-the-journal-is-aborted-then-don-t-allow-update-of-the-log-tail.patch create mode 100644 queue-3.18/powerpc-64-fix-smp_wmb-barrier-definition-use-use-lwsync-consistently.patch create mode 100644 queue-3.18/powerpc-powernv-fix-opal-nvram-driver-opal_busy-loops.patch create mode 100644 queue-3.18/powerpc-powernv-handle-unknown-opal-errors-in-opal_nvram_write.patch create mode 100644 queue-3.18/random-use-a-tighter-cap-in-credit_entropy_bits_safe.patch create mode 100644 queue-3.18/thunderbolt-resume-control-channel-after-hibernation-image-is-created.patch diff --git a/queue-3.18/asoc-ssm2602-replace-reg_default_raw-with-reg_default.patch b/queue-3.18/asoc-ssm2602-replace-reg_default_raw-with-reg_default.patch new file mode 100644 index 00000000000..984a33c636a --- /dev/null +++ b/queue-3.18/asoc-ssm2602-replace-reg_default_raw-with-reg_default.patch @@ -0,0 +1,77 @@ +From a01df75ce737951ad13a08d101306e88c3f57cb2 Mon Sep 17 00:00:00 2001 +From: James Kelly +Date: Mon, 19 Mar 2018 21:29:50 +1100 +Subject: ASoC: ssm2602: Replace reg_default_raw with reg_default + +From: James Kelly + +commit a01df75ce737951ad13a08d101306e88c3f57cb2 upstream. + +SSM2602 driver is broken on recent kernels (at least +since 4.9). User space applications such as amixer or +alsamixer get EIO when attempting to access codec +controls via the relevant IOCTLs. + +Root cause of these failures is the regcache_hw_init +function in drivers/base/regmap/regcache.c, which +prevents regmap cache initalization from the +reg_defaults_raw element of the regmap_config structure +when registers are write only. It also disables the +regmap cache entirely when all registers are write only +or volatile as is the case for the SSM2602 driver. + +Using the reg_defaults element of the regmap_config +structure rather than the reg_defaults_raw element to +initalize the regmap cache avoids the logic in the +regcache_hw_init function entirely. It also makes this +driver consistent with other ASoC codec drivers, as +this driver was the ONLY codec driver that used the +reg_defaults_raw element to initalize the cache. + +Tested on Digilent Zybo Z7 development board which has +a SSM2603 codec chip connected to a Xilinx Zynq SoC. + +Signed-off-by: James Kelly +Signed-off-by: Mark Brown +Cc: stable@vger.kernel.org +Signed-off-by: Greg Kroah-Hartman + +--- + sound/soc/codecs/ssm2602.c | 19 +++++++++++++------ + 1 file changed, 13 insertions(+), 6 deletions(-) + +--- a/sound/soc/codecs/ssm2602.c ++++ b/sound/soc/codecs/ssm2602.c +@@ -54,10 +54,17 @@ struct ssm2602_priv { + * using 2 wire for device control, so we cache them instead. + * There is no point in caching the reset register + */ +-static const u16 ssm2602_reg[SSM2602_CACHEREGNUM] = { +- 0x0097, 0x0097, 0x0079, 0x0079, +- 0x000a, 0x0008, 0x009f, 0x000a, +- 0x0000, 0x0000 ++static const struct reg_default ssm2602_reg[SSM2602_CACHEREGNUM] = { ++ { .reg = 0x00, .def = 0x0097 }, ++ { .reg = 0x01, .def = 0x0097 }, ++ { .reg = 0x02, .def = 0x0079 }, ++ { .reg = 0x03, .def = 0x0079 }, ++ { .reg = 0x04, .def = 0x000a }, ++ { .reg = 0x05, .def = 0x0008 }, ++ { .reg = 0x06, .def = 0x009f }, ++ { .reg = 0x07, .def = 0x000a }, ++ { .reg = 0x08, .def = 0x0000 }, ++ { .reg = 0x09, .def = 0x0000 } + }; + + +@@ -620,8 +627,8 @@ const struct regmap_config ssm2602_regma + .volatile_reg = ssm2602_register_volatile, + + .cache_type = REGCACHE_RBTREE, +- .reg_defaults_raw = ssm2602_reg, +- .num_reg_defaults_raw = ARRAY_SIZE(ssm2602_reg), ++ .reg_defaults = ssm2602_reg, ++ .num_reg_defaults = ARRAY_SIZE(ssm2602_reg), + }; + EXPORT_SYMBOL_GPL(ssm2602_regmap_config); + diff --git a/queue-3.18/jbd2-if-the-journal-is-aborted-then-don-t-allow-update-of-the-log-tail.patch b/queue-3.18/jbd2-if-the-journal-is-aborted-then-don-t-allow-update-of-the-log-tail.patch new file mode 100644 index 00000000000..47f4073c561 --- /dev/null +++ b/queue-3.18/jbd2-if-the-journal-is-aborted-then-don-t-allow-update-of-the-log-tail.patch @@ -0,0 +1,41 @@ +From 85e0c4e89c1b864e763c4e3bb15d0b6d501ad5d9 Mon Sep 17 00:00:00 2001 +From: Theodore Ts'o +Date: Mon, 19 Feb 2018 12:22:53 -0500 +Subject: jbd2: if the journal is aborted then don't allow update of the log tail + +From: Theodore Ts'o + +commit 85e0c4e89c1b864e763c4e3bb15d0b6d501ad5d9 upstream. + +This updates the jbd2 superblock unnecessarily, and on an abort we +shouldn't truncate the log. + +Signed-off-by: Theodore Ts'o +Cc: stable@vger.kernel.org +Signed-off-by: Greg Kroah-Hartman + +--- + fs/jbd2/journal.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +--- a/fs/jbd2/journal.c ++++ b/fs/jbd2/journal.c +@@ -923,7 +923,7 @@ out: + } + + /* +- * This is a variaon of __jbd2_update_log_tail which checks for validity of ++ * This is a variation of __jbd2_update_log_tail which checks for validity of + * provided log tail and locks j_checkpoint_mutex. So it is safe against races + * with other threads updating log tail. + */ +@@ -1399,6 +1399,9 @@ int jbd2_journal_update_sb_log_tail(jour + journal_superblock_t *sb = journal->j_superblock; + int ret; + ++ if (is_journal_aborted(journal)) ++ return -EIO; ++ + BUG_ON(!mutex_is_locked(&journal->j_checkpoint_mutex)); + jbd_debug(1, "JBD2: updating superblock (start %lu, seq %u)\n", + tail_block, tail_tid); diff --git a/queue-3.18/powerpc-64-fix-smp_wmb-barrier-definition-use-use-lwsync-consistently.patch b/queue-3.18/powerpc-64-fix-smp_wmb-barrier-definition-use-use-lwsync-consistently.patch new file mode 100644 index 00000000000..682668bf1cb --- /dev/null +++ b/queue-3.18/powerpc-64-fix-smp_wmb-barrier-definition-use-use-lwsync-consistently.patch @@ -0,0 +1,53 @@ +From 0bfdf598900fd62869659f360d3387ed80eb71cf Mon Sep 17 00:00:00 2001 +From: Nicholas Piggin +Date: Thu, 22 Mar 2018 20:41:46 +1000 +Subject: powerpc/64: Fix smp_wmb barrier definition use use lwsync consistently + +From: Nicholas Piggin + +commit 0bfdf598900fd62869659f360d3387ed80eb71cf upstream. + +asm/barrier.h is not always included after asm/synch.h, which meant +it was missing __SUBARCH_HAS_LWSYNC, so in some files smp_wmb() would +be eieio when it should be lwsync. kernel/time/hrtimer.c is one case. + +__SUBARCH_HAS_LWSYNC is only used in one place, so just fold it in +to where it's used. Previously with my small simulator config, 377 +instances of eieio in the tree. After this patch there are 55. + +Fixes: 46d075be585e ("powerpc: Optimise smp_wmb") +Cc: stable@vger.kernel.org # v2.6.29+ +Signed-off-by: Nicholas Piggin +Signed-off-by: Michael Ellerman +Signed-off-by: Greg Kroah-Hartman + +--- + arch/powerpc/include/asm/barrier.h | 3 ++- + arch/powerpc/include/asm/synch.h | 4 ---- + 2 files changed, 2 insertions(+), 5 deletions(-) + +--- a/arch/powerpc/include/asm/barrier.h ++++ b/arch/powerpc/include/asm/barrier.h +@@ -39,7 +39,8 @@ + + #ifdef CONFIG_SMP + +-#ifdef __SUBARCH_HAS_LWSYNC ++/* The sub-arch has lwsync */ ++#if defined(__powerpc64__) || defined(CONFIG_PPC_E500MC) + # define SMPWMB LWSYNC + #else + # define SMPWMB eieio +--- a/arch/powerpc/include/asm/synch.h ++++ b/arch/powerpc/include/asm/synch.h +@@ -5,10 +5,6 @@ + #include + #include + +-#if defined(__powerpc64__) || defined(CONFIG_PPC_E500MC) +-#define __SUBARCH_HAS_LWSYNC +-#endif +- + #ifndef __ASSEMBLY__ + extern unsigned int __start___lwsync_fixup, __stop___lwsync_fixup; + extern void do_lwsync_fixups(unsigned long value, void *fixup_start, diff --git a/queue-3.18/powerpc-powernv-fix-opal-nvram-driver-opal_busy-loops.patch b/queue-3.18/powerpc-powernv-fix-opal-nvram-driver-opal_busy-loops.patch new file mode 100644 index 00000000000..78d8e69b19b --- /dev/null +++ b/queue-3.18/powerpc-powernv-fix-opal-nvram-driver-opal_busy-loops.patch @@ -0,0 +1,52 @@ +From 3b8070335f751aac9f1526ae2e012e6f5b8b0f21 Mon Sep 17 00:00:00 2001 +From: Nicholas Piggin +Date: Tue, 10 Apr 2018 21:49:33 +1000 +Subject: powerpc/powernv: Fix OPAL NVRAM driver OPAL_BUSY loops + +From: Nicholas Piggin + +commit 3b8070335f751aac9f1526ae2e012e6f5b8b0f21 upstream. + +The OPAL NVRAM driver does not sleep in case it gets OPAL_BUSY or +OPAL_BUSY_EVENT from firmware, which causes large scheduling +latencies, and various lockup errors to trigger (again, BMC reboot +can cause it). + +Fix this by converting it to the standard form OPAL_BUSY loop that +sleeps. + +Fixes: 628daa8d5abf ("powerpc/powernv: Add RTC and NVRAM support plus RTAS fallbacks") +Depends-on: 34dd25de9fe3 ("powerpc/powernv: define a standard delay for OPAL_BUSY type retry loops") +Cc: stable@vger.kernel.org # v3.2+ +Signed-off-by: Nicholas Piggin +Signed-off-by: Michael Ellerman +Signed-off-by: Greg Kroah-Hartman + +--- + arch/powerpc/platforms/powernv/opal-nvram.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +--- a/arch/powerpc/platforms/powernv/opal-nvram.c ++++ b/arch/powerpc/platforms/powernv/opal-nvram.c +@@ -11,6 +11,7 @@ + + #define DEBUG + ++#include + #include + #include + #include +@@ -55,8 +56,12 @@ static ssize_t opal_nvram_write(char *bu + + while (rc == OPAL_BUSY || rc == OPAL_BUSY_EVENT) { + rc = opal_write_nvram(__pa(buf), count, off); +- if (rc == OPAL_BUSY_EVENT) ++ if (rc == OPAL_BUSY_EVENT) { ++ msleep(OPAL_BUSY_DELAY_MS); + opal_poll_events(NULL); ++ } else if (rc == OPAL_BUSY) { ++ msleep(OPAL_BUSY_DELAY_MS); ++ } + } + + if (rc) diff --git a/queue-3.18/powerpc-powernv-handle-unknown-opal-errors-in-opal_nvram_write.patch b/queue-3.18/powerpc-powernv-handle-unknown-opal-errors-in-opal_nvram_write.patch new file mode 100644 index 00000000000..d4e57ab8d9e --- /dev/null +++ b/queue-3.18/powerpc-powernv-handle-unknown-opal-errors-in-opal_nvram_write.patch @@ -0,0 +1,38 @@ +From 741de617661794246f84a21a02fc5e327bffc9ad Mon Sep 17 00:00:00 2001 +From: Nicholas Piggin +Date: Tue, 27 Mar 2018 01:02:33 +1000 +Subject: powerpc/powernv: Handle unknown OPAL errors in opal_nvram_write() + +From: Nicholas Piggin + +commit 741de617661794246f84a21a02fc5e327bffc9ad upstream. + +opal_nvram_write currently just assumes success if it encounters an +error other than OPAL_BUSY or OPAL_BUSY_EVENT. Have it return -EIO +on other errors instead. + +Fixes: 628daa8d5abf ("powerpc/powernv: Add RTC and NVRAM support plus RTAS fallbacks") +Cc: stable@vger.kernel.org # v3.2+ +Signed-off-by: Nicholas Piggin +Reviewed-by: Vasant Hegde +Acked-by: Stewart Smith +Signed-off-by: Michael Ellerman +Signed-off-by: Greg Kroah-Hartman + +--- + arch/powerpc/platforms/powernv/opal-nvram.c | 4 ++++ + 1 file changed, 4 insertions(+) + +--- a/arch/powerpc/platforms/powernv/opal-nvram.c ++++ b/arch/powerpc/platforms/powernv/opal-nvram.c +@@ -58,6 +58,10 @@ static ssize_t opal_nvram_write(char *bu + if (rc == OPAL_BUSY_EVENT) + opal_poll_events(NULL); + } ++ ++ if (rc) ++ return -EIO; ++ + *index += count; + return count; + } diff --git a/queue-3.18/random-use-a-tighter-cap-in-credit_entropy_bits_safe.patch b/queue-3.18/random-use-a-tighter-cap-in-credit_entropy_bits_safe.patch new file mode 100644 index 00000000000..8a64c2e97f3 --- /dev/null +++ b/queue-3.18/random-use-a-tighter-cap-in-credit_entropy_bits_safe.patch @@ -0,0 +1,38 @@ +From 9f886f4d1d292442b2f22a0a33321eae821bde40 Mon Sep 17 00:00:00 2001 +From: Theodore Ts'o +Date: Sat, 25 Feb 2017 18:21:33 -0400 +Subject: random: use a tighter cap in credit_entropy_bits_safe() + +From: Theodore Ts'o + +commit 9f886f4d1d292442b2f22a0a33321eae821bde40 upstream. + +This fixes a harmless UBSAN where root could potentially end up +causing an overflow while bumping the entropy_total field (which is +ignored once the entropy pool has been initialized, and this generally +is completed during the boot sequence). + +This is marginal for the stable kernel series, but it's a really +trivial patch, and it fixes UBSAN warning that might cause security +folks to get overly excited for no reason. + +Signed-off-by: Theodore Ts'o +Reported-by: Chen Feng +Cc: stable@vger.kernel.org +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/char/random.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/char/random.c ++++ b/drivers/char/random.c +@@ -704,7 +704,7 @@ retry: + + static void credit_entropy_bits_safe(struct entropy_store *r, int nbits) + { +- const int nbits_max = (int)(~0U >> (ENTROPY_SHIFT + 1)); ++ const int nbits_max = r->poolinfo->poolwords * 32; + + /* Cap the value to avoid overflows */ + nbits = min(nbits, nbits_max); diff --git a/queue-3.18/series b/queue-3.18/series index e31b58c4def..4e0729f9912 100644 --- a/queue-3.18/series +++ b/queue-3.18/series @@ -16,3 +16,10 @@ acpi-hotplug-pci-check-presence-of-slot-itself-in-get_slot_status.patch usb-fix-usb3-devices-behind-usb3-hubs-not-resuming-at-hibernate-thaw.patch usb-dwc3-pci-properly-cleanup-resource.patch hid-i2c-hid-fix-size-check-and-type-usage.patch +powerpc-powernv-handle-unknown-opal-errors-in-opal_nvram_write.patch +powerpc-64-fix-smp_wmb-barrier-definition-use-use-lwsync-consistently.patch +powerpc-powernv-fix-opal-nvram-driver-opal_busy-loops.patch +asoc-ssm2602-replace-reg_default_raw-with-reg_default.patch +thunderbolt-resume-control-channel-after-hibernation-image-is-created.patch +random-use-a-tighter-cap-in-credit_entropy_bits_safe.patch +jbd2-if-the-journal-is-aborted-then-don-t-allow-update-of-the-log-tail.patch diff --git a/queue-3.18/thunderbolt-resume-control-channel-after-hibernation-image-is-created.patch b/queue-3.18/thunderbolt-resume-control-channel-after-hibernation-image-is-created.patch new file mode 100644 index 00000000000..b7e44534d90 --- /dev/null +++ b/queue-3.18/thunderbolt-resume-control-channel-after-hibernation-image-is-created.patch @@ -0,0 +1,38 @@ +From f2a659f7d8d5da803836583aa16df06bdf324252 Mon Sep 17 00:00:00 2001 +From: Mika Westerberg +Date: Tue, 19 Dec 2017 12:44:56 +0300 +Subject: thunderbolt: Resume control channel after hibernation image is created + +From: Mika Westerberg + +commit f2a659f7d8d5da803836583aa16df06bdf324252 upstream. + +The driver misses implementation of PM hook that undoes what +->freeze_noirq() does after the hibernation image is created. This means +the control channel is not resumed properly and the Thunderbolt bus +becomes useless in later stages of hibernation (when the image is stored +or if the operation fails). + +Fix this by pointing ->thaw_noirq to driver nhi_resume_noirq(). This +makes sure the control channel is resumed properly. + +Fixes: 23dd5bb49d98 ("thunderbolt: Add suspend/hibernate support") +Signed-off-by: Mika Westerberg +Reviewed-by: Andy Shevchenko +Cc: stable@vger.kernel.org +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/thunderbolt/nhi.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/thunderbolt/nhi.c ++++ b/drivers/thunderbolt/nhi.c +@@ -627,6 +627,7 @@ static const struct dev_pm_ops nhi_pm_op + * we just disable hotplug, the + * pci-tunnels stay alive. + */ ++ .thaw_noirq = nhi_resume_noirq, + .restore_noirq = nhi_resume_noirq, + }; + -- 2.47.3