Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp320210pxb; Wed, 11 Nov 2020 04:41:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJw6yioeOARa4t6zg3PBk5UivcC4oePisJ99n5ESTxh1u4m2vlG6VS4DzhlUc1Htmz3suIk2 X-Received: by 2002:a05:6402:156:: with SMTP id s22mr4872996edu.178.1605098501169; Wed, 11 Nov 2020 04:41:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605098501; cv=none; d=google.com; s=arc-20160816; b=E7YE/KyvOJe+6ODjPlKFhGPkoC/FiKeWfCzmO5AZE0gAcGDIQz7ZfsmQJsoP/M/mcb DDV5Zyb+x9suHfO/MdhdzCvxTLeECniHa+arOg1JOInve1jX2UysUHuLjgWXXVkpotTz lOG57qI7KnWTytaUIlmFd9PdOAuNh2R0cmes1w4T3P2cFwQ0gbCxSiOEf3Tz//9Al5su Oim12qlQJcmJ8r1tGK0kI2z0R9rZwac9eKLxgtJI4R5+Wcz2csz63VZhaWahkv60IuUE haw/zAqH5bQ1lVlBLAIpuofoBadf3GuHO+tVp7pirEZtzu1H9hN48B3M9FRIz6TNgPR0 ILSg== 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=7oAuYTnJ3ggC1J+XUzephkVwNHZ+2VBV0kmAKs3PzGU=; b=oYgttpZbicVvXq9hl69NJO3PqDzl3Lfo9jKMjhTSUDB2+ewWZgcUAtPfUAZMSD+n1Z rmCfss/H/N8GAeny6QoX7SwaUJvyZk+DgzEZ4rtGl03+YoJjrYE/nb7OjVIks8JmKLy4 YzpHTYVpS08mwh4w2Jryepj2gGTyhQT3Nz8fqTTFeoTjLi8peUeEVTy1KN9BiTLDvcv+ 9MA7+Pt3Xij6PO54vzcbAjkT4UczDH5hTm12JX8knMRr4aFLraILLwm3CV0GELbJsqTN 9TQy+NTzIfR5O0V0OSMoQaYELlCZMAvNpLNKVOBd7DWXPFbaujvzvY/ABXay1XsyXTM5 OqVw== 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 w21si1328611edx.274.2020.11.11.04.41.16; Wed, 11 Nov 2020 04:41:41 -0800 (PST) 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 S1726625AbgKKMj3 (ORCPT + 99 others); Wed, 11 Nov 2020 07:39:29 -0500 Received: from mailgw01.mediatek.com ([210.61.82.183]:33478 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726149AbgKKMj2 (ORCPT ); Wed, 11 Nov 2020 07:39:28 -0500 X-UUID: 76d5ef2828874c2887938aac1a0307af-20201111 X-UUID: 76d5ef2828874c2887938aac1a0307af-20201111 Received: from mtkcas08.mediatek.inc [(172.21.101.126)] by mailgw01.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.14 Build 0819 with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1435442253; Wed, 11 Nov 2020 20:39:24 +0800 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkmbs07n2.mediatek.inc (172.21.101.141) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 11 Nov 2020 20:39:21 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Wed, 11 Nov 2020 20:39:21 +0800 From: Yong Wu To: Joerg Roedel , Matthias Brugger , Rob Herring , Will Deacon , Robin Murphy CC: Krzysztof Kozlowski , Evan Green , Tomasz Figa , , , , , , , , , Nicolas Boichat , , , Greg Kroah-Hartman , Subject: [PATCH v4 04/24] dt-bindings: memory: mediatek: Add domain definition Date: Wed, 11 Nov 2020 20:38:18 +0800 Message-ID: <20201111123838.15682-5-yong.wu@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20201111123838.15682-1-yong.wu@mediatek.com> References: <20201111123838.15682-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 In the latest SoC, there are several HW IP require a sepecial iova range, mainly CCU and VPU has this requirement. Take CCU as a example, CCU require its iova locate in the range(0x4000_0000 ~ 0x43ff_ffff). In this patch we add a domain definition for the special port. In the example of CCU, If we preassign CCU port in domain1, then iommu driver will prepare a independent iommu domain of the special iova range for it, then the iova got from dma_alloc_attrs(ccu-dev) will locate in its special range. This is a preparing patch for multi-domain support. Signed-off-by: Yong Wu --- include/dt-bindings/memory/mtk-smi-larb-port.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/include/dt-bindings/memory/mtk-smi-larb-port.h b/include/dt-bindings/memory/mtk-smi-larb-port.h index f4d8e3aed0bc..d00f5de8438b 100644 --- a/include/dt-bindings/memory/mtk-smi-larb-port.h +++ b/include/dt-bindings/memory/mtk-smi-larb-port.h @@ -7,9 +7,16 @@ #define __DTS_MTK_IOMMU_PORT_H_ #define MTK_LARB_NR_MAX 32 +#define MTK_M4U_DOM_NR_MAX 8 + +#define MTK_M4U_DOM_ID(domid, larb, port) \ + (((domid) & 0x7) << 16 | (((larb) & 0x1f) << 5) | ((port) & 0x1f)) + +/* The default dom id is 0. */ +#define MTK_M4U_ID(larb, port) MTK_M4U_DOM_ID(0, larb, port) -#define MTK_M4U_ID(larb, port) (((larb) << 5) | (port)) #define MTK_M4U_TO_LARB(id) (((id) >> 5) & 0x1f) #define MTK_M4U_TO_PORT(id) ((id) & 0x1f) +#define MTK_M4U_TO_DOM(id) (((id) >> 16) & 0x7) #endif -- 2.18.0