Thread (8 messages) 8 messages, 2 authors, 2021-08-12

Re: [PATCH v4 1/2] tty: hvc: pass DMA capable memory to put_chars()

From: Arnd Bergmann <arnd@arndb.de>
Date: 2021-08-12 08:54:42
Also in: lkml, virtualization

On Thu, Aug 12, 2021 at 10:08 AM Xianting TIan
[off-list ref] wrote:
在 2021/8/6 下午10:51, Arnd Bergmann 写道:
quoted
On Fri, Aug 6, 2021 at 5:01 AM Xianting Tian
quoted
+#define __ALIGNED__ __attribute__((__aligned__(sizeof(long))))
I think you need a higher alignment for DMA buffers, instead of sizeof(long),
I would suggest ARCH_DMA_MINALIGN.
As some ARCH(eg, x86, riscv) doesn't define ARCH_DMA_MINALIG, so i think
it 's better remain the code unchanged,

I will send v5 patch soon.
I think you could just use "L1_CACHE_BYTES" as the alignment in this case.
This will make the structure slightly larger for architectures that do not have
alignment constraints on DMA buffers, but using a smaller alignment is
clearly wrong. Another option would be to use ARCH_KMALLOC_MINALIGN.

Note that there is a patch to add ARCH_DMA_MINALIGN to riscv already,
as some implementations do not have coherent DMA. I had failed to
realized though that on x86 you do not get an ARCH_DMA_MINALIGN
definition.

       Arnd
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help