LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: David Rientjes <rientjes@google.com>
To: Arnd Bergmann <arnd@arndb.de>,
	Andrew Morton <akpm@linux-foundation.org>,
	Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	Thomas Gleixner <tglx@linutronix.de>
Cc: Adam Belay <abelay@mit.edu>, Bjorn Helgaas <bjorn.helgaas@hp.com>,
	Russell King <linux@arm.linux.org.uk>,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [patch v2 4/4] x86: allow CONFIG_ISA_DMA_API to be disabled
Date: Thu, 27 Jan 2011 13:48:23 -0800 (PST)	[thread overview]
Message-ID: <alpine.DEB.2.00.1101271345410.8425@chino.kir.corp.google.com> (raw)
In-Reply-To: <201101270923.37476.arnd@arndb.de>

On Thu, 27 Jan 2011, Arnd Bergmann wrote:

> But the x86_64 machines can also run 32 bit kernel, and I would expect
> that they don't need ISA DMA in that configuration either.
> 
> I think it would make sense to let the CONFIG_EXPERT user disable
> DMA for 32 bit as well.
> 

Hmm, ok, I originally thought that allowing it to be disabled for 32-bit 
would cause people to regret it later when using pnp, for instance, and 
finding they need to require ISA-style DMA support for their devices.  I 
agree, though, that allowing CONFIG_EXPERT to disable it even for 32-bit 
sounds appropriate since they ultimately know what devices they're 
limiting their kernel from using.  Thanks!


x86: allow CONFIG_ISA_DMA_API to be disabled

Not all 64-bit systems require ISA-style DMA, so allow it to be
configurable.  x86 utilizes the generic ISA DMA allocator from
kernel/dma.c, so require it only when CONFIG_ISA_DMA_API is enabled.

64-bit systems may compile a 32-bit kernel, so allow disabling it for
i386 as well.

Disabling CONFIG_ISA_DMA_API is dependent on CONFIG_EXPERT as required by
H. Peter Anvin.

When disabled, this also avoids declaring claim_dma_lock(),
release_dma_lock(), request_dma(), and free_dma() since those interfaces
will no longer be provided.

Signed-off-by: David Rientjes <rientjes@google.com>
---
 arch/x86/Kconfig           |   10 +++++++---
 arch/x86/include/asm/dma.h |    6 +++++-
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -119,7 +119,7 @@ config NEED_SG_DMA_LENGTH
 	def_bool y
 
 config GENERIC_ISA_DMA
-	def_bool y
+	def_bool ISA_DMA_API
 
 config GENERIC_IOMAP
 	def_bool y
@@ -2000,9 +2000,13 @@ source "drivers/pci/pcie/Kconfig"
 
 source "drivers/pci/Kconfig"
 
-# x86_64 have no ISA slots, but do have ISA-style DMA.
+# x86_64 have no ISA slots, but can have ISA-style DMA.
 config ISA_DMA_API
-	def_bool y
+	bool "ISA-style DMA support" if EXPERT
+	default y
+	help
+	  Enables ISA-style DMA support for devices requiring such controllers.
+	  If unsure, say Y.
 
 if X86_32
 
diff --git a/arch/x86/include/asm/dma.h b/arch/x86/include/asm/dma.h
--- a/arch/x86/include/asm/dma.h
+++ b/arch/x86/include/asm/dma.h
@@ -151,6 +151,7 @@
 #define DMA_AUTOINIT		0x10
 
 
+#ifdef CONFIG_ISA_DMA_API
 extern spinlock_t  dma_spin_lock;
 
 static inline unsigned long claim_dma_lock(void)
@@ -164,6 +165,7 @@ static inline void release_dma_lock(unsigned long flags)
 {
 	spin_unlock_irqrestore(&dma_spin_lock, flags);
 }
+#endif /* CONFIG_ISA_DMA_API */
 
 /* enable/disable a specific DMA channel */
 static inline void enable_dma(unsigned int dmanr)
@@ -303,9 +305,11 @@ static inline int get_dma_residue(unsigned int dmanr)
 }
 
 
-/* These are in kernel/dma.c: */
+/* These are in kernel/dma.c because x86 uses CONFIG_GENERIC_ISA_DMA */
+#ifdef CONFIG_ISA_DMA_API
 extern int request_dma(unsigned int dmanr, const char *device_id);
 extern void free_dma(unsigned int dmanr);
+#endif
 
 /* From PCI */
 

  reply	other threads:[~2011-01-27 21:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-27  3:14 [patch 1/4] pnp: only assign IORESOURCE_DMA if CONFIG_ISA_DMA_API is enabled David Rientjes
2011-01-27  3:14 ` [patch 2/4] x86: only compile 8237A " David Rientjes
2011-01-27  3:14 ` [patch 3/4] x86: only compile floppy driver " David Rientjes
2011-01-27  3:14 ` [patch 4/4] x86: allow CONFIG_ISA_DMA_API to be disabled David Rientjes
2011-01-27  8:23   ` Arnd Bergmann
2011-01-27 21:48     ` David Rientjes [this message]
2011-02-03 20:01 ` [patch 1/4] pnp: only assign IORESOURCE_DMA if CONFIG_ISA_DMA_API is enabled David Rientjes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.00.1101271345410.8425@chino.kir.corp.google.com \
    --to=rientjes@google.com \
    --cc=abelay@mit.edu \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=bjorn.helgaas@hp.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    --subject='Re: [patch v2 4/4] x86: allow CONFIG_ISA_DMA_API to be disabled' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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