qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Damien Hedde <damien.hedde@greensocs.com>, qemu-devel@nongnu.org
Cc: "Fam Zheng" <fam@euphon.net>,
	peter.maydell@linaro.org,
	"Collin Walling" <walling@linux.ibm.com>,
	"Dmitry Fleytman" <dmitry.fleytman@gmail.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Gerd Hoffmann" <kraxel@redhat.com>,
	"David Hildenbrand" <david@redhat.com>,
	"Halil Pasic" <pasic@linux.ibm.com>,
	"Christian Borntraeger" <borntraeger@de.ibm.com>,
	david@gibson.dropbear.id.au, ehabkost@redhat.com,
	"Richard Henderson" <richard.henderson@linaro.org>,
	qemu-s390x@nongnu.org, "Cédric Le Goater" <clg@kaod.org>,
	"John Snow" <jsnow@redhat.com>,
	"Richard Henderson" <rth@twiddle.net>,
	berrange@redhat.com, cohuck@redhat.com,
	mark.burton@greensocs.com, edgari@xilinx.com,
	pbonzini@redhat.com
Subject: Re: [PATCH v7 01/11] add device_legacy_reset function to prepare for reset api change
Date: Sat, 18 Jan 2020 07:48:25 +0100	[thread overview]
Message-ID: <ac48e5c4-afa2-4142-69c8-95b09f8108fd@redhat.com> (raw)
In-Reply-To: <20200115123620.250132-2-damien.hedde@greensocs.com>

