Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp292187ybh; Wed, 22 Jul 2020 00:18:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyea1E3UWbaGcAi3i/EqiCFLRj+3nlH2Seh/0FAZ4Ma2HwOa+Wx4bBPr1Hj27I3chKKm1Nm X-Received: by 2002:a17:906:fa9a:: with SMTP id lt26mr28086356ejb.502.1595402334486; Wed, 22 Jul 2020 00:18:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595402334; cv=none; d=google.com; s=arc-20160816; b=c1sb4yuxB5ebE7+CVajxOh1lDUxpED7GbpZOwH115XYDbydPhKA8TziyuoLLeacafr SdACGgD50Jg3YrqNVIwbITKD5rzqO+HgTD7ZB18Fc6k/MTD0K6qDngBiUTD6nq1ol8tL Ah4Vfayn1BHvda/odGLSp5G1KG24iyVFs0++2i/lBQZiAABkbXeWcYHDLFU4RhDPzf5s gtiqKuUWBder2DVuUgULAHgTz1nZR+vH9ivdtsXSsf72cIrFgQo1FR7DVTRmuj2xcCFM S54INv+LX949lmiH6LnzD5MMp4EqfYw8sJt+dIQ9zsYywrdZEp4PRSnlF/26JWjKm/Aa VYWQ== 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=eioeC0FtTQ1I836sh9xci60mvaR1B/7eikG6MlrGfMw=; b=wTFsfBnmKvZP4dP9SmH8YxIw76jZfhsaqR+f6NF4V1V6wikHnJWDAdMjqtTP9jSY3C iEx7g35TOmo+VFif1OUjSePTgG9dKw5PgExKsrFjOwcFlh38ma36UPEURrSNO6W0EvnK 8kvhfkcD8zfe0ZxJ/pRdWr1LmvnhWRprFXuHHwc9JF/hUNlAKYFzKRArYxYqLlbElogg v34Xmzq7Dwhb3GxqeG1M74hA+eua0kC9hPMO8fxDfTrX3fQTcPr14w+ZS1Avq3oVbV3h 1PYz96vl/3av5zvYmnBxeY+DtL0qWI1dN3wWjIyr3sexN31hwHMxLh3JbRoiwNJ02i2D NHTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b="W/1lPp0N"; 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 p11si14433193edq.445.2020.07.22.00.18.32; Wed, 22 Jul 2020 00:18:54 -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="W/1lPp0N"; 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 S1731289AbgGVHP6 (ORCPT + 99 others); Wed, 22 Jul 2020 03:15:58 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:25251 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1727096AbgGVHP6 (ORCPT ); Wed, 22 Jul 2020 03:15:58 -0400 X-UUID: d331a230923941bb81206dcd421e9959-20200722 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=eioeC0FtTQ1I836sh9xci60mvaR1B/7eikG6MlrGfMw=; b=W/1lPp0NEbJf+lJZGPKIs45XHDlPMt+SpLnLA5Lft7lV/0qolfOC2yAziWropllbzcr4m8Qm+kWWc3dX2mozJOaB2nWdo3gpKz6BDNoPj+BY7rfEeuqW1OSFcOF2or4URpnuHRwbw+NungSZmBONWNJHf90hplUuRz1Qgg0Fbcg=; X-UUID: d331a230923941bb81206dcd421e9959-20200722 Received: from mtkexhb01.mediatek.inc [(172.21.101.102)] by mailgw02.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0809 with TLS) with ESMTP id 160040994; Wed, 22 Jul 2020 15:15:53 +0800 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkmbs01n2.mediatek.inc (172.21.101.79) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 22 Jul 2020 15:15:49 +0800 Received: from [172.21.77.33] (172.21.77.33) by mtkcas07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Wed, 22 Jul 2020 15:15:50 +0800 Message-ID: <1595402150.10848.1.camel@mtkswgap22> Subject: Re: [PATCH v2] iommu/mediatek: check 4GB mode by reading infracfg From: Miles Chen To: David Hildenbrand CC: Joerg Roedel , Matthias Brugger , Rob Herring , , , , , , Mike Rapoport , Yong Wu , Yingjoe Chen , "Christoph Hellwig" , Chao Hao Date: Wed, 22 Jul 2020 15:15:50 +0800 In-Reply-To: References: <20200721021619.25575-1-miles.chen@mediatek.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.2.3-0ubuntu6 MIME-Version: 1.0 X-TM-SNTS-SMTP: 125A2A6B996131DF2178586BE457C60F26919FB3EC0293BA66AB66B8DF6B504B2000:8 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 T24gVHVlLCAyMDIwLTA3LTIxIGF0IDExOjEwICswMjAwLCBEYXZpZCBIaWxkZW5icmFuZCB3cm90 ZToNCj4gT24gMjEuMDcuMjAgMDQ6MTYsIE1pbGVzIENoZW4gd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