Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp2142971pxy; Sun, 2 May 2021 12:55:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzbtPPF/ydjh+HoQPNoo5KW9fnO4PzPXFR4TwOPmqZyizM6pHA0jXR+whRvuk/2YmnXfjIZ X-Received: by 2002:a05:6a00:1a8e:b029:272:546c:f710 with SMTP id e14-20020a056a001a8eb0290272546cf710mr15573683pfv.38.1619985316680; Sun, 02 May 2021 12:55:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619985316; cv=none; d=google.com; s=arc-20160816; b=YOmfwnnCpmZvpXExXQoEJalF9tonFJs1kxnM6E0zmt7oHyne1aq1RCnsQksVyw4Vv5 +mAy2KUmyZR6NrtQH+rC1KWEo1a+wg7ew3Vef5WCAxaOqXi3nH806E7LU99c/PGyxr/D 3OnpOZc+xAAlDsotYpK61XcAkU0l4ZnLYqUDHbU/+i69j7w8A1oN0rjtf/CBT/hZ1iGi UEmTh36yEqmR2+J9dkTa4l1qgPMoQr+A1tkqDVYm96oqQuscusly+ls/x9ijF14u/5YV INWwl44O7qBSqU8/wuugjVdeEIhlG+Eeb2wsi/LyIfRuavMfYVTyim+CoVoyCFnfrWJd XfSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:mail-followup-to:message-id:subject:cc:to:from:date :dkim-signature; bh=1VGpYy/1zWV/NQYSTMPSWihj0KmJxGbDNurHwTwE9HM=; b=iGlX5W8GU0srjxq7RY65xrogYlKLTHqERNbRG3R/6OGD5kxaOdZXnHYnGWiBZbWnh5 Por0T9mGvG8KMJ8ZlY2jKEoAv64qrpCi1BQUagRE1dQwu3K7+XMxP5dhJuQXPWT4BQjt cSwuBI/uULfYN7ya0USa2uiqsx962JpMaPNnn3g9vPcnfxxPkhtgUjrt/ofBE5RbS/JP OxPBWZvVkJbp1v6x4ZFwwxO89FyNA00d/abRk/5DwVdC1WxAvOPMPwg9dCfrCBKZrY94 8rm0shrobALTrrA8zuL1HTwDvWNi2P7HYvBHyXgknAKiA9DlQdvjGaZlVTilyRXG6fA/ YFlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cosmicpenguin-net.20150623.gappssmtp.com header.s=20150623 header.b=sAOdmZ7T; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e23si11783498pgl.20.2021.05.02.12.55.04; Sun, 02 May 2021 12:55:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@cosmicpenguin-net.20150623.gappssmtp.com header.s=20150623 header.b=sAOdmZ7T; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232392AbhEBTzD (ORCPT + 99 others); Sun, 2 May 2021 15:55:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231909AbhEBTzC (ORCPT ); Sun, 2 May 2021 15:55:02 -0400 Received: from mail-io1-xd2a.google.com (mail-io1-xd2a.google.com [IPv6:2607:f8b0:4864:20::d2a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2FAF8C06138B for ; Sun, 2 May 2021 12:54:10 -0700 (PDT) Received: by mail-io1-xd2a.google.com with SMTP id n10so131562ion.8 for ; Sun, 02 May 2021 12:54:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cosmicpenguin-net.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to; bh=1VGpYy/1zWV/NQYSTMPSWihj0KmJxGbDNurHwTwE9HM=; b=sAOdmZ7Tj6Yp46aAAgLBOcpyjoiQEzJ9bopaYE6PHeS+brnLFPq8BqP7sdPmsj5TEw TXDGHj92816H3Lym7ZWSfC5q47Mxmdej0df/PGvWbjg4liWZTSKmYqB/W2akMywyHty9 FEgyEbJpZJmUBhWU8Gj0WaacVbx0gAHSi5+3W9uoAOu5M+oxgESk3wtK8KyDHOFn+dwf wrbm9YVPkxq2C5nbicmECMNEuBgGyke9RztfMIn6TNReCSDowu3oM4i5iOFSw+jGYVRL Ih5LhF08XqfqrsHllvytKkAX1f7oMEyroLyhPzrEzU3TULXWhCX0ORxgrVWcUCJ0bfkL ytWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to; bh=1VGpYy/1zWV/NQYSTMPSWihj0KmJxGbDNurHwTwE9HM=; b=oZVc93A/B/gtIUjrhhfxZC+r35p7xOKklEK8hdLKYWmesD80u9RSq0aZSWN7OMdXrJ 827D2b14Tc7UhXA25K/xwKyYGrBDDL+jDRYUjijhhUpOMrEgkYI7iW+f7aTSckjscqew jd+mCSdmxmBgZgfE1Oqe7AXecyYnUFwnMRK08jKhKcwMFxGTRolLPL2inZomFbNYb4qV 2QSj8jglBbZMaS4Br9Bwv4K3GK4crC12NxYiTFFohc5v1gQ9RU46BN5mj5wkenibMV0o q7p/lGXpH/k45jJ+KwS2IqAk9j8uG+Vfd+jTdp4BgwwUn4tJfBPdNBg/5BD+6tsRRnvI 1Z6Q== X-Gm-Message-State: AOAM531L1eMMFxnqAve6MjDpEU9qzdpXfZ2iBf2A5uyCOmPYGO6X2UzD iIqholUapW7S8BfkJTi/cX8oNA== X-Received: by 2002:a5e:aa1a:: with SMTP id s26mr11533614ioe.95.1619985249561; Sun, 02 May 2021 12:54:09 -0700 (PDT) Received: from cosmicpenguin.net (c-71-237-100-236.hsd1.co.comcast.net. [71.237.100.236]) by smtp.gmail.com with ESMTPSA id l7sm4479777ilh.49.2021.05.02.12.54.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 May 2021 12:54:09 -0700 (PDT) Date: Sun, 2 May 2021 13:54:07 -0600 From: Jordan Crouse To: Jonathan Marek Cc: freedreno@lists.freedesktop.org, Rob Clark , Sean Paul , David Airlie , Daniel Vetter , "open list:DRM DRIVER FOR MSM ADRENO GPU" , "open list:DRM DRIVER FOR MSM ADRENO GPU" , open list Subject: Re: [PATCH 3/5] drm/msm: use the right pgprot when mapping BOs in the kernel Message-ID: <20210502195407.3packotroi5l5ie6@cosmicpenguin.net> Mail-Followup-To: Jonathan Marek , freedreno@lists.freedesktop.org, Rob Clark , Sean Paul , David Airlie , Daniel Vetter , "open list:DRM DRIVER FOR MSM ADRENO GPU" , "open list:DRM DRIVER FOR MSM ADRENO GPU" , open list References: <20210423190833.25319-1-jonathan@marek.ca> <20210423190833.25319-4-jonathan@marek.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210423190833.25319-4-jonathan@marek.ca> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > Signed-off-by: Jonathan Marek > --- > 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 >