Lines Matching defs:pdata
19 void afu_dma_region_init(struct dfl_feature_platform_data *pdata)
21 struct dfl_afu *afu = dfl_fpga_pdata_get_private(pdata);
28 * @pdata: feature device platform data
34 static int afu_dma_pin_pages(struct dfl_feature_platform_data *pdata,
38 struct device *dev = &pdata->dev->dev;
76 * @pdata: feature device platform data
82 static void afu_dma_unpin_pages(struct dfl_feature_platform_data *pdata,
86 struct device *dev = &pdata->dev->dev;
136 * @pdata: feature device platform data
141 * Needs to be called with pdata->lock heold.
143 static int afu_dma_region_add(struct dfl_feature_platform_data *pdata,
146 struct dfl_afu *afu = dfl_fpga_pdata_get_private(pdata);
149 dev_dbg(&pdata->dev->dev, "add region (iova = %llx)\n",
180 * @pdata: feature device platform data
183 * Needs to be called with pdata->lock heold.
185 static void afu_dma_region_remove(struct dfl_feature_platform_data *pdata,
190 dev_dbg(&pdata->dev->dev, "del region (iova = %llx)\n",
193 afu = dfl_fpga_pdata_get_private(pdata);
199 * @pdata: feature device platform data
201 * Needs to be called with pdata->lock heold.
203 void afu_dma_region_destroy(struct dfl_feature_platform_data *pdata)
205 struct dfl_afu *afu = dfl_fpga_pdata_get_private(pdata);
212 dev_dbg(&pdata->dev->dev, "del region (iova = %llx)\n",
218 dma_unmap_page(dfl_fpga_pdata_to_parent(pdata),
223 afu_dma_unpin_pages(pdata, region);
232 * @pdata: feature device platform data
242 * Needs to be called with pdata->lock held.
245 afu_dma_region_find(struct dfl_feature_platform_data *pdata, u64 iova, u64 size)
247 struct dfl_afu *afu = dfl_fpga_pdata_get_private(pdata);
249 struct device *dev = &pdata->dev->dev;
279 * @pdata: feature device platform data
282 * Needs to be called with pdata->lock held.
285 afu_dma_region_find_iova(struct dfl_feature_platform_data *pdata, u64 iova)
287 return afu_dma_region_find(pdata, iova, 0);
292 * @pdata: feature device platform data
301 int afu_dma_map_region(struct dfl_feature_platform_data *pdata,
326 ret = afu_dma_pin_pages(pdata, region);
328 dev_err(&pdata->dev->dev, "failed to pin memory region\n");
334 dev_err(&pdata->dev->dev, "pages are not continuous\n");
340 region->iova = dma_map_page(dfl_fpga_pdata_to_parent(pdata),
344 if (dma_mapping_error(dfl_fpga_pdata_to_parent(pdata), region->iova)) {
345 dev_err(&pdata->dev->dev, "failed to map for dma\n");
352 mutex_lock(&pdata->lock);
353 ret = afu_dma_region_add(pdata, region);
354 mutex_unlock(&pdata->lock);
356 dev_err(&pdata->dev->dev, "failed to add dma region\n");
363 dma_unmap_page(dfl_fpga_pdata_to_parent(pdata),
366 afu_dma_unpin_pages(pdata, region);
374 * @pdata: feature device platform data
380 int afu_dma_unmap_region(struct dfl_feature_platform_data *pdata, u64 iova)
384 mutex_lock(&pdata->lock);
385 region = afu_dma_region_find_iova(pdata, iova);
387 mutex_unlock(&pdata->lock);
392 mutex_unlock(&pdata->lock);
396 afu_dma_region_remove(pdata, region);
397 mutex_unlock(&pdata->lock);
399 dma_unmap_page(dfl_fpga_pdata_to_parent(pdata),
401 afu_dma_unpin_pages(pdata, region);