Skip to content
Snippets Groups Projects
Commit 3ad6a628 authored by Tasos Sahanidis's avatar Tasos Sahanidis Committed by Greg Kroah-Hartman
Browse files

media: saa7146: use sg_dma_len when building pgtable


[ Upstream commit e56429b0 ]

The new AMD IOMMU DMA implementation concatenates sglist entries under
certain conditions, and because saa7146 accessed the length member
directly, it did not support this scenario.

This fixes IO_PAGE_FAULTs by using the sg_dma_len macro.

Fixes: be62dbf5 ("iommu/amd: Convert AMD iommu driver to the dma-iommu api")
Signed-off-by: default avatarTasos Sahanidis <tasos@tasossah.com>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent a250df33
No related branches found
No related tags found
No related merge requests found
...@@ -253,7 +253,7 @@ int saa7146_pgtable_build_single(struct pci_dev *pci, struct saa7146_pgtable *pt ...@@ -253,7 +253,7 @@ int saa7146_pgtable_build_single(struct pci_dev *pci, struct saa7146_pgtable *pt
i, sg_dma_address(list), sg_dma_len(list), i, sg_dma_address(list), sg_dma_len(list),
list->offset); list->offset);
*/ */
for (p = 0; p * 4096 < list->length; p++, ptr++) { for (p = 0; p * 4096 < sg_dma_len(list); p++, ptr++) {
*ptr = cpu_to_le32(sg_dma_address(list) + p * 4096); *ptr = cpu_to_le32(sg_dma_address(list) + p * 4096);
nr_pages++; nr_pages++;
} }
......
...@@ -247,9 +247,8 @@ static int saa7146_pgtable_build(struct saa7146_dev *dev, struct saa7146_buf *bu ...@@ -247,9 +247,8 @@ static int saa7146_pgtable_build(struct saa7146_dev *dev, struct saa7146_buf *bu
/* walk all pages, copy all page addresses to ptr1 */ /* walk all pages, copy all page addresses to ptr1 */
for (i = 0; i < length; i++, list++) { for (i = 0; i < length; i++, list++) {
for (p = 0; p * 4096 < list->length; p++, ptr1++) { for (p = 0; p * 4096 < sg_dma_len(list); p++, ptr1++)
*ptr1 = cpu_to_le32(sg_dma_address(list) - list->offset); *ptr1 = cpu_to_le32(sg_dma_address(list) - list->offset);
}
} }
/* /*
ptr1 = pt1->cpu; ptr1 = pt1->cpu;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment