From 55740184333a1a0d93915d2279ecfcb61739abba Mon Sep 17 00:00:00 2001 From: Marek Szyprowski Date: Mon, 5 Mar 2018 15:55:25 +0100 Subject: [PATCH] LOCAL / GPU: ARM: Update MALI MIDGARD driver to v4.14 kernel base Signed-off-by: Marek Szyprowski --- .../gpu/arm/midgard/r12p0_04rel0/mali_kbase_jd.c | 2 +- .../gpu/arm/midgard/r12p0_04rel0/mali_kbase_mem.c | 6 ++-- .../midgard/r12p0_04rel0/mali_kbase_mem_linux.c | 33 ++++------------------ .../arm/midgard/r12p0_04rel0/mali_kbase_softjobs.c | 2 +- 4 files changed, 10 insertions(+), 33 deletions(-) diff --git a/drivers/gpu/arm/midgard/r12p0_04rel0/mali_kbase_jd.c b/drivers/gpu/arm/midgard/r12p0_04rel0/mali_kbase_jd.c index 0ffd8be..25510aa 100644 --- a/drivers/gpu/arm/midgard/r12p0_04rel0/mali_kbase_jd.c +++ b/drivers/gpu/arm/midgard/r12p0_04rel0/mali_kbase_jd.c @@ -863,7 +863,7 @@ bool jd_submit_atom(struct kbase_context *kctx, core_req = user_atom->core_req; - katom->start_timestamp.tv64 = 0; + katom->start_timestamp = 0; katom->time_spent_us = 0; katom->udata = user_atom->udata; katom->kctx = kctx; diff --git a/drivers/gpu/arm/midgard/r12p0_04rel0/mali_kbase_mem.c b/drivers/gpu/arm/midgard/r12p0_04rel0/mali_kbase_mem.c index 88dbdc0..ead3926 100644 --- a/drivers/gpu/arm/midgard/r12p0_04rel0/mali_kbase_mem.c +++ b/drivers/gpu/arm/midgard/r12p0_04rel0/mali_kbase_mem.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include @@ -2069,11 +2070,10 @@ static int kbase_jd_user_buf_map(struct kbase_context *kctx, pages = alloc->imported.user_buf.pages; - pinned_pages = get_user_pages(NULL, mm, - address, + pinned_pages = get_user_pages(address, alloc->imported.user_buf.nr_pages, reg->flags & KBASE_REG_GPU_WR, - 0, pages, NULL); + pages, NULL); if (pinned_pages <= 0) return pinned_pages; diff --git a/drivers/gpu/arm/midgard/r12p0_04rel0/mali_kbase_mem_linux.c b/drivers/gpu/arm/midgard/r12p0_04rel0/mali_kbase_mem_linux.c index 0fb570c..79b23e1 100644 --- a/drivers/gpu/arm/midgard/r12p0_04rel0/mali_kbase_mem_linux.c +++ b/drivers/gpu/arm/midgard/r12p0_04rel0/mali_kbase_mem_linux.c @@ -30,9 +30,6 @@ #include #include #include -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 5, 0)) - #include -#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 5, 0) */ #ifdef CONFIG_DMA_SHARED_BUFFER #include #endif /* defined(CONFIG_DMA_SHARED_BUFFER) */ @@ -1184,8 +1181,8 @@ static struct kbase_va_region *kbase_mem_from_user_buffer( /* We can't really store the page list because that would involve */ /* keeping the pages pinned - instead we pin/unpin around the job */ /* (as part of the external resources handling code) */ - faulted_pages = get_user_pages(current, current->mm, address, *va_pages, - reg->flags & KBASE_REG_GPU_WR, 0, NULL, NULL); + faulted_pages = get_user_pages(address, *va_pages, + reg->flags & KBASE_REG_GPU_WR, NULL, NULL); up_read(¤t->mm->mmap_sem); if (faulted_pages != *va_pages) @@ -1847,8 +1844,9 @@ static void kbase_cpu_vm_close(struct vm_area_struct *vma) KBASE_EXPORT_TEST_API(kbase_cpu_vm_close); -static int kbase_cpu_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf) +static int kbase_cpu_vm_fault(struct vm_fault *vmf) { + struct vm_area_struct *vma = vmf->vma; struct kbase_cpu_mapping *map = vma->vm_private_data; pgoff_t rel_pgoff; size_t i; @@ -1860,7 +1858,7 @@ static int kbase_cpu_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf) /* we don't use vmf->pgoff as it's affected by our mmap with * offset being a GPU VA or a cookie */ - rel_pgoff = ((unsigned long)vmf->virtual_address - map->vm_start) + rel_pgoff = ((unsigned long)vmf->address - map->vm_start) >> PAGE_SHIFT; kbase_gpu_vm_lock(map->kctx); @@ -2707,9 +2705,6 @@ void *kbase_va_alloc(struct kbase_context *kctx, u32 size, struct kbase_hwc_dma_ dma_addr_t dma_pa; struct kbase_va_region *reg; phys_addr_t *page_array; -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 5, 0)) - DEFINE_DMA_ATTRS(attrs); -#endif u32 pages = ((size - 1) >> PAGE_SHIFT) + 1; u32 flags = BASE_MEM_PROT_CPU_RD | BASE_MEM_PROT_CPU_WR | @@ -2723,12 +2718,7 @@ void *kbase_va_alloc(struct kbase_context *kctx, u32 size, struct kbase_hwc_dma_ goto err; /* All the alloc calls return zeroed memory */ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 5, 0)) - dma_set_attr(DMA_ATTR_WRITE_COMBINE, &attrs); - va = dma_alloc_attrs(kctx->kbdev->dev, size, &dma_pa, GFP_KERNEL, &attrs); -#else va = dma_alloc_writecombine(kctx->kbdev->dev, size, &dma_pa, GFP_KERNEL); -#endif if (!va) goto err; @@ -2772,11 +2762,7 @@ no_mmap: no_alloc: kfree(reg); no_reg: -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 5, 0)) - dma_free_attrs(kctx->kbdev->dev, size, va, dma_pa, &attrs); -#else dma_free_writecombine(kctx->kbdev->dev, size, va, dma_pa); -#endif err: return NULL; } @@ -2786,9 +2772,6 @@ void kbase_va_free(struct kbase_context *kctx, struct kbase_hwc_dma_mapping *han { struct kbase_va_region *reg; int err; -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 5, 0)) - DEFINE_DMA_ATTRS(attrs); -#endif KBASE_DEBUG_ASSERT(kctx != NULL); KBASE_DEBUG_ASSERT(handle->cpu_va != NULL); @@ -2804,14 +2787,8 @@ void kbase_va_free(struct kbase_context *kctx, struct kbase_hwc_dma_mapping *han kbase_mem_phy_alloc_put(reg->gpu_alloc); kfree(reg); -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 5, 0)) - dma_set_attr(DMA_ATTR_WRITE_COMBINE, &attrs); - dma_free_attrs(kctx->kbdev->dev, handle->size, - handle->cpu_va, handle->dma_pa, &attrs); -#else dma_free_writecombine(kctx->kbdev->dev, handle->size, handle->cpu_va, handle->dma_pa); -#endif } KBASE_EXPORT_SYMBOL(kbase_va_free); diff --git a/drivers/gpu/arm/midgard/r12p0_04rel0/mali_kbase_softjobs.c b/drivers/gpu/arm/midgard/r12p0_04rel0/mali_kbase_softjobs.c index 97ad5e7..fbe0fca 100644 --- a/drivers/gpu/arm/midgard/r12p0_04rel0/mali_kbase_softjobs.c +++ b/drivers/gpu/arm/midgard/r12p0_04rel0/mali_kbase_softjobs.c @@ -481,7 +481,7 @@ static int kbasep_soft_event_wait(struct kbase_jd_atom *katom) /* Schedule cancellation of this atom after a period if it is * not active */ remaining = hrtimer_get_remaining(&kctx->soft_event_timeout); - if (remaining.tv64 <= 0) { + if (remaining <= 0) { int timeout_ms = atomic_read( &kctx->kbdev->js_data.soft_event_timeout_ms); hrtimer_start(&kctx->soft_event_timeout, -- 2.7.4