提交 70ba5e9a 编写于 作者: A Andreas Larsson 提交者: Zheng Zengkai

sparc32: page align size in arch_dma_alloc

stable inclusion
from stable-5.10.70
commit 54a4860c6257f4575968998939952bd1aa9dcbce
bugzilla: 182949 https://gitee.com/openeuler/kernel/issues/I4I3GQ

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=54a4860c6257f4575968998939952bd1aa9dcbce

--------------------------------

[ Upstream commit 59583f74 ]

Commit 53b7670e ("sparc: factor the dma coherent mapping into
helper") lost the page align for the calls to dma_make_coherent and
srmmu_unmapiorange. The latter cannot handle a non page aligned len
argument.
Signed-off-by: NAndreas Larsson <andreas@gaisler.com>
Reviewed-by: NSam Ravnborg <sam@ravnborg.org>
Signed-off-by: NChristoph Hellwig <hch@lst.de>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Acked-by: NWeilong Chen <chenweilong@huawei.com>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 c8102f47
...@@ -356,7 +356,9 @@ void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle, ...@@ -356,7 +356,9 @@ void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
void arch_dma_free(struct device *dev, size_t size, void *cpu_addr, void arch_dma_free(struct device *dev, size_t size, void *cpu_addr,
dma_addr_t dma_addr, unsigned long attrs) dma_addr_t dma_addr, unsigned long attrs)
{ {
if (!sparc_dma_free_resource(cpu_addr, PAGE_ALIGN(size))) size = PAGE_ALIGN(size);
if (!sparc_dma_free_resource(cpu_addr, size))
return; return;
dma_make_coherent(dma_addr, size); dma_make_coherent(dma_addr, size);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册