From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Deucher, Alexander" Subject: Re: [PATCH] drm/amdgpu: fix "mitigate workaround for i915" Date: Wed, 21 Mar 2018 13:58:04 +0000 Message-ID: References: <20180321130818.10130-1-christian.koenig@amd.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0702969817==" Return-path: In-Reply-To: <20180321130818.10130-1-christian.koenig-5C7GfCeVMHo@public.gmane.org> Content-Language: en-US List-Id: Discussion list for AMD gfx List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org Sender: "amd-gfx" To: =?iso-8859-1?Q?Christian_K=F6nig?= , "amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org" --===============0702969817== Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_BN6PR12MB18095C145FEF342B0B625E69F7AA0BN6PR12MB1809namp_" --_000_BN6PR12MB18095C145FEF342B0B625E69F7AA0BN6PR12MB1809namp_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Acked-by: Alex Deucher ________________________________ From: amd-gfx on behalf of Christia= n K=F6nig Sent: Wednesday, March 21, 2018 9:08:18 AM To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org Subject: [PATCH] drm/amdgpu: fix "mitigate workaround for i915" Mixed up exporter and importer here. E.g. while mapping the BO we need to check the importer not the exporter. Signed-off-by: Christian K=F6nig --- drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c b/drivers/gpu/drm/am= d/amdgpu/amdgpu_prime.c index 1c9991738477..4b584cb75bf4 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c @@ -132,6 +132,7 @@ static int amdgpu_gem_map_attach(struct dma_buf *dma_bu= f, { struct drm_gem_object *obj =3D dma_buf->priv; struct amdgpu_bo *bo =3D gem_to_amdgpu_bo(obj); + struct amdgpu_device *adev =3D amdgpu_ttm_adev(bo->tbo.bdev); long r; r =3D drm_gem_map_attach(dma_buf, target_dev, attach); @@ -143,7 +144,7 @@ static int amdgpu_gem_map_attach(struct dma_buf *dma_bu= f, goto error_detach; - if (dma_buf->ops !=3D &amdgpu_dmabuf_ops) { + if (attach->dev->driver !=3D adev->dev->driver) { /* * Wait for all shared fences to complete before we switch= to future * use of exclusive fence on this prime shared bo. @@ -162,7 +163,7 @@ static int amdgpu_gem_map_attach(struct dma_buf *dma_bu= f, if (r) goto error_unreserve; - if (dma_buf->ops !=3D &amdgpu_dmabuf_ops) + if (attach->dev->driver !=3D adev->dev->driver) bo->prime_shared_count++; error_unreserve: @@ -179,6 +180,7 @@ static void amdgpu_gem_map_detach(struct dma_buf *dma_b= uf, { struct drm_gem_object *obj =3D dma_buf->priv; struct amdgpu_bo *bo =3D gem_to_amdgpu_bo(obj); + struct amdgpu_device *adev =3D amdgpu_ttm_adev(bo->tbo.bdev); int ret =3D 0; ret =3D amdgpu_bo_reserve(bo, true); @@ -186,7 +188,7 @@ static void amdgpu_gem_map_detach(struct dma_buf *dma_b= uf, goto error; amdgpu_bo_unpin(bo); - if (dma_buf->ops !=3D &amdgpu_dmabuf_ops && bo->prime_shared_count) + if (attach->dev->driver !=3D adev->dev->driver && bo->prime_shared_= count) bo->prime_shared_count--; amdgpu_bo_unreserve(bo); -- 2.14.1 _______________________________________________ amd-gfx mailing list amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx amd-gfx Info Page - freedesktop.org lists.freedesktop.org Subscribing to amd-gfx: Subscribe to amd-gfx by filling out the following f= orm. Use of all freedesktop.org lists is subject to our Code of ... --_000_BN6PR12MB18095C145FEF342B0B625E69F7AA0BN6PR12MB1809namp_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable

Acked-by: Alex Deucher <alexa= nder.deucher-5C7GfCeVMHo@public.gmane.org>