On 1/15/20 1:36 PM, 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 <damien.hedde@greensocs.com>
> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
> Acked-by: David Gibson <david@gibson.dropbear.id.au>
> Acked-by: Cornelia Huck <cohuck@redhat.com>
> ---
> v7 update: added new occurence due to rebase
> 
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: "Daniel P. Berrangé" <berrange@redhat.com>
> Cc: Eduardo Habkost <ehabkost@redhat.com>
> Cc: Richard Henderson <rth@twiddle.net>
> Cc: "Michael S. Tsirkin" <mst@redhat.com>
> Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
> Cc: John Snow <jsnow@redhat.com>
> Cc: "Cédric Le Goater" <clg@kaod.org>
> Cc: Collin Walling <walling@linux.ibm.com>
> Cc: Cornelia Huck <cohuck@redhat.com>
> Cc: David Hildenbrand <david@redhat.com>
> Cc: Halil Pasic <pasic@linux.ibm.com>
> Cc: Christian Borntraeger <borntraeger@de.ibm.com>
> Cc: Dmitry Fleytman <dmitry.fleytman@gmail.com>
> Cc: Fam Zheng <fam@euphon.net>
> ---
>   include/hw/qdev-core.h   | 4 ++--
>   hw/audio/intel-hda.c     | 2 +-
>   hw/core/qdev.c           | 6 +++---
>   hw/hyperv/hyperv.c       | 2 +-
>   hw/i386/microvm.c        | 2 +-
>   hw/i386/pc.c             | 2 +-
>   hw/ide/microdrive.c      | 8 ++++----
>   hw/intc/spapr_xive.c     | 2 +-
>   hw/ppc/pnv_psi.c         | 4 ++--
>   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 +-
>   15 files changed, 22 insertions(+), 22 deletions(-)
> 
> diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
> index 1518495b1e..b8341b0fb0 100644
> --- a/include/hw/qdev-core.h
> +++ b/include/hw/qdev-core.h
> @@ -427,11 +427,11 @@ char *qdev_get_own_fw_dev_path_from_handler(BusState *bus, DeviceState *dev);
>   void qdev_machine_init(void);
>   
>   /**
> - * @device_reset
> + * device_legacy_reset:
>    *
>    * Reset a single device (by calling the reset method).
>    */
> -void device_reset(DeviceState *dev);
> +void device_legacy_reset(DeviceState *dev);
>   
>   void device_class_set_parent_reset(DeviceClass *dc,
>                                      DeviceReset dev_reset,
> 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, &d->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 9f1753f5cf..8c0c8284c8 100644
> --- a/hw/core/qdev.c
> +++ b/hw/core/qdev.c
> @@ -298,7 +298,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;
>   }
> @@ -895,7 +895,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;
>   
> @@ -1127,7 +1127,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 da8ce82725..8ca3706f5b 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/microvm.c b/hw/i386/microvm.c
> index 827ce29e58..d23485108d 100644
> --- a/hw/i386/microvm.c
> +++ b/hw/i386/microvm.c
> @@ -370,7 +370,7 @@ static void microvm_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/i386/pc.c b/hw/i386/pc.c
> index 8054bc4147..91c7fdaab1 100644
> --- a/hw/i386/pc.c
> +++ b/hw/i386/pc.c
> @@ -1877,7 +1877,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 dscm1xxxx_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 dscm1xxxx_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 b/hw/intc/spapr_xive.c
> index 7663123878..52bab29784 100644
> --- a/hw/intc/spapr_xive.c
> +++ b/hw/intc/spapr_xive.c
> @@ -1766,7 +1766,7 @@ static target_ulong h_int_reset(PowerPCCPU *cpu,
>           return H_PARAMETER;
>       }
>   
> -    device_reset(DEVICE(xive));
> +    device_legacy_reset(DEVICE(xive));
>   
>       if (kvm_irqchip_in_kernel()) {
>           Error *local_err = NULL;
> diff --git a/hw/ppc/pnv_psi.c b/hw/ppc/pnv_psi.c
> index 1d8da31738..916e2a9ba7 100644
> --- a/hw/ppc/pnv_psi.c
> +++ b/hw/ppc/pnv_psi.c
> @@ -466,7 +466,7 @@ static void pnv_psi_reset(DeviceState *dev)
>   
>   static void pnv_psi_reset_handler(void *dev)
>   {
> -    device_reset(DEVICE(dev));
> +    device_legacy_reset(DEVICE(dev));
>   }
>   
>   static void pnv_psi_realize(DeviceState *dev, Error **errp)
> @@ -715,7 +715,7 @@ static void pnv_psi_p9_mmio_write(void *opaque, hwaddr addr,
>           break;
>       case PSIHB9_INTERRUPT_CONTROL:
>           if (val & PSIHB9_IRQ_RESET) {
> -            device_reset(DEVICE(&psi9->source));
> +            device_legacy_reset(DEVICE(&psi9->source));
>           }
>           psi->regs[reg] = val;
>           break;
> diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c
> index 723373de73..81b5d1b6f2 100644
> --- a/hw/ppc/spapr_pci.c
> +++ b/hw/ppc/spapr_pci.c
> @@ -2014,7 +2014,7 @@ static int spapr_phb_children_reset(Object *child, void *opaque)
>       DeviceState *dev = (DeviceState *) object_dynamic_cast(child, TYPE_DEVICE);
>   
>       if (dev) {
> -        device_reset(dev);
> +        device_legacy_reset(dev);
>       }
>   
>       return 0;
> diff --git a/hw/ppc/spapr_vio.c b/hw/ppc/spapr_vio.c
> index 554de9930d..f14944e900 100644
> --- a/hw/ppc/spapr_vio.c
> +++ b/hw/ppc/spapr_vio.c
> @@ -304,7 +304,7 @@ int spapr_vio_send_crq(SpaprVioDevice *dev, uint8_t *crq)
>   static void spapr_vio_quiesce_one(SpaprVioDevice *dev)
>   {
>       if (dev->tcet) {
> -        device_reset(DEVICE(dev->tcet));
> +        device_legacy_reset(DEVICE(dev->tcet));
>       }
>       free_crq(dev);
>   }
> diff --git a/hw/s390x/s390-pci-inst.c b/hw/s390x/s390-pci-inst.c
> index 92c7e45df5..2f7a7d7bd1 100644
> --- a/hw/s390x/s390-pci-inst.c
> +++ b/hw/s390x/s390-pci-inst.c
> @@ -243,7 +243,7 @@ int clp_service_call(S390CPU *cpu, uint8_t r2, uintptr_t ra)
>                   stw_p(&ressetpci->hdr.rsp, CLP_RC_SETPCIFN_FHOP);
>                   goto out;
>               }
> -            device_reset(DEVICE(pbdev));
> +            device_legacy_reset(DEVICE(pbdev));
>               pbdev->fh &= ~FH_MASK_ENABLE;
>               pbdev->state = ZPCI_FS_DISABLED;
>               stl_p(&ressetpci->fh, pbdev->fh);
> diff --git a/hw/scsi/vmw_pvscsi.c b/hw/scsi/vmw_pvscsi.c
> index 452a3b63b2..7baab1532f 100644
> --- a/hw/scsi/vmw_pvscsi.c
> +++ b/hw/scsi/vmw_pvscsi.c
> @@ -838,7 +838,7 @@ pvscsi_on_cmd_reset_device(PVSCSIState *s)
>   
>       if (sdev != NULL) {
>           s->resetting++;
> -        device_reset(&sdev->qdev);
> +        device_legacy_reset(&sdev->qdev);
>           s->resetting--;
>           return PVSCSI_COMMAND_PROCESSING_SUCCEEDED;
>       }
> diff --git a/hw/sd/omap_mmc.c b/hw/sd/omap_mmc.c
> index c6e516b611..4088a8a80b 100644
> --- a/hw/sd/omap_mmc.c
> +++ b/hw/sd/omap_mmc.c
> @@ -318,7 +318,7 @@ void omap_mmc_reset(struct omap_mmc_s *host)
>        * into any bus, and we must reset it manually. When omap_mmc is
>        * QOMified this must move into the QOM reset function.
>        */
> -    device_reset(DEVICE(host->card));
> +    device_legacy_reset(DEVICE(host->card));
>   }
>   
>   static uint64_t omap_mmc_read(void *opaque, hwaddr offset,
> diff --git a/hw/sd/pl181.c b/hw/sd/pl181.c
> index 8033fe455d..2b3776a6a0 100644
> --- a/hw/sd/pl181.c
> +++ b/hw/sd/pl181.c
> @@ -482,7 +482,7 @@ static void pl181_reset(DeviceState *d)
>       /* Since we're still using the legacy SD API the card is not plugged
>        * into any bus, and we must reset it manually.
>        */
> -    device_reset(DEVICE(s->card));
> +    device_legacy_reset(DEVICE(s->card));
>   }
>   
>   static void pl181_init(Object *obj)
> 

Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>



  reply	other threads:[~2020-01-18  6:49 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-15 12:36 [PATCH v7 00/11] Multi-phase reset mechanism Damien Hedde
2020-01-15 12:36 ` [PATCH v7 01/11] add device_legacy_reset function to prepare for reset api change Damien Hedde
2020-01-18  6:48   ` Philippe Mathieu-Daudé [this message]
2020-01-15 12:36 ` [PATCH v7 02/11] hw/core/qdev: add trace events to help with resettable transition Damien Hedde
2020-01-16  2:04   ` Philippe Mathieu-Daudé
2020-01-15 12:36 ` [PATCH v7 03/11] hw/core: create Resettable QOM interface Damien Hedde
2020-01-16  1:59   ` Philippe Mathieu-Daudé
2020-01-16  2:12     ` Philippe Mathieu-Daudé
2020-01-16  8:53     ` Damien Hedde
2020-01-16  8:57       ` Philippe Mathieu-Daudé
2020-01-18  6:35   ` Philippe Mathieu-Daudé
2020-01-20  8:50     ` Damien Hedde
2020-01-18  6:42   ` Philippe Mathieu-Daudé
2020-01-20  9:08     ` Damien Hedde
2020-01-20  9:18       ` Philippe Mathieu-Daudé
2020-01-15 12:36 ` [PATCH v7 04/11] hw/core: add Resettable support to BusClass and DeviceClass Damien Hedde
2020-01-16  2:02   ` Philippe Mathieu-Daudé
2020-01-15 12:36 ` [PATCH v7 05/11] hw/core/resettable: add support for changing parent Damien Hedde
2020-01-18  6:45   ` Philippe Mathieu-Daudé
2020-01-15 12:36 ` [PATCH v7 06/11] hw/core/qdev: handle parent bus change regarding resettable Damien Hedde
2020-01-16  2:05   ` Philippe Mathieu-Daudé
2020-01-15 12:36 ` [PATCH v7 07/11] hw/core/qdev: update hotplug reset " Damien Hedde
2020-01-18  6:47   ` Philippe Mathieu-Daudé
2020-01-15 12:36 ` [PATCH v7 08/11] hw/core: deprecate old reset functions and introduce new ones Damien Hedde
2020-01-18  6:47   ` Philippe Mathieu-Daudé
2020-01-15 12:36 ` [PATCH v7 09/11] docs/devel/reset.rst: add doc about Resettable interface Damien Hedde
2020-01-15 12:36 ` [PATCH v7 10/11] vl: replace deprecated qbus_reset_all registration Damien Hedde
2020-01-15 23:44   ` Philippe Mathieu-Daudé
2020-01-16  8:57     ` Damien Hedde
2020-01-15 12:36 ` [PATCH v7 11/11] hw/s390x/ipl: replace deprecated qdev_reset_all registration Damien Hedde

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=ac48e5c4-afa2-4142-69c8-95b09f8108fd@redhat.com \
    --to=philmd@redhat.com \
    --cc=berrange@redhat.com \
    --cc=borntraeger@de.ibm.com \
    --cc=clg@kaod.org \
    --cc=cohuck@redhat.com \
    --cc=damien.hedde@greensocs.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=david@redhat.com \
    --cc=dmitry.fleytman@gmail.com \
    --cc=edgari@xilinx.com \
    --cc=ehabkost@redhat.com \
    --cc=fam@euphon.net \
    --cc=jsnow@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=mark.burton@greensocs.com \
    --cc=mst@redhat.com \
    --cc=pasic@linux.ibm.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=rth@twiddle.net \
    --cc=walling@linux.ibm.com \
    /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).