Skip to contentSkip to conversation

virtio-s390: add a reset function to virtio-s390 devices

PATCH In review Paolo Bonzini 5 participants 9 messages Jan 10, 2013 – Jan 19, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 virtio-s390: add a reset function to virtio-s390 devices

virtio-s390 devices are not being reset when their bus is. To fix this, add a reset method that forwards to virtio_reset. This is only needed because of the "strange" modeling of virtio devices; the ->vdev link is being handled manually rather than through qdev.

---
 hw/s390-virtio-bus.c | 8 ++++++++
 1 file changed, 8 insertions(+)
hw/s390-virtio-bus.c +8 -0
index 7e99175..1e3e4f0 100644
@@ -505,6 +505,13 @@ static int s390_virtio_busdev_init(DeviceState *dev)
     return _info->init(_dev);
 }
 
+static void s390_virtio_busdev_reset(DeviceState *dev)
+{
+    VirtIOS390Device *_dev = (VirtIOS390Device *)dev;
+
+    virtio_reset(_dev->vdev);
+}
+
 static void virtio_s390_device_class_init(ObjectClass *klass, void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
@@ -512,6 +519,7 @@ static void virtio_s390_device_class_init(ObjectClass *klass, void *data)
     dc->init = s390_virtio_busdev_init;
     dc->bus_type = TYPE_S390_VIRTIO_BUS;
     dc->unplug = qdev_simple_unplug_cb;
+    dc->reset = s390_virtio_busdev_reset;
 }
 
 static TypeInfo virtio_s390_device_info = {
Signature · 1 line
1.8.1
#1 lore raw
Quoted 6 lines · Paolo Bonzini

virtio-s390 devices are not being reset when their bus is. To fix this, add a reset method that forwards to virtio_reset. This is only needed because of the "strange" modeling of virtio devices; the ->vdev link is being handled manually rather than through qdev.

Ping. This fix doesn't appear to be upstream yet and I'm also looking to get this in for 1.3.1.

(hint: patches search tag:unapplied to:qemu-stable :)

Quoted 34 lines
---
 hw/s390-virtio-bus.c | 8 ++++++++
 1 file changed, 8 insertions(+)
hw/s390-virtio-bus.c +8 -0
index 7e99175..1e3e4f0 100644
@@ -505,6 +505,13 @@ static int s390_virtio_busdev_init(DeviceState *dev)
     return _info->init(_dev);
 }
 
+static void s390_virtio_busdev_reset(DeviceState *dev)
+{
+    VirtIOS390Device *_dev = (VirtIOS390Device *)dev;
+
+    virtio_reset(_dev->vdev);
+}
+
 static void virtio_s390_device_class_init(ObjectClass *klass, void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
@@ -512,6 +519,7 @@ static void virtio_s390_device_class_init(ObjectClass *klass, void *data)
     dc->init = s390_virtio_busdev_init;
     dc->bus_type = TYPE_S390_VIRTIO_BUS;
     dc->unplug = qdev_simple_unplug_cb;
+    dc->reset = s390_virtio_busdev_reset;
 }
 
 static TypeInfo virtio_s390_device_info = {
Signature · 1 line
1.8.1
#2 lore raw
Quoted 7 lines · mdroth
Quoted 6 lines · Paolo Bonzini

virtio-s390 devices are not being reset when their bus is. To fix this, add a reset method that forwards to virtio_reset. This is only needed because of the "strange" modeling of virtio devices; the ->vdev link is being handled manually rather than through qdev.

Isn't this handled by virtio-refactoring ?

I mean if we have a virtio bus on this VirtIOS390Device like in this series:
http://www.mail-archive.com/[email protected]/msg149035.html

And make VirtIODevice an abstract device which connects on this bus we can reset it with the normal way ?

Quoted 39 lines

Ping. This fix doesn't appear to be upstream yet and I'm also looking to get this in for 1.3.1.

(hint: patches search tag:unapplied to:qemu-stable :)

Quoted 34 lines
---
  hw/s390-virtio-bus.c | 8 ++++++++
  1 file changed, 8 insertions(+)
hw/s390-virtio-bus.c +8 -0
index 7e99175..1e3e4f0 100644
@@ -505,6 +505,13 @@ static int s390_virtio_busdev_init(DeviceState *dev)
      return _info->init(_dev);
  }
 
+static void s390_virtio_busdev_reset(DeviceState *dev)
+{
+    VirtIOS390Device *_dev = (VirtIOS390Device *)dev;
+
+    virtio_reset(_dev->vdev);
+}
+
  static void virtio_s390_device_class_init(ObjectClass *klass, void *data)
  {
      DeviceClass *dc = DEVICE_CLASS(klass);
@@ -512,6 +519,7 @@ static void virtio_s390_device_class_init(ObjectClass *klass, void *data)
      dc->init = s390_virtio_busdev_init;
      dc->bus_type = TYPE_S390_VIRTIO_BUS;
      dc->unplug = qdev_simple_unplug_cb;
+    dc->reset = s390_virtio_busdev_reset;
  }
 
  static TypeInfo virtio_s390_device_info = {
Signature · 1 line
1.8.1
#3 lore raw

Il 16/01/2013 09:42, KONRAD Frédéric ha scritto:

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

virtio-s390 devices are not being reset when their bus is. To fix this, add a reset method that forwards to virtio_reset. This is only needed because of the "strange" modeling of virtio devices; the ->vdev link is being handled manually rather than through qdev.

Quoted 6 lines
Quoted 1 line
Quoted 1 line

Isn't this handled by virtio-refactoring ?

I mean if we have a virtio bus on this VirtIOS390Device like in this series:
http://www.mail-archive.com/[email protected]/msg149035.html

Well, not in 1.3.1. :)

Paolo

#4 lore raw
In reply to Paolo Bonzini

Am 10.01.2013 15:40, schrieb Paolo Bonzini:

Quoted 15 lines

virtio-s390 devices are not being reset when their bus is. To fix this, add a reset method that forwards to virtio_reset. This is only needed because of the "strange" modeling of virtio devices; the ->vdev link is being handled manually rather than through qdev.

---
 hw/s390-virtio-bus.c | 8 ++++++++
 1 file changed, 8 insertions(+)
hw/s390-virtio-bus.c +0 -0
index 7e99175..1e3e4f0 100644

hw/s390-virtio-bus.c static int s390_virtio_busdev_init(DeviceState *dev) · line 510

Quoted 6 lines
hw/s390-virtio-bus.c +3 -0
@@ -505,6 +505,13 @@ static int s390_virtio_busdev_init(DeviceState *dev)
     return _info->init(_dev);
 }
 
+static void s390_virtio_busdev_reset(DeviceState *dev)
+{
+    VirtIOS390Device *_dev = (VirtIOS390Device *)dev;

Underscore alert. ;) What about naming the arg d and the variable dev?

Andreas

Quoted 15 lines
hw/s390-virtio-bus.c +5 -0
+
+    virtio_reset(_dev->vdev);
+}
+
 static void virtio_s390_device_class_init(ObjectClass *klass, void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
@@ -512,6 +519,7 @@ static void virtio_s390_device_class_init(ObjectClass *klass, void *data)
     dc->init = s390_virtio_busdev_init;
     dc->bus_type = TYPE_S390_VIRTIO_BUS;
     dc->unplug = qdev_simple_unplug_cb;
+    dc->reset = s390_virtio_busdev_reset;
 }
 
 static TypeInfo virtio_s390_device_info = {
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#5 lore raw

Il 16/01/2013 06:27, Andreas Färber ha scritto:

Quoted 19 lines

Am 10.01.2013 15:40, schrieb Paolo Bonzini:

Quoted 18 lines

virtio-s390 devices are not being reset when their bus is. To fix this, add a reset method that forwards to virtio_reset. This is only needed because of the "strange" modeling of virtio devices; the ->vdev link is being handled manually rather than through qdev.

---
 hw/s390-virtio-bus.c | 8 ++++++++
 1 file changed, 8 insertions(+)
hw/s390-virtio-bus.c +0 -0
index 7e99175..1e3e4f0 100644
@@ -505,6 +505,13 @@ static int s390_virtio_busdev_init(DeviceState *dev)
     return _info->init(_dev);
 }
 
Quoted 5 lines

hw/s390-virtio-bus.c static int s390_virtio_busdev_init(DeviceState *dev) · line 510

Quoted 3 lines
hw/s390-virtio-bus.c +3 -0
+static void s390_virtio_busdev_reset(DeviceState *dev)
+{
+    VirtIOS390Device *_dev = (VirtIOS390Device *)dev;

Underscore alert. ;) What about naming the arg d and the variable dev?

True, but the file uses this convention throughout.

Paolo

#6 lore raw

Am 16.01.2013 11:10, schrieb Paolo Bonzini:

Quoted 20 lines

Il 16/01/2013 06:27, Andreas Färber ha scritto:

Quoted 19 lines

Am 10.01.2013 15:40, schrieb Paolo Bonzini:

Quoted 18 lines

virtio-s390 devices are not being reset when their bus is. To fix this, add a reset method that forwards to virtio_reset. This is only needed because of the "strange" modeling of virtio devices; the ->vdev link is being handled manually rather than through qdev.

---
 hw/s390-virtio-bus.c | 8 ++++++++
 1 file changed, 8 insertions(+)
hw/s390-virtio-bus.c +0 -0
index 7e99175..1e3e4f0 100644
@@ -505,6 +505,13 @@ static int s390_virtio_busdev_init(DeviceState *dev)
     return _info->init(_dev);
 }
 
Quoted 7 lines
Quoted 5 lines

hw/s390-virtio-bus.c static int s390_virtio_busdev_init(DeviceState *dev) · line 510

Quoted 3 lines
hw/s390-virtio-bus.c +3 -0
+static void s390_virtio_busdev_reset(DeviceState *dev)
+{
+    VirtIOS390Device *_dev = (VirtIOS390Device *)dev;

Underscore alert. ;) What about naming the arg d and the variable dev?

True, but the file uses this convention throughout.

Then I'm beginning to understand why Fred's patchset is so large...

Andreas

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#7 lore raw
In reply to Paolo Bonzini

Il 10/01/2013 15:40, Paolo Bonzini ha scritto:

Quoted 30 lines

virtio-s390 devices are not being reset when their bus is. To fix this, add a reset method that forwards to virtio_reset. This is only needed because of the "strange" modeling of virtio devices; the ->vdev link is being handled manually rather than through qdev.

---
 hw/s390-virtio-bus.c | 8 ++++++++
 1 file changed, 8 insertions(+)
hw/s390-virtio-bus.c +7 -0
index 7e99175..1e3e4f0 100644
@@ -505,6 +505,13 @@ static int s390_virtio_busdev_init(DeviceState *dev)
     return _info->init(_dev);
 }
 
+static void s390_virtio_busdev_reset(DeviceState *dev)
+{
+    VirtIOS390Device *_dev = (VirtIOS390Device *)dev;
+
+    virtio_reset(_dev->vdev);
+}
+
 static void virtio_s390_device_class_init(ObjectClass *klass, void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);

hw/s390-virtio-bus.c static void virtio_s390_device_class_init(ObjectClass *klass, void *data) · line 525

Quoted 7 lines
hw/s390-virtio-bus.c +1 -0
@@ -512,6 +519,7 @@ static void virtio_s390_device_class_init(ObjectClass *klass, void *data)
     dc->init = s390_virtio_busdev_init;
     dc->bus_type = TYPE_S390_VIRTIO_BUS;
     dc->unplug = qdev_simple_unplug_cb;
+    dc->reset = s390_virtio_busdev_reset;
 }
 
 static TypeInfo virtio_s390_device_info = {

Alex, you missed this.

Paolo

#8 lore raw
Quoted 36 lines · Paolo Bonzini

Il 10/01/2013 15:40, Paolo Bonzini ha scritto:

Quoted 35 lines

virtio-s390 devices are not being reset when their bus is. To fix this, add a reset method that forwards to virtio_reset. This is only needed because of the "strange" modeling of virtio devices; the ->vdev link is being handled manually rather than through qdev.

---
hw/s390-virtio-bus.c | 8 ++++++++

1 file changed, 8 insertions(+)
hw/s390-virtio-bus.c +8 -0
index 7e99175..1e3e4f0 100644
@@ -505,6 +505,13 @@ static int s390_virtio_busdev_init(DeviceState *dev)
    return _info->init(_dev);
 }
 
+static void s390_virtio_busdev_reset(DeviceState *dev)
+{
+    VirtIOS390Device *_dev = (VirtIOS390Device *)dev;
+
+    virtio_reset(_dev->vdev);
+}
+
 static void virtio_s390_device_class_init(ObjectClass *klass, void *data)
 {
    DeviceClass *dc = DEVICE_CLASS(klass);
@@ -512,6 +519,7 @@ static void virtio_s390_device_class_init(ObjectClass *klass, void *data)
    dc->init = s390_virtio_busdev_init;
    dc->bus_type = TYPE_S390_VIRTIO_BUS;
    dc->unplug = qdev_simple_unplug_cb;
+    dc->reset = s390_virtio_busdev_reset;
 }
 
Quoted 4 lines

hw/s390-virtio-bus.c static void virtio_s390_device_class_init(ObjectClass *klass, void *data) · line 525

Quoted 2 lines
hw/s390-virtio-bus.c +0 -0
 static TypeInfo virtio_s390_device_info = {

Alex, you missed this.

Yeah, sorry. It's not going to be my last s390 pull request before 1.4 :)

Alex