All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robin Murphy <robin.murphy-5wv7dgnIgG8@public.gmane.org>
To: Nipun Gupta <nipun.gupta-3arQi8VN3Tc@public.gmane.org>,
	will.deacon-5wv7dgnIgG8@public.gmane.org,
	stuart.yoder-3arQi8VN3Tc@public.gmane.org,
	iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Cc: Bharat Bhushan <bharat.bhushan-3arQi8VN3Tc@public.gmane.org>
Subject: Re: [RFC PATCH 2/2] iommu/arm-smmu: Add support for the fsl-mc bus
Date: Thu, 30 Jun 2016 12:23:08 +0100	[thread overview]
Message-ID: <5775011C.60402@arm.com> (raw)
In-Reply-To: <1467220448-16764-2-git-send-email-nipun.gupta-3arQi8VN3Tc@public.gmane.org>

On 29/06/16 18:14, Nipun Gupta wrote:
> Implement bus specific support for the fsl-mc bus including
> registering the arm_smmu_ops and bus specific smmu device init.
> 
> Signed-off-by: Nipun Gupta <nipun.gupta-3arQi8VN3Tc@public.gmane.org>
> Signed-off-by: Bharat Bhushan <bharat.bhushan-3arQi8VN3Tc@public.gmane.org>
> ---
>  drivers/iommu/arm-smmu.c | 43 +++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 43 insertions(+)
> 
> diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c
> index ab365ec..28d5dc8 100644
> --- a/drivers/iommu/arm-smmu.c
> +++ b/drivers/iommu/arm-smmu.c
> @@ -47,6 +47,9 @@
>  
>  #include <linux/amba/bus.h>
>  
> +/* Include path will be changed once FSL-MC support is out from staging */

How about we do that first?

> +#include <../drivers/staging/fsl-mc/include/fsl_mc_smmu.h>
> +
>  #include "io-pgtable.h"
>  
>  /* Maximum number of stream IDs assigned to a single device */
> @@ -447,6 +450,11 @@ static struct device_node *dev_get_dev_node(struct device *dev)
>  		return bus->bridge->parent->of_node;
>  	}
>  
> +	if (dev_is_fsl_mc(dev)) {

Where is dev_is_fsl_mc() defined? I don't see it anywhere in mainline,
here, or in -next.

> +		while (dev_is_fsl_mc(dev))
> +			dev = dev->parent;
> +	}
> +
>  	return dev->of_node;
>  }
>  
> @@ -1443,6 +1451,32 @@ static int arm_smmu_init_platform_device(struct device *dev,
>  	return 0;
>  }
>  
> +static void __arm_smmu_release_fslmc_iommudata(void *data)
> +{
> +	kfree(data);
> +}

There's already a suitable callback for this; nobody needs an exact
duplicate of it.

> +static int arm_smmu_init_fslmc_device(struct device *dev,
> +				      struct iommu_group *group)
> +{
> +	struct arm_smmu_master_cfg *cfg;
> +
> +	cfg = iommu_group_get_iommudata(group);
> +	if (!cfg) {
> +		cfg = kzalloc(sizeof(*cfg), GFP_KERNEL);
> +		if (!cfg)
> +			return -ENOMEM;
> +
> +		cfg->streamids[0] = fslmc_dev_streamid(dev);
> +		cfg->num_streamids = 1;
> +
> +		iommu_group_set_iommudata(group, cfg,
> +					  __arm_smmu_release_fslmc_iommudata);
> +	}

So the group gets the ID of the container device (assuming that's the
first one added), and the subsequent IDs are just ignored and left to go
wrong? Or is it inherently guaranteed that all devices in the same
container are programmed with the same ID?

Robin.

> +	return 0;
> +}
> +
>  static int arm_smmu_add_device(struct device *dev)
>  {
>  	struct iommu_group *group;
> @@ -1467,6 +1501,8 @@ static struct iommu_group *arm_smmu_device_group(struct device *dev)
>  
>  	if (dev_is_pci(dev))
>  		group = pci_device_group(dev);
> +	else if (dev_is_fsl_mc(dev))
> +		group = fslmc_device_group(dev);
>  	else
>  		group = generic_device_group(dev);
>  
> @@ -1475,6 +1511,8 @@ static struct iommu_group *arm_smmu_device_group(struct device *dev)
>  
>  	if (dev_is_pci(dev))
>  		ret = arm_smmu_init_pci_device(to_pci_dev(dev), group);
> +	else if (dev_is_fsl_mc(dev))
> +		ret = arm_smmu_init_fslmc_device(dev, group);
>  	else
>  		ret = arm_smmu_init_platform_device(dev, group);
>  
> @@ -2102,6 +2140,11 @@ static int __init arm_smmu_init(void)
>  	}
>  #endif
>  
> +#ifdef CONFIG_FSL_MC_BUS
> +	if (!iommu_present(&fsl_mc_bus_type))
> +		bus_set_iommu(&fsl_mc_bus_type, &arm_smmu_ops);
> +#endif
> +
>  	return 0;
>  }
>  
> 

