Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp3500734pxa; Wed, 26 Aug 2020 01:59:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx1smgf7gWKzoJgvbkbk+U6o/JKinGz5UaLEUf8lkOCzjkKPNOq/Em9KrPKTthNuXybxDVs X-Received: by 2002:a17:906:a109:: with SMTP id t9mr15690695ejy.134.1598432347690; Wed, 26 Aug 2020 01:59:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598432347; cv=none; d=google.com; s=arc-20160816; b=T6jqWpAcT15IQTBwk3uutSFPOxIGliCZDWoXxE0QXy+lrNCf+7J1W8W5xnUXOmjbDv TaesWDZNpWbRlB9ClGXLwgxTi9bWbQ5MVS+zUeeaRRwmwoFHmYNEHz+tZZXgBT460oAj dy1dhAeG8dqDx6i4BvyWyGfQ0H5vc4C0wy3CsvFoLx78bO/vRi091gf6dqxIi3khybex i2EFQLW855Oe+bQUsTJH7fhs8Mbk1CnDKtEIhYAZ7x1J8DF7kIdW+ydaVQDmU1jxAnop LQMVPZGdPOEbIZLZPmjwczp71QUdt6xCuTfJb1VDIlRjOFU5SScrfuShbv0LUuOY8DF5 TSJw== 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=0y0Vfo6/get6fXxv+JKbgOiwCIDoQLsBCkYvCv7n8ek=; b=smlXzOkOlHCXU0jvxLAbNQaSjxP64lOxLO/Q6/zplXXC198uz1ybLSMBJiAduLI71c JSjvhw9fMQhaHi7RA+iO87Wtqd++WBAW9uHoWOcKOVtej0+C+myKP/BhWd8HM4RmSBgY RQwcuJA3TY/VUFP+Baig9yQ/dzdpVHWTSit9/deMOq6aF6fMcdw4d7UGpdhCxl2SulIN LhAAZAqYrePxdvzoFXUnWvnGtx+pSYTiStCjQnkiExDYRxvyi6BBG3MfAQD7qyK74ZX3 p9iWmv3zGmx9DsmK5Sf7Asz8PwCYqAEyQ+FRjKMBYjRmXTBoU/6EpWUXYaHqABoP2bdh WAuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=hqvi7lbj; 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 z1si1132919eju.231.2020.08.26.01.58.38; Wed, 26 Aug 2020 01:59:07 -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=hqvi7lbj; 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 S1727932AbgHZI43 (ORCPT + 99 others); Wed, 26 Aug 2020 04:56:29 -0400 Received: from mailgw01.mediatek.com ([210.61.82.183]:7989 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1727793AbgHZI40 (ORCPT ); Wed, 26 Aug 2020 04:56:26 -0400 X-UUID: 5449f9c61e02490db3bee6e3dc33b42a-20200826 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=0y0Vfo6/get6fXxv+JKbgOiwCIDoQLsBCkYvCv7n8ek=; b=hqvi7lbj0WRx7lbM4KJFWEvN8WPZZaznw0EePpBG/ULsutCHqAWvkQlrmufhNrzPdaMBLCkgxLAFcHWHysK0j6I3t+ftEEGzpASlUI8duR3SzWNPTeY+jVOP2T+pjGhvolLwVho7CBeWCG2Fz4aqaArdWWSwhSYfOOlwflbbvCU=; X-UUID: 5449f9c61e02490db3bee6e3dc33b42a-20200826 Received: from mtkcas11.mediatek.inc [(172.21.101.40)] by mailgw01.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0809 with TLS) with ESMTP id 990541766; Wed, 26 Aug 2020 16:56:20 +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; Wed, 26 Aug 2020 16:56:17 +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; Wed, 26 Aug 2020 16:56:17 +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: [RESEND PATCH v4] iommu/mediatek: check 4GB mode by reading infracfg Date: Wed, 26 Aug 2020 16:56:18 +0800 Message-ID: <20200826085618.2889-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 d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