From mboxrd@z Thu Jan 1 00:00:00 1970 From: Javier Martinez Canillas Subject: Re: [PATCH v4 18/18] iommu: exynos: add callback for initializing devices from device tree Date: Fri, 23 Jan 2015 14:48:56 +0100 Message-ID: References: <1421399592-7482-1-git-send-email-m.szyprowski@samsung.com> <1421399592-7482-19-git-send-email-m.szyprowski@samsung.com> <54C2415A.3020508@samsung.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Return-path: Received: from mail-wi0-f171.google.com ([209.85.212.171]:41013 "EHLO mail-wi0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750902AbbAWNs5 (ORCPT ); Fri, 23 Jan 2015 08:48:57 -0500 Received: by mail-wi0-f171.google.com with SMTP id l15so2944233wiw.4 for ; Fri, 23 Jan 2015 05:48:56 -0800 (PST) In-Reply-To: <54C2415A.3020508@samsung.com> Sender: linux-samsung-soc-owner@vger.kernel.org List-Id: linux-samsung-soc@vger.kernel.org To: Marek Szyprowski Cc: "iommu@lists.linux-foundation.org" , "linux-samsung-soc@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , linaro-mm-sig@lists.linaro.org, Arnd Bergmann , Shaik Ameer Basha , Cho KyongHo , Joerg Roedel , Thierry Reding , Olof Johansson , Laurent Pinchart , Rob Herring , Will Deacon , David Wodhouse , Inki Dae , Kukjin Kim , Tomasz Figa , Kyungmin Park Hello Marek, On Fri, Jan 23, 2015 at 1:40 PM, Marek Szyprowski wrote: >>> + >>> + list_add_tail(&data->owner_node, &owner->clients); >> >> This is the line that causes the kernel to hang, if I comment the >> list_add_tail() call then the kernel boots. >> >> I checked that neither data nor owner are NULL and that the >> owner->clients list_head is initialized. Do you have any ideas what >> could be happening? > > > This is really strange. However the hang is definitely not caused by > adding the controller to the list, but rather the fact that it is later > being initialized, probably in exynos_iommu_attach_device(). > Yes, I knew adding to the list was not the issue but a side effect of being in the list. I'm not familiar with Exynos sysmmu/iommu to figure out though. > Just a quick question - does bootloader on Exynos5420 Peach Pit sets > any image on the display? > Yes u-boot does initialize the display, I see the boot messages and have an u-boot prompt. > If so then we will get IOMMU page fault on init (DMA engine of FIMD is > left enabled from bootloader) and such case is not yet handled. > Besides that I have no idea for any other reason for such failure. > I see, that's a reasonable explanation and in fact your patch makes at least the kernel to start booting. > To check if this is caused by io page fault, please temporarily add the > following hack: > --->8--- > diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c > index 7864797609b3..5e70cf7eb31b 100644 > --- a/arch/arm/mm/dma-mapping.c > +++ b/arch/arm/mm/dma-mapping.c > @@ -2011,6 +2011,9 @@ static bool arm_setup_iommu_dma_ops(struct device > *dev, u64 dma_base, u64 size, > return false; > } > > + iommu_map(mapping->domain, 0x40000000, 0x40000000, 0x80000000, > + IOMMU_READ | IOMMU_WRITE); > + > if (arm_iommu_attach_device(dev, mapping)) { The kernel still hangs but the boot does indeed go further. Here is my boot log [0] although I couldn't find an evident cause. Best regards, Javier [0]: http://paste.debian.net/plain/141968 From mboxrd@z Thu Jan 1 00:00:00 1970 From: javier@dowhile0.org (Javier Martinez Canillas) Date: Fri, 23 Jan 2015 14:48:56 +0100 Subject: [PATCH v4 18/18] iommu: exynos: add callback for initializing devices from device tree In-Reply-To: <54C2415A.3020508@samsung.com> References: <1421399592-7482-1-git-send-email-m.szyprowski@samsung.com> <1421399592-7482-19-git-send-email-m.szyprowski@samsung.com> <54C2415A.3020508@samsung.com> Message-ID: To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org Hello Marek, On Fri, Jan 23, 2015 at 1:40 PM, Marek Szyprowski wrote: >>> + >>> + list_add_tail(&data->owner_node, &owner->clients); >> >> This is the line that causes the kernel to hang, if I comment the >> list_add_tail() call then the kernel boots. >> >> I checked that neither data nor owner are NULL and that the >> owner->clients list_head is initialized. Do you have any ideas what >> could be happening? > > > This is really strange. However the hang is definitely not caused by > adding the controller to the list, but rather the fact that it is later > being initialized, probably in exynos_iommu_attach_device(). > Yes, I knew adding to the list was not the issue but a side effect of being in the list. I'm not familiar with Exynos sysmmu/iommu to figure out though. > Just a quick question - does bootloader on Exynos5420 Peach Pit sets > any image on the display? > Yes u-boot does initialize the display, I see the boot messages and have an u-boot prompt. > If so then we will get IOMMU page fault on init (DMA engine of FIMD is > left enabled from bootloader) and such case is not yet handled. > Besides that I have no idea for any other reason for such failure. > I see, that's a reasonable explanation and in fact your patch makes at least the kernel to start booting. > To check if this is caused by io page fault, please temporarily add the > following hack: > --->8--- > diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c > index 7864797609b3..5e70cf7eb31b 100644 > --- a/arch/arm/mm/dma-mapping.c > +++ b/arch/arm/mm/dma-mapping.c > @@ -2011,6 +2011,9 @@ static bool arm_setup_iommu_dma_ops(struct device > *dev, u64 dma_base, u64 size, > return false; > } > > + iommu_map(mapping->domain, 0x40000000, 0x40000000, 0x80000000, > + IOMMU_READ | IOMMU_WRITE); > + > if (arm_iommu_attach_device(dev, mapping)) { The kernel still hangs but the boot does indeed go further. Here is my boot log [0] although I couldn't find an evident cause. Best regards, Javier [0]: http://paste.debian.net/plain/141968