WARNING: multiple messages have this Message-ID (diff)
From: robin.murphy@arm.com (Robin Murphy)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC PATCH 2/2] iommu/arm-smmu: Add support for the fsl-mc bus
Date: Thu, 30 Jun 2016 12:23:08 +0100	[thread overview]
Message-ID: <5775011C.60402@arm.com> (raw)
In-Reply-To: <1467220448-16764-2-git-send-email-nipun.gupta@nxp.com>

On 29/06/16 18:14, Nipun Gupta wrote:
> Implement bus specific support for the fsl-mc bus including
> registering the arm_smmu_ops and bus specific smmu device init.
> 
> Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> Signed-off-by: Bharat Bhushan <bharat.bhushan@nxp.com>
> ---
>  drivers/iommu/arm-smmu.c | 43 +++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 43 insertions(+)
> 
> diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c
> index ab365ec..28d5dc8 100644
> --- a/drivers/iommu/arm-smmu.c
> +++ b/drivers/iommu/arm-smmu.c
> @@ -47,6 +47,9 @@
>  
>  #include <linux/amba/bus.h>
>  
> +/* Include path will be changed once FSL-MC support is out from staging */

How about we do that first?

> +#include <../drivers/staging/fsl-mc/include/fsl_mc_smmu.h>
> +
>  #include "io-pgtable.h"
>  
>  /* Maximum number of stream IDs assigned to a single device */
> @@ -447,6 +450,11 @@ static struct device_node *dev_get_dev_node(struct device *dev)
>  		return bus->bridge->parent->of_node;
>  	}
>  
> +	if (dev_is_fsl_mc(dev)) {

Where is dev_is_fsl_mc() defined? I don't see it anywhere in mainline,
here, or in -next.

> +		while (dev_is_fsl_mc(dev))
> +			dev = dev->parent;
> +	}
> +
>  	return dev->of_node;
>  }
>  
> @@ -1443,6 +1451,32 @@ static int arm_smmu_init_platform_device(struct device *dev,
>  	return 0;
>  }
>  
> +static void __arm_smmu_release_fslmc_iommudata(void *data)
> +{
> +	kfree(data);
> +}

There's already a suitable callback for this; nobody needs an exact
duplicate of it.

