qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>,
	qemu-devel@nongnu.org, Eduardo Habkost <ehabkost@redhat.com>,
	Markus Armbruster <armbru@redhat.com>
Cc: "David Gibson" <david@gibson.dropbear.id.au>,
	qemu-ppc@nongnu.org, "Cédric Le Goater" <clg@kaod.org>,
	"Greg Kurz" <groug@kaod.org>
Subject: Re: [PATCH 0/3] ppc: Convert (mostly) from device_legacy_reset() to device_cold_reset()
Date: Mon, 3 May 2021 18:55:23 +0200	[thread overview]
Message-ID: <5fc07469-32c4-3c86-92f1-430bac6f09a3@redhat.com> (raw)
In-Reply-To: <20210503151849.8766-1-peter.maydell@linaro.org>

Hi Peter,

+Eduardo/Markus

On 5/3/21 5:18 PM, Peter Maydell wrote:
> The old function device_legacy_reset() (which was originally
> device_reset() and got renamed when 3-phase-reset landed) is
> deprecated, because it has slightly odd semantics -- it resets the
> device itself, but (unlike when a device is reset as part of system
> reset) not any qbus it owns (and devices attached to the qbus).  The
> replacement is device_cold_reset(), which resets the device and its
> bus (if any).
> 
> For a device with child bus, the two functions are identical; this
> patchset changes the PPC code which uses device_legacy_reset() on
> devices which have no qbus to use device_cold_reset() instead; this
> should have no functionally visible difference.

So IIUC we should be able to add this check?

-- >8 --
diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index cefc5eaa0a9..4e03f964a42 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -1121,6 +1122,7 @@ void device_legacy_reset(DeviceState *dev)
     DeviceClass *klass = DEVICE_GET_CLASS(dev);

     trace_qdev_reset(dev, object_get_typename(OBJECT(dev)));
+    assert(DEVICE_GET_CLASS(dev)->bus_type);
     if (klass->reset) {
         klass->reset(dev);
     }
---

> 
> There is one other use of device_legacy_reset() in PPC code which I
> didn't change: in hw/ppc/spapr_pci.c:spapr_phb_children_reset().  I
> couldn't figure out what the children being reset here are and if
> they might own buses.  I suspect that even if they do own buses the
> right thing would be to change to device_cold_reset(), but I stuck to
> only the changes I felt reasonably sure were definitely
> no-behaviour-change.
> 
> NB: tested with 'make check' and 'make check-acceptance' only.
> 
> thanks
> -- PMM



  parent reply	other threads:[~2021-05-03 16:57 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-03 15:18 [PATCH 0/3] ppc: Convert (mostly) from device_legacy_reset() to device_cold_reset() Peter Maydell
2021-05-03 15:18 ` [PATCH 1/3] hw/intc/spapr_xive: Use device_cold_reset() instead of device_legacy_reset() Peter Maydell
2021-05-04  0:32   ` David Gibson
2021-05-03 15:18 ` [PATCH 2/3] hw/ppc/spapr_vio: Reset TCE table object with device_cold_reset() Peter Maydell
2021-05-04  0:36   ` David Gibson
2021-05-03 15:18 ` [PATCH 3/3] hw/ppc/pnv_psi: Use device_cold_reset() instead of device_legacy_reset() Peter Maydell
2021-05-04  0:37   ` David Gibson
2021-05-03 16:55 ` Philippe Mathieu-Daudé [this message]
2021-05-03 17:15   ` [PATCH 0/3] ppc: Convert (mostly) from device_legacy_reset() to device_cold_reset() Peter Maydell

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=5fc07469-32c4-3c86-92f1-430bac6f09a3@redhat.com \
    --to=philmd@redhat.com \
    --cc=armbru@redhat.com \
    --cc=clg@kaod.org \
    --cc=david@gibson.dropbear.id.au \
    --cc=ehabkost@redhat.com \
    --cc=groug@kaod.org \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@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).