linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] MAINTAINERS: Add related headers to IOMMU section
@ 2017-03-20 19:11 Thierry Reding
  2017-03-20 19:11 ` [PATCH 2/2] iommu: Add dummy implementations for !IOMMU_IOVA Thierry Reding
  0 siblings, 1 reply; 5+ messages in thread
From: Thierry Reding @ 2017-03-20 19:11 UTC (permalink / raw)
  To: Joerg Roedel; +Cc: Mikko Perttunen, iommu, linux-tegra, linux-kernel

From: Thierry Reding <treding@nvidia.com>

The linux/iommu.h and linux/iova.h headers belong to the IOMMU subsystem
but scripts/get_maintainers.pl currently fails to assign them because
they aren't listed in MAINTAINERS.

Signed-off-by: Thierry Reding <treding@nvidia.com>
---
 MAINTAINERS | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index c265a5fe4848..e11664e2fe7c 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -6764,6 +6764,8 @@ T:	git git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git
 S:	Maintained
 F:	Documentation/devicetree/bindings/iommu/
 F:	drivers/iommu/
+F:	include/linux/iommu.h
+F:	include/linux/iova.h
 
 IP MASQUERADING
 M:	Juanjo Ciarlante <jjciarla@raiz.uncu.edu.ar>
-- 
2.12.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] iommu: Add dummy implementations for !IOMMU_IOVA
  2017-03-20 19:11 [PATCH 1/2] MAINTAINERS: Add related headers to IOMMU section Thierry Reding
@ 2017-03-20 19:11 ` Thierry Reding
  2017-03-20 19:14   ` Thierry Reding
  0 siblings, 1 reply; 5+ messages in thread
From: Thierry Reding @ 2017-03-20 19:11 UTC (permalink / raw)
  To: Joerg Roedel; +Cc: Mikko Perttunen, iommu, linux-tegra, linux-kernel

From: Thierry Reding <treding@nvidia.com>

Currently, building code which uses the API guarded by the IOMMU_IOVA
will fail to link if IOMMU_IOVA is not enabled. Often this code will be
using the API provided by the IOMMU_API Kconfig symbol, but support for
this can be optional, with code falling back to contiguous memory. This
commit implements dummy functions for the IOVA API so that it can be
compiled out.

With both IOMMU_API and IOMMU_IOVA optional, code can now be built with
or without support for IOMMU without having to resort to #ifdefs in the
user code.

Signed-off-by: Thierry Reding <treding@nvidia.com>
---
 include/linux/iova.h | 91 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 91 insertions(+)

diff --git a/include/linux/iova.h b/include/linux/iova.h
index f27bb2c62fca..548982ad5f2f 100644
--- a/include/linux/iova.h
+++ b/include/linux/iova.h
@@ -82,6 +82,7 @@ static inline unsigned long iova_pfn(struct iova_domain *iovad, dma_addr_t iova)
 	return iova >> iova_shift(iovad);
 }
 
+#ifdef CONFIG_IOMMU_IOVA
 int iova_cache_get(void);
 void iova_cache_put(void);
 
@@ -106,5 +107,95 @@ void put_iova_domain(struct iova_domain *iovad);
 struct iova *split_and_remove_iova(struct iova_domain *iovad,
 	struct iova *iova, unsigned long pfn_lo, unsigned long pfn_hi);
 void free_cpu_cached_iovas(unsigned int cpu, struct iova_domain *iovad);
+#else
+static inline int iova_cache_get(void)
+{
+	return -ENOTSUPP;
+}
+
+static inline void iova_cache_put(void)
+{
+}
+
+static inline struct iova *alloc_iova_mem(void)
+{
+	return NULL;
+}
+
+static inline void free_iova_mem(struct iova *iova)
+{
+}
+
+static inline void free_iova(struct iova_domain *iovad, unsigned long pfn)
+{
+}
+
+static inline void __free_iova(struct iova_domain *iovad, struct iova *iova)
+{
+}
+
+static inline struct iova *alloc_iova(struct iova_domain *iovad,
+				      unsigned long size,
+				      unsigned long limit_pfn,
+				      bool size_aligned)
+{
+	return NULL;
+}
+
+static inline void free_iova_fast(struct iova_domain *iovad,
+				  unsigned long pfn,
+				  unsigned long size)
+{
+}
+
+static inline unsigned long alloc_iova_fast(struct iova_domain *iovad,
+					    unsigned long size,
+					    unsigned long limit_pfn)
+{
+	return 0;
+}
+
+static inline struct iova *reserve_iova(struct iova_domain *iovad,
+					unsigned long pfn_lo,
+					unsigned long pfn_hi)
+{
+	return NULL;
+}
+
+static inline void copy_reserved_iova(struct iova_domain *from,
+				      struct iova_domain *to)
+{
+}
+
+static inline void init_iova_domain(struct iova_domain *iovad,
+				    unsigned long granule,
+				    unsigned long start_pfn,
+				    unsigned long pfn_32bit)
+{
+}
+
+static inline struct iova *find_iova(struct iova_domain *iovad,
+				     unsigned long pfn)
+{
+	return NULL;
+}
+
+static inline void put_iova_domain(struct iova_domain *iovad)
+{
+}
+
+static inline struct iova *split_and_remove_iova(struct iova_domain *iovad,
+						 struct iova *iova,
+						 unsigned long pfn_lo,
+						 unsigned long pfn_hi)
+{
+	return NULL;
+}
+
+static inline void free_cpu_cached_iovas(unsigned int cpu,
+					 struct iova_domain *iovad)
+{
+}
+#endif
 
 #endif
-- 
2.12.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] iommu: Add dummy implementations for !IOMMU_IOVA
  2017-03-20 19:11 ` [PATCH 2/2] iommu: Add dummy implementations for !IOMMU_IOVA Thierry Reding
@ 2017-03-20 19:14   ` Thierry Reding
  2017-03-22 14:55     ` Joerg Roedel
  0 siblings, 1 reply; 5+ messages in thread
From: Thierry Reding @ 2017-03-20 19:14 UTC (permalink / raw)
  To: Joerg Roedel; +Cc: Mikko Perttunen, iommu, linux-tegra, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 4022 bytes --]

On Mon, Mar 20, 2017 at 08:11:28PM +0100, Thierry Reding wrote:
> From: Thierry Reding <treding@nvidia.com>
> 
> Currently, building code which uses the API guarded by the IOMMU_IOVA
> will fail to link if IOMMU_IOVA is not enabled. Often this code will be
> using the API provided by the IOMMU_API Kconfig symbol, but support for
> this can be optional, with code falling back to contiguous memory. This
> commit implements dummy functions for the IOVA API so that it can be
> compiled out.
> 
> With both IOMMU_API and IOMMU_IOVA optional, code can now be built with
> or without support for IOMMU without having to resort to #ifdefs in the
> user code.
> 
> Signed-off-by: Thierry Reding <treding@nvidia.com>
> ---
>  include/linux/iova.h | 91 ++++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 91 insertions(+)

Hi Joerg,

I've got a series of patches that I'd like to merge for v4.12 that have
a build-time dependency on this patch. It would therefore be great to
get your Acked-by on this so that I can merge it through the DRM tree
with the rest of the patches. I can provide a stable branch with only
this patch for you to pull into the IOMMU tree.

Thierry

> diff --git a/include/linux/iova.h b/include/linux/iova.h
> index f27bb2c62fca..548982ad5f2f 100644
> --- a/include/linux/iova.h
> +++ b/include/linux/iova.h
> @@ -82,6 +82,7 @@ static inline unsigned long iova_pfn(struct iova_domain *iovad, dma_addr_t iova)
>  	return iova >> iova_shift(iovad);
>  }
>  
> +#ifdef CONFIG_IOMMU_IOVA
>  int iova_cache_get(void);
>  void iova_cache_put(void);
>  
> @@ -106,5 +107,95 @@ void put_iova_domain(struct iova_domain *iovad);
>  struct iova *split_and_remove_iova(struct iova_domain *iovad,
>  	struct iova *iova, unsigned long pfn_lo, unsigned long pfn_hi);
>  void free_cpu_cached_iovas(unsigned int cpu, struct iova_domain *iovad);
> +#else
> +static inline int iova_cache_get(void)
> +{
> +	return -ENOTSUPP;
> +}
> +
> +static inline void iova_cache_put(void)
> +{
> +}
> +
> +static inline struct iova *alloc_iova_mem(void)
> +{
> +	return NULL;
> +}
> +
> +static inline void free_iova_mem(struct iova *iova)
> +{
> +}
> +
> +static inline void free_iova(struct iova_domain *iovad, unsigned long pfn)
> +{
> +}
> +
> +static inline void __free_iova(struct iova_domain *iovad, struct iova *iova)
> +{
> +}
> +
> +static inline struct iova *alloc_iova(struct iova_domain *iovad,
> +				      unsigned long size,
> +				      unsigned long limit_pfn,
> +				      bool size_aligned)
> +{
> +	return NULL;
> +}
> +
> +static inline void free_iova_fast(struct iova_domain *iovad,
> +				  unsigned long pfn,
> +				  unsigned long size)
> +{
> +}
> +
> +static inline unsigned long alloc_iova_fast(struct iova_domain *iovad,
> +					    unsigned long size,
> +					    unsigned long limit_pfn)
> +{
> +	return 0;
> +}
> +
> +static inline struct iova *reserve_iova(struct iova_domain *iovad,
> +					unsigned long pfn_lo,
> +					unsigned long pfn_hi)
> +{
> +	return NULL;
> +}
> +
> +static inline void copy_reserved_iova(struct iova_domain *from,
> +				      struct iova_domain *to)
> +{
> +}
> +
> +static inline void init_iova_domain(struct iova_domain *iovad,
> +				    unsigned long granule,
> +				    unsigned long start_pfn,
> +				    unsigned long pfn_32bit)
> +{
> +}
> +
> +static inline struct iova *find_iova(struct iova_domain *iovad,
> +				     unsigned long pfn)
> +{
> +	return NULL;
> +}
> +
> +static inline void put_iova_domain(struct iova_domain *iovad)
> +{
> +}
> +
> +static inline struct iova *split_and_remove_iova(struct iova_domain *iovad,
> +						 struct iova *iova,
> +						 unsigned long pfn_lo,
> +						 unsigned long pfn_hi)
> +{
> +	return NULL;
> +}
> +
> +static inline void free_cpu_cached_iovas(unsigned int cpu,
> +					 struct iova_domain *iovad)
> +{
> +}
> +#endif
>  
>  #endif
> -- 
> 2.12.0
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] iommu: Add dummy implementations for !IOMMU_IOVA
  2017-03-20 19:14   ` Thierry Reding
@ 2017-03-22 14:55     ` Joerg Roedel
  2017-03-22 18:07       ` Thierry Reding
  0 siblings, 1 reply; 5+ messages in thread
From: Joerg Roedel @ 2017-03-22 14:55 UTC (permalink / raw)
  To: Thierry Reding; +Cc: Mikko Perttunen, iommu, linux-tegra, linux-kernel

Hi Thierry

On Mon, Mar 20, 2017 at 08:14:31PM +0100, Thierry Reding wrote:
> I've got a series of patches that I'd like to merge for v4.12 that have
> a build-time dependency on this patch. It would therefore be great to
> get your Acked-by on this so that I can merge it through the DRM tree
> with the rest of the patches. I can provide a stable branch with only
> this patch for you to pull into the IOMMU tree.

I applied both patches to my 'core' branch. There is not much in there
yet besides your patches, so you can easily pull that branch in once it
is published (later today).



	Joerg

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] iommu: Add dummy implementations for !IOMMU_IOVA
  2017-03-22 14:55     ` Joerg Roedel
@ 2017-03-22 18:07       ` Thierry Reding
  0 siblings, 0 replies; 5+ messages in thread
From: Thierry Reding @ 2017-03-22 18:07 UTC (permalink / raw)
  To: Joerg Roedel; +Cc: Mikko Perttunen, iommu, linux-tegra, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 723 bytes --]

On Wed, Mar 22, 2017 at 03:55:30PM +0100, Joerg Roedel wrote:
> Hi Thierry
> 
> On Mon, Mar 20, 2017 at 08:14:31PM +0100, Thierry Reding wrote:
> > I've got a series of patches that I'd like to merge for v4.12 that have
> > a build-time dependency on this patch. It would therefore be great to
> > get your Acked-by on this so that I can merge it through the DRM tree
> > with the rest of the patches. I can provide a stable branch with only
> > this patch for you to pull into the IOMMU tree.
> 
> I applied both patches to my 'core' branch. There is not much in there
> yet besides your patches, so you can easily pull that branch in once it
> is published (later today).

Works for me. Thanks!

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-03-22 18:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-20 19:11 [PATCH 1/2] MAINTAINERS: Add related headers to IOMMU section Thierry Reding
2017-03-20 19:11 ` [PATCH 2/2] iommu: Add dummy implementations for !IOMMU_IOVA Thierry Reding
2017-03-20 19:14   ` Thierry Reding
2017-03-22 14:55     ` Joerg Roedel
2017-03-22 18:07       ` Thierry Reding

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).