Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp549425ybh; Wed, 22 Jul 2020 07:20:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJynAUngFyKeVVRqgZAtQtp8V9usDz6L2Zhj1OD1sFHuvA74F5qKiBWWofCz18zcFfdQ6BTI X-Received: by 2002:a17:906:3446:: with SMTP id d6mr29424797ejb.323.1595427606985; Wed, 22 Jul 2020 07:20:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595427606; cv=none; d=google.com; s=arc-20160816; b=Rcz102mYwL8vO3vhhoa69YSuxFORsn3j3uH1gW61b+h8kDIagVS8YXXv/UnqW+9Rq2 a9kf/vrEeU5s6xAVaDmB258eL6Rs83RrZ6b7b9Pvr9HizoInT50PBTxUsnGQlJdBeuaI ywsa+aDJKXjwIyWb65XyxnzTUjo5vf8C6LPC+uZkXShODbp39mkqlMNivxtK305Z/Pvd lq6/T0BPqwUppz1U7+Jus1W+7cDxMApudxm/BvgKcaCPDdJonT0+jBRVceFaK0Shg6R7 lKUxeZxAosnpC1VHFbU/F+K0ocL5hKxUUWc33KwfN168fqMRJs14gA1xnPOxli+Rgrwu 2Mew== 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=GVJnyqG5qtAiG4ewbpOZ6PTRkaO5mAaqoonpe2maeS0=; b=UlyMpr3MDjEBufwzo1e4ecv7gsP0DzVP+pcurgtaiAQL1/GXXqfCdVL25dCboF2YeM VmHBGOmlXn8kwwBXLovp/aZla+iiKwzr2xRZ1yppEEGBqxe8IWiEnp5e7p0B12c0MLs8 Q8lwUwz8VNe1sgnXLsmudevY/IE8Vy5b2OI4Y+ONbuLSbslYFMdM8nonuTPQRfOLBzC8 pTMXQwwTun8EJTqLB7ImQfG/1UHeGUKT4P/GBl3zg/tKg6VLX9rJZF3IBvxBeot4lMOA hVpK6Uxk7QUSopTZpUwtA74QprCt/0i2XWXFCISpbpw2blPDiMDwilMvOvyBgs3f2Hgd EWvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=t8MdMqMH; 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 u12si82699eja.373.2020.07.22.07.19.43; Wed, 22 Jul 2020 07:20:06 -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=t8MdMqMH; 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 S1731000AbgGVOTe (ORCPT + 99 others); Wed, 22 Jul 2020 10:19:34 -0400 Received: from mailgw01.mediatek.com ([210.61.82.183]:61334 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726003AbgGVOTd (ORCPT ); Wed, 22 Jul 2020 10:19:33 -0400 X-UUID: bf6ea4f9f55e4573aecfd81459315b05-20200722 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=GVJnyqG5qtAiG4ewbpOZ6PTRkaO5mAaqoonpe2maeS0=; b=t8MdMqMHCFhobvALTO9P3crQSzsBrFgmKaI9XrslUnc9oZKutld7zPqYAJigJ88f0dgcAMdVSuoM0hUQlH+zj8D3fGyLtn3jIuycITTzv43P00d9By0I42AkYD55dP7oY4JGI44t6ITPQo0WH3yY1xm2AvJsmqDloTlMnT148Jc=; X-UUID: bf6ea4f9f55e4573aecfd81459315b05-20200722 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 1636749737; Wed, 22 Jul 2020 22:19:29 +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; Wed, 22 Jul 2020 22:19:24 +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; Wed, 22 Jul 2020 22:19:25 +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 v3] iommu/mediatek: check 4GB mode by reading infracfg Date: Wed, 22 Jul 2020 22:19:25 +0800 Message-ID: <20200722141925.14861-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: 3FDBDF1D74D313BDD0B5091DC2AD0F9931F251897C4EB80046840637F0DE86352000: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 ZSBpcyBlbmFibGVkLg0KDQpDaGVjayA0R0Ig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