Message ID | 20240829130954.2439316-3-mcanal@igalia.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | drm/v3d: Enable Big and Super Pages | expand |
Thanks! Reviewed-by: Iago Toral Quiroga <itoral@igalia.com> El jue, 29-08-2024 a las 10:05 -0300, Maíra Canal escribió: > We must ensure that the MMU is flushed before we supply more memory > to > the binner, otherwise we might end up with invalid MMU accesses by > the > GPU. > > Fixes: 57692c94dcbe ("drm/v3d: Introduce a new DRM driver for > Broadcom V3D V3.x+") > Signed-off-by: Maíra Canal <mcanal@igalia.com> > --- > drivers/gpu/drm/v3d/v3d_drv.h | 1 + > drivers/gpu/drm/v3d/v3d_irq.c | 2 ++ > drivers/gpu/drm/v3d/v3d_mmu.c | 2 +- > 3 files changed, 4 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/v3d/v3d_drv.h > b/drivers/gpu/drm/v3d/v3d_drv.h > index cf4b23369dc4..75b4725d49c7 100644 > --- a/drivers/gpu/drm/v3d/v3d_drv.h > +++ b/drivers/gpu/drm/v3d/v3d_drv.h > @@ -553,6 +553,7 @@ void v3d_irq_disable(struct v3d_dev *v3d); > void v3d_irq_reset(struct v3d_dev *v3d); > > /* v3d_mmu.c */ > +int v3d_mmu_flush_all(struct v3d_dev *v3d); > int v3d_mmu_set_page_table(struct v3d_dev *v3d); > void v3d_mmu_insert_ptes(struct v3d_bo *bo); > void v3d_mmu_remove_ptes(struct v3d_bo *bo); > diff --git a/drivers/gpu/drm/v3d/v3d_irq.c > b/drivers/gpu/drm/v3d/v3d_irq.c > index d469bda52c1a..20bf33702c3c 100644 > --- a/drivers/gpu/drm/v3d/v3d_irq.c > +++ b/drivers/gpu/drm/v3d/v3d_irq.c > @@ -70,6 +70,8 @@ v3d_overflow_mem_work(struct work_struct *work) > list_add_tail(&bo->unref_head, &v3d->bin_job->render- > >unref_list); > spin_unlock_irqrestore(&v3d->job_lock, irqflags); > > + v3d_mmu_flush_all(v3d); > + > V3D_CORE_WRITE(0, V3D_PTB_BPOA, bo->node.start << > V3D_MMU_PAGE_SHIFT); > V3D_CORE_WRITE(0, V3D_PTB_BPOS, obj->size); > > diff --git a/drivers/gpu/drm/v3d/v3d_mmu.c > b/drivers/gpu/drm/v3d/v3d_mmu.c > index 06bb44c7f35d..3b7694ee7536 100644 > --- a/drivers/gpu/drm/v3d/v3d_mmu.c > +++ b/drivers/gpu/drm/v3d/v3d_mmu.c > @@ -28,7 +28,7 @@ > #define V3D_PTE_WRITEABLE BIT(29) > #define V3D_PTE_VALID BIT(28) > > -static int v3d_mmu_flush_all(struct v3d_dev *v3d) > +int v3d_mmu_flush_all(struct v3d_dev *v3d) > { > int ret; >
diff --git a/drivers/gpu/drm/v3d/v3d_drv.h b/drivers/gpu/drm/v3d/v3d_drv.h index cf4b23369dc4..75b4725d49c7 100644 --- a/drivers/gpu/drm/v3d/v3d_drv.h +++ b/drivers/gpu/drm/v3d/v3d_drv.h @@ -553,6 +553,7 @@ void v3d_irq_disable(struct v3d_dev *v3d); void v3d_irq_reset(struct v3d_dev *v3d); /* v3d_mmu.c */ +int v3d_mmu_flush_all(struct v3d_dev *v3d); int v3d_mmu_set_page_table(struct v3d_dev *v3d); void v3d_mmu_insert_ptes(struct v3d_bo *bo); void v3d_mmu_remove_ptes(struct v3d_bo *bo); diff --git a/drivers/gpu/drm/v3d/v3d_irq.c b/drivers/gpu/drm/v3d/v3d_irq.c index d469bda52c1a..20bf33702c3c 100644 --- a/drivers/gpu/drm/v3d/v3d_irq.c +++ b/drivers/gpu/drm/v3d/v3d_irq.c @@ -70,6 +70,8 @@ v3d_overflow_mem_work(struct work_struct *work) list_add_tail(&bo->unref_head, &v3d->bin_job->render->unref_list); spin_unlock_irqrestore(&v3d->job_lock, irqflags); + v3d_mmu_flush_all(v3d); + V3D_CORE_WRITE(0, V3D_PTB_BPOA, bo->node.start << V3D_MMU_PAGE_SHIFT); V3D_CORE_WRITE(0, V3D_PTB_BPOS, obj->size); diff --git a/drivers/gpu/drm/v3d/v3d_mmu.c b/drivers/gpu/drm/v3d/v3d_mmu.c index 06bb44c7f35d..3b7694ee7536 100644 --- a/drivers/gpu/drm/v3d/v3d_mmu.c +++ b/drivers/gpu/drm/v3d/v3d_mmu.c @@ -28,7 +28,7 @@ #define V3D_PTE_WRITEABLE BIT(29) #define V3D_PTE_VALID BIT(28) -static int v3d_mmu_flush_all(struct v3d_dev *v3d) +int v3d_mmu_flush_all(struct v3d_dev *v3d) { int ret;
We must ensure that the MMU is flushed before we supply more memory to the binner, otherwise we might end up with invalid MMU accesses by the GPU. Fixes: 57692c94dcbe ("drm/v3d: Introduce a new DRM driver for Broadcom V3D V3.x+") Signed-off-by: Maíra Canal <mcanal@igalia.com> --- drivers/gpu/drm/v3d/v3d_drv.h | 1 + drivers/gpu/drm/v3d/v3d_irq.c | 2 ++ drivers/gpu/drm/v3d/v3d_mmu.c | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-)