[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210502195407.3packotroi5l5ie6@cosmicpenguin.net>
Date: Sun, 2 May 2021 13:54:07 -0600
From: Jordan Crouse <jordan@...micpenguin.net>
To: Jonathan Marek <jonathan@...ek.ca>
Cc: freedreno@...ts.freedesktop.org, Rob Clark <robdclark@...il.com>,
Sean Paul <sean@...rly.run>, David Airlie <airlied@...ux.ie>,
Daniel Vetter <daniel@...ll.ch>,
"open list:DRM DRIVER FOR MSM ADRENO GPU"
<linux-arm-msm@...r.kernel.org>,
"open list:DRM DRIVER FOR MSM ADRENO GPU"
<dri-devel@...ts.freedesktop.org>,
open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 3/5] drm/msm: use the right pgprot when mapping BOs in
the kernel
On Fri, Apr 23, 2021 at 03:08:19PM -0400, Jonathan Marek wrote:
> Use the same logic as the userspace mapping.
>
> This fixes msm_rd with cached BOs.
>
Acked-by: Jordan Crouse <jordan@...micpenguin.net>
> Signed-off-by: Jonathan Marek <jonathan@...ek.ca>
> ---
> drivers/gpu/drm/msm/msm_gem.c | 19 +++++++++++--------
> 1 file changed, 11 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/msm_gem.c b/drivers/gpu/drm/msm/msm_gem.c
> index 09abda42d764..0f58937be0a9 100644
> --- a/drivers/gpu/drm/msm/msm_gem.c
> +++ b/drivers/gpu/drm/msm/msm_gem.c
> @@ -199,6 +199,15 @@ void msm_gem_put_pages(struct drm_gem_object *obj)
> /* when we start tracking the pin count, then do something here */
> }
>
> +static pgprot_t msm_gem_pgprot(struct msm_gem_object *msm_obj, pgprot_t prot)
> +{
> + if (msm_obj->flags & MSM_BO_WC)
> + return pgprot_writecombine(prot);
> + if (msm_obj->flags & MSM_BO_UNCACHED)
> + return pgprot_noncached(prot);
> + return prot;
> +}
> +
> int msm_gem_mmap_obj(struct drm_gem_object *obj,
> struct vm_area_struct *vma)
> {
> @@ -206,13 +215,7 @@ int msm_gem_mmap_obj(struct drm_gem_object *obj,
>
> vma->vm_flags &= ~VM_PFNMAP;
> vma->vm_flags |= VM_MIXEDMAP;
> -
> - if (msm_obj->flags & MSM_BO_WC)
> - vma->vm_page_prot = pgprot_writecombine(vm_get_page_prot(vma->vm_flags));
> - else if (msm_obj->flags & MSM_BO_UNCACHED)
> - vma->vm_page_prot = pgprot_noncached(vm_get_page_prot(vma->vm_flags));
> - else
> - vma->vm_page_prot = vm_get_page_prot(vma->vm_flags);
> + vma->vm_page_prot = msm_gem_pgprot(msm_obj, vm_get_page_prot(vma->vm_flags));
>
> return 0;
> }
> @@ -632,7 +635,7 @@ static void *get_vaddr(struct drm_gem_object *obj, unsigned madv)
> goto fail;
> }
> msm_obj->vaddr = vmap(pages, obj->size >> PAGE_SHIFT,
> - VM_MAP, pgprot_writecombine(PAGE_KERNEL));
> + VM_MAP, msm_gem_pgprot(msm_obj, PAGE_KERNEL));
> if (msm_obj->vaddr == NULL) {
> ret = -ENOMEM;
> goto fail;
> --
> 2.26.1
>
Powered by blists - more mailing lists