From: Jonathan Cavitt <jonathan.cavitt@intel.com>
To: intel-xe@lists.freedesktop.org
Cc: jonathan.cavitt@intel.com, saurabhg.gupta@intel.com,
alex.zuo@intel.com, michal.wajdeczko@intel.com,
matthew.d.roper@intel.com
Subject: [PATCH v2 5/5] drm/xe/tests: Use xe_root_mmio_gt instead of xe_device_get_gt
Date: Fri, 26 Sep 2025 20:09:23 +0000 [thread overview]
Message-ID: <20250926200917.164618-12-jonathan.cavitt@intel.com> (raw)
In-Reply-To: <20250926200917.164618-7-jonathan.cavitt@intel.com>
The xe test code expects GT0 to always be available as a part of the
test setup, so there's no reason to use xe_device_get_gt over
xe_root_mmio_gt, especially since the former may fail in some cases.
Replace all instances of xe_device_get_gt(xe, 0) with
xe_root_mmio_gt(xe) in the xe test code.
v2: Reword commit message (Michal)
Signed-off-by: Jonathan Cavitt <jonathan.cavitt@intel.com>
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
---
drivers/gpu/drm/xe/tests/xe_guc_buf_kunit.c | 2 +-
drivers/gpu/drm/xe/tests/xe_guc_db_mgr_test.c | 2 +-
drivers/gpu/drm/xe/tests/xe_guc_g2g_test.c | 2 +-
drivers/gpu/drm/xe/tests/xe_guc_id_mgr_test.c | 2 +-
drivers/gpu/drm/xe/tests/xe_guc_relay_test.c | 2 +-
5 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/xe/tests/xe_guc_buf_kunit.c b/drivers/gpu/drm/xe/tests/xe_guc_buf_kunit.c
index d266882adc0e..33dbcb262204 100644
--- a/drivers/gpu/drm/xe/tests/xe_guc_buf_kunit.c
+++ b/drivers/gpu/drm/xe/tests/xe_guc_buf_kunit.c
@@ -63,7 +63,7 @@ static int guc_buf_test_init(struct kunit *test)
xe_kunit_helper_xe_device_test_init(test);
ggtt = xe_device_get_root_tile(test->priv)->mem.ggtt;
- guc = &xe_device_get_gt(test->priv, 0)->uc.guc;
+ guc = &xe_root_mmio_gt(test->priv)->uc.guc;
KUNIT_ASSERT_EQ(test, 0,
xe_ggtt_init_kunit(ggtt, DUT_GGTT_START,
diff --git a/drivers/gpu/drm/xe/tests/xe_guc_db_mgr_test.c b/drivers/gpu/drm/xe/tests/xe_guc_db_mgr_test.c
index a87a7b4b040a..59a7c2d57fe2 100644
--- a/drivers/gpu/drm/xe/tests/xe_guc_db_mgr_test.c
+++ b/drivers/gpu/drm/xe/tests/xe_guc_db_mgr_test.c
@@ -13,7 +13,7 @@ static int guc_dbm_test_init(struct kunit *test)
struct xe_guc_db_mgr *dbm;
xe_kunit_helper_xe_device_test_init(test);
- dbm = &xe_device_get_gt(test->priv, 0)->uc.guc.dbm;
+ dbm = &xe_root_mmio_gt(test->priv)->uc.guc.dbm;
mutex_init(dbm_mutex(dbm));
test->priv = dbm;
diff --git a/drivers/gpu/drm/xe/tests/xe_guc_g2g_test.c b/drivers/gpu/drm/xe/tests/xe_guc_g2g_test.c
index 3b213fcae916..d211dfa09538 100644
--- a/drivers/gpu/drm/xe/tests/xe_guc_g2g_test.c
+++ b/drivers/gpu/drm/xe/tests/xe_guc_g2g_test.c
@@ -355,7 +355,7 @@ static void g2g_distribute(struct kunit *test, struct xe_device *xe, struct xe_b
struct xe_gt *root_gt, *gt;
int i;
- root_gt = xe_device_get_gt(xe, 0);
+ root_gt = xe_root_mmio_gt(xe);
root_gt->uc.guc.g2g.bo = bo;
root_gt->uc.guc.g2g.owned = true;
kunit_info(test, "[%d.%d] Assigned 0x%p\n", gt_to_tile(root_gt)->id, root_gt->info.id, bo);
diff --git a/drivers/gpu/drm/xe/tests/xe_guc_id_mgr_test.c b/drivers/gpu/drm/xe/tests/xe_guc_id_mgr_test.c
index ee30a1939eb0..3c84bcacd0ac 100644
--- a/drivers/gpu/drm/xe/tests/xe_guc_id_mgr_test.c
+++ b/drivers/gpu/drm/xe/tests/xe_guc_id_mgr_test.c
@@ -13,7 +13,7 @@ static int guc_id_mgr_test_init(struct kunit *test)
struct xe_guc_id_mgr *idm;
xe_kunit_helper_xe_device_test_init(test);
- idm = &xe_device_get_gt(test->priv, 0)->uc.guc.submission_state.idm;
+ idm = &xe_root_mmio_gt(test->priv)->uc.guc.submission_state.idm;
mutex_init(idm_mutex(idm));
test->priv = idm;
diff --git a/drivers/gpu/drm/xe/tests/xe_guc_relay_test.c b/drivers/gpu/drm/xe/tests/xe_guc_relay_test.c
index 13701451b923..645c8b6de3db 100644
--- a/drivers/gpu/drm/xe/tests/xe_guc_relay_test.c
+++ b/drivers/gpu/drm/xe/tests/xe_guc_relay_test.c
@@ -38,7 +38,7 @@ static int relay_test_init(struct kunit *test)
xe = test->priv;
KUNIT_ASSERT_EQ(test, xe_sriov_init(xe), 0);
- relay = &xe_device_get_gt(xe, 0)->uc.guc.relay;
+ relay = &xe_root_mmio_gt(xe)->uc.guc.relay;
kunit_activate_static_stub(test, relay_get_totalvfs,
replacement_relay_get_totalvfs);
--
2.43.0
next prev parent reply other threads:[~2025-09-26 20:09 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-26 20:09 [PATCH v2 0/5] drm/xe: Guard against NULL return for xe_device_get_gt Jonathan Cavitt
2025-09-26 20:09 ` [PATCH v2 1/5] drm/xe: Guard against NULL GT in xe_sriov_vf.c Jonathan Cavitt
2025-10-13 21:13 ` Rodrigo Vivi
2025-09-26 20:09 ` [PATCH v2 2/5] drm/xe: Guard against NULL GT in xe_pmu.c Jonathan Cavitt
2025-10-13 21:19 ` Rodrigo Vivi
2025-09-26 20:09 ` [PATCH v2 3/5] drm/xe: Don't call xe_device_get_gt twice in xe_hw_engine_lookup Jonathan Cavitt
2025-09-29 10:25 ` Upadhyay, Tejas
2025-09-26 20:09 ` [PATCH v2 4/5] drm/xe: Guard against NULL GT in xe_guc.c Jonathan Cavitt
2025-10-13 21:14 ` Rodrigo Vivi
2025-09-26 20:09 ` Jonathan Cavitt [this message]
2025-09-26 20:16 ` ✓ CI.KUnit: success for drm/xe: Guard against NULL return for xe_device_get_gt Patchwork
2025-09-26 20:52 ` ✓ Xe.CI.BAT: " Patchwork
2025-09-27 3:59 ` ✗ Xe.CI.Full: failure " 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=20250926200917.164618-12-jonathan.cavitt@intel.com \
--to=jonathan.cavitt@intel.com \
--cc=alex.zuo@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=matthew.d.roper@intel.com \
--cc=michal.wajdeczko@intel.com \
--cc=saurabhg.gupta@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