Last active
September 16, 2017 21:33
-
-
Save Miouyouyou/3dcf5009ebce350959d30ad572ac4d26 to your computer and use it in GitHub Desktop.
This freezes the machine pure and simple !
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Code */ | |
/* ... */ | |
void rk_iommu_flush_tlb(struct device *dev) { | |
struct rk_iommu *iommu = rk_iommu_from_dev(dev); | |
int i; | |
if (!iommu) | |
dev_err(dev, "Can't flush nothing !\n"); | |
else { | |
for (i = 0; i < iommu->num_mmu; i++) | |
rk_iommu_base_command(iommu->bases[i], RK_MMU_CMD_ZAP_CACHE); | |
} | |
} | |
EXPORT_SYMBOL(rk_iommu_flush_tlb); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static int vcodec_drm_map_iommu(struct vcodec_iommu_session_info *session_info, | |
int idx, | |
unsigned long *iova, | |
unsigned long *size) | |
{ | |
struct device *dev = session_info->dev; | |
struct vcodec_drm_buffer *drm_buffer; | |
/* Force to flush iommu table */ | |
if (of_machine_is_compatible("rockchip,rk3288")) | |
rk_iommu_flush_tlb(session_info->dev); | |
mutex_lock(&session_info->list_mutex); | |
drm_buffer = vcodec_drm_get_buffer_no_lock(session_info, idx); | |
dev_info(dev, | |
"( Myy ) vcodec_drm_get_buffer_no_lock(%p, %d) → %p", | |
session_info, idx, drm_buffer); | |
mutex_unlock(&session_info->list_mutex); | |
if (!drm_buffer) { | |
dev_err(dev, "can not find %d buffer in list\n", idx); | |
return -EINVAL; | |
} | |
kref_get(&drm_buffer->ref); | |
if (iova) | |
*iova = drm_buffer->iova; | |
if (size) | |
*size = drm_buffer->size; | |
return 0; | |
} | |
static int | |
vcodec_drm_unmap_iommu(struct vcodec_iommu_session_info *session_info, | |
int idx) | |
{ | |
struct device *dev = session_info->dev; | |
struct vcodec_drm_buffer *drm_buffer; | |
/* Force to flush iommu table */ | |
if (of_machine_is_compatible("rockchip,rk3288")) | |
rk_iommu_flush_tlb(session_info->dev); | |
mutex_lock(&session_info->list_mutex); | |
drm_buffer = vcodec_drm_get_buffer_no_lock(session_info, idx); | |
mutex_unlock(&session_info->list_mutex); | |
if (!drm_buffer) { | |
dev_err(dev, "can not find %d buffer in list\n", idx); | |
return -EINVAL; | |
} | |
kref_put(&drm_buffer->ref, vcodec_drm_clear_map); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment