On Fri, 30 Jun 2017, Wei Chen wrote:
> The legacy IOMMU bindings place the SMMU MasterIDs in the SMMU device
> tree node. In current code, we register the SMMU masters while probing
> SMMU. It's better to keep registering legacy masters in the SMMU probing
> progress. If we move registering legacy SMMU masters to add_device or
> assign_device, we have to go through all SMMUs to find correct SMMU for
> master device. It's inefficient and doesn't bring any enhancement.
> 
> Similarly, if we want to register generic masters in SMMU probing, we
> have to go through whole device tree to find master devices for all
> SMMUs. So we only keep registering legacy master in SMMU probing.
> 
> Signed-off-by: Wei Chen <wei.c...@arm.com>

Acked-by: Stefano Stabellini <sstabell...@kernel.org>


> ---
>  xen/drivers/passthrough/arm/smmu.c | 31 +++++++++++++++++++------------
>  1 file changed, 19 insertions(+), 12 deletions(-)
> 
> diff --git a/xen/drivers/passthrough/arm/smmu.c 
> b/xen/drivers/passthrough/arm/smmu.c
> index 441c296..895024c 100644
> --- a/xen/drivers/passthrough/arm/smmu.c
> +++ b/xen/drivers/passthrough/arm/smmu.c
> @@ -2375,21 +2375,28 @@ static int arm_smmu_device_dt_probe(struct 
> platform_device *pdev)
>       if (err)
>               return err;
>  
> -     i = 0;
>       smmu->masters = RB_ROOT;
> -     while (!of_parse_phandle_with_args(dev->of_node, "mmu-masters",
> -                                        "#stream-id-cells", i,
> -                                        &masterspec)) {
> -             err = register_smmu_master(smmu, dev, &masterspec);
> -             if (err) {
> -                     dev_err(dev, "failed to add master %s\n",
> -                             masterspec.np->name);
> -                     goto out_put_masters;
> -             }
> +     /*
> +      * The SMMU MasterIDs are listed in SMMU device tree node while using
> +      * the legacy IOMMU bindins. So in the SMMU probing progress, we will
> +      * register the SMMU master only for legacy bindings.
> +      */
> +     if (using_legacy_binding) {
> +             i = 0;
> +             while (!of_parse_phandle_with_args(dev->of_node, "mmu-masters",
> +                                                     "#stream-id-cells", i,
> +                                                     &masterspec)) {
> +                     err = register_smmu_master(smmu, dev, &masterspec);
> +                     if (err) {
> +                             dev_err(dev, "failed to add master %s\n",
> +                                     masterspec.np->name);
> +                             goto out_put_masters;
> +                     }
>  
> -             i++;
> +                     i++;
> +             }
> +             dev_notice(dev, "registered %d legacy master devices\n", i);
>       }
> -     dev_notice(dev, "registered %d master devices\n", i);
>  
>       parse_driver_options(smmu);
>  
> -- 
> 2.7.4
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> https://lists.xen.org/xen-devel
> 

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

Reply via email to