Linux IOMMU Development
 help / color / mirror / Atom feed
From: Marek Szyprowski <m.szyprowski@samsung.com>
To: Javier Martinez Canillas <javier@dowhile0.org>
Cc: "iommu@lists.linux-foundation.org"
	<iommu@lists.linux-foundation.org>,
	"linux-samsung-soc@vger.kernel.org"
	<linux-samsung-soc@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	linaro-mm-sig@lists.linaro.org, Arnd Bergmann <arnd@arndb.de>,
	Shaik Ameer Basha <shaik.ameer@samsung.com>,
	Cho KyongHo <pullip.cho@samsung.com>,
	Joerg Roedel <joro@8bytes.org>,
	Thierry Reding <treding@nvidia.com>,
	Olof Johansson <olof@lixom.net>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Rob Herring <robh@kernel.org>, Will Deacon <will.deacon@arm.com>,
	David Wodhouse <dwmw2@infradead.org>,
	Inki Dae <inki.dae@samsung.com>, Kukjin Kim <kgene@kernel.org>,
	Tomasz Figa <tomasz.figa@gmail.com>,
	Kyungmin Park <kyungmin.park@samsung.com>
Subject: Re: [PATCH v4 18/18] iommu: exynos: add callback for initializing devices from device tree
Date: Fri, 23 Jan 2015 13:40:58 +0100	[thread overview]
Message-ID: <54C2415A.3020508@samsung.com> (raw)
In-Reply-To: <CABxcv=nkcY0biXuDH1BHDdOZhrzYWr-YNP13QWzdLfZfQrxouA@mail.gmail.com>

Hello,

