mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-23 10:01:59 -06:00
vfio/igd: Handle x-igd-opregion option in config quirk
Both enable OpRegion option (x-igd-opregion) and legacy mode require setting up OpRegion copy for IGD devices. As the config quirk no longer depends on legacy mode, we can now handle x-igd-opregion option there instead of in vfio_realize. Signed-off-by: Tomita Moeko <tomitamoeko@gmail.com> Reviewed-by: Alex Williamson <alex.williamson@redhat.com> Tested-by: Alex Williamson <alex.williamson@redhat.com> Reviewed-by: Corvin Köhne <c.koehne@beckhoff.com> Link: https://lore.kernel.org/qemu-devel/20250306180131.32970-9-tomitamoeko@gmail.com Signed-off-by: Cédric Le Goater <clg@redhat.com>
This commit is contained in:
parent
2fedccf03c
commit
434ac62ef2
3 changed files with 9 additions and 16 deletions
|
@ -189,7 +189,7 @@ static bool vfio_pci_igd_opregion_init(VFIOPCIDevice *vdev,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool vfio_pci_igd_setup_opregion(VFIOPCIDevice *vdev, Error **errp)
|
static bool vfio_pci_igd_setup_opregion(VFIOPCIDevice *vdev, Error **errp)
|
||||||
{
|
{
|
||||||
g_autofree struct vfio_region_info *opregion = NULL;
|
g_autofree struct vfio_region_info *opregion = NULL;
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -560,10 +560,8 @@ bool vfio_probe_igd_config_quirk(VFIOPCIDevice *vdev, Error **errp)
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Setup OpRegion access */
|
/* Enable OpRegion quirk */
|
||||||
if (!vfio_pci_igd_setup_opregion(vdev, &err)) {
|
vdev->features |= VFIO_FEATURE_ENABLE_IGD_OPREGION;
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Setup LPC bridge / Host bridge PCI IDs */
|
/* Setup LPC bridge / Host bridge PCI IDs */
|
||||||
if (!vfio_pci_igd_setup_lpc_bridge(vdev, &err)) {
|
if (!vfio_pci_igd_setup_lpc_bridge(vdev, &err)) {
|
||||||
|
@ -575,6 +573,12 @@ bool vfio_probe_igd_config_quirk(VFIOPCIDevice *vdev, Error **errp)
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Setup OpRegion access */
|
||||||
|
if ((vdev->features & VFIO_FEATURE_ENABLE_IGD_OPREGION) &&
|
||||||
|
!vfio_pci_igd_setup_opregion(vdev, errp)) {
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Allow user to override dsm size using x-igd-gms option, in multiples of
|
* Allow user to override dsm size using x-igd-gms option, in multiples of
|
||||||
* 32MiB. This option should only be used when the desired size cannot be
|
* 32MiB. This option should only be used when the desired size cannot be
|
||||||
|
|
|
@ -3140,15 +3140,6 @@ static void vfio_realize(PCIDevice *pdev, Error **errp)
|
||||||
vfio_bar_quirk_setup(vdev, i);
|
vfio_bar_quirk_setup(vdev, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_VFIO_IGD
|
|
||||||
if (!vdev->igd_opregion &&
|
|
||||||
vdev->features & VFIO_FEATURE_ENABLE_IGD_OPREGION) {
|
|
||||||
if (!vfio_pci_igd_setup_opregion(vdev, errp)) {
|
|
||||||
goto out_unset_idev;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* QEMU emulates all of MSI & MSIX */
|
/* QEMU emulates all of MSI & MSIX */
|
||||||
if (pdev->cap_present & QEMU_PCI_CAP_MSIX) {
|
if (pdev->cap_present & QEMU_PCI_CAP_MSIX) {
|
||||||
memset(vdev->emulated_config_bits + pdev->msix_cap, 0xff,
|
memset(vdev->emulated_config_bits + pdev->msix_cap, 0xff,
|
||||||
|
|
|
@ -229,8 +229,6 @@ int vfio_pci_get_pci_hot_reset_info(VFIOPCIDevice *vdev,
|
||||||
|
|
||||||
bool vfio_populate_vga(VFIOPCIDevice *vdev, Error **errp);
|
bool vfio_populate_vga(VFIOPCIDevice *vdev, Error **errp);
|
||||||
|
|
||||||
bool vfio_pci_igd_setup_opregion(VFIOPCIDevice *vdev, Error **errp);
|
|
||||||
|
|
||||||
void vfio_display_reset(VFIOPCIDevice *vdev);
|
void vfio_display_reset(VFIOPCIDevice *vdev);
|
||||||
bool vfio_display_probe(VFIOPCIDevice *vdev, Error **errp);
|
bool vfio_display_probe(VFIOPCIDevice *vdev, Error **errp);
|
||||||
void vfio_display_finalize(VFIOPCIDevice *vdev);
|
void vfio_display_finalize(VFIOPCIDevice *vdev);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue