Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp639803ybh; Tue, 21 Jul 2020 04:26:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx2eNcL619pU29PvwIy4vXs3uG7k3s+yFFLYMfbpaKOFK158qNn5xiC8M78DPwE5qFwqJF3 X-Received: by 2002:a05:6402:cb9:: with SMTP id cn25mr26175461edb.247.1595330799866; Tue, 21 Jul 2020 04:26:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595330799; cv=none; d=google.com; s=arc-20160816; b=b9Z6ytEFGTn7IEGAo+yP5zRi4oRUWgdpZy76cdK4ZERA9C8t+Ho8SYQbCjiY73hFyb 1EuNjfZOsP23X0EX3U7DG+1EruIra0qCAS5jDt7v6iiqI7xxVn0O7dMxZgRRwDvypeb+ zaEmykaR4agbMpJhanDC8TLtTEWBqqc8oCfF4qOuZmsVbOZsmJ4cSWvJxm9q6U4o8Knz 6vlAiZDaCPGSTrPQHlpeoDZOZzf7QyYHuzobIY2tkhkZqnvm8T2VR3ty0HEsJ3yscdiE F38n+8JfipnqHQ8f2GUT0k3AWtFqNum6MVUzmgVgpwjOXCjPc8NGVf0votLQ4g82T4jV wZIA== 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:date:cc:to:from:subject:message-id :dkim-signature; bh=qpykmZSQGs2bMX7gw2YPF5m+GwO54FLnah9QDtNvrQ0=; b=dgDOhxpMzOGL6b52YabSplRfHu3Uhu9AFnbi4Cc80CSSeaD9D9ypfeM1PYhz7Kq7Yn AWAeLVPW41MNFhzqCzbG3hOWxyKA4tp3KUNd6/so1xUBXPoEGat7C8JyRaF2Ep1A5nBx cyuxVJHM8jDgINbZ5QBAXlOufTesYGQ1GVL9qDxJ26pMohdvO4S37QSUJVc2kx6OcDjI /ftDVNe+QZGol6EPr6nvRqtcKguCv5GMeK44bGuNbwA3Vo0WbzlwlyQLbO4lDnKUT/HV l9/oF6ZFNua9VCjVYsYE5N6b1DYlArwpI9xLfUHIgyM5qGJSb2Ns3cbhj73+b2NM3jYl eSlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=ZRsNNfLe; 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 v5si11698129edl.202.2020.07.21.04.26.17; Tue, 21 Jul 2020 04:26:39 -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=ZRsNNfLe; 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 S1729699AbgGULZt (ORCPT + 99 others); Tue, 21 Jul 2020 07:25:49 -0400 Received: from Mailgw01.mediatek.com ([1.203.163.78]:48750 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1728108AbgGULZt (ORCPT ); Tue, 21 Jul 2020 07:25:49 -0400 X-UUID: 0515596a95c24048a7b50e6f2c9789e6-20200721 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:MIME-Version:Content-Type:References:In-Reply-To:Date:CC:To:From:Subject:Message-ID; bh=qpykmZSQGs2bMX7gw2YPF5m+GwO54FLnah9QDtNvrQ0=; b=ZRsNNfLe2QClA7ks/IJQ35Eb2WrkD3idGZMPmzmS5ZcXcFbVPc1u1eiC1TCntDcxiRiiePXhccXyq7TIX7P/TKHaqCp+sHB+YRbGNufIqdQExCocbCLvStuwJJ2eqgxjx3kRj5Hynm8dwpKyZniVfhH6iZmfzNYLoVW1SACiRi0=; X-UUID: 0515596a95c24048a7b50e6f2c9789e6-20200721 Received: from mtkcas35.mediatek.inc [(172.27.4.253)] by mailgw01.mediatek.com (envelope-from ) (mailgw01.mediatek.com ESMTP with TLS) with ESMTP id 1266660983; Tue, 21 Jul 2020 19:25:42 +0800 Received: from MTKCAS32.mediatek.inc (172.27.4.184) by MTKMBS32N1.mediatek.inc (172.27.4.71) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 21 Jul 2020 19:25:39 +0800 Received: from [10.17.3.153] (10.17.3.153) by MTKCAS32.mediatek.inc (172.27.4.170) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 21 Jul 2020 19:25:39 +0800 Message-ID: <1595330677.16172.55.camel@mhfsdcap03> Subject: Re: [PATCH v2] iommu/mediatek: check 4GB mode by reading infracfg From: Yong Wu To: Matthias Brugger CC: Miles Chen , Joerg Roedel , Rob Herring , , , , , , Mike Rapoport , David Hildenbrand , Yingjoe Chen , Christoph Hellwig , Chao Hao Date: Tue, 21 Jul 2020 19:24:37 +0800 In-Reply-To: References: <20200721021619.25575-1-miles.chen@mediatek.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.10.4-0ubuntu2 MIME-Version: 1.0 X-TM-SNTS-SMTP: FAB7B75237DE000BACAED1A8055572801DDE7023171D49975F3AB582270F9ECD2000: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 T24gVHVlLCAyMDIwLTA3LTIxIGF0IDExOjQwICswMjAwLCBNYXR0aGlhcyBCcnVnZ2VyIHdyb3Rl Og0KPiANCj4gT24gMjEvMDcvMjAyMCA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