From: "Cédric Le Goater" <clg@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Alex Williamson" <alex.williamson@redhat.com>,
"Tomita Moeko" <tomitamoeko@gmail.com>,
"Edmund Raile" <edmund.raile@protonmail.com>,
"Corvin Köhne" <c.koehne@beckhoff.com>,
"Cédric Le Goater" <clg@redhat.com>
Subject: [PULL 07/16] vfio/igd: Fix incorrect error propagation in vfio_pci_igd_opregion_detect()
Date: Thu, 5 Jun 2025 10:42:36 +0200 [thread overview]
Message-ID: <20250605084245.1520562-8-clg@redhat.com> (raw)
In-Reply-To: <20250605084245.1520562-1-clg@redhat.com>
From: Tomita Moeko <tomitamoeko@gmail.com>
In vfio_pci_igd_opregion_detect(), errp will be set when the device does
not have OpRegion or is hotplugged. This errp will be propagated to
pci_qdev_realize(), which interprets it as failure, causing unexpected
termination on devices without OpRegion like SR-IOV VFs or discrete
GPUs. Fix it by not setting errp in vfio_pci_igd_opregion_detect().
This patch also checks if the device has OpRegion before hotplug status
to prevent unwanted warning messages on non-IGD devices.
Fixes: c0273e77f2d7 ("vfio/igd: Detect IGD device by OpRegion")
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2968
Reported-by: Edmund Raile <edmund.raile@protonmail.com>
Link: https://lore.kernel.org/qemu-devel/30044d14-17ec-46e3-b9c3-63d27a5bde27@gmail.com
Tested-by: Edmund Raile <edmund.raile@protonmail.com>
Signed-off-by: Tomita Moeko <tomitamoeko@gmail.com>
Reviewed-by: Alex Williamson <alex.williamson@redhat.com>
Reviewed-by: Corvin Köhne <c.koehne@beckhoff.com>
Link: https://lore.kernel.org/qemu-devel/20250522151636.20001-1-tomitamoeko@gmail.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
---
hw/vfio/igd.c | 22 ++++++++++------------
1 file changed, 10 insertions(+), 12 deletions(-)
diff --git a/hw/vfio/igd.c b/hw/vfio/igd.c
index 5b6341c5bfeda5c3f5210ea080aba144d9edc90b..e7a9d1ffc13044dd01ba83b88b2b3a1c24cfbf98 100644
--- a/hw/vfio/igd.c
+++ b/hw/vfio/igd.c
@@ -187,23 +187,21 @@ static bool vfio_pci_igd_opregion_init(VFIOPCIDevice *vdev,
}
static bool vfio_pci_igd_opregion_detect(VFIOPCIDevice *vdev,
- struct vfio_region_info **opregion,
- Error **errp)
+ struct vfio_region_info **opregion)
{
int ret;
- /* Hotplugging is not supported for opregion access */
- if (vdev->pdev.qdev.hotplugged) {
- error_setg(errp, "IGD OpRegion is not supported on hotplugged device");
- return false;
- }
-
ret = vfio_device_get_region_info_type(&vdev->vbasedev,
VFIO_REGION_TYPE_PCI_VENDOR_TYPE | PCI_VENDOR_ID_INTEL,
VFIO_REGION_SUBTYPE_INTEL_IGD_OPREGION, opregion);
if (ret) {
- error_setg_errno(errp, -ret,
- "Device does not support IGD OpRegion feature");
+ return false;
+ }
+
+ /* Hotplugging is not supported for opregion access */
+ if (vdev->pdev.qdev.hotplugged) {
+ warn_report("IGD device detected, but OpRegion is not supported "
+ "on hotplugged device.");
return false;
}
@@ -524,7 +522,7 @@ static bool vfio_pci_igd_config_quirk(VFIOPCIDevice *vdev, Error **errp)
}
/* IGD device always comes with OpRegion */
- if (!vfio_pci_igd_opregion_detect(vdev, &opregion, errp)) {
+ if (!vfio_pci_igd_opregion_detect(vdev, &opregion)) {
return true;
}
info_report("OpRegion detected on Intel display %x.", vdev->device_id);
@@ -695,7 +693,7 @@ static bool vfio_pci_kvmgt_config_quirk(VFIOPCIDevice *vdev, Error **errp)
return true;
}
- if (!vfio_pci_igd_opregion_detect(vdev, &opregion, errp)) {
+ if (!vfio_pci_igd_opregion_detect(vdev, &opregion)) {
/* Should never reach here, KVMGT always emulates OpRegion */
return false;
}
--
2.49.0
next prev parent reply other threads:[~2025-06-05 8:45 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-05 8:42 [PULL 00/16] vfio queue Cédric Le Goater
2025-06-05 8:42 ` [PULL 01/16] vfio/igd: OpRegion not found fix error typo Cédric Le Goater
2025-06-05 8:42 ` [PULL 02/16] vfio: add more VFIOIOMMUClass docs Cédric Le Goater
2025-06-05 8:42 ` [PULL 03/16] vfio: move more cleanup into vfio_pci_put_device() Cédric Le Goater
2025-06-05 8:42 ` [PULL 04/16] vfio: move config space read into vfio_pci_config_setup() Cédric Le Goater
2025-06-05 8:42 ` [PULL 05/16] vfio: refactor out IRQ signalling setup Cédric Le Goater
2025-06-05 8:42 ` [PULL 06/16] vfio/iommufd: Add comment emphasizing no movement of hiod->realize() call Cédric Le Goater
2025-06-05 8:42 ` Cédric Le Goater [this message]
2025-06-05 8:42 ` [PULL 08/16] vfio: return mr from vfio_get_xlat_addr Cédric Le Goater
2025-06-05 8:42 ` [PULL 09/16] vfio/container: pass MemoryRegion to DMA operations Cédric Le Goater
2025-06-05 8:42 ` [PULL 10/16] backends/iommufd: Add a helper to invalidate user-managed HWPT Cédric Le Goater
2025-06-05 8:42 ` [PULL 11/16] vfio/iommufd: Add properties and handlers to TYPE_HOST_IOMMU_DEVICE_IOMMUFD Cédric Le Goater
2025-06-05 8:42 ` [PULL 12/16] vfio/iommufd: Implement [at|de]tach_hwpt handlers Cédric Le Goater
2025-06-05 8:42 ` [PULL 13/16] vfio/iommufd: Save vendor specific device info Cédric Le Goater
2025-06-05 8:42 ` [PULL 14/16] MAINTAINERS: Add reviewer for CPR Cédric Le Goater
2025-06-05 8:42 ` [PULL 15/16] vfio: vfio_find_ram_discard_listener Cédric Le Goater
2025-06-05 8:42 ` [PULL 16/16] vfio: move vfio-cpr.h Cédric Le Goater
2025-06-05 19:00 ` [PULL 00/16] vfio queue Stefan Hajnoczi
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=20250605084245.1520562-8-clg@redhat.com \
--to=clg@redhat.com \
--cc=alex.williamson@redhat.com \
--cc=c.koehne@beckhoff.com \
--cc=edmund.raile@protonmail.com \
--cc=qemu-devel@nongnu.org \
--cc=tomitamoeko@gmail.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;
as well as URLs for NNTP newsgroup(s).