Received: by 2002:a05:6a10:8a4d:0:0:0:0 with SMTP id dn13csp529818pxb; Fri, 13 Aug 2021 00:00:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx6wUsqWRX3xJQm2LiYAzd5TgvdDVFU/ZzZjDwIaEHhMJqtS7Yr1ggOO73QAMWp1fU5oQaR X-Received: by 2002:a17:907:104f:: with SMTP id oy15mr1091340ejb.46.1628838009620; Fri, 13 Aug 2021 00:00:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628838009; cv=none; d=google.com; s=arc-20160816; b=vHOGTC1+KotgWIoLP4giGz5iGS5HdO+32uCH7n6bis9e+jS71OH2fSSfnlyT3wZgGU PNoBUUZXclq6RAcXhfcb3sWjy13B6L0RugDU0O3sGxujoG6/O3lCdbqC/yU+buQBoO92 CCobTmkezYB8SE34cn8ghcuFf1b1x7zeeDshX+eYD6TP1bhTPP0pNQMmVZSgeebBLPaN YavQN1c0K+NakZaKl8TdCVMeiZ+bx8G7aYjNSzjktfzkqNWn87VwoUv6RuUny0i6KVA6 IhGrVyAv1fCILRkB6o1lMLeKrpv80VeyLlFbfh90hJ0J32g9VRKzAYeFiPSsMRi3SQJn 5NwQ== 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=ZlFsk1sluYOqufqq9d4RAu6rQOvNWUp7zEwKAbZP9LA=; b=b1bq9ytnl9xW9mxcDbF0TL7z5fd3nMAjO70FXUMUZfl/l4Z+mdA6Sp5TaSC/lDLuqW WW9iJ0eyH2jJwJOowL03xPWfHaawyT4cmyE1W5piJFYeAlVJQz4iHkEL5fRwNKWQLYiS hUfNYhPLn34YGkuW8F6BThtD72hjIq8MX8uLiV/gF+IFV7lq3mUk03r0x7Lf4+KyhDQb CB6boP37Mf9K1/vQPDtgCyuJt+abd55TBQ3PcSwoyJS68MB0FqHUyKhwK3HQ6KfVMQDi qzubwR9rRFBnVZ4GqGnQRDnG8dxP1fjR77tvv+1CjGBw2h4e6HPrla6z5Vs1o7nQzZgH ehcA== 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 s22si775284ejv.503.2021.08.12.23.59.46; Fri, 13 Aug 2021 00:00:09 -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 S239141AbhHMG4J (ORCPT + 99 others); Fri, 13 Aug 2021 02:56:09 -0400 Received: from mailgw01.mediatek.com ([60.244.123.138]:37724 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S239114AbhHMG4B (ORCPT ); Fri, 13 Aug 2021 02:56:01 -0400 X-UUID: 9564af7569f143aeb371e6b65c5f4cbe-20210813 X-UUID: 9564af7569f143aeb371e6b65c5f4cbe-20210813 Received: from mtkexhb02.mediatek.inc [(172.21.101.103)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1392100995; Fri, 13 Aug 2021 14:55:32 +0800 Received: from mtkcas11.mediatek.inc (172.21.101.40) by mtkmbs07n1.mediatek.inc (172.21.101.16) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 13 Aug 2021 14:55:31 +0800 Received: from localhost.localdomain (10.17.3.154) by mtkcas11.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Fri, 13 Aug 2021 14:55:30 +0800 From: Yong Wu To: Joerg Roedel , Rob Herring , Matthias Brugger , Will Deacon , Robin Murphy CC: Krzysztof Kozlowski , Evan Green , Tomasz Figa , Tomasz Figa , , , , , , , , , Nicolas Boichat , , Subject: [PATCH v2 14/29] iommu/mediatek: Add IOMMU_TYPE flag Date: Fri, 13 Aug 2021 14:53:09 +0800 Message-ID: <20210813065324.29220-15-yong.wu@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20210813065324.29220-1-yong.wu@mediatek.com> References: <20210813065324.29220-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 f75fbfd951e0..20d15f80dd6e 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -127,9 +127,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