* [PATCH 1/2] MIPS: Reinstate plat_map_dma_mem_page()
@ 2010-10-10 1:50 Kevin Cernekee
2010-10-11 12:30 ` Ralf Baechle
0 siblings, 1 reply; 2+ messages in thread
From: Kevin Cernekee @ 2010-10-10 1:50 UTC (permalink / raw)
To: Ralf Baechle; +Cc: ddaney, linux-mips, linux-kernel
[Patch is against linux-queue.git]
plat_map_dma_mem_page() is required in order to translate a "struct page"
directly to a physical address. plat_map_dma_mem() is not effective on
HIGHMEM pages.
Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
---
.../include/asm/mach-cavium-octeon/dma-coherence.h | 6 ++++++
arch/mips/include/asm/mach-generic/dma-coherence.h | 6 ++++++
arch/mips/include/asm/mach-ip27/dma-coherence.h | 8 ++++++++
arch/mips/include/asm/mach-ip32/dma-coherence.h | 13 +++++++++++++
arch/mips/include/asm/mach-jazz/dma-coherence.h | 6 ++++++
.../mips/include/asm/mach-loongson/dma-coherence.h | 6 ++++++
arch/mips/include/asm/mach-powertv/dma-coherence.h | 6 ++++++
7 files changed, 51 insertions(+), 0 deletions(-)
diff --git a/arch/mips/include/asm/mach-cavium-octeon/dma-coherence.h b/arch/mips/include/asm/mach-cavium-octeon/dma-coherence.h
index a3f6676..dfdcf49 100644
--- a/arch/mips/include/asm/mach-cavium-octeon/dma-coherence.h
+++ b/arch/mips/include/asm/mach-cavium-octeon/dma-coherence.h
@@ -23,6 +23,12 @@ static inline dma_addr_t plat_map_dma_mem(struct device *dev, void *addr,
BUG();
}
+static inline dma_addr_t plat_map_dma_mem_page(struct device *dev,
+ struct page *page)
+{
+ BUG();
+}
+
static inline unsigned long plat_dma_addr_to_phys(struct device *dev,
dma_addr_t dma_addr)
{
diff --git a/arch/mips/include/asm/mach-generic/dma-coherence.h b/arch/mips/include/asm/mach-generic/dma-coherence.h
index 8259966..8da9807 100644
--- a/arch/mips/include/asm/mach-generic/dma-coherence.h
+++ b/arch/mips/include/asm/mach-generic/dma-coherence.h
@@ -17,6 +17,12 @@ static inline dma_addr_t plat_map_dma_mem(struct device *dev, void *addr,
return virt_to_phys(addr);
}
+static inline dma_addr_t plat_map_dma_mem_page(struct device *dev,
+ struct page *page)
+{
+ return page_to_phys(page);
+}
+
static inline unsigned long plat_dma_addr_to_phys(struct device *dev,
dma_addr_t dma_addr)
{
diff --git a/arch/mips/include/asm/mach-ip27/dma-coherence.h b/arch/mips/include/asm/mach-ip27/dma-coherence.h
index 2a55c55..016d098 100644
--- a/arch/mips/include/asm/mach-ip27/dma-coherence.h
+++ b/arch/mips/include/asm/mach-ip27/dma-coherence.h
@@ -26,6 +26,14 @@ static inline dma_addr_t plat_map_dma_mem(struct device *dev, void *addr,
return pa;
}
+static inline dma_addr_t plat_map_dma_mem_page(struct device *dev,
+ struct page *page)
+{
+ dma_addr_t pa = dev_to_baddr(dev, page_to_phys(page));
+
+ return pa;
+}
+
static inline unsigned long plat_dma_addr_to_phys(struct device *dev,
dma_addr_t dma_addr)
{
diff --git a/arch/mips/include/asm/mach-ip32/dma-coherence.h b/arch/mips/include/asm/mach-ip32/dma-coherence.h
index f204a1f..c8fb5aa 100644
--- a/arch/mips/include/asm/mach-ip32/dma-coherence.h
+++ b/arch/mips/include/asm/mach-ip32/dma-coherence.h
@@ -37,6 +37,19 @@ static inline dma_addr_t plat_map_dma_mem(struct device *dev, void *addr,
return pa;
}
+static inline dma_addr_t plat_map_dma_mem_page(struct device *dev,
+ struct page *page)
+{
+ dma_addr_t pa;
+
+ pa = page_to_phys(page) & RAM_OFFSET_MASK;
+
+ if (dev == NULL)
+ pa += CRIME_HI_MEM_BASE;
+
+ return pa;
+}
+
/* This is almost certainly wrong but it's what dma-ip32.c used to use */
static inline unsigned long plat_dma_addr_to_phys(struct device *dev,
dma_addr_t dma_addr)
diff --git a/arch/mips/include/asm/mach-jazz/dma-coherence.h b/arch/mips/include/asm/mach-jazz/dma-coherence.h
index f2bc39a..302101b 100644
--- a/arch/mips/include/asm/mach-jazz/dma-coherence.h
+++ b/arch/mips/include/asm/mach-jazz/dma-coherence.h
@@ -17,6 +17,12 @@ static inline dma_addr_t plat_map_dma_mem(struct device *dev, void *addr, size_t
return vdma_alloc(virt_to_phys(addr), size);
}
+static inline dma_addr_t plat_map_dma_mem_page(struct device *dev,
+ struct page *page)
+{
+ return vdma_alloc(page_to_phys(page), PAGE_SIZE);
+}
+
static inline unsigned long plat_dma_addr_to_phys(struct device *dev,
dma_addr_t dma_addr)
{
diff --git a/arch/mips/include/asm/mach-loongson/dma-coherence.h b/arch/mips/include/asm/mach-loongson/dma-coherence.h
index 8daeaee..981c75f 100644
--- a/arch/mips/include/asm/mach-loongson/dma-coherence.h
+++ b/arch/mips/include/asm/mach-loongson/dma-coherence.h
@@ -19,6 +19,12 @@ static inline dma_addr_t plat_map_dma_mem(struct device *dev, void *addr,
return virt_to_phys(addr) | 0x80000000;
}
+static inline dma_addr_t plat_map_dma_mem_page(struct device *dev,
+ struct page *page)
+{
+ return page_to_phys(page) | 0x80000000;
+}
+
static inline unsigned long plat_dma_addr_to_phys(struct device *dev,
dma_addr_t dma_addr)
{
diff --git a/arch/mips/include/asm/mach-powertv/dma-coherence.h b/arch/mips/include/asm/mach-powertv/dma-coherence.h
index 647de8c..f76029c 100644
--- a/arch/mips/include/asm/mach-powertv/dma-coherence.h
+++ b/arch/mips/include/asm/mach-powertv/dma-coherence.h
@@ -70,6 +70,12 @@ static inline dma_addr_t plat_map_dma_mem(struct device *dev, void *addr,
return phys_to_dma(virt_to_phys(addr));
}
+static inline dma_addr_t plat_map_dma_mem_page(struct device *dev,
+ struct page *page)
+{
+ return phys_to_dma(page_to_phys(page));
+}
+
static inline unsigned long plat_dma_addr_to_phys(struct device *dev,
dma_addr_t dma_addr)
{
--
1.7.0.4
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH 1/2] MIPS: Reinstate plat_map_dma_mem_page()
2010-10-10 1:50 [PATCH 1/2] MIPS: Reinstate plat_map_dma_mem_page() Kevin Cernekee
@ 2010-10-11 12:30 ` Ralf Baechle
0 siblings, 0 replies; 2+ messages in thread
From: Ralf Baechle @ 2010-10-11 12:30 UTC (permalink / raw)
To: Kevin Cernekee; +Cc: ddaney, linux-mips, linux-kernel
On Sat, Oct 09, 2010 at 06:50:13PM -0700, Kevin Cernekee wrote:
> [Patch is against linux-queue.git]
>
> plat_map_dma_mem_page() is required in order to translate a "struct page"
> directly to a physical address. plat_map_dma_mem() is not effective on
> HIGHMEM pages.
Seems to make sense. I've folded your patch into patch 6 of David Daney's
series and fixed up the resulting reject in patch 8.
Thanks!
Ralf
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-10-11 13:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-10 1:50 [PATCH 1/2] MIPS: Reinstate plat_map_dma_mem_page() Kevin Cernekee
2010-10-11 12:30 ` Ralf Baechle
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox