From: "Bernatowicz, Marcin" <marcin.bernatowicz@linux.intel.com>
To: Adam Miszczak <adam.miszczak@linux.intel.com>,
igt-dev@lists.freedesktop.org
Cc: kamil.konieczny@linux.intel.com
Subject: Re: [PATCH i-g-t 3/7] tools/vmtb: Align driver/device layer with current xe SR-IOV interfaces
Date: Thu, 8 Oct 2026 15:54:45 +0200 [thread overview]
Message-ID: <72e41ecd-9c3d-4e07-b3e1-1e642e805e96@linux.intel.com> (raw)
In-Reply-To: <20260928072600.426902-4-adam.miszczak@linux.intel.com>
LGTM,
Reviewed-by: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>
On 9/28/2026 9:25 AM, Adam Miszczak wrote:
> Move VF VRAM quota provisioning from the obsolete debugfs lmem_quota
> attribute to the sysfs SRIOV admin tree
> (/sys/bus/pci/drivers/xe/[BDF]/sriov_admin/vf[N]/profile/vram_quota)
> and update the driver abstraction and provisioning helpers.
>
> Fix physical Device bind()/unbind() calls that still passed a PCI BDF
> to DriverInterface, breaking unload_drivers() with a TypeError.
>
> Add DeviceInterface.reset() that triggers an FLR via
> /sys/bus/pci/devices/[BDF]/reset - PF FLR on the host for physical
> devices and VF FLR in the guest for virtual devices.
>
> Signed-off-by: Adam Miszczak <adam.miszczak@linux.intel.com>
> ---
> tools/vmtb/bench/drivers/driver_interface.py | 8 ++--
> tools/vmtb/bench/drivers/xe.py | 39 ++++++++++---------
> tools/vmtb/bench/machines/device_interface.py | 7 ++++
> tools/vmtb/bench/machines/physical/device.py | 12 ++++--
> tools/vmtb/bench/machines/virtual/device.py | 4 ++
> 5 files changed, 44 insertions(+), 26 deletions(-)
>
> diff --git a/tools/vmtb/bench/drivers/driver_interface.py b/tools/vmtb/bench/drivers/driver_interface.py
> index 0b0bd5abb..9d1e5ab00 100644
> --- a/tools/vmtb/bench/drivers/driver_interface.py
> +++ b/tools/vmtb/bench/drivers/driver_interface.py
> @@ -201,19 +201,19 @@ class PfDriverInterface(DriverInterface, abc.ABC):
>
> # VF provisioning
> @abc.abstractmethod
> - def get_ggtt_quota(self, vf_num: int, gt_num: int) -> int:
> + def get_vram_quota(self, vf_num: int) -> int:
> raise NotImplementedError
>
> @abc.abstractmethod
> - def set_ggtt_quota(self, vf_num: int, gt_num: int, val: int) -> None:
> + def set_vram_quota(self, vf_num: int, val: int) -> None:
> raise NotImplementedError
>
> @abc.abstractmethod
> - def get_lmem_quota(self, vf_num: int, gt_num: int) -> int:
> + def get_ggtt_quota(self, vf_num: int, gt_num: int) -> int:
> raise NotImplementedError
>
> @abc.abstractmethod
> - def set_lmem_quota(self, vf_num: int, gt_num: int, val: int) -> None:
> + def set_ggtt_quota(self, vf_num: int, gt_num: int, val: int) -> None:
> raise NotImplementedError
>
> @abc.abstractmethod
> diff --git a/tools/vmtb/bench/drivers/xe.py b/tools/vmtb/bench/drivers/xe.py
> index 26e4e0a08..479c1dd87 100644
> --- a/tools/vmtb/bench/drivers/xe.py
> +++ b/tools/vmtb/bench/drivers/xe.py
> @@ -140,7 +140,27 @@ class XeDriver(PfDriverInterface):
> path = self.__helper_create_debugfs_path(0, gt_num, '', 'sample_period_ms')
> self.write_debugfs(path, str(val))
>
> - # VF and PF provisioning parameters
> + # VF provisioning parameters
> + # Sysfs location: [SRIOV sysfs base path]/sriov_admin/[vfN]/profile
> + # @vf_num: VF number (1-based) or 0 for PF
> + def get_vram_quota(self, vf_num: int) -> int:
> + if vf_num == 0:
> + logger.warning("PF vram_quota not available")
> + return 0
> +
> + sriov_admin_path = self.__helper_create_sriov_admin_path(vf_num, 'vram_quota')
> + return int(self.read_sysfs(self.sysfs_device_path / sriov_admin_path)) if self.has_lmem() else 0
> +
> + def set_vram_quota(self, vf_num: int, val: int) -> None:
> + if vf_num == 0:
> + logger.warning("PF vram_quota not available")
> + return
> +
> + sriov_admin_path = self.__helper_create_sriov_admin_path(vf_num, 'vram_quota')
> + if self.has_lmem():
> + self.write_sysfs(self.sysfs_device_path / sriov_admin_path, str(val))
> +
> + # VF provisioning parameters (debugfs)
> # Debugfs location: [SRIOV debugfs base path]/gtM/[pf|vfN]
> # @vf_num: VF number (1-based) or 0 for PF
> def get_ggtt_quota(self, vf_num: int, gt_num: int) -> int:
> @@ -159,23 +179,6 @@ class XeDriver(PfDriverInterface):
> path = self.__helper_create_debugfs_path(vf_num, gt_num, '', 'ggtt_quota')
> self.write_debugfs(path, str(val))
>
> - def get_lmem_quota(self, vf_num: int, gt_num: int) -> int:
> - if vf_num == 0:
> - logger.warning("PF lmem_quota not available")
> - return 0
> -
> - path = self.__helper_create_debugfs_path(vf_num, gt_num, '', 'lmem_quota')
> - return int(self.read_debugfs(path)) if self.has_lmem() else 0
> -
> - def set_lmem_quota(self, vf_num: int, gt_num: int, val: int) -> None:
> - if vf_num == 0:
> - logger.warning("PF lmem_quota not available")
> - return
> -
> - path = self.__helper_create_debugfs_path(vf_num, gt_num, '', 'lmem_quota')
> - if self.has_lmem():
> - self.write_debugfs(path, str(val))
> -
> def get_contexts_quota(self, vf_num: int, gt_num: int) -> int:
> if vf_num == 0:
> logger.warning("PF contexts_quota not available")
> diff --git a/tools/vmtb/bench/machines/device_interface.py b/tools/vmtb/bench/machines/device_interface.py
> index 0eff493f0..76b47de03 100644
> --- a/tools/vmtb/bench/machines/device_interface.py
> +++ b/tools/vmtb/bench/machines/device_interface.py
> @@ -10,8 +10,15 @@ class DeviceInterface(abc.ABC):
> """
> @abc.abstractmethod
> def bind_driver(self) -> None:
> + """Bind driver to device."""
> raise NotImplementedError
>
> @abc.abstractmethod
> def unbind_driver(self) -> None:
> + """Unbind driver from device."""
> + raise NotImplementedError
> +
> + @abc.abstractmethod
> + def reset(self) -> None:
> + """Reset device (trigger FLR)."""
> raise NotImplementedError
> diff --git a/tools/vmtb/bench/machines/physical/device.py b/tools/vmtb/bench/machines/physical/device.py
> index 6c0dc4ff9..b4eebc245 100644
> --- a/tools/vmtb/bench/machines/physical/device.py
> +++ b/tools/vmtb/bench/machines/physical/device.py
> @@ -125,10 +125,14 @@ class Device(DeviceInterface):
> return ret
>
> def bind_driver(self) -> None:
> - self.driver.bind(self.pci_info.bdf)
> + self.driver.bind()
>
> def unbind_driver(self) -> None:
> - self.driver.unbind(self.pci_info.bdf)
> + self.driver.unbind()
> +
> + def reset(self) -> None:
> + logger.debug("[%s] Trigger reset (PF FLR)", self.pci_info.bdf)
> + self.driver.flr()
>
> def override_vf_driver(self, vf_num: int) -> str:
> """Set VFIO as VF driver."""
> @@ -224,8 +228,8 @@ class Device(DeviceInterface):
> self.driver.set_pf_doorbells_spare(gt_num, resources_config.pfDoorbells)
> else:
> if not self.is_gt_media_type(gt_num):
> + self.driver.set_vram_quota(fn_num, resources_config.vfLmem)
> self.driver.set_ggtt_quota(fn_num, gt_num, resources_config.vfGgtt)
> - self.driver.set_lmem_quota(fn_num, gt_num, resources_config.vfLmem)
> self.driver.set_contexts_quota(fn_num, gt_num, resources_config.vfContexts)
> self.driver.set_doorbells_quota(fn_num, gt_num, resources_config.vfDoorbells)
>
> @@ -246,8 +250,8 @@ class Device(DeviceInterface):
> self.driver.set_contexts_quota(vf_num, gt_num, 0)
> self.driver.set_doorbells_quota(vf_num, gt_num, 0)
> if not self.is_gt_media_type(gt_num):
> + self.driver.set_vram_quota(vf_num, 0)
> self.driver.set_ggtt_quota(vf_num, gt_num, 0)
> - self.driver.set_lmem_quota(vf_num, gt_num, 0)
>
> def reset_provisioning(self, num_vfs: int) -> None:
> """Clear provisioning config for a given number of VFs and restore auto provisioning mode."""
> diff --git a/tools/vmtb/bench/machines/virtual/device.py b/tools/vmtb/bench/machines/virtual/device.py
> index c838db59d..b36dbba58 100644
> --- a/tools/vmtb/bench/machines/virtual/device.py
> +++ b/tools/vmtb/bench/machines/virtual/device.py
> @@ -68,6 +68,10 @@ class VirtualDevice(DeviceInterface):
> self.vm.get_drm_driver_name(), self.pci_info.bdf)
> self.driver.unbind()
>
> + def reset(self) -> None:
> + logger.debug("[%s] Trigger reset (VF FLR)", self.pci_info.bdf)
> + self.driver.flr() # VF FLR from guest's sysfs
> +
> @property
> def lmem_size(self) -> typing.Optional[int]:
> if self._lmem_size is None:
next prev parent reply other threads:[~2026-10-08 13:56 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-28 7:25 [PATCH i-g-t 0/7] tools/vmtb: Sync VM Test Bench core with current xe SR-IOV Adam Miszczak
2026-09-28 7:25 ` [PATCH i-g-t 1/7] tools/vmtb: Introduce asynchronous VM state save/load functions Adam Miszczak
2026-10-08 13:53 ` Bernatowicz, Marcin
2026-09-28 7:25 ` [PATCH i-g-t 2/7] tools/vmtb: Rework VF scheduler provisioning Adam Miszczak
2026-10-08 13:54 ` Bernatowicz, Marcin
2026-09-28 7:25 ` [PATCH i-g-t 3/7] tools/vmtb: Align driver/device layer with current xe SR-IOV interfaces Adam Miszczak
2026-10-08 13:54 ` Bernatowicz, Marcin [this message]
2026-09-28 7:25 ` [PATCH i-g-t 4/7] tools/vmtb: Fix guest timeout handling and PCI BDF matching Adam Miszczak
2026-10-08 13:55 ` Bernatowicz, Marcin
2026-09-28 7:25 ` [PATCH i-g-t 5/7] tools/vmtb: Add pre-test environment cleanup Adam Miszczak
2026-10-08 13:55 ` Bernatowicz, Marcin
2026-09-28 7:25 ` [PATCH i-g-t 6/7] tools/vmtb: Add VM dmesg wait support Adam Miszczak
2026-10-08 13:56 ` Bernatowicz, Marcin
2026-09-28 7:26 ` [PATCH i-g-t 7/7] tools/vmtb: Extend IGT and WSIM executors Adam Miszczak
2026-10-08 12:59 ` Bernatowicz, Marcin
2026-09-28 20:28 ` ✓ i915.CI.BAT: success for tools/vmtb: Sync VM Test Bench core with current xe SR-IOV Patchwork
2026-09-28 20:47 ` ✓ Xe.CI.BAT: " Patchwork
2026-09-29 2:19 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-09-29 4:08 ` ✗ i915.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=72e41ecd-9c3d-4e07-b3e1-1e642e805e96@linux.intel.com \
--to=marcin.bernatowicz@linux.intel.com \
--cc=adam.miszczak@linux.intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=kamil.konieczny@linux.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