Message ID | 20250308230917.18907-12-philmd@linaro.org (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | hw/vfio: Build various objects once | expand |
On 3/9/25 00:09, Philippe Mathieu-Daudé wrote: > Define TYPE_VFIO_PCI_IGD_LPC_BRIDGE once to help > following where the QOM type is used in the code. > We'll use it once more in the next commit. > > Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Cédric Le Goater <clg@redhat.com> Thanks, C. > --- > hw/vfio/pci-quirks.h | 2 ++ > hw/vfio/igd.c | 4 ++-- > 2 files changed, 4 insertions(+), 2 deletions(-) > > diff --git a/hw/vfio/pci-quirks.h b/hw/vfio/pci-quirks.h > index d1532e379b1..fdaa81f00aa 100644 > --- a/hw/vfio/pci-quirks.h > +++ b/hw/vfio/pci-quirks.h > @@ -69,4 +69,6 @@ typedef struct VFIOConfigMirrorQuirk { > > extern const MemoryRegionOps vfio_generic_mirror_quirk; > > +#define TYPE_VFIO_PCI_IGD_LPC_BRIDGE "vfio-pci-igd-lpc-bridge" > + > #endif /* HW_VFIO_VFIO_PCI_QUIRKS_H */ > diff --git a/hw/vfio/igd.c b/hw/vfio/igd.c > index b1a237edd66..1fd3c4ef1d0 100644 > --- a/hw/vfio/igd.c > +++ b/hw/vfio/igd.c > @@ -262,7 +262,7 @@ static void vfio_pci_igd_lpc_bridge_class_init(ObjectClass *klass, void *data) > } > > static const TypeInfo vfio_pci_igd_lpc_bridge_info = { > - .name = "vfio-pci-igd-lpc-bridge", > + .name = TYPE_VFIO_PCI_IGD_LPC_BRIDGE, > .parent = TYPE_PCI_DEVICE, > .class_init = vfio_pci_igd_lpc_bridge_class_init, > .interfaces = (InterfaceInfo[]) { > @@ -524,7 +524,7 @@ void vfio_probe_igd_bar4_quirk(VFIOPCIDevice *vdev, int nr) > lpc_bridge = pci_find_device(pci_device_root_bus(&vdev->pdev), > 0, PCI_DEVFN(0x1f, 0)); > if (lpc_bridge && !object_dynamic_cast(OBJECT(lpc_bridge), > - "vfio-pci-igd-lpc-bridge")) { > + TYPE_VFIO_PCI_IGD_LPC_BRIDGE)) { > error_report("IGD device %s cannot support legacy mode due to existing " > "devices at address 1f.0", vdev->vbasedev.name); > return;
On 3/9/25 12:09 AM, Philippe Mathieu-Daudé wrote: > Define TYPE_VFIO_PCI_IGD_LPC_BRIDGE once to help > following where the QOM type is used in the code. > We'll use it once more in the next commit. > > Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Eric Auger <eric.auger@redhat.com> Eric > --- > hw/vfio/pci-quirks.h | 2 ++ > hw/vfio/igd.c | 4 ++-- > 2 files changed, 4 insertions(+), 2 deletions(-) > > diff --git a/hw/vfio/pci-quirks.h b/hw/vfio/pci-quirks.h > index d1532e379b1..fdaa81f00aa 100644 > --- a/hw/vfio/pci-quirks.h > +++ b/hw/vfio/pci-quirks.h > @@ -69,4 +69,6 @@ typedef struct VFIOConfigMirrorQuirk { > > extern const MemoryRegionOps vfio_generic_mirror_quirk; > > +#define TYPE_VFIO_PCI_IGD_LPC_BRIDGE "vfio-pci-igd-lpc-bridge" > + > #endif /* HW_VFIO_VFIO_PCI_QUIRKS_H */ > diff --git a/hw/vfio/igd.c b/hw/vfio/igd.c > index b1a237edd66..1fd3c4ef1d0 100644 > --- a/hw/vfio/igd.c > +++ b/hw/vfio/igd.c > @@ -262,7 +262,7 @@ static void vfio_pci_igd_lpc_bridge_class_init(ObjectClass *klass, void *data) > } > > static const TypeInfo vfio_pci_igd_lpc_bridge_info = { > - .name = "vfio-pci-igd-lpc-bridge", > + .name = TYPE_VFIO_PCI_IGD_LPC_BRIDGE, > .parent = TYPE_PCI_DEVICE, > .class_init = vfio_pci_igd_lpc_bridge_class_init, > .interfaces = (InterfaceInfo[]) { > @@ -524,7 +524,7 @@ void vfio_probe_igd_bar4_quirk(VFIOPCIDevice *vdev, int nr) > lpc_bridge = pci_find_device(pci_device_root_bus(&vdev->pdev), > 0, PCI_DEVFN(0x1f, 0)); > if (lpc_bridge && !object_dynamic_cast(OBJECT(lpc_bridge), > - "vfio-pci-igd-lpc-bridge")) { > + TYPE_VFIO_PCI_IGD_LPC_BRIDGE)) { > error_report("IGD device %s cannot support legacy mode due to existing " > "devices at address 1f.0", vdev->vbasedev.name); > return;
diff --git a/hw/vfio/pci-quirks.h b/hw/vfio/pci-quirks.h index d1532e379b1..fdaa81f00aa 100644 --- a/hw/vfio/pci-quirks.h +++ b/hw/vfio/pci-quirks.h @@ -69,4 +69,6 @@ typedef struct VFIOConfigMirrorQuirk { extern const MemoryRegionOps vfio_generic_mirror_quirk; +#define TYPE_VFIO_PCI_IGD_LPC_BRIDGE "vfio-pci-igd-lpc-bridge" + #endif /* HW_VFIO_VFIO_PCI_QUIRKS_H */ diff --git a/hw/vfio/igd.c b/hw/vfio/igd.c index b1a237edd66..1fd3c4ef1d0 100644 --- a/hw/vfio/igd.c +++ b/hw/vfio/igd.c @@ -262,7 +262,7 @@ static void vfio_pci_igd_lpc_bridge_class_init(ObjectClass *klass, void *data) } static const TypeInfo vfio_pci_igd_lpc_bridge_info = { - .name = "vfio-pci-igd-lpc-bridge", + .name = TYPE_VFIO_PCI_IGD_LPC_BRIDGE, .parent = TYPE_PCI_DEVICE, .class_init = vfio_pci_igd_lpc_bridge_class_init, .interfaces = (InterfaceInfo[]) { @@ -524,7 +524,7 @@ void vfio_probe_igd_bar4_quirk(VFIOPCIDevice *vdev, int nr) lpc_bridge = pci_find_device(pci_device_root_bus(&vdev->pdev), 0, PCI_DEVFN(0x1f, 0)); if (lpc_bridge && !object_dynamic_cast(OBJECT(lpc_bridge), - "vfio-pci-igd-lpc-bridge")) { + TYPE_VFIO_PCI_IGD_LPC_BRIDGE)) { error_report("IGD device %s cannot support legacy mode due to existing " "devices at address 1f.0", vdev->vbasedev.name); return;
Define TYPE_VFIO_PCI_IGD_LPC_BRIDGE once to help following where the QOM type is used in the code. We'll use it once more in the next commit. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> --- hw/vfio/pci-quirks.h | 2 ++ hw/vfio/igd.c | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-)