Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4607392pxj; Wed, 12 May 2021 09:08:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzaesS1lykoRq/a4yRD1IP3pUR/b6IMw3z0o5X7qAALc+dkGQm8gmISHZnmkfX85/7LLA0+ X-Received: by 2002:a17:907:ea6:: with SMTP id ho38mr4124377ejc.357.1620835714420; Wed, 12 May 2021 09:08:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620835714; cv=none; d=google.com; s=arc-20160816; b=rC+36VX46wtGpK3IrXoBf1gtHXepZQgUcoqDiWwtaEmE4Iff9AFzo1cAZ2EPlw4koP o0Sm2YYm1i5uVcZF6rkzdYc/vj4UYl5jsewDSOunDlwba+hSIOWzovx+AGpa3mpwHElo y87cVZTKtD6HX81mWz7t3g0WJD27HY2PzKfGrjIq+Ro83ZRanww5xrCVRThQ/AJWjTjT /CXUoIpcZE5ScvGZ0gfusinFDLCDCfzQ3umvR+dJrA/0mtuWv0H3C4oA/7dzUqApcgEg PWqv+GLNR9sRGhpXy4apghBGY934EcuBG11C73/IUNiDF7KSHrv6CSCUqRkrZ1iuwA1k 5Auw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=3gUrj5QxQyetgpJ3fcDH5iDQ32I+Dh89gm7z9dewGdI=; b=TPx9IvLZUVNGZ7b2KUZqThMkpd7yw9JrJ/npWfAIcbIm9PdCy0DgjFxfeSomrFQloQ CEXVDYjKrl8ErXjnvSFXRBeA1f4KxBAH3r0JUzta+xwQ7nDZfzjmM1ytKMeheZtWJFbL jXXjusqKYdIpY1+iijoeA3OvlOq7dCXaNFNwhn2DzScErjdNjURd8GujQJXjLcp9OJ7x /quHZufsEAdD6hJLUFphHPolEQtDWbiQ3+9gvPYGOALXN5aixNNEOt5M0WuCgeaeX3af sutKagrr+oxsQQVO0PWRXfs7G2ITZEs8siQOpnoKqCveEL+kgIxUv4dtvEbEb9Tbp0f/ Tw0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BbvhpYVh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s13si101384edr.479.2021.05.12.09.08.10; Wed, 12 May 2021 09:08:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BbvhpYVh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238565AbhELQF3 (ORCPT + 99 others); Wed, 12 May 2021 12:05:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:40954 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235614AbhELP2j (ORCPT ); Wed, 12 May 2021 11:28:39 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id F1BDF61412; Wed, 12 May 2021 15:14:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620832454; bh=lIzSTWoTMrLRGgwJlo1EfEcmVMeaSwWFPEv7qGRKZIY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BbvhpYVhxgmIRG1NBHU2BsQxdqSvvhp0x8gmkDcqOizUqVqJQGuJtA6bAOyKupVCX lJJPcuqLxtul9uzTWzQlYokU/lrGdoKa7+tvSGiaC8lu+sCMGiGj66oaDZ2aRCB27j ygx5h/pxpNhOpNwNCWLjDtF0X1GBrNsx8ADof7VI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tasos Sahanidis , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.10 285/530] media: saa7134: use sg_dma_len when building pgtable Date: Wed, 12 May 2021 16:46:35 +0200 Message-Id: <20210512144829.175003712@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210512144819.664462530@linuxfoundation.org> References: <20210512144819.664462530@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tasos Sahanidis [ Upstream commit 4e1cb753c04d74e06d7ca826ea0bcb02526af03e ] The new AMD IOMMU DMA implementation concatenates sglist entries under certain conditions, and because saa7134 accessed the length member directly, it did not support this scenario. This fixes IO_PAGE_FAULTs and choppy DMA audio 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 Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/pci/saa7134/saa7134-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/pci/saa7134/saa7134-core.c b/drivers/media/pci/saa7134/saa7134-core.c index 391572a6ec76..efb757d5168a 100644 --- a/drivers/media/pci/saa7134/saa7134-core.c +++ b/drivers/media/pci/saa7134/saa7134-core.c @@ -243,7 +243,7 @@ int saa7134_pgtable_build(struct pci_dev *pci, struct saa7134_pgtable *pt, ptr = pt->cpu + startpage; for (i = 0; i < length; i++, list = sg_next(list)) { - 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) + list->offset + p * 4096); } -- 2.30.2