From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753310AbcB2JeI (ORCPT ); Mon, 29 Feb 2016 04:34:08 -0500 Received: from mailout3.w1.samsung.com ([210.118.77.13]:34142 "EHLO mailout3.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752913AbcB2JeE (ORCPT ); Mon, 29 Feb 2016 04:34:04 -0500 X-AuditID: cbfec7f5-f79b16d000005389-03-56d410885ca1 Subject: Re: [PATCH] iommu: exynos: pointers are nto physical addresses To: Arnd Bergmann , Joerg Roedel , Joerg Roedel , Kukjin Kim , Krzysztof Kozlowski References: <1456735568-3886545-1-git-send-email-arnd@arndb.de> Cc: linux-arm-kernel@lists.infradead.org, iommu@lists.linux-foundation.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org From: Marek Szyprowski Message-id: <56D41087.60506@samsung.com> Date: Mon, 29 Feb 2016 10:33:59 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-version: 1.0 In-reply-to: <1456735568-3886545-1-git-send-email-arnd@arndb.de> Content-type: text/plain; charset=utf-8; format=flowed Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrILMWRmVeSWpSXmKPExsVy+t/xa7odAlfCDBov6Fr8nXSM3WLBfmuL ztkb2C0mn5rLZPH6haFF/+PXzBabHl9jtbi8aw6bxYzz+5gcOD2eHJzH5PH71yRGj02rOtk8 Ni+p95h8YzmjR9+WVYwem09Xe3zeJBfAEcVlk5Kak1mWWqRvl8CVceHhUaaCS/wVf5ecYWxg fMTTxcjJISFgIrG0oYUNwhaTuHBvPZDNxSEksJRR4mPDQhaQhJDAc0aJ00+qQWxhAXeJW1s+ MYIUiQhsZpToaXzK3sXIAVRkL3G9RRgkzizQyyix6M5sJpAGNgFDia63XWAbeAU0JJqvd4DZ LAKqEoe/PABbICoQI3H83TlGiBpBiR+T74HFOQUcJB7efMwOYjMLmEl8eXmYFcKWl9i85i3z BEaBWUhaZiEpm4WkbAEj8ypG0dTS5ILipPRcI73ixNzi0rx0veT83E2MkIj4uoNx6TGrQ4wC HIxKPLwvNC+HCbEmlhVX5h5ilOBgVhLhff4HKMSbklhZlVqUH19UmpNafIhRmoNFSZx35q73 IUIC6YklqdmpqQWpRTBZJg5OqQbGPR1rG14tUv2nLebDdsD1o0jsxulSYmJvlmbrehnxRqcK rnq6SGAr6/WPLvY7nqyS3PBHbG7irs37PbSZMifc+rkqmf3T765ZRi0/w5kWLBA/svmfUafC lex1O3R8mO5Yxs/lnrn8+f1aw3tFPPVfTzWryItxSp/jaUpMrbNY23pRKnrbpQOrlViKMxIN tZiLihMBkK3fwIQCAAA= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Arnd, On 2016-02-29 09:45, Arnd Bergmann wrote: > 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") Thanks for this fix. > --- > 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. Okay, so in the driver code all __raw_writel should be replaced by writel(), right? Those __raw_writel() calls were there from the beginning and I didn't know that they should not be used in the driver code. > 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); > Best regards -- Marek Szyprowski, PhD Samsung R&D Institute Poland