Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp504941pxb; Thu, 23 Sep 2021 05:06:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz1pMn1I0hETK+e+PS0euZu5SoCg8kRrG16CwSRxEcNSkU8SEaMdHWCO0+ubtCAo7ulMRM5 X-Received: by 2002:a17:907:2624:: with SMTP id aq4mr4643995ejc.448.1632398803417; Thu, 23 Sep 2021 05:06:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632398803; cv=none; d=google.com; s=arc-20160816; b=hEn8lBKKyR067G9+9i7DWV3KdBMlTwUI2GRbAOPbz+iIixRlYLOa4rSurW8mqronJY i/dtgS/s3eY0t4cAnoRbOwEqePzBSW93A8bUnlqEcg45p/1PQpiHjju+q4FZkSSehiIL XVPAV2EhI2bzo0w7nQtKzCxh/QxmDu58LBZVPQgnuFtCkn5enfbjr57sKxXARPgY+6Rm IQ9xe9mR+aoFbz1HhPXqJ/XfwwvWvkQqm227hT0Lrrb8+d9Q1Jb189Iht/qWKYf1TnMV hU7WnYUZgV9lgctHYhgOAwn8VxKx3Ad2VyinafVSn6bUjLaZpNjuvP+GyagO9bGG4g55 OJSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=UjZYqSXPcaK+lCy6ebZ/ypDLwfaZkw7Bwpx2GgZHGOA=; b=IDXaooeXSEbGm+zesBrK/Kcb6o0FNATJja5Oq5HK4GJg0IR8lOXjaGfHWcChKJJ6ci 1DJ8sBy6smhCo/Vm4U62kjpsKbJYSTF9Nzsz3vRS0OUHqrQqkD/Rgjh+kst9ajQv6mSY 3Hv+TAWJlQkW9IbJIxfyTgzX27m7Qjr2qU3taKLFdBFHZwf4UPTIqSLNsI7yTbQzdkZp FX3/CCqVGkhtBH7z5CF4JMcGn5Z22+9AWMiAI4M3Y70TXoEJ/GcMm5rvq/PcvMOgypCb 7il4SM9HEyacDMjI2ykg4u5orjdUrHclXhy3I9G30YBfQwtHdvEJxPg7kWsufsGAbM+K iOxg== 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=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m11si5506844edv.241.2021.09.23.05.06.17; Thu, 23 Sep 2021 05:06:43 -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=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240792AbhIWMDZ (ORCPT + 99 others); Thu, 23 Sep 2021 08:03:25 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:52282 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S240877AbhIWMDJ (ORCPT ); Thu, 23 Sep 2021 08:03:09 -0400 X-UUID: 656c0f2d056140e6819efba5bb39d96a-20210923 X-UUID: 656c0f2d056140e6819efba5bb39d96a-20210923 Received: from mtkcas11.mediatek.inc [(172.21.101.40)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1939704891; Thu, 23 Sep 2021 20:01:37 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs07n1.mediatek.inc (172.21.101.16) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 23 Sep 2021 20:01:36 +0800 Received: from localhost.localdomain (10.17.3.154) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 23 Sep 2021 20:01:35 +0800 From: Yong Wu To: Joerg Roedel , Rob Herring , Matthias Brugger , Will Deacon , Robin Murphy CC: Krzysztof Kozlowski , Tomasz Figa , , , , , , , Hsin-Yi Wang , , , , , Subject: [PATCH v3 16/33] iommu/mediatek: Add IOMMU_TYPE flag Date: Thu, 23 Sep 2021 19:58:23 +0800 Message-ID: <20210923115840.17813-17-yong.wu@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20210923115840.17813-1-yong.wu@mediatek.com> References: <20210923115840.17813-1-yong.wu@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add IOMMU_TYPE definition. In the mt8195, we have another IOMMU_TYPE: infra iommu, also there will be another APU_IOMMU, thus, use 2bits for the IOMMU_TYPE. Signed-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index d557c3437d67..2665b0707f13 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -126,9 +126,17 @@ #define SHARE_PGTABLE BIT(10) /* 2 HW share pgtable */ #define DCM_DISABLE BIT(11) #define NOT_STD_AXI_MODE BIT(12) +/* 2 bits: iommu type */ +#define MTK_IOMMU_TYPE_MM (0x0 << 13) +#define MTK_IOMMU_TYPE_INFRA (0x1 << 13) +#define MTK_IOMMU_TYPE_MASK (0x3 << 13) -#define MTK_IOMMU_HAS_FLAG(pdata, _x) \ - ((((pdata)->flags) & (_x)) == (_x)) +#define MTK_IOMMU_HAS_FLAG(pdata, _x) (!!(((pdata)->flags) & (_x))) + +#define MTK_IOMMU_HAS_FLAG_MASK(pdata, _x, mask) \ + ((((pdata)->flags) & (mask)) == (_x)) +#define MTK_IOMMU_IS_TYPE(pdata, _x) MTK_IOMMU_HAS_FLAG_MASK(pdata, _x,\ + MTK_IOMMU_TYPE_MASK) struct mtk_iommu_domain { struct io_pgtable_cfg cfg; -- 2.18.0