Re: [oss-drivers] [trivial PATCH] treewide: Convert switch/case fallthrough; to break;

2020-09-17 Thread Simon Horman
On Wed, Sep 09, 2020 at 01:06:39PM -0700, Joe Perches wrote:
> fallthrough to a separate case/default label break; isn't very readable.
> 
> Convert pseudo-keyword fallthrough; statements to a simple break; when
> the next label is case or default and the only statement in the next
> label block is break;
> 
> Found using:
> 
> $ grep-2.5.4 -rP --include=*.[ch] -n 
> "fallthrough;(\s*(case\s+\w+|default)\s*:\s*){1,7}break;" *
> 
> Miscellanea:
> 
> o Move or coalesce a couple label blocks above a default: block.
> 
> Signed-off-by: Joe Perches 

...

> diff --git a/drivers/net/ethernet/netronome/nfp/nfpcore/nfp6000_pcie.c 
> b/drivers/net/ethernet/netronome/nfp/nfpcore/nfp6000_pcie.c
> index 252fe06f58aa..1d5b87079104 100644
> --- a/drivers/net/ethernet/netronome/nfp/nfpcore/nfp6000_pcie.c
> +++ b/drivers/net/ethernet/netronome/nfp/nfpcore/nfp6000_pcie.c
> @@ -345,7 +345,7 @@ static int matching_bar(struct nfp_bar *bar, u32 tgt, u32 
> act, u32 tok,
>   baract = NFP_CPP_ACTION_RW;
>   if (act == 0)
>   act = NFP_CPP_ACTION_RW;
> - fallthrough;
> + break;
>   case NFP_PCIE_BAR_PCIE2CPP_MapType_FIXED:
>   break;
>   default:

This is a cascading fall-through handling all map types.
I don't think this change improves readability.

...
___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


Re: [PATCH] iommu/renesas: fix unused-function warning

2020-05-12 Thread Simon Horman
On Sat, May 09, 2020 at 12:02:16AM +0200, Arnd Bergmann wrote:
> gcc warns because the only reference to ipmmu_find_group
> is inside of an #ifdef:
> 
> drivers/iommu/ipmmu-vmsa.c:878:28: error: 'ipmmu_find_group' defined but not 
> used [-Werror=unused-function]
> 
> Change the #ifdef to an equivalent IS_ENABLED().
> 
> Fixes: 6580c8a78424 ("iommu/renesas: Convert to probe/release_device() 
> call-backs")
> Signed-off-by: Arnd Bergmann 

Reviewed-by: Simon Horman 

> ---
>  drivers/iommu/ipmmu-vmsa.c | 7 ++-
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/iommu/ipmmu-vmsa.c b/drivers/iommu/ipmmu-vmsa.c
> index fb7e702dee23..4c2972f3153b 100644
> --- a/drivers/iommu/ipmmu-vmsa.c
> +++ b/drivers/iommu/ipmmu-vmsa.c
> @@ -903,11 +903,8 @@ static const struct iommu_ops ipmmu_ops = {
>   .probe_device = ipmmu_probe_device,
>   .release_device = ipmmu_release_device,
>   .probe_finalize = ipmmu_probe_finalize,
> -#if defined(CONFIG_ARM) && !defined(CONFIG_IOMMU_DMA)
> - .device_group = generic_device_group,
> -#else
> - .device_group = ipmmu_find_group,
> -#endif
> + .device_group = IS_ENABLED(CONFIG_ARM) && !IS_ENABLED(CONFIG_IOMMU_DMA)
> + ? generic_device_group : ipmmu_find_group,
>   .pgsize_bitmap = SZ_1G | SZ_2M | SZ_4K,
>   .of_xlate = ipmmu_of_xlate,
>  };
> -- 
> 2.26.0
> 
___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


Re: [PATCH 1/2] iommu/ipmmu-vmsa: Move IMTTBCR_SL0_TWOBIT_* to restore sort order

2019-09-05 Thread Simon Horman
On Wed, Sep 04, 2019 at 02:08:01PM +0200, Geert Uytterhoeven wrote:
> Move the recently added IMTTBCR_SL0_TWOBIT_* definitions up, to make
> sure all IMTTBCR register bit definitions are sorted by decreasing bit
> index.  Add comments to make it clear that they exist on R-Car Gen3
> only.
> 
> Fixes: c295f504fb5a38ab ("iommu/ipmmu-vmsa: Allow two bit SL0")
> Signed-off-by: Geert Uytterhoeven 

Reviewed-by: Simon Horman 

___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


Re: [PATCH 2/2] iommu/ipmmu-vmsa: Disable cache snoop transactions on R-Car Gen3

2019-09-05 Thread Simon Horman
On Wed, Sep 04, 2019 at 02:08:02PM +0200, Geert Uytterhoeven wrote:
> From: Hai Nguyen Pham 
> 
> According to the Hardware Manual Errata for Rev. 1.50 of April 10, 2019,
> cache snoop transactions for page table walk requests are not supported
> on R-Car Gen3.
> 
> Hence, this patch removes setting these fields in the IMTTBCR register,
> since it will have no effect, and adds comments to the register bit
> definitions, to make it clear they apply to R-Car Gen2 only.
> 
> Signed-off-by: Hai Nguyen Pham 
> [geert: Reword, add comments]
> Signed-off-by: Geert Uytterhoeven 

Reviewed-by: Simon Horman 

___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


Re: [PATCH v8 4/5] block: add a helper function to merge the segments

2019-07-25 Thread Simon Horman
On Tue, Jul 23, 2019 at 02:26:47PM +0900, Yoshihiro Shimoda wrote:
> This patch adds a helper function whether a queue can merge
> the segments by the DMA MAP layer (e.g. via IOMMU).
> 
> Signed-off-by: Yoshihiro Shimoda 
> Reviewed-by: Christoph Hellwig 

Reviewed-by: Simon Horman 

___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


Re: [PATCH v8 2/5] iommu/dma: Add a new dma_map_ops of get_merge_boundary()

2019-07-25 Thread Simon Horman
On Tue, Jul 23, 2019 at 11:17:19AM +0300, Sergei Shtylyov wrote:
> Hello!
> 
> On 23.07.2019 8:26, Yoshihiro Shimoda wrote:
> 
> > This patch adds a new dma_map_ops of get_merge_boundary() to
> > expose the DMA merge boundary if the domain type is IOMMU_DOMAIN_DMA.
> > 
> > Signed-off-by: Yoshihiro Shimoda 

Sergei's comment notwithstanding,

Reviewed-by: Simon Horman 

> > ---
> >   drivers/iommu/dma-iommu.c | 11 +++
> >   1 file changed, 11 insertions(+)
> > 
> > diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c
> > index a7f9c3e..f3e5f2b 100644
> > --- a/drivers/iommu/dma-iommu.c
> > +++ b/drivers/iommu/dma-iommu.c
> > @@ -1085,6 +1085,16 @@ static int iommu_dma_get_sgtable(struct device *dev, 
> > struct sg_table *sgt,
> > return ret;
> >   }
> > +static unsigned long iommu_dma_get_merge_boundary(struct device *dev)
> > +{
> > +   struct iommu_domain *domain = iommu_get_dma_domain(dev);
> > +
> > +   if (domain->type != IOMMU_DOMAIN_DMA)
> > +   return 0;   /* can't merge */
> > +
> > +   return (1 << __ffs(domain->pgsize_bitmap)) - 1;
> 
>Not 1UL?
> 
> > +}
> > +
> >   static const struct dma_map_ops iommu_dma_ops = {
> > .alloc  = iommu_dma_alloc,
> > .free   = iommu_dma_free,
> [...]
> 
> MBR, Sergei
> 
___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


Re: [PATCH v8 5/5] mmc: queue: Use bigger segments if DMA MAP layer can merge the segments

2019-07-25 Thread Simon Horman
On Tue, Jul 23, 2019 at 02:26:48PM +0900, Yoshihiro Shimoda wrote:
> When the max_segs of a mmc host is smaller than 512, the mmc
> subsystem tries to use 512 segments if DMA MAP layer can merge
> the segments, and then the mmc subsystem exposes such information
> to the block layer by using blk_queue_can_use_dma_map_merging().
> 
> Signed-off-by: Yoshihiro Shimoda 
> Reviewed-by: Christoph Hellwig 
> Reviewed-by: Ulf Hansson 

Reviewed-by: Simon Horman 

___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


Re: [PATCH v8 3/5] block: sort headers on blk-setting.c

2019-07-25 Thread Simon Horman
On Tue, Jul 23, 2019 at 02:26:46PM +0900, Yoshihiro Shimoda wrote:
> This patch sorts the headers in alphabetic order to ease
> the maintenance for this part.
> 
> Signed-off-by: Yoshihiro Shimoda 
> Reviewed-by: Wolfram Sang 

Reviewed-by: Simon Horman 

___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


Re: [PATCH v8 1/5] dma: Introduce dma_get_merge_boundary()

2019-07-25 Thread Simon Horman
On Tue, Jul 23, 2019 at 02:26:44PM +0900, Yoshihiro Shimoda wrote:
> This patch adds a new DMA API "dma_get_merge_boundary". This function
> returns the DMA merge boundary if the DMA layer can merge the segments.
> This patch also adds the implementation for a new dma_map_ops pointer.
> 
> Signed-off-by: Yoshihiro Shimoda 
> Reviewed-by: Christoph Hellwig 

Reviewed-by: Simon Horman 

___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


Re: [PATCH v2 6/6] iommu/ipmmu-vmsa: Add suspend/resume support

2019-04-11 Thread Simon Horman
On Wed, Apr 03, 2019 at 08:21:48PM +0200, Geert Uytterhoeven wrote:
> During PSCI system suspend, R-Car Gen3 SoCs are powered down, and all
> IPMMU state is lost.  Hence after s2ram, devices wired behind an IPMMU,
> and configured to use it, will see their DMA operations hang.
> 
> To fix this, restore all IPMMU contexts, and re-enable all active
> micro-TLBs during system resume.
> 
> Signed-off-by: Geert Uytterhoeven 
> ---
> This patch takes a different approach than the BSP, which implements a
> bulk save/restore of all registers during system suspend/resume.
> 
> v2:
>   - Drop PSCI checks.
> ---
>  drivers/iommu/ipmmu-vmsa.c | 47 +-
>  1 file changed, 46 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/iommu/ipmmu-vmsa.c b/drivers/iommu/ipmmu-vmsa.c
> index 56e84bcc9532e1ce..408ad0b2591925e0 100644
> --- a/drivers/iommu/ipmmu-vmsa.c
> +++ b/drivers/iommu/ipmmu-vmsa.c
> @@ -36,7 +36,10 @@
>  #define arm_iommu_detach_device(...) do {} while (0)
>  #endif
>  
> -#define IPMMU_CTX_MAX 8U
> +#define IPMMU_CTX_MAX8U
> +#define IPMMU_CTX_INVALID-1
> +
> +#define IPMMU_UTLB_MAX   48U
>  
>  struct ipmmu_features {
>   bool use_ns_alias_offset;
> @@ -58,6 +61,7 @@ struct ipmmu_vmsa_device {
>   spinlock_t lock;/* Protects ctx and domains[] */
>   DECLARE_BITMAP(ctx, IPMMU_CTX_MAX);
>   struct ipmmu_vmsa_domain *domains[IPMMU_CTX_MAX];

It might be possible to save a bit of memory on Gen 2 systems by
making IPMMU_UTLB_MAX 32 when the driver is compiled for such systems.

> + s8 utlb_ctx[IPMMU_UTLB_MAX];
>  
>   struct iommu_group *group;
>   struct dma_iommu_mapping *mapping;
> @@ -335,6 +339,7 @@ static void ipmmu_utlb_enable(struct ipmmu_vmsa_domain 
> *domain,
>   ipmmu_write(mmu, IMUCTR(utlb),
>   IMUCTR_TTSEL_MMU(domain->context_id) | IMUCTR_FLUSH |
>   IMUCTR_MMUEN);
> + mmu->utlb_ctx[utlb] = domain->context_id;
>  }
>  
>  /*
> @@ -346,6 +351,7 @@ static void ipmmu_utlb_disable(struct ipmmu_vmsa_domain 
> *domain,
>   struct ipmmu_vmsa_device *mmu = domain->mmu;
>  
>   ipmmu_write(mmu, IMUCTR(utlb), 0);
> + mmu->utlb_ctx[utlb] = IPMMU_CTX_INVALID;
>  }
>  
>  static void ipmmu_tlb_flush_all(void *cookie)
> @@ -1043,6 +1049,7 @@ static int ipmmu_probe(struct platform_device *pdev)
>   spin_lock_init(>lock);
>   bitmap_zero(mmu->ctx, IPMMU_CTX_MAX);
>   mmu->features = of_device_get_match_data(>dev);
> + memset(mmu->utlb_ctx, IPMMU_CTX_INVALID, mmu->features->num_utlbs);
>   dma_set_mask_and_coherent(>dev, DMA_BIT_MASK(40));
>  
>   /* Map I/O memory and request IRQ. */
> @@ -1158,10 +1165,48 @@ static int ipmmu_remove(struct platform_device *pdev)
>   return 0;
>  }
>  
> +#ifdef CONFIG_PM_SLEEP
> +static int ipmmu_resume_noirq(struct device *dev)
> +{
> + struct ipmmu_vmsa_device *mmu = dev_get_drvdata(dev);
> + unsigned int i;
> +
> + /* Reset root MMU and restore contexts */
> + if (ipmmu_is_root(mmu)) {
> + ipmmu_device_reset(mmu);
> +
> + for (i = 0; i < mmu->num_ctx; i++) {
> + if (!mmu->domains[i])
> + continue;
> +
> + ipmmu_domain_setup_context(mmu->domains[i]);
> + }
> + }
> +
> + /* Re-enable active micro-TLBs */
> + for (i = 0; i < mmu->features->num_utlbs; i++) {
> + if (mmu->utlb_ctx[i] == IPMMU_CTX_INVALID)
> + continue;
> +
> + ipmmu_utlb_enable(mmu->root->domains[mmu->utlb_ctx[i]], i);
> + }
> +
> + return 0;
> +}
> +
> +static const struct dev_pm_ops ipmmu_pm  = {
> + SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(NULL, ipmmu_resume_noirq)
> +};
> +#define DEV_PM_OPS   _pm
> +#else
> +#define DEV_PM_OPS   NULL
> +#endif /* CONFIG_PM_SLEEP */
> +
>  static struct platform_driver ipmmu_driver = {
>   .driver = {
>   .name = "ipmmu-vmsa",
>   .of_match_table = of_match_ptr(ipmmu_of_ids),
> + .pm = DEV_PM_OPS,
>   },
>   .probe = ipmmu_probe,
>   .remove = ipmmu_remove,
> -- 
> 2.17.1
> 
___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


Re: [PATCH v2 4/6] iommu/ipmmu-vmsa: Move num_utlbs to SoC-specific features

2019-04-11 Thread Simon Horman
On Thu, Apr 11, 2019 at 10:32:40AM +0200, Simon Horman wrote:
> On Wed, Apr 03, 2019 at 08:21:46PM +0200, Geert Uytterhoeven wrote:
> > The maximum number of micro-TLBs per IPMMU instance is not fixed, but
> > depends on the SoC type.  Hence move it from struct ipmmu_vmsa_device to
> > struct ipmmu_features, and set up the correct value for both R-Car Gen2
> > and Gen3 SoCs.
> > 
> > Note that currently no code uses this value.
> > 
> > Signed-off-by: Geert Uytterhoeven 
> > Reviewed-by: Laurent Pinchart 
> 
> Are there any plans to use num_utlbs in the driver or anywhere else in the
> kernel? If not, perhaps it should be removed?

I see that I spoke too soon and it is used by a patch later on in this
series.

Reviewed-by: Simon Horman 
___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


Re: [PATCH v2 5/6] iommu/ipmmu-vmsa: Extract hardware context initialization

2019-04-11 Thread Simon Horman
On Wed, Apr 03, 2019 at 08:21:47PM +0200, Geert Uytterhoeven wrote:
> ipmmu_domain_init_context() takes care of (1) initializing the software
> domain, and (2) initializing the hardware context for the domain.
> 
> Extract the code to initialize the hardware context into a new subroutine
> ipmmu_domain_setup_context(), to prepare for later reuse.
> 
> Signed-off-by: Geert Uytterhoeven 

Reviewed-by: Simon Horman 

___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


Re: [PATCH v2 4/6] iommu/ipmmu-vmsa: Move num_utlbs to SoC-specific features

2019-04-11 Thread Simon Horman
On Wed, Apr 03, 2019 at 08:21:46PM +0200, Geert Uytterhoeven wrote:
> The maximum number of micro-TLBs per IPMMU instance is not fixed, but
> depends on the SoC type.  Hence move it from struct ipmmu_vmsa_device to
> struct ipmmu_features, and set up the correct value for both R-Car Gen2
> and Gen3 SoCs.
> 
> Note that currently no code uses this value.
> 
> Signed-off-by: Geert Uytterhoeven 
> Reviewed-by: Laurent Pinchart 

Are there any plans to use num_utlbs in the driver or anywhere else in the
kernel? If not, perhaps it should be removed?

> ---
> v2:
>   - Add Reviewed-by.
> ---
>  drivers/iommu/ipmmu-vmsa.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iommu/ipmmu-vmsa.c b/drivers/iommu/ipmmu-vmsa.c
> index 87acf86f295fac0d..3fa57627b1e35562 100644
> --- a/drivers/iommu/ipmmu-vmsa.c
> +++ b/drivers/iommu/ipmmu-vmsa.c
> @@ -42,6 +42,7 @@ struct ipmmu_features {
>   bool use_ns_alias_offset;
>   bool has_cache_leaf_nodes;
>   unsigned int number_of_contexts;
> + unsigned int num_utlbs;
>   bool setup_imbuscr;
>   bool twobit_imttbcr_sl0;
>   bool reserved_context;
> @@ -53,7 +54,6 @@ struct ipmmu_vmsa_device {
>   struct iommu_device iommu;
>   struct ipmmu_vmsa_device *root;
>   const struct ipmmu_features *features;
> - unsigned int num_utlbs;
>   unsigned int num_ctx;
>   spinlock_t lock;/* Protects ctx and domains[] */
>   DECLARE_BITMAP(ctx, IPMMU_CTX_MAX);
> @@ -972,6 +972,7 @@ static const struct ipmmu_features ipmmu_features_default 
> = {
>   .use_ns_alias_offset = true,
>   .has_cache_leaf_nodes = false,
>   .number_of_contexts = 1, /* software only tested with one context */
> + .num_utlbs = 32,
>   .setup_imbuscr = true,
>   .twobit_imttbcr_sl0 = false,
>   .reserved_context = false,
> @@ -981,6 +982,7 @@ static const struct ipmmu_features 
> ipmmu_features_rcar_gen3 = {
>   .use_ns_alias_offset = false,
>   .has_cache_leaf_nodes = true,
>   .number_of_contexts = 8,
> + .num_utlbs = 48,
>   .setup_imbuscr = false,
>   .twobit_imttbcr_sl0 = true,
>   .reserved_context = true,
> @@ -1033,7 +1035,6 @@ static int ipmmu_probe(struct platform_device *pdev)
>   }
>  
>   mmu->dev = >dev;
> - mmu->num_utlbs = 48;
>   spin_lock_init(>lock);
>   bitmap_zero(mmu->ctx, IPMMU_CTX_MAX);
>   mmu->features = of_device_get_match_data(>dev);
> -- 
> 2.17.1
> 
___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


Re: [PATCH v2 3/6] iommu/ipmmu-vmsa: Make IPMMU_CTX_MAX unsigned

2019-04-11 Thread Simon Horman
On Wed, Apr 03, 2019 at 08:21:45PM +0200, Geert Uytterhoeven wrote:
> Make the IPMMU_CTX_MAX constant unsigned, to match the type of
> ipmmu_features.number_of_contexts.
> 
> This allows to use plain min() instead of type-casting min_t().
> 
> Signed-off-by: Geert Uytterhoeven 
> Reviewed-by: Laurent Pinchart 

Reviewed-by: Simon Horman 

___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


Re: [PATCH v2 2/6] iommu/ipmmu-vmsa: Prepare to handle 40-bit error addresses

2019-04-11 Thread Simon Horman
On Wed, Apr 03, 2019 at 08:21:44PM +0200, Geert Uytterhoeven wrote:
> On R-Car Gen3, the faulting virtual address is a 40-bit address, and
> comprised of two registers.  Read the upper address part, and combine
> both parts, when running on a 64-bit system.
> 
> Signed-off-by: Geert Uytterhoeven 
> ---
> Apart from this, the driver doesn't support 40-bit IOVA addresses yet.

None the less this seems like progress.

Reviewed-by: Simon Horman 
___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


Re: [PATCH v2 1/6] iommu/ipmmu-vmsa: Link IOMMUs and devices in sysfs

2019-04-11 Thread Simon Horman
On Wed, Apr 03, 2019 at 08:21:43PM +0200, Geert Uytterhoeven wrote:
> As of commit 7af9a5fdb9e0ca33 ("iommu/ipmmu-vmsa: Use
> iommu_device_sysfs_add()/remove()"), IOMMU devices show up under
> /sys/class/iommus/, but their "devices" subdirectories are empty.

Hi Geert,

Should the path be /sys/class/iommu/ (no trailing 's') ?

> Likewise, devices tied to an IOMMU do not have an "iommu" backlink.
> 
> Make sure all links are created, on both arm32 and arm64.
> 
> Signed-off-by: Geert Uytterhoeven 
> Reviewed-by: Laurent Pinchart 
> ---
> v2:
>   - Add Reviewed-by.
> ---
>  drivers/iommu/ipmmu-vmsa.c | 24 +---
>  1 file changed, 17 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/iommu/ipmmu-vmsa.c b/drivers/iommu/ipmmu-vmsa.c
> index 9a380c10655e182d..9f2b781e20a0eba6 100644
> --- a/drivers/iommu/ipmmu-vmsa.c
> +++ b/drivers/iommu/ipmmu-vmsa.c
> @@ -885,27 +885,37 @@ static int ipmmu_init_arm_mapping(struct device *dev)
>  
>  static int ipmmu_add_device(struct device *dev)
>  {
> + struct ipmmu_vmsa_device *mmu = to_ipmmu(dev);
>   struct iommu_group *group;
> + int ret;
>  
>   /*
>* Only let through devices that have been verified in xlate()
>*/
> - if (!to_ipmmu(dev))
> + if (!mmu)
>   return -ENODEV;
>  
> - if (IS_ENABLED(CONFIG_ARM) && !IS_ENABLED(CONFIG_IOMMU_DMA))
> - return ipmmu_init_arm_mapping(dev);
> + if (IS_ENABLED(CONFIG_ARM) && !IS_ENABLED(CONFIG_IOMMU_DMA)) {
> + ret = ipmmu_init_arm_mapping(dev);
> + if (ret)
> + return ret;
> + } else {
> + group = iommu_group_get_for_dev(dev);
> + if (IS_ERR(group))
> + return PTR_ERR(group);
>  
> - group = iommu_group_get_for_dev(dev);
> - if (IS_ERR(group))
> - return PTR_ERR(group);
> + iommu_group_put(group);
> + }
>  
> - iommu_group_put(group);
> + iommu_device_link(>iommu, dev);
>   return 0;
>  }
>  
>  static void ipmmu_remove_device(struct device *dev)
>  {
> + struct ipmmu_vmsa_device *mmu = to_ipmmu(dev);
> +
> + iommu_device_unlink(>iommu, dev);
>   arm_iommu_detach_device(dev);
>   iommu_group_remove_device(dev);
>  }
> -- 
> 2.17.1
> 
___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


Re: [PATCH v2 1/6] iommu/ipmmu-vmsa: Link IOMMUs and devices in sysfs

2019-04-11 Thread Simon Horman
On Thu, Apr 11, 2019 at 10:10:28AM +0200, Simon Horman wrote:
> On Wed, Apr 03, 2019 at 08:21:43PM +0200, Geert Uytterhoeven wrote:
> > As of commit 7af9a5fdb9e0ca33 ("iommu/ipmmu-vmsa: Use
> > iommu_device_sysfs_add()/remove()"), IOMMU devices show up under
> > /sys/class/iommus/, but their "devices" subdirectories are empty.
> 
> Hi Geert,
> 
> Should the path be /sys/class/iommu/ (no trailing 's') ?
> 
> > Likewise, devices tied to an IOMMU do not have an "iommu" backlink.
> > 
> > Make sure all links are created, on both arm32 and arm64.
> > 
> > Signed-off-by: Geert Uytterhoeven 
> > Reviewed-by: Laurent Pinchart 
> > ---
> > v2:
> >   - Add Reviewed-by.
> > ---
> >  drivers/iommu/ipmmu-vmsa.c | 24 +---
> >  1 file changed, 17 insertions(+), 7 deletions(-)
> > 
> > diff --git a/drivers/iommu/ipmmu-vmsa.c b/drivers/iommu/ipmmu-vmsa.c
> > index 9a380c10655e182d..9f2b781e20a0eba6 100644
> > --- a/drivers/iommu/ipmmu-vmsa.c
> > +++ b/drivers/iommu/ipmmu-vmsa.c
> > @@ -885,27 +885,37 @@ static int ipmmu_init_arm_mapping(struct device *dev)
> >  
> >  static int ipmmu_add_device(struct device *dev)
> >  {
> > +   struct ipmmu_vmsa_device *mmu = to_ipmmu(dev);
> > struct iommu_group *group;
> > +   int ret;
> >  
> > /*
> >  * Only let through devices that have been verified in xlate()
> >  */
> > -   if (!to_ipmmu(dev))
> > +   if (!mmu)
> > return -ENODEV;
> >  
> > -   if (IS_ENABLED(CONFIG_ARM) && !IS_ENABLED(CONFIG_IOMMU_DMA))
> > -   return ipmmu_init_arm_mapping(dev);
> > +   if (IS_ENABLED(CONFIG_ARM) && !IS_ENABLED(CONFIG_IOMMU_DMA)) {
> > +   ret = ipmmu_init_arm_mapping(dev);
> > +   if (ret)
> > +   return ret;
> > +   } else {
> > +   group = iommu_group_get_for_dev(dev);
> > +   if (IS_ERR(group))
> > +   return PTR_ERR(group);
> >  
> > -   group = iommu_group_get_for_dev(dev);
> > -   if (IS_ERR(group))
> > -   return PTR_ERR(group);
> > +   iommu_group_put(group);
> > +   }
> >  
> > -   iommu_group_put(group);
> > +   iommu_device_link(>iommu, dev);

Also, is there any value in propagating the return value
of iommu_device_link() ?

> > return 0;
> >  }
> >  
> >  static void ipmmu_remove_device(struct device *dev)
> >  {
> > +   struct ipmmu_vmsa_device *mmu = to_ipmmu(dev);
> > +
> > +   iommu_device_unlink(>iommu, dev);
> > arm_iommu_detach_device(dev);
> > iommu_group_remove_device(dev);
> >  }
> > -- 
> > 2.17.1
> > 
___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


Re: [PATCH] dt-bindings: iommu: ipmmu-vmsa: Add r8a774c0 support

2018-12-15 Thread Simon Horman
On Thu, Dec 13, 2018 at 08:19:28PM +, Fabrizio Castro wrote:
> Document RZ/G2E (R8A774C0) SoC bindings.
> 
> Signed-off-by: Fabrizio Castro 

Reviewed-by: Simon Horman 

___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


Re: [PATCH] iommu/ipmmu-vmsa: Hook up r8a774c0 DT matching code

2018-12-14 Thread Simon Horman
On Thu, Dec 13, 2018 at 08:22:44PM +, Fabrizio Castro wrote:
> Support RZ/G2E (a.k.a. R8A774C0) IPMMU.
> 
> Signed-off-by: Fabrizio Castro 

Reviewed-by: Simon Horman 
___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


Re: [PATCH v2 2/2] iommu/ipmmu-vmsa: add an array of slave devices whitelist

2018-11-29 Thread Simon Horman
On Wed, Nov 28, 2018 at 09:23:36AM +, Yoshihiro Shimoda wrote:
> To avoid adding copy and pasted strcmp codes in the future,
> this patch adds an array "rcar_gen3_slave_whitelist" to check
> whether the device can work with the IPMMU or not.
> 
> Signed-off-by: Yoshihiro Shimoda 
> Reviewed-by: Geert Uytterhoeven 

Reviewed-by: Simon Horman 

___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


Re: [PATCH v2 1/2] iommu/ipmmu-vmsa: Modify ipmmu_slave_whitelist() to check SoC revisions

2018-11-29 Thread Simon Horman
On Wed, Nov 28, 2018 at 09:23:36AM +, Yoshihiro Shimoda wrote:
> Some R-Car Gen3 SoCs has hardware restrictions on the IPMMU. So,
> to check whether this R-Car Gen3 SoC can use the IPMMU correctly,
> this patch modifies the ipmmu_slave_whitelist().
> 
> Signed-off-by: Yoshihiro Shimoda 
> Reviewed-by: Geert Uytterhoeven 

Reviewed-by: Simon Horman 
___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


Re: [PATCH 2/2] dt-bindings: iommu: ipmmu-vmsa: Add r8a774a1 support

2018-11-08 Thread Simon Horman
On Thu, Nov 08, 2018 at 11:23:58AM +, Fabrizio Castro wrote:
> Dear All,
> 
> Who is the best person to take this patch?

I believe this one is also for Joerg.

> Thanks,
> Fab
> 
> > From: Fabrizio Castro 
> > Sent: 17 August 2018 15:31
> > Subject: [PATCH 2/2] dt-bindings: iommu: ipmmu-vmsa: Add r8a774a1 support
> >
> > Document RZ/G2M (R8A774A1) SoC bindings.
> >
> > Signed-off-by: Fabrizio Castro 
> > Reviewed-by: Biju Das 
> > ---
> > This patch applies on top of next-20180817
> >
> >  Documentation/devicetree/bindings/iommu/renesas,ipmmu-vmsa.txt | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/Documentation/devicetree/bindings/iommu/renesas,ipmmu-vmsa.txt
> > b/Documentation/devicetree/bindings/iommu/renesas,ipmmu-vmsa.txt
> > index ffadb7c..68446dd 100644
> > --- a/Documentation/devicetree/bindings/iommu/renesas,ipmmu-vmsa.txt
> > +++ b/Documentation/devicetree/bindings/iommu/renesas,ipmmu-vmsa.txt
> > @@ -13,6 +13,7 @@ Required Properties:
> >  - "renesas,ipmmu-r8a73a4" for the R8A73A4 (R-Mobile APE6) IPMMU.
> >  - "renesas,ipmmu-r8a7743" for the R8A7743 (RZ/G1M) IPMMU.
> >  - "renesas,ipmmu-r8a7745" for the R8A7745 (RZ/G1E) IPMMU.
> > +- "renesas,ipmmu-r8a774a1" for the R8A774A1 (RZ/G2M) IPMMU.
> >  - "renesas,ipmmu-r8a7790" for the R8A7790 (R-Car H2) IPMMU.
> >  - "renesas,ipmmu-r8a7791" for the R8A7791 (R-Car M2-W) IPMMU.
> >  - "renesas,ipmmu-r8a7793" for the R8A7793 (R-Car M2-N) IPMMU.
> > --
> > 2.7.4
> 
> 
> 
> 
> Renesas Electronics Europe Ltd, Dukes Meadow, Millboard Road, Bourne End, 
> Buckinghamshire, SL8 5FH, UK. Registered in England & Wales under Registered 
> No. 04586709.
> 
___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


Re: [PATCH 2/2] dt-bindings: iommu: ipmmu-vmsa: Add r8a774a1 support

2018-11-08 Thread Simon Horman
On Fri, Aug 17, 2018 at 03:31:05PM +0100, Fabrizio Castro wrote:
> Document RZ/G2M (R8A774A1) SoC bindings.
> 
> Signed-off-by: Fabrizio Castro 
> Reviewed-by: Biju Das 
> ---
> This patch applies on top of next-20180817

Reviewed-by: Simon Horman 

___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


Re: [PATCH v2 1/2] iommu/ipmmu-vmsa: Hook up R8A774A1 DT maching code

2018-11-08 Thread Simon Horman
On Thu, Aug 23, 2018 at 04:33:04PM +0100, Fabrizio Castro wrote:
> Add support for RZ/G2M (R8A774A1) SoC IPMMUs.
> 
> Signed-off-by: Fabrizio Castro 
> Reviewed-by: Biju Das 

Reviewed-by: Simon Horman 

> ---
> v1-v2:
> * taken out IOMMU_OF_DECLARE
> 
>  drivers/iommu/ipmmu-vmsa.c | 4 
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/iommu/ipmmu-vmsa.c b/drivers/iommu/ipmmu-vmsa.c
> index 51af2c5..331562f 100644
> --- a/drivers/iommu/ipmmu-vmsa.c
> +++ b/drivers/iommu/ipmmu-vmsa.c
> @@ -761,6 +761,7 @@ static bool ipmmu_slave_whitelist(struct device *dev)
>  }
>  
>  static const struct soc_device_attribute soc_rcar_gen3[] = {
> + { .soc_id = "r8a774a1", },
>   { .soc_id = "r8a7795", },
>   { .soc_id = "r8a7796", },
>   { .soc_id = "r8a77965", },
> @@ -942,6 +943,9 @@ static const struct of_device_id ipmmu_of_ids[] = {
>   .compatible = "renesas,ipmmu-vmsa",
>   .data = _features_default,
>   }, {
> + .compatible = "renesas,ipmmu-r8a774a1",
> + .data = _features_rcar_gen3,
> + }, {
>   .compatible = "renesas,ipmmu-r8a7795",
>   .data = _features_rcar_gen3,
>   }, {
> -- 
> 2.7.4
> 
___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


Re: [PATCH v2 1/2] iommu/ipmmu-vmsa: Hook up R8A774A1 DT maching code

2018-11-08 Thread Simon Horman
Hi Fabrizio,

I believe this one is for Joerg.

On Thu, Nov 08, 2018 at 11:22:55AM +, Fabrizio Castro wrote:
> Dear All,
> 
> Who is the best person to take this patch?
> 
> Thanks,
> Fab
> 
> > From: Fabrizio Castro 
> > Sent: 23 August 2018 16:33
> > Subject: [PATCH v2 1/2] iommu/ipmmu-vmsa: Hook up R8A774A1 DT maching code
> >
> > Add support for RZ/G2M (R8A774A1) SoC IPMMUs.
> >
> > Signed-off-by: Fabrizio Castro 
> > Reviewed-by: Biju Das 
> > ---
> > v1-v2:
> > * taken out IOMMU_OF_DECLARE
> >
> >  drivers/iommu/ipmmu-vmsa.c | 4 
> >  1 file changed, 4 insertions(+)
> >
> > diff --git a/drivers/iommu/ipmmu-vmsa.c b/drivers/iommu/ipmmu-vmsa.c
> > index 51af2c5..331562f 100644
> > --- a/drivers/iommu/ipmmu-vmsa.c
> > +++ b/drivers/iommu/ipmmu-vmsa.c
> > @@ -761,6 +761,7 @@ static bool ipmmu_slave_whitelist(struct device *dev)
> >  }
> >
> >  static const struct soc_device_attribute soc_rcar_gen3[] = {
> > +{ .soc_id = "r8a774a1", },
> >  { .soc_id = "r8a7795", },
> >  { .soc_id = "r8a7796", },
> >  { .soc_id = "r8a77965", },
> > @@ -942,6 +943,9 @@ static const struct of_device_id ipmmu_of_ids[] = {
> >  .compatible = "renesas,ipmmu-vmsa",
> >  .data = _features_default,
> >  }, {
> > +.compatible = "renesas,ipmmu-r8a774a1",
> > +.data = _features_rcar_gen3,
> > +}, {
> >  .compatible = "renesas,ipmmu-r8a7795",
> >  .data = _features_rcar_gen3,
> >  }, {
> > --
> > 2.7.4
> 
> 
> 
> 
> Renesas Electronics Europe Ltd, Dukes Meadow, Millboard Road, Bourne End, 
> Buckinghamshire, SL8 5FH, UK. Registered in England & Wales under Registered 
> No. 04586709.
> 
___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


Re: [PATCH] iommu/ipmmu-vmsa: Hook up r8a77990 DT matching code

2018-10-17 Thread Simon Horman
On Mon, Oct 15, 2018 at 01:56:18PM +0300, Sergei Shtylyov wrote:
> Hello!
> 
> On 10/15/2018 12:55 PM, Simon Horman wrote:
> 
> > From: Hai Nguyen Pham 
> > 
> > Support the r8a77990 IPMMU and update IPMMU_OF_DECLARE to hook up
> 
>That macro is gone, you need to update the description.

Thanks, v2 sent.

> 
> > the updated compat string.
> > 
> > Signed-off-by: Hai Nguyen Pham 
> > Signed-off-by: Kazuya Mizuguchi 
> > [simon: rebased; dropped no longer required IOMMU_OF_DECLARE hunk]
> 
>Yet you didn't drop it from the description. :-)
> 
> > Signed-off-by: Simon Horman 
> [...]
> 
> MBR, Sergei
> 
___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


[PATCH v2] iommu/ipmmu-vmsa: Hook up r8a77990 DT matching code

2018-10-17 Thread Simon Horman
From: Hai Nguyen Pham 

Support the R-Car E3 (r8a77990) IPMMU.

Signed-off-by: Hai Nguyen Pham 
Signed-off-by: Kazuya Mizuguchi 
[simon: rebased; dropped no longer required IOMMU_OF_DECLARE hunk]
Signed-off-by: Simon Horman 
---
v2 [Simon Horman]
* Update changelog
---
 drivers/iommu/ipmmu-vmsa.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/iommu/ipmmu-vmsa.c b/drivers/iommu/ipmmu-vmsa.c
index b98a03189580..e0adf5d6c13c 100644
--- a/drivers/iommu/ipmmu-vmsa.c
+++ b/drivers/iommu/ipmmu-vmsa.c
@@ -762,6 +762,7 @@ static const struct soc_device_attribute soc_rcar_gen3[] = {
{ .soc_id = "r8a7796", },
{ .soc_id = "r8a77965", },
{ .soc_id = "r8a77970", },
+   { .soc_id = "r8a77990", },
{ .soc_id = "r8a77995", },
{ /* sentinel */ }
 };
@@ -950,6 +951,9 @@ static const struct of_device_id ipmmu_of_ids[] = {
.compatible = "renesas,ipmmu-r8a77970",
.data = _features_rcar_gen3,
}, {
+   .compatible = "renesas,ipmmu-r8a77990",
+   .data = _features_rcar_gen3,
+   }, {
.compatible = "renesas,ipmmu-r8a77995",
.data = _features_rcar_gen3,
}, {
-- 
2.11.0

___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


[PATCH] iommu/ipmmu-vmsa: Hook up r8a77990 DT matching code

2018-10-15 Thread Simon Horman
From: Hai Nguyen Pham 

Support the r8a77990 IPMMU and update IPMMU_OF_DECLARE to hook up
the updated compat string.

Signed-off-by: Hai Nguyen Pham 
Signed-off-by: Kazuya Mizuguchi 
[simon: rebased; dropped no longer required IOMMU_OF_DECLARE hunk]
Signed-off-by: Simon Horman 
---
 drivers/iommu/ipmmu-vmsa.c | 4 
 1 file changed, 4 insertions(+)

 This is based on the next branch pf Joerg Roedel's iommu tree:
 2f2fbfb71ecc ("Merge branches 'arm/renesas', 'arm/smmu', 'ppc/pamu', 
'x86/vt-d', 'x86/amd' and 'core' into next")

diff --git a/drivers/iommu/ipmmu-vmsa.c b/drivers/iommu/ipmmu-vmsa.c
index b98a03189580..e0adf5d6c13c 100644
--- a/drivers/iommu/ipmmu-vmsa.c
+++ b/drivers/iommu/ipmmu-vmsa.c
@@ -762,6 +762,7 @@ static const struct soc_device_attribute soc_rcar_gen3[] = {
{ .soc_id = "r8a7796", },
{ .soc_id = "r8a77965", },
{ .soc_id = "r8a77970", },
+   { .soc_id = "r8a77990", },
{ .soc_id = "r8a77995", },
{ /* sentinel */ }
 };
@@ -950,6 +951,9 @@ static const struct of_device_id ipmmu_of_ids[] = {
.compatible = "renesas,ipmmu-r8a77970",
.data = _features_rcar_gen3,
}, {
+   .compatible = "renesas,ipmmu-r8a77990",
+   .data = _features_rcar_gen3,
+   }, {
.compatible = "renesas,ipmmu-r8a77995",
.data = _features_rcar_gen3,
}, {
-- 
2.11.0

___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


Re: [PATCH] dt-bindings: iommu: ipmmu-vmsa: Add r8a7744 support

2018-10-08 Thread Simon Horman
On Thu, Oct 04, 2018 at 05:25:47PM +0100, Biju Das wrote:
> Document RZ/G1N (R8A7744) SoC bindings.
> 
> Signed-off-by: Biju Das 
> Reviewed-by: Chris Paterson 

Reviewed-by: Simon Horman 

___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


Re: [PATCH v2] drivers/vfio: Allow type-1 IOMMU instantiation with all ARM/ARM64 IOMMUs

2018-09-17 Thread Simon Horman
On Thu, Sep 13, 2018 at 03:15:29PM +0200, Geert Uytterhoeven wrote:
> Currently the type-1 IOMMU instantiation depends on "ARM_SMMU ||
> ARM_SMMU_V3", while it applies to other ARM/ARM64 platforms with an
> IOMMU (e.g. Renesas VMSA-compatible IPMMUs).
> 
> Instead of extending the list of IOMMU types on ARM platforms, replace
> the list by "ARM || ARM64", like other architectures do.  The feature is
> still restricted to ARM/ARM64 platforms with an IOMMU by the dependency
> on IOMMU_API.
> 
> Signed-off-by: Geert Uytterhoeven 

Reviewed-by: Simon Horman 

___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


Re: [PATCH v2 1/2] iommu/ipmmu-vmsa: Hook up R8A774A1 DT maching code

2018-08-27 Thread Simon Horman
On Thu, Aug 23, 2018 at 04:33:04PM +0100, Fabrizio Castro wrote:
> Add support for RZ/G2M (R8A774A1) SoC IPMMUs.
> 
> Signed-off-by: Fabrizio Castro 
> Reviewed-by: Biju Das 
> ---
> v1-v2:
> * taken out IOMMU_OF_DECLARE

Reviewed-by: Simon Horman 

___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


Re: [PATCH 2/2] dt-bindings: iommu: ipmmu-vmsa: Add r8a774a1 support

2018-08-21 Thread Simon Horman
On Fri, Aug 17, 2018 at 03:31:05PM +0100, Fabrizio Castro wrote:
> Document RZ/G2M (R8A774A1) SoC bindings.
> 
> Signed-off-by: Fabrizio Castro 
> Reviewed-by: Biju Das 

Reviewed-by: Simon Horman 

___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


Re: [PATCH] iommu/ipmmu-vmsa: convert to SPDX identifiers

2018-08-02 Thread Simon Horman
On Thu, Aug 02, 2018 at 01:49:39AM +, Kuninori Morimoto wrote:
> 
> From: Kuninori Morimoto 
> 
> Signed-off-by: Kuninori Morimoto 

Reviewed-by: Simon Horman 

___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


Re: [PATCH] iommu/ipmmu-vmsa: Clarify supported platforms

2018-07-26 Thread Simon Horman
On Thu, Jul 26, 2018 at 12:08:33AM +0300, Laurent Pinchart wrote:
> Hi Geert,
> 
> Thank you for the patch.
> 
> On Wednesday, 25 July 2018 16:10:29 EEST Geert Uytterhoeven wrote:
> > The Renesas IPMMU-VMSA driver supports not just R-Car H2 and M2 SoCs,
> > but also other R-Car Gen2 and R-Car Gen3 SoCs.
> > 
> > Drop a superfluous "Renesas" while at it.
> > 
> > Signed-off-by: Geert Uytterhoeven 
> 
> Reviewed-by: Laurent Pinchart 

Reviewed-by: Simon Horman 

> 
> > ---
> >  drivers/iommu/Kconfig | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig
> > index 568ae81b0e99b67b..c69dc0b29b5df37f 100644
> > --- a/drivers/iommu/Kconfig
> > +++ b/drivers/iommu/Kconfig
> > @@ -306,8 +306,8 @@ config IPMMU_VMSA
> > select IOMMU_IO_PGTABLE_LPAE
> > select ARM_DMA_USE_IOMMU
> > help
> > - Support for the Renesas VMSA-compatible IPMMU Renesas found in the
> > - R-Mobile APE6 and R-Car H2/M2 SoCs.
> > + Support for the Renesas VMSA-compatible IPMMU found in the R-Mobile
> > + APE6, R-Car Gen2, and R-Car Gen3 SoCs.

Perhaps:

APE6, and R-Car Gen2 and Gen3 SoCs.

> >   If unsure, say N.
> 
> 
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> 
> 
___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


Re: [RESEND 0/6] iommu: ipmmu-vmsa: Add more Gen3 SoCs support

2018-06-20 Thread Simon Horman
[CC Alex Williamson]

On Thu, Jun 14, 2018 at 12:48:20PM +0200, Jacopo Mondi wrote:
> Hello,
>this series collects patches sent to mailing lists in late 2017 to add
> support for a number of R-Car Gen3 SoCs to the ipmmu-vmsa driver.
> 
> Part of the series these patches were part of went in through Alex Williamson
> tree and are now included in v4.17.
> 
> These patches have not yet been collected, and need to be rebased on v4.17,
> and this what this series serves for.
> 
> The series:
> - Increses the micro-TLB size to 48bits to accomodate newer SoCs
> - Adds support for M3-N, M3-W, V3-M and E3 to ipmmu-vmsa driver
> - Documents M3-N, V3H and E3 device tree bindings
> 
> All patches have been acked/reviewed by, if nothing big happens they should
> be ready to be collected.

All patches:

Reviewed-by: Simon Horman 

Joerg, Alex,

I'd be most grateful if we could find a way for these patches to progress
into mainline.

> 
> Thanks
>j
> 
> Jacopo Mondi (2):
>   dt-bindings: iommu/ipmmu-vmsa: Add R-Car M3-N (R8A77965)
>   iommu/ipmmu-vmsa: Hook up R8A77965 DT matching code
> 
> Magnus Damm (3):
>   iommu/ipmmu-vmsa: Increase maximum micro-TLBS to 48
>   iommu/ipmmu-vmsa: Hook up r8a7796 DT matching code
>   iommu/ipmmu-vmsa: Document R-Car V3H and E3 IPMMU DT bindings
> 
> Simon Horman (1):
>   iommu/ipmmu-vmsa: Hook up r8a779(70|95) DT matching code
> 
>  .../bindings/iommu/renesas,ipmmu-vmsa.txt  |  3 ++
>  drivers/iommu/ipmmu-vmsa.c | 38 
> ++
>  2 files changed, 34 insertions(+), 7 deletions(-)
> 
> --
> 2.7.4
> 
___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


Re: [PATCH] iommu/ipmmu-vmsa: Document R-Car V3H and E3 IPMMU DT bindings

2018-05-22 Thread Simon Horman
On Mon, May 21, 2018 at 11:41:33PM +0900, Magnus Damm wrote:
> From: Magnus Damm <damm+rene...@opensource.se>
> 
> Update the IPMMU DT binding documentation to include the compat strings
> for the IPMMU devices included in the R-Car V3H and E3 SoCs.
> 
> Signed-off-by: Magnus Damm <damm+rene...@opensource.se>

Reviewed-by: Simon Horman <horms+rene...@verge.net.au>

> ---
> 
>  Developed on top of renesas-drivers-2018-05-15-v4.17-rc5
> 
>  Documentation/devicetree/bindings/iommu/renesas,ipmmu-vmsa.txt |2 ++
>  1 file changed, 2 insertions(+)
> 
> --- 0001/Documentation/devicetree/bindings/iommu/renesas,ipmmu-vmsa.txt
> +++ work/Documentation/devicetree/bindings/iommu/renesas,ipmmu-vmsa.txt   
> 2018-05-21 23:37:16.370607110 +0900
> @@ -20,6 +20,8 @@ Required Properties:
>  - "renesas,ipmmu-r8a7795" for the R8A7795 (R-Car H3) IPMMU.
>  - "renesas,ipmmu-r8a7796" for the R8A7796 (R-Car M3-W) IPMMU.
>  - "renesas,ipmmu-r8a77970" for the R8A77970 (R-Car V3M) IPMMU.
> +- "renesas,ipmmu-r8a77980" for the R8A77980 (R-Car V3H) IPMMU.
> +- "renesas,ipmmu-r8a77990" for the R8A77990 (R-Car E3) IPMMU.
>  - "renesas,ipmmu-r8a77995" for the R8A77995 (R-Car D3) IPMMU.
>  - "renesas,ipmmu-vmsa" for generic R-Car Gen2 or RZ/G1 VMSA-compatible
>  IPMMU.
> 
___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


Re: [PATCH 1/3] dt-bindings: iommu: ipmmu-vmsa: Add device tree support for r8a774[35]

2018-03-16 Thread Simon Horman
On Wed, Mar 14, 2018 at 10:08:34AM +0100, Joerg Roedel wrote:
> On Wed, Mar 07, 2018 at 09:09:21AM +0100, Simon Horman wrote:
> > [CC Alex Williamson]
> > 
> > It looks like the last patch to this file was taken by Alex.
> > Perhaps he would be willing to take this one too if it it was
> > reposted with him CCed.
> 
> Alex was taking care of IOMMU patches while I was off at the end of last
> year. I will take care of these.

Excellent, thanks for clarifying.
___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


Re: [PATCH 1/3] dt-bindings: iommu: ipmmu-vmsa: Add device tree support for r8a774[35]

2018-03-07 Thread Simon Horman
[CC Alex Williamson]

It looks like the last patch to this file was taken by Alex.
Perhaps he would be willing to take this one too if it it was
reposted with him CCed.

On Tue, Mar 06, 2018 at 04:55:44PM +, Fabrizio Castro wrote:
> Dear All,
> 
> I am very sorry to bother you, do you know who is supposed to take this patch?
> 
> Thanks,
> Fab
> 
> > -Original Message-
> > From: Biju Das [mailto:biju@bp.renesas.com]
> > Sent: 24 January 2018 15:42
> > To: Joerg Roedel <j...@8bytes.org>; Laurent Pinchart 
> > <laurent.pinch...@ideasonboard.com>; Geert Uytterhoeven
> > <geert+rene...@glider.be>
> > Cc: Simon Horman <ho...@verge.net.au>; Magnus Damm <magnus.d...@gmail.com>; 
> > Chris Paterson
> > <chris.paters...@renesas.com>; Fabrizio Castro 
> > <fabrizio.cas...@bp.renesas.com>; iommu@lists.linux-foundation.org; linux-
> > renesas-...@vger.kernel.org; Biju Das <biju@bp.renesas.com>
> > Subject: [PATCH 1/3] dt-bindings: iommu: ipmmu-vmsa: Add device tree 
> > support for r8a774[35]
> >
> > Document r8a774[35] specific compatible strings. The Renesas RZ/G1[ME]
> > (r8a774[35]) IPMMU are identical to the R-Car Gen2 family.
> >
> > Signed-off-by: Biju Das <biju@bp.renesas.com>
> > Reviewed-by: Chris Paterson <chris.paters...@renesas.com>
> > ---
> >  Documentation/devicetree/bindings/iommu/renesas,ipmmu-vmsa.txt | 5 -
> >  1 file changed, 4 insertions(+), 1 deletion(-)
> >
> > diff --git a/Documentation/devicetree/bindings/iommu/renesas,ipmmu-vmsa.txt
> > b/Documentation/devicetree/bindings/iommu/renesas,ipmmu-vmsa.txt
> > index 857df92..7d300af 100644
> > --- a/Documentation/devicetree/bindings/iommu/renesas,ipmmu-vmsa.txt
> > +++ b/Documentation/devicetree/bindings/iommu/renesas,ipmmu-vmsa.txt
> > @@ -11,12 +11,15 @@ Required Properties:
> >  the device is compatible with the R-Car Gen2 VMSA-compatible IPMMU.
> >
> >  - "renesas,ipmmu-r8a73a4" for the R8A73A4 (R-Mobile APE6) IPMMU.
> > +- "renesas,ipmmu-r8a7743" for the R8A7743 (RZ/G1M) IPMMU.
> > +- "renesas,ipmmu-r8a7745" for the R8A7745 (RZ/G1E) IPMMU.
> >  - "renesas,ipmmu-r8a7790" for the R8A7790 (R-Car H2) IPMMU.
> >  - "renesas,ipmmu-r8a7791" for the R8A7791 (R-Car M2-W) IPMMU.
> >  - "renesas,ipmmu-r8a7793" for the R8A7793 (R-Car M2-N) IPMMU.
> >  - "renesas,ipmmu-r8a7794" for the R8A7794 (R-Car E2) IPMMU.
> >  - "renesas,ipmmu-r8a7795" for the R8A7795 (R-Car H3) IPMMU.
> > -- "renesas,ipmmu-vmsa" for generic R-Car Gen2 VMSA-compatible IPMMU.
> > +- "renesas,ipmmu-vmsa" for generic R-Car Gen2 or RZ/G1 VMSA-compatible
> > +   IPMMU.
> >
> >- reg: Base address and size of the IPMMU registers.
> >- interrupts: Specifiers for the MMU fault interrupts. For instances that
> > --
> > 2.7.4
> 
> 
> 
> 
> Renesas Electronics Europe Ltd, Dukes Meadow, Millboard Road, Bourne End, 
> Buckinghamshire, SL8 5FH, UK. Registered in England & Wales under Registered 
> No. 04586709.
> 
___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


Re: [PATCH 0/8] R-Car M3-N: Enable EtherAVB device node

2018-02-27 Thread Simon Horman
On Tue, Feb 27, 2018 at 09:28:38AM +0100, jacopo mondi wrote:
> Hi Geert,
> 
> On Mon, Feb 26, 2018 at 07:28:47PM +0100, Geert Uytterhoeven wrote:
> > Hi Jacopo,
> >
> > On Mon, Feb 26, 2018 at 6:57 PM, Jacopo Mondi  
> > wrote:
> > >   as discussed with you Sergei and Geert, in order to enable EtherAVB for
> > > R8A77965 we first wanted to make the phy-mode "rgmii-txid" a board 
> > > specific
> > > property for all other SoCs.
> >
> > Thanks for your series!
> >
> > > This series adds  the phy-mode property to salvator-common.dtsi and reset 
> > > the
> > > one for R8A77965/R8A7796/R8A77995 to "rgmii".
> >
> > I forgot that r8a7795.dtsi and r8a7796.dtsi are used for the ULCB boards, 
> > too.
> > So to avoid regressions, you need to make a similar change to ulcb.dtsi 
> > like you
> > made for salvator-common.dtsi.
> >
> > In addition, r8a77995.dtsi is only used for the Draak board.
> > So you have to update r8a7795-draak.dtsi first, too.
> 
> Of course! I forgot about ULCB (and had a patch for Draak I lost while
> rebasing :/ )
> >
> > > Then, in order to enable EtherAVB for R-Car M3-N, iommu nodes had to be 
> > > added
> > > as they are referenced by the "avb" device node (CC the iommu list for the
> > > series for that reason).
> >
> > I don't think we need the iommu properties and nodes at this early stage.
> > Ethernet works fine without them. Simon, do you agree?
> 
> I'll wait for Simon reply and then resend, possibly without iommu and
> ULCB and Draak patches!

I don't feel strongly about this but I don't think iommu is a strict
dependency of enabling Ethernet and I think its good not to include extra
dependencies - if it was me I'd try to get Ethernet accepted then follow-up
on iommu.
___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


Re: [PATCH 3/3] ARM: dts: r8a7745: Add IPMMU DT nodes

2018-01-30 Thread Simon Horman
On Wed, Jan 24, 2018 at 03:42:02PM +, Biju Das wrote:
> Add the six IPMMU instances found in the r8a7745 to DT with a disabled
> status.
> 
> Signed-off-by: Biju Das 
> Reviewed-by: Chris Paterson 

Thanks, I have applied this after moving the nodes
so they are after the irqc node to take into account
recent sorting of the nodes.

___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


Re: [PATCH 2/3] ARM: dts: r8a7743: Add IPMMU DT nodes

2018-01-30 Thread Simon Horman
On Wed, Jan 24, 2018 at 03:42:01PM +, Biju Das wrote:
> Add the six IPMMU instances found in the r8a7743 to DT with a disabled
> status.
> 
> Signed-off-by: Biju Das 
> Reviewed-by: Chris Paterson 
> ---
>  arch/arm/boot/dts/r8a7743.dtsi | 58 
> ++
>  1 file changed, 58 insertions(+)

Thanks, I have applied this after moving the nodes
so they are after the thermal node to take into account
recent sorting of the nodes.
___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


Re: [PATCH 1/3] dt-bindings: iommu: ipmmu-vmsa: Add device tree support for r8a774[35]

2018-01-30 Thread Simon Horman
On Wed, Jan 24, 2018 at 03:42:00PM +, Biju Das wrote:
> Document r8a774[35] specific compatible strings. The Renesas RZ/G1[ME]
> (r8a774[35]) IPMMU are identical to the R-Car Gen2 family.
> 
> Signed-off-by: Biju Das <biju@bp.renesas.com>
> Reviewed-by: Chris Paterson <chris.paters...@renesas.com>

Reviewed-by: Simon Horman <horms+rene...@verge.net.au>
___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


Re: [PATCH v2 0/2] iommu/ipmmu-vmsa: Add r8a779(6|70|95) DT bindings

2017-12-21 Thread Simon Horman
On Wed, Dec 20, 2017 at 12:02:44PM -0700, Alex Williamson wrote:
> On Fri, 24 Nov 2017 10:58:02 +
> Simon Horman <horms+rene...@verge.net.au> wrote:
> 
> > Update the IPMMU DT binding documentation to include r8a7796 (R-Car M3-W),
> > r8a77970 (R-Car V3M) and r8a77995 (R-Car D3) compat strings.
> > 
> > This patch-set is comprised of patches previously included in
> > * [PATCH v4 0/3] iommu/ipmmu-vmsa: r8a7796 support V4
> > * [PATCH 0/2] iommu/ipmmu-vmsa: r8a779(70|95) support
> > 
> > Those series also include driver updates to implement the bindings,
> > however, it while it is felt that the bindings themselves are ready
> > to be merged we feel that the driver updates are not at that stage yet.
> > 
> > Changes since v1:
> > * Correct typo in r8a779(70|95) patch: R8A7770 -> R8A77970
> > 
> > 
> > Magnus Damm (1):
> >   iommu/ipmmu-vmsa: Add r8a7796 DT binding
> > 
> > Simon Horman (1):
> >   iommu/ipmmu-vmsa: Add r8a779(70|95) DT bindings
> > 
> >  Documentation/devicetree/bindings/iommu/renesas,ipmmu-vmsa.txt | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> 
> Applied to v4.16-iommu/ipmmu-vmsa.  Thanks,

Thanks, much appreciated.
___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


Re: [PATCH v2 0/2] iommu/ipmmu-vmsa: Add r8a779(6|70|95) DT bindings

2017-12-20 Thread Simon Horman
Hi Alex,

On Fri, Nov 24, 2017 at 10:58:02AM +, Simon Horman wrote:
> Update the IPMMU DT binding documentation to include r8a7796 (R-Car M3-W),
> r8a77970 (R-Car V3M) and r8a77995 (R-Car D3) compat strings.
> 
> This patch-set is comprised of patches previously included in
> * [PATCH v4 0/3] iommu/ipmmu-vmsa: r8a7796 support V4
> * [PATCH 0/2] iommu/ipmmu-vmsa: r8a779(70|95) support
> 
> Those series also include driver updates to implement the bindings,
> however, it while it is felt that the bindings themselves are ready
> to be merged we feel that the driver updates are not at that stage yet.
> 
> Changes since v1:
> * Correct typo in r8a779(70|95) patch: R8A7770 -> R8A77970
> 
> 
> Magnus Damm (1):
>   iommu/ipmmu-vmsa: Add r8a7796 DT binding
> 
> Simon Horman (1):
>   iommu/ipmmu-vmsa: Add r8a779(70|95) DT bindings
> 
>  Documentation/devicetree/bindings/iommu/renesas,ipmmu-vmsa.txt | 3 +++
>  1 file changed, 3 insertions(+)

I'm not aware of any problems with this series.
Could you consider applying it?
___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


[PATCH v2 2/2] iommu/ipmmu-vmsa: Add r8a779(70|95) DT bindings

2017-11-24 Thread Simon Horman
Update the IPMMU DT binding documentation to include the
r8a77970 (R-Car V3M) and r8a77995 (R-Car D3) compat strings.

Based on work for r8a7796 by Magnus Damm.

Signed-off-by: Simon Horman <horms+rene...@verge.net.au>
Reviewed-by: Geert Uytterhoeven <geert+rene...@glider.be>
---
v2
* Correct typo: R8A7770 -> R8A77970
---
 Documentation/devicetree/bindings/iommu/renesas,ipmmu-vmsa.txt | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/iommu/renesas,ipmmu-vmsa.txt 
b/Documentation/devicetree/bindings/iommu/renesas,ipmmu-vmsa.txt
index 98ae900a7a76..8e4e89c1bd48 100644
--- a/Documentation/devicetree/bindings/iommu/renesas,ipmmu-vmsa.txt
+++ b/Documentation/devicetree/bindings/iommu/renesas,ipmmu-vmsa.txt
@@ -17,6 +17,8 @@ Required Properties:
 - "renesas,ipmmu-r8a7794" for the R8A7794 (R-Car E2) IPMMU.
 - "renesas,ipmmu-r8a7795" for the R8A7795 (R-Car H3) IPMMU.
 - "renesas,ipmmu-r8a7796" for the R8A7796 (R-Car M3-W) IPMMU.
+- "renesas,ipmmu-r8a77970" for the R8A77970 (R-Car V3M) IPMMU.
+- "renesas,ipmmu-r8a77995" for the R8A77995 (R-Car D3) IPMMU.
 - "renesas,ipmmu-vmsa" for generic R-Car Gen2 VMSA-compatible IPMMU.
 
   - reg: Base address and size of the IPMMU registers.
-- 
2.11.0

___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


[PATCH v2 1/2] iommu/ipmmu-vmsa: Add r8a7796 DT binding

2017-11-24 Thread Simon Horman
From: Magnus Damm <damm+rene...@opensource.se>

Update the IPMMU DT binding documentation to include the r8a7796 compat
string for R-Car M3-W.

Signed-off-by: Magnus Damm <damm+rene...@opensource.se>
Acked-by: Laurent Pinchart <laurent.pinch...@ideasonboard.com>
Acked-by: Rob Herring <r...@kernel.org>
Acked-by: Simon Horman <horms+rene...@verge.net.au>
Acked-by: Geert Uytterhoeven <geert+rene...@glider.be>
---
 Documentation/devicetree/bindings/iommu/renesas,ipmmu-vmsa.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/iommu/renesas,ipmmu-vmsa.txt 
b/Documentation/devicetree/bindings/iommu/renesas,ipmmu-vmsa.txt
index 3ed027cfca95..98ae900a7a76 100644
--- a/Documentation/devicetree/bindings/iommu/renesas,ipmmu-vmsa.txt
+++ b/Documentation/devicetree/bindings/iommu/renesas,ipmmu-vmsa.txt
@@ -16,6 +16,7 @@ Required Properties:
 - "renesas,ipmmu-r8a7793" for the R8A7793 (R-Car M2-N) IPMMU.
 - "renesas,ipmmu-r8a7794" for the R8A7794 (R-Car E2) IPMMU.
 - "renesas,ipmmu-r8a7795" for the R8A7795 (R-Car H3) IPMMU.
+- "renesas,ipmmu-r8a7796" for the R8A7796 (R-Car M3-W) IPMMU.
 - "renesas,ipmmu-vmsa" for generic R-Car Gen2 VMSA-compatible IPMMU.
 
   - reg: Base address and size of the IPMMU registers.
-- 
2.11.0

___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


[PATCH v2 0/2] iommu/ipmmu-vmsa: Add r8a779(6|70|95) DT bindings

2017-11-24 Thread Simon Horman
Update the IPMMU DT binding documentation to include r8a7796 (R-Car M3-W),
r8a77970 (R-Car V3M) and r8a77995 (R-Car D3) compat strings.

This patch-set is comprised of patches previously included in
* [PATCH v4 0/3] iommu/ipmmu-vmsa: r8a7796 support V4
* [PATCH 0/2] iommu/ipmmu-vmsa: r8a779(70|95) support

Those series also include driver updates to implement the bindings,
however, it while it is felt that the bindings themselves are ready
to be merged we feel that the driver updates are not at that stage yet.

Changes since v1:
* Correct typo in r8a779(70|95) patch: R8A7770 -> R8A77970


Magnus Damm (1):
  iommu/ipmmu-vmsa: Add r8a7796 DT binding

Simon Horman (1):
  iommu/ipmmu-vmsa: Add r8a779(70|95) DT bindings

 Documentation/devicetree/bindings/iommu/renesas,ipmmu-vmsa.txt | 3 +++
 1 file changed, 3 insertions(+)

-- 
2.11.0

___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


[PATCH/RFT v5 2/3] iommu/ipmmu-vmsa: Hook up r8a7796 DT matching code

2017-11-14 Thread Simon Horman
From: Magnus Damm 

Support the r8a7796 IPMMU by sharing feature flags between
r8a7795 and r8a7796. Also update IOMMU_OF_DECLARE to hook
up the updated compat string.

Signed-off-by: Magnus Damm 
Reviewed-by: Geert Uytterhoeven 
---
 drivers/iommu/ipmmu-vmsa.c | 14 ++
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/iommu/ipmmu-vmsa.c b/drivers/iommu/ipmmu-vmsa.c
index 286af358d8ce..f936f834984a 100644
--- a/drivers/iommu/ipmmu-vmsa.c
+++ b/drivers/iommu/ipmmu-vmsa.c
@@ -760,8 +760,9 @@ static bool ipmmu_slave_whitelist(struct device *dev)
return false;
 }
 
-static const struct soc_device_attribute soc_r8a7795[] = {
+static const struct soc_device_attribute soc_rcar_gen3[] = {
{ .soc_id = "r8a7795", },
+   { .soc_id = "r8a7796", },
{ /* sentinel */ }
 };
 
@@ -769,7 +770,7 @@ static int ipmmu_of_xlate(struct device *dev,
  struct of_phandle_args *spec)
 {
/* For R-Car Gen3 use a white list to opt-in slave devices */
-   if (soc_device_match(soc_r8a7795) && !ipmmu_slave_whitelist(dev))
+   if (soc_device_match(soc_rcar_gen3) && !ipmmu_slave_whitelist(dev))
return -ENODEV;
 
iommu_fwspec_add_ids(dev, spec->args, 1);
@@ -923,7 +924,7 @@ static const struct ipmmu_features ipmmu_features_default = 
{
.twobit_imttbcr_sl0 = false,
 };
 
-static const struct ipmmu_features ipmmu_features_r8a7795 = {
+static const struct ipmmu_features ipmmu_features_rcar_gen3 = {
.use_ns_alias_offset = false,
.has_cache_leaf_nodes = true,
.number_of_contexts = 8,
@@ -937,7 +938,10 @@ static const struct of_device_id ipmmu_of_ids[] = {
.data = _features_default,
}, {
.compatible = "renesas,ipmmu-r8a7795",
-   .data = _features_r8a7795,
+   .data = _features_rcar_gen3,
+   }, {
+   .compatible = "renesas,ipmmu-r8a7796",
+   .data = _features_rcar_gen3,
}, {
/* Terminator */
},
@@ -1123,6 +1127,8 @@ IOMMU_OF_DECLARE(ipmmu_vmsa_iommu_of, 
"renesas,ipmmu-vmsa",
 ipmmu_vmsa_iommu_of_setup);
 IOMMU_OF_DECLARE(ipmmu_r8a7795_iommu_of, "renesas,ipmmu-r8a7795",
 ipmmu_vmsa_iommu_of_setup);
+IOMMU_OF_DECLARE(ipmmu_r8a7796_iommu_of, "renesas,ipmmu-r8a7796",
+ipmmu_vmsa_iommu_of_setup);
 #endif
 
 MODULE_DESCRIPTION("IOMMU API for Renesas VMSA-compatible IPMMU");
-- 
2.11.0

___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


[PATCH/RFT v5 1/3] iommu/ipmmu-vmsa: Increase maximum micro-TLBS to 48

2017-11-14 Thread Simon Horman
From: Magnus Damm 

Bump up the maximum numbers of micro-TLBS to 48.

Each IPMMU device instance get micro-TLB assignment via
the "iommus" property in DT. Older SoCs tend to use a
maximum number of 32 micro-TLBs per IPMMU instance however
newer SoCs such as r8a7796 make use of up to 48 micro-TLBs.

At this point no SoC specific handling is done to validate
the maximum number of micro-TLBs, and because of that the
DT information is assumed to be within correct range for
each particular SoC.

If needed in the future SoC specific feature flags can be
added to handle the maximum number of micro-TLBs without
requiring DT changes, however at this point this does not
seem necessary.

Signed-off-by: Magnus Damm 
Reviewed-by: Geert Uytterhoeven 
---
 drivers/iommu/ipmmu-vmsa.c | 10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/iommu/ipmmu-vmsa.c b/drivers/iommu/ipmmu-vmsa.c
index 8dce3a9de9d8..286af358d8ce 100644
--- a/drivers/iommu/ipmmu-vmsa.c
+++ b/drivers/iommu/ipmmu-vmsa.c
@@ -194,7 +194,9 @@ static struct ipmmu_vmsa_device *to_ipmmu(struct device 
*dev)
 #define IMPMBA(n)  (0x0280 + ((n) * 4))
 #define IMPMBD(n)  (0x02c0 + ((n) * 4))
 
-#define IMUCTR(n)  (0x0300 + ((n) * 16))
+#define IMUCTR(n)  ((n) < 32 ? IMUCTR0(n) : IMUCTR32(n))
+#define IMUCTR0(n) (0x0300 + ((n) * 16))
+#define IMUCTR32(n)(0x0600 + (((n) - 32) * 16))
 #define IMUCTR_FIXADDEN(1 << 31)
 #define IMUCTR_FIXADD_MASK (0xff << 16)
 #define IMUCTR_FIXADD_SHIFT16
@@ -204,7 +206,9 @@ static struct ipmmu_vmsa_device *to_ipmmu(struct device 
*dev)
 #define IMUCTR_FLUSH   (1 << 1)
 #define IMUCTR_MMUEN   (1 << 0)
 
-#define IMUASID(n) (0x0308 + ((n) * 16))
+#define IMUASID(n) ((n) < 32 ? IMUASID0(n) : IMUASID32(n))
+#define IMUASID0(n)(0x0308 + ((n) * 16))
+#define IMUASID32(n)   (0x0608 + (((n) - 32) * 16))
 #define IMUASID_ASID8_MASK (0xff << 8)
 #define IMUASID_ASID8_SHIFT8
 #define IMUASID_ASID0_MASK (0xff << 0)
@@ -955,7 +959,7 @@ static int ipmmu_probe(struct platform_device *pdev)
}
 
mmu->dev = >dev;
-   mmu->num_utlbs = 32;
+   mmu->num_utlbs = 48;
spin_lock_init(>lock);
bitmap_zero(mmu->ctx, IPMMU_CTX_MAX);
mmu->features = of_device_get_match_data(>dev);
-- 
2.11.0

___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


[PATCH/RFT v5 0/3] iommu/ipmmu-vmsa: r8a779(6|70|95) support

2017-11-14 Thread Simon Horman
This series adds r8a7796 (R-Car M3-W), r8a77970 (R-Car V3M) and
r8a77995 (R-Car D3) support to the IPMMU driver.

The maximum number of micro-TLBs are increased and the driver is adjusted
to match on the new DT bindings posted separately.

Changes since V4:
 - Marked as RFC as I believe more consideration of driver support
   for these SoCs is required
 - Moved DT bindings documentation into separate patch-set
   "[PATCH 0/2] iommu/ipmmu-vmsa: Add r8a779(6|70|95) DT bindings"
   as I believe these are ready to be merged
 - Rebased
 - Collected driver updates for r8a7796, and r8a77970 and r8a77995 SoCs
   into a single patchset.

Changes since V3:
 - Rebased on top of [PATCH v4 00/09] iommu/ipmmu-vmsa: r8a7795 support V4
 - Patch 3/3 updated with Reviewed-by - thanks Geert!

Changes since V2:
 - Patch 2/3 updated with an outer set of () - thanks Ramesh!
 - Patch 2/3 updated with Reviewed-by - thanks Geert!
 - Patch 3/3 updated to include white list support

Changes since V1:
 - Patch 1/3 updated with more Acked-by tags
 - Patch 2/3 updated with high I/O register range support

Magnus Damm (2):
  iommu/ipmmu-vmsa: Increase maximum micro-TLBS to 48
  iommu/ipmmu-vmsa: Hook up r8a7796 DT matching code

Simon Horman (1):
  iommu/ipmmu-vmsa: Hook up r8a779(70|95) DT matching code

 drivers/iommu/ipmmu-vmsa.c | 36 +---
 1 file changed, 29 insertions(+), 7 deletions(-)

-- 
2.11.0

___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


[PATCH/RFT v5 3/3] iommu/ipmmu-vmsa: Hook up r8a779(70|95) DT matching code

2017-11-14 Thread Simon Horman
Support the r8a77970 (R-Car V3M) and r8a77995 (R-Car D3) IPMMUs by sharing
feature flags with r8a7795 (R-Car H3) and r8a7796 (R-Car M3-W). Also update
IOMMU_OF_DECLARE to hook up the compat strings.

Based on work for the r8a7796 by Magnus Damm

Signed-off-by: Simon Horman <horms+rene...@verge.net.au>
Reviewed-by: Geert Uytterhoeven <geert+rene...@glider.be>
---
v2
* Add reviewed-by tag from Geert Uytterhoeven
---
 drivers/iommu/ipmmu-vmsa.c | 12 
 1 file changed, 12 insertions(+)

diff --git a/drivers/iommu/ipmmu-vmsa.c b/drivers/iommu/ipmmu-vmsa.c
index f936f834984a..49c6fc0c1ae6 100644
--- a/drivers/iommu/ipmmu-vmsa.c
+++ b/drivers/iommu/ipmmu-vmsa.c
@@ -763,6 +763,8 @@ static bool ipmmu_slave_whitelist(struct device *dev)
 static const struct soc_device_attribute soc_rcar_gen3[] = {
{ .soc_id = "r8a7795", },
{ .soc_id = "r8a7796", },
+   { .soc_id = "r8a77970", },
+   { .soc_id = "r8a77995", },
{ /* sentinel */ }
 };
 
@@ -943,6 +945,12 @@ static const struct of_device_id ipmmu_of_ids[] = {
.compatible = "renesas,ipmmu-r8a7796",
.data = _features_rcar_gen3,
}, {
+   .compatible = "renesas,ipmmu-r8a77970",
+   .data = _features_rcar_gen3,
+   }, {
+   .compatible = "renesas,ipmmu-r8a77995",
+   .data = _features_rcar_gen3,
+   }, {
/* Terminator */
},
 };
@@ -1129,6 +1137,10 @@ IOMMU_OF_DECLARE(ipmmu_r8a7795_iommu_of, 
"renesas,ipmmu-r8a7795",
 ipmmu_vmsa_iommu_of_setup);
 IOMMU_OF_DECLARE(ipmmu_r8a7796_iommu_of, "renesas,ipmmu-r8a7796",
 ipmmu_vmsa_iommu_of_setup);
+IOMMU_OF_DECLARE(ipmmu_r8a77970_iommu_of, "renesas,ipmmu-r8a77970",
+ipmmu_vmsa_iommu_of_setup);
+IOMMU_OF_DECLARE(ipmmu_r8a77995_iommu_of, "renesas,ipmmu-r8a77995",
+ipmmu_vmsa_iommu_of_setup);
 #endif
 
 MODULE_DESCRIPTION("IOMMU API for Renesas VMSA-compatible IPMMU");
-- 
2.11.0

___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


[PATCH 1/2] iommu/ipmmu-vmsa: Add r8a7796 DT binding

2017-11-10 Thread Simon Horman
From: Magnus Damm <damm+rene...@opensource.se>

Update the IPMMU DT binding documentation to include the r8a7796 compat
string for R-Car M3-W.

Signed-off-by: Magnus Damm <damm+rene...@opensource.se>
Acked-by: Laurent Pinchart <laurent.pinch...@ideasonboard.com>
Acked-by: Rob Herring <r...@kernel.org>
Acked-by: Geert Uytterhoeven <geert+rene...@glider.be>
Signed-off-by: Simon Horman <horms+rene...@verge.net.au>
---
 Documentation/devicetree/bindings/iommu/renesas,ipmmu-vmsa.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/iommu/renesas,ipmmu-vmsa.txt 
b/Documentation/devicetree/bindings/iommu/renesas,ipmmu-vmsa.txt
index 3ed027cfca95..98ae900a7a76 100644
--- a/Documentation/devicetree/bindings/iommu/renesas,ipmmu-vmsa.txt
+++ b/Documentation/devicetree/bindings/iommu/renesas,ipmmu-vmsa.txt
@@ -16,6 +16,7 @@ Required Properties:
 - "renesas,ipmmu-r8a7793" for the R8A7793 (R-Car M2-N) IPMMU.
 - "renesas,ipmmu-r8a7794" for the R8A7794 (R-Car E2) IPMMU.
 - "renesas,ipmmu-r8a7795" for the R8A7795 (R-Car H3) IPMMU.
+- "renesas,ipmmu-r8a7796" for the R8A7796 (R-Car M3-W) IPMMU.
 - "renesas,ipmmu-vmsa" for generic R-Car Gen2 VMSA-compatible IPMMU.
 
   - reg: Base address and size of the IPMMU registers.
-- 
2.11.0

___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


[PATCH 0/2] iommu/ipmmu-vmsa: Add r8a779(6|70|95) DT bindings

2017-11-10 Thread Simon Horman
Update the IPMMU DT binding documentation to include r8a7796 (R-Car M3-W),
r8a77970 (R-Car V3M) and r8a77995 (R-Car D3) compat strings.

This patch-set is comprised of patches previously included in
* [PATCH v4 0/3] iommu/ipmmu-vmsa: r8a7796 support V4
* [PATCH 0/2] iommu/ipmmu-vmsa: r8a779(70|95) support

Those series also include driver updates to implement the bindings,
however, it while it is felt that the bindings themselves are ready
to be merged we feel that the driver updates are not at that stage yet.

Magnus Damm (1):
  iommu/ipmmu-vmsa: Add r8a7796 DT binding

Simon Horman (1):
  iommu/ipmmu-vmsa: Add r8a779(70|95) DT bindings

 Documentation/devicetree/bindings/iommu/renesas,ipmmu-vmsa.txt | 3 +++
 1 file changed, 3 insertions(+)

-- 
2.11.0

___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


[PATCH 2/2] iommu/ipmmu-vmsa: Add r8a779(70|95) DT bindings

2017-11-10 Thread Simon Horman
Update the IPMMU DT binding documentation to include the
r8a77970 (R-Car V3M) and r8a77995 (R-Car D3) compat strings.

Based on work for r8a7796 by Magnus Damm.

Signed-off-by: Simon Horman <horms+rene...@verge.net.au>
Reviewed-by: Geert Uytterhoeven <geert+rene...@glider.be>
---
 Documentation/devicetree/bindings/iommu/renesas,ipmmu-vmsa.txt | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/iommu/renesas,ipmmu-vmsa.txt 
b/Documentation/devicetree/bindings/iommu/renesas,ipmmu-vmsa.txt
index 98ae900a7a76..9efa87dbcfdc 100644
--- a/Documentation/devicetree/bindings/iommu/renesas,ipmmu-vmsa.txt
+++ b/Documentation/devicetree/bindings/iommu/renesas,ipmmu-vmsa.txt
@@ -17,6 +17,8 @@ Required Properties:
 - "renesas,ipmmu-r8a7794" for the R8A7794 (R-Car E2) IPMMU.
 - "renesas,ipmmu-r8a7795" for the R8A7795 (R-Car H3) IPMMU.
 - "renesas,ipmmu-r8a7796" for the R8A7796 (R-Car M3-W) IPMMU.
+- "renesas,ipmmu-r8a77970" for the R8A7770 (R-Car V3M) IPMMU.
+- "renesas,ipmmu-r8a77995" for the R8A77995 (R-Car D3) IPMMU.
 - "renesas,ipmmu-vmsa" for generic R-Car Gen2 VMSA-compatible IPMMU.
 
   - reg: Base address and size of the IPMMU registers.
-- 
2.11.0

___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


Re: [PATCH 0/2] iommu/ipmmu-vmsa: r8a779(70|95) support

2017-11-10 Thread Simon Horman
On Mon, Nov 06, 2017 at 12:22:01PM -0700, Alex Williamson wrote:
> On Wed,  1 Nov 2017 11:34:21 +0100
> Simon Horman <horms+rene...@verge.net.au> wrote:
> 
> > Update Update the IPMMU DT binding documentation and driver implementation
> > to support the r8a77970 (R-Car V3M) and r8a77995 (R-Car D3).
> > 
> > Based on work for r8a7796 by Magnus Damm.
> > 
> > Patches based on:
> > * iommu/next
> > * [PATCH v5 00/09] iommu/ipmmu-vmsa: r8a7795 support V5
> > * [PATCH v4 0/3] iommu/ipmmu-vmsa: r8a7796 support V4
> >   (fuzz when applying 3/3)
> 
> This last dependent patch series hasn't had any comments or updates
> since June.  Do I take it from Simon's new patches here that it's still
> relevant and desired?  Perhaps it was simply missed and nobody bothered
> to re-send it?  Thanks,

Hi Alex,

I spoke with Magnus about this and we feel that its a little early
to merge the driver portion of both "[PATCH v4 0/3] iommu/ipmmu-vmsa:
r8a7796 support V4" and this patchset.

We would, however, like to see the bindings updates merged as they seem
ready. I will repost them separately as that should be easiest for you.
___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


[PATCH 2/2] iommu/ipmmu-vmsa: Hook up r8a779(70|95) DT matching code

2017-11-01 Thread Simon Horman
Support the r8a77970 (R-Car V3M) and r8a77995 (R-Car D3) IPMMUs by sharing
feature flags with r8a7795 (R-Car H3) and r8a7796 (R-Car M3-W). Also update
IOMMU_OF_DECLARE to hook up the compat strings.

Based on work for the r8a7796 by Magnus Damm

Signed-off-by: Simon Horman <horms+rene...@verge.net.au>
---
 drivers/iommu/ipmmu-vmsa.c | 12 
 1 file changed, 12 insertions(+)

diff --git a/drivers/iommu/ipmmu-vmsa.c b/drivers/iommu/ipmmu-vmsa.c
index 02989bb060cc..c22520a453ff 100644
--- a/drivers/iommu/ipmmu-vmsa.c
+++ b/drivers/iommu/ipmmu-vmsa.c
@@ -749,6 +749,8 @@ static bool ipmmu_slave_whitelist(struct device *dev)
 static const struct soc_device_attribute soc_rcar_gen3[] = {
{ .soc_id = "r8a7795", },
{ .soc_id = "r8a7796", },
+   { .soc_id = "r8a77970", },
+   { .soc_id = "r8a77995", },
{ /* sentinel */ }
 };
 
@@ -1036,6 +1038,12 @@ static const struct of_device_id ipmmu_of_ids[] = {
.compatible = "renesas,ipmmu-r8a7796",
.data = _features_rcar_gen3,
}, {
+   .compatible = "renesas,ipmmu-r8a77970",
+   .data = _features_rcar_gen3,
+   }, {
+   .compatible = "renesas,ipmmu-r8a77995",
+   .data = _features_rcar_gen3,
+   }, {
/* Terminator */
},
 };
@@ -1224,6 +1232,10 @@ IOMMU_OF_DECLARE(ipmmu_r8a7795_iommu_of, 
"renesas,ipmmu-r8a7795",
 ipmmu_vmsa_iommu_of_setup);
 IOMMU_OF_DECLARE(ipmmu_r8a7796_iommu_of, "renesas,ipmmu-r8a7796",
 ipmmu_vmsa_iommu_of_setup);
+IOMMU_OF_DECLARE(ipmmu_r8a77970_iommu_of, "renesas,ipmmu-r8a77970",
+ipmmu_vmsa_iommu_of_setup);
+IOMMU_OF_DECLARE(ipmmu_r8a77995_iommu_of, "renesas,ipmmu-r8a77995",
+ipmmu_vmsa_iommu_of_setup);
 #endif
 
 MODULE_DESCRIPTION("IOMMU API for Renesas VMSA-compatible IPMMU");
-- 
2.11.0

___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


Re: [PATCH] dt-bindings: iommu: ipmmu-vmsa: Use generic node name

2017-10-05 Thread Simon Horman
On Wed, Oct 04, 2017 at 02:33:08PM +0200, Geert Uytterhoeven wrote:
> Use the preferred generic node name in the example.
> 
> Signed-off-by: Geert Uytterhoeven <geert+rene...@glider.be>

Reviewed-by: Simon Horman <horms+rene...@verge.net.au>

___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


[PATCH] iommu: ipmmu-vmsa: Use ARCH_RENESAS

2016-02-26 Thread Simon Horman
Make use of ARCH_RENESAS in place of ARCH_SHMOBILE.

This is part of an ongoing process to migrate from ARCH_SHMOBILE to
ARCH_RENESAS the motivation for which being that RENESAS seems to be a more
appropriate name than SHMOBILE for the majority of Renesas ARM based SoCs.

Signed-off-by: Simon Horman <horms+rene...@verge.net.au>
---
 drivers/iommu/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

 Based on the next branch of Joerg's iommu tree on kernel.org

diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig
index a1e75cba18e0..d4b38e4d27fe 100644
--- a/drivers/iommu/Kconfig
+++ b/drivers/iommu/Kconfig
@@ -266,7 +266,7 @@ config EXYNOS_IOMMU_DEBUG
 config IPMMU_VMSA
bool "Renesas VMSA-compatible IPMMU"
depends on ARM_LPAE
-   depends on ARCH_SHMOBILE || COMPILE_TEST
+   depends on ARCH_RENESAS || COMPILE_TEST
select IOMMU_API
select IOMMU_IO_PGTABLE_LPAE
select ARM_DMA_USE_IOMMU
-- 
2.1.4

___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu