linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] swiotlb: swiotlb_{alloc,free}_buffer should depend on CONFIG_DMA_DIRECT_OPS
@ 2018-03-23 17:49 Christoph Hellwig
  2018-03-23 18:57 ` Konrad Rzeszutek Wilk
  2018-03-23 19:54 ` [tip:x86/dma] swiotlb: Make swiotlb_{alloc,free}_buffer " tip-bot for Christoph Hellwig
  0 siblings, 2 replies; 7+ messages in thread
From: Christoph Hellwig @ 2018-03-23 17:49 UTC (permalink / raw)
  To: tglx, mingo; +Cc: konrad.wilk, linux-kernel, iommu

Otherwise we might get unused symbol warnings for configs that built
swiotlb.c only for use by xen-swiotlb.c and that don't otherwise select
CONFIG_DMA_DIRECT_OPS, which is possible on arm.

Fixes: 16e73adbca76 ("dma/swiotlb: Remove swiotlb_{alloc,free}_coherent()")
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 lib/swiotlb.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/swiotlb.c b/lib/swiotlb.c
index 15954b86f09e..47aeb04c1997 100644
--- a/lib/swiotlb.c
+++ b/lib/swiotlb.c
@@ -692,6 +692,7 @@ void swiotlb_tbl_sync_single(struct device *hwdev, phys_addr_t tlb_addr,
 	}
 }
 
+#ifdef CONFIG_DMA_DIRECT_OPS
 static inline bool dma_coherent_ok(struct device *dev, dma_addr_t addr,
 		size_t size)
 {
@@ -763,6 +764,7 @@ static bool swiotlb_free_buffer(struct device *dev, size_t size,
 				 DMA_ATTR_SKIP_CPU_SYNC);
 	return true;
 }
+#endif
 
 static void
 swiotlb_full(struct device *dev, size_t size, enum dma_data_direction dir,
-- 
2.14.2

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

* Re: [PATCH] swiotlb: swiotlb_{alloc,free}_buffer should depend on CONFIG_DMA_DIRECT_OPS
  2018-03-23 17:49 [PATCH] swiotlb: swiotlb_{alloc,free}_buffer should depend on CONFIG_DMA_DIRECT_OPS Christoph Hellwig
@ 2018-03-23 18:57 ` Konrad Rzeszutek Wilk
  2018-03-23 19:41   ` Thomas Gleixner
  2018-03-24 17:03   ` Christoph Hellwig
  2018-03-23 19:54 ` [tip:x86/dma] swiotlb: Make swiotlb_{alloc,free}_buffer " tip-bot for Christoph Hellwig
  1 sibling, 2 replies; 7+ messages in thread
From: Konrad Rzeszutek Wilk @ 2018-03-23 18:57 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: tglx, mingo, linux-kernel, iommu

On Fri, Mar 23, 2018 at 06:49:30PM +0100, Christoph Hellwig wrote:
> Otherwise we might get unused symbol warnings for configs that built
> swiotlb.c only for use by xen-swiotlb.c and that don't otherwise select
> CONFIG_DMA_DIRECT_OPS, which is possible on arm.
> 
> Fixes: 16e73adbca76 ("dma/swiotlb: Remove swiotlb_{alloc,free}_coherent()")
> Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
> Signed-off-by: Christoph Hellwig <hch@lst.de>


Alternatively could we set the Kconfig to slect DMA_DIRECT_OPS?

> ---
>  lib/swiotlb.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/lib/swiotlb.c b/lib/swiotlb.c
> index 15954b86f09e..47aeb04c1997 100644
> --- a/lib/swiotlb.c
> +++ b/lib/swiotlb.c
> @@ -692,6 +692,7 @@ void swiotlb_tbl_sync_single(struct device *hwdev, phys_addr_t tlb_addr,
>  	}
>  }
>  
> +#ifdef CONFIG_DMA_DIRECT_OPS
>  static inline bool dma_coherent_ok(struct device *dev, dma_addr_t addr,
>  		size_t size)
>  {
> @@ -763,6 +764,7 @@ static bool swiotlb_free_buffer(struct device *dev, size_t size,
>  				 DMA_ATTR_SKIP_CPU_SYNC);
>  	return true;
>  }
> +#endif
>  
>  static void
>  swiotlb_full(struct device *dev, size_t size, enum dma_data_direction dir,
> -- 
> 2.14.2
> 

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

* Re: [PATCH] swiotlb: swiotlb_{alloc,free}_buffer should depend on CONFIG_DMA_DIRECT_OPS
  2018-03-23 18:57 ` Konrad Rzeszutek Wilk
@ 2018-03-23 19:41   ` Thomas Gleixner
  2018-03-24 17:03   ` Christoph Hellwig
  1 sibling, 0 replies; 7+ messages in thread
From: Thomas Gleixner @ 2018-03-23 19:41 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk; +Cc: Christoph Hellwig, mingo, linux-kernel, iommu

On Fri, 23 Mar 2018, Konrad Rzeszutek Wilk wrote:

> On Fri, Mar 23, 2018 at 06:49:30PM +0100, Christoph Hellwig wrote:
> > Otherwise we might get unused symbol warnings for configs that built
> > swiotlb.c only for use by xen-swiotlb.c and that don't otherwise select
> > CONFIG_DMA_DIRECT_OPS, which is possible on arm.
> > 
> > Fixes: 16e73adbca76 ("dma/swiotlb: Remove swiotlb_{alloc,free}_coherent()")
> > Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
> > Signed-off-by: Christoph Hellwig <hch@lst.de>
> 
> 
> Alternatively could we set the Kconfig to slect DMA_DIRECT_OPS?

You only want to do that when you actually need the code. If not it's a
pointless exercise.

But Christoph change makes sense independent of that because the next
oddball Kconfig will come along sooner than later and run into the very
same problem.

Thanks,

	tglx

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

* [tip:x86/dma] swiotlb: Make swiotlb_{alloc,free}_buffer depend on CONFIG_DMA_DIRECT_OPS
  2018-03-23 17:49 [PATCH] swiotlb: swiotlb_{alloc,free}_buffer should depend on CONFIG_DMA_DIRECT_OPS Christoph Hellwig
  2018-03-23 18:57 ` Konrad Rzeszutek Wilk
@ 2018-03-23 19:54 ` tip-bot for Christoph Hellwig
  1 sibling, 0 replies; 7+ messages in thread
From: tip-bot for Christoph Hellwig @ 2018-03-23 19:54 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: tglx, linux-kernel, mingo, hpa, hch, sfr

Commit-ID:  0803e6051c1562e1525c3e044313390bf8b35c2b
Gitweb:     https://git.kernel.org/tip/0803e6051c1562e1525c3e044313390bf8b35c2b
Author:     Christoph Hellwig <hch@lst.de>
AuthorDate: Fri, 23 Mar 2018 18:49:30 +0100
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Fri, 23 Mar 2018 20:15:38 +0100

swiotlb: Make swiotlb_{alloc,free}_buffer depend on CONFIG_DMA_DIRECT_OPS

Otherwise this causes unused symbol warnings for configs that build
swiotlb.c only for use by xen-swiotlb.c and that don't otherwise select
CONFIG_DMA_DIRECT_OPS, which is possible on arm.

Fixes: 16e73adbca76 ("dma/swiotlb: Remove swiotlb_{alloc,free}_coherent()")
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: iommu@lists.linux-foundation.org
Cc: konrad.wilk@oracle.com
Link: https://lkml.kernel.org/r/20180323174930.17767-1-hch@lst.de
---
 lib/swiotlb.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/swiotlb.c b/lib/swiotlb.c
index 15954b86f09e..47aeb04c1997 100644
--- a/lib/swiotlb.c
+++ b/lib/swiotlb.c
@@ -692,6 +692,7 @@ void swiotlb_tbl_sync_single(struct device *hwdev, phys_addr_t tlb_addr,
 	}
 }
 
+#ifdef CONFIG_DMA_DIRECT_OPS
 static inline bool dma_coherent_ok(struct device *dev, dma_addr_t addr,
 		size_t size)
 {
@@ -763,6 +764,7 @@ static bool swiotlb_free_buffer(struct device *dev, size_t size,
 				 DMA_ATTR_SKIP_CPU_SYNC);
 	return true;
 }
+#endif
 
 static void
 swiotlb_full(struct device *dev, size_t size, enum dma_data_direction dir,

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

* Re: [PATCH] swiotlb: swiotlb_{alloc,free}_buffer should depend on CONFIG_DMA_DIRECT_OPS
  2018-03-23 18:57 ` Konrad Rzeszutek Wilk
  2018-03-23 19:41   ` Thomas Gleixner
@ 2018-03-24 17:03   ` Christoph Hellwig
  2018-03-24 20:05     ` Konrad Rzeszutek Wilk
  1 sibling, 1 reply; 7+ messages in thread
From: Christoph Hellwig @ 2018-03-24 17:03 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk; +Cc: Christoph Hellwig, tglx, mingo, linux-kernel, iommu

On Fri, Mar 23, 2018 at 02:57:07PM -0400, Konrad Rzeszutek Wilk wrote:
> On Fri, Mar 23, 2018 at 06:49:30PM +0100, Christoph Hellwig wrote:
> > Otherwise we might get unused symbol warnings for configs that built
> > swiotlb.c only for use by xen-swiotlb.c and that don't otherwise select
> > CONFIG_DMA_DIRECT_OPS, which is possible on arm.
> > 
> > Fixes: 16e73adbca76 ("dma/swiotlb: Remove swiotlb_{alloc,free}_coherent()")
> > Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
> > Signed-off-by: Christoph Hellwig <hch@lst.de>
> 
> 
> Alternatively could we set the Kconfig to slect DMA_DIRECT_OPS?


IFF we build swiotlb.c only for xen-swiotlb we don't need DMA_DIRECT_OPS.
IF you are fine with just requring it as well that would be doable nicely
only if we consolidate to a single defintion of CONFIG_SWIOTLB instead
of one per architecture.  Which is something we should do anyway,
so I'll look into it once I get some time.

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

* Re: [PATCH] swiotlb: swiotlb_{alloc,free}_buffer should depend on CONFIG_DMA_DIRECT_OPS
  2018-03-24 17:03   ` Christoph Hellwig
@ 2018-03-24 20:05     ` Konrad Rzeszutek Wilk
  2018-03-26 13:42       ` Christoph Hellwig
  0 siblings, 1 reply; 7+ messages in thread
From: Konrad Rzeszutek Wilk @ 2018-03-24 20:05 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: tglx, mingo, linux-kernel, iommu

On Sat, Mar 24, 2018 at 06:03:51PM +0100, Christoph Hellwig wrote:
> On Fri, Mar 23, 2018 at 02:57:07PM -0400, Konrad Rzeszutek Wilk wrote:
> > On Fri, Mar 23, 2018 at 06:49:30PM +0100, Christoph Hellwig wrote:
> > > Otherwise we might get unused symbol warnings for configs that built
> > > swiotlb.c only for use by xen-swiotlb.c and that don't otherwise select
> > > CONFIG_DMA_DIRECT_OPS, which is possible on arm.
> > > 
> > > Fixes: 16e73adbca76 ("dma/swiotlb: Remove swiotlb_{alloc,free}_coherent()")
> > > Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
> > > Signed-off-by: Christoph Hellwig <hch@lst.de>
> > 
> > 
> > Alternatively could we set the Kconfig to slect DMA_DIRECT_OPS?
> 
> 
> IFF we build swiotlb.c only for xen-swiotlb we don't need DMA_DIRECT_OPS.

I don't think there is ever an case where you want a Xen specific build.

> IF you are fine with just requring it as well that would be doable nicely
> only if we consolidate to a single defintion of CONFIG_SWIOTLB instead
> of one per architecture.  Which is something we should do anyway,
> so I'll look into it once I get some time.

Sounds good. Thank you.

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

* Re: [PATCH] swiotlb: swiotlb_{alloc,free}_buffer should depend on CONFIG_DMA_DIRECT_OPS
  2018-03-24 20:05     ` Konrad Rzeszutek Wilk
@ 2018-03-26 13:42       ` Christoph Hellwig
  0 siblings, 0 replies; 7+ messages in thread
From: Christoph Hellwig @ 2018-03-26 13:42 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk; +Cc: Christoph Hellwig, tglx, mingo, linux-kernel, iommu

On Sat, Mar 24, 2018 at 04:05:45PM -0400, Konrad Rzeszutek Wilk wrote:
> > > > Otherwise we might get unused symbol warnings for configs that built
> > > > swiotlb.c only for use by xen-swiotlb.c and that don't otherwise select
> > > > CONFIG_DMA_DIRECT_OPS, which is possible on arm.
> > > > 
> > > > Fixes: 16e73adbca76 ("dma/swiotlb: Remove swiotlb_{alloc,free}_coherent()")
> > > > Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
> > > > Signed-off-by: Christoph Hellwig <hch@lst.de>
> > > 
> > > 
> > > Alternatively could we set the Kconfig to slect DMA_DIRECT_OPS?
> > 
> > 
> > IFF we build swiotlb.c only for xen-swiotlb we don't need DMA_DIRECT_OPS.
> 
> I don't think there is ever an case where you want a Xen specific build.

arm never uses swiotlb directly, so any swiotlb.c build on arm is purely
for xen-swiotlb.c

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

end of thread, other threads:[~2018-03-26 13:43 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-23 17:49 [PATCH] swiotlb: swiotlb_{alloc,free}_buffer should depend on CONFIG_DMA_DIRECT_OPS Christoph Hellwig
2018-03-23 18:57 ` Konrad Rzeszutek Wilk
2018-03-23 19:41   ` Thomas Gleixner
2018-03-24 17:03   ` Christoph Hellwig
2018-03-24 20:05     ` Konrad Rzeszutek Wilk
2018-03-26 13:42       ` Christoph Hellwig
2018-03-23 19:54 ` [tip:x86/dma] swiotlb: Make swiotlb_{alloc,free}_buffer " tip-bot for Christoph Hellwig

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).