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=-15.0 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,URIBL_BLOCKED, USER_AGENT_SANE_2 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 E8AC6C433DB for ; Fri, 15 Jan 2021 05:31:44 +0000 (UTC) Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (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 7937C239FC for ; Fri, 15 Jan 2021 05:31:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7937C239FC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=iommu-bounces@lists.linux-foundation.org Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 245F086A70; Fri, 15 Jan 2021 05:31:44 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id lj2RBIqIp3xx; Fri, 15 Jan 2021 05:31:42 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by fraxinus.osuosl.org (Postfix) with ESMTP id 3ABE286A1A; Fri, 15 Jan 2021 05:31:42 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 10780C088B; Fri, 15 Jan 2021 05:31:42 +0000 (UTC) Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 37909C013A for ; Fri, 15 Jan 2021 05:31:40 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 1A89B86A09 for ; Fri, 15 Jan 2021 05:31:40 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7SgOSdiGFtQJ for ; Fri, 15 Jan 2021 05:31:38 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mailgw01.mediatek.com (unknown [1.203.163.78]) by whitealder.osuosl.org (Postfix) with ESMTP id DE1E0869C1 for ; Fri, 15 Jan 2021 05:31:34 +0000 (UTC) X-UUID: 24067ff830cf4529bc716d71bc9e2947-20210115 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:MIME-Version:Content-Type:References:In-Reply-To:Date:CC:To:From:Subject:Message-ID; bh=8Xzi4Jk1vwim8FSqpSrcJwUMLUAt5CxpsEAeeSgDR/A=; b=PK0jmoLWR1BxE3osY8lzT6Um7Kk6obLEEprp0Kb//ACrnXkZRBG4wYmCjDanxe0vfxHJrw6xU5RvkZ7UgjHjDI3vQuTiHXrtNVFMfKmp7Zz0waeRwAex8g/AWAUpaxgsW/rRTSzwXQNsRzSv7mE9rsNGDAQZ/kZja+BbEjbP6OA=; X-UUID: 24067ff830cf4529bc716d71bc9e2947-20210115 Received: from mtkcas34.mediatek.inc [(172.27.4.253)] by mailgw01.mediatek.com (envelope-from ) (mailgw01.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 851705744; Fri, 15 Jan 2021 13:30:33 +0800 Received: from MTKCAS36.mediatek.inc (172.27.4.186) by MTKMBS31N1.mediatek.inc (172.27.4.69) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 15 Jan 2021 13:30:27 +0800 Received: from [10.17.3.153] (10.17.3.153) by MTKCAS36.mediatek.inc (172.27.4.170) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Fri, 15 Jan 2021 13:30:26 +0800 Message-ID: <1610688626.4578.1.camel@mhfsdcap03> Subject: Re: [PATCH v6 06/33] of/device: Move dma_range_map before of_iommu_configure From: Yong Wu To: Rob Herring Date: Fri, 15 Jan 2021 13:30:26 +0800 In-Reply-To: <20210114192732.GA3401278@robh.at.kernel.org> References: <20210111111914.22211-1-yong.wu@mediatek.com> <20210111111914.22211-7-yong.wu@mediatek.com> <20210114192732.GA3401278@robh.at.kernel.org> X-Mailer: Evolution 3.10.4-0ubuntu2 MIME-Version: 1.0 X-TM-SNTS-SMTP: 84A856FA60FFA5913CE06B0A418092BC787D34670283D643131FDFCEE268D07C2000:8 X-MTK: N Cc: youlin.pei@mediatek.com, devicetree@vger.kernel.org, Nicolas Boichat , srv_heupstream@mediatek.com, chao.hao@mediatek.com, Will Deacon , Frank Rowand , linux-kernel@vger.kernel.org, Evan Green , Tomasz Figa , iommu@lists.linux-foundation.org, linux-mediatek@lists.infradead.org, Krzysztof Kozlowski , Matthias Brugger , anan.sun@mediatek.com, Robin Murphy , linux-arm-kernel@lists.infradead.org X-BeenThere: iommu@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Development issues for Linux IOMMU support List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: iommu-bounces@lists.linux-foundation.org Sender: "iommu" On Thu, 2021-01-14 at 13:27 -0600, Rob Herring wrote: > On Mon, Jan 11, 2021 at 07:18:47PM +0800, Yong Wu wrote: > > "dev->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. > > > > CC: Rob Herring > > CC: Frank Rowand > > Signed-off-by: Yong Wu > > --- > > drivers/of/device.c | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/of/device.c b/drivers/of/device.c > > index aedfaaafd3e7..1d84636149df 100644 > > --- a/drivers/of/device.c > > +++ b/drivers/of/device.c > > @@ -170,9 +170,11 @@ int of_dma_configure_id(struct device *dev, struct device_node *np, > > dev_dbg(dev, "device is%sdma coherent\n", > > coherent ? " " : " not "); > > > > + dev->dma_range_map = map; > > iommu = of_iommu_configure(dev, np, id); > > if (PTR_ERR(iommu) == -EPROBE_DEFER) { > > kfree(map); > > + dev->dma_range_map = NULL; > > Not really going to matter, but you should probably clear dma_range_map > before what it points to is freed. > > With that, > > Reviewed-by: Rob Herring Thanks for the review. I will move it before "kfree(map)" in next version. > > > return -EPROBE_DEFER; > > } > > > > @@ -181,7 +183,6 @@ int of_dma_configure_id(struct device *dev, struct device_node *np, > > > > arch_setup_dma_ops(dev, dma_start, size, iommu, coherent); > > > > - dev->dma_range_map = map; > > return 0; > > } > > EXPORT_SYMBOL_GPL(of_dma_configure_id); > > -- > > 2.18.0 > > _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu 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=-15.5 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,UNPARSEABLE_RELAY, URIBL_BLOCKED,USER_AGENT_SANE_2 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 8EA82C433DB for ; Fri, 15 Jan 2021 05:31:08 +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 3185C239EF for ; Fri, 15 Jan 2021 05:31:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3185C239EF Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+linux-mediatek=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-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Date:To:From: Subject:Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=bYL/rko7+sJY2CaCksN0oumcohQnN9sTFFK2T9DJIBw=; b=JHWCRfqNAIkpVqLKJ+0SZQQtg o1oArnwkmhP4+w8hYHJNOryDqd4S1WQTg6gd8OXn07JrDSCS3XKkU7e1CeVFqe/tuVWK5vebYoyE/ gS036orUmW2IhmRDVwGg7cdQKWxXU1TUE/SaLVsAPtwfJW7xFREMkXyzdYdv4UjtwUU3wwDmNBSYY hAzIzWuxTnvUXC8Ru+iqavCNli+Hegb1eWtoN/c7in+g7XvXZKfdyTd4h14/yAIVa8Wuaya1Qt6lB l3LUV70XtCZCUekZb/6gS/7tlhxTd8DQ7UHKSKcuzlZw7M6u/I9JASwZLbBg0RKzGDfy1KfJftUzb Q4KP0dkcA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l0HhB-0001VA-2m; Fri, 15 Jan 2021 05:30:49 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l0Hh4-0001Tj-UJ; Fri, 15 Jan 2021 05:30:45 +0000 X-UUID: ffccda5d60164ae591b9571125478c42-20210114 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:MIME-Version:Content-Type:References:In-Reply-To:Date:CC:To:From:Subject:Message-ID; bh=8Xzi4Jk1vwim8FSqpSrcJwUMLUAt5CxpsEAeeSgDR/A=; b=KP0F6rz5HRRpj5ET6flowpLf9ANavMzQNi4XPKpHOvI8JsVItgAlbTbA2ZLVNhz9BJx75oh5fvjdZThGl3uCZAH0WmX12GDYfHyVQ96cfdz5Cxe1s/Qf98XdpUgZ2FF8g59mQlIE0ejU023cxfYoOXhVxqR0uzcNq5eQQ0cnQaU=; X-UUID: ffccda5d60164ae591b9571125478c42-20210114 Received: from mtkcas68.mediatek.inc [(172.29.94.19)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1355738179; Thu, 14 Jan 2021 21:30:35 -0800 Received: from MTKMBS31N1.mediatek.inc (172.27.4.69) by MTKMBS62N1.mediatek.inc (172.29.193.41) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 14 Jan 2021 21:30:34 -0800 Received: from MTKCAS36.mediatek.inc (172.27.4.186) by MTKMBS31N1.mediatek.inc (172.27.4.69) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 15 Jan 2021 13:30:27 +0800 Received: from [10.17.3.153] (10.17.3.153) by MTKCAS36.mediatek.inc (172.27.4.170) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Fri, 15 Jan 2021 13:30:26 +0800 Message-ID: <1610688626.4578.1.camel@mhfsdcap03> Subject: Re: [PATCH v6 06/33] of/device: Move dma_range_map before of_iommu_configure From: Yong Wu To: Rob Herring Date: Fri, 15 Jan 2021 13:30:26 +0800 In-Reply-To: <20210114192732.GA3401278@robh.at.kernel.org> References: <20210111111914.22211-1-yong.wu@mediatek.com> <20210111111914.22211-7-yong.wu@mediatek.com> <20210114192732.GA3401278@robh.at.kernel.org> X-Mailer: Evolution 3.10.4-0ubuntu2 MIME-Version: 1.0 X-TM-SNTS-SMTP: 84A856FA60FFA5913CE06B0A418092BC787D34670283D643131FDFCEE268D07C2000:8 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210115_003043_763380_0B11C1FB X-CRM114-Status: GOOD ( 19.03 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: youlin.pei@mediatek.com, devicetree@vger.kernel.org, Nicolas Boichat , srv_heupstream@mediatek.com, chao.hao@mediatek.com, Will Deacon , Joerg Roedel , Frank Rowand , linux-kernel@vger.kernel.org, Evan Green , Tomasz Figa , iommu@lists.linux-foundation.org, linux-mediatek@lists.infradead.org, Krzysztof Kozlowski , Matthias Brugger , anan.sun@mediatek.com, Robin Murphy , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org On Thu, 2021-01-14 at 13:27 -0600, Rob Herring wrote: > On Mon, Jan 11, 2021 at 07:18:47PM +0800, Yong Wu wrote: > > "dev->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. > > > > CC: Rob Herring > > CC: Frank Rowand > > Signed-off-by: Yong Wu > > --- > > drivers/of/device.c | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/of/device.c b/drivers/of/device.c > > index aedfaaafd3e7..1d84636149df 100644 > > --- a/drivers/of/device.c > > +++ b/drivers/of/device.c > > @@ -170,9 +170,11 @@ int of_dma_configure_id(struct device *dev, struct device_node *np, > > dev_dbg(dev, "device is%sdma coherent\n", > > coherent ? " " : " not "); > > > > + dev->dma_range_map = map; > > iommu = of_iommu_configure(dev, np, id); > > if (PTR_ERR(iommu) == -EPROBE_DEFER) { > > kfree(map); > > + dev->dma_range_map = NULL; > > Not really going to matter, but you should probably clear dma_range_map > before what it points to is freed. > > With that, > > Reviewed-by: Rob Herring Thanks for the review. I will move it before "kfree(map)" in next version. > > > return -EPROBE_DEFER; > > } > > > > @@ -181,7 +183,6 @@ int of_dma_configure_id(struct device *dev, struct device_node *np, > > > > arch_setup_dma_ops(dev, dma_start, size, iommu, coherent); > > > > - dev->dma_range_map = map; > > return 0; > > } > > EXPORT_SYMBOL_GPL(of_dma_configure_id); > > -- > > 2.18.0 > > _______________________________________________ Linux-mediatek mailing list Linux-mediatek@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-mediatek 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=-15.5 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,UNPARSEABLE_RELAY, URIBL_BLOCKED,USER_AGENT_SANE_2 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 55690C433DB for ; Fri, 15 Jan 2021 05:32:19 +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 EAE1A239EF for ; Fri, 15 Jan 2021 05:32:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EAE1A239EF Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.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-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Date:To:From: Subject:Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=SZAmHPcuDtOcGQuZ9ZiTy+/VId6dt8jghoKYfZyqJ/A=; b=yl0eYaCSGfNSwhtZsFKX2QII1 xP2juEC6whW5ZxElxvO46pn35yAzr79IzG1yruRHyuksniwAhQOQKdFa0wniVZkpdmTy4dsuy0B0A HUvxQSsZ5vPBPwR05PLNQzuUu9GjzUy8p1EIN3omqpXoMLF8f2FNEh1l9dLTNFuiWgtOyyVmOK/kv oCSTAme06vVChjUx5Nx80MqbGo4VQea73JSw1Jo6IBap+ubBAZhSSbrFofUzkSy0Fbx7Cft+woxbd X5JLliaWWSe9g1HTAANBH99InVBy5vzTyqReKEjGPcLSTe7MD6U1p8zUxz4tQTnmzh4iH4JQFV6Jr i93cY7a2Q==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l0Hh9-0001Um-HS; Fri, 15 Jan 2021 05:30:47 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l0Hh4-0001Tj-UJ; Fri, 15 Jan 2021 05:30:45 +0000 X-UUID: ffccda5d60164ae591b9571125478c42-20210114 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:MIME-Version:Content-Type:References:In-Reply-To:Date:CC:To:From:Subject:Message-ID; bh=8Xzi4Jk1vwim8FSqpSrcJwUMLUAt5CxpsEAeeSgDR/A=; b=KP0F6rz5HRRpj5ET6flowpLf9ANavMzQNi4XPKpHOvI8JsVItgAlbTbA2ZLVNhz9BJx75oh5fvjdZThGl3uCZAH0WmX12GDYfHyVQ96cfdz5Cxe1s/Qf98XdpUgZ2FF8g59mQlIE0ejU023cxfYoOXhVxqR0uzcNq5eQQ0cnQaU=; X-UUID: ffccda5d60164ae591b9571125478c42-20210114 Received: from mtkcas68.mediatek.inc [(172.29.94.19)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1355738179; Thu, 14 Jan 2021 21:30:35 -0800 Received: from MTKMBS31N1.mediatek.inc (172.27.4.69) by MTKMBS62N1.mediatek.inc (172.29.193.41) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 14 Jan 2021 21:30:34 -0800 Received: from MTKCAS36.mediatek.inc (172.27.4.186) by MTKMBS31N1.mediatek.inc (172.27.4.69) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 15 Jan 2021 13:30:27 +0800 Received: from [10.17.3.153] (10.17.3.153) by MTKCAS36.mediatek.inc (172.27.4.170) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Fri, 15 Jan 2021 13:30:26 +0800 Message-ID: <1610688626.4578.1.camel@mhfsdcap03> Subject: Re: [PATCH v6 06/33] of/device: Move dma_range_map before of_iommu_configure From: Yong Wu To: Rob Herring Date: Fri, 15 Jan 2021 13:30:26 +0800 In-Reply-To: <20210114192732.GA3401278@robh.at.kernel.org> References: <20210111111914.22211-1-yong.wu@mediatek.com> <20210111111914.22211-7-yong.wu@mediatek.com> <20210114192732.GA3401278@robh.at.kernel.org> X-Mailer: Evolution 3.10.4-0ubuntu2 MIME-Version: 1.0 X-TM-SNTS-SMTP: 84A856FA60FFA5913CE06B0A418092BC787D34670283D643131FDFCEE268D07C2000:8 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210115_003043_763380_0B11C1FB X-CRM114-Status: GOOD ( 19.03 ) 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: youlin.pei@mediatek.com, devicetree@vger.kernel.org, Nicolas Boichat , srv_heupstream@mediatek.com, chao.hao@mediatek.com, Will Deacon , Joerg Roedel , Frank Rowand , linux-kernel@vger.kernel.org, Evan Green , Tomasz Figa , iommu@lists.linux-foundation.org, linux-mediatek@lists.infradead.org, Krzysztof Kozlowski , Matthias Brugger , anan.sun@mediatek.com, Robin Murphy , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, 2021-01-14 at 13:27 -0600, Rob Herring wrote: > On Mon, Jan 11, 2021 at 07:18:47PM +0800, Yong Wu wrote: > > "dev->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. > > > > CC: Rob Herring > > CC: Frank Rowand > > Signed-off-by: Yong Wu > > --- > > drivers/of/device.c | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/of/device.c b/drivers/of/device.c > > index aedfaaafd3e7..1d84636149df 100644 > > --- a/drivers/of/device.c > > +++ b/drivers/of/device.c > > @@ -170,9 +170,11 @@ int of_dma_configure_id(struct device *dev, struct device_node *np, > > dev_dbg(dev, "device is%sdma coherent\n", > > coherent ? " " : " not "); > > > > + dev->dma_range_map = map; > > iommu = of_iommu_configure(dev, np, id); > > if (PTR_ERR(iommu) == -EPROBE_DEFER) { > > kfree(map); > > + dev->dma_range_map = NULL; > > Not really going to matter, but you should probably clear dma_range_map > before what it points to is freed. > > With that, > > Reviewed-by: Rob Herring Thanks for the review. I will move it before "kfree(map)" in next version. > > > return -EPROBE_DEFER; > > } > > > > @@ -181,7 +183,6 @@ int of_dma_configure_id(struct device *dev, struct device_node *np, > > > > arch_setup_dma_ops(dev, dma_start, size, iommu, coherent); > > > > - dev->dma_range_map = map; > > return 0; > > } > > EXPORT_SYMBOL_GPL(of_dma_configure_id); > > -- > > 2.18.0 > > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel 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=-17.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, URIBL_BLOCKED,USER_AGENT_SANE_2 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 7515AC433E0 for ; Fri, 15 Jan 2021 05:31:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 33E5C239FC for ; Fri, 15 Jan 2021 05:31:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727679AbhAOFbj (ORCPT ); Fri, 15 Jan 2021 00:31:39 -0500 Received: from Mailgw01.mediatek.com ([1.203.163.78]:49219 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726019AbhAOFbj (ORCPT ); Fri, 15 Jan 2021 00:31:39 -0500 X-UUID: 24067ff830cf4529bc716d71bc9e2947-20210115 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:MIME-Version:Content-Type:References:In-Reply-To:Date:CC:To:From:Subject:Message-ID; bh=8Xzi4Jk1vwim8FSqpSrcJwUMLUAt5CxpsEAeeSgDR/A=; b=PK0jmoLWR1BxE3osY8lzT6Um7Kk6obLEEprp0Kb//ACrnXkZRBG4wYmCjDanxe0vfxHJrw6xU5RvkZ7UgjHjDI3vQuTiHXrtNVFMfKmp7Zz0waeRwAex8g/AWAUpaxgsW/rRTSzwXQNsRzSv7mE9rsNGDAQZ/kZja+BbEjbP6OA=; X-UUID: 24067ff830cf4529bc716d71bc9e2947-20210115 Received: from mtkcas34.mediatek.inc [(172.27.4.253)] by mailgw01.mediatek.com (envelope-from ) (mailgw01.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 851705744; Fri, 15 Jan 2021 13:30:33 +0800 Received: from MTKCAS36.mediatek.inc (172.27.4.186) by MTKMBS31N1.mediatek.inc (172.27.4.69) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 15 Jan 2021 13:30:27 +0800 Received: from [10.17.3.153] (10.17.3.153) by MTKCAS36.mediatek.inc (172.27.4.170) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Fri, 15 Jan 2021 13:30:26 +0800 Message-ID: <1610688626.4578.1.camel@mhfsdcap03> Subject: Re: [PATCH v6 06/33] of/device: Move dma_range_map before of_iommu_configure From: Yong Wu To: Rob Herring CC: Joerg Roedel , Matthias Brugger , Will Deacon , Robin Murphy , Krzysztof Kozlowski , Evan Green , Tomasz Figa , , , , , , , , Nicolas Boichat , , , Frank Rowand Date: Fri, 15 Jan 2021 13:30:26 +0800 In-Reply-To: <20210114192732.GA3401278@robh.at.kernel.org> References: <20210111111914.22211-1-yong.wu@mediatek.com> <20210111111914.22211-7-yong.wu@mediatek.com> <20210114192732.GA3401278@robh.at.kernel.org> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.10.4-0ubuntu2 MIME-Version: 1.0 X-TM-SNTS-SMTP: 84A856FA60FFA5913CE06B0A418092BC787D34670283D643131FDFCEE268D07C2000:8 X-MTK: N Content-Transfer-Encoding: base64 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org T24gVGh1LCAyMDIxLTAxLTE0IGF0IDEzOjI3IC0wNjAwLCBSb2IgSGVycmluZyB3cm90ZToNCj4g T24gTW9uLCBKYW4gMTEsIDIwMjEgYXQgMDc6MTg6NDdQTSArMDgwMCwgWW9uZyBXdSB3cm90ZToN Cj4gPiAiZGV2LT5kbWFfcmFuZ2VfbWFwIiBjb250YWlucyB0aGUgZGV2aWNlcycgZG1hX3Jhbmdl cyBpbmZvcm1hdGlvbiwNCj4gPiBUaGlzIHBhdGNoIG1vdmVzIGRtYV9yYW5nZV9tYXAgYmVmb3Jl IG9mX2lvbW11X2NvbmZpZ3VyZS4gVGhlIGlvbW11DQo+ID4gZHJpdmVyIG1heSBuZWVkIHRvIGtu b3cgdGhlIGRtYV9hZGRyZXNzIHJlcXVpcmVtZW50cyBvZiBpdHMgaW9tbXUNCj4gPiBj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