lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAOD6ATobD8HCJWXeRgoXYaBBuKxy_TPj_AuWOfdPhJRF=Gxz5w@mail.gmail.com>
Date:	Tue, 22 Apr 2014 18:53:51 +0530
From:	Shaik Ameer Basha <shaik.samsung@...il.com>
To:	Cho KyongHo <pullip.cho@...sung.com>
Cc:	Linux ARM Kernel <linux-arm-kernel@...ts.infradead.org>,
	Linux DeviceTree <devicetree@...r.kernel.org>,
	Linux IOMMU <iommu@...ts.linux-foundation.org>,
	Linux Kernel <linux-kernel@...r.kernel.org>,
	Linux Samsung SOC <linux-samsung-soc@...r.kernel.org>,
	Antonios Motakis <a.motakis@...tualopensystems.com>,
	Grant Grundler <grundler@...omium.org>,
	Joerg Roedel <joro@...tes.org>,
	Kukjin Kim <kgene.kim@...sung.com>,
	Prathyush <prathyush.k@...sung.com>,
	Rahul Sharma <rahul.sharma@...sung.com>,
	Sachin Kamat <sachin.kamat@...aro.org>,
	Sylwester Nawrocki <s.nawrocki@...sung.com>,
	Tomasz Figa <t.figa@...sung.com>,
	Varun Sethi <Varun.Sethi@...escale.com>
Subject: Re: [PATCH v11 20/27] iommu/exynos: allow having multiple System MMUs
 for a master H/W

Hi KyongHo Cho,



On Fri, Mar 14, 2014 at 10:40 AM, Cho KyongHo <pullip.cho@...sung.com> wrote:
> Some master device descriptor like fimc-is which is an abstraction
> of very complex H/W may have multiple System MMUs. For those devices,
> the design of the link between System MMU and its master H/W is needed
> to be reconsidered.
>
> A link structure, sysmmu_list_data is introduced that provides a link
> to master H/W and that has a pointer to the device descriptor of a
> System MMU. Given a device descriptor of a master H/W, it is possible
> to traverse all System MMUs that must be controlled along with the
> master H/W.
>
> Signed-off-by: Cho KyongHo <pullip.cho@...sung.com>
> ---
>  drivers/iommu/exynos-iommu.c |  534 ++++++++++++++++++++++++++----------------
>  1 file changed, 333 insertions(+), 201 deletions(-)
>
> diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c
> index 84ba29a..7489343 100644
> --- a/drivers/iommu/exynos-iommu.c
> +++ b/drivers/iommu/exynos-iommu.c
> @@ -128,6 +128,10 @@
>  #define __master_clk_disable(data)     __clk_gate_ctrl(data, clk_master, dis)
>

[snip]

> +static int __init __sysmmu_init_master(struct device *dev)
> +{
> +       int ret;
> +       int i = 0;
> +       struct device_node *node;
> +
> +       while ((node = of_parse_phandle(dev->of_node, "mmu-masters", i++))) {
>                 struct platform_device *master = of_find_device_by_node(node);
> +               struct exynos_iommu_owner *owner;
> +               struct sysmmu_list_data *list_data;
>
>                 if (!master) {
>                         dev_err(dev, "%s: mmu-master '%s' not found\n",
>                                 __func__, node->name);
> -                       return -EINVAL;
> +                       ret = -EINVAL;
> +                       goto err;
>                 }
>
> -               if (master->dev.archdata.iommu != NULL) {
> -                       dev_err(dev, "%s: '%s' is master of other MMU\n",
> -                               __func__, node->name);
> -                       return -EINVAL;
> +               owner = master->dev.archdata.iommu;
> +               if (!owner) {
> +                       owner = devm_kzalloc(dev, sizeof(*owner), GFP_KERNEL);
> +                       if (!owner) {
> +                               dev_err(dev,
> +                               "%s: Failed to allocate owner structure\n",
> +                               __func__);
> +                               ret = -ENOMEM;
> +                               goto err;
> +                       }
> +
> +                       INIT_LIST_HEAD(&owner->mmu_list);
> +                       INIT_LIST_HEAD(&owner->client);
> +                       owner->dev = &master->dev;
> +                       spin_lock_init(&owner->lock);
> +
> +                       master->dev.archdata.iommu = owner;
>                 }
>
> +               list_data = devm_kzalloc(dev, sizeof(*list_data), GFP_KERNEL);
> +               if (!list_data) {
> +                       dev_err(dev,
> +                               "%s: Failed to allocate sysmmu_list_data\n",
> +                               __func__);
> +                       ret = -ENOMEM;
> +                       goto err;
> +               }
> +
> +               INIT_LIST_HEAD(&list_data->entry);
> +               list_data->sysmmu = dev;
> +
>                 /*
> -                * archdata.iommu will be initialized with exynos_iommu_client
> -                * in sysmmu_hook_driver_register().
> +                * System MMUs are attached in the order of the presence
> +                * in device tree
>                  */
> -               master->dev.archdata.iommu = dev;
> +               list_add_tail(&list_data->entry, &owner->mmu_list);
>         }
>
> -       data->sysmmu = dev;
> -       rwlock_init(&data->lock);
> +       return 0;
> +err:
> +       while ((node = of_parse_phandle(dev->of_node, "mmu-masters", i++))) {

Don't we need to reinitialize variable 'i' here before using?
i = 0;

Regards,
Shaik Ameer Basha



> +               struct platform_device *master = of_find_device_by_node(node);
> +               struct exynos_iommu_owner *owner;
> +               struct sysmmu_list_data *list_data;
>
> -       platform_set_drvdata(pdev, data);
> +               if (!master)
> +                       continue;
>
> -       pm_runtime_enable(dev);
> -       data->runtime_active = !pm_runtime_enabled(dev);
> +               owner = master->dev.archdata.iommu;
> +               if (!owner)
> +                       continue;
>
> -       dev_dbg(dev, "Probed and initialized\n");
> -       return 0;
> +               for_each_sysmmu_list(owner->dev, list_data) {
> +                       if (list_data->sysmmu == dev) {
> +                               list_del(&list_data->entry);
> +                               kfree(list_data);
> +                               break;
> +                       }
> +               }
> +       }
> +
> +       return ret;
>  }
>

[snip]
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