From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B637AC433E6 for ; Wed, 27 Jan 2021 13:03:23 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 71706207A3 for ; Wed, 27 Jan 2021 13:03:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 71706207A3 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bootlin.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Type:Cc: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: In-Reply-To:MIME-Version:References:Message-ID:Subject:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=PUDyW9vdW06+qhrbW8popjNDX535uPWg1ZKOly14R6I=; b=BnqM9/1DbzqfKOVtAt3JrAsEf FjcYUBlTz9doKAC4XyCzc8YhnhDRy+4LdCezcR0T7C3kjHJGF4dSeNad0D79531vLO51QaWODW8fJ s4L8QQcXij7yq28YrX8aBB2E7TZ452UBRXcmmCyhSKCvGuJlFgMm+2aB9yYDcRYkYFrM8JPIhcDRD ARWZ1VOKPUUq9Swf1u5QO5RGfCE05+abCMiZ8oYGWGxYuDII/scjUMoqo9BeiASPpko+QCKiWcak5 kIVO6ROUmxl9zSGKh8S+Gq38bhmWvZPdNo4LlHXoKl47z7JUfO1YEDRIMu9RqNDvX3PunG9n4oP1x tzMOfBInA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l4kRS-00045M-Kl; Wed, 27 Jan 2021 13:01:02 +0000 Received: from relay5-d.mail.gandi.net ([217.70.183.197]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l4kRJ-00041m-Fc; Wed, 27 Jan 2021 13:00:55 +0000 X-Originating-IP: 93.29.109.196 Received: from aptenodytes (196.109.29.93.rev.sfr.net [93.29.109.196]) (Authenticated sender: paul.kocialkowski@bootlin.com) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 9A2151C000A; Wed, 27 Jan 2021 13:00:40 +0000 (UTC) Date: Wed, 27 Jan 2021 14:00:39 +0100 From: Paul Kocialkowski To: Yong Wu Subject: Re: [PATCH v2] of/device: Update dma_range_map only when dev has valid dma-ranges Message-ID: References: <20210119105203.15530-1-yong.wu@mediatek.com> MIME-Version: 1.0 In-Reply-To: <20210119105203.15530-1-yong.wu@mediatek.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210127_080053_828908_3DF7F671 X-CRM114-Status: GOOD ( 22.85 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Nicolas Boichat , srv_heupstream@mediatek.com, Will Deacon , Joerg Roedel , Frank Rowand , linux-kernel@vger.kernel.org, Krzysztof Kozlowski , Tomasz Figa , iommu@lists.linux-foundation.org, Rob Herring , linux-mediatek@lists.infradead.org, Matthias Brugger , Robin Murphy , linux-arm-kernel@lists.infradead.org Content-Type: multipart/mixed; boundary="===============6943755511374209491==" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org --===============6943755511374209491== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="BIH3KrdpdMNN62Ds" Content-Disposition: inline --BIH3KrdpdMNN62Ds Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi, On Tue 19 Jan 21, 18:52, Yong Wu wrote: > The commit e0d072782c73 ("dma-mapping: introduce DMA range map, > supplanting dma_pfn_offset") always update dma_range_map even though it w= as > already set, like in the sunxi_mbus driver. the issue is reported at [1]. > This patch avoid this(Updating it only when dev has valid dma-ranges). >=20 > Meanwhile, dma_range_map contains the devices' dma_ranges information, > This patch moves dma_range_map before of_iommu_configure. The iommu > driver may need to know the dma_address requirements of its iommu > consumer devices. Just a gentle ping on this issue, it would be nice to have this fix merged ASAP, in the next RC :) Cheers, Paul > [1] https://lore.kernel.org/linux-arm-kernel/5c7946f3-b56e-da00-a750-be09= 7c7ceb32@arm.com/ >=20 > CC: Rob Herring > CC: Frank Rowand > Fixes: e0d072782c73 ("dma-mapping: introduce DMA range map, supplanting d= ma_pfn_offset"), > Suggested-by: Robin Murphy > Signed-off-by: Yong Wu > Signed-off-by: Paul Kocialkowski > Reviewed-by: Rob Herring > --- > drivers/of/device.c | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) >=20 > diff --git a/drivers/of/device.c b/drivers/of/device.c > index aedfaaafd3e7..1122daa8e273 100644 > --- a/drivers/of/device.c > +++ b/drivers/of/device.c > @@ -162,9 +162,11 @@ int of_dma_configure_id(struct device *dev, struct d= evice_node *np, > mask =3D DMA_BIT_MASK(ilog2(end) + 1); > dev->coherent_dma_mask &=3D mask; > *dev->dma_mask &=3D mask; > - /* ...but only set bus limit if we found valid dma-ranges earlier */ > - if (!ret) > + /* ...but only set bus limit and range map if we found valid dma-ranges= earlier */ > + if (!ret) { > dev->bus_dma_limit =3D end; > + dev->dma_range_map =3D map; > + } > =20 > coherent =3D of_dma_is_coherent(np); > dev_dbg(dev, "device is%sdma coherent\n", > @@ -172,6 +174,9 @@ int of_dma_configure_id(struct device *dev, struct de= vice_node *np, > =20 > iommu =3D of_iommu_configure(dev, np, id); > if (PTR_ERR(iommu) =3D=3D -EPROBE_DEFER) { > + /* Don't touch range map if it wasn't set from a valid dma-ranges */ > + if (!ret) > + dev->dma_range_map =3D NULL; > kfree(map); > return -EPROBE_DEFER; > } > @@ -181,7 +186,6 @@ int of_dma_configure_id(struct device *dev, struct de= vice_node *np, > =20 > arch_setup_dma_ops(dev, dma_start, size, iommu, coherent); > =20 > - dev->dma_range_map =3D map; > return 0; > } > EXPORT_SYMBOL_GPL(of_dma_configure_id); > --=20 > 2.18.0 >=20 --=20 Paul Kocialkowski, Bootlin Embedded Linux and kernel engineering https://bootlin.com --BIH3KrdpdMNN62Ds Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEJZpWjZeIetVBefti3cLmz3+fv9EFAmARY/cACgkQ3cLmz3+f v9HHbgf/Rk9Hu0kUW5B3MNVJs1JlKh376ihTjnZEjV3Xo7c4YP4KwGcTzAB2AMY2 ja2o4bLiLOBTOVExH1kXCmXuxvlgvumq3H9Zxi0+Ef/5ZPPlmi915WuSw440Seg3 t3W638nzVrqrIcvKa6YiS41UV5CbYGKHhBiInpPDdK3FbSDzRMSFkr3EKFdhNK1F qgL/9PV6WpamufJW589cWXQFumazQN/kz+zop1kD0jqWbNiSKM4rNz5j4PvH5iwj uQFWwUF/nuPfiEMCTeICiFrtgMTpl6QqiZqAUenTk+wuPeB7Xk0mXg0kaFmeUYpX k9INUJJAqUv96+i8ZW2lfOnI7fo90g== =2oxl -----END PGP SIGNATURE----- --BIH3KrdpdMNN62Ds-- --===============6943755511374209491== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel --===============6943755511374209491==--