On 2015-01-19 16:27, Javier Martinez Canillas wrote:
> I wanted to test your IOMMU series on an Exynos5420 Peach Pit but the
> kernel hangs with your series + dependencies on top of 3.19-rc5.
>
> Bisecting I found that $subject is the offending commit. I've pushed
> my test branch [0] in case I missed something.
>
> On Fri, Jan 16, 2015 at 10:13 AM, Marek Szyprowski
> <m.szyprowski@samsung.com> wrote:
>> This patch adds implementation of of_xlate callback, which prepares
>> masters device for attaching to IOMMU. This callback is called during
>> creating devices from device tree.
>>
>> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
>> ---
>>   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 ea2659159e63..5432b443abfc 100644
>> --- a/drivers/iommu/exynos-iommu.c
>> +++ b/drivers/iommu/exynos-iommu.c
>> @@ -1077,6 +1077,33 @@ static phys_addr_t exynos_iommu_iova_to_phys(struct iommu_domain *iommu_domain,
>>          return phys;
>>   }
>>
>> +static int exynos_iommu_of_xlate(struct device *dev,
>> +                                struct of_phandle_args *spec)
>> +{
>> +       struct exynos_iommu_owner *owner = dev->archdata.iommu;
>> +       struct platform_device *sysmmu = of_find_device_by_node(spec->np);
>> +       struct sysmmu_drvdata *data;
>> +
>> +       if (!sysmmu)
>> +               return -ENODEV;
>> +
>> +       data = platform_get_drvdata(sysmmu);
>> +       if (!data)
>> +               return -ENODEV;
>> +
>> +       if (!owner) {
>> +               owner = kzalloc(sizeof(*owner), GFP_KERNEL);
>> +               if (!owner)
>> +                       return -ENOMEM;
>> +
>> +               INIT_LIST_HEAD(&owner->clients);
>> +               dev->archdata.iommu = owner;
>> +       }
>> +
>> +       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().

Just a quick question - does bootloader on Exynos5420 Peach Pit sets
any image on the display?

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.

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)) {
          pr_warn("Failed to attached device %s to IOMMU_mapping\n",
                  dev_name(dev));

--->8---

Best regards
-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland

  reply	other threads:[~2015-01-23 12:40 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-16  9:12 [PATCH v4 00/18] Exynos SYSMMU (IOMMU) integration with DT and DMA-mapping subsystem Marek Szyprowski
     [not found] ` <1421399592-7482-1-git-send-email-m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2015-01-16  9:12   ` [PATCH v4 01/18] drm: exynos: detach from default dma-mapping domain on init Marek Szyprowski
2015-01-16  9:12   ` [PATCH v4 02/18] arm: exynos: pm_domains: add support for devices registered before arch_initcall Marek Szyprowski
2015-01-16  9:12   ` [PATCH v4 03/18] ARM: dts: exynos4: add sysmmu nodes Marek Szyprowski
2015-01-16  9:13   ` [PATCH v4 08/18] iommu: exynos: remove useless spinlock Marek Szyprowski
2015-01-16  9:13   ` [PATCH v4 10/18] iommu: exynos: remove unused functions, part 2 Marek Szyprowski
2015-01-16  9:13   ` [PATCH v4 11/18] iommu: exynos: remove useless device_add/remove callbacks Marek Szyprowski
2015-01-16  9:12 ` [PATCH v4 04/18] ARM: dts: exynos5250: add sysmmu nodes Marek Szyprowski
2015-01-16  9:12 ` [PATCH v4 05/18] ARM: dts: exynos5420: " Marek Szyprowski
2015-01-16  9:13 ` [PATCH v4 06/18] iommu: exynos: don't read version register on every tlb operation Marek Szyprowski
2015-01-16  9:13 ` [PATCH v4 07/18] iommu: exynos: remove unused functions Marek Szyprowski
2015-01-16  9:13 ` [PATCH v4 09/18] iommu: exynos: refactor function parameters to simplify code Marek Szyprowski
2015-01-16  9:13 ` [PATCH v4 12/18] iommu: exynos: add support for binding more than one sysmmu to master device Marek Szyprowski
2015-01-16  9:13 ` [PATCH v4 13/18] iommu: exynos: add support for runtime_pm Marek Szyprowski
2015-01-16  9:13 ` [PATCH v4 14/18] iommu: exynos: rename variables to reflect their purpose Marek Szyprowski
2015-01-16  9:13 ` [PATCH v4 15/18] iommu: exynos: document internal structures Marek Szyprowski
2015-01-16  9:13 ` [PATCH v4 16/18] iommu: exynos: remove excessive includes and sort others alphabetically Marek Szyprowski
2015-01-16  9:13 ` [PATCH v4 17/18] iommu: exynos: init from dt-specific callback instead of initcall Marek Szyprowski
2015-01-19  1:11   ` Laurent Pinchart
2015-01-19 11:33     ` Will Deacon
2015-01-20 13:41       ` Laurent Pinchart
2015-01-16  9:13 ` [PATCH v4 18/18] iommu: exynos: add callback for initializing devices from device tree Marek Szyprowski
     [not found]   ` <1421399592-7482-19-git-send-email-m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2015-01-19 15:27     ` Javier Martinez Canillas
2015-01-23 12:40       ` Marek Szyprowski [this message]
2015-01-23 13:48         ` Javier Martinez Canillas
     [not found]           ` <CABxcv=nX22+1VcA038yyLJz7dUN-tk9-kWTpSB-FeyLxVeRmZA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-01-23 16:15             ` Marek Szyprowski
     [not found]               ` <54C273AF.1010404-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2015-01-23 16:44                 ` Javier Martinez Canillas
2015-01-21 23:37 ` [PATCH v4 00/18] Exynos SYSMMU (IOMMU) integration with DT and DMA-mapping subsystem Tobias Jakobi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54C2415A.3020508@samsung.com \
    --to=m.szyprowski@samsung.com \
    --cc=arnd@arndb.de \
    --cc=dwmw2@infradead.org \
    --cc=inki.dae@samsung.com \
    --cc=iommu@lists.linux-foundation.org \
    --cc=javier@dowhile0.org \
    --cc=joro@8bytes.org \
    --cc=kgene@kernel.org \
    --cc=kyungmin.park@samsung.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linaro-mm-sig@lists.linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=olof@lixom.net \
    --cc=pullip.cho@samsung.com \
    --cc=robh@kernel.org \
    --cc=shaik.ameer@samsung.com \
    --cc=tomasz.figa@gmail.com \
    --cc=treding@nvidia.com \
    --cc=will.deacon@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox