All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/11] hw: Convert various reset() handler to DeviceReset
@ 2019-09-26 15:17 Philippe Mathieu-Daudé
  2019-09-26 15:17 ` [PATCH 01/11] hw/acpi/piix4: Convert reset " Philippe Mathieu-Daudé
                   ` (12 more replies)
  0 siblings, 13 replies; 22+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-09-26 15:17 UTC (permalink / raw)
  To: qemu-devel
  Cc: Damien Hedde, Peter Maydell, Aleksandar Markovic, qemu-block,
	Michael S. Tsirkin, qemu-trivial, John Snow, Aleksandar Rikalo,
	Markus Armbruster, qemu-arm, qemu-ppc, Edgar E. Iglesias,
	Igor Mammedov, Philippe Mathieu-Daudé

Hi.

Following the thread discussion between Peter/Markus/Damien about
reset handlers:
https://www.mail-archive.com/qemu-devel@nongnu.org/msg617103.html
I started to remove qemu_register_reset() calls from few qdevified
devices (the trivial ones).

Regards,

Phil.

Philippe Mathieu-Daudé (11):
  hw/acpi/piix4: Convert reset handler to DeviceReset
  hw/ide/piix: Convert reset handler to DeviceReset
  hw/isa/piix4: Convert reset handler to DeviceReset
  hw/pci-host/piix: Convert reset handler to DeviceReset
  hw/ide/sii3112: Convert reset handler to DeviceReset
  hw/ide/via82c: Convert reset handler to DeviceReset
  hw/isa/vt82c686: Convert reset handler to DeviceReset
  hw/input/lm832x: Convert reset handler to DeviceReset
  hw/pci-host/bonito: Convert reset handler to DeviceReset
  hw/timer/etraxfs: Convert reset handler to DeviceReset
  hw/misc/vmcoreinfo: Convert reset handler to DeviceReset

 hw/acpi/piix4.c          |  7 +++----
 hw/ide/piix.c            |  8 +++-----
 hw/ide/sii3112.c         |  7 +++----
 hw/ide/via.c             | 10 ++++------
 hw/input/lm832x.c        | 12 +++++-------
 hw/isa/piix4.c           |  7 +++----
 hw/isa/vt82c686.c        | 11 ++++-------
 hw/misc/vmcoreinfo.c     |  5 ++---
 hw/pci-host/bonito.c     |  8 +++-----
 hw/pci-host/piix.c       |  8 +++-----
 hw/timer/etraxfs_timer.c |  7 +++----
 11 files changed, 36 insertions(+), 54 deletions(-)

-- 
2.20.1



^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH 01/11] hw/acpi/piix4: Convert reset handler to DeviceReset
  2019-09-26 15:17 [PATCH 00/11] hw: Convert various reset() handler to DeviceReset Philippe Mathieu-Daudé
@ 2019-09-26 15:17 ` Philippe Mathieu-Daudé
  2019-10-04 11:32   ` Igor Mammedov
  2019-09-26 15:17 ` [PATCH 02/11] hw/ide/piix: " Philippe Mathieu-Daudé
                   ` (11 subsequent siblings)
  12 siblings, 1 reply; 22+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-09-26 15:17 UTC (permalink / raw)
  To: qemu-devel
  Cc: Damien Hedde, Peter Maydell, Michael S. Tsirkin, qemu-trivial,
	Markus Armbruster, Igor Mammedov, Philippe Mathieu-Daudé

Convert the reset handler into a proper Device reset method.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 hw/acpi/piix4.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c
index 5742c3df87..4e079b39bd 100644
--- a/hw/acpi/piix4.c
+++ b/hw/acpi/piix4.c
@@ -27,7 +27,6 @@
 #include "hw/pci/pci.h"
 #include "hw/qdev-properties.h"
 #include "hw/acpi/acpi.h"
-#include "sysemu/reset.h"
 #include "sysemu/runstate.h"
 #include "sysemu/sysemu.h"
 #include "qapi/error.h"
@@ -344,9 +343,9 @@ static const VMStateDescription vmstate_acpi = {
     }
 };
 
-static void piix4_reset(void *opaque)
+static void piix4_pm_reset(DeviceState *dev)
 {
-    PIIX4PMState *s = opaque;
+    PIIX4PMState *s = PIIX4_PM(dev);
     PCIDevice *d = PCI_DEVICE(s);
     uint8_t *pci_conf = d->config;
 
@@ -542,7 +541,6 @@ static void piix4_pm_realize(PCIDevice *dev, Error **errp)
 
     s->machine_ready.notify = piix4_pm_machine_ready;
     qemu_add_machine_init_done_notifier(&s->machine_ready);
-    qemu_register_reset(piix4_reset, s);
 
     piix4_acpi_system_hot_add_init(pci_address_space_io(dev),
                                    pci_get_bus(dev), s);
@@ -692,6 +690,7 @@ static void piix4_pm_class_init(ObjectClass *klass, void *data)
     k->device_id = PCI_DEVICE_ID_INTEL_82371AB_3;
     k->revision = 0x03;
     k->class_id = PCI_CLASS_BRIDGE_OTHER;
+    dc->reset = piix4_pm_reset;
     dc->desc = "PM";
     dc->vmsd = &vmstate_acpi;
     dc->props = piix4_pm_properties;
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 02/11] hw/ide/piix: Convert reset handler to DeviceReset
  2019-09-26 15:17 [PATCH 00/11] hw: Convert various reset() handler to DeviceReset Philippe Mathieu-Daudé
  2019-09-26 15:17 ` [PATCH 01/11] hw/acpi/piix4: Convert reset " Philippe Mathieu-Daudé
@ 2019-09-26 15:17 ` Philippe Mathieu-Daudé
  2019-09-26 15:17 ` [PATCH 03/11] hw/isa/piix4: " Philippe Mathieu-Daudé
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 22+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-09-26 15:17 UTC (permalink / raw)
  To: qemu-devel
  Cc: Damien Hedde, Peter Maydell, qemu-block, qemu-trivial,
	Philippe Mathieu-Daudé,
	Markus Armbruster, John Snow

Convert the reset handler into a proper Device reset method.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 hw/ide/piix.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/hw/ide/piix.c b/hw/ide/piix.c
index fba6bc8bff..18b2c3b722 100644
--- a/hw/ide/piix.c
+++ b/hw/ide/piix.c
@@ -30,7 +30,6 @@
 #include "sysemu/block-backend.h"
 #include "sysemu/blockdev.h"
 #include "sysemu/dma.h"
-#include "sysemu/reset.h"
 
 #include "hw/ide/pci.h"
 #include "trace.h"
@@ -103,9 +102,9 @@ static void bmdma_setup_bar(PCIIDEState *d)
     }
 }
 
-static void piix3_reset(void *opaque)
+static void piix3_ide_reset(DeviceState *dev)
 {
-    PCIIDEState *d = opaque;
+    PCIIDEState *d = PCI_IDE(dev);
     PCIDevice *pd = PCI_DEVICE(d);
     uint8_t *pci_conf = pd->config;
     int i;
@@ -154,8 +153,6 @@ static void pci_piix_ide_realize(PCIDevice *dev, Error **errp)
 
     pci_conf[PCI_CLASS_PROG] = 0x80; // legacy ATA mode
 
-    qemu_register_reset(piix3_reset, d);
-
     bmdma_setup_bar(d);
     pci_register_bar(dev, 4, PCI_BASE_ADDRESS_SPACE_IO, &d->bmdma_bar);
 
@@ -247,6 +244,7 @@ static void piix3_ide_class_init(ObjectClass *klass, void *data)
     DeviceClass *dc = DEVICE_CLASS(klass);
     PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
 
+    dc->reset = piix3_ide_reset;
     k->realize = pci_piix_ide_realize;
     k->exit = pci_piix_ide_exitfn;
     k->vendor_id = PCI_VENDOR_ID_INTEL;
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 03/11] hw/isa/piix4: Convert reset handler to DeviceReset
  2019-09-26 15:17 [PATCH 00/11] hw: Convert various reset() handler to DeviceReset Philippe Mathieu-Daudé
  2019-09-26 15:17 ` [PATCH 01/11] hw/acpi/piix4: Convert reset " Philippe Mathieu-Daudé
  2019-09-26 15:17 ` [PATCH 02/11] hw/ide/piix: " Philippe Mathieu-Daudé
@ 2019-09-26 15:17 ` Philippe Mathieu-Daudé
  2019-09-26 15:17 ` [PATCH 04/11] hw/pci-host/piix: " Philippe Mathieu-Daudé
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 22+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-09-26 15:17 UTC (permalink / raw)
  To: qemu-devel
  Cc: Damien Hedde, Peter Maydell, Michael S. Tsirkin, qemu-trivial,
	Markus Armbruster, Philippe Mathieu-Daudé

Convert the reset handler into a proper Device reset method.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 hw/isa/piix4.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c
index 3294056cd5..890d999abf 100644
--- a/hw/isa/piix4.c
+++ b/hw/isa/piix4.c
@@ -28,7 +28,6 @@
 #include "hw/isa/isa.h"
 #include "hw/sysbus.h"
 #include "migration/vmstate.h"
-#include "sysemu/reset.h"
 
 PCIDevice *piix4_dev;
 
@@ -40,9 +39,9 @@ typedef struct PIIX4State {
 #define PIIX4_PCI_DEVICE(obj) \
     OBJECT_CHECK(PIIX4State, (obj), TYPE_PIIX4_PCI_DEVICE)
 
-static void piix4_reset(void *opaque)
+static void piix4_isa_reset(DeviceState *dev)
 {
-    PIIX4State *d = opaque;
+    PIIX4State *d = PIIX4_PCI_DEVICE(dev);
     uint8_t *pci_conf = d->dev.config;
 
     pci_conf[0x04] = 0x07; // master, memory and I/O
@@ -97,7 +96,6 @@ static void piix4_realize(PCIDevice *dev, Error **errp)
         return;
     }
     piix4_dev = &d->dev;
-    qemu_register_reset(piix4_reset, d);
 }
 
 int piix4_init(PCIBus *bus, ISABus **isa_bus, int devfn)
@@ -118,6 +116,7 @@ static void piix4_class_init(ObjectClass *klass, void *data)
     k->vendor_id = PCI_VENDOR_ID_INTEL;
     k->device_id = PCI_DEVICE_ID_INTEL_82371AB_0;
     k->class_id = PCI_CLASS_BRIDGE_ISA;
+    dc->reset = piix4_isa_reset;
     dc->desc = "ISA bridge";
     dc->vmsd = &vmstate_piix4;
     /*
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 04/11] hw/pci-host/piix: Convert reset handler to DeviceReset
  2019-09-26 15:17 [PATCH 00/11] hw: Convert various reset() handler to DeviceReset Philippe Mathieu-Daudé
                   ` (2 preceding siblings ...)
  2019-09-26 15:17 ` [PATCH 03/11] hw/isa/piix4: " Philippe Mathieu-Daudé
@ 2019-09-26 15:17 ` Philippe Mathieu-Daudé
  2019-09-26 15:17 ` [PATCH 05/11] hw/ide/sii3112: " Philippe Mathieu-Daudé
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 22+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-09-26 15:17 UTC (permalink / raw)
  To: qemu-devel
  Cc: Damien Hedde, Peter Maydell, Michael S. Tsirkin, qemu-trivial,
	Markus Armbruster, Philippe Mathieu-Daudé

Convert the reset handler into a proper Device reset method.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 hw/pci-host/piix.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/hw/pci-host/piix.c b/hw/pci-host/piix.c
index 135c645535..a1cd8b8406 100644
--- a/hw/pci-host/piix.c
+++ b/hw/pci-host/piix.c
@@ -36,7 +36,6 @@
 #include "migration/qemu-file-types.h"
 #include "migration/vmstate.h"
 #include "hw/pci-host/pam.h"
-#include "sysemu/reset.h"
 #include "sysemu/runstate.h"
 #include "hw/i386/ioapic.h"
 #include "qapi/visitor.h"
@@ -562,9 +561,9 @@ static void piix3_write_config_xen(PCIDevice *dev,
     piix3_write_config(dev, address, val, len);
 }
 
-static void piix3_reset(void *opaque)
+static void piix3_reset(DeviceState *dev)
 {
-    PIIX3State *d = opaque;
+    PIIX3State *d = PIIX3_PCI_DEVICE(dev);
     uint8_t *pci_conf = d->dev.config;
 
     pci_conf[0x04] = 0x07; /* master, memory and I/O */
@@ -711,8 +710,6 @@ static void piix3_realize(PCIDevice *dev, Error **errp)
                           "piix3-reset-control", 1);
     memory_region_add_subregion_overlap(pci_address_space_io(dev), RCR_IOPORT,
                                         &d->rcr_mem, 1);
-
-    qemu_register_reset(piix3_reset, d);
 }
 
 static void pci_piix3_class_init(ObjectClass *klass, void *data)
@@ -723,6 +720,7 @@ static void pci_piix3_class_init(ObjectClass *klass, void *data)
     dc->desc        = "ISA bridge";
     dc->vmsd        = &vmstate_piix3;
     dc->hotpluggable   = false;
+    dc->reset       = piix3_reset;
     k->realize      = piix3_realize;
     k->vendor_id    = PCI_VENDOR_ID_INTEL;
     /* 82371SB PIIX3 PCI-to-ISA bridge (Step A1) */
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 05/11] hw/ide/sii3112: Convert reset handler to DeviceReset
  2019-09-26 15:17 [PATCH 00/11] hw: Convert various reset() handler to DeviceReset Philippe Mathieu-Daudé
                   ` (3 preceding siblings ...)
  2019-09-26 15:17 ` [PATCH 04/11] hw/pci-host/piix: " Philippe Mathieu-Daudé
@ 2019-09-26 15:17 ` Philippe Mathieu-Daudé
  2019-09-26 15:17 ` [PATCH 06/11] hw/ide/via82c: " Philippe Mathieu-Daudé
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 22+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-09-26 15:17 UTC (permalink / raw)
  To: qemu-devel
  Cc: Damien Hedde, Peter Maydell, qemu-block, qemu-trivial, John Snow,
	Markus Armbruster, qemu-ppc, Philippe Mathieu-Daudé

Convert the reset handler into a proper Device reset method.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 hw/ide/sii3112.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/hw/ide/sii3112.c b/hw/ide/sii3112.c
index 2181260531..06605d7af2 100644
--- a/hw/ide/sii3112.c
+++ b/hw/ide/sii3112.c
@@ -15,7 +15,6 @@
 #include "qemu/osdep.h"
 #include "hw/ide/pci.h"
 #include "qemu/module.h"
-#include "sysemu/reset.h"
 #include "trace.h"
 
 #define TYPE_SII3112_PCI "sii3112"
@@ -237,9 +236,9 @@ static void sii3112_set_irq(void *opaque, int channel, int level)
     sii3112_update_irq(s);
 }
 
-static void sii3112_reset(void *opaque)
+static void sii3112_reset(DeviceState *dev)
 {
-    SiI3112PCIState *s = opaque;
+    SiI3112PCIState *s = SII3112_PCI(dev);
     int i;
 
     for (i = 0; i < 2; i++) {
@@ -290,7 +289,6 @@ static void sii3112_pci_realize(PCIDevice *dev, Error **errp)
         s->bmdma[i].bus = &s->bus[i];
         ide_register_restart_cb(&s->bus[i]);
     }
-    qemu_register_reset(sii3112_reset, s);
 }
 
 static void sii3112_pci_class_init(ObjectClass *klass, void *data)
@@ -303,6 +301,7 @@ static void sii3112_pci_class_init(ObjectClass *klass, void *data)
     pd->class_id = PCI_CLASS_STORAGE_RAID;
     pd->revision = 1;
     pd->realize = sii3112_pci_realize;
+    dc->reset = sii3112_reset;
     dc->desc = "SiI3112A SATA controller";
     set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
 }
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 06/11] hw/ide/via82c: Convert reset handler to DeviceReset
  2019-09-26 15:17 [PATCH 00/11] hw: Convert various reset() handler to DeviceReset Philippe Mathieu-Daudé
                   ` (4 preceding siblings ...)
  2019-09-26 15:17 ` [PATCH 05/11] hw/ide/sii3112: " Philippe Mathieu-Daudé
@ 2019-09-26 15:17 ` Philippe Mathieu-Daudé
  2019-09-26 15:17 ` [PATCH 07/11] hw/isa/vt82c686: " Philippe Mathieu-Daudé
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 22+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-09-26 15:17 UTC (permalink / raw)
  To: qemu-devel
  Cc: Damien Hedde, Peter Maydell, qemu-block, qemu-trivial,
	Philippe Mathieu-Daudé,
	Markus Armbruster, John Snow

Convert the reset handler into a proper Device reset method.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 hw/ide/via.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/hw/ide/via.c b/hw/ide/via.c
index 7087dc676e..053622bd82 100644
--- a/hw/ide/via.c
+++ b/hw/ide/via.c
@@ -29,7 +29,6 @@
 #include "migration/vmstate.h"
 #include "qemu/module.h"
 #include "sysemu/dma.h"
-#include "sysemu/reset.h"
 
 #include "hw/ide/pci.h"
 #include "trace.h"
@@ -120,10 +119,10 @@ static void via_ide_set_irq(void *opaque, int n, int level)
     }
 }
 
-static void via_ide_reset(void *opaque)
+static void via_ide_reset(DeviceState *dev)
 {
-    PCIIDEState *d = opaque;
-    PCIDevice *pd = PCI_DEVICE(d);
+    PCIIDEState *d = PCI_IDE(dev);
+    PCIDevice *pd = PCI_DEVICE(dev);
     uint8_t *pci_conf = pd->config;
     int i;
 
@@ -172,8 +171,6 @@ static void via_ide_realize(PCIDevice *dev, Error **errp)
     pci_set_long(pci_conf + PCI_CAPABILITY_LIST, 0x000000c0);
     dev->wmask[PCI_INTERRUPT_LINE] = 0xf;
 
-    qemu_register_reset(via_ide_reset, d);
-
     memory_region_init_io(&d->data_bar[0], OBJECT(d), &pci_ide_data_le_ops,
                           &d->bus[0], "via-ide0-data", 8);
     pci_register_bar(dev, 0, PCI_BASE_ADDRESS_SPACE_IO, &d->data_bar[0]);
@@ -229,6 +226,7 @@ static void via_ide_class_init(ObjectClass *klass, void *data)
     DeviceClass *dc = DEVICE_CLASS(klass);
     PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
 
+    dc->reset = via_ide_reset;
     k->realize = via_ide_realize;
     k->exit = via_ide_exitfn;
     k->vendor_id = PCI_VENDOR_ID_VIA;
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 07/11] hw/isa/vt82c686: Convert reset handler to DeviceReset
  2019-09-26 15:17 [PATCH 00/11] hw: Convert various reset() handler to DeviceReset Philippe Mathieu-Daudé
                   ` (5 preceding siblings ...)
  2019-09-26 15:17 ` [PATCH 06/11] hw/ide/via82c: " Philippe Mathieu-Daudé
@ 2019-09-26 15:17 ` Philippe Mathieu-Daudé
  2019-09-26 15:17 ` [PATCH 08/11] hw/input/lm832x: " Philippe Mathieu-Daudé
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 22+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-09-26 15:17 UTC (permalink / raw)
  To: qemu-devel
  Cc: Damien Hedde, Peter Maydell, qemu-trivial, Markus Armbruster,
	Aleksandar Rikalo, Aleksandar Markovic,
	Philippe Mathieu-Daudé

Convert the reset handler into a proper Device reset method.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 hw/isa/vt82c686.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/hw/isa/vt82c686.c b/hw/isa/vt82c686.c
index 50bd28fa82..616f67f347 100644
--- a/hw/isa/vt82c686.c
+++ b/hw/isa/vt82c686.c
@@ -23,7 +23,6 @@
 #include "hw/isa/apm.h"
 #include "hw/acpi/acpi.h"
 #include "hw/i2c/pm_smbus.h"
-#include "sysemu/reset.h"
 #include "qemu/module.h"
 #include "qemu/timer.h"
 #include "exec/address-spaces.h"
@@ -116,11 +115,10 @@ static const MemoryRegionOps superio_ops = {
     },
 };
 
-static void vt82c686b_reset(void * opaque)
+static void vt82c686b_isa_reset(DeviceState *dev)
 {
-    PCIDevice *d = opaque;
-    uint8_t *pci_conf = d->config;
-    VT82C686BState *vt82c = VT82C686B_DEVICE(d);
+    VT82C686BState *vt82c = VT82C686B_DEVICE(dev);
+    uint8_t *pci_conf = vt82c->dev.config;
 
     pci_set_long(pci_conf + PCI_CAPABILITY_LIST, 0x000000c0);
     pci_set_word(pci_conf + PCI_COMMAND, PCI_COMMAND_IO | PCI_COMMAND_MEMORY |
@@ -476,8 +474,6 @@ static void vt82c686b_realize(PCIDevice *d, Error **errp)
      * But we do not emulate a floppy, so just set it here. */
     memory_region_add_subregion(isa_bus->address_space_io, 0x3f0,
                                 &vt82c->superio);
-
-    qemu_register_reset(vt82c686b_reset, d);
 }
 
 ISABus *vt82c686b_isa_init(PCIBus *bus, int devfn)
@@ -501,6 +497,7 @@ static void via_class_init(ObjectClass *klass, void *data)
     k->device_id = PCI_DEVICE_ID_VIA_ISA_BRIDGE;
     k->class_id = PCI_CLASS_BRIDGE_ISA;
     k->revision = 0x40;
+    dc->reset = vt82c686b_isa_reset;
     dc->desc = "ISA bridge";
     dc->vmsd = &vmstate_via;
     /*
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 08/11] hw/input/lm832x: Convert reset handler to DeviceReset
  2019-09-26 15:17 [PATCH 00/11] hw: Convert various reset() handler to DeviceReset Philippe Mathieu-Daudé
                   ` (6 preceding siblings ...)
  2019-09-26 15:17 ` [PATCH 07/11] hw/isa/vt82c686: " Philippe Mathieu-Daudé
@ 2019-09-26 15:17 ` Philippe Mathieu-Daudé
  2019-09-26 15:17 ` [PATCH 09/11] hw/pci-host/bonito: " Philippe Mathieu-Daudé
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 22+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-09-26 15:17 UTC (permalink / raw)
  To: qemu-devel
  Cc: Damien Hedde, Peter Maydell, qemu-trivial,
	Philippe Mathieu-Daudé,
	Markus Armbruster, qemu-arm

Convert the reset handler into a proper Device reset method.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 hw/input/lm832x.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/hw/input/lm832x.c b/hw/input/lm832x.c
index a37eb854b9..aa629ddbf1 100644
--- a/hw/input/lm832x.c
+++ b/hw/input/lm832x.c
@@ -24,7 +24,6 @@
 #include "migration/vmstate.h"
 #include "qemu/module.h"
 #include "qemu/timer.h"
-#include "sysemu/reset.h"
 #include "ui/console.h"
 
 #define TYPE_LM8323 "lm8323"
@@ -94,8 +93,10 @@ static void lm_kbd_gpio_update(LM823KbdState *s)
 {
 }
 
-static void lm_kbd_reset(LM823KbdState *s)
+static void lm_kbd_reset(DeviceState *dev)
 {
+    LM823KbdState *s = LM8323(dev);
+
     s->config = 0x80;
     s->status = INT_NOINIT;
     s->acttime = 125;
@@ -273,7 +274,7 @@ static void lm_kbd_write(LM823KbdState *s, int reg, int byte, uint8_t value)
 
     case LM832x_CMD_RESET:
         if (value == 0xaa)
-            lm_kbd_reset(s);
+            lm_kbd_reset(DEVICE(s));
         else
             lm_kbd_error(s, ERR_BADPAR);
         s->reg = LM832x_GENERAL_ERROR;
@@ -476,10 +477,6 @@ static void lm8323_realize(DeviceState *dev, Error **errp)
     s->pwm.tm[1] = timer_new_ns(QEMU_CLOCK_VIRTUAL, lm_kbd_pwm1_tick, s);
     s->pwm.tm[2] = timer_new_ns(QEMU_CLOCK_VIRTUAL, lm_kbd_pwm2_tick, s);
     qdev_init_gpio_out(dev, &s->nirq, 1);
-
-    lm_kbd_reset(s);
-
-    qemu_register_reset((void *) lm_kbd_reset, s);
 }
 
 void lm832x_key_event(DeviceState *dev, int key, int state)
@@ -507,6 +504,7 @@ static void lm8323_class_init(ObjectClass *klass, void *data)
     DeviceClass *dc = DEVICE_CLASS(klass);
     I2CSlaveClass *k = I2C_SLAVE_CLASS(klass);
 
+    dc->reset = lm_kbd_reset;
     dc->realize = lm8323_realize;
     k->event = lm_i2c_event;
     k->recv = lm_i2c_rx;
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 09/11] hw/pci-host/bonito: Convert reset handler to DeviceReset
  2019-09-26 15:17 [PATCH 00/11] hw: Convert various reset() handler to DeviceReset Philippe Mathieu-Daudé
                   ` (7 preceding siblings ...)
  2019-09-26 15:17 ` [PATCH 08/11] hw/input/lm832x: " Philippe Mathieu-Daudé
@ 2019-09-26 15:17 ` Philippe Mathieu-Daudé
  2019-09-26 15:17 ` [PATCH 10/11] hw/timer/etraxfs: " Philippe Mathieu-Daudé
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 22+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-09-26 15:17 UTC (permalink / raw)
  To: qemu-devel
  Cc: Damien Hedde, Peter Maydell, qemu-trivial, Markus Armbruster,
	Aleksandar Rikalo, Aleksandar Markovic,
	Philippe Mathieu-Daudé

Convert the reset handler into a proper Device reset method.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 hw/pci-host/bonito.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/hw/pci-host/bonito.c b/hw/pci-host/bonito.c
index ceee463a11..aaba96bd13 100644
--- a/hw/pci-host/bonito.c
+++ b/hw/pci-host/bonito.c
@@ -45,7 +45,6 @@
 #include "hw/mips/mips.h"
 #include "hw/pci/pci_host.h"
 #include "migration/vmstate.h"
-#include "sysemu/reset.h"
 #include "sysemu/runstate.h"
 #include "exec/address-spaces.h"
 
@@ -570,9 +569,9 @@ static int pci_bonito_map_irq(PCIDevice * pci_dev, int irq_num)
     }
 }
 
-static void bonito_reset(void *opaque)
+static void bonito_reset(DeviceState *dev)
 {
-    PCIBonitoState *s = opaque;
+    PCIBonitoState *s = PCI_BONITO(dev);
 
     /* set the default value of north bridge registers */
 
@@ -671,8 +670,6 @@ static void bonito_realize(PCIDevice *dev, Error **errp)
     pci_set_byte(dev->config + PCI_INTERRUPT_PIN, 0x01);
     pci_set_byte(dev->config + PCI_MIN_GNT, 0x3c);
     pci_set_byte(dev->config + PCI_MAX_LAT, 0x00);
-
-    qemu_register_reset(bonito_reset, s);
 }
 
 PCIBus *bonito_init(qemu_irq *pic)
@@ -703,6 +700,7 @@ static void bonito_class_init(ObjectClass *klass, void *data)
     DeviceClass *dc = DEVICE_CLASS(klass);
     PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
 
+    dc->reset = bonito_reset;
     k->realize = bonito_realize;
     k->vendor_id = 0xdf53;
     k->device_id = 0x00d5;
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 10/11] hw/timer/etraxfs: Convert reset handler to DeviceReset
  2019-09-26 15:17 [PATCH 00/11] hw: Convert various reset() handler to DeviceReset Philippe Mathieu-Daudé
                   ` (8 preceding siblings ...)
  2019-09-26 15:17 ` [PATCH 09/11] hw/pci-host/bonito: " Philippe Mathieu-Daudé
@ 2019-09-26 15:17 ` Philippe Mathieu-Daudé
  2019-09-26 15:17 ` [PATCH 11/11] hw/misc/vmcoreinfo: " Philippe Mathieu-Daudé
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 22+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-09-26 15:17 UTC (permalink / raw)
  To: qemu-devel
  Cc: Damien Hedde, Peter Maydell, qemu-trivial, Markus Armbruster,
	Edgar E. Iglesias, Philippe Mathieu-Daudé

Convert the reset handler into a proper Device reset method.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 hw/timer/etraxfs_timer.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/hw/timer/etraxfs_timer.c b/hw/timer/etraxfs_timer.c
index d62025b879..c2623ecd59 100644
--- a/hw/timer/etraxfs_timer.c
+++ b/hw/timer/etraxfs_timer.c
@@ -24,7 +24,6 @@
 
 #include "qemu/osdep.h"
 #include "hw/sysbus.h"
-#include "sysemu/reset.h"
 #include "sysemu/runstate.h"
 #include "qemu/main-loop.h"
 #include "qemu/module.h"
@@ -307,9 +306,9 @@ static const MemoryRegionOps timer_ops = {
     }
 };
 
-static void etraxfs_timer_reset(void *opaque)
+static void etraxfs_timer_reset(DeviceState *dev)
 {
-    ETRAXTimerState *t = opaque;
+    ETRAXTimerState *t = ETRAX_TIMER(dev);
 
     ptimer_stop(t->ptimer_t0);
     ptimer_stop(t->ptimer_t1);
@@ -338,13 +337,13 @@ static void etraxfs_timer_realize(DeviceState *dev, Error **errp)
     memory_region_init_io(&t->mmio, OBJECT(t), &timer_ops, t,
                           "etraxfs-timer", 0x5c);
     sysbus_init_mmio(sbd, &t->mmio);
-    qemu_register_reset(etraxfs_timer_reset, t);
 }
 
 static void etraxfs_timer_class_init(ObjectClass *klass, void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
 
+    dc->reset = etraxfs_timer_reset;
     dc->realize = etraxfs_timer_realize;
 }
 
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 11/11] hw/misc/vmcoreinfo: Convert reset handler to DeviceReset
  2019-09-26 15:17 [PATCH 00/11] hw: Convert various reset() handler to DeviceReset Philippe Mathieu-Daudé
                   ` (9 preceding siblings ...)
  2019-09-26 15:17 ` [PATCH 10/11] hw/timer/etraxfs: " Philippe Mathieu-Daudé
@ 2019-09-26 15:17 ` Philippe Mathieu-Daudé
  2019-09-26 16:02   ` Philippe Mathieu-Daudé
  2019-09-27  8:47 ` [PATCH 00/11] hw: Convert various reset() " no-reply
  2019-10-05 21:46 ` Michael S. Tsirkin
  12 siblings, 1 reply; 22+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-09-26 15:17 UTC (permalink / raw)
  To: qemu-devel
  Cc: Damien Hedde, Peter Maydell, qemu-trivial, Markus Armbruster,
	Marc-André Lureau, Philippe Mathieu-Daudé

Convert the reset handler into a proper Device reset method.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 hw/misc/vmcoreinfo.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/hw/misc/vmcoreinfo.c b/hw/misc/vmcoreinfo.c
index 326a3ce8f4..a1c4847cdf 100644
--- a/hw/misc/vmcoreinfo.c
+++ b/hw/misc/vmcoreinfo.c
@@ -13,7 +13,6 @@
 #include "qemu/osdep.h"
 #include "qapi/error.h"
 #include "qemu/module.h"
-#include "sysemu/reset.h"
 #include "hw/nvram/fw_cfg.h"
 #include "migration/vmstate.h"
 #include "hw/misc/vmcoreinfo.h"
@@ -26,7 +25,7 @@ static void fw_cfg_vmci_write(void *dev, off_t offset, size_t len)
         && s->vmcoreinfo.guest_format != FW_CFG_VMCOREINFO_FORMAT_NONE;
 }
 
-static void vmcoreinfo_reset(void *dev)
+static void vmcoreinfo_reset(DeviceState *dev)
 {
     VMCoreInfoState *s = VMCOREINFO(dev);
 
@@ -61,7 +60,6 @@ static void vmcoreinfo_realize(DeviceState *dev, Error **errp)
                              NULL, fw_cfg_vmci_write, s,
                              &s->vmcoreinfo, sizeof(s->vmcoreinfo), false);
 
-    qemu_register_reset(vmcoreinfo_reset, dev);
     vmcoreinfo_state = s;
 }
 
@@ -84,6 +82,7 @@ static void vmcoreinfo_device_class_init(ObjectClass *klass, void *data)
     DeviceClass *dc = DEVICE_CLASS(klass);
 
     dc->vmsd = &vmstate_vmcoreinfo;
+    dc->reset = vmcoreinfo_reset;
     dc->realize = vmcoreinfo_realize;
     dc->hotpluggable = false;
     set_bit(DEVICE_CATEGORY_MISC, dc->categories);
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 22+ messages in thread

* Re: [PATCH 11/11] hw/misc/vmcoreinfo: Convert reset handler to DeviceReset
  2019-09-26 15:17 ` [PATCH 11/11] hw/misc/vmcoreinfo: " Philippe Mathieu-Daudé
@ 2019-09-26 16:02   ` Philippe Mathieu-Daudé
  2019-10-08 13:32     ` Eduardo Habkost
  2019-10-09 13:51     ` Peter Maydell
  0 siblings, 2 replies; 22+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-09-26 16:02 UTC (permalink / raw)
  To: qemu-devel
  Cc: Damien Hedde, Peter Maydell, Eduardo Habkost, qemu-trivial,
	Markus Armbruster, Marc-André Lureau

On 9/26/19 5:17 PM, Philippe Mathieu-Daudé wrote:
> Convert the reset handler into a proper Device reset method.

Marc-André noticed this one is incorrect, because while being QDEV it is
not connected to a QBUS.

Maybe we can add a Device::unconnected property, and when set, the
parent realize() calls 'qemu_register_reset(dev->reset, dev);'?
This might look the same, but at least Devices implementations could
stop to use this function...

> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>  hw/misc/vmcoreinfo.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/hw/misc/vmcoreinfo.c b/hw/misc/vmcoreinfo.c
> index 326a3ce8f4..a1c4847cdf 100644
> --- a/hw/misc/vmcoreinfo.c
> +++ b/hw/misc/vmcoreinfo.c
> @@ -13,7 +13,6 @@
>  #include "qemu/osdep.h"
>  #include "qapi/error.h"
>  #include "qemu/module.h"
> -#include "sysemu/reset.h"
>  #include "hw/nvram/fw_cfg.h"
>  #include "migration/vmstate.h"
>  #include "hw/misc/vmcoreinfo.h"
> @@ -26,7 +25,7 @@ static void fw_cfg_vmci_write(void *dev, off_t offset, size_t len)
>          && s->vmcoreinfo.guest_format != FW_CFG_VMCOREINFO_FORMAT_NONE;
>  }
>  
> -static void vmcoreinfo_reset(void *dev)
> +static void vmcoreinfo_reset(DeviceState *dev)
>  {
>      VMCoreInfoState *s = VMCOREINFO(dev);
>  
> @@ -61,7 +60,6 @@ static void vmcoreinfo_realize(DeviceState *dev, Error **errp)
>                               NULL, fw_cfg_vmci_write, s,
>                               &s->vmcoreinfo, sizeof(s->vmcoreinfo), false);
>  
> -    qemu_register_reset(vmcoreinfo_reset, dev);
>      vmcoreinfo_state = s;
>  }
>  
> @@ -84,6 +82,7 @@ static void vmcoreinfo_device_class_init(ObjectClass *klass, void *data)
>      DeviceClass *dc = DEVICE_CLASS(klass);
>  
>      dc->vmsd = &vmstate_vmcoreinfo;
> +    dc->reset = vmcoreinfo_reset;
>      dc->realize = vmcoreinfo_realize;
>      dc->hotpluggable = false;
>      set_bit(DEVICE_CATEGORY_MISC, dc->categories);
> 


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 00/11] hw: Convert various reset() handler to DeviceReset
  2019-09-26 15:17 [PATCH 00/11] hw: Convert various reset() handler to DeviceReset Philippe Mathieu-Daudé
                   ` (10 preceding siblings ...)
  2019-09-26 15:17 ` [PATCH 11/11] hw/misc/vmcoreinfo: " Philippe Mathieu-Daudé
@ 2019-09-27  8:47 ` no-reply
  2019-10-05 21:46 ` Michael S. Tsirkin
  12 siblings, 0 replies; 22+ messages in thread
From: no-reply @ 2019-09-27  8:47 UTC (permalink / raw)
  To: philmd
  Cc: damien.hedde, peter.maydell, qemu-block, mst, qemu-trivial,
	philmd, qemu-devel, armbru, arikalo, qemu-arm, qemu-ppc,
	amarkovic, imammedo, edgar.iglesias, jsnow

Patchew URL: https://patchew.org/QEMU/20190926151733.25349-1-philmd@redhat.com/



Hi,

This series failed the docker-mingw@fedora build test. Please find the testing commands and
their output below. If you have Docker installed, you can probably reproduce it
locally.

=== TEST SCRIPT BEGIN ===
#! /bin/bash
export ARCH=x86_64
make docker-image-fedora V=1 NETWORK=1
time make docker-test-mingw@fedora J=14 NETWORK=1
=== TEST SCRIPT END ===




The full log is available at
http://patchew.org/logs/20190926151733.25349-1-philmd@redhat.com/testing.docker-mingw@fedora/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 01/11] hw/acpi/piix4: Convert reset handler to DeviceReset
  2019-09-26 15:17 ` [PATCH 01/11] hw/acpi/piix4: Convert reset " Philippe Mathieu-Daudé
@ 2019-10-04 11:32   ` Igor Mammedov
  0 siblings, 0 replies; 22+ messages in thread
From: Igor Mammedov @ 2019-10-04 11:32 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Damien Hedde, Peter Maydell, Michael S. Tsirkin, qemu-trivial,
	qemu-devel, Markus Armbruster

On Thu, 26 Sep 2019 17:17:23 +0200
Philippe Mathieu-Daudé <philmd@redhat.com> wrote:

> Convert the reset handler into a proper Device reset method.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>

Reviewed-by: Igor Mammedov <imammedo@redhat.com>

> ---
>  hw/acpi/piix4.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c
> index 5742c3df87..4e079b39bd 100644
> --- a/hw/acpi/piix4.c
> +++ b/hw/acpi/piix4.c
> @@ -27,7 +27,6 @@
>  #include "hw/pci/pci.h"
>  #include "hw/qdev-properties.h"
>  #include "hw/acpi/acpi.h"
> -#include "sysemu/reset.h"
>  #include "sysemu/runstate.h"
>  #include "sysemu/sysemu.h"
>  #include "qapi/error.h"
> @@ -344,9 +343,9 @@ static const VMStateDescription vmstate_acpi = {
>      }
>  };
>  
> -static void piix4_reset(void *opaque)
> +static void piix4_pm_reset(DeviceState *dev)
>  {
> -    PIIX4PMState *s = opaque;
> +    PIIX4PMState *s = PIIX4_PM(dev);
>      PCIDevice *d = PCI_DEVICE(s);
>      uint8_t *pci_conf = d->config;
>  
> @@ -542,7 +541,6 @@ static void piix4_pm_realize(PCIDevice *dev, Error **errp)
>  
>      s->machine_ready.notify = piix4_pm_machine_ready;
>      qemu_add_machine_init_done_notifier(&s->machine_ready);
> -    qemu_register_reset(piix4_reset, s);
>  
>      piix4_acpi_system_hot_add_init(pci_address_space_io(dev),
>                                     pci_get_bus(dev), s);
> @@ -692,6 +690,7 @@ static void piix4_pm_class_init(ObjectClass *klass, void *data)
>      k->device_id = PCI_DEVICE_ID_INTEL_82371AB_3;
>      k->revision = 0x03;
>      k->class_id = PCI_CLASS_BRIDGE_OTHER;
> +    dc->reset = piix4_pm_reset;
>      dc->desc = "PM";
>      dc->vmsd = &vmstate_acpi;
>      dc->props = piix4_pm_properties;



^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 00/11] hw: Convert various reset() handler to DeviceReset
  2019-09-26 15:17 [PATCH 00/11] hw: Convert various reset() handler to DeviceReset Philippe Mathieu-Daudé
                   ` (11 preceding siblings ...)
  2019-09-27  8:47 ` [PATCH 00/11] hw: Convert various reset() " no-reply
@ 2019-10-05 21:46 ` Michael S. Tsirkin
  2019-10-07 10:01   ` Philippe Mathieu-Daudé
  12 siblings, 1 reply; 22+ messages in thread
From: Michael S. Tsirkin @ 2019-10-05 21:46 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Damien Hedde, Peter Maydell, Aleksandar Markovic, qemu-block,
	qemu-trivial, qemu-devel, Markus Armbruster, Aleksandar Rikalo,
	qemu-arm, qemu-ppc, Edgar E. Iglesias, Igor Mammedov, John Snow

On Thu, Sep 26, 2019 at 05:17:22PM +0200, Philippe Mathieu-Daudé wrote:
> Hi.
> 
> Following the thread discussion between Peter/Markus/Damien about
> reset handlers:
> https://www.mail-archive.com/qemu-devel@nongnu.org/msg617103.html
> I started to remove qemu_register_reset() calls from few qdevified
> devices (the trivial ones).
> 
> Regards,
> 
> Phil.

How do you want these patches merged? Trivial tree?

> Philippe Mathieu-Daudé (11):
>   hw/acpi/piix4: Convert reset handler to DeviceReset
>   hw/ide/piix: Convert reset handler to DeviceReset
>   hw/isa/piix4: Convert reset handler to DeviceReset
>   hw/pci-host/piix: Convert reset handler to DeviceReset
>   hw/ide/sii3112: Convert reset handler to DeviceReset
>   hw/ide/via82c: Convert reset handler to DeviceReset
>   hw/isa/vt82c686: Convert reset handler to DeviceReset
>   hw/input/lm832x: Convert reset handler to DeviceReset
>   hw/pci-host/bonito: Convert reset handler to DeviceReset
>   hw/timer/etraxfs: Convert reset handler to DeviceReset
>   hw/misc/vmcoreinfo: Convert reset handler to DeviceReset
> 
>  hw/acpi/piix4.c          |  7 +++----
>  hw/ide/piix.c            |  8 +++-----
>  hw/ide/sii3112.c         |  7 +++----
>  hw/ide/via.c             | 10 ++++------
>  hw/input/lm832x.c        | 12 +++++-------
>  hw/isa/piix4.c           |  7 +++----
>  hw/isa/vt82c686.c        | 11 ++++-------
>  hw/misc/vmcoreinfo.c     |  5 ++---
>  hw/pci-host/bonito.c     |  8 +++-----
>  hw/pci-host/piix.c       |  8 +++-----
>  hw/timer/etraxfs_timer.c |  7 +++----
>  11 files changed, 36 insertions(+), 54 deletions(-)
> 
> -- 
> 2.20.1


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 00/11] hw: Convert various reset() handler to DeviceReset
  2019-10-05 21:46 ` Michael S. Tsirkin
@ 2019-10-07 10:01   ` Philippe Mathieu-Daudé
  2019-10-07 21:24     ` Eduardo Habkost
  0 siblings, 1 reply; 22+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-10-07 10:01 UTC (permalink / raw)
  To: Michael S. Tsirkin, Eduardo Habkost
  Cc: Damien Hedde, Peter Maydell, Aleksandar Markovic, qemu-block,
	qemu-trivial, qemu-devel, Markus Armbruster, Aleksandar Rikalo,
	qemu-ppc, Edgar E. Iglesias, Igor Mammedov, John Snow

Hi Michael,

On 10/5/19 11:46 PM, Michael S. Tsirkin wrote:
> On Thu, Sep 26, 2019 at 05:17:22PM +0200, Philippe Mathieu-Daudé wrote:
>> Hi.
>>
>> Following the thread discussion between Peter/Markus/Damien about
>> reset handlers:
>> https://www.mail-archive.com/qemu-devel@nongnu.org/msg617103.html
>> I started to remove qemu_register_reset() calls from few qdevified
>> devices (the trivial ones).
>>
>> Regards,
>>
>> Phil.
> 
> How do you want these patches merged? Trivial tree?

I was hoping Eduardo would take them but he is busy and I even forgot to 
Cc him. They might go via Trivial or else via Paolo's Misc...

>> Philippe Mathieu-Daudé (11):
>>    hw/acpi/piix4: Convert reset handler to DeviceReset
>>    hw/ide/piix: Convert reset handler to DeviceReset
>>    hw/isa/piix4: Convert reset handler to DeviceReset
>>    hw/pci-host/piix: Convert reset handler to DeviceReset
>>    hw/ide/sii3112: Convert reset handler to DeviceReset
>>    hw/ide/via82c: Convert reset handler to DeviceReset
>>    hw/isa/vt82c686: Convert reset handler to DeviceReset
>>    hw/input/lm832x: Convert reset handler to DeviceReset
>>    hw/pci-host/bonito: Convert reset handler to DeviceReset
>>    hw/timer/etraxfs: Convert reset handler to DeviceReset
>>    hw/misc/vmcoreinfo: Convert reset handler to DeviceReset


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 00/11] hw: Convert various reset() handler to DeviceReset
  2019-10-07 10:01   ` Philippe Mathieu-Daudé
@ 2019-10-07 21:24     ` Eduardo Habkost
  2019-10-08  9:47       ` Peter Maydell
  0 siblings, 1 reply; 22+ messages in thread
From: Eduardo Habkost @ 2019-10-07 21:24 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Damien Hedde, Peter Maydell, Aleksandar Markovic, qemu-block,
	Michael S. Tsirkin, qemu-trivial, Markus Armbruster, qemu-devel,
	Aleksandar Rikalo, qemu-ppc, Edgar E. Iglesias, Igor Mammedov,
	John Snow

On Mon, Oct 07, 2019 at 12:01:54PM +0200, Philippe Mathieu-Daudé wrote:
> Hi Michael,
> 
> On 10/5/19 11:46 PM, Michael S. Tsirkin wrote:
> > On Thu, Sep 26, 2019 at 05:17:22PM +0200, Philippe Mathieu-Daudé wrote:
> > > Hi.
> > > 
> > > Following the thread discussion between Peter/Markus/Damien about
> > > reset handlers:
> > > https://www.mail-archive.com/qemu-devel@nongnu.org/msg617103.html
> > > I started to remove qemu_register_reset() calls from few qdevified
> > > devices (the trivial ones).
> > > 
> > > Regards,
> > > 
> > > Phil.
> > 
> > How do you want these patches merged? Trivial tree?
> 
> I was hoping Eduardo would take them but he is busy and I even forgot to Cc
> him. They might go via Trivial or else via Paolo's Misc...

I can merge them if somebody reviews the series.  How exactly are
we making sure device_reset() is really being called for all
devices touched by this series?  Are all buses guaranteed to be
children of main-system-bus?

> 
> > > Philippe Mathieu-Daudé (11):
> > >    hw/acpi/piix4: Convert reset handler to DeviceReset
> > >    hw/ide/piix: Convert reset handler to DeviceReset
> > >    hw/isa/piix4: Convert reset handler to DeviceReset
> > >    hw/pci-host/piix: Convert reset handler to DeviceReset
> > >    hw/ide/sii3112: Convert reset handler to DeviceReset
> > >    hw/ide/via82c: Convert reset handler to DeviceReset
> > >    hw/isa/vt82c686: Convert reset handler to DeviceReset
> > >    hw/input/lm832x: Convert reset handler to DeviceReset
> > >    hw/pci-host/bonito: Convert reset handler to DeviceReset
> > >    hw/timer/etraxfs: Convert reset handler to DeviceReset
> > >    hw/misc/vmcoreinfo: Convert reset handler to DeviceReset

-- 
Eduardo


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 00/11] hw: Convert various reset() handler to DeviceReset
  2019-10-07 21:24     ` Eduardo Habkost
@ 2019-10-08  9:47       ` Peter Maydell
  0 siblings, 0 replies; 22+ messages in thread
From: Peter Maydell @ 2019-10-08  9:47 UTC (permalink / raw)
  To: Eduardo Habkost
  Cc: Damien Hedde, Aleksandar Markovic, Qemu-block,
	Michael S. Tsirkin, QEMU Trivial, John Snow, Aleksandar Rikalo,
	Markus Armbruster, QEMU Developers, qemu-ppc, Edgar E. Iglesias,
	Igor Mammedov, Philippe Mathieu-Daudé

On Mon, 7 Oct 2019 at 22:24, Eduardo Habkost <ehabkost@redhat.com> wrote:
>
> On Mon, Oct 07, 2019 at 12:01:54PM +0200, Philippe Mathieu-Daudé wrote:
> > Hi Michael,
> >
> > On 10/5/19 11:46 PM, Michael S. Tsirkin wrote:
> > > On Thu, Sep 26, 2019 at 05:17:22PM +0200, Philippe Mathieu-Daudé wrote:
> > > > Hi.
> > > >
> > > > Following the thread discussion between Peter/Markus/Damien about
> > > > reset handlers:
> > > > https://www.mail-archive.com/qemu-devel@nongnu.org/msg617103.html
> > > > I started to remove qemu_register_reset() calls from few qdevified
> > > > devices (the trivial ones).
> > > >
> > > > Regards,
> > > >
> > > > Phil.
> > >
> > > How do you want these patches merged? Trivial tree?
> >
> > I was hoping Eduardo would take them but he is busy and I even forgot to Cc
> > him. They might go via Trivial or else via Paolo's Misc...
>
> I can merge them if somebody reviews the series.  How exactly are
> we making sure device_reset() is really being called for all
> devices touched by this series?  Are all buses guaranteed to be
> children of main-system-bus?

At least one of them is not (vmcoreinfo), as noted in review
comments on that patch. So while some of these patches might
be ok, some are not, and so we need to review them first
before they get merged via any route I think.

thanks
-- PMM


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 11/11] hw/misc/vmcoreinfo: Convert reset handler to DeviceReset
  2019-09-26 16:02   ` Philippe Mathieu-Daudé
@ 2019-10-08 13:32     ` Eduardo Habkost
  2019-10-09  9:04       ` Damien Hedde
  2019-10-09 13:51     ` Peter Maydell
  1 sibling, 1 reply; 22+ messages in thread
From: Eduardo Habkost @ 2019-10-08 13:32 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Damien Hedde, Peter Maydell, qemu-trivial, qemu-devel,
	Markus Armbruster, Marc-André Lureau

On Thu, Sep 26, 2019 at 06:02:47PM +0200, Philippe Mathieu-Daudé wrote:
> On 9/26/19 5:17 PM, Philippe Mathieu-Daudé wrote:
> > Convert the reset handler into a proper Device reset method.
> 
> Marc-André noticed this one is incorrect, because while being QDEV it is
> not connected to a QBUS.
> 
> Maybe we can add a Device::unconnected property, and when set, the
> parent realize() calls 'qemu_register_reset(dev->reset, dev);'?
> This might look the same, but at least Devices implementations could
> stop to use this function...

Can we make this automatic instead of requiring another explicit
setting?

Today we have at least 3 different ways of getting a device to be
reset: qemu_register_reset(); explicit device_reset_all() call in
another reset handler; and implicit device_reset_all() call done
through parent buses/devices.  I wouldn't like to create a 4th
method.

What I really wish for, is a opt-out mechanism for reset (meaning
all devices would be guaranteed to be reset unless they
explicitly opt out), instead of 3 or 4 different opt-in
mechanisms.

-- 
Eduardo


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 11/11] hw/misc/vmcoreinfo: Convert reset handler to DeviceReset
  2019-10-08 13:32     ` Eduardo Habkost
@ 2019-10-09  9:04       ` Damien Hedde
  0 siblings, 0 replies; 22+ messages in thread
From: Damien Hedde @ 2019-10-09  9:04 UTC (permalink / raw)
  To: Eduardo Habkost, Philippe Mathieu-Daudé
  Cc: qemu-trivial, Peter Maydell, qemu-devel, Marc-André Lureau,
	Markus Armbruster



On 10/8/19 3:32 PM, Eduardo Habkost wrote:
> On Thu, Sep 26, 2019 at 06:02:47PM +0200, Philippe Mathieu-Daudé wrote:
>> On 9/26/19 5:17 PM, Philippe Mathieu-Daudé wrote:
>>> Convert the reset handler into a proper Device reset method.
>>
>> Marc-André noticed this one is incorrect, because while being QDEV it is
>> not connected to a QBUS.
>>
>> Maybe we can add a Device::unconnected property, and when set, the
>> parent realize() calls 'qemu_register_reset(dev->reset, dev);'?
>> This might look the same, but at least Devices implementations could
>> stop to use this function...
> 
> Can we make this automatic instead of requiring another explicit
> setting?
> 
> Today we have at least 3 different ways of getting a device to be
> reset: qemu_register_reset(); explicit device_reset_all() call in
> another reset handler; and implicit device_reset_all() call done
> through parent buses/devices.  I wouldn't like to create a 4th
> method.
> 
> What I really wish for, is a opt-out mechanism for reset (meaning
> all devices would be guaranteed to be reset unless they
> explicitly opt out), instead of 3 or 4 different opt-in
> mechanisms.
> 

Sorry for the stupid question, but why would we not reset a device ? Are
there some cases when a device must be "initialized" not in its reset
state ?

Regarding the reset guarantee. Can this be done by doing first
qemu_register_reset() on each device and eventually unregistering
it in case of opt-out or wanting to reset it by other means (eg when
putting it into a bus) ?

Damien


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 11/11] hw/misc/vmcoreinfo: Convert reset handler to DeviceReset
  2019-09-26 16:02   ` Philippe Mathieu-Daudé
  2019-10-08 13:32     ` Eduardo Habkost
@ 2019-10-09 13:51     ` Peter Maydell
  1 sibling, 0 replies; 22+ messages in thread
From: Peter Maydell @ 2019-10-09 13:51 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Damien Hedde, Eduardo Habkost, QEMU Trivial, QEMU Developers,
	Markus Armbruster, Marc-André Lureau

On Thu, 26 Sep 2019 at 17:02, Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
>
> On 9/26/19 5:17 PM, Philippe Mathieu-Daudé wrote:
> > Convert the reset handler into a proper Device reset method.
>
> Marc-André noticed this one is incorrect, because while being QDEV it is
> not connected to a QBUS.
>
> Maybe we can add a Device::unconnected property, and when set, the
> parent realize() calls 'qemu_register_reset(dev->reset, dev);'?
> This might look the same, but at least Devices implementations could
> stop to use this function...

I'm not in favour of ad-hoc attempts to patch the
problem with some devices not being reset like this.
I'd rather we figured out a general solution to the design
problem (which isn't easy, but on the other hand the
set of workarounds we currently have isn't too awful
to deal with).

thanks
-- PMM


^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2019-10-09 18:53 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-26 15:17 [PATCH 00/11] hw: Convert various reset() handler to DeviceReset Philippe Mathieu-Daudé
2019-09-26 15:17 ` [PATCH 01/11] hw/acpi/piix4: Convert reset " Philippe Mathieu-Daudé
2019-10-04 11:32   ` Igor Mammedov
2019-09-26 15:17 ` [PATCH 02/11] hw/ide/piix: " Philippe Mathieu-Daudé
2019-09-26 15:17 ` [PATCH 03/11] hw/isa/piix4: " Philippe Mathieu-Daudé
2019-09-26 15:17 ` [PATCH 04/11] hw/pci-host/piix: " Philippe Mathieu-Daudé
2019-09-26 15:17 ` [PATCH 05/11] hw/ide/sii3112: " Philippe Mathieu-Daudé
2019-09-26 15:17 ` [PATCH 06/11] hw/ide/via82c: " Philippe Mathieu-Daudé
2019-09-26 15:17 ` [PATCH 07/11] hw/isa/vt82c686: " Philippe Mathieu-Daudé
2019-09-26 15:17 ` [PATCH 08/11] hw/input/lm832x: " Philippe Mathieu-Daudé
2019-09-26 15:17 ` [PATCH 09/11] hw/pci-host/bonito: " Philippe Mathieu-Daudé
2019-09-26 15:17 ` [PATCH 10/11] hw/timer/etraxfs: " Philippe Mathieu-Daudé
2019-09-26 15:17 ` [PATCH 11/11] hw/misc/vmcoreinfo: " Philippe Mathieu-Daudé
2019-09-26 16:02   ` Philippe Mathieu-Daudé
2019-10-08 13:32     ` Eduardo Habkost
2019-10-09  9:04       ` Damien Hedde
2019-10-09 13:51     ` Peter Maydell
2019-09-27  8:47 ` [PATCH 00/11] hw: Convert various reset() " no-reply
2019-10-05 21:46 ` Michael S. Tsirkin
2019-10-07 10:01   ` Philippe Mathieu-Daudé
2019-10-07 21:24     ` Eduardo Habkost
2019-10-08  9:47       ` Peter Maydell

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.