From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Paolo Bonzini <pbonzini@redhat.com>,
Marcel Apfelbaum <marcel.apfelbaum@gmail.com>,
Aleksandar Markovic <amarkovic@wavecomp.com>,
Aurelien Jarno <aurelien@aurel32.net>,
Aleksandar Rikalo <arikalo@wavecomp.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PULL 4/5] virtio-vga: fix reset.
Date: Fri, 8 Mar 2019 13:39:36 +0100 [thread overview]
Message-ID: <20190308123937.2346-5-kraxel@redhat.com> (raw)
In-Reply-To: <20190308123937.2346-1-kraxel@redhat.com>
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>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Message-id: 20190307080244.9011-3-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
next prev parent reply other threads:[~2019-03-08 12:40 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-08 12:39 [Qemu-devel] [PULL 0/5] Vga 20190308 patches Gerd Hoffmann
2019-03-08 12:39 ` [Qemu-devel] [PULL 1/5] hw/display: Add basic ATI VGA emulation Gerd Hoffmann
2019-03-08 16:16 ` BALATON Zoltan
2019-03-08 12:39 ` [Qemu-devel] [PULL 2/5] mips_fulong2e: Add on-board graphics chip Gerd Hoffmann
2019-03-08 12:39 ` [Qemu-devel] [PULL 3/5] virtio: add class_size to VirtioPCIDeviceTypeInfo Gerd Hoffmann
2019-03-08 12:39 ` Gerd Hoffmann [this message]
2019-03-08 12:39 ` [Qemu-devel] [PULL 5/5] virtio-gpu: make virtio_gpu_reset static Gerd Hoffmann
2019-03-09 14:42 ` [Qemu-devel] [PULL 0/5] Vga 20190308 patches Peter Maydell
2019-03-11 13:33 ` Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190308123937.2346-5-kraxel@redhat.com \
--to=kraxel@redhat.com \
--cc=amarkovic@wavecomp.com \
--cc=arikalo@wavecomp.com \
--cc=aurelien@aurel32.net \
--cc=marcel.apfelbaum@gmail.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).