> +static int arm_smmu_init_fslmc_device(struct device *dev,
> +				      struct iommu_group *group)
> +{
> +	struct arm_smmu_master_cfg *cfg;
> +
> +	cfg = iommu_group_get_iommudata(group);
> +	if (!cfg) {
> +		cfg = kzalloc(sizeof(*cfg), GFP_KERNEL);
> +		if (!cfg)
> +			return -ENOMEM;
> +
> +		cfg->streamids[0] = fslmc_dev_streamid(dev);
> +		cfg->num_streamids = 1;
> +
> +		iommu_group_set_iommudata(group, cfg,
> +					  __arm_smmu_release_fslmc_iommudata);
> +	}

So the group gets the ID of the container device (assuming that's the
first one added), and the subsequent IDs are just ignored and left to go
wrong? Or is it inherently guaranteed that all devices in the same
container are programmed with the same ID?

Robin.

> +	return 0;
> +}
> +
>  static int arm_smmu_add_device(struct device *dev)
>  {
>  	struct iommu_group *group;
> @@ -1467,6 +1501,8 @@ static struct iommu_group *arm_smmu_device_group(struct device *dev)
>  
>  	if (dev_is_pci(dev))
>  		group = pci_device_group(dev);
> +	else if (dev_is_fsl_mc(dev))
> +		group = fslmc_device_group(dev);
>  	else
>  		group = generic_device_group(dev);
>  
> @@ -1475,6 +1511,8 @@ static struct iommu_group *arm_smmu_device_group(struct device *dev)
>  
>  	if (dev_is_pci(dev))
>  		ret = arm_smmu_init_pci_device(to_pci_dev(dev), group);
> +	else if (dev_is_fsl_mc(dev))
> +		ret = arm_smmu_init_fslmc_device(dev, group);
>  	else
>  		ret = arm_smmu_init_platform_device(dev, group);
>  
> @@ -2102,6 +2140,11 @@ static int __init arm_smmu_init(void)
>  	}
>  #endif
>  
> +#ifdef CONFIG_FSL_MC_BUS
> +	if (!iommu_present(&fsl_mc_bus_type))
> +		bus_set_iommu(&fsl_mc_bus_type, &arm_smmu_ops);
> +#endif
> +
>  	return 0;
>  }
>  
> 

  parent reply	other threads:[~2016-06-30 11:23 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-29 17:14 [RFC PATCH 1/2] fsl-mc: Added header file to provide fsl-mc bus iommu group creation Nipun Gupta
2016-06-29 17:14 ` Nipun Gupta
     [not found] ` <1467220448-16764-1-git-send-email-nipun.gupta-3arQi8VN3Tc@public.gmane.org>
2016-06-29 17:14   ` [RFC PATCH 2/2] iommu/arm-smmu: Add support for the fsl-mc bus Nipun Gupta
2016-06-29 17:14     ` Nipun Gupta
     [not found]     ` <1467220448-16764-2-git-send-email-nipun.gupta-3arQi8VN3Tc@public.gmane.org>
2016-06-30 11:23       ` Robin Murphy [this message]
2016-06-30 11:23         ` Robin Murphy
     [not found]         ` <5775011C.60402-5wv7dgnIgG8@public.gmane.org>
2016-06-30 12:11           ` Nipun Gupta
2016-06-30 12:11             ` Nipun Gupta
2016-06-30 10:55   ` [RFC PATCH 1/2] fsl-mc: Added header file to provide fsl-mc bus iommu group creation Robin Murphy
2016-06-30 10:55     ` Robin Murphy
     [not found]     ` <5774FABE.5070707-5wv7dgnIgG8@public.gmane.org>
2016-06-30 11:43       ` Nipun Gupta
2016-06-30 11:43         ` Nipun Gupta
     [not found]         ` <HE1PR0401MB1866C1468D3B4733B437C79BE6240-B0v07Ae2tarOWAm+xAH2pY3W/0Ik+aLCnBOFsp37pqbUKgpGm//BTAC/G2K4zDHf@public.gmane.org>
2016-06-30 14:14           ` Robin Murphy
2016-06-30 14:14             ` Robin Murphy
     [not found]             ` <57752939.9010504-5wv7dgnIgG8@public.gmane.org>
2016-07-01 15:11               ` Nipun Gupta
2016-07-01 15:11                 ` Nipun Gupta

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=5775011C.60402@arm.com \
    --to=robin.murphy-5wv7dgnigg8@public.gmane.org \
    --cc=bharat.bhushan-3arQi8VN3Tc@public.gmane.org \
    --cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=nipun.gupta-3arQi8VN3Tc@public.gmane.org \
    --cc=stuart.yoder-3arQi8VN3Tc@public.gmane.org \
    --cc=will.deacon-5wv7dgnIgG8@public.gmane.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.