* [PATCH 2/4 V2] sparc: Add pci32_unmap_page.
@ 2011-01-13 9:05 Kristoffer Glembo
2011-01-13 9:50 ` Sam Ravnborg
2011-01-18 9:15 ` Kristoffer Glembo
0 siblings, 2 replies; 3+ messages in thread
From: Kristoffer Glembo @ 2011-01-13 9:05 UTC (permalink / raw)
To: sparclinux
Signed-off-by: Kristoffer Glembo <kristoffer@gaisler.com>
---
arch/sparc/kernel/ioport.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/arch/sparc/kernel/ioport.c b/arch/sparc/kernel/ioport.c
index cea49c0..1b9f07c 100644
--- a/arch/sparc/kernel/ioport.c
+++ b/arch/sparc/kernel/ioport.c
@@ -524,6 +524,13 @@ static dma_addr_t pci32_map_page(struct device *dev, struct page *page,
return page_to_phys(page) + offset;
}
+static void pci32_unmap_page(struct device *dev, dma_addr_t ba, size_t size,
+ enum dma_data_direction dir, struct dma_attrs *attrs)
+{
+ if (dir != PCI_DMA_TODEVICE)
+ mmu_inval_dma_area((unsigned long)phys_to_virt(ba), PAGE_ALIGN(size));
+}
+
/* Map a set of buffers described by scatterlist in streaming
* mode for DMA. This is the scather-gather version of the
* above pci_map_single interface. Here the scatter gather list
@@ -646,6 +653,7 @@ struct dma_map_ops pci32_dma_ops = {
.alloc_coherent = pci32_alloc_coherent,
.free_coherent = pci32_free_coherent,
.map_page = pci32_map_page,
+ .unmap_page = pci32_unmap_page,
.map_sg = pci32_map_sg,
.unmap_sg = pci32_unmap_sg,
.sync_single_for_cpu = pci32_sync_single_for_cpu,
--
1.6.4.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 2/4 V2] sparc: Add pci32_unmap_page.
2011-01-13 9:05 [PATCH 2/4 V2] sparc: Add pci32_unmap_page Kristoffer Glembo
@ 2011-01-13 9:50 ` Sam Ravnborg
2011-01-18 9:15 ` Kristoffer Glembo
1 sibling, 0 replies; 3+ messages in thread
From: Sam Ravnborg @ 2011-01-13 9:50 UTC (permalink / raw)
To: sparclinux
On Thu, Jan 13, 2011 at 10:05:33AM +0100, Kristoffer Glembo wrote:
> Signed-off-by: Kristoffer Glembo <kristoffer@gaisler.com>
I totally miss _why_ you add this function.
Just a small comment in the changelog would help.
It may due to my ignorance of all the dma stuff...
> ---
> arch/sparc/kernel/ioport.c | 8 ++++++++
> 1 files changed, 8 insertions(+), 0 deletions(-)
>
> diff --git a/arch/sparc/kernel/ioport.c b/arch/sparc/kernel/ioport.c
> index cea49c0..1b9f07c 100644
> --- a/arch/sparc/kernel/ioport.c
> +++ b/arch/sparc/kernel/ioport.c
> @@ -524,6 +524,13 @@ static dma_addr_t pci32_map_page(struct device *dev, struct page *page,
> return page_to_phys(page) + offset;
> }
>
> +static void pci32_unmap_page(struct device *dev, dma_addr_t ba, size_t size,
> + enum dma_data_direction dir, struct dma_attrs *attrs)
> +{
> + if (dir != PCI_DMA_TODEVICE)
> + mmu_inval_dma_area((unsigned long)phys_to_virt(ba), PAGE_ALIGN(size));
> +}
How about a patch that fix it so mmu_inval_dma_area() takes a void *
as first argument?
In most cases I see a cast from void * => unsigned long where we call
mmu_inval_dma_area().
In sbus_alloc_coherent() we use the result of __get_free_pages()
but the general pattern is that the result of __get_free_pages()
is cast to the right type when used.
So if we did:
void * va;
va = (void *)__get_free_pages(GFP_KERNEL|__GFP_COMP, order);
Then we could remove all the other casts.
Sam
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 2/4 V2] sparc: Add pci32_unmap_page.
2011-01-13 9:05 [PATCH 2/4 V2] sparc: Add pci32_unmap_page Kristoffer Glembo
2011-01-13 9:50 ` Sam Ravnborg
@ 2011-01-18 9:15 ` Kristoffer Glembo
1 sibling, 0 replies; 3+ messages in thread
From: Kristoffer Glembo @ 2011-01-18 9:15 UTC (permalink / raw)
To: sparclinux
Hi Sam,
Sorry for my sluggish replies.
Sam Ravnborg wrote:
> On Thu, Jan 13, 2011 at 10:05:33AM +0100, Kristoffer Glembo wrote:
>> Signed-off-by: Kristoffer Glembo <kristoffer@gaisler.com>
>
> I totally miss _why_ you add this function.
> Just a small comment in the changelog would help.
> It may due to my ignorance of all the dma stuff...
>
It is part of the DMA API and needed by our ethernet driver. I guess no PCI driver (on sparc) used it before.
>
> How about a patch that fix it so mmu_inval_dma_area() takes a void *
> as first argument?
> In most cases I see a cast from void * => unsigned long where we call
> mmu_inval_dma_area().
>
Ok.
/Kristoffer
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-01-18 9:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-13 9:05 [PATCH 2/4 V2] sparc: Add pci32_unmap_page Kristoffer Glembo
2011-01-13 9:50 ` Sam Ravnborg
2011-01-18 9:15 ` Kristoffer Glembo
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.