All of lore.kernel.org
 help / color / mirror / Atom feed
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 v10 2/3] drm/xe/tests: Fix pf_set_admin_mode() after sriov.pf.admin_only removal
Date: Wed, 8 Apr 2026 19:25:46 +0200	[thread overview]
Message-ID: <42fbfbf4-2de0-439f-94c9-462640f4fd71@intel.com> (raw)
In-Reply-To: <20260408160514.2388689-7-satyanarayana.k.v.p@intel.com>

title: after patch reorder there is nothing to 'fix', so maybe:

	drm/xe/tests: Update admin-only mode selection

On 4/8/2026 6:05 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>
> 
> ---
> V9 -> V10:
> - Moved kunit_activate_static_stub() to pf_set_admin_mode() (Michal).
> 
> V8 -> V9:
> - New commit.
> ---
>  .../xe/tests/xe_gt_sriov_pf_config_kunit.c    | 22 +++++++++++++++++--
>  drivers/gpu/drm/xe/xe_device.c                |  3 +++
>  2 files changed, 23 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..a235ec04d6b6 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,34 @@
>  #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 xe_device_is_admin_only_stub_enable(const struct xe_device *xe)
> +{
> +	return true;
> +}
> +
> +static bool xe_device_is_admin_only_stub_disable(const struct xe_device *xe)
> +{
> +	return false;
> +}
> +
>  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;
> +	if (enable)
> +		kunit_activate_static_stub(kunit_get_current_test(),
> +					   xe_device_is_admin_only,
> +					   xe_device_is_admin_only_stub_enable);
> +	else
> +		kunit_activate_static_stub(kunit_get_current_test(),
> +					   xe_device_is_admin_only,
> +					   xe_device_is_admin_only_stub_disable);

nit: to avoid some code duplication you can write this as:

	typeof(xe_device_is_admin_only) stub = enable ?
			xe_device_is_admin_only_stub_enable :
			xe_device_is_admin_only_stub_disable;

	kunit_activate_static_stub(kunit_get_current_test(),
				   xe_device_is_admin_only,
				   stub);

> +
>  	KUNIT_EXPECT_EQ(kunit_get_current_test(), enable, xe_sriov_pf_admin_only(xe));
>  }
>  
> diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c
> index b0bbb079ca8e..f391a1987682 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"
> @@ -446,6 +447,8 @@ 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);
> +
>  #ifdef CONFIG_PCI_IOV
>  	return xe->drm.driver == &admin_only_driver;
>  #endif


  reply	other threads:[~2026-04-08 17:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-08 16:05 [PATCH v10 0/3] Do not create drm device for PF only admin mode Satyanarayana K V P
2026-04-08 16:05 ` [PATCH v10 1/3] drm/xe/pf: Restrict device query responses in admin-only PF mode Satyanarayana K V P
2026-04-08 17:13   ` Michal Wajdeczko
2026-04-08 16:05 ` [PATCH v10 2/3] drm/xe/tests: Fix pf_set_admin_mode() after sriov.pf.admin_only removal Satyanarayana K V P
2026-04-08 17:25   ` Michal Wajdeczko [this message]
2026-04-08 16:05 ` [PATCH v10 3/3] drm/xe/pf: Derive admin-only PF mode from xe_device state Satyanarayana K V P
2026-04-08 16:18 ` ✗ CI.KUnit: failure for Do not create drm device for PF only admin mode (rev9) 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=42fbfbf4-2de0-439f-94c9-462640f4fd71@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.