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.0 required=3.0 tests=BAYES_00,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 E7891C433E0 for ; Thu, 14 Jan 2021 19:27:39 +0000 (UTC) Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (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 61D6B23B46 for ; Thu, 14 Jan 2021 19:27:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 61D6B23B46 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=iommu-bounces@lists.linux-foundation.org Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id DB1628677D; Thu, 14 Jan 2021 19:27:38 +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 BO6-xQn5NJKX; Thu, 14 Jan 2021 19:27:38 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by whitealder.osuosl.org (Postfix) with ESMTP id EFED184ECF; Thu, 14 Jan 2021 19:27:37 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id D05DAC088B; Thu, 14 Jan 2021 19:27:37 +0000 (UTC) Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 3525FC013A for ; Thu, 14 Jan 2021 19:27:36 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 29B0A86961 for ; Thu, 14 Jan 2021 19:27:36 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 2tqaIY8BfscN for ; Thu, 14 Jan 2021 19:27:35 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-ot1-f53.google.com (mail-ot1-f53.google.com [209.85.210.53]) by hemlock.osuosl.org (Postfix) with ESMTPS id 165CA85754 for ; Thu, 14 Jan 2021 19:27:35 +0000 (UTC) Received: by mail-ot1-f53.google.com with SMTP id c18so468515oto.3 for ; Thu, 14 Jan 2021 11:27:35 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=VEeqdZkDifn0VyJEJKrWR4ztWRK6vfNBUVg/0z1SB/E=; b=hG0VRiqeyWsT0z0+qg5bHt4IQqE+LkPuQUvmh0G8CDnDe2SISAEgQ9nI5vrU12chq/ DZGKDVYM9x1as0ypWzTdBKYn+dQ1jadprMOOWDuPxMTVzXuHcl3wciyphKG0pGFgJ+xN jMRr54eW2taJCFmHYdYCpmjPCahlwIR7y0UjDLlbW/BGdpfGeCiQ01uSdPyBu9iFS02e fXI9iLDA98pneMPkwUCYr/AYMReOuSqbYvU0O3vE+nHcLHXyo/Z2jU22sKVfEhg/hX1S KVY63YEgeSp/vkru86MOapsM8nP6xD/y2agrSvU1W6T9pY9ze0vK/wLiLbqGmQmmlVPI 6Lsw== X-Gm-Message-State: AOAM5313G6fr/htK9tBn/DzFxVQuseta+jj/Gh6OYEBIqVG1uii8dkTB dQ53Aq1BVmLChsemI5jdAQ== X-Google-Smtp-Source: ABdhPJyYwiGGmezeN+wyEHvNPOPyKigxB7dYEfZtRaxnNgEofQKzxycwX+PBMxfL7z5b0J6I8OHScA== X-Received: by 2002:a05:6830:19da:: with SMTP id p26mr5479965otp.80.1610652454370; Thu, 14 Jan 2021 11:27:34 -0800 (PST) Received: from robh.at.kernel.org (24-155-109-49.dyn.grandenetworks.net. [24.155.109.49]) by smtp.gmail.com with ESMTPSA id z189sm1222803oia.28.2021.01.14.11.27.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Jan 2021 11:27:33 -0800 (PST) Received: (nullmailer pid 3425359 invoked by uid 1000); Thu, 14 Jan 2021 19:27:32 -0000 Date: Thu, 14 Jan 2021 13:27:32 -0600 From: Rob Herring To: Yong Wu Subject: Re: [PATCH v6 06/33] of/device: Move dma_range_map before of_iommu_configure Message-ID: <20210114192732.GA3401278@robh.at.kernel.org> References: <20210111111914.22211-1-yong.wu@mediatek.com> <20210111111914.22211-7-yong.wu@mediatek.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210111111914.22211-7-yong.wu@mediatek.com> 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 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 > 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=-14.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,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 554ECC433DB for ; Thu, 14 Jan 2021 19:27:55 +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 B19DB23B46 for ; Thu, 14 Jan 2021 19:27:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B19DB23B46 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org 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:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Oz+tOyiqnCET2g1H83QYWwjulOyDY5uyRDbBXmId9ks=; b=skDJG/+vkx4s5rdpxu+2HmTL9 v6uazHgZL1NYasvPPyQ7Gwr0bt8spBisWNfo+Jv22A2bojPQ9V4EeVR0rxdOSVyCiW3ImSxpwKVJa JeN5uengkAc7lJUMKHjOwFTNU9XE47txL0t6FVKSH/rxkN8w7tdM+DsVG4p32kxncFIRAjFC6mWhg ESzVfTSXGufA8EbJ/dYAUhmylMg9/kB9Ym3d+CdJLjGpY1l+RAjFvT8IDZdU4+f0mymB0KVDxe7UF fRyZwuIcfoMj9vX571qNa0FHQtT8DAh/FgIKWG3IocXPqzooiYu3rjQOmAYaDRKGq67p2O13ksdB6 jzuQJ38FA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l08HR-0001k9-Rb; Thu, 14 Jan 2021 19:27:37 +0000 Received: from mail-ot1-f52.google.com ([209.85.210.52]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l08HP-0001jW-EX; Thu, 14 Jan 2021 19:27:36 +0000 Received: by mail-ot1-f52.google.com with SMTP id r9so6232222otk.11; Thu, 14 Jan 2021 11:27:35 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=VEeqdZkDifn0VyJEJKrWR4ztWRK6vfNBUVg/0z1SB/E=; b=sceyzlufrk8y99eA6kXdeyYRLM2RN0L/qUoUrcczCleGzJviG8QtlDW3p6ER07JePy fd0akFVHv+VMZxiUKAyijzPFP5WWOfxksIhzVzIkkOwTaRz22zCEGaqvsdhoq8UZToFL cmh+rHURLjLSylatQEhBozC7feaX8c+Y0R17/Z+3gJxVGNqzpcNdhEj0aFfBxNz2N/ia mwuI81c8pk/PXgmJisuyLNCn+R3JiVlGWQ4q1Vs33OuUoDmlzNLtbN5UpyFXi+VFSw7D h8DksS90xHNGjvMP2bylPBye4awltnHAAY7qq5q+ecAz3gxiuJ8QoXbHAGXqHoZrrluO 56vQ== X-Gm-Message-State: AOAM533Aqo+AAMk4wZ14th4kPwhueqKRA/OizQX2w+uXAJ9yUOfRdfbx dpKEtIfV9un5AR7wR6V7iw== X-Google-Smtp-Source: ABdhPJyYwiGGmezeN+wyEHvNPOPyKigxB7dYEfZtRaxnNgEofQKzxycwX+PBMxfL7z5b0J6I8OHScA== X-Received: by 2002:a05:6830:19da:: with SMTP id p26mr5479965otp.80.1610652454370; Thu, 14 Jan 2021 11:27:34 -0800 (PST) Received: from robh.at.kernel.org (24-155-109-49.dyn.grandenetworks.net. [24.155.109.49]) by smtp.gmail.com with ESMTPSA id z189sm1222803oia.28.2021.01.14.11.27.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Jan 2021 11:27:33 -0800 (PST) Received: (nullmailer pid 3425359 invoked by uid 1000); Thu, 14 Jan 2021 19:27:32 -0000 Date: Thu, 14 Jan 2021 13:27:32 -0600 From: Rob Herring To: Yong Wu Subject: Re: [PATCH v6 06/33] of/device: Move dma_range_map before of_iommu_configure Message-ID: <20210114192732.GA3401278@robh.at.kernel.org> References: <20210111111914.22211-1-yong.wu@mediatek.com> <20210111111914.22211-7-yong.wu@mediatek.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210111111914.22211-7-yong.wu@mediatek.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210114_142735_509907_62421D98 X-CRM114-Status: GOOD ( 17.34 ) 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 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 > 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=-14.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,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 B5B6DC433E0 for ; Thu, 14 Jan 2021 19:29:06 +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 46BA223B54 for ; Thu, 14 Jan 2021 19:29:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 46BA223B54 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org 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:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=xR/SQwpibe/kW2fzOsWTT/1oIARmn7b5W79wsX5dGII=; b=juJS9UGKCmct3YanGGb7+HCEe DjUDixyfr27FvOi0ct+dgE49IpPwpVH4Ar6BpZ8mtZnY/cOiFapDkHb+df9P8ZEYLVkkMgf0zvlBa WCy1el54g53nFrESypExW77FeOh+I2G2r+g5EIoh+dpZUXDvUpST+i9U5ZR4yAgujxaWjsKLwRzOy GNYhN/YKwT7r5l3TWaE8fDVCYufBHfuWoSdN9X/MqBN8SS2KgGb+Tdzhl3EDk46XluNNbQFGXnLAA MnS6TEs1rMubLWejnBgrmTiJjjBuXDboO6j51k+wIKahI7W4RwjbHSkyLA5ix697px29ivNogCoQT Zut5ERT9A==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l08HS-0001kN-RF; Thu, 14 Jan 2021 19:27:38 +0000 Received: from mail-ot1-f52.google.com ([209.85.210.52]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l08HP-0001jW-EX; Thu, 14 Jan 2021 19:27:36 +0000 Received: by mail-ot1-f52.google.com with SMTP id r9so6232222otk.11; Thu, 14 Jan 2021 11:27:35 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=VEeqdZkDifn0VyJEJKrWR4ztWRK6vfNBUVg/0z1SB/E=; b=sceyzlufrk8y99eA6kXdeyYRLM2RN0L/qUoUrcczCleGzJviG8QtlDW3p6ER07JePy fd0akFVHv+VMZxiUKAyijzPFP5WWOfxksIhzVzIkkOwTaRz22zCEGaqvsdhoq8UZToFL cmh+rHURLjLSylatQEhBozC7feaX8c+Y0R17/Z+3gJxVGNqzpcNdhEj0aFfBxNz2N/ia mwuI81c8pk/PXgmJisuyLNCn+R3JiVlGWQ4q1Vs33OuUoDmlzNLtbN5UpyFXi+VFSw7D h8DksS90xHNGjvMP2bylPBye4awltnHAAY7qq5q+ecAz3gxiuJ8QoXbHAGXqHoZrrluO 56vQ== X-Gm-Message-State: AOAM533Aqo+AAMk4wZ14th4kPwhueqKRA/OizQX2w+uXAJ9yUOfRdfbx dpKEtIfV9un5AR7wR6V7iw== X-Google-Smtp-Source: ABdhPJyYwiGGmezeN+wyEHvNPOPyKigxB7dYEfZtRaxnNgEofQKzxycwX+PBMxfL7z5b0J6I8OHScA== X-Received: by 2002:a05:6830:19da:: with SMTP id p26mr5479965otp.80.1610652454370; Thu, 14 Jan 2021 11:27:34 -0800 (PST) Received: from robh.at.kernel.org (24-155-109-49.dyn.grandenetworks.net. [24.155.109.49]) by smtp.gmail.com with ESMTPSA id z189sm1222803oia.28.2021.01.14.11.27.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Jan 2021 11:27:33 -0800 (PST) Received: (nullmailer pid 3425359 invoked by uid 1000); Thu, 14 Jan 2021 19:27:32 -0000 Date: Thu, 14 Jan 2021 13:27:32 -0600 From: Rob Herring To: Yong Wu Subject: Re: [PATCH v6 06/33] of/device: Move dma_range_map before of_iommu_configure Message-ID: <20210114192732.GA3401278@robh.at.kernel.org> References: <20210111111914.22211-1-yong.wu@mediatek.com> <20210111111914.22211-7-yong.wu@mediatek.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210111111914.22211-7-yong.wu@mediatek.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210114_142735_509907_62421D98 X-CRM114-Status: GOOD ( 17.34 ) 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 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 > 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=-14.0 required=3.0 tests=BAYES_00,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 F02F4C433DB for ; Thu, 14 Jan 2021 19:28:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A57FF23B54 for ; Thu, 14 Jan 2021 19:28:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727205AbhANT2P (ORCPT ); Thu, 14 Jan 2021 14:28:15 -0500 Received: from mail-ot1-f53.google.com ([209.85.210.53]:45417 "EHLO mail-ot1-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726874AbhANT2P (ORCPT ); Thu, 14 Jan 2021 14:28:15 -0500 Received: by mail-ot1-f53.google.com with SMTP id n42so6227982ota.12; Thu, 14 Jan 2021 11:27:59 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=VEeqdZkDifn0VyJEJKrWR4ztWRK6vfNBUVg/0z1SB/E=; b=gjx4xyDZJHjp5pQEKM4eIrncsn8uhTrQOeOPtYGuIkyutl0GMpb1uJpoDbjJY9CIze dQc0w60jQrt5uk2cmzZ2ktI33gGMeG0Qxf8Nv6M3BNwf4x5C5nTHUImXYq9u1p0tgWJe Waz3/gpmhQALZaIa+k3wm+AaMkASJFGK9GRQuJQqX77B+31u9oTc78m2RR41dz+286Ec /rJjszFOBdCf5X9dAKVsriNn+oFSdrAJhPCKbfk4O0NPfsI7WREei3qEtGewqnL/coVq CwoTmZlDf2tlO+WFrF1UA08uddQ0lBIkjWVRSzMuo7QsWTSgasHMumWX9W5IJBBBCiKZ Cz4A== X-Gm-Message-State: AOAM531EQudWYGA+zIjlbCKV+Coe+V9JWCTLfscQjVcDNwOfUlEiFKPP uAdGbM96H0hK0DD2X+RFXg== X-Google-Smtp-Source: ABdhPJyYwiGGmezeN+wyEHvNPOPyKigxB7dYEfZtRaxnNgEofQKzxycwX+PBMxfL7z5b0J6I8OHScA== X-Received: by 2002:a05:6830:19da:: with SMTP id p26mr5479965otp.80.1610652454370; Thu, 14 Jan 2021 11:27:34 -0800 (PST) Received: from robh.at.kernel.org (24-155-109-49.dyn.grandenetworks.net. [24.155.109.49]) by smtp.gmail.com with ESMTPSA id z189sm1222803oia.28.2021.01.14.11.27.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Jan 2021 11:27:33 -0800 (PST) Received: (nullmailer pid 3425359 invoked by uid 1000); Thu, 14 Jan 2021 19:27:32 -0000 Date: Thu, 14 Jan 2021 13:27:32 -0600 From: Rob Herring To: Yong Wu Cc: Joerg Roedel , Matthias Brugger , Will Deacon , Robin Murphy , Krzysztof Kozlowski , Evan Green , Tomasz Figa , linux-mediatek@lists.infradead.org, srv_heupstream@mediatek.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, iommu@lists.linux-foundation.org, youlin.pei@mediatek.com, Nicolas Boichat , anan.sun@mediatek.com, chao.hao@mediatek.com, Frank Rowand Subject: Re: [PATCH v6 06/33] of/device: Move dma_range_map before of_iommu_configure Message-ID: <20210114192732.GA3401278@robh.at.kernel.org> References: <20210111111914.22211-1-yong.wu@mediatek.com> <20210111111914.22211-7-yong.wu@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210111111914.22211-7-yong.wu@mediatek.com> Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org 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 > 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 >