/* * drm_iommu_attach_device- attach device to iommu mapping * * @drm_dev: DRM device * @subdrv_dev: device to be attach * * This function should be called by sub drivers to attach it to iommu * mapping.
*/ staticint drm_iommu_attach_device(struct drm_device *drm_dev, struct device *subdrv_dev, void **dma_priv)
{ struct exynos_drm_private *priv = drm_dev->dev_private; int ret = 0;
if (get_dma_ops(priv->dma_dev) != get_dma_ops(subdrv_dev)) {
DRM_DEV_ERROR(subdrv_dev, "Device %s lacks support for IOMMU\n",
dev_name(subdrv_dev)); return -EINVAL;
}
dma_set_max_seg_size(subdrv_dev, DMA_BIT_MASK(32)); if (IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU)) { /* * Keep the original DMA mapping of the sub-device and * restore it on Exynos DRM detach, otherwise the DMA * framework considers it as IOMMU-less during the next * probe (in case of deferred probe or modular build)
*/
*dma_priv = to_dma_iommu_mapping(subdrv_dev); if (*dma_priv)
arm_iommu_detach_device(subdrv_dev);
ret = arm_iommu_attach_device(subdrv_dev, priv->mapping);
} elseif (IS_ENABLED(CONFIG_IOMMU_DMA)) {
ret = iommu_attach_device(priv->mapping, subdrv_dev);
}
return ret;
}
/* * drm_iommu_detach_device -detach device address space mapping from device * * @drm_dev: DRM device * @subdrv_dev: device to be detached * * This function should be called by sub drivers to detach it from iommu * mapping
*/ staticvoid drm_iommu_detach_device(struct drm_device *drm_dev, struct device *subdrv_dev, void **dma_priv)
{ struct exynos_drm_private *priv = drm_dev->dev_private;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.