Skip to contentSkip to conversation

imagination: Update allocation flags for buffers in submit job

PATCH Superseded Brajesh Gupta 3 participants 10 messages Oct 29 – Nov 9 Library code

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v2 cover imagination: Update allocation flags for buffers in submit job

Update BO allocation flags to match expectation:
- Remove the CPU_ACCESS flag from BOs that are not host-accessed.
- Use DRM_PVR_BO_PM_FW_PROTECT for MList allocations.

---
Changes in v2:
- Update as per Kamil's feedback.
- Updated description to map commits are specific to Imagination.
- Spilt lib/igt change to two: Interface update and flags update.
- Link to v1: https://patch.msgid.link/[email protected]

---
Brajesh Gupta (3):
lib/igt_pvr: Update general heap allocation interface to pass flags
imagination: Skip CPU access flag for a few Render related allocations lib/igt_pvr: Pass DRM_PVR_BO_PM_FW_PROTECT flag for PM MList allocation

 lib/igt_pvr.c                       | 33 +++++++++++++++++++--------------
 lib/igt_pvr.h                       |  3 ++-
 tests/imagination/pvr_submit_jobs.c | 13 ++++++++++---
 3 files changed, 31 insertions(+), 18 deletions(-)

---
base-commit: fc75d6d7ffcb79e8a3316e80c7085460568a7670
change-id: 20261029-b4-render_update-79d0cf70eb0e

Best regards,

Signature · 1 line
Brajesh Gupta <[email protected]>
#1 lore raw

PATCH v2 1/3 lib/igt_pvr: Update general heap allocation interface to pass flags

Update igt_pvr_allocate_general() interface to pass flags for allocation.

---
 lib/igt_pvr.c                       | 39 ++++++++++++++++++++++++-------------
 lib/igt_pvr.h                       |  3 ++-
 tests/imagination/pvr_submit_jobs.c | 13 ++++++++++---
 3 files changed, 37 insertions(+), 18 deletions(-)
lib/igt_pvr.c +25 -14
index 799852da5..22b0c2775 100644
@@ -397,9 +397,10 @@ uint32_t igt_pvr_ioctl_create_context(int fd, enum drm_pvr_ctx_type type,
 	switch (type) {
 	case DRM_PVR_CTX_TYPE_RENDER:
 		create_context_args.callstack_addr =
-			igt_pvr_get_gpu_addr(igt_pvr_allocate_general(fd,
-								      vm_ctx_handle,
-								      POWERVR_GPU_PAGE_SIZE));
+			igt_pvr_get_gpu_addr(igt_pvr_allocate_general(fd, vm_ctx_handle,
+								      POWERVR_GPU_PAGE_SIZE,
+								      DRM_PVR_BO_ALLOW_CPU_USERSPACE_ACCESS |
+								      DRM_PVR_BO_BYPASS_DEVICE_CACHE));
 		create_context_args.static_context_state = to_user_pointer(init_render_context_stream);
 		create_context_args.static_context_state_len =
 			init_render_context_state_stream(init_render_context_stream);
@@ -673,17 +674,15 @@ struct igt_pvr_allocation *igt_pvr_allocate(int fd, uint32_t vm_ctx, size_t size
  * @fd: The file descriptor of the DRM device.
  * @vm_ctx: The virtual memory context.
  * @size: The size of the allocation.
+ * @flags: Allocation flags.
  *
  * Function to allocate and map GPU memory from the general heap.
  *
  * Returns: Pointer to the allocation structure.
  */
-struct igt_pvr_allocation *igt_pvr_allocate_general(int fd, uint32_t vm_ctx, size_t size)
+struct igt_pvr_allocation *igt_pvr_allocate_general(int fd, uint32_t vm_ctx, size_t size, uint64_t flags)
 {
-	return igt_pvr_allocate(fd, vm_ctx, size,
-				DRM_PVR_BO_ALLOW_CPU_USERSPACE_ACCESS |
-				DRM_PVR_BO_BYPASS_DEVICE_CACHE,
-				DRM_PVR_HEAP_GENERAL);
+	return igt_pvr_allocate(fd, vm_ctx, size, flags, DRM_PVR_HEAP_GENERAL);
 }
 
 /**
@@ -817,11 +816,17 @@ static void igt_pvr_create_hwrt_geom_data_args(int fd, uint32_t vm_ctx,
 					       *geom_data_args)
 {
 	geom_data_args->rtc_dev_addr =
-		igt_pvr_get_gpu_addr(igt_pvr_allocate_general(fd, vm_ctx, POWERVR_GPU_PAGE_SIZE));
+		igt_pvr_get_gpu_addr(igt_pvr_allocate_general(fd, vm_ctx, POWERVR_GPU_PAGE_SIZE,
+							      DRM_PVR_BO_ALLOW_CPU_USERSPACE_ACCESS |
+							      DRM_PVR_BO_BYPASS_DEVICE_CACHE));
 	geom_data_args->tpc_dev_addr =
-		igt_pvr_get_gpu_addr(igt_pvr_allocate_general(fd, vm_ctx, POWERVR_GPU_PAGE_SIZE));
+		igt_pvr_get_gpu_addr(igt_pvr_allocate_general(fd, vm_ctx, POWERVR_GPU_PAGE_SIZE,
+							      DRM_PVR_BO_ALLOW_CPU_USERSPACE_ACCESS |
+							      DRM_PVR_BO_BYPASS_DEVICE_CACHE));
 	geom_data_args->vheap_table_dev_addr =
-		igt_pvr_get_gpu_addr(igt_pvr_allocate_general(fd, vm_ctx, POWERVR_GPU_PAGE_SIZE));
+		igt_pvr_get_gpu_addr(igt_pvr_allocate_general(fd, vm_ctx, POWERVR_GPU_PAGE_SIZE,
+							      DRM_PVR_BO_ALLOW_CPU_USERSPACE_ACCESS |
+							      DRM_PVR_BO_BYPASS_DEVICE_CACHE));
 	geom_data_args->tpc_size = POWERVR_GPU_PAGE_SIZE;
 	geom_data_args->tpc_stride = 0x1;
 }
@@ -839,11 +844,17 @@ static void igt_pvr_create_hwrt_rt_data_args(int fd, uint32_t vm_ctx,
 					     struct drm_pvr_create_hwrt_rt_data_args *rt_data_args)
 {
 	rt_data_args->pm_mlist_dev_addr =
-		igt_pvr_get_gpu_addr(igt_pvr_allocate_general(fd, vm_ctx, POWERVR_GPU_PAGE_SIZE));
+		igt_pvr_get_gpu_addr(igt_pvr_allocate_general(fd, vm_ctx, POWERVR_GPU_PAGE_SIZE,
+							      DRM_PVR_BO_ALLOW_CPU_USERSPACE_ACCESS |
+							      DRM_PVR_BO_BYPASS_DEVICE_CACHE));
 	rt_data_args->macrotile_array_dev_addr =
-		igt_pvr_get_gpu_addr(igt_pvr_allocate_general(fd, vm_ctx, POWERVR_GPU_PAGE_SIZE));
+		igt_pvr_get_gpu_addr(igt_pvr_allocate_general(fd, vm_ctx, POWERVR_GPU_PAGE_SIZE,
+							      DRM_PVR_BO_ALLOW_CPU_USERSPACE_ACCESS |
+							      DRM_PVR_BO_BYPASS_DEVICE_CACHE));
 	rt_data_args->region_header_dev_addr =
-		igt_pvr_get_gpu_addr(igt_pvr_allocate_general(fd, vm_ctx, POWERVR_GPU_PAGE_SIZE));
+		igt_pvr_get_gpu_addr(igt_pvr_allocate_general(fd, vm_ctx, POWERVR_GPU_PAGE_SIZE,
+							      DRM_PVR_BO_ALLOW_CPU_USERSPACE_ACCESS |
+							      DRM_PVR_BO_BYPASS_DEVICE_CACHE));
 }
 
 /**
lib/igt_pvr.h +2 -1
index b6e3dd676..bed02f968 100644
@@ -67,7 +67,8 @@ struct igt_pvr_allocation *igt_pvr_allocate_addr(int fd, uint32_t vm_ctx, size_t
 						 uint64_t flags, uint64_t gpu_addr);
 struct igt_pvr_allocation *igt_pvr_allocate(int fd, uint32_t vm_ctx, size_t size, uint64_t flags,
 					    uint32_t heap_index);
-struct igt_pvr_allocation *igt_pvr_allocate_general(int fd, uint32_t vm_ctx, size_t size);
+struct igt_pvr_allocation *igt_pvr_allocate_general(int fd, uint32_t vm_ctx, size_t size,
+					    uint64_t flags);
 void *igt_pvr_get_cpu_addr(int fd, struct igt_pvr_allocation *alloc);
 uint64_t igt_pvr_get_gpu_addr(struct igt_pvr_allocation *alloc);
 size_t igt_pvr_get_size(struct igt_pvr_allocation *alloc);
tests/imagination/pvr_submit_jobs.c +10 -3
index 566f9d2b2..21ccb03fd 100644
@@ -52,7 +52,10 @@ static uint32_t init_compute_cmd_stream(int fd, uint32_t vm_ctx,
 	void *cdm_stream_map;
 	uint32_t stream_length;
 
-	struct igt_pvr_allocation *cdm_stream_alloc = igt_pvr_allocate_general(fd, vm_ctx, 0x1000);
+	struct igt_pvr_allocation *cdm_stream_alloc =
+		igt_pvr_allocate_general(fd, vm_ctx, 0x1000,
+				         DRM_PVR_BO_ALLOW_CPU_USERSPACE_ACCESS |
+				         DRM_PVR_BO_BYPASS_DEVICE_CACHE);
 
 	cdm_stream_gpu_addr = igt_pvr_get_gpu_addr(cdm_stream_alloc);
 
@@ -212,14 +215,18 @@ int igt_main()
 		pds_buffer_base[0x20] = pds_inst_encode_halt();
 
 		vdm_alloc =
-			igt_pvr_allocate_general(fd, render_vm_ctx_handle, size);
+			igt_pvr_allocate_general(fd, render_vm_ctx_handle, size,
+						 DRM_PVR_BO_ALLOW_CPU_USERSPACE_ACCESS |
+						 DRM_PVR_BO_BYPASS_DEVICE_CACHE);
 
 		vdm_buffer = igt_pvr_get_cpu_addr(fd, vdm_alloc);
 
 		size = PVR_BO_SIZE;
 
 		ppp_alloc =
-			igt_pvr_allocate_general(fd, render_vm_ctx_handle, size);
+			igt_pvr_allocate_general(fd, render_vm_ctx_handle, size,
+						 DRM_PVR_BO_ALLOW_CPU_USERSPACE_ACCESS |
+						 DRM_PVR_BO_BYPASS_DEVICE_CACHE);
 
 		ppp_buffer_base = igt_pvr_get_cpu_addr(fd, ppp_alloc);
 
Signature · 1 line
2.43.0
Reviewed-by on v2 1/3
#2 lore raw

Re: [PATCH i-g-t v2 1/3] lib/igt_pvr: Update general heap allocation interface to pass flags

Quoted 3 lines · Brajesh Gupta

Update igt_pvr_allocate_general() interface to pass flags for allocation.

Only a minor nit below.

Quoted 11 lines
---
 lib/igt_pvr.c                       | 39 ++++++++++++++++++++++++-------------
 lib/igt_pvr.h                       |  3 ++-
 tests/imagination/pvr_submit_jobs.c | 13 ++++++++++---
 3 files changed, 37 insertions(+), 18 deletions(-)
lib/igt_pvr.c +0 -0
index 799852da5..22b0c2775 100644

lib/igt_pvr.c uint32_t igt_pvr_ioctl_create_context(int fd, enum drm_pvr_ctx_type type, · line 400

Quoted 7 lines
lib/igt_pvr.c +1 -3
@@ -397,9 +397,10 @@ uint32_t igt_pvr_ioctl_create_context(int fd, enum drm_pvr_ctx_type type,
 	switch (type) {
 	case DRM_PVR_CTX_TYPE_RENDER:
 		create_context_args.callstack_addr =
-			igt_pvr_get_gpu_addr(igt_pvr_allocate_general(fd,
-								      vm_ctx_handle,
-								      POWERVR_GPU_PAGE_SIZE));
+			igt_pvr_get_gpu_addr(igt_pvr_allocate_general(fd, vm_ctx_handle,

nit: I'd not move vm_ctx_handle.

Quoted 121 lines
lib/igt_pvr.c +24 -11
+								      POWERVR_GPU_PAGE_SIZE,
+								      DRM_PVR_BO_ALLOW_CPU_USERSPACE_ACCESS |
+								      DRM_PVR_BO_BYPASS_DEVICE_CACHE));
 		create_context_args.static_context_state = to_user_pointer(init_render_context_stream);
 		create_context_args.static_context_state_len =
 			init_render_context_state_stream(init_render_context_stream);
@@ -673,17 +674,15 @@ struct igt_pvr_allocation *igt_pvr_allocate(int fd, uint32_t vm_ctx, size_t size
  * @fd: The file descriptor of the DRM device.
  * @vm_ctx: The virtual memory context.
  * @size: The size of the allocation.
+ * @flags: Allocation flags.
  *
  * Function to allocate and map GPU memory from the general heap.
  *
  * Returns: Pointer to the allocation structure.
  */
-struct igt_pvr_allocation *igt_pvr_allocate_general(int fd, uint32_t vm_ctx, size_t size)
+struct igt_pvr_allocation *igt_pvr_allocate_general(int fd, uint32_t vm_ctx, size_t size, uint64_t flags)
 {
-	return igt_pvr_allocate(fd, vm_ctx, size,
-				DRM_PVR_BO_ALLOW_CPU_USERSPACE_ACCESS |
-				DRM_PVR_BO_BYPASS_DEVICE_CACHE,
-				DRM_PVR_HEAP_GENERAL);
+	return igt_pvr_allocate(fd, vm_ctx, size, flags, DRM_PVR_HEAP_GENERAL);
 }
 
 /**
@@ -817,11 +816,17 @@ static void igt_pvr_create_hwrt_geom_data_args(int fd, uint32_t vm_ctx,
 					       *geom_data_args)
 {
 	geom_data_args->rtc_dev_addr =
-		igt_pvr_get_gpu_addr(igt_pvr_allocate_general(fd, vm_ctx, POWERVR_GPU_PAGE_SIZE));
+		igt_pvr_get_gpu_addr(igt_pvr_allocate_general(fd, vm_ctx, POWERVR_GPU_PAGE_SIZE,
+							      DRM_PVR_BO_ALLOW_CPU_USERSPACE_ACCESS |
+							      DRM_PVR_BO_BYPASS_DEVICE_CACHE));
 	geom_data_args->tpc_dev_addr =
-		igt_pvr_get_gpu_addr(igt_pvr_allocate_general(fd, vm_ctx, POWERVR_GPU_PAGE_SIZE));
+		igt_pvr_get_gpu_addr(igt_pvr_allocate_general(fd, vm_ctx, POWERVR_GPU_PAGE_SIZE,
+							      DRM_PVR_BO_ALLOW_CPU_USERSPACE_ACCESS |
+							      DRM_PVR_BO_BYPASS_DEVICE_CACHE));
 	geom_data_args->vheap_table_dev_addr =
-		igt_pvr_get_gpu_addr(igt_pvr_allocate_general(fd, vm_ctx, POWERVR_GPU_PAGE_SIZE));
+		igt_pvr_get_gpu_addr(igt_pvr_allocate_general(fd, vm_ctx, POWERVR_GPU_PAGE_SIZE,
+							      DRM_PVR_BO_ALLOW_CPU_USERSPACE_ACCESS |
+							      DRM_PVR_BO_BYPASS_DEVICE_CACHE));
 	geom_data_args->tpc_size = POWERVR_GPU_PAGE_SIZE;
 	geom_data_args->tpc_stride = 0x1;
 }
@@ -839,11 +844,17 @@ static void igt_pvr_create_hwrt_rt_data_args(int fd, uint32_t vm_ctx,
 					     struct drm_pvr_create_hwrt_rt_data_args *rt_data_args)
 {
 	rt_data_args->pm_mlist_dev_addr =
-		igt_pvr_get_gpu_addr(igt_pvr_allocate_general(fd, vm_ctx, POWERVR_GPU_PAGE_SIZE));
+		igt_pvr_get_gpu_addr(igt_pvr_allocate_general(fd, vm_ctx, POWERVR_GPU_PAGE_SIZE,
+							      DRM_PVR_BO_ALLOW_CPU_USERSPACE_ACCESS |
+							      DRM_PVR_BO_BYPASS_DEVICE_CACHE));
 	rt_data_args->macrotile_array_dev_addr =
-		igt_pvr_get_gpu_addr(igt_pvr_allocate_general(fd, vm_ctx, POWERVR_GPU_PAGE_SIZE));
+		igt_pvr_get_gpu_addr(igt_pvr_allocate_general(fd, vm_ctx, POWERVR_GPU_PAGE_SIZE,
+							      DRM_PVR_BO_ALLOW_CPU_USERSPACE_ACCESS |
+							      DRM_PVR_BO_BYPASS_DEVICE_CACHE));
 	rt_data_args->region_header_dev_addr =
-		igt_pvr_get_gpu_addr(igt_pvr_allocate_general(fd, vm_ctx, POWERVR_GPU_PAGE_SIZE));
+		igt_pvr_get_gpu_addr(igt_pvr_allocate_general(fd, vm_ctx, POWERVR_GPU_PAGE_SIZE,
+							      DRM_PVR_BO_ALLOW_CPU_USERSPACE_ACCESS |
+							      DRM_PVR_BO_BYPASS_DEVICE_CACHE));
 }
 
 /**
lib/igt_pvr.h +2 -1
index b6e3dd676..bed02f968 100644
@@ -67,7 +67,8 @@ struct igt_pvr_allocation *igt_pvr_allocate_addr(int fd, uint32_t vm_ctx, size_t
 						 uint64_t flags, uint64_t gpu_addr);
 struct igt_pvr_allocation *igt_pvr_allocate(int fd, uint32_t vm_ctx, size_t size, uint64_t flags,
 					    uint32_t heap_index);
-struct igt_pvr_allocation *igt_pvr_allocate_general(int fd, uint32_t vm_ctx, size_t size);
+struct igt_pvr_allocation *igt_pvr_allocate_general(int fd, uint32_t vm_ctx, size_t size,
+					    uint64_t flags);
 void *igt_pvr_get_cpu_addr(int fd, struct igt_pvr_allocation *alloc);
 uint64_t igt_pvr_get_gpu_addr(struct igt_pvr_allocation *alloc);
 size_t igt_pvr_get_size(struct igt_pvr_allocation *alloc);
tests/imagination/pvr_submit_jobs.c +10 -3
index 566f9d2b2..21ccb03fd 100644
@@ -52,7 +52,10 @@ static uint32_t init_compute_cmd_stream(int fd, uint32_t vm_ctx,
 	void *cdm_stream_map;
 	uint32_t stream_length;
 
-	struct igt_pvr_allocation *cdm_stream_alloc = igt_pvr_allocate_general(fd, vm_ctx, 0x1000);
+	struct igt_pvr_allocation *cdm_stream_alloc =
+		igt_pvr_allocate_general(fd, vm_ctx, 0x1000,
+				         DRM_PVR_BO_ALLOW_CPU_USERSPACE_ACCESS |
+				         DRM_PVR_BO_BYPASS_DEVICE_CACHE);
 
 	cdm_stream_gpu_addr = igt_pvr_get_gpu_addr(cdm_stream_alloc);
 
@@ -212,14 +215,18 @@ int igt_main()
 		pds_buffer_base[0x20] = pds_inst_encode_halt();
 
 		vdm_alloc =
-			igt_pvr_allocate_general(fd, render_vm_ctx_handle, size);
+			igt_pvr_allocate_general(fd, render_vm_ctx_handle, size,
+						 DRM_PVR_BO_ALLOW_CPU_USERSPACE_ACCESS |
+						 DRM_PVR_BO_BYPASS_DEVICE_CACHE);
 
 		vdm_buffer = igt_pvr_get_cpu_addr(fd, vdm_alloc);
 
 		size = PVR_BO_SIZE;
 
 		ppp_alloc =
-			igt_pvr_allocate_general(fd, render_vm_ctx_handle, size);
+			igt_pvr_allocate_general(fd, render_vm_ctx_handle, size,
+						 DRM_PVR_BO_ALLOW_CPU_USERSPACE_ACCESS |
+						 DRM_PVR_BO_BYPASS_DEVICE_CACHE);
 
 		ppp_buffer_base = igt_pvr_get_cpu_addr(fd, ppp_alloc);
 
#3 lore raw

Re: [PATCH i-g-t v2 1/3] lib/igt_pvr: Update general heap allocation interface to pass flags

Hi Luigi,

Quoted 15 lines · Luigi Santivetti
Quoted 3 lines · Brajesh Gupta

Update igt_pvr_allocate_general() interface to pass flags for allocation.

Only a minor nit below.

Quoted 6 lines
---
 lib/igt_pvr.c                       | 39 ++++++++++++++++++++++++-------------
 lib/igt_pvr.h                       |  3 ++-
 tests/imagination/pvr_submit_jobs.c | 13 ++++++++++---
 3 files changed, 37 insertions(+), 18 deletions(-)
Quoted 15 lines

lib/igt_pvr.c uint32_t igt_pvr_ioctl_create_context(int fd, enum drm_pvr_ctx_type type, · line 400

Quoted 12 lines
lib/igt_pvr.c +1 -3
index 799852da5..22b0c2775 100644
@@ -397,9 +397,10 @@ uint32_t igt_pvr_ioctl_create_context(int fd, enum drm_pvr_ctx_type type,
 	switch (type) {
 	case DRM_PVR_CTX_TYPE_RENDER:
 		create_context_args.callstack_addr =
-			igt_pvr_get_gpu_addr(igt_pvr_allocate_general(fd,
-								      vm_ctx_handle,
-								      POWERVR_GPU_PAGE_SIZE));
+			igt_pvr_get_gpu_addr(igt_pvr_allocate_general(fd, vm_ctx_handle,

nit: I'd not move vm_ctx_handle.

Brajesh, please correct this, add r-b to patches were you got it and resend.

Regards,
Kamil

Quoted 122 lines
Quoted 121 lines
lib/igt_pvr.c +24 -11
+								      POWERVR_GPU_PAGE_SIZE,
+								      DRM_PVR_BO_ALLOW_CPU_USERSPACE_ACCESS |
+								      DRM_PVR_BO_BYPASS_DEVICE_CACHE));
 		create_context_args.static_context_state = to_user_pointer(init_render_context_stream);
 		create_context_args.static_context_state_len =
 			init_render_context_state_stream(init_render_context_stream);
@@ -673,17 +674,15 @@ struct igt_pvr_allocation *igt_pvr_allocate(int fd, uint32_t vm_ctx, size_t size
  * @fd: The file descriptor of the DRM device.
  * @vm_ctx: The virtual memory context.
  * @size: The size of the allocation.
+ * @flags: Allocation flags.
  *
  * Function to allocate and map GPU memory from the general heap.
  *
  * Returns: Pointer to the allocation structure.
  */
-struct igt_pvr_allocation *igt_pvr_allocate_general(int fd, uint32_t vm_ctx, size_t size)
+struct igt_pvr_allocation *igt_pvr_allocate_general(int fd, uint32_t vm_ctx, size_t size, uint64_t flags)
 {
-	return igt_pvr_allocate(fd, vm_ctx, size,
-				DRM_PVR_BO_ALLOW_CPU_USERSPACE_ACCESS |
-				DRM_PVR_BO_BYPASS_DEVICE_CACHE,
-				DRM_PVR_HEAP_GENERAL);
+	return igt_pvr_allocate(fd, vm_ctx, size, flags, DRM_PVR_HEAP_GENERAL);
 }
 
 /**
@@ -817,11 +816,17 @@ static void igt_pvr_create_hwrt_geom_data_args(int fd, uint32_t vm_ctx,
 					       *geom_data_args)
 {
 	geom_data_args->rtc_dev_addr =
-		igt_pvr_get_gpu_addr(igt_pvr_allocate_general(fd, vm_ctx, POWERVR_GPU_PAGE_SIZE));
+		igt_pvr_get_gpu_addr(igt_pvr_allocate_general(fd, vm_ctx, POWERVR_GPU_PAGE_SIZE,
+							      DRM_PVR_BO_ALLOW_CPU_USERSPACE_ACCESS |
+							      DRM_PVR_BO_BYPASS_DEVICE_CACHE));
 	geom_data_args->tpc_dev_addr =
-		igt_pvr_get_gpu_addr(igt_pvr_allocate_general(fd, vm_ctx, POWERVR_GPU_PAGE_SIZE));
+		igt_pvr_get_gpu_addr(igt_pvr_allocate_general(fd, vm_ctx, POWERVR_GPU_PAGE_SIZE,
+							      DRM_PVR_BO_ALLOW_CPU_USERSPACE_ACCESS |
+							      DRM_PVR_BO_BYPASS_DEVICE_CACHE));
 	geom_data_args->vheap_table_dev_addr =
-		igt_pvr_get_gpu_addr(igt_pvr_allocate_general(fd, vm_ctx, POWERVR_GPU_PAGE_SIZE));
+		igt_pvr_get_gpu_addr(igt_pvr_allocate_general(fd, vm_ctx, POWERVR_GPU_PAGE_SIZE,
+							      DRM_PVR_BO_ALLOW_CPU_USERSPACE_ACCESS |
+							      DRM_PVR_BO_BYPASS_DEVICE_CACHE));
 	geom_data_args->tpc_size = POWERVR_GPU_PAGE_SIZE;
 	geom_data_args->tpc_stride = 0x1;
 }
@@ -839,11 +844,17 @@ static void igt_pvr_create_hwrt_rt_data_args(int fd, uint32_t vm_ctx,
 					     struct drm_pvr_create_hwrt_rt_data_args *rt_data_args)
 {
 	rt_data_args->pm_mlist_dev_addr =
-		igt_pvr_get_gpu_addr(igt_pvr_allocate_general(fd, vm_ctx, POWERVR_GPU_PAGE_SIZE));
+		igt_pvr_get_gpu_addr(igt_pvr_allocate_general(fd, vm_ctx, POWERVR_GPU_PAGE_SIZE,
+							      DRM_PVR_BO_ALLOW_CPU_USERSPACE_ACCESS |
+							      DRM_PVR_BO_BYPASS_DEVICE_CACHE));
 	rt_data_args->macrotile_array_dev_addr =
-		igt_pvr_get_gpu_addr(igt_pvr_allocate_general(fd, vm_ctx, POWERVR_GPU_PAGE_SIZE));
+		igt_pvr_get_gpu_addr(igt_pvr_allocate_general(fd, vm_ctx, POWERVR_GPU_PAGE_SIZE,
+							      DRM_PVR_BO_ALLOW_CPU_USERSPACE_ACCESS |
+							      DRM_PVR_BO_BYPASS_DEVICE_CACHE));
 	rt_data_args->region_header_dev_addr =
-		igt_pvr_get_gpu_addr(igt_pvr_allocate_general(fd, vm_ctx, POWERVR_GPU_PAGE_SIZE));
+		igt_pvr_get_gpu_addr(igt_pvr_allocate_general(fd, vm_ctx, POWERVR_GPU_PAGE_SIZE,
+							      DRM_PVR_BO_ALLOW_CPU_USERSPACE_ACCESS |
+							      DRM_PVR_BO_BYPASS_DEVICE_CACHE));
 }
 
 /**
lib/igt_pvr.h +2 -1
index b6e3dd676..bed02f968 100644
@@ -67,7 +67,8 @@ struct igt_pvr_allocation *igt_pvr_allocate_addr(int fd, uint32_t vm_ctx, size_t
 						 uint64_t flags, uint64_t gpu_addr);
 struct igt_pvr_allocation *igt_pvr_allocate(int fd, uint32_t vm_ctx, size_t size, uint64_t flags,
 					    uint32_t heap_index);
-struct igt_pvr_allocation *igt_pvr_allocate_general(int fd, uint32_t vm_ctx, size_t size);
+struct igt_pvr_allocation *igt_pvr_allocate_general(int fd, uint32_t vm_ctx, size_t size,
+					    uint64_t flags);
 void *igt_pvr_get_cpu_addr(int fd, struct igt_pvr_allocation *alloc);
 uint64_t igt_pvr_get_gpu_addr(struct igt_pvr_allocation *alloc);
 size_t igt_pvr_get_size(struct igt_pvr_allocation *alloc);
tests/imagination/pvr_submit_jobs.c +10 -3
index 566f9d2b2..21ccb03fd 100644
@@ -52,7 +52,10 @@ static uint32_t init_compute_cmd_stream(int fd, uint32_t vm_ctx,
 	void *cdm_stream_map;
 	uint32_t stream_length;
 
-	struct igt_pvr_allocation *cdm_stream_alloc = igt_pvr_allocate_general(fd, vm_ctx, 0x1000);
+	struct igt_pvr_allocation *cdm_stream_alloc =
+		igt_pvr_allocate_general(fd, vm_ctx, 0x1000,
+				         DRM_PVR_BO_ALLOW_CPU_USERSPACE_ACCESS |
+				         DRM_PVR_BO_BYPASS_DEVICE_CACHE);
 
 	cdm_stream_gpu_addr = igt_pvr_get_gpu_addr(cdm_stream_alloc);
 
@@ -212,14 +215,18 @@ int igt_main()
 		pds_buffer_base[0x20] = pds_inst_encode_halt();
 
 		vdm_alloc =
-			igt_pvr_allocate_general(fd, render_vm_ctx_handle, size);
+			igt_pvr_allocate_general(fd, render_vm_ctx_handle, size,
+						 DRM_PVR_BO_ALLOW_CPU_USERSPACE_ACCESS |
+						 DRM_PVR_BO_BYPASS_DEVICE_CACHE);
 
 		vdm_buffer = igt_pvr_get_cpu_addr(fd, vdm_alloc);
 
 		size = PVR_BO_SIZE;
 
 		ppp_alloc =
-			igt_pvr_allocate_general(fd, render_vm_ctx_handle, size);
+			igt_pvr_allocate_general(fd, render_vm_ctx_handle, size,
+						 DRM_PVR_BO_ALLOW_CPU_USERSPACE_ACCESS |
+						 DRM_PVR_BO_BYPASS_DEVICE_CACHE);
 
 		ppp_buffer_base = igt_pvr_get_cpu_addr(fd, ppp_alloc);
 
#4 lore raw

PATCH v2 2/3 imagination: Skip CPU access flag for a few Render related allocations

In reply to Brajesh Gupta

Skip passing CPU access flag for BO's that don't need host access.

---
 lib/igt_pvr.c | 7 -------
 1 file changed, 7 deletions(-)
lib/igt_pvr.c +0 -7
index 22b0c2775..dbad69758 100644
@@ -399,7 +399,6 @@ uint32_t igt_pvr_ioctl_create_context(int fd, enum drm_pvr_ctx_type type,
 		create_context_args.callstack_addr =
 			igt_pvr_get_gpu_addr(igt_pvr_allocate_general(fd, vm_ctx_handle,
 								      POWERVR_GPU_PAGE_SIZE,
-								      DRM_PVR_BO_ALLOW_CPU_USERSPACE_ACCESS |
 								      DRM_PVR_BO_BYPASS_DEVICE_CACHE));
 		create_context_args.static_context_state = to_user_pointer(init_render_context_stream);
 		create_context_args.static_context_state_len =
@@ -817,15 +816,12 @@ static void igt_pvr_create_hwrt_geom_data_args(int fd, uint32_t vm_ctx,
 {
 	geom_data_args->rtc_dev_addr =
 		igt_pvr_get_gpu_addr(igt_pvr_allocate_general(fd, vm_ctx, POWERVR_GPU_PAGE_SIZE,
-							      DRM_PVR_BO_ALLOW_CPU_USERSPACE_ACCESS |
 							      DRM_PVR_BO_BYPASS_DEVICE_CACHE));
 	geom_data_args->tpc_dev_addr =
 		igt_pvr_get_gpu_addr(igt_pvr_allocate_general(fd, vm_ctx, POWERVR_GPU_PAGE_SIZE,
-							      DRM_PVR_BO_ALLOW_CPU_USERSPACE_ACCESS |
 							      DRM_PVR_BO_BYPASS_DEVICE_CACHE));
 	geom_data_args->vheap_table_dev_addr =
 		igt_pvr_get_gpu_addr(igt_pvr_allocate_general(fd, vm_ctx, POWERVR_GPU_PAGE_SIZE,
-							      DRM_PVR_BO_ALLOW_CPU_USERSPACE_ACCESS |
 							      DRM_PVR_BO_BYPASS_DEVICE_CACHE));
 	geom_data_args->tpc_size = POWERVR_GPU_PAGE_SIZE;
 	geom_data_args->tpc_stride = 0x1;
@@ -845,15 +841,12 @@ static void igt_pvr_create_hwrt_rt_data_args(int fd, uint32_t vm_ctx,
 {
 	rt_data_args->pm_mlist_dev_addr =
 		igt_pvr_get_gpu_addr(igt_pvr_allocate_general(fd, vm_ctx, POWERVR_GPU_PAGE_SIZE,
-							      DRM_PVR_BO_ALLOW_CPU_USERSPACE_ACCESS |
 							      DRM_PVR_BO_BYPASS_DEVICE_CACHE));
 	rt_data_args->macrotile_array_dev_addr =
 		igt_pvr_get_gpu_addr(igt_pvr_allocate_general(fd, vm_ctx, POWERVR_GPU_PAGE_SIZE,
-							      DRM_PVR_BO_ALLOW_CPU_USERSPACE_ACCESS |
 							      DRM_PVR_BO_BYPASS_DEVICE_CACHE));
 	rt_data_args->region_header_dev_addr =
 		igt_pvr_get_gpu_addr(igt_pvr_allocate_general(fd, vm_ctx, POWERVR_GPU_PAGE_SIZE,
-							      DRM_PVR_BO_ALLOW_CPU_USERSPACE_ACCESS |
 							      DRM_PVR_BO_BYPASS_DEVICE_CACHE));
 }
 
Signature · 1 line
2.43.0
Reviewed-by on v2 2/3
#5 lore raw

Re: [PATCH i-g-t v2 2/3] imagination: Skip CPU access flag for a few Render related allocations

Quoted 3 lines · Brajesh Gupta

Skip passing CPU access flag for BO's that don't need host access.

Quoted 49 lines
---
 lib/igt_pvr.c | 7 -------
 1 file changed, 7 deletions(-)
lib/igt_pvr.c +0 -7
index 22b0c2775..dbad69758 100644
@@ -399,7 +399,6 @@ uint32_t igt_pvr_ioctl_create_context(int fd, enum drm_pvr_ctx_type type,
 		create_context_args.callstack_addr =
 			igt_pvr_get_gpu_addr(igt_pvr_allocate_general(fd, vm_ctx_handle,
 								      POWERVR_GPU_PAGE_SIZE,
-								      DRM_PVR_BO_ALLOW_CPU_USERSPACE_ACCESS |
 								      DRM_PVR_BO_BYPASS_DEVICE_CACHE));
 		create_context_args.static_context_state = to_user_pointer(init_render_context_stream);
 		create_context_args.static_context_state_len =
@@ -817,15 +816,12 @@ static void igt_pvr_create_hwrt_geom_data_args(int fd, uint32_t vm_ctx,
 {
 	geom_data_args->rtc_dev_addr =
 		igt_pvr_get_gpu_addr(igt_pvr_allocate_general(fd, vm_ctx, POWERVR_GPU_PAGE_SIZE,
-							      DRM_PVR_BO_ALLOW_CPU_USERSPACE_ACCESS |
 							      DRM_PVR_BO_BYPASS_DEVICE_CACHE));
 	geom_data_args->tpc_dev_addr =
 		igt_pvr_get_gpu_addr(igt_pvr_allocate_general(fd, vm_ctx, POWERVR_GPU_PAGE_SIZE,
-							      DRM_PVR_BO_ALLOW_CPU_USERSPACE_ACCESS |
 							      DRM_PVR_BO_BYPASS_DEVICE_CACHE));
 	geom_data_args->vheap_table_dev_addr =
 		igt_pvr_get_gpu_addr(igt_pvr_allocate_general(fd, vm_ctx, POWERVR_GPU_PAGE_SIZE,
-							      DRM_PVR_BO_ALLOW_CPU_USERSPACE_ACCESS |
 							      DRM_PVR_BO_BYPASS_DEVICE_CACHE));
 	geom_data_args->tpc_size = POWERVR_GPU_PAGE_SIZE;
 	geom_data_args->tpc_stride = 0x1;
@@ -845,15 +841,12 @@ static void igt_pvr_create_hwrt_rt_data_args(int fd, uint32_t vm_ctx,
 {
 	rt_data_args->pm_mlist_dev_addr =
 		igt_pvr_get_gpu_addr(igt_pvr_allocate_general(fd, vm_ctx, POWERVR_GPU_PAGE_SIZE,
-							      DRM_PVR_BO_ALLOW_CPU_USERSPACE_ACCESS |
 							      DRM_PVR_BO_BYPASS_DEVICE_CACHE));
 	rt_data_args->macrotile_array_dev_addr =
 		igt_pvr_get_gpu_addr(igt_pvr_allocate_general(fd, vm_ctx, POWERVR_GPU_PAGE_SIZE,
-							      DRM_PVR_BO_ALLOW_CPU_USERSPACE_ACCESS |
 							      DRM_PVR_BO_BYPASS_DEVICE_CACHE));
 	rt_data_args->region_header_dev_addr =
 		igt_pvr_get_gpu_addr(igt_pvr_allocate_general(fd, vm_ctx, POWERVR_GPU_PAGE_SIZE,
-							      DRM_PVR_BO_ALLOW_CPU_USERSPACE_ACCESS |
 							      DRM_PVR_BO_BYPASS_DEVICE_CACHE));
 }
 
#6 lore raw

PATCH v2 3/3 lib/igt_pvr: Pass DRM_PVR_BO_PM_FW_PROTECT flag for PM MList allocation

In reply to Brajesh Gupta

Pass DRM_PVR_BO_PM_FW_PROTECT flag for PM MList allocation to indicate only PM/FW allowed to access the memory.

---
 lib/igt_pvr.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
lib/igt_pvr.c +2 -1
index dbad69758..4a5fef2ae 100644
@@ -841,7 +841,8 @@ static void igt_pvr_create_hwrt_rt_data_args(int fd, uint32_t vm_ctx,
 {
 	rt_data_args->pm_mlist_dev_addr =
 		igt_pvr_get_gpu_addr(igt_pvr_allocate_general(fd, vm_ctx, POWERVR_GPU_PAGE_SIZE,
-							      DRM_PVR_BO_BYPASS_DEVICE_CACHE));
+							      DRM_PVR_BO_BYPASS_DEVICE_CACHE |
+							      DRM_PVR_BO_PM_FW_PROTECT));
 	rt_data_args->macrotile_array_dev_addr =
 		igt_pvr_get_gpu_addr(igt_pvr_allocate_general(fd, vm_ctx, POWERVR_GPU_PAGE_SIZE,
 							      DRM_PVR_BO_BYPASS_DEVICE_CACHE));
Signature · 1 line
2.43.0
#7 lore raw
In reply to Brajesh Gupta

Hi Brajesh,

Quoted 1 line · Brajesh Gupta

Update BO allocation flags to match expectation:

Sorry, what would those expectations be with respect to upstream?

I take IGT has always been broken, but nothing has really changed recently with regard to PM/FW protect?!

Perhaps it's worth adding a description of what makes (or doesn't) the flag needed in patch [3/3] commit message, especially as we expect to extend the heaps in the future I can see how easy is to generate confusion around this area. I'd suggest to describe rather precisely what it is that requires the new flag so we keep good records.

Thank you!

Quoted 29 lines

- Remove the CPU_ACCESS flag from BOs that are not host-accessed.
- Use DRM_PVR_BO_PM_FW_PROTECT for MList allocations.

---
Changes in v2:
- Update as per Kamil's feedback.
- Updated description to map commits are specific to Imagination.
- Spilt lib/igt change to two: Interface update and flags update.
- Link to v1: https://patch.msgid.link/[email protected]

---
Brajesh Gupta (3):
lib/igt_pvr: Update general heap allocation interface to pass flags
imagination: Skip CPU access flag for a few Render related allocations lib/igt_pvr: Pass DRM_PVR_BO_PM_FW_PROTECT flag for PM MList allocation

 lib/igt_pvr.c                       | 33 +++++++++++++++++++--------------
 lib/igt_pvr.h                       |  3 ++-
 tests/imagination/pvr_submit_jobs.c | 13 ++++++++++---
 3 files changed, 31 insertions(+), 18 deletions(-)

---
base-commit: fc75d6d7ffcb79e8a3316e80c7085460568a7670
change-id: 20261029-b4-render_update-79d0cf70eb0e

Best regards,

Signature · 1 line
Brajesh Gupta <[email protected]>
#8 lore raw

On Thu, 2026-10-29 at 17:07 +0000, Luigi Santivetti wrote:
Hi Luigi,

Quoted 11 lines

*** NOTE: This is an internal email from Imagination Technologies ***

Hi Brajesh,

Quoted 1 line · Brajesh Gupta

Update BO allocation flags to match expectation:

Sorry, what would those expectations be with respect to upstream?

I was referring to generic expectations:
- If a BO doesn't need access from the host, then don't pass the flag CPU_ACCESS flag. It gives options to driver to adjust things when required.
- For DRM_PVR_BO_PM_FW_PROTECT flag, just following guidance to pass this flag for any BO which be accessed by either Parameter Manager and/or Firmware. Update is to pass the flag for MList in the same way it was passed for Free List allocation.

Quoted 3 lines

I take IGT has always been broken, but nothing has really changed recently with regard to PM/FW protect?!

Nothing is broken at this point and pvr_submit_test test is passing.

Quoted 7 lines

Perhaps it's worth adding a description of what makes (or doesn't) the flag needed in patch [3/3] commit message, especially as we expect to extend the heaps in the future I can see how easy is to generate confusion around this area. I'd suggest to describe rather precisely what it is that requires the new flag so we keep good records.

I think it will better to hold on patch[3] change till kernel driver adds support for PM_FW_PROTECT flag.

Thanks,
Brajesh

Quoted 32 lines

Thank you!

Quoted 29 lines

- Remove the CPU_ACCESS flag from BOs that are not host-accessed.
- Use DRM_PVR_BO_PM_FW_PROTECT for MList allocations.

---
Changes in v2:
- Update as per Kamil's feedback.
- Updated description to map commits are specific to Imagination.
- Spilt lib/igt change to two: Interface update and flags update.
- Link to v1: https://patch.msgid.link/[email protected]

---
Brajesh Gupta (3):
lib/igt_pvr: Update general heap allocation interface to pass flags
imagination: Skip CPU access flag for a few Render related allocations lib/igt_pvr: Pass DRM_PVR_BO_PM_FW_PROTECT flag for PM MList allocation

 lib/igt_pvr.c                       | 33 +++++++++++++++++++--------------
 lib/igt_pvr.h                       |  3 ++-
 tests/imagination/pvr_submit_jobs.c | 13 ++++++++++---
 3 files changed, 31 insertions(+), 18 deletions(-)

---
base-commit: fc75d6d7ffcb79e8a3316e80c7085460568a7670
change-id: 20261029-b4-render_update-79d0cf70eb0e

Best regards,
--
Brajesh Gupta <[email protected]>

#9 lore raw

Hi Brajesh,

Quoted 25 lines · Brajesh Gupta

On Thu, 2026-10-29 at 17:07 +0000, Luigi Santivetti wrote:
Hi Luigi,

Quoted 11 lines

*** NOTE: This is an internal email from Imagination Technologies ***

Hi Brajesh,

Quoted 1 line · Brajesh Gupta

Update BO allocation flags to match expectation:

Sorry, what would those expectations be with respect to upstream?

I was referring to generic expectations:
- If a BO doesn't need access from the host, then don't pass the flag CPU_ACCESS flag. It gives options to driver to adjust things when required.
- For DRM_PVR_BO_PM_FW_PROTECT flag, just following guidance to pass this flag for any BO which be accessed by either Parameter Manager and/or Firmware. Update is to pass the flag for MList in the same way it was passed for Free List allocation.

Quoted 3 lines

I take IGT has always been broken, but nothing has really changed recently with regard to PM/FW protect?!

Nothing is broken at this point and pvr_submit_test test is passing.

Quoted 1 line
Quoted 9 lines
Quoted 6 lines

Perhaps it's worth adding a description of what makes (or doesn't) the flag needed in patch [3/3] commit message, especially as we expect to extend the heaps in the future I can see how easy is to generate confusion around this area. I'd suggest to describe rather precisely what it is that requires the new flag so we keep good records.

I think it will better to hold on patch[3] change till kernel driver adds support for PM_FW_PROTECT flag.

Okay,
Thanks

Quoted 35 lines

Thanks,
Brajesh

Quoted 32 lines

Thank you!

Quoted 29 lines

- Remove the CPU_ACCESS flag from BOs that are not host-accessed.
- Use DRM_PVR_BO_PM_FW_PROTECT for MList allocations.

---
Changes in v2:
- Update as per Kamil's feedback.
- Updated description to map commits are specific to Imagination.
- Spilt lib/igt change to two: Interface update and flags update.
- Link to v1: https://patch.msgid.link/[email protected]

---
Brajesh Gupta (3):
lib/igt_pvr: Update general heap allocation interface to pass flags
imagination: Skip CPU access flag for a few Render related allocations lib/igt_pvr: Pass DRM_PVR_BO_PM_FW_PROTECT flag for PM MList allocation

 lib/igt_pvr.c                       | 33 +++++++++++++++++++--------------
 lib/igt_pvr.h                       |  3 ++-
 tests/imagination/pvr_submit_jobs.c | 13 ++++++++++---
 3 files changed, 31 insertions(+), 18 deletions(-)

---
base-commit: fc75d6d7ffcb79e8a3316e80c7085460568a7670
change-id: 20261029-b4-render_update-79d0cf70eb0e

Best regards,
--
Brajesh Gupta <[email protected]>