drm/lima: fix recovering from PLBU out of memory
diff mbox series

Message ID 20200215035026.3180698-1-anarsoul@gmail.com
State New
Headers show
Series
  • drm/lima: fix recovering from PLBU out of memory
Related show

Commit Message

Vasily Khoruzhick Feb. 15, 2020, 3:50 a.m. UTC
It looks like on PLBU_OUT_OF_MEM interrupt we need to resume from where we
stopped, i.e. new PLBU heap start is old end. Also update end address
in GP frame to grow heap on 2nd and subsequent out of memory interrupts.

Fixes: 2081e8dcf1ee ("drm/lima: recover task by enlarging heap buffer")
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
---
 drivers/gpu/drm/lima/lima_gp.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Qiang Yu Feb. 17, 2020, 1:20 a.m. UTC | #1
Looks good for me, patch is:
Reviewed-by: Qiang Yu <yuq825@gmail.com>

Regards,
Qiang

On Sat, Feb 15, 2020 at 11:50 AM Vasily Khoruzhick <anarsoul@gmail.com> wrote:
>
> It looks like on PLBU_OUT_OF_MEM interrupt we need to resume from where we
> stopped, i.e. new PLBU heap start is old end. Also update end address
> in GP frame to grow heap on 2nd and subsequent out of memory interrupts.
>
> Fixes: 2081e8dcf1ee ("drm/lima: recover task by enlarging heap buffer")
> Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
> ---
>  drivers/gpu/drm/lima/lima_gp.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/lima/lima_gp.c b/drivers/gpu/drm/lima/lima_gp.c
> index d1e7826c2d74..325604262def 100644
> --- a/drivers/gpu/drm/lima/lima_gp.c
> +++ b/drivers/gpu/drm/lima/lima_gp.c
> @@ -224,8 +224,13 @@ static int lima_gp_task_recover(struct lima_sched_pipe *pipe)
>         }
>
>         gp_write(LIMA_GP_INT_MASK, LIMA_GP_IRQ_MASK_USED);
> +       /* Resume from where we stopped, i.e. new start is old end */
> +       gp_write(LIMA_GP_PLBU_ALLOC_START_ADDR,
> +                f[LIMA_GP_PLBU_ALLOC_END_ADDR >> 2]);
> +       f[LIMA_GP_PLBU_ALLOC_END_ADDR >> 2] =
> +               f[LIMA_GP_PLBU_ALLOC_START_ADDR >> 2] + task->heap->heap_size;
>         gp_write(LIMA_GP_PLBU_ALLOC_END_ADDR,
> -                f[LIMA_GP_PLBU_ALLOC_START_ADDR >> 2] + task->heap->heap_size);
> +                f[LIMA_GP_PLBU_ALLOC_END_ADDR >> 2]);
>         gp_write(LIMA_GP_CMD, LIMA_GP_CMD_UPDATE_PLBU_ALLOC);
>         return 0;
>  }
> --
> 2.25.0
>
Qiang Yu Feb. 17, 2020, 3:06 a.m. UTC | #2
applied to drm-misc-next.

On Mon, Feb 17, 2020 at 9:20 AM Qiang Yu <yuq825@gmail.com> wrote:
>
> Looks good for me, patch is:
> Reviewed-by: Qiang Yu <yuq825@gmail.com>
>
> Regards,
> Qiang
>
> On Sat, Feb 15, 2020 at 11:50 AM Vasily Khoruzhick <anarsoul@gmail.com> wrote:
> >
> > It looks like on PLBU_OUT_OF_MEM interrupt we need to resume from where we
> > stopped, i.e. new PLBU heap start is old end. Also update end address
> > in GP frame to grow heap on 2nd and subsequent out of memory interrupts.
> >
> > Fixes: 2081e8dcf1ee ("drm/lima: recover task by enlarging heap buffer")
> > Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
> > ---
> >  drivers/gpu/drm/lima/lima_gp.c | 7 ++++++-
> >  1 file changed, 6 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/lima/lima_gp.c b/drivers/gpu/drm/lima/lima_gp.c
> > index d1e7826c2d74..325604262def 100644
> > --- a/drivers/gpu/drm/lima/lima_gp.c
> > +++ b/drivers/gpu/drm/lima/lima_gp.c
> > @@ -224,8 +224,13 @@ static int lima_gp_task_recover(struct lima_sched_pipe *pipe)
> >         }
> >
> >         gp_write(LIMA_GP_INT_MASK, LIMA_GP_IRQ_MASK_USED);
> > +       /* Resume from where we stopped, i.e. new start is old end */
> > +       gp_write(LIMA_GP_PLBU_ALLOC_START_ADDR,
> > +                f[LIMA_GP_PLBU_ALLOC_END_ADDR >> 2]);
> > +       f[LIMA_GP_PLBU_ALLOC_END_ADDR >> 2] =
> > +               f[LIMA_GP_PLBU_ALLOC_START_ADDR >> 2] + task->heap->heap_size;
> >         gp_write(LIMA_GP_PLBU_ALLOC_END_ADDR,
> > -                f[LIMA_GP_PLBU_ALLOC_START_ADDR >> 2] + task->heap->heap_size);
> > +                f[LIMA_GP_PLBU_ALLOC_END_ADDR >> 2]);
> >         gp_write(LIMA_GP_CMD, LIMA_GP_CMD_UPDATE_PLBU_ALLOC);
> >         return 0;
> >  }
> > --
> > 2.25.0
> >

Patch
diff mbox series

diff --git a/drivers/gpu/drm/lima/lima_gp.c b/drivers/gpu/drm/lima/lima_gp.c
index d1e7826c2d74..325604262def 100644
--- a/drivers/gpu/drm/lima/lima_gp.c
+++ b/drivers/gpu/drm/lima/lima_gp.c
@@ -224,8 +224,13 @@  static int lima_gp_task_recover(struct lima_sched_pipe *pipe)
 	}
 
 	gp_write(LIMA_GP_INT_MASK, LIMA_GP_IRQ_MASK_USED);
+	/* Resume from where we stopped, i.e. new start is old end */
+	gp_write(LIMA_GP_PLBU_ALLOC_START_ADDR,
+		 f[LIMA_GP_PLBU_ALLOC_END_ADDR >> 2]);
+	f[LIMA_GP_PLBU_ALLOC_END_ADDR >> 2] =
+		f[LIMA_GP_PLBU_ALLOC_START_ADDR >> 2] + task->heap->heap_size;
 	gp_write(LIMA_GP_PLBU_ALLOC_END_ADDR,
-		 f[LIMA_GP_PLBU_ALLOC_START_ADDR >> 2] + task->heap->heap_size);
+		 f[LIMA_GP_PLBU_ALLOC_END_ADDR >> 2]);
 	gp_write(LIMA_GP_CMD, LIMA_GP_CMD_UPDATE_PLBU_ALLOC);
 	return 0;
 }