Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1807421ybh; Fri, 17 Jul 2020 01:27:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwSS+v9B0iQvnlmWBEvaxxir1hoVoT13B3dvjDLAVo6C1wk/mdVHvim7mzIRsCUpXjoGLEP X-Received: by 2002:a17:906:c10f:: with SMTP id do15mr7852162ejc.249.1594974433903; Fri, 17 Jul 2020 01:27:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594974433; cv=none; d=google.com; s=arc-20160816; b=Rx9qp+paYg00DVSx5xzdTFXoSangjbHJBQ6CWkfwwLzY9bZ0+ckVa/OqrGRAr4fyDv yolQeDJ/VCpyJtdjaKQpREOHQ2Hg52PZ8qgSrnGiQYuc+dGpBHhOapjV51zKBTMYQck1 1NF6CSDuteW5UgFgBYRXD/OLTQoAPUWoYTYOCqFlx4HpiLmkykYpi0mqVbyr7FeJlOf0 D43wME6b0XAs31K0yw61IXErWtsrq0vFWl9WuHpqbRBSXLKzcOWT04RvAqxinPHQ7ebd SzW4gcZWBwuCHCMbR+fXZKnJ1bRdJX/58NdN1mo1rOQTckAy8IIK5xzXqxTa8CbTEh/z tD8w== 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=MrihObMU7n6YHGhXYYDfe7xLLhNpwqJjPTZD5pCRXi4=; b=jVjBR3ch4ufvoQZeoLoqmd+O5tr62LXwjAnEJhEqVlnRBSpFyxU+s8Ie7QfaCsf6iC 1dfLbospddCyfUkb6Rnd4SVGC+6i+k3K94g5ODgdaTWCXGwzi39pLKtrisE08fNULjEG ltS71IGdbFPpIDuoN0mXCZGdGrzI/SCqa1fJNOxSZzoes6UlF2rEHSdnSq+yvrIINxgs VCb1Ger5FjDw1r3rec7vxFRgFzeC7NOGLbc6/zfhfX1QSFH33m79vY9jMZ6YjP1PM+Rm tQTFEPRvu81lXXrUuwEX84z8f+ilJI7hUppd4ryMOnHhvQ4LD4qeFY4gdz2sMLVEsWXQ F9sQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=qSkg5pGZ; 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 h7si4648309ejy.82.2020.07.17.01.26.50; Fri, 17 Jul 2020 01:27:13 -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=qSkg5pGZ; 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 S1726293AbgGQI0j (ORCPT + 99 others); Fri, 17 Jul 2020 04:26:39 -0400 Received: from mailgw01.mediatek.com ([210.61.82.183]:46299 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1725864AbgGQI0i (ORCPT ); Fri, 17 Jul 2020 04:26:38 -0400 X-UUID: 00c49b57fed94b27b76049b300df15c8-20200717 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=MrihObMU7n6YHGhXYYDfe7xLLhNpwqJjPTZD5pCRXi4=; b=qSkg5pGZ7/GUqDa+KYmKpnSkiESL+hypmwvZ5i4IEGNH4WK6YywNGJCxL8h9/9NaHi0W9EMw68I+Bszeitn3N1dHLHw4cNF+I3U9TFPqE/uqPKcUNA6nlKJV0zYbBXVWTxPFkvamJ/Zr+VCei7kegzPh1id3EGAJuYoBXnY6V9c=; X-UUID: 00c49b57fed94b27b76049b300df15c8-20200717 Received: from mtkcas07.mediatek.inc [(172.21.101.84)] by mailgw01.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0809 with TLS) with ESMTP id 764249227; Fri, 17 Jul 2020 16:26:32 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs02n1.mediatek.inc (172.21.101.77) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 17 Jul 2020 16:26:29 +0800 Received: from [172.21.77.33] (172.21.77.33) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Fri, 17 Jul 2020 16:26:29 +0800 Message-ID: <1594974391.12796.25.camel@mtkswgap22> Subject: Re: [PATCH 4/4] iommu/mediatek: check 4GB mode by reading infracfg From: Miles Chen To: Matthias Brugger CC: Joerg Roedel , Rob Herring , , , , , , , Yong Wu , Chao Hao , Yingjoe Chen , Mike Rapoport , "David Hildenbrand" , Christoph Hellwig Date: Fri, 17 Jul 2020 16:26:31 +0800 In-Reply-To: <84333997-735c-4a91-6d47-1dcb5c4a6078@gmail.com> References: <20200702093721.6063-1-miles.chen@mediatek.com> <20200702093721.6063-4-miles.chen@mediatek.com> <84333997-735c-4a91-6d47-1dcb5c4a6078@gmail.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.2.3-0ubuntu6 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 T24gV2VkLCAyMDIwLTA3LTE1IGF0IDIzOjA1ICswMjAwLCBNYXR0aGlhcyBCcnV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