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,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=unavailable 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 84726C433E0 for ; Wed, 13 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 273B9230FC for ; Wed, 13 Jan 2021 05:32:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 273B9230FC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.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:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=sYis/k+wCBYX1JKb4cUlRxoY1WtfA9IJiVTVDBaGrwU=; b=SLNWs6/Ln6tijjuhw2PzQdui3 6LQ4UXa4zHKdiHC2rb7nmdStkNS9JnFH8J/zAzAROSuwtIkLbFX08xXhG8RRaH+wFbazmcS4FcANU HoN2wRCkdUfibl62s5TMSsQNtEZ11OwVtsK+NMlWzdWZQAdC1hCO698PlLc6G3MWCLE+L0BECMGvQ eVjf4y2p/VQ/TeUGoza3w4A8KS1abWlgddr0cmzpyrOusc+zLsokomfqSo2q4Kq8mFjVP/qm9JrP8 JHe71k5xeNRAq2Yrjoguc7n6mi67ZmoK6oXLBiuub+Fq1AJfYoxZPNR6kojo2mP0HSF7IZMYeTxUQ N2GhJImjA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kzYk1-0005iR-1m; Wed, 13 Jan 2021 05:30:45 +0000 Received: from mail-ej1-x62d.google.com ([2a00:1450:4864:20::62d]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kzYjx-0005gO-Ob for linux-arm-kernel@lists.infradead.org; Wed, 13 Jan 2021 05:30:42 +0000 Received: by mail-ej1-x62d.google.com with SMTP id d17so1276803ejy.9 for ; Tue, 12 Jan 2021 21:30:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=3eSHLU0tsnB/8YZodS1JHYyVuvZP1q+Jh72EF+LlqTo=; b=kH9y5HDmn14mKPIgiSh0+j61km8jiNYl7Jz2izQAcbV/5id9R9NlXd1WoPfZ4Cqp12 DC2YZgYFU3CAG0ZYQdxFQiMKzJqP8Q+nkXFfCI9yrpeJDZ6lzD4Ld6GCkOfgQtLnoGLA KxDo2CyZ1EsNF43VAwEawZpbStfqt1FOzQm8I= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=3eSHLU0tsnB/8YZodS1JHYyVuvZP1q+Jh72EF+LlqTo=; b=C23U8RXyC+wZJQarkLS8P6PqEjYFVmcUcUpYeKFBni6BH1egjR3WW3H9x0UjZ4YqQZ 3Z0lMX5pOFL7afetoiDn0Jl/fNbIUEicko8DRe3WSH+1YZsuupBBu5ifOLLWBVutbEoK z47Bg1EVfMlffF2bqosqX0hz6M4qV5hg2tPADogsTcEv54s46GIjDgdb6R8IE963QE99 gUlaXmX9RK7CsxHX6+bm6V9dVL77PJnvTVh9cVGhKks+fkIVvPoqYt90MjBHyH/kDEl2 WmeDoQc0fsCV41EkFbU5eC5FOGIWvb1EWz/FFqfq/0jCnJ2uf3qBplMJPe7LmuxHDmZW Up5w== X-Gm-Message-State: AOAM53001Nj+Rl19+z4z5CKn08kQi7ZP9TAtz/mPr0rSDJhBp2ovYi70 O+6bOQm728Gal8tm8Ky/q/D0YyfLhyHWRcLs X-Google-Smtp-Source: ABdhPJwWMYehlvUNZFHaAouZtMvluhXtOH6/Mx2bhzgPO/kmgQea22fW2DsW0SnlFdegLZ7UhG4wmw== X-Received: by 2002:a17:906:4c85:: with SMTP id q5mr305831eju.375.1610515839145; Tue, 12 Jan 2021 21:30:39 -0800 (PST) Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com. [209.85.128.53]) by smtp.gmail.com with ESMTPSA id ch30sm334418edb.8.2021.01.12.21.30.37 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 12 Jan 2021 21:30:38 -0800 (PST) Received: by mail-wm1-f53.google.com with SMTP id k10so401981wmi.3 for ; Tue, 12 Jan 2021 21:30:37 -0800 (PST) X-Received: by 2002:a7b:c773:: with SMTP id x19mr382042wmk.127.1610515837254; Tue, 12 Jan 2021 21:30:37 -0800 (PST) MIME-Version: 1.0 References: <20201209080102.26626-1-yong.wu@mediatek.com> <20201209080102.26626-7-yong.wu@mediatek.com> <1608809713.26323.262.camel@mhfsdcap03> In-Reply-To: <1608809713.26323.262.camel@mhfsdcap03> From: Tomasz Figa Date: Wed, 13 Jan 2021 14:30:24 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v5 06/27] dt-bindings: mediatek: Add binding for mt8192 IOMMU To: Yong Wu X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210113_003041_895260_100C7E98 X-CRM114-Status: GOOD ( 34.27 ) 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, linux-devicetree , Nicolas Boichat , srv_heupstream , Will Deacon , Joerg Roedel , Linux Kernel Mailing List , Evan Green , chao.hao@mediatek.com, "open list:IOMMU DRIVERS" , Rob Herring , "moderated list:ARM/Mediatek SoC support" , Krzysztof Kozlowski , Matthias Brugger , anan.sun@mediatek.com, Robin Murphy , "list@263.net:IOMMU DRIVERS , Joerg Roedel , " 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, Dec 24, 2020 at 8:35 PM Yong Wu wrote: > > On Wed, 2020-12-23 at 17:18 +0900, Tomasz Figa wrote: > > On Wed, Dec 09, 2020 at 04:00:41PM +0800, Yong Wu wrote: > > > This patch adds decriptions for mt8192 IOMMU and SMI. > > > > > > mt8192 also is MTK IOMMU gen2 which uses ARM Short-Descriptor translation > > > table format. The M4U-SMI HW diagram is as below: > > > > > > EMI > > > | > > > M4U > > > | > > > ------------ > > > SMI Common > > > ------------ > > > | > > > +-------+------+------+----------------------+-------+ > > > | | | | ...... | | > > > | | | | | | > > > larb0 larb1 larb2 larb4 ...... larb19 larb20 > > > disp0 disp1 mdp vdec IPE IPE > > > > > > All the connections are HW fixed, SW can NOT adjust it. > > > > > > mt8192 M4U support 0~16GB iova range. we preassign different engines > > > into different iova ranges: > > > > > > domain-id module iova-range larbs > > > 0 disp 0 ~ 4G larb0/1 > > > 1 vcodec 4G ~ 8G larb4/5/7 > > > 2 cam/mdp 8G ~ 12G larb2/9/11/13/14/16/17/18/19/20 > > > > Why do we preassign these addresses in DT? Shouldn't it be a user's or > > integrator's decision to split the 16 GB address range into sub-ranges > > and define which larbs those sub-ranges are shared with? > > The problem is that we can't split the 16GB range with the larb as unit. > The example is the below ccu0(larb13 port9/10) is a independent > range(domain), the others ports in larb13 is in another domain. > > disp/vcodec/cam/mdp don't have special iova requirement, they could > access any range. vcodec also can locate 8G~12G. it don't care about > where its iova locate. here I preassign like this following with our > internal project setting. Let me try to understand this a bit more. Given the split you're proposing, is there actually any isolation enforced between particular domains? For example, if I program vcodec to with a DMA address from the 0-4G range, would the IOMMU actually generate a fault, even if disp had some memory mapped at that address? > > Why set this in DT?, this is only for simplifying the code. Assume we > put it in the platform data. We have up to 32 larbs, each larb has up to > 32 ports, each port may be in different iommu domains. we should have a > big array for this..however we only use a macro to get the domain in the > DT method. > > When replying this mail, I happen to see there is a "dev->dev_range_map" > which has "dma-range" information, I think I could use this value to get > which domain the device belong to. then no need put domid in DT. I will > test this. My feeling is that the only part that needs to be enforced statically is the reserved IOVA range for CCUs. The other ranges should be determined dynamically, although I think I need to understand better how the hardware and your proposed design work to tell what would be likely the best choice here. Best regards, Tomasz > > Thanks. > > > > Best regards, > > Tomasz > > > > > 3 CCU0 0x4000_0000 ~ 0x43ff_ffff larb13: port 9/10 > > > 4 CCU1 0x4400_0000 ~ 0x47ff_ffff larb14: port 4/5 > > > > > > The iova range for CCU0/1(camera control unit) is HW requirement. > > > > > > Signed-off-by: Yong Wu > > > Reviewed-by: Rob Herring > > > --- > > > .../bindings/iommu/mediatek,iommu.yaml | 18 +- > > > include/dt-bindings/memory/mt8192-larb-port.h | 240 ++++++++++++++++++ > > > 2 files changed, 257 insertions(+), 1 deletion(-) > > > create mode 100644 include/dt-bindings/memory/mt8192-larb-port.h > > > > [snip] _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel