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 v11 2/2] drm/xe/pf: Derive admin-only PF mode from xe_device state
Date: Mon, 13 Apr 2026 11:06:17 +0200 [thread overview]
Message-ID: <236dab1a-9962-49af-84e2-c2b0f08f65a4@intel.com> (raw)
In-Reply-To: <20260409154423.2499340-6-satyanarayana.k.v.p@intel.com>
On 4/9/2026 5:44 PM, Satyanarayana K V P wrote:
> Stop tracking admin-only PF mode in a separate `xe->sriov.pf.admin_only`
> field and use `xe_device_is_admin_only(xe)` as the single source of
> admin mode.
>
> Signed-off-by: Satyanarayana K V P <satyanarayana.k.v.p@intel.com>
> Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Reviewed-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
small nits below
>
> ---
> V10 -> V11:
> - Squashed kunit commit into the current one.
> - Cleandup pf_set_admin_mode() as per review comments (Michal).
>
> V9 -> V10:
> - None.
>
> V8 -> V9:
> - New commit.
> ---
> .../xe/tests/xe_gt_sriov_pf_config_kunit.c | 21 +++++++++++++++++--
> drivers/gpu/drm/xe/xe_device.c | 2 ++
> drivers/gpu/drm/xe/xe_sriov_pf.c | 6 ------
> drivers/gpu/drm/xe/xe_sriov_pf_helpers.h | 3 ++-
> drivers/gpu/drm/xe/xe_sriov_pf_types.h | 3 ---
> 5 files changed, 23 insertions(+), 12 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..524b9f5d2624 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,33 @@
> #include <kunit/test.h>
> #include <kunit/test-bug.h>
>
> +#include "xe_device.h"
nit: not needed as this .h is already included by the parent .c file
> #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;
> + 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);
> +
nit: maybe in addition to below check of xe_sriov_pf_admin_only() we should
also add EXPECT_EQ for xe_device_is_admin_only() that we've just replaced?
> 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 ceddda10f78f..4b45b617a039 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"
> @@ -445,6 +446,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;
> }
> #endif
> diff --git a/drivers/gpu/drm/xe/xe_sriov_pf.c b/drivers/gpu/drm/xe/xe_sriov_pf.c
> index 47a6e0fd66e0..33bd754d138f 100644
> --- a/drivers/gpu/drm/xe/xe_sriov_pf.c
> +++ b/drivers/gpu/drm/xe/xe_sriov_pf.c
> @@ -20,11 +20,6 @@
> #include "xe_sriov_pf_sysfs.h"
> #include "xe_sriov_printk.h"
>
> -static bool wanted_admin_only(struct xe_device *xe)
> -{
> - return xe_configfs_admin_only_pf(to_pci_dev(xe->drm.dev));
> -}
> -
> static unsigned int wanted_max_vfs(struct xe_device *xe)
> {
> return xe_configfs_get_max_vfs(to_pci_dev(xe->drm.dev));
> @@ -79,7 +74,6 @@ bool xe_sriov_pf_readiness(struct xe_device *xe)
>
> pf_reduce_totalvfs(xe, newlimit);
>
> - xe->sriov.pf.admin_only = wanted_admin_only(xe);
> xe->sriov.pf.device_total_vfs = totalvfs;
> xe->sriov.pf.driver_max_vfs = newlimit;
>
> diff --git a/drivers/gpu/drm/xe/xe_sriov_pf_helpers.h b/drivers/gpu/drm/xe/xe_sriov_pf_helpers.h
> index 0fcc6cec4afc..19f6f8331c8d 100644
> --- a/drivers/gpu/drm/xe/xe_sriov_pf_helpers.h
> +++ b/drivers/gpu/drm/xe/xe_sriov_pf_helpers.h
> @@ -7,6 +7,7 @@
> #define _XE_SRIOV_PF_HELPERS_H_
>
> #include "xe_assert.h"
> +#include "xe_device.h"
> #include "xe_device_types.h"
> #include "xe_sriov.h"
> #include "xe_sriov_types.h"
> @@ -57,7 +58,7 @@ static inline unsigned int xe_sriov_pf_num_vfs(const struct xe_device *xe)
> static inline bool xe_sriov_pf_admin_only(const struct xe_device *xe)
> {
> xe_assert(xe, IS_SRIOV_PF(xe));
> - return xe->sriov.pf.admin_only;
> + return xe_device_is_admin_only(xe);
> }
>
> static inline struct mutex *xe_sriov_pf_master_mutex(struct xe_device *xe)
> diff --git a/drivers/gpu/drm/xe/xe_sriov_pf_types.h b/drivers/gpu/drm/xe/xe_sriov_pf_types.h
> index 080cf10512f4..b0253e1ae5da 100644
> --- a/drivers/gpu/drm/xe/xe_sriov_pf_types.h
> +++ b/drivers/gpu/drm/xe/xe_sriov_pf_types.h
> @@ -36,9 +36,6 @@ struct xe_sriov_metadata {
> * @XE_SRIOV_MODE_PF mode.
> */
> struct xe_device_pf {
> - /** @admin_only: PF functionality focused on VFs management only. */
> - bool admin_only;
> -
> /** @device_total_vfs: Maximum number of VFs supported by the device. */
> u16 device_total_vfs;
>
next prev parent reply other threads:[~2026-04-13 9:06 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-09 15:44 [PATCH v11 0/2] Do not create drm device for PF only admin mode Satyanarayana K V P
2026-04-09 15:44 ` [PATCH v11 1/2] drm/xe/pf: Restrict device query responses in admin-only PF mode Satyanarayana K V P
2026-04-13 8:57 ` Michal Wajdeczko
2026-04-09 15:44 ` [PATCH v11 2/2] drm/xe/pf: Derive admin-only PF mode from xe_device state Satyanarayana K V P
2026-04-13 9:06 ` Michal Wajdeczko [this message]
2026-04-13 9:56 ` [PATCH v12] " Satyanarayana K V P
2026-04-09 15:51 ` ✗ CI.KUnit: failure for Do not create drm device for PF only admin mode (rev10) Patchwork
2026-04-10 4:34 ` ✓ CI.KUnit: success for Do not create drm device for PF only admin mode (rev11) Patchwork
2026-04-10 5:29 ` ✓ Xe.CI.BAT: " Patchwork
2026-04-10 12:14 ` ✓ Xe.CI.FULL: " Patchwork
2026-04-13 13:01 ` ✓ CI.KUnit: success for Do not create drm device for PF only admin mode (rev12) Patchwork
2026-04-13 14:26 ` ✓ Xe.CI.BAT: " Patchwork
2026-04-13 15:34 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-04-14 6:25 ` K V P, Satyanarayana
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=236dab1a-9962-49af-84e2-c2b0f08f65a4@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