diff mbox

[RfC,08/15] virtio-gpu-pci: virtio-1.0 adaptions [fixup]

Message ID 1424687012-18524-9-git-send-email-kraxel@redhat.com
State New
Headers show

Commit Message

Gerd Hoffmann Feb. 23, 2015, 10:23 a.m. UTC
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/display/virtio-gpu-pci.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

Comments

Max Reitz Feb. 26, 2015, 4:46 p.m. UTC | #1
On 2015-02-23 at 05:23, Gerd Hoffmann wrote:
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>   hw/display/virtio-gpu-pci.c | 11 ++++-------
>   1 file changed, 4 insertions(+), 7 deletions(-)
>
> diff --git a/hw/display/virtio-gpu-pci.c b/hw/display/virtio-gpu-pci.c
> index 77c5e06..791ee8b 100644
> --- a/hw/display/virtio-gpu-pci.c
> +++ b/hw/display/virtio-gpu-pci.c
> @@ -28,10 +28,10 @@ static int virtio_gpu_pci_init(VirtIOPCIProxy *vpci_dev)
>       DeviceState *vdev = DEVICE(&vgpu->vdev);
>   
>       qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus));
> -    if (qdev_init(vdev) < 0) {
> -        return -1;
> -    }
> -    return 0;
> +    /* force virtio-1.0 */
> +    vpci_dev->flags &= ~VIRTIO_PCI_FLAG_DISABLE_MODERN;
> +    vpci_dev->flags |= VIRTIO_PCI_FLAG_DISABLE_LEGACY;
> +    return qdev_init(vdev);
>   }
>   
>   static void virtio_gpu_pci_class_init(ObjectClass *klass, void *data)
> @@ -43,9 +43,6 @@ static void virtio_gpu_pci_class_init(ObjectClass *klass, void *data)
>       set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories);
>       dc->props = virtio_gpu_pci_properties;
>       k->init = virtio_gpu_pci_init;
> -    pcidev_k->vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET;
> -    pcidev_k->device_id = PCI_DEVICE_ID_VIRTIO_GPU;
> -    pcidev_k->revision = VIRTIO_PCI_ABI_VERSION;

So I guess this is the reason why you didn't update pci-ids.txt in patch 7.

This seems to be in line with the changes made in patch 1; however, I 
fail to see where VirtIODevice.device_id is set so that 
virtio_bus_get_vdev_id() returns it when called from 
virtio_pci_device_plugged()... Maybe I'll find it yet.

Max

>       pcidev_k->class_id = PCI_CLASS_DISPLAY_OTHER;
>   }
Gerd Hoffmann Feb. 27, 2015, 11:18 a.m. UTC | #2
Hi,

> This seems to be in line with the changes made in patch 1; however, I 
> fail to see where VirtIODevice.device_id is set so that 
> virtio_bus_get_vdev_id() returns it when called from 
> virtio_pci_device_plugged()... Maybe I'll find it yet.

virtio_gpu_device_realize() calls virtio_init() with the id as one of
the parameters.

cheers,
  Gerd
Max Reitz Feb. 27, 2015, 2:30 p.m. UTC | #3
On 2015-02-27 at 06:18, Gerd Hoffmann wrote:
>    Hi,
>
>> This seems to be in line with the changes made in patch 1; however, I
>> fail to see where VirtIODevice.device_id is set so that
>> virtio_bus_get_vdev_id() returns it when called from
>> virtio_pci_device_plugged()... Maybe I'll find it yet.
> virtio_gpu_device_realize() calls virtio_init() with the id as one of
> the parameters.

Right. Thanks!

Max
diff mbox

Patch

diff --git a/hw/display/virtio-gpu-pci.c b/hw/display/virtio-gpu-pci.c
index 77c5e06..791ee8b 100644
--- a/hw/display/virtio-gpu-pci.c
+++ b/hw/display/virtio-gpu-pci.c
@@ -28,10 +28,10 @@  static int virtio_gpu_pci_init(VirtIOPCIProxy *vpci_dev)
     DeviceState *vdev = DEVICE(&vgpu->vdev);
 
     qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus));
-    if (qdev_init(vdev) < 0) {
-        return -1;
-    }
-    return 0;
+    /* force virtio-1.0 */
+    vpci_dev->flags &= ~VIRTIO_PCI_FLAG_DISABLE_MODERN;
+    vpci_dev->flags |= VIRTIO_PCI_FLAG_DISABLE_LEGACY;
+    return qdev_init(vdev);
 }
 
 static void virtio_gpu_pci_class_init(ObjectClass *klass, void *data)
@@ -43,9 +43,6 @@  static void virtio_gpu_pci_class_init(ObjectClass *klass, void *data)
     set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories);
     dc->props = virtio_gpu_pci_properties;
     k->init = virtio_gpu_pci_init;
-    pcidev_k->vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET;
-    pcidev_k->device_id = PCI_DEVICE_ID_VIRTIO_GPU;
-    pcidev_k->revision = VIRTIO_PCI_ABI_VERSION;
     pcidev_k->class_id = PCI_CLASS_DISPLAY_OTHER;
 }