From: Jan Maslak <jan.maslak@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: dominik.grzegorzek@intel.com, jonathan.cavitt@intel.com,
matthew.d.roper@intel.com, Jan Maslak <jan.maslak@intel.com>
Subject: [PATCH 1/3] lib/xe_query: add hwconfig to xe_device
Date: Thu, 28 Nov 2024 13:05:01 +0000 [thread overview]
Message-ID: <20241128130503.241328-2-jan.maslak@intel.com> (raw)
In-Reply-To: <20241128130503.241328-1-jan.maslak@intel.com>
Add hwconfig and hwconfig_size to xe_device, so that it can be accessed
easier by the tests.
Thanks to this, hwconfig data will only be queried once and cached.
Signed-off-by: Jan Maslak <jan.maslak@intel.com>
Reviewed-by: Dominik Grzegorzek <dominik.grzegorzek@intel.com>
---
lib/xe/xe_query.c | 28 ++++++++++++++++++++++++++++
lib/xe/xe_query.h | 6 ++++++
2 files changed, 34 insertions(+)
diff --git a/lib/xe/xe_query.c b/lib/xe/xe_query.c
index 0c9cff066..49bed033b 100644
--- a/lib/xe/xe_query.c
+++ b/lib/xe/xe_query.c
@@ -39,6 +39,32 @@ static struct drm_xe_query_config *xe_query_config_new(int fd)
return config;
}
+static uint32_t *xe_query_hwconfig_new(int fd, uint32_t *hwconfig_size)
+{
+ uint32_t *hwconfig;
+ struct drm_xe_device_query query = {
+ .extensions = 0,
+ .query = DRM_XE_DEVICE_QUERY_HWCONFIG,
+ .size = 0,
+ .data = 0,
+ };
+
+ /* Perform the initial query to get the size */
+ igt_assert_eq(igt_ioctl(fd, DRM_IOCTL_XE_DEVICE_QUERY, &query), 0);
+ igt_assert_neq(query.size, 0);
+
+ hwconfig = malloc(query.size);
+ igt_assert(hwconfig);
+
+ query.data = to_user_pointer(hwconfig);
+
+ /* Perform the query to get the actual data */
+ igt_assert_eq(igt_ioctl(fd, DRM_IOCTL_XE_DEVICE_QUERY, &query), 0);
+
+ *hwconfig_size = query.size;
+ return hwconfig;
+}
+
static struct drm_xe_query_gt_list *xe_query_gt_list_new(int fd)
{
struct drm_xe_query_gt_list *gt_list;
@@ -239,6 +265,7 @@ static struct xe_device *find_in_cache(int fd)
static void xe_device_free(struct xe_device *xe_dev)
{
free(xe_dev->config);
+ free(xe_dev->hwconfig);
free(xe_dev->gt_list);
free(xe_dev->engines);
free(xe_dev->mem_regions);
@@ -268,6 +295,7 @@ struct xe_device *xe_device_get(int fd)
xe_dev->fd = fd;
xe_dev->config = xe_query_config_new(fd);
+ xe_dev->hwconfig = xe_query_hwconfig_new(fd, &xe_dev->hwconfig_size);
xe_dev->va_bits = xe_dev->config->info[DRM_XE_QUERY_CONFIG_VA_BITS];
xe_dev->dev_id = xe_dev->config->info[DRM_XE_QUERY_CONFIG_REV_AND_DEVICE_ID] & 0xffff;
xe_dev->gt_list = xe_query_gt_list_new(fd);
diff --git a/lib/xe/xe_query.h b/lib/xe/xe_query.h
index cabb8078c..f8836578e 100644
--- a/lib/xe/xe_query.h
+++ b/lib/xe/xe_query.h
@@ -26,6 +26,12 @@ struct xe_device {
/** @config: xe configuration */
struct drm_xe_query_config *config;
+ /** @hwconfig: xe hwconfig table data */
+ uint32_t *hwconfig;
+
+ /** @hwconfig_size: size of hwconfig in bytes */
+ uint32_t hwconfig_size;
+
/** @gt_list: gt info */
struct drm_xe_query_gt_list *gt_list;
--
2.34.1
next prev parent reply other threads:[~2024-11-28 13:05 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-28 13:05 [PATCH 0/3] tests/xe_eudebug_online: update thread count handling in query_attention_bitmask_size() Jan Maslak
2024-11-28 13:05 ` Jan Maslak [this message]
2024-11-28 13:05 ` [PATCH 2/3] lib/xe_query: add xe_hwconfig_lookup_value() helper Jan Maslak
2024-11-28 13:10 ` Grzegorzek, Dominik
2024-11-28 13:05 ` [PATCH 3/3] tests/xe_eudebug_online: update thread count handling in query_attention_bitmask_size() Jan Maslak
2024-11-28 14:22 ` ✓ Xe.CI.BAT: success for tests/xe_eudebug_online: update thread count handling in query_attention_bitmask_size() (rev3) Patchwork
2024-11-28 14:35 ` ✗ i915.CI.BAT: failure " Patchwork
2024-11-28 17:39 ` ✗ Xe.CI.Full: " Patchwork
-- strict thread matches above, loose matches on Subject: below --
2024-11-20 22:28 [PATCH 0/3] tests/xe_eudebug_online: update thread count handling in query_attention_bitmask_size() Jan Maslak
2024-11-20 22:28 ` [PATCH 1/3] lib/xe_query: add hwconfig to xe_device Jan Maslak
2024-11-26 8:34 ` Grzegorzek, Dominik
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=20241128130503.241328-2-jan.maslak@intel.com \
--to=jan.maslak@intel.com \
--cc=dominik.grzegorzek@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=jonathan.cavitt@intel.com \
--cc=matthew.d.roper@intel.com \
/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