]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.15-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 3 May 2022 14:22:10 +0000 (16:22 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 3 May 2022 14:22:10 +0000 (16:22 +0200)
added patches:
eeprom-at25-use-dma-safe-buffers.patch
perf-symbol-remove-arch__symbols__fixup_end.patch

queue-5.15/eeprom-at25-use-dma-safe-buffers.patch [new file with mode: 0644]
queue-5.15/perf-symbol-remove-arch__symbols__fixup_end.patch [new file with mode: 0644]
queue-5.15/series

diff --git a/queue-5.15/eeprom-at25-use-dma-safe-buffers.patch b/queue-5.15/eeprom-at25-use-dma-safe-buffers.patch
new file mode 100644 (file)
index 0000000..8a663ad
--- /dev/null
@@ -0,0 +1,155 @@
+From 5b47b751b760ee1c74a51660fd096aa148a362cd Mon Sep 17 00:00:00 2001
+From: Christophe Leroy <christophe.leroy@csgroup.eu>
+Date: Wed, 23 Mar 2022 11:51:55 +0100
+Subject: eeprom: at25: Use DMA safe buffers
+
+From: Christophe Leroy <christophe.leroy@csgroup.eu>
+
+commit 5b47b751b760ee1c74a51660fd096aa148a362cd upstream.
+
+Reading EEPROM fails with following warning:
+
+[   16.357496] ------------[ cut here ]------------
+[   16.357529] fsl_spi b01004c0.spi: rejecting DMA map of vmalloc memory
+[   16.357698] WARNING: CPU: 0 PID: 371 at include/linux/dma-mapping.h:326 fsl_spi_cpm_bufs+0x2a0/0x2d8
+[   16.357775] CPU: 0 PID: 371 Comm: od Not tainted 5.16.11-s3k-dev-01743-g19beecbfe9d6-dirty #109
+[   16.357806] NIP:  c03fbc9c LR: c03fbc9c CTR: 00000000
+[   16.357825] REGS: e68d9b20 TRAP: 0700   Not tainted  (5.16.11-s3k-dev-01743-g19beecbfe9d6-dirty)
+[   16.357849] MSR:  00029032 <EE,ME,IR,DR,RI>  CR: 24002282  XER: 00000000
+[   16.357931]
+[   16.357931] GPR00: c03fbc9c e68d9be0 c26d06a0 00000039 00000001 c0d36364 c0e96428 00000027
+[   16.357931] GPR08: 00000001 00000000 00000023 3fffc000 24002282 100d3dd6 100a2ffc 00000000
+[   16.357931] GPR16: 100cd280 100b0000 00000000 aff54f7e 100d0000 100d0000 00000001 100cf328
+[   16.357931] GPR24: 100cf328 00000000 00000003 e68d9e30 c156b410 e67ab4c0 e68d9d38 c24ab278
+[   16.358253] NIP [c03fbc9c] fsl_spi_cpm_bufs+0x2a0/0x2d8
+[   16.358292] LR [c03fbc9c] fsl_spi_cpm_bufs+0x2a0/0x2d8
+[   16.358325] Call Trace:
+[   16.358336] [e68d9be0] [c03fbc9c] fsl_spi_cpm_bufs+0x2a0/0x2d8 (unreliable)
+[   16.358388] [e68d9c00] [c03fcb44] fsl_spi_bufs.isra.0+0x94/0x1a0
+[   16.358436] [e68d9c20] [c03fd970] fsl_spi_do_one_msg+0x254/0x3dc
+[   16.358483] [e68d9cb0] [c03f7e50] __spi_pump_messages+0x274/0x8a4
+[   16.358529] [e68d9ce0] [c03f9d30] __spi_sync+0x344/0x378
+[   16.358573] [e68d9d20] [c03fb52c] spi_sync+0x34/0x60
+[   16.358616] [e68d9d30] [c03b4dec] at25_ee_read+0x138/0x1a8
+[   16.358667] [e68d9e50] [c04a8fb8] bin_attr_nvmem_read+0x98/0x110
+[   16.358725] [e68d9e60] [c0204b14] kernfs_fop_read_iter+0xc0/0x1fc
+[   16.358774] [e68d9e80] [c0168660] vfs_read+0x284/0x410
+[   16.358821] [e68d9f00] [c016925c] ksys_read+0x6c/0x11c
+[   16.358863] [e68d9f30] [c00160e0] ret_from_syscall+0x0/0x28
+...
+[   16.359608] ---[ end trace a4ce3e34afef0cb5 ]---
+[   16.359638] fsl_spi b01004c0.spi: unable to map tx dma
+
+This is due to the AT25 driver using buffers on stack, which is not
+possible with CONFIG_VMAP_STACK.
+
+As mentionned in kernel Documentation (Documentation/spi/spi-summary.rst):
+
+  - Follow standard kernel rules, and provide DMA-safe buffers in
+    your messages.  That way controller drivers using DMA aren't forced
+    to make extra copies unless the hardware requires it (e.g. working
+    around hardware errata that force the use of bounce buffering).
+
+Modify the driver to use a buffer located in the at25 device structure
+which is allocated via kmalloc during probe.
+
+Protect writes in this new buffer with the driver's mutex.
+
+Fixes: b587b13a4f67 ("[PATCH] SPI eeprom driver")
+Cc: stable <stable@kernel.org>
+Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
+Link: https://lore.kernel.org/r/230a9486fc68ea0182df46255e42a51099403642.1648032613.git.christophe.leroy@csgroup.eu
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/misc/eeprom/at25.c |   19 +++++++++++--------
+ 1 file changed, 11 insertions(+), 8 deletions(-)
+
+--- a/drivers/misc/eeprom/at25.c
++++ b/drivers/misc/eeprom/at25.c
+@@ -30,6 +30,8 @@
+  */
+ #define       FM25_SN_LEN     8               /* serial number length */
++#define EE_MAXADDRLEN 3               /* 24 bit addresses, up to 2 MBytes */
++
+ struct at25_data {
+       struct spi_device       *spi;
+       struct mutex            lock;
+@@ -38,6 +40,7 @@ struct at25_data {
+       struct nvmem_config     nvmem_config;
+       struct nvmem_device     *nvmem;
+       u8 sernum[FM25_SN_LEN];
++      u8 command[EE_MAXADDRLEN + 1];
+ };
+ #define       AT25_WREN       0x06            /* latch the write enable */
+@@ -60,8 +63,6 @@ struct at25_data {
+ #define       FM25_ID_LEN     9               /* ID length */
+-#define EE_MAXADDRLEN 3               /* 24 bit addresses, up to 2 MBytes */
+-
+ /* Specs often allow 5 msec for a page write, sometimes 20 msec;
+  * it's important to recover from write timeouts.
+  */
+@@ -76,7 +77,6 @@ static int at25_ee_read(void *priv, unsi
+ {
+       struct at25_data *at25 = priv;
+       char *buf = val;
+-      u8                      command[EE_MAXADDRLEN + 1];
+       u8                      *cp;
+       ssize_t                 status;
+       struct spi_transfer     t[2];
+@@ -90,12 +90,15 @@ static int at25_ee_read(void *priv, unsi
+       if (unlikely(!count))
+               return -EINVAL;
+-      cp = command;
++      cp = at25->command;
+       instr = AT25_READ;
+       if (at25->chip.flags & EE_INSTR_BIT3_IS_ADDR)
+               if (offset >= (1U << (at25->addrlen * 8)))
+                       instr |= AT25_INSTR_BIT3;
++
++      mutex_lock(&at25->lock);
++
+       *cp++ = instr;
+       /* 8/16/24-bit address is written MSB first */
+@@ -114,7 +117,7 @@ static int at25_ee_read(void *priv, unsi
+       spi_message_init(&m);
+       memset(t, 0, sizeof(t));
+-      t[0].tx_buf = command;
++      t[0].tx_buf = at25->command;
+       t[0].len = at25->addrlen + 1;
+       spi_message_add_tail(&t[0], &m);
+@@ -122,8 +125,6 @@ static int at25_ee_read(void *priv, unsi
+       t[1].len = count;
+       spi_message_add_tail(&t[1], &m);
+-      mutex_lock(&at25->lock);
+-
+       /* Read it all at once.
+        *
+        * REVISIT that's potentially a problem with large chips, if
+@@ -151,7 +152,7 @@ static int fm25_aux_read(struct at25_dat
+       spi_message_init(&m);
+       memset(t, 0, sizeof(t));
+-      t[0].tx_buf = &command;
++      t[0].tx_buf = at25->command;
+       t[0].len = 1;
+       spi_message_add_tail(&t[0], &m);
+@@ -161,6 +162,8 @@ static int fm25_aux_read(struct at25_dat
+       mutex_lock(&at25->lock);
++      at25->command[0] = command;
++
+       status = spi_sync(at25->spi, &m);
+       dev_dbg(&at25->spi->dev, "read %d aux bytes --> %d\n", len, status);
diff --git a/queue-5.15/perf-symbol-remove-arch__symbols__fixup_end.patch b/queue-5.15/perf-symbol-remove-arch__symbols__fixup_end.patch
new file mode 100644 (file)
index 0000000..327d7e8
--- /dev/null
@@ -0,0 +1,165 @@
+From a5d20d42a2f2dc2b2f9e9361912062732414090d Mon Sep 17 00:00:00 2001
+From: Namhyung Kim <namhyung@kernel.org>
+Date: Fri, 15 Apr 2022 17:40:48 -0700
+Subject: perf symbol: Remove arch__symbols__fixup_end()
+
+From: Namhyung Kim <namhyung@kernel.org>
+
+commit a5d20d42a2f2dc2b2f9e9361912062732414090d upstream.
+
+Now the generic code can handle kallsyms fixup properly so no need to
+keep the arch-functions anymore.
+
+Fixes: 3cf6a32f3f2a4594 ("perf symbols: Fix symbol size calculation condition")
+Signed-off-by: Namhyung Kim <namhyung@kernel.org>
+Acked-by: Ian Rogers <irogers@google.com>
+Cc: Heiko Carstens <hca@linux.ibm.com>
+Cc: Ingo Molnar <mingo@kernel.org>
+Cc: Jiri Olsa <jolsa@kernel.org>
+Cc: John Garry <john.garry@huawei.com>
+Cc: Leo Yan <leo.yan@linaro.org>
+Cc: Mark Rutland <mark.rutland@arm.com>
+Cc: Masami Hiramatsu <mhiramat@kernel.org>
+Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
+Cc: Michael Ellerman <mpe@ellerman.id.au>
+Cc: Michael Petlan <mpetlan@redhat.com>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Song Liu <songliubraving@fb.com>
+Cc: Will Deacon <will@kernel.org>
+Cc: linux-s390@vger.kernel.org
+Cc: linuxppc-dev@lists.ozlabs.org
+Link: https://lore.kernel.org/r/20220416004048.1514900-4-namhyung@kernel.org
+Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ tools/perf/arch/arm64/util/Build       |    1 -
+ tools/perf/arch/arm64/util/machine.c   |   28 ----------------------------
+ tools/perf/arch/powerpc/util/Build     |    1 -
+ tools/perf/arch/powerpc/util/machine.c |   25 -------------------------
+ tools/perf/arch/s390/util/machine.c    |   16 ----------------
+ tools/perf/util/symbol.c               |    5 -----
+ tools/perf/util/symbol.h               |    1 -
+ 7 files changed, 77 deletions(-)
+ delete mode 100644 tools/perf/arch/powerpc/util/machine.c
+
+--- a/tools/perf/arch/arm64/util/Build
++++ b/tools/perf/arch/arm64/util/Build
+@@ -1,5 +1,4 @@
+ perf-y += header.o
+-perf-y += machine.o
+ perf-y += perf_regs.o
+ perf-y += tsc.o
+ perf-y += pmu.o
+--- a/tools/perf/arch/arm64/util/machine.c
++++ /dev/null
+@@ -1,28 +0,0 @@
+-// SPDX-License-Identifier: GPL-2.0
+-
+-#include <inttypes.h>
+-#include <stdio.h>
+-#include <string.h>
+-#include "debug.h"
+-#include "symbol.h"
+-
+-/* On arm64, kernel text segment starts at high memory address,
+- * for example 0xffff 0000 8xxx xxxx. Modules start at a low memory
+- * address, like 0xffff 0000 00ax xxxx. When only small amount of
+- * memory is used by modules, gap between end of module's text segment
+- * and start of kernel text segment may reach 2G.
+- * Therefore do not fill this gap and do not assign it to the kernel dso map.
+- */
+-
+-#define SYMBOL_LIMIT (1 << 12) /* 4K */
+-
+-void arch__symbols__fixup_end(struct symbol *p, struct symbol *c)
+-{
+-      if ((strchr(p->name, '[') && strchr(c->name, '[') == NULL) ||
+-                      (strchr(p->name, '[') == NULL && strchr(c->name, '[')))
+-              /* Limit range of last symbol in module and kernel */
+-              p->end += SYMBOL_LIMIT;
+-      else
+-              p->end = c->start;
+-      pr_debug4("%s sym:%s end:%#" PRIx64 "\n", __func__, p->name, p->end);
+-}
+--- a/tools/perf/arch/powerpc/util/Build
++++ b/tools/perf/arch/powerpc/util/Build
+@@ -1,5 +1,4 @@
+ perf-y += header.o
+-perf-y += machine.o
+ perf-y += kvm-stat.o
+ perf-y += perf_regs.o
+ perf-y += mem-events.o
+--- a/tools/perf/arch/powerpc/util/machine.c
++++ /dev/null
+@@ -1,25 +0,0 @@
+-// SPDX-License-Identifier: GPL-2.0
+-
+-#include <inttypes.h>
+-#include <stdio.h>
+-#include <string.h>
+-#include <internal/lib.h> // page_size
+-#include "debug.h"
+-#include "symbol.h"
+-
+-/* On powerpc kernel text segment start at memory addresses, 0xc000000000000000
+- * whereas the modules are located at very high memory addresses,
+- * for example 0xc00800000xxxxxxx. The gap between end of kernel text segment
+- * and beginning of first module's text segment is very high.
+- * Therefore do not fill this gap and do not assign it to the kernel dso map.
+- */
+-
+-void arch__symbols__fixup_end(struct symbol *p, struct symbol *c)
+-{
+-      if (strchr(p->name, '[') == NULL && strchr(c->name, '['))
+-              /* Limit the range of last kernel symbol */
+-              p->end += page_size;
+-      else
+-              p->end = c->start;
+-      pr_debug4("%s sym:%s end:%#" PRIx64 "\n", __func__, p->name, p->end);
+-}
+--- a/tools/perf/arch/s390/util/machine.c
++++ b/tools/perf/arch/s390/util/machine.c
+@@ -35,19 +35,3 @@ int arch__fix_module_text_start(u64 *sta
+       return 0;
+ }
+-
+-/* On s390 kernel text segment start is located at very low memory addresses,
+- * for example 0x10000. Modules are located at very high memory addresses,
+- * for example 0x3ff xxxx xxxx. The gap between end of kernel text segment
+- * and beginning of first module's text segment is very big.
+- * Therefore do not fill this gap and do not assign it to the kernel dso map.
+- */
+-void arch__symbols__fixup_end(struct symbol *p, struct symbol *c)
+-{
+-      if (strchr(p->name, '[') == NULL && strchr(c->name, '['))
+-              /* Last kernel symbol mapped to end of page */
+-              p->end = roundup(p->end, page_size);
+-      else
+-              p->end = c->start;
+-      pr_debug4("%s sym:%s end:%#" PRIx64 "\n", __func__, p->name, p->end);
+-}
+--- a/tools/perf/util/symbol.c
++++ b/tools/perf/util/symbol.c
+@@ -101,11 +101,6 @@ static int prefix_underscores_count(cons
+       return tail - str;
+ }
+-void __weak arch__symbols__fixup_end(struct symbol *p, struct symbol *c)
+-{
+-      p->end = c->start;
+-}
+-
+ const char * __weak arch__normalize_symbol_name(const char *name)
+ {
+       return name;
+--- a/tools/perf/util/symbol.h
++++ b/tools/perf/util/symbol.h
+@@ -230,7 +230,6 @@ const char *arch__normalize_symbol_name(
+ #define SYMBOL_A 0
+ #define SYMBOL_B 1
+-void arch__symbols__fixup_end(struct symbol *p, struct symbol *c);
+ int arch__compare_symbol_names(const char *namea, const char *nameb);
+ int arch__compare_symbol_names_n(const char *namea, const char *nameb,
+                                unsigned int n);
index 3043a91847b1943fd7903dad4d96c603c29b74e4..24fc9ecd955e37ca196af1480336e9ee5aab0bfc 100644 (file)
@@ -170,3 +170,5 @@ tty-n_gsm-fix-missing-tty-wakeup-in-convergence-layer-type-2.patch
 tty-n_gsm-fix-reset-fifo-race-condition.patch
 tty-n_gsm-fix-incorrect-ua-handling.patch
 tty-n_gsm-fix-software-flow-control-handling.patch
+perf-symbol-remove-arch__symbols__fixup_end.patch
+eeprom-at25-use-dma-safe-buffers.patch