From: Michal Wajdeczko <michal.wajdeczko@intel.com>
To: Satyanarayana K V P <satyanarayana.k.v.p@intel.com>,
<intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH v9 3/3] drm/xe/tests: Fix pf_set_admin_mode() after sriov.pf.admin_only removal
Date: Tue, 7 Apr 2026 12:58:45 +0200 [thread overview]
Message-ID: <3fc89f31-9ee0-4ae6-bf20-98d1f1fbc519@intel.com> (raw)
In-Reply-To: <20260406114515.1043145-8-satyanarayana.k.v.p@intel.com>
On 4/6/2026 1:45 PM, Satyanarayana K V P wrote:
> Admin-only mode is now derived from xe_device_is_admin_only(), which
> checks whether the device was registered under the admin-only DRM driver
> instance or not.
>
> Update the kunit test to have a stub function to mimic the functionality
> of xe_device_is_admin_only().
>
> Signed-off-by: Satyanarayana K V P <satyanarayana.k.v.p@intel.com>
> Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
>
> ---
> V8 -> V9:
> - New commit.
> ---
> .../drm/xe/tests/xe_gt_sriov_pf_config_kunit.c | 15 +++++++++++++--
> drivers/gpu/drm/xe/xe_device.c | 2 ++
> 2 files changed, 15 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/tests/xe_gt_sriov_pf_config_kunit.c b/drivers/gpu/drm/xe/tests/xe_gt_sriov_pf_config_kunit.c
> index efa8963ec248..7b3c5733cede 100644
> --- a/drivers/gpu/drm/xe/tests/xe_gt_sriov_pf_config_kunit.c
> +++ b/drivers/gpu/drm/xe/tests/xe_gt_sriov_pf_config_kunit.c
> @@ -7,16 +7,23 @@
> #include <kunit/test.h>
> #include <kunit/test-bug.h>
>
> +#include "xe_device.h"
> #include "xe_kunit_helpers.h"
> #include "xe_pci_test.h"
>
> #define TEST_MAX_VFS 63
> #define TEST_VRAM 0x7a800000ull /* random size that works on 32-bit */
>
> +static bool sriov_pf_admin_only;
instead static bool you may just provide two stubs, one that returns
always true and the other that returns false and active the one that
matches test expectations
> +
> +static bool xe_device_is_admin_only_stub(const struct xe_device *xe)
> +{
> + return sriov_pf_admin_only;
> +}
> +
> static void pf_set_admin_mode(struct xe_device *xe, bool enable)
> {
> - /* should match logic of xe_sriov_pf_admin_only() */
> - xe->sriov.pf.admin_only = enable;
hmm, so actually kunit would be broken after patch 2/3 until now
you need to reorder patches 2<->3 to avoid that
> + sriov_pf_admin_only = enable;
> KUNIT_EXPECT_EQ(kunit_get_current_test(), enable, xe_sriov_pf_admin_only(xe));
> }
>
> @@ -82,6 +89,10 @@ static int pf_gt_config_test_init(struct kunit *test)
> xe->sriov.pf.driver_max_vfs = TEST_MAX_VFS;
> KUNIT_ASSERT_EQ(test, xe_sriov_pf_get_totalvfs(xe), 63);
>
> + sriov_pf_admin_only = false;
> + kunit_activate_static_stub(test, xe_device_is_admin_only,
> + xe_device_is_admin_only_stub);
move stub activation to pf_set_admin_mode helper
> +
> pf_set_admin_mode(xe, false);
> KUNIT_ASSERT_EQ(test, xe_sriov_init(xe), 0);
>
> diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c
> index b70fa3af6d15..d2981e7c0d91 100644
> --- a/drivers/gpu/drm/xe/xe_device.c
> +++ b/drivers/gpu/drm/xe/xe_device.c
> @@ -17,6 +17,7 @@
> #include <drm/drm_managed.h>
> #include <drm/drm_pagemap_util.h>
> #include <drm/drm_print.h>
> +#include <kunit/static_stub.h>
> #include <uapi/drm/xe_drm.h>
>
> #include "display/xe_display.h"
> @@ -444,6 +445,7 @@ static struct drm_driver admin_only_driver = {
> */
> bool xe_device_is_admin_only(const struct xe_device *xe)
> {
> + KUNIT_STATIC_STUB_REDIRECT(xe_device_is_admin_only, xe);
> return xe->drm.driver == &admin_only_driver;
> }
>
next prev parent reply other threads:[~2026-04-07 10:58 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-06 11:45 [PATCH v9 0/3] Do not create drm device for PF only admin mode Satyanarayana K V P
2026-04-06 11:45 ` [PATCH v9 1/3] drm/xe/pf: Restrict device query responses in admin-only PF mode Satyanarayana K V P
2026-04-07 10:28 ` Michal Wajdeczko
2026-04-06 11:45 ` [PATCH v9 2/3] drm/xe/pf: Derive admin-only PF mode from xe_device state Satyanarayana K V P
2026-04-07 10:32 ` Michal Wajdeczko
2026-04-06 11:45 ` [PATCH v9 3/3] drm/xe/tests: Fix pf_set_admin_mode() after sriov.pf.admin_only removal Satyanarayana K V P
2026-04-07 10:58 ` Michal Wajdeczko [this message]
2026-04-06 11:52 ` ✓ CI.KUnit: success for Do not create drm device for PF only admin mode (rev8) Patchwork
2026-04-06 12:41 ` ✓ Xe.CI.BAT: " Patchwork
2026-04-06 14:38 ` ✗ 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=3fc89f31-9ee0-4ae6-bf20-98d1f1fbc519@intel.com \
--to=michal.wajdeczko@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=satyanarayana.k.v.p@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