From patchwork Wed Dec 26 01:54:21 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cho KyongHo X-Patchwork-Id: 1910471 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id B25CC3FE37 for ; Wed, 26 Dec 2012 02:00:51 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TngFA-0002Sl-GF; Wed, 26 Dec 2012 01:57:17 +0000 Received: from mailout3.samsung.com ([203.254.224.33]) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TngCa-0000tG-GM for linux-arm-kernel@lists.infradead.org; Wed, 26 Dec 2012 01:54:39 +0000 Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MFM0066Q7YLW9H0@mailout3.samsung.com> for linux-arm-kernel@lists.infradead.org; Wed, 26 Dec 2012 10:54:21 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [203.254.230.50]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id D6.46.01231.DC85AD05; Wed, 26 Dec 2012 10:54:21 +0900 (KST) X-AuditID: cbfee61a-b7fa66d0000004cf-b0-50da58cd4dd4 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id E5.46.01231.DC85AD05; Wed, 26 Dec 2012 10:54:21 +0900 (KST) Received: from DOPULLIPCHO06 ([12.23.118.152]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MFM00M3E7YLBY20@mmp2.samsung.com> for linux-arm-kernel@lists.infradead.org; Wed, 26 Dec 2012 10:54:21 +0900 (KST) From: Cho KyongHo To: 'Linux ARM Kernel' , 'Linux IOMMU' , 'Linux Kernel' , 'Linux Samsung SOC' Subject: [PATCH v6 10/12] iommu/exynos: pass version information from DT Date: Wed, 26 Dec 2012 10:54:21 +0900 Message-id: <003d01cde30b$ec6f3970$c54dac50$%cho@samsung.com> MIME-version: 1.0 X-Mailer: Microsoft Office Outlook 12.0 Thread-index: Ac3jC+w0gI3tcmKiQNmMYr+YxFluXw== Content-language: ko DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrHIsWRmVeSWpSXmKPExsVy+t8zI92zEbcCDDYv1LPY9PgaqwOjx+Yl 9QGMUVw2Kak5mWWpRfp2CVwZ5+c8Yi6YK1Kx4lRGA+NSgS5GTg4JAROJXzsvs0DYYhIX7q1n 62Lk4hASWMYo8W/pQmaYoj2TdjJCJKYzSly//wPKWc4kcWH/UkaQKjYBLYnVc4+D2SICdxkl Xp7nASliFvjLKPHpzCF2kISwgIfEhw0b2UBsFgFVic8r5oCt4BWwlZj/+hMbhC0o8WPyPbCb mAUMJN7P6mOFsOUlNq95C1TPAXSSusSjv7ogpoiAnsTJRjaIChGJfS/eMUJMF5D4NvkQC0S1 rMSmA8wg10gIdLNL/N24ix3iMUmJgytusExgFJuFZPEsJItnIVk8C8mKBYwsqxhFUwuSC4qT 0nMN9YoTc4tL89L1kvNzNzFCIkVqB+PKBotDjAIcjEo8vBu/3wwQYk0sK67MPcQowcGsJMLr /BEoxJuSWFmVWpQfX1Sak1p8iNEH6PKJzFKiyfnAKM4riTc0NjYxMzE1Mbc0NTfFIawkztvs kRIgJJCeWJKanZpakFoEM46Jg1OqgbHi37Keme9r9Hu3/3e/l8HwPGf94zl7ciIO3vItnVN4 8Nc1q0s5Pmu+5c8xf3qz8ru6+pPN9rI57bf4nP6FZTzezGjgX/pdOPqrjfbEBfpVLxbv+3eA ceqsjYpy8fdPSX+pLWjJ+5seo7L0Y6cdr9WWnldR5pVLdv6Snvt826GYyvl3vW4/3PxYiaU4 I9FQi7moOBEAmA+L/sECAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrLIsWRmVeSWpSXmKPExsVy+t9jQd2zEbcCDD60aVhsenyN1YHRY/OS +gDGqAZGm4zUxJTUIoXUvOT8lMy8dFsl7+B453hTMwNDXUNLC3MlhbzE3FRbJRefAF23zByg qUoKZYk5pUChgMTiYiV9O0wTQkPcdC1gGiN0fUOC4HqMDNBAwjrGjPNzHjEXzBWpWHEqo4Fx qUAXIyeHhICJxJ5JOxkhbDGJC/fWs3UxcnEICUxnlLh+/wcjhLOcSeLC/qVgVWwCWhKr5x4H s0UE7jJKvDzPA1LELPCXUeLTmUPsIAlhAQ+JDxs2soHYLAKqEp9XzGEGsXkFbCXmv/7EBmEL SvyYfI8FxGYWMJB4P6uPFcKWl9i85i1QPQfQSeoSj/7qgpgiAnoSJxvZICpEJPa9eMc4gVFg FpJBs5AMmoVk0CwkLQsYWVYxiqYWJBcUJ6XnGuoVJ+YWl+al6yXn525iBMfhM6kdjCsbLA4x CnAwKvHwbvx+M0CINbGsuDL3EKMEB7OSCK/zR6AQb0piZVVqUX58UWlOavEhRh+gPycyS4km 5wNTRF5JvKGxiZmRpZGZhZGJuTkOYSVx3maPlAAhgfTEktTs1NSC1CKYcUwcnFINjBY3xIO2 hT0pyrvzJp07s0xIz+V3foeTwY6f0vN1dz47sjTrcoFoIbun6/WM2TF7uir7M6yvm38p9hTO u/lAfaa33sO5Wfs2WyzfIXr1UVXCuV0XPotOSI5JXZT4g+t1O6t16f2YearHeGUv/BPLmRO5 oPvQ7Fuz5xQeXNXVtikp2WXXnY0fVyixFGckGmoxFxUnAgAkccBv8AIAAA== X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20121225_205437_081179_EB7B18ED X-CRM114-Status: GOOD ( 11.82 ) X-Spam-Score: -7.6 (-------) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-7.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [203.254.224.33 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.7 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.0 T_MANY_HDRS_LCASE Odd capitalization of multiple message headers Cc: 'Kukjin Kim' , 'Hyunwoong Kim' , 'Prathyush' , 'Joerg Roedel' , 'Subash Patel' , 'Rahul Sharma' X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org System MMUs in some implementation of Exynos core does not include correct version information in the System MMU. If the version information is not correct, exynos-iommu driver cannot take advantages of feature of higher versions of System MMu like prefetching page table entries prior to TLB miss. This commit allows passing version information from DT to the driver. If DT does not pass version information, the driver will read the information from System MMU. Signed-off-by: KyongHo Cho --- drivers/iommu/exynos-iommu.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c index a558c51..70921e9 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c @@ -205,6 +205,12 @@ struct sysmmu_prefbuf { unsigned long config; }; +struct sysmmu_version { + unsigned char major; /* major = 0 means that driver must use MMU_VERSION + register instead of this structure */ + unsigned char minor; +}; + struct sysmmu_drvdata { struct device *sysmmu; /* System MMU's device descriptor */ struct device *master; /* Client device that needs System MMU */ @@ -214,6 +220,7 @@ struct sysmmu_drvdata { spinlock_t lock; struct sysmmu_prefbuf pbufs[MAX_NUM_PBUF]; int num_pbufs; + struct sysmmu_version ver; struct iommu_domain *domain; unsigned long pgtable; bool runtime_active; @@ -246,6 +253,20 @@ static unsigned int __sysmmu_version(struct sysmmu_drvdata *drvdata, major = readl(drvdata->sfrbases[idx] + REG_MMU_VERSION); + if ((MMU_MAJ_VER(major) == 0) || (MMU_MAJ_VER(major) > 3)) { + /* register MMU_VERSION is used for special purpose */ + if (drvdata->ver.major == 0) { + /* min ver. is not important for System MMU 1 and 2 */ + major = 1; + } else { + if (minor) + *minor = drvdata->ver.minor; + major = drvdata->ver.major; + } + + return major; + } + if (minor) *minor = MMU_MIN_VER(major); @@ -933,8 +954,15 @@ static int __init __sysmmu_setup(struct device *sysmmu, const char *compat; struct platform_device *pmaster = NULL; u32 master_inst_no = -1; + u32 ver[2]; int ret; + if (!of_property_read_u32_array(sysmmu->of_node, "version", ver, 2)) { + drvdata->ver.major = (unsigned char)ver[0]; + drvdata->ver.minor = (unsigned char)ver[1]; + dev_dbg(sysmmu, "Found version %d.%d\n", ver[0], ver[1]); + } + drvdata->pbufs[0].base = 0; drvdata->pbufs[0].size = ~0; drvdata->num_pbufs = 1;