Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp361468ybh; Mon, 20 Jul 2020 19:19:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyhm26H0psYIKtGNMY3N846uF+FX91tFupv/ZKZEq1lOtXX+xxUPelAnPItxQjem1QjO0gs X-Received: by 2002:a17:907:11db:: with SMTP id va27mr24458642ejb.175.1595297961582; Mon, 20 Jul 2020 19:19:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595297961; cv=none; d=google.com; s=arc-20160816; b=nk/1M7Kkca1jRpESrRSs5hUBoCW3LLXgJ5Ug3TrpjYq0wLTz60Lqmg8j1LL7EmfE3O sRZAu55ai/IWDLBLttNnV5adtr0OKvRHYDlzUzqqRXY1s5A7chQcGo10nbIV+LFONRhJ woi6BnpbwEXxS1Qq6Iug1mIhXZWVlyP9xW3A7EVQB0wn7JL4ae9ok77v2YZHPvgJ8qsR KiZ86WLTMfMWm41W6ADGnPxZz+zIgsVWI9sTiEc3GrGy9S+FQPEQUNAKkKXQ5sXcSAtK l9Du/M3jkkpuunJq2eyOOJgKgkvupVYN1R3We7nee2ndL3YuEGHR/UeO1FPYA4zfKaeb zISw== 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=1bSgcMBsyM3c9aSUx6HgVWkvGxtBrg5PzcKspdBYPfE=; b=XUmsXVwnVX4319GpTMfHudlVaj85aWTj0Uxs8yoj/B9mZhusb+Y51XytpAL2P/66WA CnrNbWTk94fFlKRJi2379t+r3BWm8aQTVy9fo15iJ3doFXje6SUTnCIBul56WwizZdxe cBjEpnKPD6P1mMQ/kpDbLEJ9ZwrZmopkhmDR0vfQY76o9v02CJgQPas0jubphOp4uD9X QiS00vkyQne5iFMIf4+bORWGqG1rmKG/R5PBzGQtJrGvoc+M/btYmiZ0wDgr+VBrwZ/U bxAT+PazMfqZekD3Mlx+NRxEGtaLjLlpVKU/RqVFBfrpL2O0hDA4pPPl6zE17gW0VjaP +WLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=uU0K7gWF; 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 w18si12053532edx.276.2020.07.20.19.18.58; Mon, 20 Jul 2020 19:19:21 -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=uU0K7gWF; 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 S1728162AbgGUCQ1 (ORCPT + 99 others); Mon, 20 Jul 2020 22:16:27 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:11310 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1725774AbgGUCQ0 (ORCPT ); Mon, 20 Jul 2020 22:16:26 -0400 X-UUID: a19c054b7fde42b58d6bb2b3cd59a97b-20200721 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=1bSgcMBsyM3c9aSUx6HgVWkvGxtBrg5PzcKspdBYPfE=; b=uU0K7gWFecpXxjP8fs8a5jIXNn9ppUVyp+B6uKN62qUvJ0dRRftxxRmZqXu7i1sHHMUKv/k0GTiOXhvrx6LDDIf63aLx7DUfDNz+3AXiQqR3RVRpswopdwczSzcpnmOKVG+wCJogGwnu8umHFijHrLpU9qBDRcgvAxSvQI12HuU=; X-UUID: a19c054b7fde42b58d6bb2b3cd59a97b-20200721 Received: from mtkcas10.mediatek.inc [(172.21.101.39)] by mailgw02.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0809 with TLS) with ESMTP id 300682285; Tue, 21 Jul 2020 10:16:22 +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; Tue, 21 Jul 2020 10:16:20 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 21 Jul 2020 10:16:21 +0800 From: Miles Chen To: Joerg Roedel , Matthias Brugger , Rob Herring CC: , , , , , Miles Chen , Mike Rapoport , David Hildenbrand , Yong Wu , Yingjoe Chen , Christoph Hellwig , Chao Hao Subject: [PATCH v2] iommu/mediatek: check 4GB mode by reading infracfg Date: Tue, 21 Jul 2020 10:16:19 +0800 Message-ID: <20200721021619.25575-1-miles.chen@mediatek.com> X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 Content-Type: text/plain 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 ZSBpcyBlbmFibGVkLg0KDQpDaGVjayA0R0IgbW9kZSBieSByZWFkaW5nIGluZnJhY2ZnIHJlZ2lz dGVy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