Message ID | 20220807151218.656881-2-jic23@kernel.org (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | staging: iio: DMA alignment fixes. | expand |
On Sun, Aug 7, 2022 at 5:26 PM Jonathan Cameron <jic23@kernel.org> wrote: > > From: Jonathan Cameron <Jonathan.Cameron@huawei.com> > > ____cacheline_aligned is an insufficient guarantee for non-coherent DMA > on platforms with 128 byte cachelines above L1. Switch to the updated > IIO_DMA_MINALIGN definition. ... > union { > - __be16 freq_data[4]____cacheline_aligned; > + __be16 freq_data[4] __aligned(IIO_DMA_MINALIGN); > __be16 phase_data[2]; > __be16 data; > }; Hmm... Can we rather mark the entire union with it?
On Mon, 8 Aug 2022 11:18:34 +0200 Andy Shevchenko <andy.shevchenko@gmail.com> wrote: > On Sun, Aug 7, 2022 at 5:26 PM Jonathan Cameron <jic23@kernel.org> wrote: > > > > From: Jonathan Cameron <Jonathan.Cameron@huawei.com> > > > > ____cacheline_aligned is an insufficient guarantee for non-coherent DMA > > on platforms with 128 byte cachelines above L1. Switch to the updated > > IIO_DMA_MINALIGN definition. > > ... > > > union { > > - __be16 freq_data[4]____cacheline_aligned; > > + __be16 freq_data[4] __aligned(IIO_DMA_MINALIGN); > > __be16 phase_data[2]; > > __be16 data; > > }; > > Hmm... Can we rather mark the entire union with it? > ah. I'd not even registered it was a union ;) Anyhow, yes, that would make sense.
diff --git a/drivers/staging/iio/frequency/ad9832.c b/drivers/staging/iio/frequency/ad9832.c index f43464db618a..ce9fcba6bc5c 100644 --- a/drivers/staging/iio/frequency/ad9832.c +++ b/drivers/staging/iio/frequency/ad9832.c @@ -112,7 +112,7 @@ struct ad9832_state { * transfer buffers to live in their own cache lines. */ union { - __be16 freq_data[4]____cacheline_aligned; + __be16 freq_data[4] __aligned(IIO_DMA_MINALIGN); __be16 phase_data[2]; __be16 data; };