Re: [PATCH 1/4] Provide simple noop dma ops
Am 28.10.2015 um 01:41 schrieb Joerg Roedel: > Hi Christian, > > On Tue, Oct 27, 2015 at 11:48:48PM +0100, Christian Borntraeger wrote: >> +static dma_addr_t dma_noop_map_page(struct device *dev, struct page *page, >> + unsigned long offset, size_t size, >> + enum dma_data_direction dir, >> + struct dma_attrs *attrs) >> +{ >> +return page_to_phys(page) + offset; >> +} > > X86 also has its own version of these noop dma_ops, see > arch/x86/kernel/pci-nommu.c. This one also checks the dma_mask and > prints a warning if the physical address doesn't fit into the mask. > > I think this would make sense here too, and that we can also make x86 > use the same generic noop-dma-ops your are introducing. It not trivial without understanding the dma mask details. Do I read the x86 implementation right, that it limits the dma to 32 bit? Then we cannot collapse both implementations. Or maybe we can hide this in dma_capable. Dont know So I would prefer to keep it as is and let someone with x86 test environment do the unification. Christoph, I think you wanted to do that anyway, are you willing to do that? Christian -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/4] Provide simple noop dma ops
On Fri, Oct 30, 2015 at 01:55:56PM +0100, Christian Borntraeger wrote: > It not trivial without understanding the dma mask details. Do I read > the x86 implementation right, that it limits the dma to 32 bit? Then > we cannot collapse both implementations. Or maybe we can hide this in > dma_capable. Dont know No, DMA is not limited to 32bit on x86. Each device has its own dma_mask, and the requested address+size is checked against it. The DMA_BIT_MASK(32) check is only to there to print a warning when a 32bit capable device trys to access memory above 4GB. Joerg -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/4] Provide simple noop dma ops
Hi Christian, On Tue, Oct 27, 2015 at 11:48:48PM +0100, Christian Borntraeger wrote: > +static dma_addr_t dma_noop_map_page(struct device *dev, struct page *page, > + unsigned long offset, size_t size, > + enum dma_data_direction dir, > + struct dma_attrs *attrs) > +{ > + return page_to_phys(page) + offset; > +} X86 also has its own version of these noop dma_ops, see arch/x86/kernel/pci-nommu.c. This one also checks the dma_mask and prints a warning if the physical address doesn't fit into the mask. I think this would make sense here too, and that we can also make x86 use the same generic noop-dma-ops your are introducing. Joerg -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html