* [Qemu-devel] [PATCH 0/3] virtio-gpu: fix reset.
@ 2019-03-07 8:02 Gerd Hoffmann
2019-03-07 8:02 ` [Qemu-devel] [PATCH 1/3] virtio: add class_size to VirtioPCIDeviceTypeInfo Gerd Hoffmann
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Gerd Hoffmann @ 2019-03-07 8:02 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann, Michael S. Tsirkin
Gerd Hoffmann (3):
virtio: add class_size to VirtioPCIDeviceTypeInfo
virtio-vga: fix reset.
virtio-gpu: make virtio_gpu_reset static
hw/virtio/virtio-pci.h | 1 +
include/hw/virtio/virtio-gpu.h | 1 -
hw/display/virtio-gpu.c | 2 +-
hw/display/virtio-vga.c | 17 +++++++++++++++--
hw/virtio/virtio-pci.c | 1 +
5 files changed, 18 insertions(+), 4 deletions(-)
--
2.18.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Qemu-devel] [PATCH 1/3] virtio: add class_size to VirtioPCIDeviceTypeInfo
2019-03-07 8:02 [Qemu-devel] [PATCH 0/3] virtio-gpu: fix reset Gerd Hoffmann
@ 2019-03-07 8:02 ` Gerd Hoffmann
2019-03-07 8:02 ` [Qemu-devel] [PATCH 2/3] virtio-vga: fix reset Gerd Hoffmann
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Gerd Hoffmann @ 2019-03-07 8:02 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann, Michael S. Tsirkin
Needed when VirtioPCIClass subclasses have their own
class struct with some extra fields.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/virtio/virtio-pci.h | 1 +
hw/virtio/virtio-pci.c | 1 +
2 files changed, 2 insertions(+)
diff --git a/hw/virtio/virtio-pci.h b/hw/virtio/virtio-pci.h
index bd223a6e3b0b..18581854cae1 100644
--- a/hw/virtio/virtio-pci.h
+++ b/hw/virtio/virtio-pci.h
@@ -230,6 +230,7 @@ typedef struct VirtioPCIDeviceTypeInfo {
/* Same as TypeInfo fields: */
size_t instance_size;
+ size_t class_size;
void (*instance_init)(Object *obj);
void (*class_init)(ObjectClass *klass, void *data);
} VirtioPCIDeviceTypeInfo;
diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
index e978bfe76048..cb44e19b6789 100644
--- a/hw/virtio/virtio-pci.c
+++ b/hw/virtio/virtio-pci.c
@@ -1935,6 +1935,7 @@ void virtio_pci_types_register(const VirtioPCIDeviceTypeInfo *t)
.parent = t->parent ? t->parent : TYPE_VIRTIO_PCI,
.instance_size = t->instance_size,
.instance_init = t->instance_init,
+ .class_size = t->class_size,
.class_init = virtio_pci_base_class_init,
.class_data = (void *)t,
.abstract = true,
--
2.18.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Qemu-devel] [PATCH 2/3] virtio-vga: fix reset.
2019-03-07 8:02 [Qemu-devel] [PATCH 0/3] virtio-gpu: fix reset Gerd Hoffmann
2019-03-07 8:02 ` [Qemu-devel] [PATCH 1/3] virtio: add class_size to VirtioPCIDeviceTypeInfo Gerd Hoffmann
@ 2019-03-07 8:02 ` Gerd Hoffmann
2019-03-07 8:02 ` [Qemu-devel] [PATCH 3/3] virtio-gpu: make virtio_gpu_reset static Gerd Hoffmann
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Gerd Hoffmann @ 2019-03-07 8:02 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann, Michael S. Tsirkin
Store reset handler of the parent class and just call that for a
complete virtio reset. When taking the shortcut and calling
virtio_gpu_reset() directly the generic virtio reset code (for
virtqueues etc) will not be executed.
Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1597621
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/display/virtio-vga.c | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/hw/display/virtio-vga.c b/hw/display/virtio-vga.c
index 1e48009b74a6..a2b803b75f94 100644
--- a/hw/display/virtio-vga.c
+++ b/hw/display/virtio-vga.c
@@ -12,6 +12,10 @@
#define TYPE_VIRTIO_VGA "virtio-vga"
#define VIRTIO_VGA(obj) \
OBJECT_CHECK(VirtIOVGA, (obj), TYPE_VIRTIO_VGA)
+#define VIRTIO_VGA_GET_CLASS(obj) \
+ OBJECT_GET_CLASS(VirtIOVGAClass, obj, TYPE_VIRTIO_VGA)
+#define VIRTIO_VGA_CLASS(klass) \
+ OBJECT_CLASS_CHECK(VirtIOVGAClass, klass, TYPE_VIRTIO_VGA)
typedef struct VirtIOVGA {
VirtIOPCIProxy parent_obj;
@@ -20,6 +24,11 @@ typedef struct VirtIOVGA {
MemoryRegion vga_mrs[3];
} VirtIOVGA;
+typedef struct VirtIOVGAClass {
+ VirtioPCIClass parent_class;
+ DeviceReset parent_reset;
+} VirtIOVGAClass;
+
static void virtio_vga_invalidate_display(void *opaque)
{
VirtIOVGA *vvga = opaque;
@@ -168,10 +177,11 @@ static void virtio_vga_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
static void virtio_vga_reset(DeviceState *dev)
{
+ VirtIOVGAClass *klass = VIRTIO_VGA_GET_CLASS(dev);
VirtIOVGA *vvga = VIRTIO_VGA(dev);
/* reset virtio-gpu */
- virtio_gpu_reset(VIRTIO_DEVICE(&vvga->vdev));
+ klass->parent_reset(dev);
/* reset vga */
vga_common_reset(&vvga->vga);
@@ -187,13 +197,15 @@ static void virtio_vga_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
VirtioPCIClass *k = VIRTIO_PCI_CLASS(klass);
+ VirtIOVGAClass *v = VIRTIO_VGA_CLASS(klass);
PCIDeviceClass *pcidev_k = PCI_DEVICE_CLASS(klass);
set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories);
dc->props = virtio_vga_properties;
- dc->reset = virtio_vga_reset;
dc->vmsd = &vmstate_virtio_vga;
dc->hotpluggable = false;
+ device_class_set_parent_reset(dc, virtio_vga_reset,
+ &v->parent_reset);
k->realize = virtio_vga_realize;
pcidev_k->romfile = "vgabios-virtio.bin";
@@ -212,6 +224,7 @@ static VirtioPCIDeviceTypeInfo virtio_vga_info = {
.generic_name = TYPE_VIRTIO_VGA,
.instance_size = sizeof(struct VirtIOVGA),
.instance_init = virtio_vga_inst_initfn,
+ .class_size = sizeof(struct VirtIOVGAClass),
.class_init = virtio_vga_class_init,
};
--
2.18.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Qemu-devel] [PATCH 3/3] virtio-gpu: make virtio_gpu_reset static
2019-03-07 8:02 [Qemu-devel] [PATCH 0/3] virtio-gpu: fix reset Gerd Hoffmann
2019-03-07 8:02 ` [Qemu-devel] [PATCH 1/3] virtio: add class_size to VirtioPCIDeviceTypeInfo Gerd Hoffmann
2019-03-07 8:02 ` [Qemu-devel] [PATCH 2/3] virtio-vga: fix reset Gerd Hoffmann
@ 2019-03-07 8:02 ` Gerd Hoffmann
2019-03-07 10:37 ` [Qemu-devel] [PATCH 0/3] virtio-gpu: fix reset Philippe Mathieu-Daudé
2019-03-07 15:12 ` Michael S. Tsirkin
4 siblings, 0 replies; 6+ messages in thread
From: Gerd Hoffmann @ 2019-03-07 8:02 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann, Michael S. Tsirkin
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
include/hw/virtio/virtio-gpu.h | 1 -
hw/display/virtio-gpu.c | 2 +-
2 files changed, 1 insertion(+), 2 deletions(-)
diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h
index 98504f907583..ce0ca7217175 100644
--- a/include/hw/virtio/virtio-gpu.h
+++ b/include/hw/virtio/virtio-gpu.h
@@ -148,7 +148,6 @@ extern const GraphicHwOps virtio_gpu_ops;
} while (0)
/* virtio-gpu.c */
-void virtio_gpu_reset(VirtIODevice *vdev);
void virtio_gpu_ctrl_response(VirtIOGPU *g,
struct virtio_gpu_ctrl_command *cmd,
struct virtio_gpu_ctrl_hdr *resp,
diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
index a3627f58a9dd..4dbf48e42482 100644
--- a/hw/display/virtio-gpu.c
+++ b/hw/display/virtio-gpu.c
@@ -1346,7 +1346,7 @@ static void virtio_gpu_instance_init(Object *obj)
{
}
-void virtio_gpu_reset(VirtIODevice *vdev)
+static void virtio_gpu_reset(VirtIODevice *vdev)
{
VirtIOGPU *g = VIRTIO_GPU(vdev);
struct virtio_gpu_simple_resource *res, *tmp;
--
2.18.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH 0/3] virtio-gpu: fix reset.
2019-03-07 8:02 [Qemu-devel] [PATCH 0/3] virtio-gpu: fix reset Gerd Hoffmann
` (2 preceding siblings ...)
2019-03-07 8:02 ` [Qemu-devel] [PATCH 3/3] virtio-gpu: make virtio_gpu_reset static Gerd Hoffmann
@ 2019-03-07 10:37 ` Philippe Mathieu-Daudé
2019-03-07 15:12 ` Michael S. Tsirkin
4 siblings, 0 replies; 6+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-03-07 10:37 UTC (permalink / raw)
To: Gerd Hoffmann, qemu-devel; +Cc: Michael S. Tsirkin
On 3/7/19 9:02 AM, Gerd Hoffmann wrote:
> Gerd Hoffmann (3):
> virtio: add class_size to VirtioPCIDeviceTypeInfo
> virtio-vga: fix reset.
> virtio-gpu: make virtio_gpu_reset static
>
> hw/virtio/virtio-pci.h | 1 +
> include/hw/virtio/virtio-gpu.h | 1 -
> hw/display/virtio-gpu.c | 2 +-
> hw/display/virtio-vga.c | 17 +++++++++++++++--
> hw/virtio/virtio-pci.c | 1 +
> 5 files changed, 18 insertions(+), 4 deletions(-)
Series:
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH 0/3] virtio-gpu: fix reset.
2019-03-07 8:02 [Qemu-devel] [PATCH 0/3] virtio-gpu: fix reset Gerd Hoffmann
` (3 preceding siblings ...)
2019-03-07 10:37 ` [Qemu-devel] [PATCH 0/3] virtio-gpu: fix reset Philippe Mathieu-Daudé
@ 2019-03-07 15:12 ` Michael S. Tsirkin
4 siblings, 0 replies; 6+ messages in thread
From: Michael S. Tsirkin @ 2019-03-07 15:12 UTC (permalink / raw)
To: Gerd Hoffmann; +Cc: qemu-devel
On Thu, Mar 07, 2019 at 09:02:41AM +0100, Gerd Hoffmann wrote:
>
>
> Gerd Hoffmann (3):
> virtio: add class_size to VirtioPCIDeviceTypeInfo
> virtio-vga: fix reset.
> virtio-gpu: make virtio_gpu_reset static
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Feel free to merge.
> hw/virtio/virtio-pci.h | 1 +
> include/hw/virtio/virtio-gpu.h | 1 -
> hw/display/virtio-gpu.c | 2 +-
> hw/display/virtio-vga.c | 17 +++++++++++++++--
> hw/virtio/virtio-pci.c | 1 +
> 5 files changed, 18 insertions(+), 4 deletions(-)
>
> --
> 2.18.1
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-03-07 15:12 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-07 8:02 [Qemu-devel] [PATCH 0/3] virtio-gpu: fix reset Gerd Hoffmann
2019-03-07 8:02 ` [Qemu-devel] [PATCH 1/3] virtio: add class_size to VirtioPCIDeviceTypeInfo Gerd Hoffmann
2019-03-07 8:02 ` [Qemu-devel] [PATCH 2/3] virtio-vga: fix reset Gerd Hoffmann
2019-03-07 8:02 ` [Qemu-devel] [PATCH 3/3] virtio-gpu: make virtio_gpu_reset static Gerd Hoffmann
2019-03-07 10:37 ` [Qemu-devel] [PATCH 0/3] virtio-gpu: fix reset Philippe Mathieu-Daudé
2019-03-07 15:12 ` Michael S. Tsirkin
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.