From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-oi1-f180.google.com (mail-oi1-f180.google.com [209.85.167.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 38A222DF128 for ; Sat, 21 Mar 2026 19:40:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.180 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774122039; cv=none; b=Src5YKgkYqBIpCCT5UxCJRJ/sPTiraLD5ph8DcxHnoqhJMmDlrjg4A0caYBFi/Ug2VR7qw/3u5/PGZr/1giYAYrdT6QBAkkiqEHCYtShjXKFLhNXLokWttzcWLMTE5PnqzXxSN/4g0LZtilWriaPg/mL5ysBX+SP5MVYv+SSnew= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774122039; c=relaxed/simple; bh=OIvDzZ+BfUUfvR5O1o7W5HAd/fdYMitDl3NmLBl+Ipk=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=LxsDq9dXUV3Ee5YKomg/9nCFTjUj4VPWHj5VKbmrLgqD59VvLQG3sqx3cLpShaxWe8jLgevNnn//b0qqeppZSENKa+OSkb9xAHqgq6o2vaIfWqEOspm+2bQJFgUajHmnlZX7FSKZjioePCI5gTXUoGt+3Hkhv1cRVdXHy6CJV0c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=I71f42sK; arc=none smtp.client-ip=209.85.167.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="I71f42sK" Received: by mail-oi1-f180.google.com with SMTP id 5614622812f47-45f053b7b90so1890500b6e.0 for ; Sat, 21 Mar 2026 12:40:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1774122036; x=1774726836; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=fe+4n5KT34TE5HqzzhJjD50bZ2llxXjXk7hkDJH1bR0=; b=I71f42sK44Wtn/oXpru74ji6QZ6nhrS2hjKMToqoEPryJ/j++EaIucyPcrlsyDelZF 8eEhzf3OrxFUw+BRqGxkG8Us4ENNCK2RhDgBpusItOi5zoSA6YnevDNi/E1y55hZcJ4G qxRvmNy07JpHYd7lgDVzjNYKZSNYYBwMeiFe21RnnnzCH4lbBRg+qeO1uqdf6hRhBRNp I2p7zmszdZeWII+v0PnL5Tdxx/OeNU88chUkLeUMHHOZVek3zxvAFDxU2vH5hPGFuUFk FhhdI1+fG71P/5eeNm877rDUcK+fPVjXAlydtEm8o+O61XoXLcUkBROMvfBAc2Wcg+pB D/zg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774122036; x=1774726836; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=fe+4n5KT34TE5HqzzhJjD50bZ2llxXjXk7hkDJH1bR0=; b=InVYuVESP1jetqCG/4T8OLbeYxd9p1rcVQT8mLL9JR43oaLHS6YFRSf7nTEviaYJNF Mw+IP+ZtugN2FsVBkdFmAYIORI+hqE2OMtVZJ2AZrBHcmsrlyGiZ3xScRiYELf5n4SLB c4XaaWHKc1SYpg/2fwUiFzXJuplCEoqjBelkCZyTI+C5BL4FmievK0yaOk2CIvpx1P+G 0vdA/ycQPTGeWy4+QDTs9NlDXw4VZLVTERB0VGa+btzBvlr2AJlacyp4bvAEv97BPP8F IvjK4swAzedyC8/LMKDExtY5scwddWI0kXBTPX5OT2v+HuPcguYKAVIAyTo6T89PPNqf 3UGw== X-Forwarded-Encrypted: i=1; AJvYcCUBQZG8n4Y8YomqgIf3w0l65DTzbCQJzHIg6hGaF67BvlhoLKkh16jIn5C8SdL7u/xnZldY3sqGKpNtMlM=@vger.kernel.org X-Gm-Message-State: AOJu0Yynixs5pv3Z7zNk5H3Xw7Wn6tx9M84kFSP2lylc8LnWJioswGKy 89eyX6gNpb8g6pykosiR9jgRW50d0smd/JaNnr4LiMTC0X91wY6YyIPl3JT6UmG1Dag= X-Gm-Gg: ATEYQzzcUAyx8C2i/xs1NHfQX0VSwebyOLRYJVzSXBZ2HdYg6o/pQRLYdfVBzuCsfqI dlpfCAxOl5GkJ8kc4wy7wvKQ8hf3GiDFqbVtU7v4Vcg5EuSCQNVMBICQQZzJBZ70kyOX68uC1pe 16ZVS+ybBwQIZYQ8kfUbfgbIxvJQ2lS7nlgFfayUo0wZZvy6ntTR90++Gp2y30VbRXpQdCIVtY6 EBAEDvYPMitrF7h7Jjm6U7JUY6/gcjOiYRwJkUODNsWTo2DxYu/QPS3mq401u+oIHDJdiny7+5a DknNv+HK1HhniVDBE8IDWVGLUl14SqZS8NckpCUWeRQAUCbQvwChelFmxbSYmAtIv+yzEu1D7PS 449YOTDsQmcmI6wQeY5WIliIs8FxPCXxiaXd84BA8bKHdBNbE7pw5a7WCQEEzmG+uWGX10qh/+z 15dbxZt3iKTK6E0R5I0m9iIGDs3M8B/4GMCEXLoWwdDEgcCWFhFZnf4AuKpPN/Ze0VvkfBIW1qO Q== X-Received: by 2002:a05:6808:15a6:b0:463:c56f:a45b with SMTP id 5614622812f47-467e5ed2b5fmr4678932b6e.28.1774122036135; Sat, 21 Mar 2026 12:40:36 -0700 (PDT) Received: from ?IPV6:2600:8803:e7e4:500:8e89:f58e:e4e6:5567? ([2600:8803:e7e4:500:8e89:f58e:e4e6:5567]) by smtp.gmail.com with ESMTPSA id 5614622812f47-46811e5164esm248557b6e.0.2026.03.21.12.40.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 21 Mar 2026 12:40:35 -0700 (PDT) Message-ID: <2c5083b4-0291-43a0-808f-25d3decdfb5a@baylibre.com> Date: Sat, 21 Mar 2026 14:40:35 -0500 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 2/2] iio: adc: ti-adc161s626: use DMA-safe memory for spi_read() To: Andy Shevchenko , Jonathan Cameron Cc: =?UTF-8?Q?Nuno_S=C3=A1?= , Andy Shevchenko , Matt Ranostay , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org References: <20260314-iio-adc-ti-adc161s626-fix-scan-buf-v1-0-56243b11e87b@baylibre.com> <20260314-iio-adc-ti-adc161s626-fix-scan-buf-v1-2-56243b11e87b@baylibre.com> <20260316183117.4dde7386@jic23-huawei> Content-Language: en-US From: David Lechner In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 3/16/26 2:53 PM, Andy Shevchenko wrote: > On Mon, Mar 16, 2026 at 06:31:17PM +0000, Jonathan Cameron wrote: >> On Sat, 14 Mar 2026 18:13:32 -0500 >> David Lechner wrote: > > ... > >>> u8 shift; >>> + u8 buf[3] __aligned(IIO_DMA_MINALIGN); >> On this. There is new generic infrastructure for marking these. >> https://elixir.bootlin.com/linux/v7.0-rc3/source/include/linux/dma-mapping.h#L720 >> https://lore.kernel.org/all/01ea88055ded4d70cac70ba557680fd5fa7d9ff5.1767601130.git.mst@redhat.com/ >> >> Would look like >> __dma_from_device_group_begin(); >> u8 buf[3]; >> __dma_from_device_group_end(); >> >> Do you think we should adopt them rather than doing our own thing? >> Slowly though I don't want the noise of a mass conversion. >> >> As normal, advantage of standard infrastructure is cutting down >> in subsystem specific magic. >> >> I 'think' result is the same (though it also forces the trailing padding if anything >> comes after this and needs it). > > As I read it it will be an equivalent to > > u8 shift; __aligned(IIO_DMA_MINALIGN); > u8 buf[3] __aligned(IIO_DMA_MINALIGN); > > It will be: u8 shift; __u8 __cacheline_group_begin__[0] __aligned(ARCH_DMA_MINALIGN); u8 buf[3]; __u8 __cacheline_group_end__[0] __aligned(ARCH_DMA_MINALIGN); Note that ARCH_DMA_MINALIGN is not always the same as IIO_DMA_MINALIGN. IIO_DMA_MINALIGN has a minimum of 8 bytes to account for timestamp alignment. I wonder if this would add an extra ARCH_DMA_MINALIGN bytes to the struct. Or if the compiler is smart enough to see that it has 0 size on the last array and have a special case for that. And even if the 0 is handled, if someone added a new field after this, I expect the struct would grow by ARCH_DMA_MINALIGN rather than sizeof(field) bytes.