Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
To: igt-dev@lists.freedesktop.org, zbigniew.kempczynski@intel.com
Subject: [igt-dev] [i-g-t V2 3/5] lib/xe/xe_query: Add dev_id() interface
Date: Tue, 14 Mar 2023 21:35:01 +0530	[thread overview]
Message-ID: <20230314160503.2237121-4-bhanuprakash.modem@intel.com> (raw)
In-Reply-To: <20230314160503.2237121-1-bhanuprakash.modem@intel.com>

Add support to query XE_QUERY_CONFIG_REV_AND_DEVICE_ID.

V2: - Use uint16_t as value is truncating with 0xffff (Zbigniew)

Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
Reviewed-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
Reviewed-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---
 lib/xe/xe_query.c | 9 +++++++++
 lib/xe/xe_query.h | 4 ++++
 2 files changed, 13 insertions(+)

diff --git a/lib/xe/xe_query.c b/lib/xe/xe_query.c
index a6926057f..e27d14383 100644
--- a/lib/xe/xe_query.c
+++ b/lib/xe/xe_query.c
@@ -247,6 +247,7 @@ struct xe_device *xe_device_get(int fd)
 	xe_dev->config = xe_query_config_new(fd);
 	xe_dev->number_gt = xe_dev->config->info[XE_QUERY_CONFIG_GT_COUNT];
 	xe_dev->va_bits = xe_dev->config->info[XE_QUERY_CONFIG_VA_BITS];
+	xe_dev->dev_id = xe_dev->config->info[XE_QUERY_CONFIG_REV_AND_DEVICE_ID] & 0xffff;
 	xe_dev->gts = xe_query_gts_new(fd);
 	xe_dev->memory_regions = __memory_regions(xe_dev->gts);
 	xe_dev->hw_engines = xe_query_engines_new(fd, &xe_dev->number_hw_engines);
@@ -465,6 +466,14 @@ xe_dev_FN(xe_supports_faults, supports_faults, bool);
  */
 xe_dev_FN(xe_va_bits, va_bits, uint32_t);
 
+/**
+ * xe_dev_id:
+ * @fd: xe device fd
+ *
+ * Returns Device id of xe device @fd.
+ */
+xe_dev_FN(xe_dev_id, dev_id, uint32_t);
+
 igt_constructor
 {
 	xe_device_cache_init();
diff --git a/lib/xe/xe_query.h b/lib/xe/xe_query.h
index fe1343f61..13ac77d3d 100644
--- a/lib/xe/xe_query.h
+++ b/lib/xe/xe_query.h
@@ -58,6 +58,9 @@ struct xe_device {
 
 	/** @va_bits: va length in bits */
 	uint32_t va_bits;
+
+	/** @dev_id: Device id of xe device */
+	uint16_t dev_id;
 };
 
 #define for_each_hw_engine(__fd, __hwe) \
@@ -85,6 +88,7 @@ bool xe_has_vram(int fd);
 uint64_t xe_vram_size(int fd, int gt);
 uint32_t xe_get_default_alignment(int fd);
 uint32_t xe_va_bits(int fd);
+uint32_t xe_dev_id(int fd);
 bool xe_supports_faults(int fd);
 const char *xe_engine_class_string(uint32_t engine_class);
 
-- 
2.39.1

  parent reply	other threads:[~2023-03-14 16:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-14 16:04 [igt-dev] [i-g-t V2 0/5] Add basic helpers to support display in XE Bhanuprakash Modem
2023-03-14 16:04 ` [igt-dev] [i-g-t V2 1/5] lib/drmtest: Add helpers to check and require the XE driver Bhanuprakash Modem
2023-03-14 16:05 ` [igt-dev] [i-g-t V2 2/5] i915: s/igt_require_intel/igt_require_i915 Bhanuprakash Modem
2023-03-14 16:05 ` Bhanuprakash Modem [this message]
2023-03-14 16:05 ` [igt-dev] [i-g-t V2 4/5] lib/intel_chipset: Add support to XE driver to get devid Bhanuprakash Modem
2023-03-14 16:05 ` [igt-dev] [i-g-t V2 5/5] lib/igt_kms: Cache xe_device info for kms tests Bhanuprakash Modem
2023-03-14 17:00 ` [igt-dev] ✓ Fi.CI.BAT: success for Add basic helpers to support display in XE (rev2) Patchwork
2023-03-15 20:30 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork

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=20230314160503.2237121-4-bhanuprakash.modem@intel.com \
    --to=bhanuprakash.modem@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=zbigniew.kempczynski@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