From patchwork Mon Oct 10 12:36:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 9369455 X-Patchwork-Delegate: agross@codeaurora.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D1B6B60487 for ; Mon, 10 Oct 2016 12:48:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C0DA42993E for ; Mon, 10 Oct 2016 12:48:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B51C429961; Mon, 10 Oct 2016 12:48:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E01C02994E for ; Mon, 10 Oct 2016 12:48:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752070AbcJJMsf (ORCPT ); Mon, 10 Oct 2016 08:48:35 -0400 Received: from mailout4.w1.samsung.com ([210.118.77.14]:53755 "EHLO mailout4.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751783AbcJJMse (ORCPT ); Mon, 10 Oct 2016 08:48:34 -0400 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout4.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OEU007350D8C310@mailout4.w1.samsung.com> for linux-arm-msm@vger.kernel.org; Mon, 10 Oct 2016 13:36:45 +0100 (BST) Received: from eusmges4.samsung.com (unknown [203.254.199.244]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20161010123644eucas1p1bdb0e047c075b38f1d460fd86604d528~8K9ySbZF21190811908eucas1p1M; Mon, 10 Oct 2016 12:36:44 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges4.samsung.com (EUCPMTA) with SMTP id DF.C1.28332.B5B8BF75; Mon, 10 Oct 2016 13:36:43 +0100 (BST) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20161010123643eucas1p21238ec0164722fdf112be47bfb4933c2~8K9xosznh2959529595eucas1p2T; Mon, 10 Oct 2016 12:36:43 +0000 (GMT) X-AuditID: cbfec7f4-f791c6d000006eac-d3-57fb8b5ba058 Received: from eusync1.samsung.com ( [203.254.199.211]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id F2.48.10494.43B8BF75; Mon, 10 Oct 2016 13:36:04 +0100 (BST) Received: from [106.120.52.91] by eusync1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OEU005N20D6FD90@eusync1.samsung.com>; Mon, 10 Oct 2016 13:36:43 +0100 (BST) Subject: Re: [PATCH V3 0/8] IOMMU probe deferral support To: Sricharan R , will.deacon@arm.com, robin.murphy@arm.com, joro@8bytes.org, iommu@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, laurent.pinchart@ideasonboard.com, tfiga@chromium.org, srinivas.kandagatla@linaro.org From: Marek Szyprowski Message-id: <12cfb59f-f7ca-d4df-eb7f-42348e357979@samsung.com> Date: Mon, 10 Oct 2016 14:36:41 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-version: 1.0 In-reply-to: <1475600632-21289-1-git-send-email-sricharan@codeaurora.org> Content-type: text/plain; charset=utf-8; format=flowed Content-transfer-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LVYsN/aonP2BnaL zolL2C02Pb7GajFx/1l2i4MfnrBafJnYwWLRduwYq8Xn1n9sFi8/nmBx4PJ4cnAek8eaeWsY PWY3XGTxuNzXy+Qxu2Mmq8eda3vYPDYvqfeYfGM5o8fnTXIBnFFuNhmpiSmpRQqpecn5KZl5 6bZKoSFuuhZKCnmJuam2ShG6viFBSgpliTmlQJ6RARpwcA5wD1bSt0twy2jrOcNccM+gYvfN eawNjKtVuxg5OCQETCRe3GTvYuQEMsUkLtxbz9bFyMUhJLCEUWLdxq2sIAkhgWeMEseXeYHY wgIWEg/m/AaLiwisYZLY9TwBomEeo8TGyYvAJrEJGEp0ve1iA7F5BewkGtqnMYHYLAKqEvOn vACrERWIkbj+7BFUjaDEj8n3WEBsTgFPif8vToDZzAJmEl9eHmaFsOUlNq95yzyBkX8WkpZZ SMpmISlbwMi8ilEktbQ4Nz232EivODG3uDQvXS85P3cTIzAKtx37uWUHY9e74EOMAhyMSjy8 Lyt/hQuxJpYVV+YeYpTgYFYS4Z3Y8TtciDclsbIqtSg/vqg0J7X4EKMp0BMTmaVEk/OBCSKv JN7QxNDc0tDI2MLC3MhISZx36ocr4UIC6YklqdmpqQWpRTB9TBycUg2MS7fX+jAJrLnbtJpb f/kFJ47UqfoWtxmuJkmZP1+x1Pf6IS/7u5v9NwhbTuYwfr1q0RpP+fAzcb/31x+SeJTR8ED1 csj9znPnZjz7vOuX3emWXqkzSwOqxDoX182TCJtdcfDrpRemuk8Nqn+6vShYG+f541zo6Uk/ RDYs77zn/WSSyculf+beva/EUpyRaKjFXFScCAAyHGz92AIAAA== X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20161010123643eucas1p21238ec0164722fdf112be47bfb4933c2 X-Msg-Generator: CA X-Sender-IP: 182.198.249.180 X-Local-Sender: =?UTF-8?B?TWFyZWsgU3p5cHJvd3NraRtTUlBPTC1LZXJuZWwgKFRQKRs=?= =?UTF-8?B?7IK87ISx7KCE7J6QG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Global-Sender: =?UTF-8?B?TWFyZWsgU3p5cHJvd3NraRtTUlBPTC1LZXJuZWwgKFRQKRtT?= =?UTF-8?B?YW1zdW5nIEVsZWN0cm9uaWNzG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Sender-Code: =?UTF-8?B?QzEwG0VIURtDMTBDRDAyQ0QwMjczOTI=?= CMS-TYPE: 201P X-HopCount: 7 X-CMS-RootMailID: 20161004170414eucas1p141bebe16e1bf241862833e7ad0270c72 X-RootMTR: 20161004170414eucas1p141bebe16e1bf241862833e7ad0270c72 References: <1475600632-21289-1-git-send-email-sricharan@codeaurora.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi Sricharan, On 2016-10-04 19:03, Sricharan R wrote: > Initial post from Laurent Pinchart[1]. This is > series calls the dma ops configuration for the devices > at a generic place so that it works for all busses. > The dma_configure_ops for a device is now called during > the device_attach callback just before the probe of the > bus/driver is called. Similarly dma_deconfigure is called during > device/driver_detach path. > > > pci_bus_add_devices (platform/amba)(_device_create/driver_register) > | | > pci_bus_add_device (device_add/driver_register) > | | > device_attach device_initial_probe > | | > __device_attach_driver __device_attach_driver > | > driver_probe_device > | > really_probe > | > dma_configure > > Similarly on the device/driver_unregister path __device_release_driver is > called which inturn calls dma_deconfigure. > > If the ACPI bus code follows the same, we can add acpi_dma_configure > at the same place as of_dma_configure. > > This series is based on the recently merged Generic DT bindings for > PCI IOMMUs and ARM SMMU from Robin Murphy robin.murphy@arm.com [2] > > This time tested this with platform and pci device for probe deferral > and reprobe on arm64 based platform. There is an issue on the cleanup > path for arm64 though, where there is WARN_ON if the dma_ops is reset while > device is attached to an domain in arch_teardown_dma_ops. > But with iommu_groups created from the iommu driver, the device is always > attached to a domain/default_domain. So so the WARN has to be removed/handled > probably. Thanks for continuing work on this feature! Your can add my: Tested-by: Marek Szyprowski It works fine with Exynos SYSMMU driver, although a patch is needed to fix infinite loop due to list corruption (same element is added twice if master device fails with deferred probe): From: Marek Szyprowski Date: Mon, 10 Oct 2016 14:22:42 +0200 Subject: [PATCH] iommu/exynos: ensure that sysmmu is added only once to its master Since adding IOMMU deferred probing support, of_xlate() callback might be called more than once for given master device (for example it happens when masters device driver fails with EPROBE_DEFER), so ensure that SYSMMU controller is added to its master device (owner) only once. Signed-off-by: Marek Szyprowski --- drivers/iommu/exynos-iommu.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c index 30808e91b775..1525a86eb829 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c @@ -1253,7 +1253,7 @@ static int exynos_iommu_of_xlate(struct device *dev, { struct exynos_iommu_owner *owner = dev->archdata.iommu; struct platform_device *sysmmu = of_find_device_by_node(spec->np); - struct sysmmu_drvdata *data; + struct sysmmu_drvdata *data, *entry; if (!sysmmu) return -ENODEV; @@ -1271,6 +1271,10 @@ static int exynos_iommu_of_xlate(struct device *dev, dev->archdata.iommu = owner; } + list_for_each_entry(entry, &owner->controllers, owner_node) + if (entry == data) + return 0; + list_add_tail(&data->owner_node, &owner->controllers); return 0; }