Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1355241
| From | "Niklas S??derlund" <niklas.soderlund@ragnatech.se> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v5 3/9] dma-mapping: add dma_{map,unmap}_resource |
| Date | 2016-03-10 17:10 +0100 |
| Message-ID | <rbbjZ-119-15@gated-at.bofh.it> (permalink) |
| References | <rafSF-34S-3@gated-at.bofh.it> <rafSG-34S-21@gated-at.bofh.it> <rakpk-6eV-17@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Hi Christoph, On 2016-03-07 23:38:47 -0800, Christoph Hellwig wrote: > Please add some documentation on where/how this should be used. It's > not a very obvious interface. Good idea, I have added the following to Documentation/DMA-API.txt and folded it in to this patch. Do you feel it's adequate and do you know anywhere else I should add documentation? diff --git a/Documentation/DMA-API.txt b/Documentation/DMA-API.txt index 45ef3f2..248556a 100644 --- a/Documentation/DMA-API.txt +++ b/Documentation/DMA-API.txt @@ -277,14 +277,29 @@ and <size> parameters are provided to do partial page mapping, it is recommended that you never use these unless you really know what the cache width is. +dma_addr_t +dma_map_resource(struct device *dev, phys_addr_t phys_addr, size_t size, + enum dma_data_direction dir, struct dma_attrs *attrs) + +Maps a MMIO region so it can be accessed by the device and returns the +DMA address of the memory. API should only be used to map device MMIO, +mapping of RAM is not permitted. + +void +dma_unmap_resource(struct device *dev, dma_addr_t addr, size_t size, + enum dma_data_direction dir, struct dma_attrs *attrs) + +Unmaps the IOMMU region previously mapped. All the parameters passed in +must be identical to those passed in (and returned) by the mapping API. + int dma_mapping_error(struct device *dev, dma_addr_t dma_addr) -In some circumstances dma_map_single() and dma_map_page() will fail to create -a mapping. A driver can check for these errors by testing the returned -DMA address with dma_mapping_error(). A non-zero return value means the mapping -could not be created and the driver should take appropriate action (e.g. -reduce current DMA mapping usage or delay and try again later). +In some circumstances dma_map_single(), dma_map_page() and dma_map_resource() +will fail to create a mapping. A driver can check for these errors by testing +the returned DMA address with dma_mapping_error(). A non-zero return value +means the mapping could not be created and the driver should take appropriate +action (e.g. reduce current DMA mapping usage or delay and try again later). -- Regards, Niklas Söderlund
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v5 0/9] dmaengine: rcar-dmac: add iommu support for slave transfers Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> - 2016-03-08 03:50 +0100
[PATCH v5 4/9] arm: dma-mapping: add {map,unmap}_resource for iommu ops Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> - 2016-03-08 03:50 +0100
[PATCH v5 3/9] dma-mapping: add dma_{map,unmap}_resource Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> - 2016-03-08 03:50 +0100
Re: [PATCH v5 3/9] dma-mapping: add dma_{map,unmap}_resource Christoph Hellwig <hch@infradead.org> - 2016-03-08 08:40 +0100
Re: [PATCH v5 3/9] dma-mapping: add dma_{map,unmap}_resource "Niklas S??derlund" <niklas.soderlund@ragnatech.se> - 2016-03-10 17:10 +0100
Re: [PATCH v5 3/9] dma-mapping: add dma_{map,unmap}_resource Vinod Koul <vinod.koul@intel.com> - 2016-03-11 07:20 +0100
Re: [PATCH v5 3/9] dma-mapping: add dma_{map,unmap}_resource Dan Williams <dan.j.williams@intel.com> - 2016-03-11 07:50 +0100
Re: [PATCH v5 3/9] dma-mapping: add dma_{map,unmap}_resource Christoph Hellwig <hch@infradead.org> - 2016-03-11 12:20 +0100
Re: [PATCH v5 3/9] dma-mapping: add dma_{map,unmap}_resource Niklas Söderlund <niklas.soderlund@ragnatech.se> - 2016-03-11 14:00 +0100
Re: [PATCH v5 3/9] dma-mapping: add dma_{map,unmap}_resource Christoph Hellwig <hch@infradead.org> - 2016-03-15 09:30 +0100
Re: [PATCH v5 3/9] dma-mapping: add dma_{map,unmap}_resource Robin Murphy <robin.murphy@arm.com> - 2016-03-11 14:50 +0100
Re: [PATCH v5 3/9] dma-mapping: add dma_{map,unmap}_resource Dan Williams <dan.j.williams@intel.com> - 2016-03-11 19:00 +0100
[PATCH v5 9/9] ARM: dts: r8a7791: add iommus to dmac0 and dmac1 Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> - 2016-03-08 03:50 +0100
[PATCH v5 1/9] iommu: Add MMIO mapping type Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> - 2016-03-08 03:50 +0100
[PATCH v5 6/9] dmaengine: rcar-dmac: group slave configuration Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> - 2016-03-08 03:50 +0100
csiph-web