Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp966444ybh; Wed, 22 Jul 2020 18:49:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwAOfi+qLjvEKEVbDzy0wh4LJY0a5ZQt3JqTAicN1bOXGYUyNANNGZX9xwgoBHTLPe7fRot X-Received: by 2002:a50:fd12:: with SMTP id i18mr2091569eds.371.1595468947585; Wed, 22 Jul 2020 18:49:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595468947; cv=none; d=google.com; s=arc-20160816; b=dhu3XRAfk+/qFS1Kawv/UVCJoQrcqiwkROZqhkHhTYsbSK5t019LkgBXBFuUKj9PMQ xOn+oiHVknXyLmTXWG165Daw91G6U2E8pVckcaZxZI/YMpNKhxApO93oPb3Ay7S+VbBC MWDBeE/TJPHHvsrk7MDQNIWNfQHyspmzIDOnajG2eUG9o07QESRxYvudFJaTIrgU77n7 YKwKJw9N8ZEL7GpGppaiogs0VradweTkrMP437xje7UnJIwQBboe+kSYkjAj8+wCzUsT fEIft8QdnQT/Ysm5NezBPQ+zjPm03EUoyPTuVLj0TC4CjEHZ7aPEuWtLBUGt7LOiCQ7E EuXg== 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=xB3vYsH5mGVvpIjLZzZB6IHf61wU6lbXndzMHp0RF0o=; b=lUnDbJPBuqhPdf/hhFPcIqWNSU4FadBHrloZg8GDWzMl3xdBEwJ7wSKkYvXdZXTK6+ VcX+PTmVNXnLSEpJP0wrvBFHQ2LN0wqwBKkm0FJEvrk+dmH7v6/EX9nyrxHf+cBxut8I 0uG+vOdLwwJX6+TDvnKcZ+DRI900TCWPNxNrlkzO6tZcyxNrO5RPNTwQU1HtWeNWwX71 wzTSSdTj/iWFaA4dkJ4KEjHA+u/DL2dqlzoos6cOeTGGQRuNf8NMJOXZ+CuHkDJLvlvo OOgSjHAO2Y86wSwA66veH7gbi4wY43JVrsKmQ1ALmcbm8OBGnmGAlDY7mjjFeSdscs2p WjWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=AJvIf34L; 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 aq2si302879ejc.297.2020.07.22.18.48.44; Wed, 22 Jul 2020 18:49: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=AJvIf34L; 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 S1733276AbgGWBr5 (ORCPT + 99 others); Wed, 22 Jul 2020 21:47:57 -0400 Received: from mailgw01.mediatek.com ([210.61.82.183]:27257 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1729198AbgGWBr5 (ORCPT ); Wed, 22 Jul 2020 21:47:57 -0400 X-UUID: dc3f9e2680a5426f90fec775d1b71688-20200723 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=xB3vYsH5mGVvpIjLZzZB6IHf61wU6lbXndzMHp0RF0o=; b=AJvIf34L8HGRiopROr4BOPH7SmMvvNAvwW6FTy9GhSNzC2oAGDHwUCgU8Q0TzL0ARy87E565P7KDQyUm0gUnwQY73BL6WjHl3xAUrx8BOmSX4ZRUvJ8s07pVzUg0fRD7hztefeRfbwILULsfCA6qmhgtl8XSz56MjkM+EbKmBqs=; X-UUID: dc3f9e2680a5426f90fec775d1b71688-20200723 Received: from mtkexhb01.mediatek.inc [(172.21.101.102)] by mailgw01.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0809 with TLS) with ESMTP id 1119077577; Thu, 23 Jul 2020 09:47:53 +0800 Received: from mtkcas08.mediatek.inc (172.21.101.126) by mtkmbs01n1.mediatek.inc (172.21.101.68) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 23 Jul 2020 09:47:51 +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, 23 Jul 2020 09:47:51 +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 v4] iommu/mediatek: check 4GB mode by reading infracfg Date: Thu, 23 Jul 2020 09:47:50 +0800 Message-ID: <20200723014750.14491-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 dGVyLCByZW1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