From: amd-gfx <amd-gfx= -bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> on behalf of Christian K=F6nig <ckoen= ig.leichtzumerken-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Sent: Wednesday, March 21, 2018 9:08:18 AM
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: [PATCH] drm/amdgpu: fix "mitigate workaround for i915&= quot;
 
Mixed up exporter and importer here. E.g. while ma= pping the BO we need
to check the importer not the exporter.

Signed-off-by: Christian K=F6nig <christian.koenig-5C7GfCeVMHo@public.gmane.org>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c | 8 ++++= 3;---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c b/drivers/gpu/drm/am= d/amdgpu/amdgpu_prime.c
index 1c9991738477..4b584cb75bf4 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c
@@ -132,6 +132,7 @@ static int amdgpu_gem_map_attach(struct dma_buf *dm= a_buf,
 {
         struct drm_gem_object *obj= =3D dma_buf->priv;
         struct amdgpu_bo *bo =3D g= em_to_amdgpu_bo(obj);
+       struct amdgpu_device *adev =3D am= dgpu_ttm_adev(bo->tbo.bdev);
         long r;
 
         r =3D drm_gem_map_attach(d= ma_buf, target_dev, attach);
@@ -143,7 +144,7 @@ static int amdgpu_gem_map_attach(struct dma_buf *dm= a_buf,
            &nb= sp;    goto error_detach;
 
 
-       if (dma_buf->ops !=3D &amdgpu_= dmabuf_ops) {
+       if (attach->dev->driver != =3D adev->dev->driver) {
            &nb= sp;    /*
            &nb= sp;     * Wait for all shared fences to complete before= we switch to future
            &nb= sp;     * use of exclusive fence on this prime shared b= o.
@@ -162,7 +163,7 @@ static int amdgpu_gem_map_attach(struct dma_buf *dm= a_buf,
         if (r)
            &nb= sp;    goto error_unreserve;
 
-       if (dma_buf->ops !=3D &amdgpu_= dmabuf_ops)
+       if (attach->dev->driver != =3D adev->dev->driver)
            &nb= sp;    bo->prime_shared_count++;
 
 error_unreserve:
@@ -179,6 +180,7 @@ static void amdgpu_gem_map_detach(struct dma_buf *d= ma_buf,
 {
         struct drm_gem_object *obj= =3D dma_buf->priv;
         struct amdgpu_bo *bo =3D g= em_to_amdgpu_bo(obj);
+       struct amdgpu_device *adev =3D am= dgpu_ttm_adev(bo->tbo.bdev);
         int ret =3D 0;
 
         ret =3D amdgpu_bo_reserve(= bo, true);
@@ -186,7 +188,7 @@ static void amdgpu_gem_map_detach(struct dma_buf *d= ma_buf,
            &nb= sp;    goto error;
 
         amdgpu_bo_unpin(bo);
-       if (dma_buf->ops !=3D &amdgpu_= dmabuf_ops && bo->prime_shared_count)
+       if (attach->dev->driver != =3D adev->dev->driver && bo->prime_shared_count)
            &nb= sp;    bo->prime_shared_count--;
         amdgpu_bo_unreserve(bo);  
--
2.14.1

_______________________________________________
amd-gfx mailing list
amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
https://lists.freedesktop.org/mailman/li= stinfo/amd-gfx
lists.freedesktop.org
Subscribing to amd-gfx: Subscribe to amd-gfx by filling out the following f= orm. Use of all freedesktop.org lists is subject to our Code of ...

--_000_BN6PR12MB18095C145FEF342B0B625E69F7AA0BN6PR12MB1809namp_-- --===============0702969817== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KYW1kLWdmeCBt YWlsaW5nIGxpc3QKYW1kLWdmeEBsaXN0cy5mcmVlZGVza3RvcC5vcmcKaHR0cHM6Ly9saXN0cy5m cmVlZGVza3RvcC5vcmcvbWFpbG1hbi9saXN0aW5mby9hbWQtZ2Z4Cg== --===============0702969817==--