aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/common/saa7146/saa7146_video.c
diff options
context:
space:
mode:
authorTasos Sahanidis <tasos@tasossah.com>2021-03-03 19:52:53 +0100
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>2021-03-11 11:59:44 +0100
commite56429b09d5e0802b86f84ec7c24025886c9f88b (patch)
tree01f1b4a9a9573e504da7e1dc8bbb0c31d801ad23 /drivers/media/common/saa7146/saa7146_video.c
parentmedia: saa7134: use sg_dma_len when building pgtable (diff)
downloadlinux-dev-e56429b09d5e0802b86f84ec7c24025886c9f88b.tar.xz
linux-dev-e56429b09d5e0802b86f84ec7c24025886c9f88b.zip
media: saa7146: use sg_dma_len when building pgtable
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: be62dbf554c5 ("iommu/amd: Convert AMD iommu driver to the dma-iommu api") Signed-off-by: Tasos Sahanidis <tasos@tasossah.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Diffstat (limited to 'drivers/media/common/saa7146/saa7146_video.c')
-rw-r--r--drivers/media/common/saa7146/saa7146_video.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/media/common/saa7146/saa7146_video.c b/drivers/media/common/saa7146/saa7146_video.c
index 7b8795eca589..66215d9106a4 100644
--- a/drivers/media/common/saa7146/saa7146_video.c
+++ b/drivers/media/common/saa7146/saa7146_video.c
@@ -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 */
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 = pt1->cpu;