Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1627574ybh; Thu, 23 Jul 2020 13:48:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwniD/RFl1UNl8IoPuw5xwp6MSKKVU3IUAjbpfvRTIRm00Ic+qG2/S70MOrg8gvR/nKQkh0 X-Received: by 2002:a17:906:4d1:: with SMTP id g17mr6147703eja.78.1595537306769; Thu, 23 Jul 2020 13:48:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595537306; cv=none; d=google.com; s=arc-20160816; b=yDuOzQoMn2CYWShx81hqW8ygyxYlx5jJaDCwqjMsLOJDVAOaMxGAzumr4qlIDrABvq NKDCPbrEl17uWh5zrDm7jruatN1M4xi4/nouBWmLUqqW8QTGoQFi2mKMN34OLIAzt+Jk gGfzdklvKui+0LTSbncnZBVSTMKav/klJ1DysZ8QJFLQ6RTELy1zpQEWn19oc83x5BwA 92RDMZDL3B+w2vTkwTqVvqZJ2GScg/MUVwh/bc4V5f1ka2Nk6BwONALHDHw/AI0CPtOD x9aeO4N85YSKO8+jGQcO8PRgN13qk3jxbYC8XpiUqw9Hpq1hDjqEAn9zYgBN6J/KA7QT JpRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=/ykIh0i0xy9qqdWkp/0xl4AY6xx/230nGu1DDjaI5lo=; b=nriidVeJiD3vrmMTGU+aOqhAcboUQJ+JRpU7YLR4N6b02MYsRiE8xK2fNyowROV4cM 7085ZBQS/DqVpsOVdIM0myk2cFPD8pYTyTtBefDpYsSVifxK9UjF7tszL4ZWZ8YJzJOJ u/qgLX+Gd45hQSF7a4LfuA4YymVnlN+rE2X2yhC1rw5q/9LLuVF9+RGG7DlQ6JxpfcgX GmcOvf9Spj4X+DVcjwI3qt3DsiaeHPB1fm2rD+wsU2Vwu5XKWA3f83YnUEVYVvJjH1Mn tA8mvpM/cwsjsbQh5pBMayRsVADQZNgG2cHR0VLMNT8rStewu2cCnA07lNtQAyLknEay IxUg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b10si2609562eje.471.2020.07.23.13.48.04; Thu, 23 Jul 2020 13:48:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728076AbgGWUrd (ORCPT + 99 others); Thu, 23 Jul 2020 16:47:33 -0400 Received: from mail-il1-f194.google.com ([209.85.166.194]:39192 "EHLO mail-il1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726046AbgGWUrc (ORCPT ); Thu, 23 Jul 2020 16:47:32 -0400 Received: by mail-il1-f194.google.com with SMTP id k6so5497582ili.6; Thu, 23 Jul 2020 13:47:32 -0700 (PDT) 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=/ykIh0i0xy9qqdWkp/0xl4AY6xx/230nGu1DDjaI5lo=; b=ia6JJF9GPGzyOOL+z+bCioEzpwnTufIoSgmRqABFHpqgl02jc0gLPnmHlqjeK7M9yw tcHSDyfBsjMvZuLdjS5kzXUUYGHc37HrRz+nuxj5TqHQqprYqHEVC//7BufK3fO5Pkiy KKtBbeL3ouDRKxYNXDc747Ehm/CQzFDZDVcDk0C8OXFX/ffBiLNmBhxm7cQBz7pSFa7S p43XIVLB7btqVKLET1S52C4qGdOJjizORlm9m7J4kqSY3bwsAdDOfuB9w/6yPO5VwMcg iYxFezlp9LF+DLKSfgo8+foMZB/myxzlbpVkYhHpNw7tlGe7raOWugBGYdwWVWOw+664 d6Cg== X-Gm-Message-State: AOAM531qS0JhyBkmsFKiZW3y/1i+eKuIxzMbqLNg77k0VLPFsGQkOOuR ojGAo+ePpE2VH2yVMLPk/4b2eRSadg== X-Received: by 2002:a92:c792:: with SMTP id c18mr7006999ilk.223.1595537251697; Thu, 23 Jul 2020 13:47:31 -0700 (PDT) Received: from xps15 ([64.188.179.252]) by smtp.gmail.com with ESMTPSA id w5sm2032325ilm.46.2020.07.23.13.47.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jul 2020 13:47:30 -0700 (PDT) Received: (nullmailer pid 833108 invoked by uid 1000); Thu, 23 Jul 2020 20:47:29 -0000 Date: Thu, 23 Jul 2020 14:47:29 -0600 From: Rob Herring To: Yong Wu Cc: Joerg Roedel , Matthias Brugger , Robin Murphy , Will Deacon , 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, cui.zhang@mediatek.com, chao.hao@mediatek.com, ming-fan.chen@mediatek.com Subject: Re: [PATCH 18/21] iommu/mediatek: Add support for multi domain Message-ID: <20200723204729.GA823856@bogus> References: <20200711064846.16007-1-yong.wu@mediatek.com> <20200711064846.16007-19-yong.wu@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200711064846.16007-19-yong.wu@mediatek.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jul 11, 2020 at 02:48:43PM +0800, Yong Wu wrote: > Some HW IP(ex: CCU) require the special iova range. That means the > iova got from dma_alloc_attrs for that devices must locate in his > special range. In this patch, we allocate a special iova_range for > each a special requirement and create each a iommu domain for each > a iova_range. > > meanwhile we still use one pagetable which support 16GB iova. > > After this patch, If the iova range of a master is over 4G, the master > should: > a) Declare its special dma_ranges in its dtsi node. For example, If we > preassign the iova 4G-8G for vcodec, then the vcodec dtsi node should: > dma-ranges = <0x1 0x0 0x1 0x0 0x1 0x0>; /* 4G ~ 8G */ BTW, dma-ranges should be in the parent node of the vcodec. > b) Update the dma_mask: > dma_set_mask_and_coherent(dev, DMA_BIT_MASK(33)); This should happen for you automatically. The DMA PFN offset should also be 4GB here. > > Signed-off-by: Yong Wu > --- > drivers/iommu/mtk_iommu.c | 49 ++++++++++++++++++++++++++++++++------- > drivers/iommu/mtk_iommu.h | 3 ++- > 2 files changed, 42 insertions(+), 10 deletions(-)