mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alessandro Rubini <rubini@gnudd.com>
To: linux-kernel@vger.kernel.org
Cc: tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com,
	x86@kernel.org, Jesse Barnes <jbarnes@virtuousgeek.org>,
	Ingo Molnar <mingo@elte.hu>,
	Giancarlo Asnaghi <giancarlo.asnaghi@st.com>,
	Alan Cox <alan@linux.intel.com>
Subject: [PATCH V4 2/3] x86: introduce CONFIG_X86_DMA_REMAP
Date: Tue, 13 Mar 2012 08:30:38 +0100	[thread overview]
Message-ID: <6ee0095901fd5cb5a84997a8a4553e2e8caf0727.1331622735.git.rubini@gnudd.com> (raw)
In-Reply-To: <cover.1331622735.git.rubini@gnudd.com>

The default functions phys_to_dma, dma_to_phys implement identity
mapping as fast inline functions.  Some systems, however, may need a
custom function to implement its own mapping between CPU addresses and
device addresses. This new configuration option allows the functions
to be external when needed (such as for the ConneXt device)

Signed-off-by: Alessandro Rubini <rubini@gnudd.com>
Acked-by: Giancarlo Asnaghi <giancarlo.asnaghi@st.com>
Cc: Alan Cox <alan@linux.intel.com>
---
 arch/x86/Kconfig                   |    3 +++
 arch/x86/include/asm/dma-mapping.h |    7 +++++++
 2 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index c06a8a3..9f6255b 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -2253,6 +2253,9 @@ config X86_DEV_DMA_OPS
 	bool
 	depends on X86_64
 
+config X86_DMA_REMAP
+	bool
+
 source "net/Kconfig"
 
 source "drivers/Kconfig"
diff --git a/arch/x86/include/asm/dma-mapping.h b/arch/x86/include/asm/dma-mapping.h
index 09aa473..61c0bd2 100644
--- a/arch/x86/include/asm/dma-mapping.h
+++ b/arch/x86/include/asm/dma-mapping.h
@@ -62,6 +62,12 @@ extern void *dma_generic_alloc_coherent(struct device *dev, size_t size,
 					dma_addr_t *dma_addr, gfp_t flag,
 					struct dma_attrs *attrs);
 
+#ifdef CONFIG_X86_DMA_REMAP /* Platform code defines bridge-specific code */
+extern bool dma_capable(struct device *dev, dma_addr_t addr, size_t size);
+extern dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr);
+extern phys_addr_t dma_to_phys(struct device *dev, dma_addr_t daddr);
+#else
+
 static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size)
 {
 	if (!dev->dma_mask)
@@ -79,6 +85,7 @@ static inline phys_addr_t dma_to_phys(struct device *dev, dma_addr_t daddr)
 {
 	return daddr;
 }
+#endif /* CONFIG_X86_DMA_REMAP */
 
 static inline void
 dma_cache_sync(struct device *dev, void *vaddr, size_t size,
-- 
1.7.7.2

  parent reply	other threads:[~2012-03-13  7:31 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-13  7:28 [PATCH V4 0/3] *** SUBJECT HERE *** Alessandro Rubini
2012-03-13  7:30 ` [PATCH V4 1/3] x86: introduce CONFIG_X86_DEV_DMA_OPS Alessandro Rubini
2012-03-14  6:56   ` Ingo Molnar
2012-04-12 18:01     ` H. Peter Anvin
2012-04-12 20:15     ` Alessandro Rubini
2012-04-12 20:18       ` H. Peter Anvin
2012-04-12 20:32       ` Alessandro Rubini
2012-04-12 20:47         ` H. Peter Anvin
2012-04-14 11:38           ` Ingo Molnar
2012-04-11 10:19   ` Alessandro Rubini
2012-03-13  7:30 ` Alessandro Rubini [this message]
2012-03-13  7:30 ` [PATCH V4 3/3] x86/PCI: initial support for sta2x11 I/O hub Alessandro Rubini

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=6ee0095901fd5cb5a84997a8a4553e2e8caf0727.1331622735.git.rubini@gnudd.com \
    --to=rubini@gnudd.com \
    --cc=alan@linux.intel.com \
    --cc=giancarlo.asnaghi@st.com \
    --cc=hpa@zytor.com \
    --cc=jbarnes@virtuousgeek.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®