Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1666629 > unrolled thread

[PATCH 01/04] iommu/ipmmu-vmsa: Use iommu_device_register()/unregister()

Started byMagnus Damm <magnus.damm@gmail.com>
First post2017-06-15 12:40 +0200
Last post2017-06-19 18:30 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 01/04] iommu/ipmmu-vmsa: Use iommu_device_register()/unregister() Magnus Damm <magnus.damm@gmail.com> - 2017-06-15 12:40 +0200
    Re: [PATCH 01/04] iommu/ipmmu-vmsa: Use  iommu_device_register()/unregister() Robin Murphy <robin.murphy@arm.com> - 2017-06-19 18:30 +0200

#1666629 — [PATCH 01/04] iommu/ipmmu-vmsa: Use iommu_device_register()/unregister()

FromMagnus Damm <magnus.damm@gmail.com>
Date2017-06-15 12:40 +0200
Subject[PATCH 01/04] iommu/ipmmu-vmsa: Use iommu_device_register()/unregister()
Message-ID<tSAlY-1jO-13@gated-at.bofh.it>
From: Magnus Damm <damm+renesas@opensource.se>

Extend the driver to make use of iommu_device_register()/unregister()
functions together with iommu_device_set_ops() and iommu_set_fwnode().

These used to be part of the earlier posted 64-bit ARM (r8a7795) series but
it turns out that these days they are required on 32-bit ARM as well.

Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
---

 drivers/iommu/ipmmu-vmsa.c |   10 ++++++++++
 1 file changed, 10 insertions(+)

--- 0001/drivers/iommu/ipmmu-vmsa.c
+++ work/drivers/iommu/ipmmu-vmsa.c	2017-06-15 16:57:21.890607110 +0900
@@ -35,6 +35,7 @@
 struct ipmmu_vmsa_device {
 	struct device *dev;
 	void __iomem *base;
+	struct iommu_device iommu;
 	struct list_head list;
 
 	unsigned int num_utlbs;
@@ -1054,6 +1055,13 @@ static int ipmmu_probe(struct platform_d
 
 	ipmmu_device_reset(mmu);
 
+	ret = iommu_device_register(&mmu->iommu);
+	if (ret)
+		return ret;
+
+	iommu_device_set_ops(&mmu->iommu, &ipmmu_ops);
+	iommu_device_set_fwnode(&mmu->iommu, &pdev->dev.of_node->fwnode);
+
 	/*
 	 * We can't create the ARM mapping here as it requires the bus to have
 	 * an IOMMU, which only happens when bus_set_iommu() is called in
@@ -1077,6 +1085,8 @@ static int ipmmu_remove(struct platform_
 	list_del(&mmu->list);
 	spin_unlock(&ipmmu_devices_lock);
 
+	iommu_device_unregister(&mmu->iommu);
+
 #if defined(CONFIG_ARM) && !defined(CONFIG_IOMMU_DMA)
 	arm_iommu_release_mapping(mmu->mapping);
 #endif

[toc] | [next] | [standalone]


#1669466 — Re: [PATCH 01/04] iommu/ipmmu-vmsa: Use iommu_device_register()/unregister()

FromRobin Murphy <robin.murphy@arm.com>
Date2017-06-19 18:30 +0200
SubjectRe: [PATCH 01/04] iommu/ipmmu-vmsa: Use iommu_device_register()/unregister()
Message-ID<tU7IS-51y-31@gated-at.bofh.it>
In reply to#1666629
On 15/06/17 11:29, Magnus Damm wrote:
> From: Magnus Damm <damm+renesas@opensource.se>
> 
> Extend the driver to make use of iommu_device_register()/unregister()
> functions together with iommu_device_set_ops() and iommu_set_fwnode().
> 
> These used to be part of the earlier posted 64-bit ARM (r8a7795) series but
> it turns out that these days they are required on 32-bit ARM as well.
> 
> Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
> ---
> 
>  drivers/iommu/ipmmu-vmsa.c |   10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> --- 0001/drivers/iommu/ipmmu-vmsa.c
> +++ work/drivers/iommu/ipmmu-vmsa.c	2017-06-15 16:57:21.890607110 +0900
> @@ -35,6 +35,7 @@
>  struct ipmmu_vmsa_device {
>  	struct device *dev;
>  	void __iomem *base;
> +	struct iommu_device iommu;
>  	struct list_head list;
>  
>  	unsigned int num_utlbs;
> @@ -1054,6 +1055,13 @@ static int ipmmu_probe(struct platform_d
>  
>  	ipmmu_device_reset(mmu);
>  
> +	ret = iommu_device_register(&mmu->iommu);
> +	if (ret)
> +		return ret;
> +
> +	iommu_device_set_ops(&mmu->iommu, &ipmmu_ops);
> +	iommu_device_set_fwnode(&mmu->iommu, &pdev->dev.of_node->fwnode);

Nit: I guess it works out OK in practice, but it does look rather weird
to be initialising the iommu_device's members *after* registering it.

Robin.

> +
>  	/*
>  	 * We can't create the ARM mapping here as it requires the bus to have
>  	 * an IOMMU, which only happens when bus_set_iommu() is called in
> @@ -1077,6 +1085,8 @@ static int ipmmu_remove(struct platform_
>  	list_del(&mmu->list);
>  	spin_unlock(&ipmmu_devices_lock);
>  
> +	iommu_device_unregister(&mmu->iommu);
> +
>  #if defined(CONFIG_ARM) && !defined(CONFIG_IOMMU_DMA)
>  	arm_iommu_release_mapping(mmu->mapping);
>  #endif
> 

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web