* [PATCH 0/2] x86: fixes for the allow_coherent rewrite (tip/x86/iommu) @ 2008-09-11 14:08 FUJITA Tomonori 2008-09-11 14:08 ` [PATCH 1/2] x86: avoid unnecessary low zone allocation in Calgary's alloc_coherent FUJITA Tomonori 0 siblings, 1 reply; 7+ messages in thread From: FUJITA Tomonori @ 2008-09-11 14:08 UTC (permalink / raw) To: mingo; +Cc: linux-kernel, fujita.tomonori This is the final patchset for the allow_coherent rewrite (hopefully). ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/2] x86: avoid unnecessary low zone allocation in Calgary's alloc_coherent 2008-09-11 14:08 [PATCH 0/2] x86: fixes for the allow_coherent rewrite (tip/x86/iommu) FUJITA Tomonori @ 2008-09-11 14:08 ` FUJITA Tomonori 2008-09-11 14:08 ` [PATCH 2/2] x86: gart alloc_coherent does virtual mapppings only when necessary FUJITA Tomonori 2008-09-11 18:10 ` [PATCH 1/2] x86: avoid unnecessary low zone allocation in Calgary's alloc_coherent Muli Ben-Yehuda 0 siblings, 2 replies; 7+ messages in thread From: FUJITA Tomonori @ 2008-09-11 14:08 UTC (permalink / raw) To: mingo; +Cc: linux-kernel, fujita.tomonori, Alexis Bruemmer, Muli Ben-Yehuda x86's common alloc_coherent (dma_alloc_coherent in dma-mapping.h) sets up the gfp flag according to the device dma_mask but Calgary doesn't need it because of virtual mappings. This patch avoids unnecessary low zone allocation. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Cc: Alexis Bruemmer <alexisb@us.ibm.com> Cc: Muli Ben-Yehuda <muli@il.ibm.com> --- arch/x86/kernel/pci-calgary_64.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/arch/x86/kernel/pci-calgary_64.c b/arch/x86/kernel/pci-calgary_64.c index 8415d92..fe7695e 100644 --- a/arch/x86/kernel/pci-calgary_64.c +++ b/arch/x86/kernel/pci-calgary_64.c @@ -491,6 +491,8 @@ static void* calgary_alloc_coherent(struct device *dev, size_t size, npages = size >> PAGE_SHIFT; order = get_order(size); + flag &= ~(__GFP_DMA | __GFP_HIGHMEM | __GFP_DMA32); + /* alloc enough pages (and possibly more) */ ret = (void *)__get_free_pages(flag, order); if (!ret) -- 1.5.4.2 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/2] x86: gart alloc_coherent does virtual mapppings only when necessary 2008-09-11 14:08 ` [PATCH 1/2] x86: avoid unnecessary low zone allocation in Calgary's alloc_coherent FUJITA Tomonori @ 2008-09-11 14:08 ` FUJITA Tomonori 2008-09-11 14:16 ` Joerg Roedel 2008-09-11 18:10 ` [PATCH 1/2] x86: avoid unnecessary low zone allocation in Calgary's alloc_coherent Muli Ben-Yehuda 1 sibling, 1 reply; 7+ messages in thread From: FUJITA Tomonori @ 2008-09-11 14:08 UTC (permalink / raw) To: mingo; +Cc: linux-kernel, fujita.tomonori, Joerg Roedel gart alloc_coherent need to do virtual mapppings only when an allocated buffer is not DMA-capable for a device. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Cc: Joerg Roedel <joerg.roedel@amd.com> --- arch/x86/kernel/pci-gart_64.c | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletions(-) diff --git a/arch/x86/kernel/pci-gart_64.c b/arch/x86/kernel/pci-gart_64.c index 1b0c412..47abe43 100644 --- a/arch/x86/kernel/pci-gart_64.c +++ b/arch/x86/kernel/pci-gart_64.c @@ -488,15 +488,23 @@ gart_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_addr, gfp_t flag) { void *vaddr; + dma_addr_t paddr; unsigned long align_mask; + u64 dma_mask = dma_alloc_coherent_mask(dev, flag); vaddr = (void *)__get_free_pages(flag | __GFP_ZERO, get_order(size)); if (!vaddr) return NULL; + paddr = virt_to_phys(vaddr); + if (is_buffer_dma_capable(dma_mask, paddr, size)) { + *dma_addr = paddr; + return vaddr; + } + align_mask = (1UL << get_order(size)) - 1; - *dma_addr = dma_map_area(dev, __pa(vaddr), size, DMA_BIDIRECTIONAL, + *dma_addr = dma_map_area(dev, paddr, size, DMA_BIDIRECTIONAL, align_mask); flush_gart(); -- 1.5.4.2 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] x86: gart alloc_coherent does virtual mapppings only when necessary 2008-09-11 14:08 ` [PATCH 2/2] x86: gart alloc_coherent does virtual mapppings only when necessary FUJITA Tomonori @ 2008-09-11 14:16 ` Joerg Roedel 2008-09-14 14:44 ` Ingo Molnar 0 siblings, 1 reply; 7+ messages in thread From: Joerg Roedel @ 2008-09-11 14:16 UTC (permalink / raw) To: FUJITA Tomonori; +Cc: mingo, linux-kernel Looks good to me. On Thu, Sep 11, 2008 at 11:08:48PM +0900, FUJITA Tomonori wrote: > gart alloc_coherent need to do virtual mapppings only when an > allocated buffer is not DMA-capable for a device. > > Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> > Cc: Joerg Roedel <joerg.roedel@amd.com> Acked-by: Joerg Roedel <joerg.roedel@amd.com> > --- > arch/x86/kernel/pci-gart_64.c | 10 +++++++++- > 1 files changed, 9 insertions(+), 1 deletions(-) > > diff --git a/arch/x86/kernel/pci-gart_64.c b/arch/x86/kernel/pci-gart_64.c > index 1b0c412..47abe43 100644 > --- a/arch/x86/kernel/pci-gart_64.c > +++ b/arch/x86/kernel/pci-gart_64.c > @@ -488,15 +488,23 @@ gart_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_addr, > gfp_t flag) > { > void *vaddr; > + dma_addr_t paddr; > unsigned long align_mask; > + u64 dma_mask = dma_alloc_coherent_mask(dev, flag); > > vaddr = (void *)__get_free_pages(flag | __GFP_ZERO, get_order(size)); > if (!vaddr) > return NULL; > > + paddr = virt_to_phys(vaddr); > + if (is_buffer_dma_capable(dma_mask, paddr, size)) { > + *dma_addr = paddr; > + return vaddr; > + } > + > align_mask = (1UL << get_order(size)) - 1; > > - *dma_addr = dma_map_area(dev, __pa(vaddr), size, DMA_BIDIRECTIONAL, > + *dma_addr = dma_map_area(dev, paddr, size, DMA_BIDIRECTIONAL, > align_mask); > flush_gart(); > > -- > 1.5.4.2 > > -- | AMD Saxony Limited Liability Company & Co. KG Operating | Wilschdorfer Landstr. 101, 01109 Dresden, Germany System | Register Court Dresden: HRA 4896 Research | General Partner authorized to represent: Center | AMD Saxony LLC (Wilmington, Delaware, US) | General Manager of AMD Saxony LLC: Dr. Hans-R. Deppe, Thomas McCoy ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] x86: gart alloc_coherent does virtual mapppings only when necessary 2008-09-11 14:16 ` Joerg Roedel @ 2008-09-14 14:44 ` Ingo Molnar 0 siblings, 0 replies; 7+ messages in thread From: Ingo Molnar @ 2008-09-14 14:44 UTC (permalink / raw) To: Joerg Roedel; +Cc: FUJITA Tomonori, mingo, linux-kernel * Joerg Roedel <joerg.roedel@amd.com> wrote: > Looks good to me. > > On Thu, Sep 11, 2008 at 11:08:48PM +0900, FUJITA Tomonori wrote: > > gart alloc_coherent need to do virtual mapppings only when an > > allocated buffer is not DMA-capable for a device. > > > > Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> > > Cc: Joerg Roedel <joerg.roedel@amd.com> > > Acked-by: Joerg Roedel <joerg.roedel@amd.com> applied to tip/x86/iommu, thanks. Ingo ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] x86: avoid unnecessary low zone allocation in Calgary's alloc_coherent 2008-09-11 14:08 ` [PATCH 1/2] x86: avoid unnecessary low zone allocation in Calgary's alloc_coherent FUJITA Tomonori 2008-09-11 14:08 ` [PATCH 2/2] x86: gart alloc_coherent does virtual mapppings only when necessary FUJITA Tomonori @ 2008-09-11 18:10 ` Muli Ben-Yehuda 2008-09-14 14:44 ` Ingo Molnar 1 sibling, 1 reply; 7+ messages in thread From: Muli Ben-Yehuda @ 2008-09-11 18:10 UTC (permalink / raw) To: FUJITA Tomonori; +Cc: mingo, linux-kernel, Alexis Bruemmer On Thu, Sep 11, 2008 at 11:08:47PM +0900, FUJITA Tomonori wrote: > x86's common alloc_coherent (dma_alloc_coherent in dma-mapping.h) sets > up the gfp flag according to the device dma_mask but Calgary doesn't > need it because of virtual mappings. This patch avoids unnecessary low > zone allocation. > > Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> > Cc: Alexis Bruemmer <alexisb@us.ibm.com> > Cc: Muli Ben-Yehuda <muli@il.ibm.com> Looks good, Acked-by: Muli Ben-Yehuda <muli@il.ibm.com> Cheers, Muli -- Workshop on I/O Virtualization (WIOV '08) Co-located with OSDI '08, Dec 2008, San Diego, CA http://www.usenix.org/wiov08 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] x86: avoid unnecessary low zone allocation in Calgary's alloc_coherent 2008-09-11 18:10 ` [PATCH 1/2] x86: avoid unnecessary low zone allocation in Calgary's alloc_coherent Muli Ben-Yehuda @ 2008-09-14 14:44 ` Ingo Molnar 0 siblings, 0 replies; 7+ messages in thread From: Ingo Molnar @ 2008-09-14 14:44 UTC (permalink / raw) To: Muli Ben-Yehuda; +Cc: FUJITA Tomonori, mingo, linux-kernel, Alexis Bruemmer * Muli Ben-Yehuda <muli@il.ibm.com> wrote: > Looks good, > > Acked-by: Muli Ben-Yehuda <muli@il.ibm.com> applied to tip/x86/iommu, thanks. Ingo ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2008-09-14 14:48 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2008-09-11 14:08 [PATCH 0/2] x86: fixes for the allow_coherent rewrite (tip/x86/iommu) FUJITA Tomonori 2008-09-11 14:08 ` [PATCH 1/2] x86: avoid unnecessary low zone allocation in Calgary's alloc_coherent FUJITA Tomonori 2008-09-11 14:08 ` [PATCH 2/2] x86: gart alloc_coherent does virtual mapppings only when necessary FUJITA Tomonori 2008-09-11 14:16 ` Joerg Roedel 2008-09-14 14:44 ` Ingo Molnar 2008-09-11 18:10 ` [PATCH 1/2] x86: avoid unnecessary low zone allocation in Calgary's alloc_coherent Muli Ben-Yehuda 2008-09-14 14:44 ` Ingo Molnar
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox