Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp878925ybg; Mon, 27 Jul 2020 01:57:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJymBzQttZ22KV50ySKsNHU1pubkao78LB6DqoMvJJn9EX4Vsx94Qsh7h2pPqk91pxLPZ7pa X-Received: by 2002:a05:6402:228d:: with SMTP id cw13mr20712171edb.343.1595840251713; Mon, 27 Jul 2020 01:57:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595840251; cv=none; d=google.com; s=arc-20160816; b=wZ6zPSY6HhQt7mbvnA3s+cpKF/Blh1hiwbqTHMaags9sLiokO/VIT7wS4PPixzrhbv +kXxfza8g2+mJgsQEU90Rnne29m+XrxkulnvYI0ijOH1D8Yt4WMLEtf7+mk++vN5zIH1 MNijqmMycjtDL4WZS1AEWaBWJmuE64lwZL5G44AAQcuTaAEtFKVFOdI9oUicfBVXKLJn iCYFZXRFErCan1ABh0X0jEpxpZCjtjFfrIwOgAF0gEmGyDpGhOHCqNRGy16gz8Teq2mn 6EtKGUZrpP+P1et8UqP9dfVcfP6Dp96eCzZtBM8whccXvi0FGKjZbsf1a/57xU88DD+v v/Cg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id :dkim-signature; bh=q34zqKlfJT1egqrpS4Z0LW4UkZCQFjyQJ1hrO1Kt++w=; b=oaQte3oeu01OsK3+cTBgJqck+YRJ84Dzz8b6QjnrRIeiSnUsyg/FLLiqTLQxwqavXI kouzwum4FHN7qf6NY5ejvwTwJV/XTs5jlIYnTmp4yEBkmnU8vt1B48dy9/JAwaC12dun Hyt7JlRY/+aqIUMKuvsmUQJqbkkvu90al8khrkVC4yws5iARD5auMloslb5IhbmiYUu7 miSmi/fEXxErYut102OPqeL5w2Gj6AR9q9QNuiFyJJgW2ILZcNkf37Y+Vadd4iOJFVce kw74kZBbXceNxyJnWc7MVtvn/GfP3/N+0P2p/0Tm+3KO+5O2xhzU5pjIyYq93gSrzqOy AEOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=jdh9vUaE; 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=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e12si3967775ejd.148.2020.07.27.01.57.09; Mon, 27 Jul 2020 01:57:31 -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; dkim=pass header.i=@mediatek.com header.s=dk header.b=jdh9vUaE; 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=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726739AbgG0IwK (ORCPT + 99 others); Mon, 27 Jul 2020 04:52:10 -0400 Received: from mailgw01.mediatek.com ([210.61.82.183]:50531 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726302AbgG0IwJ (ORCPT ); Mon, 27 Jul 2020 04:52:09 -0400 X-UUID: 4faa5b68767544c988f8a5078b80dc23-20200727 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:MIME-Version:Content-Type:References:In-Reply-To:Date:CC:To:From:Subject:Message-ID; bh=q34zqKlfJT1egqrpS4Z0LW4UkZCQFjyQJ1hrO1Kt++w=; b=jdh9vUaEP2PlzjKm/2oker36hCtrU4F+ZAjB2yirdFYudZ0SNBA/h8ra30CPxk0Ue1jRLD4gswLnpoiX55DNLLt/CyNcWkR7bbJP6M7fWkjviEmKFUfhgUhXzYw5KnBSmjHDkaW1c8U96XW23RwYiLj5bdomeApnwD0X0MVlMbg=; X-UUID: 4faa5b68767544c988f8a5078b80dc23-20200727 Received: from mtkcas10.mediatek.inc [(172.21.101.39)] by mailgw01.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0809 with TLS) with ESMTP id 1620473155; Mon, 27 Jul 2020 16:52:02 +0800 Received: from mtkcas08.mediatek.inc (172.21.101.126) by mtkmbs07n2.mediatek.inc (172.21.101.141) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 27 Jul 2020 16:51:59 +0800 Received: from [10.15.20.246] (10.15.20.246) by mtkcas08.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 27 Jul 2020 16:51:58 +0800 Message-ID: <1595839778.2350.4.camel@mbjsdccf07> Subject: Re: [PATCH 11/21] iommu/mediatek: Add power-domain operation From: chao hao To: Yong Wu CC: Joerg Roedel , Matthias Brugger , Rob Herring , Robin Murphy , Will Deacon , Evan Green , Tomasz Figa , , , , , , , , Nicolas Boichat , , , , chao hao <"Chao. Hao"@mediatek.com> Date: Mon, 27 Jul 2020 16:49:38 +0800 In-Reply-To: <20200711064846.16007-12-yong.wu@mediatek.com> References: <20200711064846.16007-1-yong.wu@mediatek.com> <20200711064846.16007-12-yong.wu@mediatek.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.10.4-0ubuntu2 MIME-Version: 1.0 X-MTK: N Content-Transfer-Encoding: base64 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org T24gU2F0LCAyMDIwLTA3LTExIGF0IDE0OjQ4ICswODAwLCBZb25nIFd1IHdyb3RlOg0KPiBJbiB0 aGUgcHJldmlvdXMgU29DLCB0aGUgTTRVIEhXIGlz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