Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp2908541iog; Mon, 27 Jun 2022 05:33:20 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uGxDc1wzrJ8jj4hYLN8DQDnaMN5blkZbKBqRvBCygy2Ax9N61uWcgqDFbQOtwWlHXtb+rC X-Received: by 2002:a63:3e47:0:b0:40c:fa04:dd6e with SMTP id l68-20020a633e47000000b0040cfa04dd6emr12688693pga.224.1656333200436; Mon, 27 Jun 2022 05:33:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656333200; cv=none; d=google.com; s=arc-20160816; b=oCZaEMwDuuTMGhcRqH06hzMI5ol40OeOsqswMfoV9cWacKLqhAPQl3oZmYq89QkZIv bDSwEbc3ww12okzLbe4F6KMHxe1n3QSY/aEAVHctU30dcbQixjAZZRk1wYcY0viOMRpO bVdRhP9oa9keOwcqsZBtB+3fqeST5xkNK3J2I1HoQe2DepgjSjq/aMj33Oq4gr8qImAX zBggSfHKF/a6SP+eYN9JFZdxDJtcvfx8zuH2lJBclyUu5OvrBWY3xrJ/5+OfBvyOBMZy NVFI79KYKdmtAUHE2JaZg1Fuo5vi2lJ1brjiB9oFR6ZkfUxVigmbLZ375XLF8bOoU0v9 /60A== 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=FV45rpbWwrlhEivlAtBz9mR85hj9Qtwk5lb60IUc7i8=; b=qENsN8ueCWLyZzxCkFXKe4zYp5fii9LuHjvqLNIFOUB02YWeR1l3vyTaxRfMYUFr/Z LgLluWuQc8206+Lht67RNViyoU3dnXxAmb6eutokwAHNzK4ImfvuVTJGeV0x/uST2wtX b/KtuLnBwuZa9Ex/5tqnvMGS7CoZ9p+I1/IeR67SSq75SU/t2oAXgOTet92h1QcBE+fU mxP1F8WIT53tV9rbVJddYkyzEYF6bbWuGjEWPq1dYw7RO4UblhNFz0a3FwUUxedxeipn KVIWFQEUV2xDzfl4EknoFCupi37GnnyGuVkzOFJ6oPPFSMlaGpbwwAR1HBLa6HCL7q3+ E30w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VVTjzLzY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e28-20020a631e1c000000b0040cd5d37ca3si14522291pge.364.2022.06.27.05.33.08; Mon, 27 Jun 2022 05:33:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VVTjzLzY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234688AbiF0LYI (ORCPT + 99 others); Mon, 27 Jun 2022 07:24:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234653AbiF0LXw (ORCPT ); Mon, 27 Jun 2022 07:23:52 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0278656C; Mon, 27 Jun 2022 04:23:50 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A83ADB8111D; Mon, 27 Jun 2022 11:23:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F20D3C3411D; Mon, 27 Jun 2022 11:23:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1656329028; bh=s2CTaI6UHqs5E2FloxSRNwIUroR1a8kLO48tU7IexVA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VVTjzLzY0EU6PgM019wqYH/1QtOd6yi42O4xOr9/LsNNBbyQiRFrEMy6iOsq5SfUE s+N2jD9aCaqh/4AXSaYSQ3jJV7Ooe6LssR1B0mFOIqo5y6J1Ym4VrEI4Z/nTrAksef FPXGn024xuJ3dAwQJAcZsZRqhpxwwxlP0t7Jo3MM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Marek , Rob Clark , Sasha Levin Subject: [PATCH 5.10 026/102] drm/msm: use for_each_sgtable_sg to iterate over scatterlist Date: Mon, 27 Jun 2022 13:20:37 +0200 Message-Id: <20220627111934.242551543@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220627111933.455024953@linuxfoundation.org> References: <20220627111933.455024953@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Marek [ Upstream commit 62b5e322fb6cc5a5a91fdeba0e4e57e75d9f4387 ] The dma_map_sgtable() call (used to invalidate cache) overwrites sgt->nents with 1, so msm_iommu_pagetable_map maps only the first physical segment. To fix this problem use for_each_sgtable_sg(), which uses orig_nents. Fixes: b145c6e65eb0 ("drm/msm: Add support to create a local pagetable") Signed-off-by: Jonathan Marek Link: https://lore.kernel.org/r/20220613221019.11399-1-jonathan@marek.ca Signed-off-by: Rob Clark Signed-off-by: Sasha Levin --- drivers/gpu/drm/msm/msm_iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/msm/msm_iommu.c b/drivers/gpu/drm/msm/msm_iommu.c index 22ac7c692a81..ecab6287c1c3 100644 --- a/drivers/gpu/drm/msm/msm_iommu.c +++ b/drivers/gpu/drm/msm/msm_iommu.c @@ -58,7 +58,7 @@ static int msm_iommu_pagetable_map(struct msm_mmu *mmu, u64 iova, u64 addr = iova; unsigned int i; - for_each_sg(sgt->sgl, sg, sgt->nents, i) { + for_each_sgtable_sg(sgt, sg, i) { size_t size = sg->length; phys_addr_t phys = sg_phys(sg); -- 2.35.1