Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp878596pxk; Mon, 31 Aug 2020 03:57:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzSsjW9AwDzT+6afDM9UllP4/+DSgT7bwHfIm8ddwUov4+D6nmafHsJHGDPU+1DXRh48GAB X-Received: by 2002:a17:906:cc8d:: with SMTP id oq13mr565197ejb.280.1598871474660; Mon, 31 Aug 2020 03:57:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598871474; cv=none; d=google.com; s=arc-20160816; b=Eoem0go3Hdf7XQZsTotQYVFQ/HcWCqge+3E7dTL7ykpzW4cagozMeUDBYoBmFX3vLf iTGz/Sir60UI5Uh3nenTKXtQeSsQj2iN7xvi9oakf5bw9ZJlceoZ3F0uvGJTU7D2sB4G ngNAQbEcav+UvXi81r9gcmoSOiRbKHtZ2ZyXEvqe8Qjg43lVmjuLp7CfaaA2EOmsEUrH Xt4IyoTiIl1EKh4PvFUh9lkz17+OXuqflnAIKp1y4PqgqAOuYaANDNse3jKFfRYQhd/j HFvWD8lKW/VkkDsLg1mh6gH9f5TLQf/uWnQA3AFPl06bsuQzQpPQssV7/BCRSawMZORI SZfw== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=PFK96T7avqn9jICrOvLa+GZbdRwSDF9sP7kZd14N3es=; b=eOFXrFdqCsrFFK8a5l7uboLRiLeJNJZH4+axFqBu4IN4O6Y3AMtR9u3n7FbYUYJcH6 5x2r4bc9NIHgN7BQgZFW2tOxaf1mLdQgzNrwvadJo+mbuRTDtaB6y9r3XvsdOccC68Mg n3b/RKLT+pHaLkidkO4xZARCUTrvxLjpupyOzrd/IaLhK7exTE/mVJgxz1TO2kz/JSzx g4DB/367TTc2EK2lzN1MKKkmsmRCpoRRYYkVcV9JxCMfn0gE2EcL4XNsmnzsucR5P0ZB X/2EMxb/hkZtTMyykVD/wBXkOuHKVOOOu/+F3NHUVwHWzv2wWBnTeIJZvn5Jzi+ydoss b9Hw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=SjNBQ6we; 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 j20si2751799edq.109.2020.08.31.03.57.31; Mon, 31 Aug 2020 03:57: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=SjNBQ6we; 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 S1726253AbgHaK4x (ORCPT + 99 others); Mon, 31 Aug 2020 06:56:53 -0400 Received: from mailgw01.mediatek.com ([210.61.82.183]:43559 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726121AbgHaK4x (ORCPT ); Mon, 31 Aug 2020 06:56:53 -0400 X-UUID: d92c9e3114fa4d5c8c978949b4224d19-20200831 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID:Date:Subject:CC:To:From; bh=PFK96T7avqn9jICrOvLa+GZbdRwSDF9sP7kZd14N3es=; b=SjNBQ6weldBIG4cCv4v/RPnwzTdTxs5IQIjHtZhR4RBdjJe/nKlWJUWONsjlKK/3OjNjAX/cP++Px1uHRAHGe2c40dtq7y/zYwZKZSNqiFLrbnurigTOnLoo5SFAbfocv31xnZrAlFDBB09+DfFoam9uOMdhbb2DbX/AtzakNgc=; X-UUID: d92c9e3114fa4d5c8c978949b4224d19-20200831 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 1501708277; Mon, 31 Aug 2020 18:56:46 +0800 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkmbs02n2.mediatek.inc (172.21.101.101) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 31 Aug 2020 18:56:38 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 31 Aug 2020 18:56:38 +0800 From: Miles Chen To: Joerg Roedel , Matthias Brugger , Rob Herring CC: , , , , , Miles Chen , Mike Rapoport , David Hildenbrand , Yong Wu , Yingjoe Chen , Christoph Hellwig Subject: [PATCH v5] iommu/mediatek: check 4GB mode by reading infracfg Date: Mon, 31 Aug 2020 18:56:39 +0800 Message-ID: <20200831105639.2856-1-miles.chen@mediatek.com> X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 Content-Type: text/plain X-TM-SNTS-SMTP: 80F077771CDF5D82782C84C936A5D97B92B6AC9617A3A67447E00A9E4B201C822000: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 SW4gcHJldmlvdXMgZGlzY3Vzc2lvbiBbMV0gYW5kIFsyXSwgd2UgZm91bmQgdGhhdCBpdCBpcyBy aXNreSB0bw0KdXNlIG1heF9wZm4gb3IgdG90YWxyYW1fcGFnZXMgdG8gdGVsbCBpZiA0R0IgbW9k ZSBpcyBlbmFibGVkLg0KDQpD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