On Tue, 22 Apr 2025 00:31:01 +0800
Tomita Moeko <tomitamoeko@gmail.com> wrote:
> Intel only provides legacy VBIOS for IGD up to Gen9, and there is no
> CSM support on later devices. Additionally, Seabios can only handle
> 32-bit BDSM register used until Gen9. Since legacy mode requires VGA
> capability, restrict it to Gen6 through Gen9 devices.
>
> Link: https://lore.kernel.org/qemu-devel/20250325172239.27926-1-tomitamoeko@gmail.com/T/
> Signed-off-by: Tomita Moeko <tomitamoeko@gmail.com>
> ---
> hw/vfio/igd.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/hw/vfio/igd.c b/hw/vfio/igd.c
> index 6678e0e5cd..01826acf10 100644
> --- a/hw/vfio/igd.c
> +++ b/hw/vfio/igd.c
> @@ -516,11 +516,13 @@ static bool vfio_pci_igd_config_quirk(VFIOPCIDevice *vdev, Error **errp)
>
> /*
> * For backward compatibility, enable legacy mode when
> + * - Device geneation is 6 to 9 (including both)
> * - Machine type is i440fx (pc_piix)
> * - IGD device is at guest BDF 00:02.0
> * - Not manually disabled by x-igd-legacy-mode=off
> */
> if ((vdev->igd_legacy_mode != ON_OFF_AUTO_OFF) &&
> + (gen >= 6 && gen <= 9) &&
> !strcmp(MACHINE_GET_CLASS(qdev_get_machine())->family, "pc_piix") &&
> (&vdev->pdev == pci_find_device(pci_device_root_bus(&vdev->pdev),
> 0, PCI_DEVFN(0x2, 0)))) {
> @@ -565,7 +567,9 @@ static bool vfio_pci_igd_config_quirk(VFIOPCIDevice *vdev, Error **errp)
> vdev->features |= VFIO_FEATURE_ENABLE_IGD_LPC;
> } else if (vdev->igd_legacy_mode == ON_OFF_AUTO_ON) {
> error_setg(&err,
> - "Machine is not i440fx or assigned BDF is not 00:02.0");
> + "Machine is not i440fx, assigned BDF is not 00:02.0, "
> + "or device %04x doesn't support legacy mode",
> + vdev->device_id);
> goto error;
> }
>
It seems more useful to me to print the generation than the device ID.
A bug report where the generation value is obviously bogus or outside
the supported ranges is more actionable than a PCI device ID. Thanks,
Alex