From patchwork Mon Feb 29 08:45:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 8450341 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 2F1D49F372 for ; Mon, 29 Feb 2016 08:47:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4DEAF2021F for ; Mon, 29 Feb 2016 08:46:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 72D1620173 for ; Mon, 29 Feb 2016 08:46:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752068AbcB2Iq5 (ORCPT ); Mon, 29 Feb 2016 03:46:57 -0500 Received: from mout.kundenserver.de ([212.227.17.24]:55358 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751992AbcB2Iq4 (ORCPT ); Mon, 29 Feb 2016 03:46:56 -0500 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue101) with ESMTPA (Nemesis) id 0MS1yk-1aUNRT2keI-00THGU; Mon, 29 Feb 2016 09:46:17 +0100 From: Arnd Bergmann To: Joerg Roedel , Marek Szyprowski , Joerg Roedel , Kukjin Kim , Krzysztof Kozlowski Cc: linux-arm-kernel@lists.infradead.org, Arnd Bergmann , iommu@lists.linux-foundation.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] iommu: exynos: pointers are nto physical addresses Date: Mon, 29 Feb 2016 09:45:59 +0100 Message-Id: <1456735568-3886545-1-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.7.0 X-Provags-ID: V03:K0:nM/NfYnyZnLpC7xc6UjSackLPhzQB5uvVnqjFsWvAG0jArENhzN +RU9M19ZLVSffz5ygwQJVhfhjDKUr7HvXcMwr3EzAIC+dZ1ci3ZMbB0mvjJzdYfV/IWRIse jVIWfTHHiDnVl6/daYYqSFWDa3Nny+NHdfitZB8Yiu5xAsNVIho13jvcbd4msyKdVwBW4Wy yo5kaFmMtVWxoGIno0msA== X-UI-Out-Filterresults: notjunk:1; V01:K0:/olG1ckZ2Zw=:aNx5aHiNs/HSXPYqthkFBq 618yPrZ4zqxxLnj/cKYbaPcbFJ+CAga1rcE+T6jcP1E+rx5pBDvbppmmdtPYrDB1155HD4WJ0 s/UHPw+YFpVig4WNkarZ31sqbJdBq/P7cy0cYfqv1PZ5ckJyOH+W742b5T8V/ZA9TGELhDyVr TfN0+mxHNadWcTdTSchGiF/2Vdb4nOoTTEknyZXYT6yVYlk21gvoaRzQbDDn1kng+AhD0zT/b AL7kaBPvBFhX4VrFcKl8vw2HAXtDufFTME/Uin25+DJX00Z3ywb3u/PAjOCq6f2Q5fe1748qM B2nqNRWTnLTRI1IqrUVWU9v3w/C3o+Br8GtHO69ywOhv2F9hK0Mlw7X/hdyVj7vIY/IVC5Kbw nLx+UiuVBSQPZL4WfS5miQaZ7eJtWLfyg9yd4DFM08pZugemwB9Bn+uFYD3+hci4Fs6LFiIUn +SoUL055jb7RRFrH13bjLJGsyi1AF3aXSuCkPxcaQKIzEy2cmojSe7Eah42fo4+DMcsndBqlj 7S3/ywmLfR+EFJl+faNC67V+XJ0pCQE5Ar+SAeEalvlj3om7UdkCr8LaIwo8rW6tpJb3/v0ds e6En0+uMI46AlPjngKvTCzdf4HKJ4iyOUILFsz96mbauOKAeID6VedC/rt6XDUAgQcW9AKliA fkDeaPUtHlowLUFHcWkVHmIV6VfezLfAnb/6ITFTI3QiNtU4jDdak3ynlQJgIGRYZVQY= Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The exynos iommu driver changed an incorrect cast from pointer to 'unsigned int' to an equally incorrect cast to a 'phys_addr_t', which results in an obvious compile-time error when phys_addr_t is wider than pointers are: drivers/iommu/exynos-iommu.c: In function 'alloc_lv2entry': drivers/iommu/exynos-iommu.c:918:32: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast] The code does not actually want the physical address (which would involve using virt_to_phys()), but just checks the alignment, so we can change it to use a cast to uintptr_t instead. Signed-off-by: Arnd Bergmann Fixes: 740a01eee9ad ("iommu/exynos: Add support for v5 SYSMMU") --- I also see that some incorrect __raw_writel() calls have crept in around the same time, which breaks running big-endian kernels when this driver is loaded. Please fix and that that as well. drivers/iommu/exynos-iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c index b0665042bf29..484b3b37631f 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c @@ -915,7 +915,7 @@ static sysmmu_pte_t *alloc_lv2entry(struct exynos_iommu_domain *domain, bool need_flush_flpd_cache = lv1ent_zero(sent); pent = kmem_cache_zalloc(lv2table_kmem_cache, GFP_ATOMIC); - BUG_ON((phys_addr_t)pent & (LV2TABLE_SIZE - 1)); + BUG_ON((uintptr_t)pent & (LV2TABLE_SIZE - 1)); if (!pent) return ERR_PTR(-ENOMEM);