Message ID | 1294909535-6290-3-git-send-email-kristoffer@gaisler.com |
---|---|
State | Changes Requested |
Delegated to: | David Miller |
Headers | show |
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 -- To unsubscribe from this list: send the line "unsubscribe sparclinux" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
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 -- To unsubscribe from this list: send the line "unsubscribe sparclinux" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
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,
Signed-off-by: Kristoffer Glembo <kristoffer@gaisler.com> --- arch/sparc/kernel/ioport.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-)