Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1207574pxk; Fri, 4 Sep 2020 03:43:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzMHblkaiwUVociatWvHOhMZYfrac8qOs3NLwAUATL5pWK9Bs0HkkNEVdtwSpZupVdAOpEm X-Received: by 2002:a50:9e6b:: with SMTP id z98mr7471047ede.365.1599216181209; Fri, 04 Sep 2020 03:43:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599216181; cv=none; d=google.com; s=arc-20160816; b=OqHkEUumG/OrhGmIZY5r17mFJmD4w+FgUaeptz+sZ/euE5TSWKnoRB90YkKsIWTn9i d32I9gzKoauhobd3l0zGxNHIdNjl5mzuyRcNGvEq72J4W9Ri3SMTI7df+k1xA2B4ubxG y0wNB6XnRBUnfbkiGgGFC/dRH3eKGxcQu+NYZ24Zjv/h6ssccD2cC5u7CpXOGcKgtFBE VLMeafINKscHjUPDxHgA5YOWW8/k2I8NArbmbY6gw2dGefIXzYWiHBgR36i0LdDi/4Jg e4dPzLl6jyOOjgE/dWASrluzXTUOdC92UsIeWiXYONIJWhNA9Uj+zS5xB8xezwWvfgGF ReyQ== 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=+foNOXIgIh1kuuS1RTWqR7W2PgiV9fXKECaUSNGOkmY=; b=FRNTSUd0g5Tr5E9g+CLYRkCKvQ4kI5tNFcfZKmPwaThDDehteMpbuOuyjE2kRVERRN kTQbzPyBOijKa/bQhOP8rBrVK3mTwAVHjpGYvLmW86/0EEsIiruJHDqhh+E/cDw4tf7z 6Srz78GcCYzViE7+t6aifayqmMErG+ixiUCaRUW3GzJb41EbqAgo/UA8wAGItGnP0Kq2 8QSJWj3uwyEQOKXGAqzABaexfQWmQ/3sMqFf49mlZcIChcm57HwhF8blUedQXXG/elBc h8QP4a4y3MC8IRwuUOcm61x2Yv98NH+APpVmkXnIB7IpX5w0byFq6LL9K/e33FiK43o2 HvUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=vDafAjZh; 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 t21si4401978edi.213.2020.09.04.03.42.38; Fri, 04 Sep 2020 03:43:01 -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=vDafAjZh; 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 S1730202AbgIDKlK (ORCPT + 99 others); Fri, 4 Sep 2020 06:41:10 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:12202 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1730180AbgIDKku (ORCPT ); Fri, 4 Sep 2020 06:40:50 -0400 X-UUID: 64c71c1da95b41f5851dc5712fe4fbac-20200904 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=+foNOXIgIh1kuuS1RTWqR7W2PgiV9fXKECaUSNGOkmY=; b=vDafAjZhBr9b/kXzS0qNaq3RDs99RuSW6YrpiKIdChoe8TQO7mt2uBDWk+92uM/+9gZRLjnCkoK6zbTx7aXf8zJ6bIjOkKKERyhmYW+6RE67OHhLNhhO1V9nTG5Jk4l8BlQ3Tc1vBujjLyDBio9VvAMZDQgF2oAg6W/8mkwIDus=; X-UUID: 64c71c1da95b41f5851dc5712fe4fbac-20200904 Received: from mtkcas11.mediatek.inc [(172.21.101.40)] by mailgw02.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.14 Build 0819 with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 789402017; Fri, 04 Sep 2020 18:40:44 +0800 Received: from mtkcas08.mediatek.inc (172.21.101.126) by mtkmbs02n1.mediatek.inc (172.21.101.77) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 4 Sep 2020 18:40:37 +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; Fri, 4 Sep 2020 18:40:37 +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 , Rob Herring Subject: [RESEND PATCHv5] iommu/mediatek: check 4GB mode by reading infracfg Date: Fri, 4 Sep 2020 18:40:38 +0800 Message-ID: <20200904104038.4979-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 ZSBpcyBlbmFibGVkLg0KDQpDaGVjayA0R0IgbW9kZSBieSByZ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