Release 4.7 drivers/gpu/drm/exynos/exynos_drm_iommu.c
  
  
/* exynos_drm_iommu.c
 *
 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
 * Author: Inki Dae <inki.dae@samsung.com>
 *
 * This program is free software; you can redistribute  it and/or modify it
 * under  the terms of  the GNU General  Public License as published by the
 * Free Software Foundation;  either version 2 of the  License, or (at your
 * option) any later version.
 */
#include <drm/drmP.h>
#include <drm/exynos_drm.h>
#include <linux/dma-mapping.h>
#include <linux/iommu.h>
#include <linux/kref.h>
#include <asm/dma-iommu.h>
#include "exynos_drm_drv.h"
#include "exynos_drm_iommu.h"
/*
 * drm_create_iommu_mapping - create a mapping structure
 *
 * @drm_dev: DRM device
 */
int drm_create_iommu_mapping(struct drm_device *drm_dev)
{
	struct dma_iommu_mapping *mapping = NULL;
	struct exynos_drm_private *priv = drm_dev->dev_private;
	if (!priv->da_start)
		priv->da_start = EXYNOS_DEV_ADDR_START;
	if (!priv->da_space_size)
		priv->da_space_size = EXYNOS_DEV_ADDR_SIZE;
	mapping = arm_iommu_create_mapping(&platform_bus_type, priv->da_start,
						priv->da_space_size);
	if (IS_ERR(mapping))
		return PTR_ERR(mapping);
	priv->mapping = mapping;
	return 0;
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| inki dae | inki dae | 82 | 91.11% | 1 | 33.33% | 
| wei yongjun | wei yongjun | 7 | 7.78% | 1 | 33.33% | 
| marek szyprowski | marek szyprowski | 1 | 1.11% | 1 | 33.33% | 
 | Total | 90 | 100.00% | 3 | 100.00% | 
/*
 * drm_release_iommu_mapping - release iommu mapping structure
 *
 * @drm_dev: DRM device
 *
 * if mapping->kref becomes 0 then all things related to iommu mapping
 * will be released
 */
void drm_release_iommu_mapping(struct drm_device *drm_dev)
{
	struct exynos_drm_private *priv = drm_dev->dev_private;
	arm_iommu_release_mapping(priv->mapping);
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| inki dae | inki dae | 22 | 84.62% | 1 | 50.00% | 
| marek szyprowski | marek szyprowski | 4 | 15.38% | 1 | 50.00% | 
 | Total | 26 | 100.00% | 2 | 100.00% | 
/*
 * 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.
 */
int drm_iommu_attach_device(struct drm_device *drm_dev,
				struct device *subdrv_dev)
{
	struct exynos_drm_private *priv = drm_dev->dev_private;
	int ret;
	if (!priv->mapping)
		return 0;
	subdrv_dev->dma_parms = devm_kzalloc(subdrv_dev,
					sizeof(*subdrv_dev->dma_parms),
					GFP_KERNEL);
	if (!subdrv_dev->dma_parms)
		return -ENOMEM;
	dma_set_max_seg_size(subdrv_dev, 0xffffffffu);
	if (subdrv_dev->archdata.mapping)
		arm_iommu_detach_device(subdrv_dev);
	ret = arm_iommu_attach_device(subdrv_dev, priv->mapping);
	if (ret < 0) {
		DRM_DEBUG_KMS("failed iommu attach.\n");
		return ret;
	}
	return 0;
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| inki dae | inki dae | 87 | 74.36% | 1 | 20.00% | 
| marek szyprowski | marek szyprowski | 18 | 15.38% | 2 | 40.00% | 
| sachin kamat | sachin kamat | 11 | 9.40% | 1 | 20.00% | 
| joonyoung shim | joonyoung shim | 1 | 0.85% | 1 | 20.00% | 
 | Total | 117 | 100.00% | 5 | 100.00% | 
/*
 * 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
 */
void drm_iommu_detach_device(struct drm_device *drm_dev,
				struct device *subdrv_dev)
{
	struct exynos_drm_private *priv = drm_dev->dev_private;
	struct dma_iommu_mapping *mapping = priv->mapping;
	if (!mapping || !mapping->domain)
		return;
	arm_iommu_detach_device(subdrv_dev);
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| inki dae | inki dae | 44 | 89.80% | 1 | 33.33% | 
| marek szyprowski | marek szyprowski | 4 | 8.16% | 1 | 33.33% | 
| joonyoung shim | joonyoung shim | 1 | 2.04% | 1 | 33.33% | 
 | Total | 49 | 100.00% | 3 | 100.00% | 
Overall Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| inki dae | inki dae | 263 | 84.57% | 2 | 22.22% | 
| marek szyprowski | marek szyprowski | 27 | 8.68% | 2 | 22.22% | 
| sachin kamat | sachin kamat | 11 | 3.54% | 1 | 11.11% | 
| wei yongjun | wei yongjun | 7 | 2.25% | 1 | 11.11% | 
| joonyoung shim | joonyoung shim | 2 | 0.64% | 2 | 22.22% | 
| andrzej hajda | andrzej hajda | 1 | 0.32% | 1 | 11.11% | 
 | Total | 311 | 100.00% | 9 | 100.00% | 
  
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.