Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Ashutosh Dixit <ashutosh.dixit@intel.com>
To: intel-xe@lists.freedesktop.org
Subject: [Intel-xe] [PATCH 10/10] drm/xe/oa: Implement queries
Date: Thu, 20 Jul 2023 17:30:06 -0700	[thread overview]
Message-ID: <20230721003006.3467377-11-ashutosh.dixit@intel.com> (raw)
In-Reply-To: <20230721003006.3467377-1-ashutosh.dixit@intel.com>

Implement queries to query OA unit ID's for HW engines, OA timestamp freq
and OA ioctl version.

Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
---
 drivers/gpu/drm/xe/xe_oa.c    | 11 +++++++++++
 drivers/gpu/drm/xe/xe_oa.h    |  3 +++
 drivers/gpu/drm/xe/xe_query.c |  5 ++++-
 3 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/xe/xe_oa.c b/drivers/gpu/drm/xe/xe_oa.c
index 163f057213258..8be7f6cf17930 100644
--- a/drivers/gpu/drm/xe/xe_oa.c
+++ b/drivers/gpu/drm/xe/xe_oa.c
@@ -2221,6 +2221,12 @@ static int xe_oa_init_engine_groups(struct xe_oa *oa)
 	return 0;
 }
 
+u32 xe_oa_unit_id(struct xe_hw_engine *hwe)
+{
+	return hwe->oa_group && hwe->oa_group->num_engines ?
+		hwe->oa_group->oa_unit_id : U32_MAX;
+}
+
 static void oa_format_add(struct xe_oa *oa, enum drm_xe_oa_format format)
 {
 	__set_bit(format, oa->format_mask);
@@ -2335,6 +2341,11 @@ static struct ctl_table oa_ctl_table[] = {
 	{}
 };
 
+int xe_oa_ioctl_version(struct xe_device *xe)
+{
+	return 1;
+}
+
 int xe_oa_sysctl_register(void)
 {
 	sysctl_header = register_sysctl("dev/xe", oa_ctl_table);
diff --git a/drivers/gpu/drm/xe/xe_oa.h b/drivers/gpu/drm/xe/xe_oa.h
index fd6caf652047a..41a7d8b0f10e1 100644
--- a/drivers/gpu/drm/xe/xe_oa.h
+++ b/drivers/gpu/drm/xe/xe_oa.h
@@ -22,4 +22,7 @@ int xe_oa_add_config_ioctl(struct drm_device *dev, void *data,
 			   struct drm_file *file);
 int xe_oa_remove_config_ioctl(struct drm_device *dev, void *data,
 			      struct drm_file *file);
+u32 xe_oa_timestamp_frequency(struct xe_device *xe);
+u32 xe_oa_unit_id(struct xe_hw_engine *hwe);
+
 #endif
diff --git a/drivers/gpu/drm/xe/xe_query.c b/drivers/gpu/drm/xe/xe_query.c
index f880c9af1651a..8acde018650cc 100644
--- a/drivers/gpu/drm/xe/xe_query.c
+++ b/drivers/gpu/drm/xe/xe_query.c
@@ -77,7 +77,8 @@ static int query_engines(struct xe_device *xe,
 				xe_to_user_engine_class[hwe->class];
 			hw_engine_info[i].engine_instance =
 				hwe->logical_instance;
-			hw_engine_info[i++].gt_id = gt->info.id;
+			hw_engine_info[i].gt_id = gt->info.id;
+			hw_engine_info[i++].oa_unit_id = xe_oa_unit_id(hwe);
 		}
 
 	if (copy_to_user(query_ptr, hw_engine_info, size)) {
@@ -203,6 +204,7 @@ static int query_config(struct xe_device *xe, struct drm_xe_device_query *query)
 		hweight_long(xe->info.mem_region_mask);
 	config->info[XE_QUERY_CONFIG_MAX_ENGINE_PRIORITY] =
 		xe_engine_device_get_max_priority(xe);
+	config->info[XE_QUERY_OA_IOCTL_VERSION] = xe_oa_ioctl_version(xe);
 
 	if (copy_to_user(query_ptr, config, size)) {
 		kfree(config);
@@ -244,6 +246,7 @@ static int query_gts(struct xe_device *xe, struct drm_xe_device_query *query)
 			gts->gts[id].type = XE_QUERY_GT_TYPE_MAIN;
 		gts->gts[id].instance = id;
 		gts->gts[id].clock_freq = gt->info.clock_freq;
+		gts->gts[id].oa_timestamp_freq = xe_oa_timestamp_frequency(xe);
 		if (!IS_DGFX(xe))
 			gts->gts[id].native_mem_regions = 0x1;
 		else
-- 
2.41.0


  parent reply	other threads:[~2023-07-21  0:30 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-21  0:29 [Intel-xe] [PATCH 00/10] Add OA functionality to Xe Ashutosh Dixit
2023-07-21  0:29 ` [Intel-xe] [PATCH 01/10] drm/xe/oa: Introduce OA uapi Ashutosh Dixit
2023-07-21  0:29 ` [Intel-xe] [PATCH 02/10] drm/xe/oa: Add OA types Ashutosh Dixit
2023-07-21  0:29 ` [Intel-xe] [PATCH 03/10] drm/xe/oa: Add registers and GPU commands used by OA Ashutosh Dixit
2023-07-21  0:30 ` [Intel-xe] [PATCH 04/10] drm/xe/oa: Module init/exit and probe/remove Ashutosh Dixit
2023-07-21  0:30 ` [Intel-xe] [PATCH 05/10] drm/xe/oa: Add/remove config ioctl's Ashutosh Dixit
2023-07-21  0:30 ` [Intel-xe] [PATCH 06/10] drm/xe/oa: Start implementing OA stream open ioctl Ashutosh Dixit
2023-07-21  0:30 ` [Intel-xe] [PATCH 07/10] drm/xe/oa: OA stream initialization Ashutosh Dixit
2023-07-21  0:30 ` [Intel-xe] [PATCH 08/10] drm/xe/oa: Expose OA stream fd Ashutosh Dixit
2023-07-21  0:30 ` [Intel-xe] [PATCH 09/10] drm/xe/oa: Read file_operation Ashutosh Dixit
2023-07-21  0:30 ` Ashutosh Dixit [this message]
2023-07-21  0:32 ` [Intel-xe] ✓ CI.Patch_applied: success for Add OA functionality to Xe Patchwork
2023-07-21  0:32 ` [Intel-xe] ✗ CI.checkpatch: warning " Patchwork
2023-07-21  0:34 ` [Intel-xe] ✓ CI.KUnit: success " Patchwork
2023-07-21  0:36 ` [Intel-xe] ✗ CI.Build: failure " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2023-07-21  2:28 [Intel-xe] [PATCH v2 00/10] " Ashutosh Dixit
2023-07-21  2:28 ` [Intel-xe] [PATCH 10/10] drm/xe/oa: Implement queries Ashutosh Dixit
2023-08-08  1:31 [Intel-xe] [PATCH 00/10] Add OA functionality to Xe Ashutosh Dixit
2023-08-08  1:31 ` [Intel-xe] [PATCH 10/10] drm/xe/oa: Implement queries Ashutosh Dixit
2023-08-22 15:55   ` Umesh Nerlige Ramappa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230721003006.3467377-11-ashutosh.dixit@intel.com \
    --to=ashutosh.dixit@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox