Re: [Qemu-block] [PATCH v4 01/10] add device_legacy_reset function to prepare for reset api change
On Wed, Aug 21, 2019 at 06:33:32PM +0200, Damien Hedde wrote: > Provide a temporary device_legacy_reset function doing what > device_reset does to prepare for the transition with Resettable > API. > > All occurrence of device_reset in the code tree are also replaced > by device_legacy_reset. > > The new resettable API has different prototype and semantics > (resetting child buses as well as the specified device). Subsequent > commits will make the changeover for each call site individually; once > that is complete device_legacy_reset() will be removed. > > Signed-off-by: Damien Hedde > Reviewed-by: Peter Maydell ppc parts Acked-by: David Gibson > --- > Cc: Gerd Hoffmann > Cc: Paolo Bonzini > Cc: "Daniel P. Berrangé" > Cc: Eduardo Habkost > Cc: Richard Henderson > Cc: "Michael S. Tsirkin" > Cc: Marcel Apfelbaum > Cc: John Snow > Cc: "Cédric Le Goater" > Cc: Collin Walling > Cc: Cornelia Huck > Cc: David Hildenbrand > Cc: Halil Pasic > Cc: Christian Borntraeger > Cc: Dmitry Fleytman > Cc: Fam Zheng > Cc: qemu-block@nongnu.org > Cc: qemu-...@nongnu.org > Cc: qemu-s3...@nongnu.org > Cc: qemu-...@nongnu.org > --- > hw/audio/intel-hda.c | 2 +- > hw/core/qdev.c | 6 +++--- > hw/hyperv/hyperv.c | 2 +- > hw/i386/pc.c | 2 +- > hw/ide/microdrive.c | 8 > hw/intc/spapr_xive.c | 2 +- > hw/ppc/pnv_psi.c | 2 +- > hw/ppc/spapr_pci.c | 2 +- > hw/ppc/spapr_vio.c | 2 +- > hw/s390x/s390-pci-inst.c | 2 +- > hw/scsi/vmw_pvscsi.c | 2 +- > hw/sd/omap_mmc.c | 2 +- > hw/sd/pl181.c| 2 +- > include/hw/qdev-core.h | 4 ++-- > 14 files changed, 20 insertions(+), 20 deletions(-) > > diff --git a/hw/audio/intel-hda.c b/hw/audio/intel-hda.c > index 6ecd383540..27b71c57cf 100644 > --- a/hw/audio/intel-hda.c > +++ b/hw/audio/intel-hda.c > @@ -1087,7 +1087,7 @@ static void intel_hda_reset(DeviceState *dev) > QTAILQ_FOREACH(kid, >codecs.qbus.children, sibling) { > DeviceState *qdev = kid->child; > cdev = HDA_CODEC_DEVICE(qdev); > -device_reset(DEVICE(cdev)); > +device_legacy_reset(DEVICE(cdev)); > d->state_sts |= (1 << cdev->cad); > } > intel_hda_update_irq(d); > diff --git a/hw/core/qdev.c b/hw/core/qdev.c > index 60d66c2f39..a95d4fa87d 100644 > --- a/hw/core/qdev.c > +++ b/hw/core/qdev.c > @@ -257,7 +257,7 @@ HotplugHandler *qdev_get_hotplug_handler(DeviceState *dev) > > static int qdev_reset_one(DeviceState *dev, void *opaque) > { > -device_reset(dev); > +device_legacy_reset(dev); > > return 0; > } > @@ -865,7 +865,7 @@ static void device_set_realized(Object *obj, bool value, > Error **errp) > } > } > if (dev->hotplugged) { > -device_reset(dev); > +device_legacy_reset(dev); > } > dev->pending_deleted_event = false; > > @@ -1087,7 +1087,7 @@ void device_class_set_parent_unrealize(DeviceClass *dc, > dc->unrealize = dev_unrealize; > } > > -void device_reset(DeviceState *dev) > +void device_legacy_reset(DeviceState *dev) > { > DeviceClass *klass = DEVICE_GET_CLASS(dev); > > diff --git a/hw/hyperv/hyperv.c b/hw/hyperv/hyperv.c > index 6ebf31c310..cd9db3cb5c 100644 > --- a/hw/hyperv/hyperv.c > +++ b/hw/hyperv/hyperv.c > @@ -140,7 +140,7 @@ void hyperv_synic_reset(CPUState *cs) > SynICState *synic = get_synic(cs); > > if (synic) { > -device_reset(DEVICE(synic)); > +device_legacy_reset(DEVICE(synic)); > } > } > > diff --git a/hw/i386/pc.c b/hw/i386/pc.c > index 3ab4bcb3ca..f33a8de42f 100644 > --- a/hw/i386/pc.c > +++ b/hw/i386/pc.c > @@ -2826,7 +2826,7 @@ static void pc_machine_reset(MachineState *machine) > cpu = X86_CPU(cs); > > if (cpu->apic_state) { > -device_reset(cpu->apic_state); > +device_legacy_reset(cpu->apic_state); > } > } > } > diff --git a/hw/ide/microdrive.c b/hw/ide/microdrive.c > index b0272ea14b..6b30e36ed8 100644 > --- a/hw/ide/microdrive.c > +++ b/hw/ide/microdrive.c > @@ -173,7 +173,7 @@ static void md_attr_write(PCMCIACardState *card, uint32_t > at, uint8_t value) > case 0x00: /* Configuration Option Register */ > s->opt = value & 0xcf; > if (value & OPT_SRESET) { > -device_reset(DEVICE(s)); > +device_legacy_reset(DEVICE(s)); > } > md_interrupt_update(s); > break; > @@ -316,7 +316,7 @@ static void md_common_write(PCMCIACardState *card, > uint32_t at, uint16_t value) > case 0xe:/* Device Control */ > s->ctrl = value; > if (value & CTRL_SRST) { > -device_reset(DEVICE(s)); > +device_legacy_reset(DEVICE(s)); > } > md_interrupt_update(s); > break; > @@ -541,7 +541,7 @@ static int dscm1_attach(PCMCIACardState *card) > md->attr_base = pcc->cis[0x74] | (pcc->cis[0x76] <<
[Qemu-block] [PATCH v4 01/10] add device_legacy_reset function to prepare for reset api change
Provide a temporary device_legacy_reset function doing what device_reset does to prepare for the transition with Resettable API. All occurrence of device_reset in the code tree are also replaced by device_legacy_reset. The new resettable API has different prototype and semantics (resetting child buses as well as the specified device). Subsequent commits will make the changeover for each call site individually; once that is complete device_legacy_reset() will be removed. Signed-off-by: Damien Hedde Reviewed-by: Peter Maydell --- Cc: Gerd Hoffmann Cc: Paolo Bonzini Cc: "Daniel P. Berrangé" Cc: Eduardo Habkost Cc: Richard Henderson Cc: "Michael S. Tsirkin" Cc: Marcel Apfelbaum Cc: John Snow Cc: "Cédric Le Goater" Cc: Collin Walling Cc: Cornelia Huck Cc: David Hildenbrand Cc: Halil Pasic Cc: Christian Borntraeger Cc: Dmitry Fleytman Cc: Fam Zheng Cc: qemu-block@nongnu.org Cc: qemu-...@nongnu.org Cc: qemu-s3...@nongnu.org Cc: qemu-...@nongnu.org --- hw/audio/intel-hda.c | 2 +- hw/core/qdev.c | 6 +++--- hw/hyperv/hyperv.c | 2 +- hw/i386/pc.c | 2 +- hw/ide/microdrive.c | 8 hw/intc/spapr_xive.c | 2 +- hw/ppc/pnv_psi.c | 2 +- hw/ppc/spapr_pci.c | 2 +- hw/ppc/spapr_vio.c | 2 +- hw/s390x/s390-pci-inst.c | 2 +- hw/scsi/vmw_pvscsi.c | 2 +- hw/sd/omap_mmc.c | 2 +- hw/sd/pl181.c| 2 +- include/hw/qdev-core.h | 4 ++-- 14 files changed, 20 insertions(+), 20 deletions(-) diff --git a/hw/audio/intel-hda.c b/hw/audio/intel-hda.c index 6ecd383540..27b71c57cf 100644 --- a/hw/audio/intel-hda.c +++ b/hw/audio/intel-hda.c @@ -1087,7 +1087,7 @@ static void intel_hda_reset(DeviceState *dev) QTAILQ_FOREACH(kid, >codecs.qbus.children, sibling) { DeviceState *qdev = kid->child; cdev = HDA_CODEC_DEVICE(qdev); -device_reset(DEVICE(cdev)); +device_legacy_reset(DEVICE(cdev)); d->state_sts |= (1 << cdev->cad); } intel_hda_update_irq(d); diff --git a/hw/core/qdev.c b/hw/core/qdev.c index 60d66c2f39..a95d4fa87d 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -257,7 +257,7 @@ HotplugHandler *qdev_get_hotplug_handler(DeviceState *dev) static int qdev_reset_one(DeviceState *dev, void *opaque) { -device_reset(dev); +device_legacy_reset(dev); return 0; } @@ -865,7 +865,7 @@ static void device_set_realized(Object *obj, bool value, Error **errp) } } if (dev->hotplugged) { -device_reset(dev); +device_legacy_reset(dev); } dev->pending_deleted_event = false; @@ -1087,7 +1087,7 @@ void device_class_set_parent_unrealize(DeviceClass *dc, dc->unrealize = dev_unrealize; } -void device_reset(DeviceState *dev) +void device_legacy_reset(DeviceState *dev) { DeviceClass *klass = DEVICE_GET_CLASS(dev); diff --git a/hw/hyperv/hyperv.c b/hw/hyperv/hyperv.c index 6ebf31c310..cd9db3cb5c 100644 --- a/hw/hyperv/hyperv.c +++ b/hw/hyperv/hyperv.c @@ -140,7 +140,7 @@ void hyperv_synic_reset(CPUState *cs) SynICState *synic = get_synic(cs); if (synic) { -device_reset(DEVICE(synic)); +device_legacy_reset(DEVICE(synic)); } } diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 3ab4bcb3ca..f33a8de42f 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -2826,7 +2826,7 @@ static void pc_machine_reset(MachineState *machine) cpu = X86_CPU(cs); if (cpu->apic_state) { -device_reset(cpu->apic_state); +device_legacy_reset(cpu->apic_state); } } } diff --git a/hw/ide/microdrive.c b/hw/ide/microdrive.c index b0272ea14b..6b30e36ed8 100644 --- a/hw/ide/microdrive.c +++ b/hw/ide/microdrive.c @@ -173,7 +173,7 @@ static void md_attr_write(PCMCIACardState *card, uint32_t at, uint8_t value) case 0x00: /* Configuration Option Register */ s->opt = value & 0xcf; if (value & OPT_SRESET) { -device_reset(DEVICE(s)); +device_legacy_reset(DEVICE(s)); } md_interrupt_update(s); break; @@ -316,7 +316,7 @@ static void md_common_write(PCMCIACardState *card, uint32_t at, uint16_t value) case 0xe: /* Device Control */ s->ctrl = value; if (value & CTRL_SRST) { -device_reset(DEVICE(s)); +device_legacy_reset(DEVICE(s)); } md_interrupt_update(s); break; @@ -541,7 +541,7 @@ static int dscm1_attach(PCMCIACardState *card) md->attr_base = pcc->cis[0x74] | (pcc->cis[0x76] << 8); md->io_base = 0x0; -device_reset(DEVICE(md)); +device_legacy_reset(DEVICE(md)); md_interrupt_update(md); return 0; @@ -551,7 +551,7 @@ static int dscm1_detach(PCMCIACardState *card) { MicroDriveState *md = MICRODRIVE(card); -device_reset(DEVICE(md)); +device_legacy_reset(DEVICE(md)); return 0; } diff --git a/hw/intc/spapr_xive.c