Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1325986ybt; Thu, 2 Jul 2020 02:38:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyfcsehd8dOTly+dfrsSAZdTq9qKaAzn9g4Uir07uhAAK+tlwt7uouduydQMbvPLGkd6vPG X-Received: by 2002:a17:906:511:: with SMTP id j17mr23553620eja.434.1593682710782; Thu, 02 Jul 2020 02:38:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593682710; cv=none; d=google.com; s=arc-20160816; b=vBLtD1XdAlLU++v4ic1cizGf9ZJwWWlAcmiMtGLaT8XZ7Q+XVCcsc+Zs29H2qvlOuS 9PwKi8+vdg18rAQEYqWAVmOidz21T79wWzBSLWcEmidIqEftExIF5Wy3EKrd0YIQQ5Mo X6qQ075+Rqup1ODEwr9RKUUoOiH+QWk//PfxV/FXbzC6pjruzzJ1JZElrCwo2fY8WMbh 0aM9QwL7LQJyiWveSaxp0YAlRsY+gzFl38cqQdSlR33T/l26yK2MFcS1KzbmqdL/EZxZ lMCtUIuexN0OL0H2TYqQpvkdOjqAdA46ufPBoHWwDi5JO2UtIH2VaVzoJDLGzzCprmhK iuyg== 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:message-id:date:subject:cc:to:from :dkim-signature; bh=srCB5XNrPlYp3HSyZlphU1Xk3HZN3j+BE4+7DogmQy4=; b=hWLco/uzvKLKtj9tbnO8OJmaQi8MHxmxVmLqQtOiW9Pt1W6ewTB+9sCRWLTmgaflnr lgVtxXrv1VjFTW1kk3Qsf8QHeuaL3E4x+sD1+c6HaSBkGLSlxAJKcAsTmcl6vezBZ68v zRRUdormWhqyn674b5hQA4OJdGA/hweCt7e1cJC0kURkDGOoEWte6wl4/U6rKTfiink+ yiKvCAAyWdWVUDZKY+sBluHGAUEpuwbYuRY9BywCURJu5D1sjECveccFCDkd3PEDLfAf zDT+21KYmvSHq2II+xXb8/U6TUmIJwA3wYd+lXHUMdQJXige0bk8NOILTK4b5umlCGCO C0cg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=ahZe316A; 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 qk3si5720888ejb.323.2020.07.02.02.38.07; Thu, 02 Jul 2020 02:38:30 -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=ahZe316A; 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 S1728323AbgGBJhk (ORCPT + 99 others); Thu, 2 Jul 2020 05:37:40 -0400 Received: from mailgw01.mediatek.com ([210.61.82.183]:21681 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726475AbgGBJha (ORCPT ); Thu, 2 Jul 2020 05:37:30 -0400 X-UUID: eaf6688f8280499c981c850801bb6627-20200702 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:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=srCB5XNrPlYp3HSyZlphU1Xk3HZN3j+BE4+7DogmQy4=; b=ahZe316AlRZVKQKpFx8qUSc/9KwNv7eR2m1bhZOhhjy6zwuLS5q+raAqLi/BoTImAln0PWbNIjDX7IHcp22NJbaIwMKQUVQc9J1Xz62N6T4OOMn2ow53jX8ezYmiJGQ5lCKrPDqltBkogMYronch5CCTtYAJxo+7v/X3XvqQyFQ=; X-UUID: eaf6688f8280499c981c850801bb6627-20200702 Received: from mtkcas10.mediatek.inc [(172.21.101.39)] by mailgw01.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0809 with TLS) with ESMTP id 1895597495; Thu, 02 Jul 2020 17:37:25 +0800 Received: from mtkcas08.mediatek.inc (172.21.101.126) by mtkmbs02n2.mediatek.inc (172.21.101.101) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 2 Jul 2020 17:37:20 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas08.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 2 Jul 2020 17:37:21 +0800 From: Miles Chen To: Joerg Roedel , Rob Herring , Matthias Brugger CC: , , , , , , Yong Wu , Chao Hao , Yingjoe Chen , Miles Chen , Mike Rapoport , David Hildenbrand , Christoph Hellwig Subject: [PATCH 4/4] iommu/mediatek: check 4GB mode by reading infracfg Date: Thu, 2 Jul 2020 17:37:20 +0800 Message-ID: <20200702093721.6063-4-miles.chen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20200702093721.6063-1-miles.chen@mediatek.com> References: <20200702093721.6063-1-miles.chen@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-TM-SNTS-SMTP: A048809BF75A2565D4E6E6BBA7AA1D99F242281B24CA77BCBD8A0D61FB421EA72000: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 SW4gcHJldmlvdXMgZGlzc2N1c2lvbiBbMV0gYW5kIFsyXSwgd2UgZm91bmQgdGhhdCBpdCBpcyBy aXNreSB0bw0KdXNlIG1heF9wZm4g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