From cf4009a541b677e66e6c53496fd52a9717dda652 Mon Sep 17 00:00:00 2001 From: zsq Date: Thu, 12 Apr 2012 07:47:06 +0000 Subject: [PATCH] try to fix rga flush timeout reset bug --- drivers/video/rockchip/rga/rga_drv.c | 15 ++++++++----- drivers/video/rockchip/rga/rga_mmu_info.c | 26 ++++++++++++++--------- 2 files changed, 26 insertions(+), 15 deletions(-) diff --git a/drivers/video/rockchip/rga/rga_drv.c b/drivers/video/rockchip/rga/rga_drv.c index 1cfc565bac01..c54255efae52 100755 --- a/drivers/video/rockchip/rga/rga_drv.c +++ b/drivers/video/rockchip/rga/rga_drv.c @@ -96,6 +96,8 @@ static struct clk *hclk_rga; static int rga_blit_async(rga_session *session, struct rga_req *req); static void rga_del_running_list(void); +static void rga_try_set_reg(uint32_t num); + /* Logging */ @@ -263,11 +265,14 @@ static int rga_flush(rga_session *session, unsigned long arg) if (unlikely(ret_timeout < 0)) { pr_err("flush pid %d wait task ret %d\n", session->pid, ret); rga_soft_reset(); + rga_del_running_list(); ret = -ETIMEDOUT; } else if (0 == ret_timeout) { pr_err("flush pid %d wait %d task done timeout\n", session->pid, atomic_read(&session->task_running)); printk("bus = %.8x\n", rga_read(RGA_INT)); rga_soft_reset(); + rga_del_running_list(); + rga_try_set_reg(1); ret = -ETIMEDOUT; } @@ -345,6 +350,7 @@ static void rga_copy_reg(struct rga_reg *reg, uint32_t offset) atomic_add(1, &rga_service.cmd_num); atomic_add(1, ®->session->task_running); + atomic_add(1, &rga_service.total_running); cmd_buf = (uint32_t *)rga_service.cmd_buff + offset*28; reg_p = (uint32_t *)reg->cmd_reg; @@ -573,10 +579,7 @@ static void rga_try_set_reg(uint32_t num) /* Start proc */ atomic_set(®->session->done, 0); rga_write(0x1, RGA_CMD_CTRL); - - atomic_add(1, &rga_service.total_running); - atomic_add(1, ®->session->task_running); - + #if RGA_TEST { uint32_t i; @@ -765,12 +768,15 @@ static int rga_blit_sync(rga_session *session, struct rga_req *req) { pr_err("sync pid %d wait task ret %d\n", session->pid, ret_timeout); rga_soft_reset(); + rga_del_running_list(); ret = -ETIMEDOUT; } else if (0 == ret_timeout) { pr_err("sync pid %d wait %d task done timeout\n", session->pid, atomic_read(&session->task_running)); rga_soft_reset(); + rga_del_running_list(); + rga_try_set_reg(1); ret = -ETIMEDOUT; } @@ -1175,7 +1181,6 @@ static int __init rga_init(void) } //rga_test_0(); - //rga_test_1(); INFO("Module initialized.\n"); diff --git a/drivers/video/rockchip/rga/rga_mmu_info.c b/drivers/video/rockchip/rga/rga_mmu_info.c index c9e676397705..e41c3dc41dde 100755 --- a/drivers/video/rockchip/rga/rga_mmu_info.c +++ b/drivers/video/rockchip/rga/rga_mmu_info.c @@ -220,7 +220,6 @@ static int rga_MapUserMemory(struct page **pages, uint32_t i; uint32_t status; uint32_t Address; - uint32_t t_mem; status = 0; Address = 0; @@ -243,10 +242,8 @@ static int rga_MapUserMemory(struct page **pages, struct vm_area_struct *vma; for(i=0; imm, t_mem); + { + vma = find_vma(current->mm, (Memory + i) << PAGE_SHIFT); if (vma && (vma->vm_flags & VM_PFNMAP) ) { @@ -255,15 +252,24 @@ static int rga_MapUserMemory(struct page **pages, pte_t * pte; spinlock_t * ptl; unsigned long pfn; + pgd_t * pgd; + pud_t * pud; + + pgd = pgd_offset(current->mm, (Memory + i) << PAGE_SHIFT); - pgd_t * pgd = pgd_offset(current->mm, t_mem); - pud_t * pud = pud_offset(pgd, t_mem); + if(pgd_val(*pgd) == 0) + { + printk("pgd value is zero \n"); + break; + } + + pud = pud_offset(pgd, (Memory + i) << PAGE_SHIFT); if (pud) { - pmd_t * pmd = pmd_offset(pud, t_mem); + pmd_t * pmd = pmd_offset(pud, (Memory + i) << PAGE_SHIFT); if (pmd) { - pte = pte_offset_map_lock(current->mm, pmd, t_mem, &ptl); + pte = pte_offset_map_lock(current->mm, pmd, (Memory + i) << PAGE_SHIFT, &ptl); if (!pte) { break; @@ -280,7 +286,7 @@ static int rga_MapUserMemory(struct page **pages, } pfn = pte_pfn(*pte); - Address = ((pfn << PAGE_SHIFT) | (((unsigned long)t_mem) & ~PAGE_MASK)); + Address = ((pfn << PAGE_SHIFT) | (((unsigned long)((Memory + i) << PAGE_SHIFT)) & ~PAGE_MASK)); pte_unmap_unlock(pte, ptl); } while (0); -- 2.34.1