From: Jonathan Cameron <jic23@kernel.org>
To: linux-iio@vger.kernel.org
Cc: "Akinobu Mita" <akinobu.mita@gmail.com>,
"Alexandru Lazar" <alazar@startmail.com>,
"Alexandru Tachici" <alexandru.tachici@analog.com>,
"Antoniu Miclaus" <antoniu.miclaus@analog.com>,
"Charles-Antoine Couret" <charles-antoine.couret@essensium.com>,
"Cosmin Tanislav" <cosmin.tanislav@analog.com>,
"Cristian Pop" <cristian.pop@analog.com>,
"David Lechner" <david@lechnology.com>,
"Ivan Mikhaylov" <i.mikhaylov@yadro.com>,
"Jacopo Mondi" <jacopo+renesas@jmondi.org>,
"Jean-Baptiste Maneyrol" <jmaneyrol@invensense.com>,
"Lars-Peter Clausen" <lars@metafoo.de>,
"Marcelo Schmitt" <marcelo.schmitt1@gmail.com>,
"Mårten Lindahl" <martenli@axis.com>,
"Matt Ranostay" <mranostay@gmail.com>,
"Michael Hennerich" <michael.hennerich@analog.com>,
"Michael Welling" <mwelling@ieee.org>,
"Mugilraj Dhavachelvan" <dmugil2000@gmail.com>,
"Navin Sankar Velliangiri" <navin@linumiz.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Paul Cercueil" <paul@crapouillou.net>,
"Phil Reid" <preid@electromag.com.au>,
"Puranjay Mohan" <puranjay12@gmail.com>,
"Ricardo Ribalda" <ribalda@kernel.org>,
"Robert Jones" <rjones@gateworks.com>,
"Rui Miguel Silva" <rui.silva@linaro.org>,
"Sean Nyekjaer" <sean.nyekjaer@prevas.dk>,
"Tomas Melin" <tomas.melin@vaisala.com>,
"Tomislav Denis" <tomislav.denis@avl.com>,
"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
"Jonathan Cameron" <Jonathan.Cameron@huawei.com>
Subject: [PATCH 01/92] iio: core: Fix IIO_ALIGN as it was not sufficiently large on some platforms.
Date: Tue, 3 May 2022 09:58:04 +0100 [thread overview]
Message-ID: <20220503085935.1533814-2-jic23@kernel.org> (raw)
In-Reply-To: <20220503085935.1533814-1-jic23@kernel.org>
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Discussion of the series:
https://lore.kernel.org/all/20220405135758.774016-1-catalin.marinas@arm.com/
mm, arm64: Reduce ARCH_KMALLOC_MINALIGN brought to my attention that
our current IIO usage of L1CACHE_ALIGN is insufficient as their are Arm
platforms out their with non coherent DMA and larger cache lines at
at higher levels of their cache hierarchy.
Note this patch will greatly reduce the padding on some architectures
that have smaller requirements for DMA safe buffers.
The history of changing values of ARCH_KMALLOC_MINALIGN via
ARCH_DMA_MINALIGN on arm64 is rather complex. I'm not tagging this
as fixing a particular patch from that route as it's not clear what to tag.
Most recently a change to bring them back inline was reverted because
of some Qualcomm Kryo cores with an L2 cache with 128-byte lines
sitting above the point of coherency.
c1132702c71f Revert "arm64: cache: Lower ARCH_DMA_MINALIGN to 64 (L1_CACHE_BYTES)"
That reverts:
65688d2a05de arm64: cache: Lower ARCH_DMA_MINALIGN to 64 (L1_CACHE_BYTES) which
refers to the change originally being motivated by Thunder x1 performance
rather than correctness.
Fixes: 6f7c8ee585e9d ("staging:iio: Add ability to allocate private data space to iio_allocate_device")
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
include/linux/iio/iio.h | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
index faf00f2c0be6..30937f8f9424 100644
--- a/include/linux/iio/iio.h
+++ b/include/linux/iio/iio.h
@@ -9,6 +9,7 @@
#include <linux/device.h>
#include <linux/cdev.h>
+#include <linux/slab.h>
#include <linux/iio/types.h>
#include <linux/of.h>
/* IIO TODO LIST */
@@ -657,8 +658,13 @@ static inline void *iio_device_get_drvdata(const struct iio_dev *indio_dev)
return dev_get_drvdata(&indio_dev->dev);
}
-/* Can we make this smaller? */
-#define IIO_ALIGN L1_CACHE_BYTES
+/*
+ * Used to ensure the iio_priv() structure is aligned to allow that structure
+ * to in turn include IIO_ALIGN'd elements such as buffers which must not share
+ * cachelines with the rest of the structure, thus making them safe for use with
+ * non-coherent DMA.
+ */
+#define IIO_ALIGN ARCH_KMALLOC_MINALIGN
struct iio_dev *iio_device_alloc(struct device *parent, int sizeof_priv);
/* The information at the returned address is guaranteed to be cacheline aligned */
--
2.36.0
next prev parent reply other threads:[~2022-05-03 8:51 UTC|newest]
Thread overview: 113+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-03 8:58 [PATCH 00/92] IIO: Fix alignment of buffers for DMA Jonathan Cameron
2022-05-03 8:58 ` Jonathan Cameron [this message]
2022-05-03 14:27 ` [PATCH 01/92] iio: core: Fix IIO_ALIGN as it was not sufficiently large on some platforms Uwe Kleine-König
2022-05-03 16:24 ` Jonathan Cameron
2022-05-08 16:17 ` Jonathan Cameron
2022-05-03 8:58 ` [PATCH 02/92] iio: accel: adxl313: Fix alignment for DMA safety Jonathan Cameron
2022-05-03 13:11 ` Lars-Peter Clausen
2022-05-03 16:27 ` Jonathan Cameron
2022-05-03 8:58 ` [PATCH 03/92] iio: accel: adxl355: " Jonathan Cameron
2022-05-03 8:58 ` [PATCH 04/92] iio: accel: adxl367: " Jonathan Cameron
2022-05-03 8:58 ` [PATCH 05/92] iio: accel: bma220: " Jonathan Cameron
2022-05-03 8:58 ` [PATCH 06/92] iio: accel: bmi088: " Jonathan Cameron
2022-05-03 8:58 ` [PATCH 07/92] iio: accel: sca3000: " Jonathan Cameron
2022-05-03 8:58 ` [PATCH 08/92] " Jonathan Cameron
2022-05-03 10:06 ` Tomas Melin
2022-05-03 8:58 ` [PATCH 09/92] iio: adc: ad7266: " Jonathan Cameron
2022-05-03 8:58 ` [PATCH 10/92] iio: adc: ad7280a: " Jonathan Cameron
2022-05-03 8:58 ` [PATCH 11/92] iio: adc: ad7292: " Jonathan Cameron
2022-05-07 16:40 ` Marcelo Schmitt
2022-05-03 8:58 ` [PATCH 12/92] iio: adc: ad7298: " Jonathan Cameron
2022-05-03 8:58 ` [PATCH 13/92] iio: adc: ad7476: " Jonathan Cameron
2022-05-03 8:58 ` [PATCH 14/92] iio: adc: ad7606: " Jonathan Cameron
2022-05-03 8:58 ` [PATCH 15/92] iio: adc: ad7766: " Jonathan Cameron
2022-05-03 8:58 ` [PATCH 16/92] iio: adc: ad7768-1: " Jonathan Cameron
2022-05-03 8:58 ` [PATCH 17/92] iio: adc: ad7887: " Jonathan Cameron
2022-05-03 8:58 ` [PATCH 18/92] iio: adc: ad7923: " Jonathan Cameron
2022-05-03 8:58 ` [PATCH 19/92] iio: adc: ad7949: " Jonathan Cameron
2022-05-03 8:58 ` [PATCH 20/92] iio: adc: hi8435: " Jonathan Cameron
2022-05-03 8:58 ` [PATCH 21/92] iio: adc: ltc2496: " Jonathan Cameron
2022-05-03 8:58 ` [PATCH 22/92] iio: adc: ltc2497: " Jonathan Cameron
2022-05-03 8:58 ` [PATCH 23/92] iio: adc: max1027: " Jonathan Cameron
2022-05-03 8:58 ` [PATCH 24/92] iio: adc: max11100: " Jonathan Cameron
2022-05-03 12:19 ` Jacopo Mondi
2022-05-03 8:58 ` [PATCH 25/92] iio: adc: max1118: " Jonathan Cameron
2022-05-03 8:58 ` [PATCH 26/92] iio: adc: max1241: " Jonathan Cameron
2022-05-03 14:23 ` Alexandru Lazar
2022-05-03 8:58 ` [PATCH 27/92] iio: adc: mcp320x: " Jonathan Cameron
2022-05-03 8:58 ` [PATCH 28/92] iio: adc: ti-adc0832: " Jonathan Cameron
2022-05-03 8:58 ` [PATCH 29/92] iio: adc: ti-adc084s021: " Jonathan Cameron
2022-05-04 6:30 ` Marten Lindahl
2022-05-03 8:58 ` [PATCH 30/92] iio: adc: ti-adc108s102: " Jonathan Cameron
2022-05-03 8:58 ` [PATCH 31/92] iio: adc: ti-adc12138: " Jonathan Cameron
2022-05-03 8:58 ` [PATCH 32/92] iio: adc: ti-adc128s052: " Jonathan Cameron
2022-05-03 8:58 ` [PATCH 33/92] iio: adc: ti-adc161s626: " Jonathan Cameron
2022-05-03 8:58 ` [PATCH 34/92] iio: adc: ti-ads124s08: " Jonathan Cameron
2022-05-03 8:58 ` [PATCH 35/92] iio: adc: ti-ads131e08: " Jonathan Cameron
2022-05-03 8:58 ` [PATCH 36/92] iio: adc: ti-ads7950: " Jonathan Cameron
2022-05-03 19:42 ` David Lechner
2022-05-03 8:58 ` [PATCH 37/92] iio: adc: ti-ads8344: " Jonathan Cameron
2022-05-03 8:58 ` [PATCH 38/92] iio: adc: ti-ads8688: " Jonathan Cameron
2022-05-03 8:58 ` [PATCH 39/92] iio: adc: ti-tlc4541: " Jonathan Cameron
2022-05-03 8:58 ` [PATCH 40/92] iio: addac: ad74413r: " Jonathan Cameron
2022-05-03 8:58 ` [PATCH 41/92] iio: amplifiers: ad8366: " Jonathan Cameron
2022-05-03 8:58 ` [PATCH 42/92] iio: common: ssp: " Jonathan Cameron
2022-05-03 8:58 ` [PATCH 43/92] iio: dac: ad5064: " Jonathan Cameron
2022-05-03 8:58 ` [PATCH 44/92] iio: dac: ad5360: " Jonathan Cameron
2022-05-03 8:58 ` [PATCH 45/92] iio: dac: ad5421: " Jonathan Cameron
2022-05-03 8:58 ` [PATCH 46/92] iio: dac: ad5449: " Jonathan Cameron
2022-05-03 8:58 ` [PATCH 47/92] iio: dac: ad5504: " Jonathan Cameron
2022-05-03 8:58 ` [PATCH 48/92] iio: dac: ad5592r: " Jonathan Cameron
2022-05-03 8:58 ` [PATCH 49/92] iio: dac: ad5686: " Jonathan Cameron
2022-05-03 8:58 ` [PATCH 50/92] iio: dac: ad5755: " Jonathan Cameron
2022-05-03 8:58 ` [PATCH 51/92] iio: dac: ad5761: " Jonathan Cameron
2022-05-03 11:09 ` Ricardo Ribalda Delgado
2022-05-03 8:58 ` [PATCH 52/92] iio: dac: ad5764: " Jonathan Cameron
2022-05-03 8:58 ` [PATCH 53/92] iio: dac: ad5766: " Jonathan Cameron
2022-05-03 8:58 ` [PATCH 54/92] iio: dac: ad5770r: " Jonathan Cameron
2022-05-03 8:58 ` [PATCH 55/92] iio: dac: ad5791: Fix alignment for DMA saftey Jonathan Cameron
2022-05-03 8:58 ` [PATCH 56/92] iio: dac: ad7293: Fix alignment for DMA safety Jonathan Cameron
2022-05-03 8:59 ` [PATCH 57/92] iio: dac: ad7303: " Jonathan Cameron
2022-05-03 8:59 ` [PATCH 58/92] iio: dac: ad8801: " Jonathan Cameron
2022-05-03 8:59 ` [PATCH 59/92] iio: dac: ltc2688: " Jonathan Cameron
2022-05-03 8:59 ` [PATCH 60/92] iio: dac: mcp3922: " Jonathan Cameron
2022-05-03 8:59 ` [PATCH 61/92] iio: dac: ti-dac082s085: " Jonathan Cameron
2022-05-03 8:59 ` [PATCH 62/92] iio: dac: ti-dac5571: " Jonathan Cameron
2022-05-03 8:59 ` [PATCH 63/92] iio: dac: ti-dac7311: " Jonathan Cameron
2022-05-03 8:59 ` [PATCH 64/92] iio: dac: ti-dac7612: " Jonathan Cameron
2022-05-03 11:10 ` Ricardo Ribalda Delgado
2022-05-03 8:59 ` [PATCH 65/92] iio: frequency: ad9523: " Jonathan Cameron
2022-05-03 8:59 ` [PATCH 66/92] iio: frequency: adf4350: " Jonathan Cameron
2022-05-03 8:59 ` [PATCH 67/92] iio: frequency: adf4371: " Jonathan Cameron
2022-05-03 8:59 ` [PATCH 68/92] iio: frequency: admv1013: " Jonathan Cameron
2022-05-03 8:59 ` [PATCH 69/92] iio: frequency: admv1014: " Jonathan Cameron
2022-05-03 8:59 ` [PATCH 70/92] iio: frequency: admv4420: " Jonathan Cameron
2022-05-03 8:59 ` [PATCH 71/92] iio: frequency: adrf6780: " Jonathan Cameron
2022-05-03 8:59 ` [PATCH 72/92] iio: gyro: adis16080: " Jonathan Cameron
2022-05-03 8:59 ` [PATCH 73/92] iio: gyro: adis16130: " Jonathan Cameron
2022-05-03 8:59 ` [PATCH 74/92] iio: gyro: adxrs450: " Jonathan Cameron
2022-05-03 8:59 ` [PATCH 75/92] iio: gyro: fxas210002c: " Jonathan Cameron
2022-05-03 12:14 ` Rui Miguel Silva
2022-05-03 8:59 ` [PATCH 76/92] iio: imu: fxos8700: " Jonathan Cameron
2022-05-03 8:59 ` [PATCH 77/92] iio: imu_icm42600: " Jonathan Cameron
2022-05-03 11:53 ` Jean-Baptiste Maneyrol
2022-05-03 8:59 ` [PATCH 78/92] iio: imu: icm42600: Fix alignment for DMA safety in buffer code Jonathan Cameron
2022-05-03 11:55 ` Jean-Baptiste Maneyrol
2022-05-03 8:59 ` [PATCH 79/92] iio: imu: mpu6050: Fix alignment for DMA safety Jonathan Cameron
2022-05-03 11:56 ` Jean-Baptiste Maneyrol
2022-05-03 8:59 ` [PATCH 80/92] iio: potentiometer: ad5110: " Jonathan Cameron
2022-05-03 8:59 ` [PATCH 81/92] iio: potentiometer: ad5272: " Jonathan Cameron
2022-05-03 23:44 ` Phil Reid
2022-05-03 8:59 ` [PATCH 82/92] iio: potentiometer: max5481: " Jonathan Cameron
2022-05-03 8:59 ` [PATCH 83/92] iio: potentiometer: mcp41010: " Jonathan Cameron
2022-05-03 8:59 ` [PATCH 84/92] iio: potentiometer: mcp4131: " Jonathan Cameron
2022-05-03 8:59 ` [PATCH 85/92] iio: pressure: dlhl60d: Drop unnecessary alignment forcing Jonathan Cameron
2022-05-03 8:59 ` [PATCH 86/92] iio: proximity: as3935: Fix alignment for DMA safety Jonathan Cameron
2022-05-03 8:59 ` [PATCH 87/92] iio: proximity: vcnl3020: Drop unnecessary alignment requirement for i2c device Jonathan Cameron
2022-05-03 8:59 ` [PATCH 88/92] iio: resolver: ad2s1200: Fix alignment for DMA safety Jonathan Cameron
2022-05-03 8:59 ` [PATCH 89/92] iio: resolver: ad2s90: " Jonathan Cameron
2022-05-03 8:59 ` [PATCH 90/92] iio: temp: ltc2983: " Jonathan Cameron
2022-05-03 8:59 ` [PATCH 91/92] iio: temp: max31865: " Jonathan Cameron
2022-05-03 8:59 ` [PATCH 92/92] iio: temp: maxim_thermocouple: " Jonathan Cameron
2022-05-04 13:00 ` [PATCH 00/92] IIO: Fix alignment of buffers for DMA Sa, Nuno
2022-05-04 21:06 ` Jonathan Cameron
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=20220503085935.1533814-2-jic23@kernel.org \
--to=jic23@kernel.org \
--cc=Jonathan.Cameron@huawei.com \
--cc=akinobu.mita@gmail.com \
--cc=alazar@startmail.com \
--cc=alexandru.tachici@analog.com \
--cc=antoniu.miclaus@analog.com \
--cc=charles-antoine.couret@essensium.com \
--cc=cosmin.tanislav@analog.com \
--cc=cristian.pop@analog.com \
--cc=david@lechnology.com \
--cc=dmugil2000@gmail.com \
--cc=i.mikhaylov@yadro.com \
--cc=jacopo+renesas@jmondi.org \
--cc=jmaneyrol@invensense.com \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=marcelo.schmitt1@gmail.com \
--cc=martenli@axis.com \
--cc=michael.hennerich@analog.com \
--cc=mranostay@gmail.com \
--cc=mwelling@ieee.org \
--cc=navin@linumiz.com \
--cc=nuno.sa@analog.com \
--cc=paul@crapouillou.net \
--cc=preid@electromag.com.au \
--cc=puranjay12@gmail.com \
--cc=ribalda@kernel.org \
--cc=rjones@gateworks.com \
--cc=rui.silva@linaro.org \
--cc=sean.nyekjaer@prevas.dk \
--cc=tomas.melin@vaisala.com \
--cc=tomislav.denis@avl.com \
--cc=u.kleine-koenig@pengutronix.de \
/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