From: Matthew Brost <matthew.brost@intel.com>
To: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: <intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH 1/6] drm/xe/pf: Add top level functions to control VFs
Date: Wed, 1 Oct 2025 00:34:24 -0700 [thread overview]
Message-ID: <aNzZgNIIAgd6OBzn@lstrano-desk.jf.intel.com> (raw)
In-Reply-To: <20250930233525.201263-2-michal.wajdeczko@intel.com>
On Wed, Oct 01, 2025 at 01:35:19AM +0200, Michal Wajdeczko wrote:
> We already have control functions that we use to control the VF
> state on the per-GT basis, but that is low level detail from the
> user point of view, who rather expects VF-level functions.
>
> For now add simple functions that just iterate over all GTs and
> call per-GT control function. We will soon allow to use some of
> them from the user facing interfaces like debugfs.
>
Will the VFIO driver hook into the level control like xe_sriov_pf_control.c?
Matt
> Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
> ---
> drivers/gpu/drm/xe/Makefile | 1 +
> drivers/gpu/drm/xe/xe_pci_sriov.c | 8 +-
> drivers/gpu/drm/xe/xe_sriov_pf_control.c | 104 +++++++++++++++++++++++
> drivers/gpu/drm/xe/xe_sriov_pf_control.h | 16 ++++
> 4 files changed, 124 insertions(+), 5 deletions(-)
> create mode 100644 drivers/gpu/drm/xe/xe_sriov_pf_control.c
> create mode 100644 drivers/gpu/drm/xe/xe_sriov_pf_control.h
>
> diff --git a/drivers/gpu/drm/xe/Makefile b/drivers/gpu/drm/xe/Makefile
> index 3c5d2388997d..84321fad3265 100644
> --- a/drivers/gpu/drm/xe/Makefile
> +++ b/drivers/gpu/drm/xe/Makefile
> @@ -174,6 +174,7 @@ xe-$(CONFIG_PCI_IOV) += \
> xe_lmtt_ml.o \
> xe_pci_sriov.o \
> xe_sriov_pf.o \
> + xe_sriov_pf_control.o \
> xe_sriov_pf_debugfs.o \
> xe_sriov_pf_service.o \
> xe_tile_sriov_pf_debugfs.o
> diff --git a/drivers/gpu/drm/xe/xe_pci_sriov.c b/drivers/gpu/drm/xe/xe_pci_sriov.c
> index af05db07162e..9c1c9e669b04 100644
> --- a/drivers/gpu/drm/xe/xe_pci_sriov.c
> +++ b/drivers/gpu/drm/xe/xe_pci_sriov.c
> @@ -17,6 +17,7 @@
> #include "xe_pm.h"
> #include "xe_sriov.h"
> #include "xe_sriov_pf.h"
> +#include "xe_sriov_pf_control.h"
> #include "xe_sriov_pf_helpers.h"
> #include "xe_sriov_printk.h"
>
> @@ -60,13 +61,10 @@ static void pf_unprovision_vfs(struct xe_device *xe, unsigned int num_vfs)
>
> static void pf_reset_vfs(struct xe_device *xe, unsigned int num_vfs)
> {
> - struct xe_gt *gt;
> - unsigned int id;
> unsigned int n;
>
> - for_each_gt(gt, xe, id)
> - for (n = 1; n <= num_vfs; n++)
> - xe_gt_sriov_pf_control_trigger_flr(gt, n);
> + for (n = 1; n <= num_vfs; n++)
> + xe_sriov_pf_control_reset_vf(xe, n);
> }
>
> static struct pci_dev *xe_pci_pf_get_vf_dev(struct xe_device *xe, unsigned int vf_id)
> diff --git a/drivers/gpu/drm/xe/xe_sriov_pf_control.c b/drivers/gpu/drm/xe/xe_sriov_pf_control.c
> new file mode 100644
> index 000000000000..56c0dd382262
> --- /dev/null
> +++ b/drivers/gpu/drm/xe/xe_sriov_pf_control.c
> @@ -0,0 +1,104 @@
> +// SPDX-License-Identifier: MIT
> +/*
> + * Copyright © 2025 Intel Corporation
> + */
> +
> +#include "xe_device.h"
> +#include "xe_gt_sriov_pf_control.h"
> +#include "xe_sriov_pf_control.h"
> +
> +/**
> + * xe_sriov_pf_control_pause_vf() - Pause a VF on all GTs.
> + * @xe: the &xe_device
> + * @vfid: the VF identifier (can't be 0 == PFID)
> + *
> + * This function is for PF only.
> + *
> + * Return: 0 on success or a negative error code on failure.
> + */
> +int xe_sriov_pf_control_pause_vf(struct xe_device *xe, unsigned int vfid)
> +{
> + struct xe_gt *gt;
> + unsigned int id;
> + int result = 0;
> + int err;
> +
> + for_each_gt(gt, xe, id) {
> + err = xe_gt_sriov_pf_control_pause_vf(gt, vfid);
> + result = result ? -EUCLEAN : err;
> + }
> +
> + return result;
> +}
> +
> +/**
> + * xe_sriov_pf_control_resume_vf() - Resume a VF on all GTs.
> + * @xe: the &xe_device
> + * @vfid: the VF identifier
> + *
> + * This function is for PF only.
> + *
> + * Return: 0 on success or a negative error code on failure.
> + */
> +int xe_sriov_pf_control_resume_vf(struct xe_device *xe, unsigned int vfid)
> +{
> + struct xe_gt *gt;
> + unsigned int id;
> + int result = 0;
> + int err;
> +
> + for_each_gt(gt, xe, id) {
> + err = xe_gt_sriov_pf_control_resume_vf(gt, vfid);
> + result = result ? -EUCLEAN : err;
> + }
> +
> + return result;
> +}
> +
> +/**
> + * xe_sriov_pf_control_stop_vf - Stop a VF on all GTs.
> + * @xe: the &xe_device
> + * @vfid: the VF identifier
> + *
> + * This function is for PF only.
> + *
> + * Return: 0 on success or a negative error code on failure.
> + */
> +int xe_sriov_pf_control_stop_vf(struct xe_device *xe, unsigned int vfid)
> +{
> + struct xe_gt *gt;
> + unsigned int id;
> + int result = 0;
> + int err;
> +
> + for_each_gt(gt, xe, id) {
> + err = xe_gt_sriov_pf_control_stop_vf(gt, vfid);
> + result = result ? -EUCLEAN : err;
> + }
> +
> + return result;
> +}
> +
> +/**
> + * xe_sriov_pf_control_reset_vf() - Perform a VF reset (FLR).
> + * @xe: the &xe_device
> + * @vfid: the VF identifier
> + *
> + * This function is for PF only.
> + *
> + * Return: 0 on success or a negative error code on failure.
> + */
> +int xe_sriov_pf_control_reset_vf(struct xe_device *xe, unsigned int vfid)
> +{
> + struct xe_gt *gt;
> + unsigned int id;
> + int result = 0;
> + int err;
> +
> + for_each_gt(gt, xe, id) {
> + err = xe_gt_sriov_pf_control_trigger_flr(gt, vfid);
> + result = result ? -EUCLEAN : err;
> + }
> +
> + return result;
> +}
> diff --git a/drivers/gpu/drm/xe/xe_sriov_pf_control.h b/drivers/gpu/drm/xe/xe_sriov_pf_control.h
> new file mode 100644
> index 000000000000..9bf059f746d4
> --- /dev/null
> +++ b/drivers/gpu/drm/xe/xe_sriov_pf_control.h
> @@ -0,0 +1,16 @@
> +/* SPDX-License-Identifier: MIT */
> +/*
> + * Copyright © 2025 Intel Corporation
> + */
> +
> +#ifndef _XE_SRIOV_PF_CONTROL_H_
> +#define _XE_SRIOV_PF_CONTROL_H_
> +
> +struct xe_device;
> +
> +int xe_sriov_pf_control_pause_vf(struct xe_device *xe, unsigned int vfid);
> +int xe_sriov_pf_control_resume_vf(struct xe_device *xe, unsigned int vfid);
> +int xe_sriov_pf_control_stop_vf(struct xe_device *xe, unsigned int vfid);
> +int xe_sriov_pf_control_reset_vf(struct xe_device *xe, unsigned int vfid);
> +
> +#endif
> --
> 2.47.1
>
next prev parent reply other threads:[~2025-10-01 7:34 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-30 23:35 [PATCH 0/6] More PF improvements Michal Wajdeczko
2025-09-30 23:35 ` [PATCH 1/6] drm/xe/pf: Add top level functions to control VFs Michal Wajdeczko
2025-10-01 7:34 ` Matthew Brost [this message]
2025-10-01 8:03 ` Michal Wajdeczko
2025-10-02 21:26 ` Michał Winiarski
2025-09-30 23:35 ` [PATCH 2/6] drm/xe/pf: Log only top level VF state changes Michal Wajdeczko
2025-10-02 21:33 ` Michał Winiarski
2025-09-30 23:35 ` [PATCH 3/6] drm/xe/pf: Expose VF control operations over debugfs Michal Wajdeczko
2025-10-01 7:30 ` Matthew Brost
2025-10-01 8:21 ` Michal Wajdeczko
2025-10-02 21:37 ` Michał Winiarski
2025-09-30 23:35 ` [PATCH 4/6] drm/xe/pf: Unify VF state tracking log Michal Wajdeczko
2025-10-02 21:46 ` Michał Winiarski
2025-09-30 23:35 ` [PATCH 5/6] drm/xe/pf: Split VF FLR processing function Michal Wajdeczko
2025-10-02 21:47 ` Michał Winiarski
2025-09-30 23:35 ` [PATCH 6/6] drm/xe/pf: Synchronize VF FLR between all GTs Michal Wajdeczko
2025-10-01 7:32 ` Matthew Brost
2025-10-01 8:27 ` Michal Wajdeczko
2025-10-02 21:57 ` Michał Winiarski
2025-10-01 0:59 ` ✗ CI.checkpatch: warning for More PF improvements Patchwork
2025-10-01 1:00 ` ✓ CI.KUnit: success " Patchwork
2025-10-01 1:35 ` ✓ Xe.CI.BAT: " Patchwork
2025-10-01 3:56 ` ✓ 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=aNzZgNIIAgd6OBzn@lstrano-desk.jf.intel.com \
--to=matthew.brost@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=michal.wajdeczko@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