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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7CB47C4332F for ; Mon, 31 Jan 2022 12:30:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241728AbiAaM36 (ORCPT ); Mon, 31 Jan 2022 07:29:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229786AbiAaM3z (ORCPT ); Mon, 31 Jan 2022 07:29:55 -0500 Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 63448C061714; Mon, 31 Jan 2022 04:29:55 -0800 (PST) Received: by mail-wr1-x435.google.com with SMTP id k18so25103422wrg.11; Mon, 31 Jan 2022 04:29:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :cc:references:from:in-reply-to:content-transfer-encoding; bh=XfDEtvQ/tzVD1YeBowq1DH94HINF3JBGxRgfDDz4P9Q=; b=W4NHjEA+9XVVL8xz6qTEqQvruINpNG1pl5p/yaTwPsUbqDWoTdwk6B90cytFkMTHZT lrQuJGMCrkrs3FC5BaobUmorxlxni/0C26+D4VsSXYqKlUY8Ar8xiHI3b74c2sMVkTLU gSKadOZdH4vnOVfaH7dEpE2s9zlDj36v/3eMYHeSfAyUcZJ1HDwwiM1nyWsQnV4O0yRb O1xd+UqJM3rUINASsACdI5OKMhaHlXLsyvVO9ERwrZUlIgIG7kIn8nF6cUlGtvVMzycp 83qu/fIP/2WVZAxPlTcZxmh9pHc3byTUiIOGNQbWxrf5VMQI0tURoHxAzof9DE6mx1vg FIAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=XfDEtvQ/tzVD1YeBowq1DH94HINF3JBGxRgfDDz4P9Q=; b=pB+fn8DDCI07v69lujnSCYAORy8YAhCznFgb57yOEw39spEtyPA8G+/pvj1b8TnRPI hQFQIJeSBbq5ik0BDH49jl49fCSrAWo4RIdxUnJOGy6YTetfuB+UvnRYgggXINwSlpXm brcmVg+N8XWgimjSEPTlEgfpa54RRafXCKUSIuj4ZLR59ROeaa3z/DtzaYhir1EpxoII 6J6QDlMkbcLVHuag+FwRkgxzv9JfvjQYUYO/G3rM1DQOwyDaT3enZn5AMoZW2R/kmgt5 Gje0TY4sfzgWPzDJKFlbjsd9dQmFn81aI9AH+fZis5d3Fsg8Of7P2pz6zslBhYnE4V+b V/Mw== X-Gm-Message-State: AOAM531p10YYEUPiYv3Rz/m+8wBmQktZy86pwFLk9dRDHhUhI08IMMoe oy8OdpBiNG6Qlsgy56OiLR8= X-Google-Smtp-Source: ABdhPJwKPAOlfE8A7dNEWpNDKJVV/rApo0lar6YbP+IVu/WUEb/GzeZxyimip5vdiaqDYs3eC4tjRQ== X-Received: by 2002:a05:6000:1548:: with SMTP id 8mr16792438wry.504.1643632193762; Mon, 31 Jan 2022 04:29:53 -0800 (PST) Received: from [192.168.0.14] ([37.223.145.74]) by smtp.gmail.com with ESMTPSA id m12sm13729547wrp.61.2022.01.31.04.29.51 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 31 Jan 2022 04:29:53 -0800 (PST) Message-ID: <5991ad51-4181-d445-284c-386447cffb95@gmail.com> Date: Mon, 31 Jan 2022 13:29:51 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH v10 02/13] iommu/mediatek-v1: Free the existed fwspec if the master dev already has Content-Language: en-US To: Mauro Carvalho Chehab , Yong Wu Cc: Hans Verkuil , Joerg Roedel , Rob Herring , Krzysztof Kozlowski , David Airlie , Evan Green , Robin Murphy , Tomasz Figa , Will Deacon , 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, Matthias Kaehlcke , anan.sun@mediatek.com, yi.kuo@mediatek.com, acourbot@chromium.org, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, Daniel Vetter , Chun-Kuang Hu , Philipp Zabel , Tiffany Lin , Dafna Hirschfeld , Hsin-Yi Wang , Eizan Miyamoto , anthony.huang@mediatek.com, Frank Wunderlich , mingyuan.ma@mediatek.com, yf.wang@mediatek.com, libo.kang@mediatek.com, AngeloGioacchino Del Regno References: <20220117070510.17642-1-yong.wu@mediatek.com> <20220117070510.17642-3-yong.wu@mediatek.com> <20220128134055.720bb43c@coco.lan> <20220128134540.00c6c380@coco.lan> From: Matthias Brugger In-Reply-To: <20220128134540.00c6c380@coco.lan> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 28/01/2022 13:45, Mauro Carvalho Chehab wrote: > Em Fri, 28 Jan 2022 13:40:55 +0100 > Mauro Carvalho Chehab escreveu: > >> Hi Matthias/Yong, >> >> Are you ok if this patch gets merged via the media tree together with the >> remaining series, or do you prefer to apply it via SoC tree instead? > > Same questions for other patches touching files outside drivers/media > on this pull request: > > https://patchwork.kernel.org/project/linux-mediatek/patch/7af52d61-47c7-581d-62ed-76a7f8315b16@xs4all.nl/ > Looks good to me. Please let me know once you accepted the pull request and I'll queue the DTS related changes from this series. Regards, Matthias > Like those: > 0004-0013-iommu-mediatek-v1-Free-the-existed-fwspec-if-the-mas.patch > 0005-0013-iommu-mediatek-Return-ENODEV-if-the-device-is-NULL.patch > 0006-0013-iommu-mediatek-Add-probe_defer-for-smi-larb.patch > 0007-0013-iommu-mediatek-Add-device_link-between-the-consumer-.patch > > Regards, > Mauro > >> >> Regards, >> Mauro >> >> >> Em Mon, 17 Jan 2022 15:04:59 +0800 >> Yong Wu escreveu: >> >>> When the iommu master device enters of_iommu_xlate, the ops may be >>> NULL(iommu dev is defered), then it will initialize the fwspec here: >>> >>> [] (dev_iommu_fwspec_set) from [] >>> (iommu_fwspec_init+0xbc/0xd4) >>> [] (iommu_fwspec_init) from [] >>> (of_iommu_xlate+0x7c/0x12c) >>> [] (of_iommu_xlate) from [] >>> (of_iommu_configure+0x144/0x1e8) >>> >>> BUT the mtk_iommu_v1.c only supports arm32, the probing flow still is a bit >>> weird. We always expect create the fwspec internally. otherwise it will >>> enter here and return fail. >>> >>> static int mtk_iommu_create_mapping(struct device *dev, >>> struct of_phandle_args *args) >>> { >>> ... >>> if (!fwspec) { >>> .... >>> } else if (dev_iommu_fwspec_get(dev)->ops != &mtk_iommu_ops) { >>> >>>>>>>>>>Enter here. return fail.<<<<<<<<<<<< >>> return -EINVAL; >>> } >>> ... >>> } >>> >>> Thus, Free the existed fwspec if the master device already has fwspec. >>> >>> This issue is reported at: >>> https://lore.kernel.org/linux-mediatek/trinity-7d9ebdc9-4849-4d93-bfb5-429dcb4ee449-1626253158870@3c-app-gmx-bs01/ >>> >>> Reported-by: Frank Wunderlich >>> Tested-by: Frank Wunderlich # BPI-R2/MT7623 >>> Signed-off-by: Yong Wu >>> Acked-by: Joerg Roedel >>> Acked-by: AngeloGioacchino Del Regno >>> --- >>> drivers/iommu/mtk_iommu_v1.c | 9 +++++++++ >>> 1 file changed, 9 insertions(+) >>> >>> diff --git a/drivers/iommu/mtk_iommu_v1.c b/drivers/iommu/mtk_iommu_v1.c >>> index be22fcf988ce..1467ba1e4417 100644 >>> --- a/drivers/iommu/mtk_iommu_v1.c >>> +++ b/drivers/iommu/mtk_iommu_v1.c >>> @@ -425,6 +425,15 @@ static struct iommu_device *mtk_iommu_probe_device(struct device *dev) >>> struct mtk_iommu_data *data; >>> int err, idx = 0; >>> >>> + /* >>> + * In the deferred case, free the existed fwspec. >>> + * Always initialize the fwspec internally. >>> + */ >>> + if (fwspec) { >>> + iommu_fwspec_free(dev); >>> + fwspec = dev_iommu_fwspec_get(dev); >>> + } >>> + >>> while (!of_parse_phandle_with_args(dev->of_node, "iommus", >>> "#iommu-cells", >>> idx, &iommu_spec)) { >> >> >> >> Thanks, >> Mauro > > > > Thanks, > Mauro 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 Received: from smtp1.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 smtp.lore.kernel.org (Postfix) with ESMTPS id A0E17C433EF for ; Mon, 31 Jan 2022 12:29:59 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 313A6828C5; Mon, 31 Jan 2022 12:29:59 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ZiYQFLOBBlMn; Mon, 31 Jan 2022 12:29:58 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp1.osuosl.org (Postfix) with ESMTPS id 00DAE82871; Mon, 31 Jan 2022 12:29:58 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id B9C9EC0011; Mon, 31 Jan 2022 12:29:57 +0000 (UTC) Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) by lists.linuxfoundation.org (Postfix) with ESMTP id E6406C000B for ; Mon, 31 Jan 2022 12:29:56 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id CD9EE828A9 for ; Mon, 31 Jan 2022 12:29:56 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id r0aLaqbNKS8a for ; Mon, 31 Jan 2022 12:29:55 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.8.0 Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by smtp1.osuosl.org (Postfix) with ESMTPS id B98FA82871 for ; Mon, 31 Jan 2022 12:29:55 +0000 (UTC) Received: by mail-wr1-x42c.google.com with SMTP id u15so25122618wrt.3 for ; Mon, 31 Jan 2022 04:29:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :cc:references:from:in-reply-to:content-transfer-encoding; bh=XfDEtvQ/tzVD1YeBowq1DH94HINF3JBGxRgfDDz4P9Q=; b=W4NHjEA+9XVVL8xz6qTEqQvruINpNG1pl5p/yaTwPsUbqDWoTdwk6B90cytFkMTHZT lrQuJGMCrkrs3FC5BaobUmorxlxni/0C26+D4VsSXYqKlUY8Ar8xiHI3b74c2sMVkTLU gSKadOZdH4vnOVfaH7dEpE2s9zlDj36v/3eMYHeSfAyUcZJ1HDwwiM1nyWsQnV4O0yRb O1xd+UqJM3rUINASsACdI5OKMhaHlXLsyvVO9ERwrZUlIgIG7kIn8nF6cUlGtvVMzycp 83qu/fIP/2WVZAxPlTcZxmh9pHc3byTUiIOGNQbWxrf5VMQI0tURoHxAzof9DE6mx1vg FIAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=XfDEtvQ/tzVD1YeBowq1DH94HINF3JBGxRgfDDz4P9Q=; b=vQDRWVprjocN/IdO61pEJ8ob8A55OBPOrekhtWgAMQl7pRrRUaBY73/arB3BiZka19 jtLgtSFkpUFWM1/b/fUNV3TRckantdpYogF10bVqb2MRPpJnmbAEHtlWar+nTfkZXBfK 41c9joOBCvWDHQvCkrTbx13iJZGdKaeH4R2z+gNJovtDEwUicpx5tRbxqPp2Tx9MB39H QpaD/EIzkBxe5T/+adS23QoZwcyE3D4cJBE+9+38WpbY3yjdR+M8WciUV2tsthh8I7vC 8OxhzaQ1PcQ4k/dXo+ipMu94AayCdRerdm/wIQ89R3z2GjZ1Iw1gc/03Sc2zT1fs7lQc KlFQ== X-Gm-Message-State: AOAM533OMespKvZAC9Ex+4bkp1dr+ceuj1kO1xuDSs3nfTqgmlFtukTi 6QbvzOfr+F7fY+Av9T6sDTk= X-Google-Smtp-Source: ABdhPJwKPAOlfE8A7dNEWpNDKJVV/rApo0lar6YbP+IVu/WUEb/GzeZxyimip5vdiaqDYs3eC4tjRQ== X-Received: by 2002:a05:6000:1548:: with SMTP id 8mr16792438wry.504.1643632193762; Mon, 31 Jan 2022 04:29:53 -0800 (PST) Received: from [192.168.0.14] ([37.223.145.74]) by smtp.gmail.com with ESMTPSA id m12sm13729547wrp.61.2022.01.31.04.29.51 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 31 Jan 2022 04:29:53 -0800 (PST) Message-ID: <5991ad51-4181-d445-284c-386447cffb95@gmail.com> Date: Mon, 31 Jan 2022 13:29:51 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH v10 02/13] iommu/mediatek-v1: Free the existed fwspec if the master dev already has Content-Language: en-US To: Mauro Carvalho Chehab , Yong Wu References: <20220117070510.17642-1-yong.wu@mediatek.com> <20220117070510.17642-3-yong.wu@mediatek.com> <20220128134055.720bb43c@coco.lan> <20220128134540.00c6c380@coco.lan> From: Matthias Brugger In-Reply-To: <20220128134540.00c6c380@coco.lan> Cc: Chun-Kuang Hu , David Airlie , Will Deacon , dri-devel@lists.freedesktop.org, yf.wang@mediatek.com, Hans Verkuil , anthony.huang@mediatek.com, Krzysztof Kozlowski , Evan Green , Eizan Miyamoto , Matthias Kaehlcke , mingyuan.ma@mediatek.com, linux-media@vger.kernel.org, devicetree@vger.kernel.org, Joerg Roedel , Philipp Zabel , Frank Wunderlich , libo.kang@mediatek.com, yi.kuo@mediatek.com, Rob Herring , linux-mediatek@lists.infradead.org, Hsin-Yi Wang , Tiffany Lin , linux-arm-kernel@lists.infradead.org, AngeloGioacchino Del Regno , anan.sun@mediatek.com, srv_heupstream@mediatek.com, acourbot@chromium.org, linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, Daniel Vetter , Robin Murphy 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-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: iommu-bounces@lists.linux-foundation.org Sender: "iommu" On 28/01/2022 13:45, Mauro Carvalho Chehab wrote: > Em Fri, 28 Jan 2022 13:40:55 +0100 > Mauro Carvalho Chehab escreveu: > >> Hi Matthias/Yong, >> >> Are you ok if this patch gets merged via the media tree together with the >> remaining series, or do you prefer to apply it via SoC tree instead? > > Same questions for other patches touching files outside drivers/media > on this pull request: > > https://patchwork.kernel.org/project/linux-mediatek/patch/7af52d61-47c7-581d-62ed-76a7f8315b16@xs4all.nl/ > Looks good to me. Please let me know once you accepted the pull request and I'll queue the DTS related changes from this series. Regards, Matthias > Like those: > 0004-0013-iommu-mediatek-v1-Free-the-existed-fwspec-if-the-mas.patch > 0005-0013-iommu-mediatek-Return-ENODEV-if-the-device-is-NULL.patch > 0006-0013-iommu-mediatek-Add-probe_defer-for-smi-larb.patch > 0007-0013-iommu-mediatek-Add-device_link-between-the-consumer-.patch > > Regards, > Mauro > >> >> Regards, >> Mauro >> >> >> Em Mon, 17 Jan 2022 15:04:59 +0800 >> Yong Wu escreveu: >> >>> When the iommu master device enters of_iommu_xlate, the ops may be >>> NULL(iommu dev is defered), then it will initialize the fwspec here: >>> >>> [] (dev_iommu_fwspec_set) from [] >>> (iommu_fwspec_init+0xbc/0xd4) >>> [] (iommu_fwspec_init) from [] >>> (of_iommu_xlate+0x7c/0x12c) >>> [] (of_iommu_xlate) from [] >>> (of_iommu_configure+0x144/0x1e8) >>> >>> BUT the mtk_iommu_v1.c only supports arm32, the probing flow still is a bit >>> weird. We always expect create the fwspec internally. otherwise it will >>> enter here and return fail. >>> >>> static int mtk_iommu_create_mapping(struct device *dev, >>> struct of_phandle_args *args) >>> { >>> ... >>> if (!fwspec) { >>> .... >>> } else if (dev_iommu_fwspec_get(dev)->ops != &mtk_iommu_ops) { >>> >>>>>>>>>>Enter here. return fail.<<<<<<<<<<<< >>> return -EINVAL; >>> } >>> ... >>> } >>> >>> Thus, Free the existed fwspec if the master device already has fwspec. >>> >>> This issue is reported at: >>> https://lore.kernel.org/linux-mediatek/trinity-7d9ebdc9-4849-4d93-bfb5-429dcb4ee449-1626253158870@3c-app-gmx-bs01/ >>> >>> Reported-by: Frank Wunderlich >>> Tested-by: Frank Wunderlich # BPI-R2/MT7623 >>> Signed-off-by: Yong Wu >>> Acked-by: Joerg Roedel >>> Acked-by: AngeloGioacchino Del Regno >>> --- >>> drivers/iommu/mtk_iommu_v1.c | 9 +++++++++ >>> 1 file changed, 9 insertions(+) >>> >>> diff --git a/drivers/iommu/mtk_iommu_v1.c b/drivers/iommu/mtk_iommu_v1.c >>> index be22fcf988ce..1467ba1e4417 100644 >>> --- a/drivers/iommu/mtk_iommu_v1.c >>> +++ b/drivers/iommu/mtk_iommu_v1.c >>> @@ -425,6 +425,15 @@ static struct iommu_device *mtk_iommu_probe_device(struct device *dev) >>> struct mtk_iommu_data *data; >>> int err, idx = 0; >>> >>> + /* >>> + * In the deferred case, free the existed fwspec. >>> + * Always initialize the fwspec internally. >>> + */ >>> + if (fwspec) { >>> + iommu_fwspec_free(dev); >>> + fwspec = dev_iommu_fwspec_get(dev); >>> + } >>> + >>> while (!of_parse_phandle_with_args(dev->of_node, "iommus", >>> "#iommu-cells", >>> idx, &iommu_spec)) { >> >> >> >> Thanks, >> Mauro > > > > Thanks, > Mauro _______________________________________________ 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 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 22842C433FE for ; Mon, 31 Jan 2022 12:29:58 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7B7EA10E344; Mon, 31 Jan 2022 12:29:57 +0000 (UTC) Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8181D10E3AE for ; Mon, 31 Jan 2022 12:29:55 +0000 (UTC) Received: by mail-wr1-x432.google.com with SMTP id s9so25060826wrb.6 for ; Mon, 31 Jan 2022 04:29:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :cc:references:from:in-reply-to:content-transfer-encoding; bh=XfDEtvQ/tzVD1YeBowq1DH94HINF3JBGxRgfDDz4P9Q=; b=W4NHjEA+9XVVL8xz6qTEqQvruINpNG1pl5p/yaTwPsUbqDWoTdwk6B90cytFkMTHZT lrQuJGMCrkrs3FC5BaobUmorxlxni/0C26+D4VsSXYqKlUY8Ar8xiHI3b74c2sMVkTLU gSKadOZdH4vnOVfaH7dEpE2s9zlDj36v/3eMYHeSfAyUcZJ1HDwwiM1nyWsQnV4O0yRb O1xd+UqJM3rUINASsACdI5OKMhaHlXLsyvVO9ERwrZUlIgIG7kIn8nF6cUlGtvVMzycp 83qu/fIP/2WVZAxPlTcZxmh9pHc3byTUiIOGNQbWxrf5VMQI0tURoHxAzof9DE6mx1vg FIAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=XfDEtvQ/tzVD1YeBowq1DH94HINF3JBGxRgfDDz4P9Q=; b=oADrccU/Hl9/TmYO+Gp746L1OI/urxiRTh4Fni83OgKm0zMOneOPGl2OHdwgfsx4Ez tj3Se0xjgnjsuNZ81f/5RWE7uBTh1QDFUCjyitCTyYGB5CzfIdJaFR6FL5cFDPOr1C31 Fgx80/p6roxZovr+CutnHG2uGY/IiYDwb1wgq+ieRZcy5UZ3gqjlPyKxGLDVbyJZI36a pWxtjR9w4/91LzQQlPrO6O029P7l+gzzLpzcJZIx8Hy4cGgWdg9Jf+yGlt6ymlNqn658 u4dc4hZMGDxNntn8IEagyXtUbBHCeNKTHUJOSgHBxpCbgRS7laKkgICZpRQMld6XkfbR +txA== X-Gm-Message-State: AOAM530lOf+o4pQogtfu44U7Run2E13y1z5yr6BFk7bDHqoSJQmkvo1T 5XeK7N5LBcDPITAOV6+PsOo= X-Google-Smtp-Source: ABdhPJwKPAOlfE8A7dNEWpNDKJVV/rApo0lar6YbP+IVu/WUEb/GzeZxyimip5vdiaqDYs3eC4tjRQ== X-Received: by 2002:a05:6000:1548:: with SMTP id 8mr16792438wry.504.1643632193762; Mon, 31 Jan 2022 04:29:53 -0800 (PST) Received: from [192.168.0.14] ([37.223.145.74]) by smtp.gmail.com with ESMTPSA id m12sm13729547wrp.61.2022.01.31.04.29.51 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 31 Jan 2022 04:29:53 -0800 (PST) Message-ID: <5991ad51-4181-d445-284c-386447cffb95@gmail.com> Date: Mon, 31 Jan 2022 13:29:51 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH v10 02/13] iommu/mediatek-v1: Free the existed fwspec if the master dev already has Content-Language: en-US To: Mauro Carvalho Chehab , Yong Wu References: <20220117070510.17642-1-yong.wu@mediatek.com> <20220117070510.17642-3-yong.wu@mediatek.com> <20220128134055.720bb43c@coco.lan> <20220128134540.00c6c380@coco.lan> From: Matthias Brugger In-Reply-To: <20220128134540.00c6c380@coco.lan> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dafna Hirschfeld , Chun-Kuang Hu , David Airlie , Will Deacon , dri-devel@lists.freedesktop.org, yf.wang@mediatek.com, Hans Verkuil , anthony.huang@mediatek.com, youlin.pei@mediatek.com, Krzysztof Kozlowski , Evan Green , Eizan Miyamoto , Matthias Kaehlcke , mingyuan.ma@mediatek.com, linux-media@vger.kernel.org, devicetree@vger.kernel.org, Joerg Roedel , Frank Wunderlich , libo.kang@mediatek.com, yi.kuo@mediatek.com, Rob Herring , linux-mediatek@lists.infradead.org, Hsin-Yi Wang , Tiffany Lin , linux-arm-kernel@lists.infradead.org, AngeloGioacchino Del Regno , anan.sun@mediatek.com, srv_heupstream@mediatek.com, acourbot@chromium.org, linux-kernel@vger.kernel.org, Tomasz Figa , iommu@lists.linux-foundation.org, Robin Murphy Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On 28/01/2022 13:45, Mauro Carvalho Chehab wrote: > Em Fri, 28 Jan 2022 13:40:55 +0100 > Mauro Carvalho Chehab escreveu: > >> Hi Matthias/Yong, >> >> Are you ok if this patch gets merged via the media tree together with the >> remaining series, or do you prefer to apply it via SoC tree instead? > > Same questions for other patches touching files outside drivers/media > on this pull request: > > https://patchwork.kernel.org/project/linux-mediatek/patch/7af52d61-47c7-581d-62ed-76a7f8315b16@xs4all.nl/ > Looks good to me. Please let me know once you accepted the pull request and I'll queue the DTS related changes from this series. Regards, Matthias > Like those: > 0004-0013-iommu-mediatek-v1-Free-the-existed-fwspec-if-the-mas.patch > 0005-0013-iommu-mediatek-Return-ENODEV-if-the-device-is-NULL.patch > 0006-0013-iommu-mediatek-Add-probe_defer-for-smi-larb.patch > 0007-0013-iommu-mediatek-Add-device_link-between-the-consumer-.patch > > Regards, > Mauro > >> >> Regards, >> Mauro >> >> >> Em Mon, 17 Jan 2022 15:04:59 +0800 >> Yong Wu escreveu: >> >>> When the iommu master device enters of_iommu_xlate, the ops may be >>> NULL(iommu dev is defered), then it will initialize the fwspec here: >>> >>> [] (dev_iommu_fwspec_set) from [] >>> (iommu_fwspec_init+0xbc/0xd4) >>> [] (iommu_fwspec_init) from [] >>> (of_iommu_xlate+0x7c/0x12c) >>> [] (of_iommu_xlate) from [] >>> (of_iommu_configure+0x144/0x1e8) >>> >>> BUT the mtk_iommu_v1.c only supports arm32, the probing flow still is a bit >>> weird. We always expect create the fwspec internally. otherwise it will >>> enter here and return fail. >>> >>> static int mtk_iommu_create_mapping(struct device *dev, >>> struct of_phandle_args *args) >>> { >>> ... >>> if (!fwspec) { >>> .... >>> } else if (dev_iommu_fwspec_get(dev)->ops != &mtk_iommu_ops) { >>> >>>>>>>>>>Enter here. return fail.<<<<<<<<<<<< >>> return -EINVAL; >>> } >>> ... >>> } >>> >>> Thus, Free the existed fwspec if the master device already has fwspec. >>> >>> This issue is reported at: >>> https://lore.kernel.org/linux-mediatek/trinity-7d9ebdc9-4849-4d93-bfb5-429dcb4ee449-1626253158870@3c-app-gmx-bs01/ >>> >>> Reported-by: Frank Wunderlich >>> Tested-by: Frank Wunderlich # BPI-R2/MT7623 >>> Signed-off-by: Yong Wu >>> Acked-by: Joerg Roedel >>> Acked-by: AngeloGioacchino Del Regno >>> --- >>> drivers/iommu/mtk_iommu_v1.c | 9 +++++++++ >>> 1 file changed, 9 insertions(+) >>> >>> diff --git a/drivers/iommu/mtk_iommu_v1.c b/drivers/iommu/mtk_iommu_v1.c >>> index be22fcf988ce..1467ba1e4417 100644 >>> --- a/drivers/iommu/mtk_iommu_v1.c >>> +++ b/drivers/iommu/mtk_iommu_v1.c >>> @@ -425,6 +425,15 @@ static struct iommu_device *mtk_iommu_probe_device(struct device *dev) >>> struct mtk_iommu_data *data; >>> int err, idx = 0; >>> >>> + /* >>> + * In the deferred case, free the existed fwspec. >>> + * Always initialize the fwspec internally. >>> + */ >>> + if (fwspec) { >>> + iommu_fwspec_free(dev); >>> + fwspec = dev_iommu_fwspec_get(dev); >>> + } >>> + >>> while (!of_parse_phandle_with_args(dev->of_node, "iommus", >>> "#iommu-cells", >>> idx, &iommu_spec)) { >> >> >> >> Thanks, >> Mauro > > > > Thanks, > Mauro 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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 47B54C433EF for ; Mon, 31 Jan 2022 12:30:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:To:Subject:MIME-Version: Date:Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=9VefL/aHZXW3xr6REsKaXldSA/XnIOt7gOcF9L7boac=; b=gcfc6ild3kPnqfhkQu1M385srh NoHthty1toPOHnSJ5O8GNnbY5PHmJmPZgGu/bHz7+iTyqskSByGc3eNUKecFpu5e7osTJTHO4IF80 ZKkWM8xfvs38kNBCCNYG/+9yXAc8GaZq2fFZNHRMjvgbaFAPMY4lUzTFqfFt5qW/so+U2Zp/E2LvU 6ETOyYkUUoDTLd/3SEGqtvljq45haRPf/9QMk7yydn6ggFi+Mlcq7EKtOmdtqjK2LE01Gb1cC6wj7 IpswgQw8gzGYDaE686LJtQCS2CG7RAmvVHoJgoojpmCu2KrsxM14Uov3XCyHjYuajv2WzAXJxMulD kVGjpz4w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nEVol-009M74-N8; Mon, 31 Jan 2022 12:29:59 +0000 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nEVoi-009M5J-Fp; Mon, 31 Jan 2022 12:29:58 +0000 Received: by mail-wr1-x430.google.com with SMTP id e2so25164811wra.2; Mon, 31 Jan 2022 04:29:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :cc:references:from:in-reply-to:content-transfer-encoding; bh=XfDEtvQ/tzVD1YeBowq1DH94HINF3JBGxRgfDDz4P9Q=; b=W4NHjEA+9XVVL8xz6qTEqQvruINpNG1pl5p/yaTwPsUbqDWoTdwk6B90cytFkMTHZT lrQuJGMCrkrs3FC5BaobUmorxlxni/0C26+D4VsSXYqKlUY8Ar8xiHI3b74c2sMVkTLU gSKadOZdH4vnOVfaH7dEpE2s9zlDj36v/3eMYHeSfAyUcZJ1HDwwiM1nyWsQnV4O0yRb O1xd+UqJM3rUINASsACdI5OKMhaHlXLsyvVO9ERwrZUlIgIG7kIn8nF6cUlGtvVMzycp 83qu/fIP/2WVZAxPlTcZxmh9pHc3byTUiIOGNQbWxrf5VMQI0tURoHxAzof9DE6mx1vg FIAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=XfDEtvQ/tzVD1YeBowq1DH94HINF3JBGxRgfDDz4P9Q=; b=RlHYqwWSgpaiv4sBGmxcBNHYZiEciRrjZNK+Y2o1PoGqpvp2SlTzduZcdOlZIZ5JCJ sdjwgqiIeXyGP/FbxYAv53UnMQ6dyLFx5xjIdN74puSQrjXkMpo81GzTz/hjfbj8ATIC rScE0nq3VND1yG11k6J3ioZ7NErmlukApVzkK4kYGC9lIKUzYlUAe4425Ud8zfhxbSic js74olOGRtf1OmAIQ0AQb91V2r5kBF0hVbXsCgVEJeBR4uM2LWlPjZpNEl/OB/tbeULl JOHjnJZOo4OqANxm3mMm0TJAWnw/56yUyf/xLNi03BqRKl8wip3i2ZlcszTsKn2jkUWv N1+A== X-Gm-Message-State: AOAM532KTi0dbTN7Taw9KjzgAMdTmoF8BLYmjNhFkJLCMDdSa4xxMC97 kGRww0GaeUaA/Z2ZMwhEoUg= X-Google-Smtp-Source: ABdhPJwKPAOlfE8A7dNEWpNDKJVV/rApo0lar6YbP+IVu/WUEb/GzeZxyimip5vdiaqDYs3eC4tjRQ== X-Received: by 2002:a05:6000:1548:: with SMTP id 8mr16792438wry.504.1643632193762; Mon, 31 Jan 2022 04:29:53 -0800 (PST) Received: from [192.168.0.14] ([37.223.145.74]) by smtp.gmail.com with ESMTPSA id m12sm13729547wrp.61.2022.01.31.04.29.51 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 31 Jan 2022 04:29:53 -0800 (PST) Message-ID: <5991ad51-4181-d445-284c-386447cffb95@gmail.com> Date: Mon, 31 Jan 2022 13:29:51 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH v10 02/13] iommu/mediatek-v1: Free the existed fwspec if the master dev already has Content-Language: en-US To: Mauro Carvalho Chehab , Yong Wu References: <20220117070510.17642-1-yong.wu@mediatek.com> <20220117070510.17642-3-yong.wu@mediatek.com> <20220128134055.720bb43c@coco.lan> <20220128134540.00c6c380@coco.lan> From: Matthias Brugger In-Reply-To: <20220128134540.00c6c380@coco.lan> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220131_042956_579608_21721216 X-CRM114-Status: GOOD ( 21.11 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dafna Hirschfeld , Chun-Kuang Hu , David Airlie , Will Deacon , dri-devel@lists.freedesktop.org, yf.wang@mediatek.com, Hans Verkuil , anthony.huang@mediatek.com, youlin.pei@mediatek.com, Krzysztof Kozlowski , Evan Green , Eizan Miyamoto , Matthias Kaehlcke , mingyuan.ma@mediatek.com, linux-media@vger.kernel.org, devicetree@vger.kernel.org, Joerg Roedel , Philipp Zabel , libo.kang@mediatek.com, yi.kuo@mediatek.com, Rob Herring , linux-mediatek@lists.infradead.org, Hsin-Yi Wang , Tiffany Lin , linux-arm-kernel@lists.infradead.org, AngeloGioacchino Del Regno , anan.sun@mediatek.com, srv_heupstream@mediatek.com, acourbot@chromium.org, linux-kernel@vger.kernel.org, Tomasz Figa , iommu@lists.linux-foundation.org, Daniel Vetter , Robin Murphy Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org On 28/01/2022 13:45, Mauro Carvalho Chehab wrote: > Em Fri, 28 Jan 2022 13:40:55 +0100 > Mauro Carvalho Chehab escreveu: > >> Hi Matthias/Yong, >> >> Are you ok if this patch gets merged via the media tree together with the >> remaining series, or do you prefer to apply it via SoC tree instead? > > Same questions for other patches touching files outside drivers/media > on this pull request: > > https://patchwork.kernel.org/project/linux-mediatek/patch/7af52d61-47c7-581d-62ed-76a7f8315b16@xs4all.nl/ > Looks good to me. Please let me know once you accepted the pull request and I'll queue the DTS related changes from this series. Regards, Matthias > Like those: > 0004-0013-iommu-mediatek-v1-Free-the-existed-fwspec-if-the-mas.patch > 0005-0013-iommu-mediatek-Return-ENODEV-if-the-device-is-NULL.patch > 0006-0013-iommu-mediatek-Add-probe_defer-for-smi-larb.patch > 0007-0013-iommu-mediatek-Add-device_link-between-the-consumer-.patch > > Regards, > Mauro > >> >> Regards, >> Mauro >> >> >> Em Mon, 17 Jan 2022 15:04:59 +0800 >> Yong Wu escreveu: >> >>> When the iommu master device enters of_iommu_xlate, the ops may be >>> NULL(iommu dev is defered), then it will initialize the fwspec here: >>> >>> [] (dev_iommu_fwspec_set) from [] >>> (iommu_fwspec_init+0xbc/0xd4) >>> [] (iommu_fwspec_init) from [] >>> (of_iommu_xlate+0x7c/0x12c) >>> [] (of_iommu_xlate) from [] >>> (of_iommu_configure+0x144/0x1e8) >>> >>> BUT the mtk_iommu_v1.c only supports arm32, the probing flow still is a bit >>> weird. We always expect create the fwspec internally. otherwise it will >>> enter here and return fail. >>> >>> static int mtk_iommu_create_mapping(struct device *dev, >>> struct of_phandle_args *args) >>> { >>> ... >>> if (!fwspec) { >>> .... >>> } else if (dev_iommu_fwspec_get(dev)->ops != &mtk_iommu_ops) { >>> >>>>>>>>>>Enter here. return fail.<<<<<<<<<<<< >>> return -EINVAL; >>> } >>> ... >>> } >>> >>> Thus, Free the existed fwspec if the master device already has fwspec. >>> >>> This issue is reported at: >>> https://lore.kernel.org/linux-mediatek/trinity-7d9ebdc9-4849-4d93-bfb5-429dcb4ee449-1626253158870@3c-app-gmx-bs01/ >>> >>> Reported-by: Frank Wunderlich >>> Tested-by: Frank Wunderlich # BPI-R2/MT7623 >>> Signed-off-by: Yong Wu >>> Acked-by: Joerg Roedel >>> Acked-by: AngeloGioacchino Del Regno >>> --- >>> drivers/iommu/mtk_iommu_v1.c | 9 +++++++++ >>> 1 file changed, 9 insertions(+) >>> >>> diff --git a/drivers/iommu/mtk_iommu_v1.c b/drivers/iommu/mtk_iommu_v1.c >>> index be22fcf988ce..1467ba1e4417 100644 >>> --- a/drivers/iommu/mtk_iommu_v1.c >>> +++ b/drivers/iommu/mtk_iommu_v1.c >>> @@ -425,6 +425,15 @@ static struct iommu_device *mtk_iommu_probe_device(struct device *dev) >>> struct mtk_iommu_data *data; >>> int err, idx = 0; >>> >>> + /* >>> + * In the deferred case, free the existed fwspec. >>> + * Always initialize the fwspec internally. >>> + */ >>> + if (fwspec) { >>> + iommu_fwspec_free(dev); >>> + fwspec = dev_iommu_fwspec_get(dev); >>> + } >>> + >>> while (!of_parse_phandle_with_args(dev->of_node, "iommus", >>> "#iommu-cells", >>> idx, &iommu_spec)) { >> >> >> >> Thanks, >> Mauro > > > > Thanks, > Mauro _______________________________________________ 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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6E73DC433F5 for ; Mon, 31 Jan 2022 12:31:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=QjndWX0Dj/fnDf3pp7tLa7w9uXS1WTVN/waFcTBo504=; b=IVpCSRtJ05IHQB 04VycX98Z5O4T9HTiGS8/6a091ZL0lxhDd6j6JKhGuC9EJ7AH1WzO7bmd1U2t9Zs8zRDOLM+gV/5M TgXVehIQj2GI/vIMdOLv+v3Zo79TPIt0L/dPc23uJ9cCb2ZyfLo39uR4v/IokgIso30VKqjQzSaZy goj7y8bwU+t19Zln6krG2mHPGVml1WGFnUk+kzKlNJ227XHRQkhlb15pk2uWwAM8AV5mR6uc41I7r HRbl/b1g+BZQBYQt2KkUm//Ct5UvTz0omM5Rjsv2BY+cxwynMZdFEjV5EXYQaeaucXItaoIvUfi3d hVb3tXaAmsdYXquRJy1w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nEVop-009M8O-Qq; Mon, 31 Jan 2022 12:30:04 +0000 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nEVoi-009M5J-Fp; Mon, 31 Jan 2022 12:29:58 +0000 Received: by mail-wr1-x430.google.com with SMTP id e2so25164811wra.2; Mon, 31 Jan 2022 04:29:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :cc:references:from:in-reply-to:content-transfer-encoding; bh=XfDEtvQ/tzVD1YeBowq1DH94HINF3JBGxRgfDDz4P9Q=; b=W4NHjEA+9XVVL8xz6qTEqQvruINpNG1pl5p/yaTwPsUbqDWoTdwk6B90cytFkMTHZT lrQuJGMCrkrs3FC5BaobUmorxlxni/0C26+D4VsSXYqKlUY8Ar8xiHI3b74c2sMVkTLU gSKadOZdH4vnOVfaH7dEpE2s9zlDj36v/3eMYHeSfAyUcZJ1HDwwiM1nyWsQnV4O0yRb O1xd+UqJM3rUINASsACdI5OKMhaHlXLsyvVO9ERwrZUlIgIG7kIn8nF6cUlGtvVMzycp 83qu/fIP/2WVZAxPlTcZxmh9pHc3byTUiIOGNQbWxrf5VMQI0tURoHxAzof9DE6mx1vg FIAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=XfDEtvQ/tzVD1YeBowq1DH94HINF3JBGxRgfDDz4P9Q=; b=RlHYqwWSgpaiv4sBGmxcBNHYZiEciRrjZNK+Y2o1PoGqpvp2SlTzduZcdOlZIZ5JCJ sdjwgqiIeXyGP/FbxYAv53UnMQ6dyLFx5xjIdN74puSQrjXkMpo81GzTz/hjfbj8ATIC rScE0nq3VND1yG11k6J3ioZ7NErmlukApVzkK4kYGC9lIKUzYlUAe4425Ud8zfhxbSic js74olOGRtf1OmAIQ0AQb91V2r5kBF0hVbXsCgVEJeBR4uM2LWlPjZpNEl/OB/tbeULl JOHjnJZOo4OqANxm3mMm0TJAWnw/56yUyf/xLNi03BqRKl8wip3i2ZlcszTsKn2jkUWv N1+A== X-Gm-Message-State: AOAM532KTi0dbTN7Taw9KjzgAMdTmoF8BLYmjNhFkJLCMDdSa4xxMC97 kGRww0GaeUaA/Z2ZMwhEoUg= X-Google-Smtp-Source: ABdhPJwKPAOlfE8A7dNEWpNDKJVV/rApo0lar6YbP+IVu/WUEb/GzeZxyimip5vdiaqDYs3eC4tjRQ== X-Received: by 2002:a05:6000:1548:: with SMTP id 8mr16792438wry.504.1643632193762; Mon, 31 Jan 2022 04:29:53 -0800 (PST) Received: from [192.168.0.14] ([37.223.145.74]) by smtp.gmail.com with ESMTPSA id m12sm13729547wrp.61.2022.01.31.04.29.51 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 31 Jan 2022 04:29:53 -0800 (PST) Message-ID: <5991ad51-4181-d445-284c-386447cffb95@gmail.com> Date: Mon, 31 Jan 2022 13:29:51 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH v10 02/13] iommu/mediatek-v1: Free the existed fwspec if the master dev already has Content-Language: en-US To: Mauro Carvalho Chehab , Yong Wu Cc: Hans Verkuil , Joerg Roedel , Rob Herring , Krzysztof Kozlowski , David Airlie , Evan Green , Robin Murphy , Tomasz Figa , Will Deacon , 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, Matthias Kaehlcke , anan.sun@mediatek.com, yi.kuo@mediatek.com, acourbot@chromium.org, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, Daniel Vetter , Chun-Kuang Hu , Philipp Zabel , Tiffany Lin , Dafna Hirschfeld , Hsin-Yi Wang , Eizan Miyamoto , anthony.huang@mediatek.com, Frank Wunderlich , mingyuan.ma@mediatek.com, yf.wang@mediatek.com, libo.kang@mediatek.com, AngeloGioacchino Del Regno References: <20220117070510.17642-1-yong.wu@mediatek.com> <20220117070510.17642-3-yong.wu@mediatek.com> <20220128134055.720bb43c@coco.lan> <20220128134540.00c6c380@coco.lan> From: Matthias Brugger In-Reply-To: <20220128134540.00c6c380@coco.lan> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220131_042956_579608_21721216 X-CRM114-Status: GOOD ( 21.11 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 28/01/2022 13:45, Mauro Carvalho Chehab wrote: > Em Fri, 28 Jan 2022 13:40:55 +0100 > Mauro Carvalho Chehab escreveu: > >> Hi Matthias/Yong, >> >> Are you ok if this patch gets merged via the media tree together with the >> remaining series, or do you prefer to apply it via SoC tree instead? > > Same questions for other patches touching files outside drivers/media > on this pull request: > > https://patchwork.kernel.org/project/linux-mediatek/patch/7af52d61-47c7-581d-62ed-76a7f8315b16@xs4all.nl/ > Looks good to me. Please let me know once you accepted the pull request and I'll queue the DTS related changes from this series. Regards, Matthias > Like those: > 0004-0013-iommu-mediatek-v1-Free-the-existed-fwspec-if-the-mas.patch > 0005-0013-iommu-mediatek-Return-ENODEV-if-the-device-is-NULL.patch > 0006-0013-iommu-mediatek-Add-probe_defer-for-smi-larb.patch > 0007-0013-iommu-mediatek-Add-device_link-between-the-consumer-.patch > > Regards, > Mauro > >> >> Regards, >> Mauro >> >> >> Em Mon, 17 Jan 2022 15:04:59 +0800 >> Yong Wu escreveu: >> >>> When the iommu master device enters of_iommu_xlate, the ops may be >>> NULL(iommu dev is defered), then it will initialize the fwspec here: >>> >>> [] (dev_iommu_fwspec_set) from [] >>> (iommu_fwspec_init+0xbc/0xd4) >>> [] (iommu_fwspec_init) from [] >>> (of_iommu_xlate+0x7c/0x12c) >>> [] (of_iommu_xlate) from [] >>> (of_iommu_configure+0x144/0x1e8) >>> >>> BUT the mtk_iommu_v1.c only supports arm32, the probing flow still is a bit >>> weird. We always expect create the fwspec internally. otherwise it will >>> enter here and return fail. >>> >>> static int mtk_iommu_create_mapping(struct device *dev, >>> struct of_phandle_args *args) >>> { >>> ... >>> if (!fwspec) { >>> .... >>> } else if (dev_iommu_fwspec_get(dev)->ops != &mtk_iommu_ops) { >>> >>>>>>>>>>Enter here. return fail.<<<<<<<<<<<< >>> return -EINVAL; >>> } >>> ... >>> } >>> >>> Thus, Free the existed fwspec if the master device already has fwspec. >>> >>> This issue is reported at: >>> https://lore.kernel.org/linux-mediatek/trinity-7d9ebdc9-4849-4d93-bfb5-429dcb4ee449-1626253158870@3c-app-gmx-bs01/ >>> >>> Reported-by: Frank Wunderlich >>> Tested-by: Frank Wunderlich # BPI-R2/MT7623 >>> Signed-off-by: Yong Wu >>> Acked-by: Joerg Roedel >>> Acked-by: AngeloGioacchino Del Regno >>> --- >>> drivers/iommu/mtk_iommu_v1.c | 9 +++++++++ >>> 1 file changed, 9 insertions(+) >>> >>> diff --git a/drivers/iommu/mtk_iommu_v1.c b/drivers/iommu/mtk_iommu_v1.c >>> index be22fcf988ce..1467ba1e4417 100644 >>> --- a/drivers/iommu/mtk_iommu_v1.c >>> +++ b/drivers/iommu/mtk_iommu_v1.c >>> @@ -425,6 +425,15 @@ static struct iommu_device *mtk_iommu_probe_device(struct device *dev) >>> struct mtk_iommu_data *data; >>> int err, idx = 0; >>> >>> + /* >>> + * In the deferred case, free the existed fwspec. >>> + * Always initialize the fwspec internally. >>> + */ >>> + if (fwspec) { >>> + iommu_fwspec_free(dev); >>> + fwspec = dev_iommu_fwspec_get(dev); >>> + } >>> + >>> while (!of_parse_phandle_with_args(dev->of_node, "iommus", >>> "#iommu-cells", >>> idx, &iommu_spec)) { >> >> >> >> Thanks, >> Mauro > > > > Thanks, > Mauro _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel