Douglas Anderson 138d73b627
spi: spi-qcom-qspi: Fallback to PIO for xfers that aren't multiples of 4 bytes
The Qualcomm QSPI driver appears to require that any reads using DMA
are a mutliple of 4 bytes. If this isn't true then the controller will
clobber any extra bytes in memory following the last word. Let's
detect this and falback to PIO.

This fixes problems reported by slub_debug=FZPUA, which would complain
about "kmalloc Redzone overwritten". One such instance said:

  0xffffff80c29d541a-0xffffff80c29d541b @offset=21530. First byte 0x0 instead of 0xcc
  Allocated in mtd_kmalloc_up_to+0x98/0xac age=36 cpu=3 pid=6658

Tracing through what was happening I saw that, while we often did DMA
tranfers of 0x1000 bytes, sometimes we'd end up doing ones of 0x41a
bytes. Those 0x41a byte transfers were the problem.

NOTE: a future change will enable the SPI "mem ops" to help avoid this
case, but it still seems good to add the extra check in the transfer.

Fixes: b5762d95607e ("spi: spi-qcom-qspi: Add DMA mode support")
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Vijaya Krishna Nivarthi <quic_vnivarth@quicinc.com>
Reviewed-by: Bjorn Andersson <andersson@kernel.org>
Link: https://lore.kernel.org/r/20230725110226.1.Ia2f980fc7cd0b831e633391f0bb1272914d8f381@changeid
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-07-26 12:47:19 +01:00
..
2023-07-06 22:25:06 -07:00
2023-06-29 11:00:17 -07:00
2023-07-22 11:05:15 -07:00
2023-07-06 09:56:53 -07:00
2023-06-29 08:09:31 -06:00
2023-06-29 16:03:58 -07:00
2023-07-06 09:48:31 -07:00
2023-07-20 14:38:36 +02:00
2023-07-12 11:56:22 -07:00
2023-07-03 12:56:23 -07:00
2023-07-08 12:28:00 -07:00
2023-07-03 12:56:23 -07:00
2023-06-29 15:28:33 -07:00
2023-07-03 11:26:05 -07:00
2023-07-08 12:08:39 -07:00
2023-07-05 10:42:32 -07:00
2023-07-06 10:06:04 -07:00
2023-07-03 10:55:04 -07:00
2023-06-28 14:02:03 -07:00
2023-07-14 19:57:29 -07:00
2023-06-15 13:42:18 +02:00
2023-07-05 21:38:13 -07:00
2023-07-13 00:05:52 +02:00
2023-06-29 15:22:19 -07:00
2023-07-05 12:55:06 -07:00
2023-07-03 17:03:05 -07:00
2023-06-29 15:22:19 -07:00
2023-07-03 10:43:10 -07:00
2023-07-05 10:42:32 -07:00
2023-07-08 12:35:18 -07:00
2023-06-29 15:22:19 -07:00
2023-07-03 15:38:26 -07:00
2023-06-30 15:22:09 -07:00
2023-07-03 15:38:26 -07:00
2023-07-13 13:39:36 -07:00