On 5/19/25 16:03, edmund.raile wrote:
> Restore SR-IOV Intel iGPU VF passthrough capability:
> Check x-igd-opregion=off parameter in vfio_pci_igd_config_quirk and
> vfio_pci_kvmgt_config_quirk to ensure x-igd-opregion=off is
> respected despite subsequent attempt of automatic
> IGD opregion detection.
> 
> Fixes: c0273e77f2d7 ("vfio/igd: Detect IGD device by OpRegion")
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2968
> Signed-off-by: Edmund Raile <edmund.ra...@protonmail.com>
> ---
> This patch fixes a regression in QEMU’s VFIO IGD quirk handling that
> established automatic IGD opregion detection which ignores 
> x-igd-opregion=off necessary for SR-IOV VF passthrough of
> Intel iGPUs using i915-sriov-dkms.
> 
> Please review and provide feedback.
> Let me know if additional testing or changes are needed.
> 
> Kind regards,
> Edmund Raile.

Hi, Edmund

I did a quick test with x-igd-opregion=off with c0273e77f2d7 included on
SRIOV PF, setting x-igd-opregion=off works as expected on my linux
guest. Per my understanding, SRIOV PF should not have OpRegion address
in its config space 0xfc, kernel returns -ENODEV when accessing, and
QEMU continues after vfio_pci_igd_opregion_detect() fails by returing
true. Could you please share more details about this issue?

[    0.655035] i915 0000:00:02.0: [drm:intel_opregion_setup [i915]] graphic 
opregion physical addr: 0x0
[    0.655490] i915 0000:00:02.0: [drm:intel_opregion_setup [i915]] ACPI 
OpRegion not supported!
[    0.656088] i915 0000:00:02.0: Invalid PCI ROM header signature: expecting 
0xaa55, got 0x0000
[    0.656462] i915 0000:00:02.0: [drm] Failed to find VBIOS tables (VBT)

If you are mentioning the log "Device does not supports IGD OpRegion
feature", it is a false error and can be ignored I think. Maybe we can
improve this, making it more clear?

 
>  hw/vfio/igd.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/hw/vfio/igd.c b/hw/vfio/igd.c
> index e7952d15a0..e54a2a2f00 100644
> --- a/hw/vfio/igd.c
> +++ b/hw/vfio/igd.c
> @@ -523,6 +523,11 @@ static bool vfio_pci_igd_config_quirk(VFIOPCIDevice 
> *vdev, Error **errp)
>          return true;
>      }
>  
> +    /* Respect x-igd-opregion=off by skipping OpRegion handling */
> +    if (!vdev->igd_opregion) {
> +        return true;
> +    }
> +

Here (vdev->igd_opregion == NULL) is always true, the pointer is zero-
initialized and only get assigned in vfio_pci_igd_opregion_init().
Enabling OpRegion or not is by VFIO_FEATURE_ENABLE_IGD_OPREGION bit.

>      /* IGD device always comes with OpRegion */
>      if (!vfio_pci_igd_opregion_detect(vdev, &opregion, errp)) {
>          return true;
> @@ -689,6 +694,11 @@ static bool vfio_pci_kvmgt_config_quirk(VFIOPCIDevice 
> *vdev, Error **errp)
>          return true;
>      }
>  
> +    /* Respect x-igd-opregion=off by skipping OpRegion handling */
> +    if (!vdev->igd_opregion) {
> +        return true;
> +    }
> +

As I mentioned in a comment below, GVT-g vGPU always emulate OpRegion,
so let QEMU fail immediately if OpRegion is not avaliable here.

Thanks,
Moeko

>      /* FIXME: Cherryview is Gen8, but don't support GVT-g */
>      gen = igd_gen(vdev);
>      if (gen != 8 && gen != 9) {

Reply via email to