linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: linux-input@vger.kernel.org, Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Jonathan Cameron <Jonathan.Cameron@huawei.com>,
	Benjamin Tissoires <benjamin.tissoires@redhat.com>
Subject: [PATCH 6/9] Input: surface3 - Fix padding for DMA safe buffers.
Date: Sun, 27 Nov 2022 14:41:13 +0000	[thread overview]
Message-ID: <20221127144116.1418083-7-jic23@kernel.org> (raw)
In-Reply-To: <20221127144116.1418083-1-jic23@kernel.org>

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

On some architectures (e.g. arm64), ____cachline_aligned only aligns
to the cacheline size of the L1 cache size. L1_CACHE_BYTES in
arch64/include/asm/cache.h  Unfortunately DMA safety on these
architectures requires the buffer no share a last level cache cacheline
given by ARCH_DMA_MINALIGN which has a greater granularity.
ARCH_DMA_MINALIGN is not defined for all architectures, but when it is
defined it is used to set the size of ARCH_KMALLOC_MINALIGN
to allow DMA safe buffer allocations.

As such the correct alignment requirement is
__aligned(ARCH_KMALLOC_MINALIGN).
This has recently been fixed in other subsystems such as IIO.

Presumably this part is little used on boards where this could actually
matter so this is mostly about removing code that might be coppied
elsewhere.

Fixes: 4feacbc24eea ("Input: add new driver for the Surface 3")
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Benjamin Tissoires <benjamin.tissoires@redhat.com>
---
 drivers/input/touchscreen/surface3_spi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/input/touchscreen/surface3_spi.c b/drivers/input/touchscreen/surface3_spi.c
index 1da23e5585a0..6c884fc2b332 100644
--- a/drivers/input/touchscreen/surface3_spi.c
+++ b/drivers/input/touchscreen/surface3_spi.c
@@ -32,7 +32,7 @@ struct surface3_ts_data {
 	struct input_dev *pen_input_dev;
 	int pen_tool;
 
-	u8 rd_buf[SURFACE3_PACKET_SIZE]		____cacheline_aligned;
+	u8 rd_buf[SURFACE3_PACKET_SIZE] __aligned(ARCH_KMALLOC_MINALIGN;
 };
 
 struct surface3_ts_data_finger {
-- 
2.38.1


  parent reply	other threads:[~2022-11-27 14:29 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` Jonathan Cameron [this message]
2022-11-27 16:26   ` [PATCH 6/9] Input: surface3 " 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221127144116.1418083-7-jic23@kernel.org \
    --to=jic23@kernel.org \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=benjamin.tissoires@redhat.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).