From: =?UTF-8?B?Q2hyaXN0aWFuIEvDtm5pZw==?= Subject: Re: [PATCH] drm/radeon: set VM base addr using the PFP v2 Date: Wed, 30 Jul 2014 20:15:50 +0200 Message-ID: <53D93656.2030504@vodafone.de> References: <1406733492-9996-1-git-send-email-deathsimple@vodafone.de> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0881973426==" Return-path: Received: from pegasos-out.vodafone.de (pegasos-out.vodafone.de [80.84.1.38]) by gabe.freedesktop.org (Postfix) with ESMTP id 9FD1089EB1 for ; Wed, 30 Jul 2014 11:16:28 -0700 (PDT) Received: from localhost (localhost.localdomain [127.0.0.1]) by pegasos-out.vodafone.de (Rohrpostix1 Daemon) with ESMTP id B4D10260C89 for ; Wed, 30 Jul 2014 20:16:26 +0200 (CEST) Received: from pegasos-out.vodafone.de ([127.0.0.1]) by localhost (rohrpostix1.prod.vfnet.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id JcGk8PFhpdp9 for ; Wed, 30 Jul 2014 20:16:04 +0200 (CEST) In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" To: Jerome Glisse , Alex Deucher Cc: Maling list - DRI developers List-Id: dri-devel@lists.freedesktop.org This is a multi-part message in MIME format. --===============0881973426== Content-Type: multipart/alternative; boundary="------------080201080604000600070401" This is a multi-part message in MIME format. --------------080201080604000600070401 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Am 30.07.2014 um 19:24 schrieb Jerome Glisse: > On Wed, Jul 30, 2014 at 11:54 AM, Alex Deucher > wrote: > > On Wed, Jul 30, 2014 at 11:18 AM, Christian K=C3=B6nig > > wrote: > > From: Christian K=C3=B6nig > > > > > Seems to make VM flushes more stable on SI and CIK. > > > > v2: only use the PFP on the GFX ring on CIK > > > > Signed-off-by: Christian K=C3=B6nig > > > Cc: stable@vger.kernel.org > > Applied to my 3.17 tree. We should use PFP whenever possible for > all packets. > > > Can all this be explained with more words ? What are the choice ? What=20 > are the difference ? What we gain ? The PFP is responsible of fetching the data the CP executes from memory,=20 classify them and if necessary forward them to the ME. The ME is the=20 part where normally all the juicy stuff happens, e.g. register writes,=20 most type3 packet execution etc... What we did before was setting the VM base address with the ME instead=20 of the PFP, but since the PFP needs to fetch the IB data we inserted an=20 "Wait for ME" packet into the command stream to let the ME catch up to=20 the PFP before proceeding. The problem is that this is sometimes not enough, e.g. on CIK it could=20 happen that the IB read goes out while the the page table base address=20 wasn't updated yet with the obviously bad consequences. Compute rings don't have a PFP on CIK so this won't work there. Regards, Christian. > > Alex > > > --- > > drivers/gpu/drm/radeon/cik.c | 5 +++-- > > drivers/gpu/drm/radeon/si.c | 2 +- > > 2 files changed, 4 insertions(+), 3 deletions(-) > > > > diff --git a/drivers/gpu/drm/radeon/cik.c > b/drivers/gpu/drm/radeon/cik.c > > index cc1f02f..db53616 100644 > > --- a/drivers/gpu/drm/radeon/cik.c > > +++ b/drivers/gpu/drm/radeon/cik.c > > @@ -5641,12 +5641,13 @@ static void cik_vm_decode_fault(struct > radeon_device *rdev, > > void cik_vm_flush(struct radeon_device *rdev, int ridx, struct > radeon_vm *vm) > > { > > struct radeon_ring *ring =3D &rdev->ring[ridx]; > > + int usepfp =3D (ridx =3D=3D RADEON_RING_TYPE_GFX_INDEX); > > > > if (vm =3D=3D NULL) > > return; > > > > radeon_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3)); > > - radeon_ring_write(ring, (WRITE_DATA_ENGINE_SEL(0) | > > + radeon_ring_write(ring, (WRITE_DATA_ENGINE_SEL(usepfp) | > > WRITE_DATA_DST_SEL(0))); > > if (vm->id < 8) { > > radeon_ring_write(ring, > > @@ -5696,7 +5697,7 @@ void cik_vm_flush(struct radeon_device > *rdev, int ridx, struct radeon_vm *vm) > > radeon_ring_write(ring, 1 << vm->id); > > > > /* compute doesn't have PFP */ > > - if (ridx =3D=3D RADEON_RING_TYPE_GFX_INDEX) { > > + if (usepfp) { > > /* sync PFP to ME, otherwise we might get > invalid PFP reads */ > > radeon_ring_write(ring, > PACKET3(PACKET3_PFP_SYNC_ME, 0)); > > radeon_ring_write(ring, 0x0); > > diff --git a/drivers/gpu/drm/radeon/si.c > b/drivers/gpu/drm/radeon/si.c > > index 9e854fd..f87d82a 100644 > > --- a/drivers/gpu/drm/radeon/si.c > > +++ b/drivers/gpu/drm/radeon/si.c > > @@ -4815,7 +4815,7 @@ void si_vm_flush(struct radeon_device > *rdev, int ridx, struct radeon_vm *vm) > > > > /* write new base address */ > > radeon_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3)); > > - radeon_ring_write(ring, (WRITE_DATA_ENGINE_SEL(0) | > > + radeon_ring_write(ring, (WRITE_DATA_ENGINE_SEL(1) | > > WRITE_DATA_DST_SEL(0))); > > > > if (vm->id < 8) { > > -- > > 1.9.1 > > > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > > http://lists.freedesktop.org/mailman/listinfo/dri-devel > > --------------080201080604000600070401 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
Am 30.07.2014 um 19:24 schrieb Jerome Glisse:
On Wed, Jul 30, 2014 at 11:54 AM, Alex Deucher <a= lexdeucher@gmail.com> wrote:
On Wed, Jul 30, 2014 at 11:18 AM, Christian K=C3=B6nig
<deathsimple@vod= afone.de> wrote:
> From: Christian K=C3=B6nig <christian.koen= ig@amd.com>
>
> Seems to make VM flushes more stable on SI and CIK.<= br> >
> v2: only use the PFP on the GFX ring on CIK
>
> Signed-off-by: Christian K=C3=B6nig <christian.koen= ig@amd.com>
> Cc: stable@vger.kern= el.org

Applied to my 3.17 tree. =C2=A0We should use PFP whenever possible for all packets.

Can all this be explained with more words ? What are the choice ? What are the difference ? What we gain ?

The PFP is responsible of fetching the data the CP executes from memory, classify them and if necessary forward them to the ME. The ME is the part where normally all the juicy stuff happens, e.g. register writes, most type3 packet execution etc...

What we did before was setting the VM base address with the ME instead of the PFP, but since the PFP needs to fetch the IB data we inserted an "Wait for ME" packet into the command stream to let the ME catch up to the PFP before proceeding.

The problem is that this is sometimes not enough, e.g. on CIK it could happen that the IB read goes out while the the page table base address wasn't updated yet with the obviously bad consequences.

Compute rings don't have a PFP on CIK so this won't work there.

Regards,
Christian.

=C2=A0

Alex

> ---
> =C2=A0drivers/gpu/drm/radeon/cik.c | 5 +++--
> =C2=A0drivers/gpu/drm/radeon/si.c =C2=A0| 2 +-
> =C2=A02 files changed, 4 insertions(+), 3 deletion= s(-)
>
> diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c
> index cc1f02f..db53616 100644
> --- a/drivers/gpu/drm/radeon/cik.c
> +++ b/drivers/gpu/drm/radeon/cik.c
> @@ -5641,12 +5641,13 @@ static void cik_vm_decode_fault(struct radeon_device *rdev,
> =C2=A0void cik_vm_flush(struct radeon_device *rdev= , int ridx, struct radeon_vm *vm)
> =C2=A0{
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 struct radeon_ring *ri= ng =3D &rdev->ring[ridx];
> + =C2=A0 =C2=A0 =C2=A0 int usepfp =3D (ridx =3D=3D RADEON_RING_TYPE_GFX_INDEX);
>
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (vm =3D=3D NULL) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 return;
>
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 radeon_ring_write(ring= , PACKET3(PACKET3_WRITE_DATA, 3));
> - =C2=A0 =C2=A0 =C2=A0 radeon_ring_write(ring, (WRITE_DATA_ENGINE_SEL(0) |
> + =C2=A0 =C2=A0 =C2=A0 radeon_ring_write(ring, (WRITE_DATA_ENGINE_SEL(usepfp) |
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0WRITE_DATA_DST_SEL(0)));
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (vm->id < 8) = {
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 radeon_ring_write(ring,
> @@ -5696,7 +5697,7 @@ void cik_vm_flush(struct radeon_device *rdev, int ridx, struct radeon_vm *vm) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 radeon_ring_write(ring= , 1 << vm->id);
>
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 /* compute doesn't hav= e PFP */
> - =C2=A0 =C2=A0 =C2=A0 if (ridx =3D=3D RADEON_RING= _TYPE_GFX_INDEX) {
> + =C2=A0 =C2=A0 =C2=A0 if (usepfp) {
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 /* sync PFP to ME, otherwise we might get invalid PFP reads */
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 radeon_ring_write(ring, PACKET3(PACKET3_PFP_SYNC_ME, 0));
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 radeon_ring_write(ring, 0x0);
> diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c
> index 9e854fd..f87d82a 100644
> --- a/drivers/gpu/drm/radeon/si.c
> +++ b/drivers/gpu/drm/radeon/si.c
> @@ -4815,7 +4815,7 @@ void si_vm_flush(struct radeon_device *rdev, int ridx, struct radeon_vm *vm) >
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 /* write new base addr= ess */
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 radeon_ring_write(ring= , PACKET3(PACKET3_WRITE_DATA, 3));
> - =C2=A0 =C2=A0 =C2=A0 radeon_ring_write(ring, (WRITE_DATA_ENGINE_SEL(0) |
> + =C2=A0 =C2=A0 =C2=A0 radeon_ring_write(ring, (WRITE_DATA_ENGINE_SEL(1) |
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0WRITE_DATA_DST_SEL(0)));
>
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (vm->id < 8) = {
> --
> 1.9.1
>
_______________________________________________
dri-devel mailing list
dri-d= evel@lists.freedesktop.org
http://lists.freedesktop.org/mailma= n/listinfo/dri-devel


--------------080201080604000600070401-- --===============0881973426== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel --===============0881973426==--