linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/9] Input: Fix insufficent DMA alignment.
@ 2022-11-27 14:41 Jonathan Cameron
  2022-11-27 14:41 ` [PATCH 1/9] Input: psxpad - Fix padding for DMA safe buffers Jonathan Cameron
                   ` (9 more replies)
  0 siblings, 10 replies; 20+ messages in thread
From: Jonathan Cameron @ 2022-11-27 14:41 UTC (permalink / raw)
  To: linux-input, Dmitry Torokhov
  Cc: Jonathan Cameron, Daniel Mack, Michael Hennerich,
	Tomohiro Yoshidomi, Javier Martinez Canillas, Linus Walleij,
	Benjamin Tissoires, Lauri Kasanen, Daniel Hung-yu Wu

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

This problem was discovered in IIO as a side effect of the discussions about
relaxing kmalloc alignment on arm64 and resulted in a series of large
patch sets.

https://lore.kernel.org/linux-iio/20220508175712.647246-1-jic23@kernel.org/

Unsurprisingly there are cases of it in other subsystems.

The short version of this is that there are a few known arm64 chips where
___cacheline_aligned enforces 64 byte alignment which is what we typically
want for performance optimization as the size of the L1 cache lines.
However, further out in the cache hierarchy we have caches with 128 byte
lines.  Those are the ones that matter for DMA safety.
So we need the larger alignment guarantees of ARCH_KMALLOC_MINALIGN which
in this case is 128 bytes.

There is one other use of ____cacheline_aligned in input:
joystick/iforce/iforce-usb.c

Whilst suspicious I'm not sure enough of the requirements of USB to
know if they are there for DMA safety or some other constraint.

Jonathan

Cc: Daniel Mack <daniel@zonque.org>
Cc: Michael Hennerich <michael.hennerich@analog.com>
Cc: Tomohiro Yoshidomi <sylph23k@gmail.com>
Cc: Javier Martinez Canillas <javier@dowhile0.org>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Cc: Lauri Kasanen <cand@gmx.com>
Cc: Daniel Hung-yu Wu <hywu@google.com>

Jonathan Cameron (9):
  Input: psxpad - Fix padding for DMA safe buffers.
  Input: ad714x - Fix padding for DMA safe buffers.
  Input: ad7887 - Fix padding for DMA safe buffers.
  Input: ads7846 - Fix padding for DMA safe buffers.
  Input: cyttsp - Fix padding for DMA safe buffers.
  Input: surface3 - Fix padding for DMA safe buffers.
  Input: n64joy - Fix DMA buffer alignment.
  Input: atmel_captouch - Avoid suspect DMA buffer alignment.
  Input: elants - Fix suspect DMA buffer alignment

 drivers/input/joystick/n64joy.c          | 6 +++---
 drivers/input/joystick/psxpad-spi.c      | 4 ++--
 drivers/input/misc/ad714x.h              | 2 +-
 drivers/input/misc/atmel_captouch.c      | 2 +-
 drivers/input/touchscreen/ad7877.c       | 4 ++--
 drivers/input/touchscreen/ads7846.c      | 4 ++--
 drivers/input/touchscreen/cyttsp_core.h  | 2 +-
 drivers/input/touchscreen/elants_i2c.c   | 2 +-
 drivers/input/touchscreen/surface3_spi.c | 2 +-
 9 files changed, 14 insertions(+), 14 deletions(-)

-- 
2.38.1


^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2022-11-30  1:24 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-27 14:41 [PATCH 0/9] Input: Fix insufficent DMA alignment Jonathan Cameron
2022-11-27 14:41 ` [PATCH 1/9] Input: psxpad - Fix padding for DMA safe buffers Jonathan Cameron
2022-11-27 14:41 ` [PATCH 2/9] Input: ad714x " Jonathan Cameron
2022-11-28  7:14   ` Hennerich, Michael
2022-11-27 14:41 ` [PATCH 3/9] Input: ad7887 " Jonathan Cameron
2022-11-28  7:14   ` Hennerich, Michael
2022-11-27 14:41 ` [PATCH 4/9] Input: ads7846 " Jonathan Cameron
2022-11-27 14:41 ` [PATCH 5/9] Input: cyttsp " Jonathan Cameron
2022-11-27 14:41 ` [PATCH 6/9] Input: surface3 " Jonathan Cameron
2022-11-27 16:26   ` Jonathan Cameron
2022-11-27 14:41 ` [PATCH 7/9] Input: n64joy - Fix DMA buffer alignment Jonathan Cameron
2022-11-27 16:48   ` Lauri Kasanen
2022-11-27 18:01     ` Jonathan Cameron
2022-11-28  6:49       ` Lauri Kasanen
2022-11-28 18:04     ` Dmitry Torokhov
2022-11-27 14:41 ` [PATCH 8/9] Input: atmel_captouch - Avoid suspect " Jonathan Cameron
2022-11-27 14:41 ` [PATCH 9/9] Input: elants - Fix " Jonathan Cameron
2022-11-28 18:16 ` [PATCH 0/9] Input: Fix insufficent DMA alignment Dmitry Torokhov
2022-11-29  9:18   ` Jonathan Cameron
2022-11-30  1:23     ` Dmitry Torokhov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).