From: Adam Miszczak <adam.miszczak@linux.intel.com>
To: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>,
igt-dev@lists.freedesktop.org
Cc: "Jakub Kolakowski" <jakub1.kolakowski@intel.com>,
"Lukasz Laguna" <lukasz.laguna@intel.com>,
"Michał Wajdeczko" <michal.wajdeczko@intel.com>,
"Michał Winiarski" <michal.winiarski@intel.com>,
"Narasimha C V" <narasimha.c.v@intel.com>,
"Piotr Piórkowski" <piotr.piorkowski@intel.com>,
"Satyanarayana K V P" <satyanarayana.k.v.p@intel.com>,
"Tomasz Lis" <tomasz.lis@intel.com>
Subject: Re: [PATCH i-g-t 2/6] lib/igt_sriov_device: add helper for resetting SR-IOV device
Date: Mon, 14 Oct 2024 15:37:22 +0200 [thread overview]
Message-ID: <111cd01b-f695-43e2-8866-62d9b7ab4584@linux.intel.com> (raw)
In-Reply-To: <20241009113018.741371-3-marcin.bernatowicz@linux.intel.com>
On 09.10.2024 13:30, Marcin Bernatowicz wrote:
> Reset is initiated by writing 1 to device's sysfs reset attribute.
>
> Signed-off-by: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>
> Cc: Adam Miszczak <adam.miszczak@linux.intel.com>
> Cc: Jakub Kolakowski <jakub1.kolakowski@intel.com>
> Cc: Lukasz Laguna <lukasz.laguna@intel.com>
> Cc: Michał Wajdeczko <michal.wajdeczko@intel.com>
> Cc: Michał Winiarski <michal.winiarski@intel.com>
> Cc: Narasimha C V <narasimha.c.v@intel.com>
> Cc: Piotr Piórkowski <piotr.piorkowski@intel.com>
> Cc: Satyanarayana K V P <satyanarayana.k.v.p@intel.com>
> Cc: Tomasz Lis <tomasz.lis@intel.com>
> ---
> lib/igt_sriov_device.c | 51 ++++++++++++++++++++++++++++++++++++++++++
> lib/igt_sriov_device.h | 2 ++
> 2 files changed, 53 insertions(+)
>
> diff --git a/lib/igt_sriov_device.c b/lib/igt_sriov_device.c
> index d20c74823..2b83cd43c 100644
> --- a/lib/igt_sriov_device.c
> +++ b/lib/igt_sriov_device.c
> @@ -413,3 +413,54 @@ int igt_sriov_device_sysfs_open(int pf, unsigned int vf_num)
>
> return fd;
> }
> +
> +/**
> + * igt_sriov_device_reset_exists:
> + * @pf: PF device file descriptor
> + * @vf_num: VF number (1-based to identify single VF) or 0 for PF
> + *
> + * Check if reset attribute exists for a given SR-IOV device.
> + *
> + * Returns:
> + * True if reset attribute exists, false otherwise.
> + */
> +bool igt_sriov_device_reset_exists(int pf, unsigned int vf_num)
> +{
> + int sysfs;
> + bool reset_exists;
> +
> + sysfs = igt_sriov_device_sysfs_open(pf, vf_num);
> + if (sysfs < 0)
> + return false;
> +
> + reset_exists = igt_sysfs_has_attr(sysfs, "reset");
> + close(sysfs);
> +
> + return reset_exists;
> +}
> +
> +/**
> + * igt_sriov_device_reset:
> + * @pf: PF device file descriptor
> + * @vf_num: VF number (1-based to identify single VF) or 0 for PF
> + *
> + * Trigger FLR on a given VF.
> + *
> + * Returns:
> + * True on success, false on failure.
> + */
> +bool igt_sriov_device_reset(int pf, unsigned int vf_num)
> +{
> + int sysfs;
> + bool ret;
> +
> + sysfs = igt_sriov_device_sysfs_open(pf, vf_num);
> + if (sysfs < 0)
> + return false;
> +
> + igt_debug("Initiating FLR on VF%d\n", vf_num);
> + ret = igt_sysfs_set(sysfs, "reset", "1");
> + close(sysfs);
> +
> + return ret;
> +}
LGTM,
Reviewed-by: Adam Miszczak <adam.miszczak@linux.intel.com>
> diff --git a/lib/igt_sriov_device.h b/lib/igt_sriov_device.h
> index dc95a4c78..4b63ceb22 100644
> --- a/lib/igt_sriov_device.h
> +++ b/lib/igt_sriov_device.h
> @@ -31,6 +31,8 @@ bool igt_sriov_is_vf_drm_driver_probed(int pf, unsigned int vf_num);
> void igt_sriov_bind_vf_drm_driver(int pf, unsigned int vf_num);
> void igt_sriov_unbind_vf_drm_driver(int pf, unsigned int vf_num);
> int igt_sriov_device_sysfs_open(int pf, unsigned int vf_num);
> +bool igt_sriov_device_reset_exists(int pf, unsigned int vf_num);
> +bool igt_sriov_device_reset(int pf, unsigned int vf_num);
>
> /**
> * for_each_sriov_vf - Helper for running code on each VF
next prev parent reply other threads:[~2024-10-14 13:37 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-09 11:30 [PATCH i-g-t 0/6] Introduce xe_sriov_flr test Marcin Bernatowicz
2024-10-09 11:30 ` [PATCH i-g-t 1/6] lib/igt_sriov_device: add helper for opening SR-IOV device sysfs Marcin Bernatowicz
2024-10-14 13:34 ` Adam Miszczak
2024-10-09 11:30 ` [PATCH i-g-t 2/6] lib/igt_sriov_device: add helper for resetting SR-IOV device Marcin Bernatowicz
2024-10-14 13:37 ` Adam Miszczak [this message]
2024-10-09 11:30 ` [PATCH i-g-t 3/6] tests/intel/xe_sriov_flr: Add skeleton for clear and isolation tests Marcin Bernatowicz
2024-10-18 6:58 ` Laguna, Lukasz
2024-10-09 11:30 ` [PATCH i-g-t 4/6] tests/intel/xe_sriov_flr: Implement clear-ggtt subcheck Marcin Bernatowicz
2024-10-18 7:06 ` Laguna, Lukasz
2024-10-09 11:30 ` [PATCH i-g-t 5/6] tests/intel/xe_sriov_flr: Implement clear-lmem subcheck Marcin Bernatowicz
2024-10-18 7:17 ` Laguna, Lukasz
2024-10-09 11:30 ` [PATCH i-g-t 6/6] tests/intel/xe_sriov_flr: Implement clear-scratch-regs and clear-media-scratch-regs subchecks Marcin Bernatowicz
2024-10-10 0:04 ` ✓ CI.xeBAT: success for Introduce xe_sriov_flr test Patchwork
2024-10-10 0:13 ` ✓ Fi.CI.BAT: " Patchwork
2024-10-10 14:13 ` ✗ CI.xeFULL: failure " Patchwork
2024-10-11 6:35 ` ✗ Fi.CI.IGT: " 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=111cd01b-f695-43e2-8866-62d9b7ab4584@linux.intel.com \
--to=adam.miszczak@linux.intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=jakub1.kolakowski@intel.com \
--cc=lukasz.laguna@intel.com \
--cc=marcin.bernatowicz@linux.intel.com \
--cc=michal.wajdeczko@intel.com \
--cc=michal.winiarski@intel.com \
--cc=narasimha.c.v@intel.com \
--cc=piotr.piorkowski@intel.com \
--cc=satyanarayana.k.v.p@intel.com \
--cc=tomasz.lis@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