Re: remove NULL struct device support in the DMA API
On Wed, Apr 03, 2019 at 07:26:40PM +0100, Russell King - ARM Linux admin wrote: > On Thu, Mar 21, 2019 at 03:52:28PM -0700, Christoph Hellwig wrote: > > We still have a few drivers which pass a NULL struct device pointer > > to DMA API functions, which generally is a bad idea as the API > > implementations rely on the device not only for ops selection, but > > also the dma mask and various other attributes, and many implementations > > have been broken for NULL device support for a while. > > I think I must be missing something, but... > > My understanding is that ISA DMA is normally limited to 24 bits of > address Yes. > - indeed, the x86 version only programs 24 bits of DMA address. > Looking through this series, it appears that the conversions mean that > the DMA mask for ISA becomes the full all-ones DMA mask, which would > of course lead to memory corruption if only 24 bits of the address end > up being programmed into the hardware. In the generic dma mapping code no struct device has always meant a 32-bit DMA mask - take a look at the dma_get_mask() function. > Maybe you could say why you think this series is safe in regard to ISA > DMA? ISA DMA has always been rather painful in a myriad of ways, and the DMA API so far hasn't helped, given that we don't do bounce buffering for the 24-bit limit, but just the higher limits. So far even if you do use the DMA API and pass a device ISA DMA so far always meant that the higher layers had to assure things are addressable, either by using GFP_DMA allocation in the drivers, or mid-layer hacks like the unchecked_isa_dma flag in SCSI and/or BLK_BOUNCE_ISA in the block layer. This series doesn't change those facts at all. I have some half started series to clean some of this up but it isn't high up on the priority list. ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu
Re: remove NULL struct device support in the DMA API
On Thu, Mar 21, 2019 at 03:52:28PM -0700, Christoph Hellwig wrote: > We still have a few drivers which pass a NULL struct device pointer > to DMA API functions, which generally is a bad idea as the API > implementations rely on the device not only for ops selection, but > also the dma mask and various other attributes, and many implementations > have been broken for NULL device support for a while. I think I must be missing something, but... My understanding is that ISA DMA is normally limited to 24 bits of address - indeed, the x86 version only programs 24 bits of DMA address. Looking through this series, it appears that the conversions mean that the DMA mask for ISA becomes the full all-ones DMA mask, which would of course lead to memory corruption if only 24 bits of the address end up being programmed into the hardware. Maybe you could say why you think this series is safe in regard to ISA DMA? > > This series removes the few remaning users that weren't picked up in > the last merge window and then removes core support for this "feature". > > A git tree is also available at: > > git://git.infradead.org/users/hch/misc.git dma-remove-NULL-dev-support > > Gitweb: > > > http://git.infradead.org/users/hch/misc.git/shortlog/refs/heads/dma-remove-NULL-dev-support > -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up According to speedtest.net: 11.9Mbps down 500kbps up ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu
Re: remove NULL struct device support in the DMA API
Any comments on the remaining patches? I'd like to give this series a couple weeks of soaking in linux-next before the end of the merge window, so reviews would be apprciated. On Thu, Mar 21, 2019 at 03:52:28PM -0700, Christoph Hellwig wrote: > We still have a few drivers which pass a NULL struct device pointer > to DMA API functions, which generally is a bad idea as the API > implementations rely on the device not only for ops selection, but > also the dma mask and various other attributes, and many implementations > have been broken for NULL device support for a while. > > This series removes the few remaning users that weren't picked up in > the last merge window and then removes core support for this "feature". > > A git tree is also available at: > > git://git.infradead.org/users/hch/misc.git dma-remove-NULL-dev-support > > Gitweb: > > > http://git.infradead.org/users/hch/misc.git/shortlog/refs/heads/dma-remove-NULL-dev-support > ___ > iommu mailing list > iommu@lists.linux-foundation.org > https://lists.linuxfoundation.org/mailman/listinfo/iommu ---end quoted text--- ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu
remove NULL struct device support in the DMA API
We still have a few drivers which pass a NULL struct device pointer to DMA API functions, which generally is a bad idea as the API implementations rely on the device not only for ops selection, but also the dma mask and various other attributes, and many implementations have been broken for NULL device support for a while. This series removes the few remaning users that weren't picked up in the last merge window and then removes core support for this "feature". A git tree is also available at: git://git.infradead.org/users/hch/misc.git dma-remove-NULL-dev-support Gitweb: http://git.infradead.org/users/hch/misc.git/shortlog/refs/heads/dma-remove-NULL-dev-support ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu