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=-7.0 required=3.0 tests=BAYES_00,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no 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 338C6C433E5 for ; Thu, 23 Jul 2020 20:47:37 +0000 (UTC) Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (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 016FA2065E for ; Thu, 23 Jul 2020 20:47:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 016FA2065E 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 silver.osuosl.org (Postfix) with ESMTP id BA50F203CF; Thu, 23 Jul 2020 20:47:36 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ZKooHQlH2zyk; Thu, 23 Jul 2020 20:47:34 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by silver.osuosl.org (Postfix) with ESMTP id 959792040B; Thu, 23 Jul 2020 20:47:34 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 67E89C004D; Thu, 23 Jul 2020 20:47:34 +0000 (UTC) Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 54A02C004C for ; Thu, 23 Jul 2020 20:47:33 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 3CC152040B for ; Thu, 23 Jul 2020 20:47:33 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Zm5bKp1xYyXj for ; Thu, 23 Jul 2020 20:47:32 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-il1-f193.google.com (mail-il1-f193.google.com [209.85.166.193]) by silver.osuosl.org (Postfix) with ESMTPS id 5F56E203CF for ; Thu, 23 Jul 2020 20:47:32 +0000 (UTC) Received: by mail-il1-f193.google.com with SMTP id p15so5456525ilh.13 for ; 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=Bmz2LAr9RfT8UwO+3Bn8+aAj9XRnMFc7XXSG2pcNf02XCR2U1Y5JmT997UkT2+W3/B 7U6UPb1KzG3/uuXG2q4Lc8Qbz9OUEJWEebCnKX2/rKLLX7dnlBvQbKQDmW7ucLksUCBI p0GIKUJgBvId/cbprcP8iusVcRnlJCQ7yeYjbF0P6IdprH8JzGtLMQgS09WEsqNSRaK8 WrPViTE2N1QE63VPfjYs9dCCs5Fx/xBwOQXye5bpbdttNRNaN6NGM0avls6sTtou3YbD Cwy9/aiWdnvWWurvXPKr3OwyIUMt0RCkKRDhL8ape8TslZBa9V9h+bBMJccpPk3LdRre ksGg== X-Gm-Message-State: AOAM532M9uHYoX0eUPcqWwIMpyDy20xTCfKGHca2Cv4lIZHausA5Tcg2 yThSbjU/CjXAasGdbuCVHQ== X-Google-Smtp-Source: ABdhPJxj977xyK987KA25YXvHJw0KF0pYIdsSwCRmIfXKkWWW85uigcOZS4pmbBfQX5gRynZmqjiXQ== 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 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-Disposition: inline In-Reply-To: <20200711064846.16007-19-yong.wu@mediatek.com> Cc: youlin.pei@mediatek.com, devicetree@vger.kernel.org, Nicolas Boichat , cui.zhang@mediatek.com, srv_heupstream@mediatek.com, chao.hao@mediatek.com, Robin Murphy , linux-kernel@vger.kernel.org, Evan Green , Tomasz Figa , iommu@lists.linux-foundation.org, linux-mediatek@lists.infradead.org, Matthias Brugger , ming-fan.chen@mediatek.com, anan.sun@mediatek.com, Will Deacon , 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 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(-) _______________________________________________ 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=-7.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no 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 6FF69C433EA for ; Thu, 23 Jul 2020 20:47:47 +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 3B04C2065E for ; Thu, 23 Jul 2020 20:47:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="vOq8aOSV" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3B04C2065E 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=aY7jwtvbr1jcQ5T4gOuri8+BxO7e2acoStljcpVPS2o=; b=vOq8aOSVLLjsonBaJC+6H38w0 Hh6oeZ+wronWsK2Np00QY24FEOIbxJzEQtzi8cVmbKi0QYsn29MlSvVeoddMXb8xcR4zdrp83MS9S TFwbBY10T+cy2kJxAy+bTZymtUQy9oF/U1spSptbdC2vgoYWGZc1/v+wvjSnCq0tReYEfWKijRP26 Fgaws6zUMP2HIMd1l+59SC1/BxuwzslWcLprZigbkkSUWDhZkNcGyj05rn1+F2Il7IgJ/Xsy3+C9u YxUspTgvwU1h0lrG+HzbGb1rmPqRinzIQ6wRDlw2c6xUBixxQvRSVzWhUah++92hdxc8ZhTJpsX5k DY9x3QPsA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jyi7r-0000Co-3m; Thu, 23 Jul 2020 20:47:35 +0000 Received: from mail-il1-f195.google.com ([209.85.166.195]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jyi7o-0000C3-Qx; Thu, 23 Jul 2020 20:47:33 +0000 Received: by mail-il1-f195.google.com with SMTP id x9so5512844ila.3; 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=hrs6JtT7uqVYXz++NXnFyxDnRN841fu+389xaFG23xcbCFmob0DL9LKJ9agQUY0wXm +43GfYUm6eLrOXgboeA48ibuFTubMyhn1WJ7bk6dIsA0EtzWehpt5fgyf9X1nc8r3pgc A0IkAAOmt4teLRmnYPR/OcjmqDooiSkyPqkNChqidpJEX2hm6cvLmpIw6LasC5j3S+Wz dgGrcJlRugJ91wO+YAxUgii1GQ2UyegG+JK5ekrUQZdN1I5fMVww2Uis4Nq0ecEjSH08 fmv6mxhjhwT1dY/4o3dL/uLuYMdazinpDWPJkZk0a9lJKb3Oj+AFiutaNNcCOtguj6IX RMjw== X-Gm-Message-State: AOAM532fkWkKJk0ypDGHp18feId3V3jQCldu9akQYsI1J8ubtdtCzIB4 4KBRzwQXOWUq13l4hP4hdQ== X-Google-Smtp-Source: ABdhPJxj977xyK987KA25YXvHJw0KF0pYIdsSwCRmIfXKkWWW85uigcOZS4pmbBfQX5gRynZmqjiXQ== 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 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-Disposition: inline In-Reply-To: <20200711064846.16007-19-yong.wu@mediatek.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200723_164732_901586_97DC8109 X-CRM114-Status: GOOD ( 13.99 ) 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 , cui.zhang@mediatek.com, srv_heupstream@mediatek.com, chao.hao@mediatek.com, Robin Murphy , Joerg Roedel , linux-kernel@vger.kernel.org, Evan Green , Tomasz Figa , iommu@lists.linux-foundation.org, linux-mediatek@lists.infradead.org, Matthias Brugger , ming-fan.chen@mediatek.com, anan.sun@mediatek.com, Will Deacon , 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 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(-) _______________________________________________ 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=-7.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no 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 5432AC433E0 for ; Thu, 23 Jul 2020 20:48:54 +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 208B72065E for ; Thu, 23 Jul 2020 20:48:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="bmVdQb4W" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 208B72065E 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=i4WEemdS4boV0Ux9jzrFaSA2PGHX2HXNZ3TeixaBDhg=; b=bmVdQb4W3uflxDsxOncxdxEuM Iwqj5fxfFB4gAJBmSFC7h+yBrzG4F6GhPT3DH506wBLf0hAe22zHBkP6+JocwCRMbw/zcxR19gadN TJhThbWqn4hO36MhM1MMBqxlbmlX1/VViBn8qCCiywOnS3vK4+IT26nvb2CTkhSNj67kbGXwvB57F lgPuBTq31SucVPkXJe9ewFt4X4yE/diy8YWaDR9UN0LyTnXD4VVmFz419xKJoeEWu8pNwwmtQDkPQ E9fNbYyUi+eGlJrxpd0o86b0hq48ccCd7f0UHe5p7feMTL86bRkBX/UERU4wo+mzF3BhTrb/yeDvS oXt0rIp0w==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jyi7s-0000Cy-8C; Thu, 23 Jul 2020 20:47:36 +0000 Received: from mail-il1-f195.google.com ([209.85.166.195]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jyi7o-0000C3-Qx; Thu, 23 Jul 2020 20:47:33 +0000 Received: by mail-il1-f195.google.com with SMTP id x9so5512844ila.3; 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=hrs6JtT7uqVYXz++NXnFyxDnRN841fu+389xaFG23xcbCFmob0DL9LKJ9agQUY0wXm +43GfYUm6eLrOXgboeA48ibuFTubMyhn1WJ7bk6dIsA0EtzWehpt5fgyf9X1nc8r3pgc A0IkAAOmt4teLRmnYPR/OcjmqDooiSkyPqkNChqidpJEX2hm6cvLmpIw6LasC5j3S+Wz dgGrcJlRugJ91wO+YAxUgii1GQ2UyegG+JK5ekrUQZdN1I5fMVww2Uis4Nq0ecEjSH08 fmv6mxhjhwT1dY/4o3dL/uLuYMdazinpDWPJkZk0a9lJKb3Oj+AFiutaNNcCOtguj6IX RMjw== X-Gm-Message-State: AOAM532fkWkKJk0ypDGHp18feId3V3jQCldu9akQYsI1J8ubtdtCzIB4 4KBRzwQXOWUq13l4hP4hdQ== X-Google-Smtp-Source: ABdhPJxj977xyK987KA25YXvHJw0KF0pYIdsSwCRmIfXKkWWW85uigcOZS4pmbBfQX5gRynZmqjiXQ== 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 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-Disposition: inline In-Reply-To: <20200711064846.16007-19-yong.wu@mediatek.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200723_164732_901586_97DC8109 X-CRM114-Status: GOOD ( 13.99 ) 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 , cui.zhang@mediatek.com, srv_heupstream@mediatek.com, chao.hao@mediatek.com, Robin Murphy , Joerg Roedel , linux-kernel@vger.kernel.org, Evan Green , Tomasz Figa , iommu@lists.linux-foundation.org, linux-mediatek@lists.infradead.org, Matthias Brugger , ming-fan.chen@mediatek.com, anan.sun@mediatek.com, Will Deacon , 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 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(-) _______________________________________________ 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=-7.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no 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 5F53DC433E3 for ; Thu, 23 Jul 2020 20:47:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3C9342065E for ; Thu, 23 Jul 2020 20:47:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1595537256; bh=Z16xu/uGurFFuLQg7lucgmQ5ePh3KVIjkt6FCIdbgi0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=0XaknrQQg3mApmvncbA+3fZ7ZW+BOS2kES09DXF8xILI7Ps09JXcuSSRSK8EG8X0N wKJMXYuzN8OFL2TXJmsY6ZHTNdHpudq31zabIpN13cVQrlifkInFPHJzUQ8LHAd0iE Jd94693u4zrSgDaGqO7Fd02fj6NX5yOdGdjG3mpk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728036AbgGWUrd (ORCPT ); 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-Google-Smtp-Source: ABdhPJxj977xyK987KA25YXvHJw0KF0pYIdsSwCRmIfXKkWWW85uigcOZS4pmbBfQX5gRynZmqjiXQ== 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: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@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(-)