mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 07:13:54 -06:00
vfio/igd: Fix broken KVMGT OpRegion support
The KVMGT/GVT-g vGPU also exposes OpRegion. But unlike IGD passthrough, it only needs the OpRegion quirk. A previous change moved x-igd-opregion handling to config quirk breaks KVMGT functionality as it brings extra checks and applied other quirks. Here we check if the device is mdev (KVMGT) or not (passthrough), and then applies corresponding quirks. As before, users must manually specify x-igd-opregion=on to enable it on KVMGT devices. In the future, we may check the VID/DID and enable OpRegion automatically. 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-11-tomitamoeko@gmail.com Signed-off-by: Cédric Le Goater <clg@redhat.com>
This commit is contained in:
parent
674f61117d
commit
e46b7af508
1 changed files with 26 additions and 1 deletions
|
@ -481,7 +481,7 @@ void vfio_probe_igd_bar0_quirk(VFIOPCIDevice *vdev, int nr)
|
|||
QLIST_INSERT_HEAD(&vdev->bars[nr].quirks, bdsm_quirk, next);
|
||||
}
|
||||
|
||||
bool vfio_probe_igd_config_quirk(VFIOPCIDevice *vdev, Error **errp)
|
||||
static bool vfio_pci_igd_config_quirk(VFIOPCIDevice *vdev, Error **errp)
|
||||
{
|
||||
int ret, gen;
|
||||
uint64_t gms_size;
|
||||
|
@ -655,3 +655,28 @@ error:
|
|||
error_propagate(errp, err);
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* KVMGT/GVT-g vGPU exposes an emulated OpRegion. So far, users have to specify
|
||||
* x-igd-opregion=on to enable the access.
|
||||
* TODO: Check VID/DID and enable opregion access automatically
|
||||
*/
|
||||
static bool vfio_pci_kvmgt_config_quirk(VFIOPCIDevice *vdev, Error **errp)
|
||||
{
|
||||
if ((vdev->features & VFIO_FEATURE_ENABLE_IGD_OPREGION) &&
|
||||
!vfio_pci_igd_setup_opregion(vdev, errp)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool vfio_probe_igd_config_quirk(VFIOPCIDevice *vdev, Error **errp)
|
||||
{
|
||||
/* KVMGT/GVT-g vGPU is exposed as mdev */
|
||||
if (vdev->vbasedev.mdev) {
|
||||
return vfio_pci_kvmgt_config_quirk(vdev, errp);
|
||||
}
|
||||
|
||||
return vfio_pci_igd_config_quirk(vdev, errp);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue