Re: [PATCH v2 RESEND 1/5] drm: panthor: expose some fw information through the query ioctl

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Daniel,

On 21/08/2024 15:37, Daniel Almeida wrote:
This is of interest to userspace, and similar in nature to the GPU
and CSIF information we already return in the query ioctl.

Signed-off-by: Daniel Almeida <daniel.almeida@xxxxxxxxxxxxx>
---
  drivers/gpu/drm/panthor/panthor_device.h |  3 +++
  drivers/gpu/drm/panthor/panthor_drv.c    |  8 ++++++++
  drivers/gpu/drm/panthor/panthor_sched.c  |  5 +++++
  include/uapi/drm/panthor_drm.h           | 19 +++++++++++++++++++
  4 files changed, 35 insertions(+)

diff --git a/drivers/gpu/drm/panthor/panthor_device.h b/drivers/gpu/drm/panthor/panthor_device.h
index e388c0472ba7..224c53dcfe6d 100644
--- a/drivers/gpu/drm/panthor/panthor_device.h
+++ b/drivers/gpu/drm/panthor/panthor_device.h
@@ -100,6 +100,9 @@ struct panthor_device {
  	/** @csif_info: Command stream interface information. */
  	struct drm_panthor_csif_info csif_info;
+ /** @fw_info: Firmware info for the global interface */
+	struct drm_panthor_fw_info fw_info;
+
  	/** @gpu: GPU management data. */
  	struct panthor_gpu *gpu;
diff --git a/drivers/gpu/drm/panthor/panthor_drv.c b/drivers/gpu/drm/panthor/panthor_drv.c
index b8a84f26b3ef..fb30e119d9bf 100644
--- a/drivers/gpu/drm/panthor/panthor_drv.c
+++ b/drivers/gpu/drm/panthor/panthor_drv.c
@@ -164,6 +164,7 @@ panthor_get_uobj_array(const struct drm_panthor_obj_array *in, u32 min_stride,
  	_Generic(_obj_name, \
  		 PANTHOR_UOBJ_DECL(struct drm_panthor_gpu_info, tiler_present), \
  		 PANTHOR_UOBJ_DECL(struct drm_panthor_csif_info, pad), \
+		 PANTHOR_UOBJ_DECL(struct drm_panthor_fw_info, instr_features), \
  		 PANTHOR_UOBJ_DECL(struct drm_panthor_sync_op, timeline_value), \
  		 PANTHOR_UOBJ_DECL(struct drm_panthor_queue_submit, syncs), \
  		 PANTHOR_UOBJ_DECL(struct drm_panthor_queue_create, ringbuf_size), \
@@ -765,6 +766,10 @@ static int panthor_ioctl_dev_query(struct drm_device *ddev, void *data, struct d
  			args->size = sizeof(ptdev->csif_info);
  			return 0;
+ case DRM_PANTHOR_DEV_QUERY_FW_INFO:
+			args->size = sizeof(ptdev->fw_info);
+			return 0;
+
  		default:
  			return -EINVAL;
  		}
@@ -777,6 +782,9 @@ static int panthor_ioctl_dev_query(struct drm_device *ddev, void *data, struct d
  	case DRM_PANTHOR_DEV_QUERY_CSIF_INFO:
  		return PANTHOR_UOBJ_SET(args->pointer, args->size, ptdev->csif_info);
+ case DRM_PANTHOR_DEV_QUERY_FW_INFO:
+		return PANTHOR_UOBJ_SET(args->pointer, args->size, ptdev->fw_info);
+
  	default:
  		return -EINVAL;
  	}
diff --git a/drivers/gpu/drm/panthor/panthor_sched.c b/drivers/gpu/drm/panthor/panthor_sched.c
index 79ffcbc41d78..e0ecc8bcfaae 100644
--- a/drivers/gpu/drm/panthor/panthor_sched.c
+++ b/drivers/gpu/drm/panthor/panthor_sched.c
@@ -3495,6 +3495,11 @@ int panthor_sched_init(struct panthor_device *ptdev)
  	ptdev->csif_info.cs_slot_count = sched->cs_slot_count;
  	ptdev->csif_info.scoreboard_slot_count = sched->sb_slot_count;
+ ptdev->fw_info.version = glb_iface->control->version;
+	ptdev->fw_info.features = glb_iface->control->features;
+	ptdev->fw_info.group_num = glb_iface->control->group_num;
+	ptdev->fw_info.instr_features = glb_iface->control->instr_features;
+
  	sched->last_tick = 0;
  	sched->resched_target = U64_MAX;
  	sched->tick_period = msecs_to_jiffies(10);
diff --git a/include/uapi/drm/panthor_drm.h b/include/uapi/drm/panthor_drm.h
index aaed8e12ad0b..e235cf452460 100644
--- a/include/uapi/drm/panthor_drm.h
+++ b/include/uapi/drm/panthor_drm.h
@@ -260,6 +260,9 @@ enum drm_panthor_dev_query_type {
/** @DRM_PANTHOR_DEV_QUERY_CSIF_INFO: Query command-stream interface information. */
  	DRM_PANTHOR_DEV_QUERY_CSIF_INFO,
+
+	/** @DRM_PANTHOR_DEV_QUERY_FW_INFO: Query firmware information */
+	DRM_PANTHOR_DEV_QUERY_FW_INFO,
  };
/**
@@ -377,6 +380,22 @@ struct drm_panthor_csif_info {
  	__u32 pad;
  };
+/** struct drm_panthor_fw_info - FW information
+ *
+ * Structure grouping all queryable information relating to the global FW interface.
+ */
+
+struct drm_panthor_fw_info {
+	/** @version: Global interface version */
+	__u32 version;
+	/** @features: Global interface features */
+	__u32 features;
+	/** @group_num: Number of CSG interfaces */
+	__u32 group_num;
+	/** @instr_features: Instrumentation features */
+	__u32 instr_features;

This field doesn't appear to be used at all in this series or in the Mesa MR [1], besides decoding it. Can it be removed?

[1] https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30651

+};
+
  /**
   * struct drm_panthor_dev_query - Arguments passed to DRM_PANTHOR_IOCTL_DEV_QUERY
   */

--
Mihail Atanassov <mihail.atanassov@xxxxxxx>




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux