drm/v3d: Enable V3D to use different PAGE_SIZE
Subsystems (3)
Maíra Canal
maintainerPATCH 1/1 drm/v3d: Enable V3D to use different PAGE_SIZE
Currently, the V3D driver uses PAGE_SHIFT over the assumption that PAGE_SHIFT = 12, as the PAGE_SIZE = 4KB. But, the RPi 5 is using PAGE_SIZE = 16KB, so the MMU PAGE_SHIFT is different than the system's PAGE_SHIFT.
Enable V3D to be used in system's with any PAGE_SIZE by making sure that everything MMU-related uses the MMU page shift.
--- drivers/gpu/drm/v3d/v3d_bo.c | 12 ++++++------ drivers/gpu/drm/v3d/v3d_debugfs.c | 2 +- drivers/gpu/drm/v3d/v3d_drv.h | 2 ++ drivers/gpu/drm/v3d/v3d_irq.c | 2 +- drivers/gpu/drm/v3d/v3d_mmu.c | 2 -- 5 files changed, 10 insertions(+), 10 deletions(-)
drivers/gpu/drm/v3d/v3d_bo.c +6 -6
@@ -40,7 +40,7 @@ void v3d_free_object(struct drm_gem_object *obj)mutex_lock (&v3d->bo_lock); v3d->bo_stats.num_allocated--; - v3d->bo_stats.pages_allocated -= obj->size >>PAGE_SHIFT ; + v3d->bo_stats.pages_allocated -= obj->size >>V3D_MMU_PAGE_SHIFT ;mutex_unlock (&v3d->bo_lock);spin_lock (&v3d->mm_lock);
@@ -109,8 +109,8 @@ v3d_bo_create_finish(struct drm_gem_object *obj)* lifetime of the BO. */ ret =drm_mm_insert_node_generic (&v3d->mm, &bo->node, - obj->size >>PAGE_SHIFT , -GMP_GRANULARITY >>PAGE_SHIFT ,0 ,0 ); + obj->size >>V3D_MMU_PAGE_SHIFT , +GMP_GRANULARITY >>V3D_MMU_PAGE_SHIFT ,0 ,0 );spin_unlock (&v3d->mm_lock);if (ret)return ret;
@@ -118,7 +118,7 @@ v3d_bo_create_finish(struct drm_gem_object *obj)/* Track stats for /debug/dri/n/bo_stats. */ mutex_lock (&v3d->bo_lock); v3d->bo_stats.num_allocated++; - v3d->bo_stats.pages_allocated += obj->size >>PAGE_SHIFT ; + v3d->bo_stats.pages_allocated += obj->size >>V3D_MMU_PAGE_SHIFT ;mutex_unlock (&v3d->bo_lock);v3d_mmu_insert_ptes (bo);
@@ -201,7 +201,7 @@ int v3d_create_bo_ioctl(struct drm_device *dev, void *data,if (IS_ERR (bo))return PTR_ERR (bo); - args->offset = bo->node.start <<PAGE_SHIFT ; + args->offset = bo->node.start <<V3D_MMU_PAGE_SHIFT ; ret =drm_gem_handle_create (file_priv, &bo->base.base, &args->handle);drm_gem_object_put (&bo->base.base);
@@ -246,7 +246,7 @@ int v3d_get_bo_offset_ioctl(struct drm_device *dev, void *data, } bo =to_v3d_bo (gem_obj); - args->offset = bo->node.start <<PAGE_SHIFT ; + args->offset = bo->node.start <<V3D_MMU_PAGE_SHIFT ;drm_gem_object_put (gem_obj);return 0 ;
drivers/gpu/drm/v3d/v3d_debugfs.c +1 -1
@@ -219,7 +219,7 @@ static int v3d_debugfs_bo_stats(struct seq_file *m, void *unused)seq_printf (m,"allocated bos: %d\n" , v3d->bo_stats.num_allocated);seq_printf (m,"allocated bo size (kb): %ld\n" , - (long )v3d->bo_stats.pages_allocated << (PAGE_SHIFT -10 )); + (long )v3d->bo_stats.pages_allocated << (V3D_MMU_PAGE_SHIFT -10 ));mutex_unlock (&v3d->bo_lock);return 0 ;
drivers/gpu/drm/v3d/v3d_drv.h +2 -0
@@ -19,6 +19,8 @@ struct reset_control;#define GMP_GRANULARITY (128 * 1024) +#define V3D_MMU_PAGE_SHIFT 12 +#define V3D_MAX_QUEUES (V3D_CPU + 1)static inline char *v3d_queue_to_string (enum v3d_queue queue)
drivers/gpu/drm/v3d/v3d_irq.c +1 -1
@@ -70,7 +70,7 @@ 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_CORE_WRITE (0 ,V3D_PTB_BPOA , bo->node.start <<PAGE_SHIFT ); +V3D_CORE_WRITE (0 ,V3D_PTB_BPOA , bo->node.start <<V3D_MMU_PAGE_SHIFT );V3D_CORE_WRITE (0 ,V3D_PTB_BPOS , obj->size); out:
drivers/gpu/drm/v3d/v3d_mmu.c +0 -2
@@ -21,8 +21,6 @@#include "v3d_drv.h" #include "v3d_regs.h" -#define V3D_MMU_PAGE_SHIFT 12 -/* Note: All PTEs for the 1MB superpage must be filled with the * superpage bit set. */
--
2.43.0
Hi Maíra,
drivers/gpu/drm/v3d/v3d_bo.c
Quoted 24 lines · Maíra Canal
Currently, the V3D driver uses
PAGE_SHIFTover the assumption thatPAGE_SHIFT= 12, as thePAGE_SIZE= 4KB. But, the RPi 5 is usingPAGE_SIZE= 16KB, so the MMUPAGE_SHIFTis different than the system'sPAGE_SHIFT.Enable V3D to be used in system's with any
PAGE_SIZEby making sure that
everything MMU-related uses the MMU page shift.Signed-off-by Maíra Canal <[email protected]>---
drivers/gpu/drm/v3d/v3d_bo.c | 12 ++++++------drivers/gpu/drm/v3d/v3d_debugfs.c| 2 +-drivers/gpu/drm/v3d/v3d_drv.h | 2 ++ drivers/gpu/drm/v3d/v3d_irq.c | 2 +- drivers/gpu/drm/v3d/v3d_mmu.c | 2 -- 5 files changed, 10 insertions(+), 10 deletions(-)drivers/gpu/drm/v3d/v3d_bo.c +0
-0
I think we need the same change in v3d_get_bo_vaddr, no?
Iago
Quoted 121 lines
drivers/gpu/drm/v3d/v3d_bo.c +1
-1@@ -40,7 +40,7 @@ void v3d_free_object(struct drm_gem_object *obj) mutex_lock(&v3d->bo_lock); v3d->bo_stats.num_allocated--; - v3d->bo_stats.pages_allocated -= obj->size >>PAGE_SHIFT ; + v3d->bo_stats.pages_allocated -= obj->size >>V3D_MMU_PAGE_SHIFT ; mutex_unlock(&v3d->bo_lock);
spin_lock(&v3d->mm_lock);drivers/gpu/drm/v3d/v3d_bo.c +2
-2@@ -109,8 +109,8 @@ v3d_bo_create_finish(struct drm_gem_object *obj)* lifetime of the BO. */ ret = drm_mm_insert_node_generic(&v3d->mm, &bo->node, - obj->size >>PAGE_SHIFT , -GMP_GRANULARITY >>PAGE_SHIFT ,0 ,0 ); + obj->size >>V3D_MMU_PAGE_SHIFT , +GMP_GRANULARITY >> V3D_MMU_PAGE_SHIFT, 0, 0);
spin_unlock(&v3d->mm_lock);
if (ret)
return ret;drivers/gpu/drm/v3d/v3d_bo.c +1
-1@@ -118,7 +118,7 @@ v3d_bo_create_finish(struct drm_gem_object *obj) /* Track stats for /debug/dri/n/bo_stats. */ mutex_lock(&v3d->bo_lock); v3d->bo_stats.num_allocated++; - v3d->bo_stats.pages_allocated += obj->size >>PAGE_SHIFT ; + v3d->bo_stats.pages_allocated += obj->size >>V3D_MMU_PAGE_SHIFT ; mutex_unlock(&v3d->bo_lock);
v3d_mmu_insert_ptes(bo);drivers/gpu/drm/v3d/v3d_bo.c +1
-1@@ -201,7 +201,7 @@ int v3d_create_bo_ioctl(struct drm_device *dev,void *data, if (IS_ERR(bo)) return PTR_ERR(bo); - args->offset = bo->node.start <<PAGE_SHIFT ; + args->offset = bo->node.start <<V3D_MMU_PAGE_SHIFT ; ret = drm_gem_handle_create(file_priv, &bo->base.base,
&args->handle);
drm_gem_object_put(&bo->base.base);drivers/gpu/drm/v3d/v3d_bo.c +1
-1@@ -246,7 +246,7 @@ int v3d_get_bo_offset_ioctl(struct drm_device *dev, void *data, } bo = to_v3d_bo(gem_obj); - args->offset = bo->node.start <<PAGE_SHIFT ; + args->offset = bo->node.start <<V3D_MMU_PAGE_SHIFT ; drm_gem_object_put(gem_obj);return 0;
drivers/gpu/drm/v3d/v3d_debugfs.c +1
-1@@ -219,7 +219,7 @@ static int v3d_debugfs_bo_stats(struct seq_file *m, void *unused) seq_printf(m, "allocated bos: %d\n", v3d->bo_stats.num_allocated); seq_printf(m, "allocated bo size (kb): %ld\n", - (long)v3d->bo_stats.pages_allocated << (PAGE_SHIFT -10 )); + (long)v3d->bo_stats.pages_allocated << (V3D_MMU_PAGE_SHIFT - 10));
mutex_unlock(&v3d->bo_lock);return 0;
drivers/gpu/drm/v3d/v3d_drv.h +2
-0@@ -19,6 +19,8 @@ struct reset_control; #define GMP_GRANULARITY (128 * 1024) +#define V3D_MMU_PAGE_SHIFT 12 + #define V3D_MAX_QUEUES (V3D_CPU + 1) static inline char *v3d_queue_to_string(enum v3d_queue queue)drivers/gpu/drm/v3d/v3d_irq.c +0
-0@@ -70,7 +70,7 @@ v3d_overflow_mem_work(struct work_struct *work)list_add_tail(&bo->unref_head, &v3d->bin_job->render-
Quoted 1 line
unref_list);
spin_unlock_irqrestore(&v3d->job_lock, irqflags);drivers/gpu/drm/v3d/v3d_irq.c +0
-1- V3D_CORE_WRITE(0, V3D_PTB_BPOA, bo->node.start <<
PAGE_SHIFT);drivers/gpu/drm/v3d/v3d_irq.c +1
-0+ V3D_CORE_WRITE(0, V3D_PTB_BPOA, bo->node.start <<
V3D_MMU_PAGE_SHIFT);
V3D_CORE_WRITE(0, V3D_PTB_BPOS, obj->size);out:
drivers/gpu/drm/v3d/v3d_mmu.c +0
-3@@ -21,8 +21,6 @@ #include "v3d_drv.h" #include "v3d_regs.h" -#define V3D_MMU_PAGE_SHIFT 12 - /* Note: All PTEs for the 1MB superpage must be filled with the* superpage bit set. */ --2.43.0
Maíra Canal
maintainerHi Iago,
Quoted 22 lines · Iago Toral
Hi Maíra,
Quoted 19 lines · Maíra Canal
Currently, the V3D driver uses
PAGE_SHIFTover the assumption thatPAGE_SHIFT= 12, as thePAGE_SIZE= 4KB. But, the RPi 5 is usingPAGE_SIZE= 16KB, so the MMUPAGE_SHIFTis different than the system'sPAGE_SHIFT.Enable V3D to be used in system's with any
PAGE_SIZEby making sure that
everything MMU-related uses the MMU page shift.Signed-off-by Maíra Canal <[email protected]>--- drivers/gpu/drm/v3d/v3d_bo.c | 12 ++++++------ drivers/gpu/drm/v3d/v3d_debugfs.c | 2 +- drivers/gpu/drm/v3d/v3d_drv.h | 2 ++ drivers/gpu/drm/v3d/v3d_irq.c | 2 +- drivers/gpu/drm/v3d/v3d_mmu.c | 2 -- 5 files changed, 10 insertions(+), 10 deletions(-)
Quoted 7 lines
drivers/gpu/drm/v3d/v3d_bo.c
Quoted 5 lines
drivers/gpu/drm/v3d/v3d_bo.c +0
-0I think we need the same change in
v3d_get_bo_vaddr, no?
No, that one uses the PAGE_SHIFT of the CPU, because obj->pages is in the CPU.
Best Regards,
- Maíra
Quoted 125 lines
Iago
Quoted 121 lines
drivers/gpu/drm/v3d/v3d_bo.c +1
-1@@ -40,7 +40,7 @@ void v3d_free_object(struct drm_gem_object *obj) mutex_lock(&v3d->bo_lock); v3d->bo_stats.num_allocated--; - v3d->bo_stats.pages_allocated -= obj->size >>PAGE_SHIFT ; + v3d->bo_stats.pages_allocated -= obj->size >>V3D_MMU_PAGE_SHIFT ; mutex_unlock(&v3d->bo_lock);
spin_lock(&v3d->mm_lock);drivers/gpu/drm/v3d/v3d_bo.c +2
-2@@ -109,8 +109,8 @@ v3d_bo_create_finish(struct drm_gem_object *obj)* lifetime of the BO. */ ret = drm_mm_insert_node_generic(&v3d->mm, &bo->node, - obj->size >>PAGE_SHIFT , -GMP_GRANULARITY >>PAGE_SHIFT ,0 ,0 ); + obj->size >>V3D_MMU_PAGE_SHIFT , +GMP_GRANULARITY >> V3D_MMU_PAGE_SHIFT, 0, 0);
spin_unlock(&v3d->mm_lock);
if (ret)
return ret;drivers/gpu/drm/v3d/v3d_bo.c +1
-1@@ -118,7 +118,7 @@ v3d_bo_create_finish(struct drm_gem_object *obj) /* Track stats for /debug/dri/n/bo_stats. */ mutex_lock(&v3d->bo_lock); v3d->bo_stats.num_allocated++; - v3d->bo_stats.pages_allocated += obj->size >>PAGE_SHIFT ; + v3d->bo_stats.pages_allocated += obj->size >>V3D_MMU_PAGE_SHIFT ; mutex_unlock(&v3d->bo_lock);
v3d_mmu_insert_ptes(bo);drivers/gpu/drm/v3d/v3d_bo.c +1
-1@@ -201,7 +201,7 @@ int v3d_create_bo_ioctl(struct drm_device *dev,void *data, if (IS_ERR(bo)) return PTR_ERR(bo); - args->offset = bo->node.start <<PAGE_SHIFT ; + args->offset = bo->node.start <<V3D_MMU_PAGE_SHIFT ; ret = drm_gem_handle_create(file_priv, &bo->base.base,
&args->handle);
drm_gem_object_put(&bo->base.base);drivers/gpu/drm/v3d/v3d_bo.c +1
-1@@ -246,7 +246,7 @@ int v3d_get_bo_offset_ioctl(struct drm_device *dev, void *data, } bo = to_v3d_bo(gem_obj); - args->offset = bo->node.start <<PAGE_SHIFT ; + args->offset = bo->node.start <<V3D_MMU_PAGE_SHIFT ; drm_gem_object_put(gem_obj);return 0;
drivers/gpu/drm/v3d/v3d_debugfs.c +1
-1@@ -219,7 +219,7 @@ static int v3d_debugfs_bo_stats(struct seq_file *m, void *unused) seq_printf(m, "allocated bos: %d\n", v3d->bo_stats.num_allocated); seq_printf(m, "allocated bo size (kb): %ld\n", - (long)v3d->bo_stats.pages_allocated << (PAGE_SHIFT -10 )); + (long)v3d->bo_stats.pages_allocated << (V3D_MMU_PAGE_SHIFT - 10));
mutex_unlock(&v3d->bo_lock);return 0;
drivers/gpu/drm/v3d/v3d_drv.h +2
-0@@ -19,6 +19,8 @@ struct reset_control; #define GMP_GRANULARITY (128 * 1024) +#define V3D_MMU_PAGE_SHIFT 12 + #define V3D_MAX_QUEUES (V3D_CPU + 1) static inline char *v3d_queue_to_string(enum v3d_queue queue)drivers/gpu/drm/v3d/v3d_irq.c +1
-1@@ -70,7 +70,7 @@ 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_CORE_WRITE (0 ,V3D_PTB_BPOA , bo->node.start << PAGE_SHIFT); +V3D_CORE_WRITE (0 ,V3D_PTB_BPOA , bo->node.start <<V3D_MMU_PAGE_SHIFT );
V3D_CORE_WRITE(0, V3D_PTB_BPOS, obj->size);out:
drivers/gpu/drm/v3d/v3d_mmu.c +0
-3@@ -21,8 +21,6 @@ #include "v3d_drv.h" #include "v3d_regs.h" -#define V3D_MMU_PAGE_SHIFT 12 - /* Note: All PTEs for the 1MB superpage must be filled with the* superpage bit set. */ --2.43.0
Iago Toral
Reviewed-byQuoted 35 lines · Maíra Canal
Hi Iago,
Quoted 24 lines · Iago Toral
Hi Maíra,
Quoted 21 lines · Maíra Canal
Currently, the V3D driver uses
PAGE_SHIFTover the assumption thatPAGE_SHIFT= 12, as thePAGE_SIZE= 4KB. But, the RPi 5 is usingPAGE_SIZE= 16KB, so the MMUPAGE_SHIFTis different than the system'sPAGE_SHIFT.Enable V3D to be used in system's with any
PAGE_SIZEby making sure
that
everything MMU-related uses the MMU page shift.Signed-off-by Maíra Canal <[email protected]>---
drivers/gpu/drm/v3d/v3d_bo.c | 12 ++++++------drivers/gpu/drm/v3d/v3d_debugfs.c| 2 +-drivers/gpu/drm/v3d/v3d_drv.h | 2 ++ drivers/gpu/drm/v3d/v3d_irq.c | 2 +- drivers/gpu/drm/v3d/v3d_mmu.c | 2 -- 5 files changed, 10 insertions(+), 10 deletions(-)Quoted 7 lines
drivers/gpu/drm/v3d/v3d_bo.c
Quoted 5 lines
drivers/gpu/drm/v3d/v3d_bo.c +0
-0I think we need the same change in
v3d_get_bo_vaddr, no?
Quoted 3 lines
No, that one uses the
PAGE_SHIFTof the CPU, because
is in
the CPU.
Ah, makes sense, thanks!
Quoted 138 lines
Best Regards,
- MaíraQuoted 133 lines
Iago
Quoted 129 lines
drivers/gpu/drm/v3d/v3d_bo.c +1
-1@@ -40,7 +40,7 @@ void v3d_free_object(struct drm_gem_object *obj) mutex_lock(&v3d->bo_lock); v3d->bo_stats.num_allocated--; - v3d->bo_stats.pages_allocated -= obj->size >>PAGE_SHIFT ; + v3d->bo_stats.pages_allocated -= obj->size >>V3D_MMU_PAGE_SHIFT ;
mutex_unlock(&v3d->bo_lock);
spin_lock(&v3d->mm_lock);drivers/gpu/drm/v3d/v3d_bo.c +1
-2@@ -109,8 +109,8 @@ v3d_bo_create_finish(struct drm_gem_object*obj) * lifetime of the BO. */ ret = drm_mm_insert_node_generic(&v3d->mm, &bo->node, - obj->size >>PAGE_SHIFT , -GMP_GRANULARITY >>PAGE_SHIFT ,0 ,0 ); + obj->size >>
V3D_MMU_PAGE_SHIFT,drivers/gpu/drm/v3d/v3d_bo.c +1
-0+ GMP_GRANULARITY >>
V3D_MMU_PAGE_SHIFT, 0, 0);
spin_unlock(&v3d->mm_lock);
if (ret)
return ret;drivers/gpu/drm/v3d/v3d_bo.c +1
-1@@ -118,7 +118,7 @@ v3d_bo_create_finish(struct drm_gem_object *obj) /* Track stats for /debug/dri/n/bo_stats. */ mutex_lock(&v3d->bo_lock); v3d->bo_stats.num_allocated++; - v3d->bo_stats.pages_allocated += obj->size >>PAGE_SHIFT ; + v3d->bo_stats.pages_allocated += obj->size >>V3D_MMU_PAGE_SHIFT ;
mutex_unlock(&v3d->bo_lock);
v3d_mmu_insert_ptes(bo);drivers/gpu/drm/v3d/v3d_bo.c +1
-1@@ -201,7 +201,7 @@ int v3d_create_bo_ioctl(struct drm_device *dev, void *data, if (IS_ERR(bo)) return PTR_ERR(bo); - args->offset = bo->node.start <<PAGE_SHIFT ; + args->offset = bo->node.start <<V3D_MMU_PAGE_SHIFT ;ret =
drm_gem_handle_create(file_priv, &bo->base.base, &args->handle);
drm_gem_object_put(&bo->base.base);drivers/gpu/drm/v3d/v3d_bo.c +1
-1@@ -246,7 +246,7 @@ int v3d_get_bo_offset_ioctl(struct drm_device *dev, void *data, } bo = to_v3d_bo(gem_obj); - args->offset = bo->node.start <<PAGE_SHIFT ; + args->offset = bo->node.start <<V3D_MMU_PAGE_SHIFT ; drm_gem_object_put(gem_obj);return 0;
drivers/gpu/drm/v3d/v3d_debugfs.c +0
-0@@ -219,7 +219,7 @@ static int v3d_debugfs_bo_stats(struct
seq_file
*m, void *unused)
seq_printf(m, "allocated bos: %d\n", v3d->bo_stats.num_allocated); seq_printf(m, "allocated bo size (kb): %ld\n",drivers/gpu/drm/v3d/v3d_debugfs.c +0
-1- (long)v3d->bo_stats.pages_allocated <<(
PAGE_SHIFT- 10));drivers/gpu/drm/v3d/v3d_debugfs.c +1
-0+ (long)v3d->bo_stats.pages_allocated <<(
V3D_MMU_PAGE_SHIFT- 10));
mutex_unlock(&v3d->bo_lock);return 0;
drivers/gpu/drm/v3d/v3d_drv.h +2
-0@@ -19,6 +19,8 @@ struct reset_control; #define GMP_GRANULARITY (128 * 1024) +#define V3D_MMU_PAGE_SHIFT 12 + #define V3D_MAX_QUEUES (V3D_CPU + 1) static inline char *v3d_queue_to_string(enum v3d_queue queue)drivers/gpu/drm/v3d/v3d_irq.c +0
-0@@ -70,7 +70,7 @@ v3d_overflow_mem_work(struct work_struct *work)list_add_tail(&bo->unref_head, &v3d->bin_job->render-
Quoted 1 line
unref_list);
spin_unlock_irqrestore(&v3d->job_lock, irqflags);drivers/gpu/drm/v3d/v3d_irq.c +0
-1- V3D_CORE_WRITE(0, V3D_PTB_BPOA, bo->node.start <<
PAGE_SHIFT);drivers/gpu/drm/v3d/v3d_irq.c +1
-0+ V3D_CORE_WRITE(0, V3D_PTB_BPOA, bo->node.start <<
V3D_MMU_PAGE_SHIFT);
V3D_CORE_WRITE(0, V3D_PTB_BPOS, obj->size);out:
drivers/gpu/drm/v3d/v3d_mmu.c +0
-3@@ -21,8 +21,6 @@ #include "v3d_drv.h" #include "v3d_regs.h" -#define V3D_MMU_PAGE_SHIFT 12 - /* Note: All PTEs for the 1MB superpage must be filled with the* superpage bit set. */ --2.43.0
Hi Iago,
Quoted 36 lines · Iago Toral
Quoted 35 lines · Maíra Canal
Hi Iago,
Quoted 31 lines · Iago Toral
Hi Maíra,
drivers/gpu/drm/v3d/v3d_bo.c
Quoted 26 lines · Maíra Canal
Currently, the V3D driver uses
PAGE_SHIFTover the assumption thatPAGE_SHIFT= 12, as thePAGE_SIZE= 4KB. But, the RPi 5 is usingPAGE_SIZE= 16KB, so the MMUPAGE_SHIFTis different than the system'sPAGE_SHIFT.Enable V3D to be used in system's with any
PAGE_SIZEby making sure
that
everything MMU-related uses the MMU page shift.Signed-off-by Maíra Canal <[email protected]>--- drivers/gpu/drm/v3d/v3d_bo.c | 12 ++++++------ drivers/gpu/drm/v3d/v3d_debugfs.c | 2 +- drivers/gpu/drm/v3d/v3d_drv.h | 2 ++ drivers/gpu/drm/v3d/v3d_irq.c | 2 +- drivers/gpu/drm/v3d/v3d_mmu.c | 2 -- 5 files changed, 10 insertions(+), 10 deletions(-)drivers/gpu/drm/v3d/v3d_bo.c +0
-0I think we need the same change in
v3d_get_bo_vaddr, no?
Quoted 7 lines
Quoted 3 lines
No, that one uses the
PAGE_SHIFTof the CPU, because
is in
the CPU.Ah, makes sense, thanks!
Reviewed-by Iago Toral Quiroga <[email protected]>
Applied to drm-misc/drm-misc-next!
Best Regards,
- Maíra
Quoted 140 lines
Quoted 139 lines
Best Regards,
- MaíraQuoted 133 lines
Iago
Quoted 129 lines
drivers/gpu/drm/v3d/v3d_bo.c +1
-1@@ -40,7 +40,7 @@ void v3d_free_object(struct drm_gem_object *obj) mutex_lock(&v3d->bo_lock); v3d->bo_stats.num_allocated--; - v3d->bo_stats.pages_allocated -= obj->size >>PAGE_SHIFT ; + v3d->bo_stats.pages_allocated -= obj->size >>V3D_MMU_PAGE_SHIFT ;
mutex_unlock(&v3d->bo_lock);
spin_lock(&v3d->mm_lock);drivers/gpu/drm/v3d/v3d_bo.c +1
-2@@ -109,8 +109,8 @@ v3d_bo_create_finish(struct drm_gem_object*obj) * lifetime of the BO. */ ret = drm_mm_insert_node_generic(&v3d->mm, &bo->node, - obj->size >>PAGE_SHIFT , -GMP_GRANULARITY >>PAGE_SHIFT ,0 ,0 ); + obj->size >>
V3D_MMU_PAGE_SHIFT,drivers/gpu/drm/v3d/v3d_bo.c +1
-0+ GMP_GRANULARITY >>
V3D_MMU_PAGE_SHIFT, 0, 0);
spin_unlock(&v3d->mm_lock);
if (ret)
return ret;drivers/gpu/drm/v3d/v3d_bo.c +1
-1@@ -118,7 +118,7 @@ v3d_bo_create_finish(struct drm_gem_object *obj) /* Track stats for /debug/dri/n/bo_stats. */ mutex_lock(&v3d->bo_lock); v3d->bo_stats.num_allocated++; - v3d->bo_stats.pages_allocated += obj->size >>PAGE_SHIFT ; + v3d->bo_stats.pages_allocated += obj->size >>V3D_MMU_PAGE_SHIFT ;
mutex_unlock(&v3d->bo_lock);
v3d_mmu_insert_ptes(bo);drivers/gpu/drm/v3d/v3d_bo.c +1
-1@@ -201,7 +201,7 @@ int v3d_create_bo_ioctl(struct drm_device *dev, void *data, if (IS_ERR(bo)) return PTR_ERR(bo); - args->offset = bo->node.start <<PAGE_SHIFT ; + args->offset = bo->node.start <<V3D_MMU_PAGE_SHIFT ;ret = drm_gem_handle_create(file_priv,
&bo->base.base,&args->handle);
drm_gem_object_put(&bo->base.base);drivers/gpu/drm/v3d/v3d_bo.c +1
-1@@ -246,7 +246,7 @@ int v3d_get_bo_offset_ioctl(struct drm_device *dev, void *data, } bo = to_v3d_bo(gem_obj); - args->offset = bo->node.start <<PAGE_SHIFT ; + args->offset = bo->node.start <<V3D_MMU_PAGE_SHIFT ; drm_gem_object_put(gem_obj);return 0;
drivers/gpu/drm/v3d/v3d_debugfs.c +0
-0@@ -219,7 +219,7 @@ static int v3d_debugfs_bo_stats(struct
seq_file
*m, void *unused)
seq_printf(m, "allocated bos: %d\n", v3d->bo_stats.num_allocated); seq_printf(m, "allocated bo size (kb): %ld\n",drivers/gpu/drm/v3d/v3d_debugfs.c +0
-1- (long)v3d->bo_stats.pages_allocated <<(
PAGE_SHIFT- 10));drivers/gpu/drm/v3d/v3d_debugfs.c +1
-0+ (long)v3d->bo_stats.pages_allocated <<(
V3D_MMU_PAGE_SHIFT- 10));
mutex_unlock(&v3d->bo_lock);return 0;
drivers/gpu/drm/v3d/v3d_drv.h +2
-0@@ -19,6 +19,8 @@ struct reset_control; #define GMP_GRANULARITY (128 * 1024) +#define V3D_MMU_PAGE_SHIFT 12 + #define V3D_MAX_QUEUES (V3D_CPU + 1) static inline char *v3d_queue_to_string(enum v3d_queue queue)drivers/gpu/drm/v3d/v3d_irq.c +1
-1@@ -70,7 +70,7 @@ 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_CORE_WRITE (0 ,V3D_PTB_BPOA , bo->node.start << PAGE_SHIFT); +V3D_CORE_WRITE (0 ,V3D_PTB_BPOA , bo->node.start <<V3D_MMU_PAGE_SHIFT );
V3D_CORE_WRITE(0, V3D_PTB_BPOS, obj->size);out:
drivers/gpu/drm/v3d/v3d_mmu.c +0
-3@@ -21,8 +21,6 @@ #include "v3d_drv.h" #include "v3d_regs.h" -#define V3D_MMU_PAGE_SHIFT 12 - /* Note: All PTEs for the 1MB superpage must be filled with the* superpage bit set. */ --2.43.0