From: Michal Wajdeczko <michal.wajdeczko@intel.com>
To: Jonathan Cavitt <jonathan.cavitt@intel.com>,
<intel-xe@lists.freedesktop.org>
Cc: <saurabhg.gupta@intel.com>, <alex.zuo@intel.com>
Subject: Re: [PATCH 5/5] drm/xe/tests: Use xe_root_mmio_gt instead of xe_device_get_gt
Date: Fri, 26 Sep 2025 20:46:02 +0200 [thread overview]
Message-ID: <332f4f67-91be-480a-a74d-e6731a8736ab@intel.com> (raw)
In-Reply-To: <20250926155948.145934-12-jonathan.cavitt@intel.com>
On 9/26/2025 5:59 PM, Jonathan Cavitt wrote:
> xe_root_mmio_gt(xe) is equivalent to xe_device_get_gt(xe, 0) in terms of
> return value, but it takes up less line space and is slightly more
> efficient during execution. Replace instances of the latter with the
> former in the xe test code.
I guess the rationale here is not about efficiency, but rather that
tests just expects root GT0 to be always available as part of the
test setup, so there is no point is using more flexible function that
actually may fail in some cases
otherwise, LGTM
(as in tests we likely wont be able to disable GT0 by configfs ;)
>
> Signed-off-by: Jonathan Cavitt <jonathan.cavitt@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);
>
next prev parent reply other threads:[~2025-09-26 18:46 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-26 15:59 [PATCH 0/5] drm/xe: Guard against NULL return for xe_device_get_gt Jonathan Cavitt
2025-09-26 15:59 ` [PATCH 1/5] drm/xe: Guard against NULL GT in xe_sriov_vf.c Jonathan Cavitt
2025-09-26 18:10 ` Michal Wajdeczko
2025-09-26 15:59 ` [PATCH 2/5] drm/xe: Guard against NULL GT in xe_pmu.c Jonathan Cavitt
2025-09-26 18:26 ` Michal Wajdeczko
2025-09-29 10:40 ` Upadhyay, Tejas
2025-09-29 15:41 ` Cavitt, Jonathan
2025-09-26 15:59 ` [PATCH 3/5] drm/xe: Don't call xe_device_get_gt twice in xe_hw_engine_lookup Jonathan Cavitt
2025-09-26 18:28 ` Michal Wajdeczko
2025-09-26 15:59 ` [PATCH 4/5] drm/xe: Guard against NULL GT in xe_guc.c Jonathan Cavitt
2025-09-26 18:36 ` Michal Wajdeczko
2025-09-26 19:26 ` Matt Roper
2025-09-26 22:04 ` Michal Wajdeczko
2025-09-26 15:59 ` [PATCH 5/5] drm/xe/tests: Use xe_root_mmio_gt instead of xe_device_get_gt Jonathan Cavitt
2025-09-26 18:46 ` Michal Wajdeczko [this message]
2025-09-26 16:06 ` ✓ CI.KUnit: success for drm/xe: Guard against NULL return for xe_device_get_gt Patchwork
2025-09-26 16:42 ` ✓ Xe.CI.BAT: " Patchwork
2025-09-26 23:52 ` ✓ Xe.CI.Full: " 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=332f4f67-91be-480a-a74d-e6731a8736ab@intel.com \
--to=michal.wajdeczko@intel.com \
--cc=alex.zuo@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=jonathan.cavitt@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