[PATCH] hw/ppc/spapr_pci.c: Use device_cold_reset() rather than device_legacy_reset()

Peter Maydell posted 1 patch 1 year, 7 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20221014142841.2092784-1-peter.maydell@linaro.org
Maintainers: "Cédric Le Goater" <clg@kaod.org>, Daniel Henrique Barboza <danielhb413@gmail.com>, David Gibson <david@gibson.dropbear.id.au>, Greg Kurz <groug@kaod.org>
hw/ppc/spapr_pci.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] hw/ppc/spapr_pci.c: Use device_cold_reset() rather than device_legacy_reset()
Posted by Peter Maydell 1 year, 7 months ago
In spapr_phb_children_reset() we call device_legacy_reset() to reset any
QOM children of the SPAPR PCI host bridge device. This will not reset
any qbus such a child might own. Switch to device_cold_reset(), which will
reset both the device and its buses. (If the child has no qbuses then
there will be no change in behaviour.)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
I couldn't figure out what exactly the QOM child objects are in this
case -- the comment in spapr_phb_reset() suggests there's only one and
it's the IOMMU? My guess is that they don't have any qbuses in any case.
This patch was tested with 'make check' and 'make check-avocado' only.
---
 hw/ppc/spapr_pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c
index 57c8a4f0855..7b7618d5da0 100644
--- a/hw/ppc/spapr_pci.c
+++ b/hw/ppc/spapr_pci.c
@@ -2045,7 +2045,7 @@ static int spapr_phb_children_reset(Object *child, void *opaque)
     DeviceState *dev = (DeviceState *) object_dynamic_cast(child, TYPE_DEVICE);
 
     if (dev) {
-        device_legacy_reset(dev);
+        device_cold_reset(dev);
     }
 
     return 0;
-- 
2.25.1
Re: [PATCH] hw/ppc/spapr_pci.c: Use device_cold_reset() rather than device_legacy_reset()
Posted by Daniel Henrique Barboza 1 year, 7 months ago

On 10/14/22 11:28, Peter Maydell wrote:
> In spapr_phb_children_reset() we call device_legacy_reset() to reset any
> QOM children of the SPAPR PCI host bridge device. This will not reset
> any qbus such a child might own. Switch to device_cold_reset(), which will
> reset both the device and its buses. (If the child has no qbuses then
> there will be no change in behaviour.)
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>

And queued. Thanks,


Daniel

> I couldn't figure out what exactly the QOM child objects are in this
> case -- the comment in spapr_phb_reset() suggests there's only one and
> it's the IOMMU? My guess is that they don't have any qbuses in any case.
> This patch was tested with 'make check' and 'make check-avocado' only.
> ---
>   hw/ppc/spapr_pci.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c
> index 57c8a4f0855..7b7618d5da0 100644
> --- a/hw/ppc/spapr_pci.c
> +++ b/hw/ppc/spapr_pci.c
> @@ -2045,7 +2045,7 @@ static int spapr_phb_children_reset(Object *child, void *opaque)
>       DeviceState *dev = (DeviceState *) object_dynamic_cast(child, TYPE_DEVICE);
>   
>       if (dev) {
> -        device_legacy_reset(dev);
> +        device_cold_reset(dev);
>       }
>   
>       return 0;
Re: [PATCH] hw/ppc/spapr_pci.c: Use device_cold_reset() rather than device_legacy_reset()
Posted by Cédric Le Goater 1 year, 7 months ago
On 10/14/22 16:28, Peter Maydell wrote:
> In spapr_phb_children_reset() we call device_legacy_reset() to reset any
> QOM children of the SPAPR PCI host bridge device. This will not reset
> any qbus such a child might own. Switch to device_cold_reset(), which will
> reset both the device and its buses. (If the child has no qbuses then
> there will be no change in behaviour.)
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> I couldn't figure out what exactly the QOM child objects are in this
> case -- the comment in spapr_phb_reset() suggests there's only one and
> it's the IOMMU? My guess is that they don't have any qbuses in any case.
> This patch was tested with 'make check' and 'make check-avocado' only.

If I understand correctly commit e28c16f61fee ("spapr_pci: Allow multiple
TCE tables per PHB"), spapr_phb_children_reset() was introduced to reset
the TYPE_SPAPR_TCE_TABLE objects.

Reviewed-by: Cédric Le Goater <clg@kaod.org>

Thanks,

C.

> ---
>   hw/ppc/spapr_pci.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c
> index 57c8a4f0855..7b7618d5da0 100644
> --- a/hw/ppc/spapr_pci.c
> +++ b/hw/ppc/spapr_pci.c
> @@ -2045,7 +2045,7 @@ static int spapr_phb_children_reset(Object *child, void *opaque)
>       DeviceState *dev = (DeviceState *) object_dynamic_cast(child, TYPE_DEVICE);
>   
>       if (dev) {
> -        device_legacy_reset(dev);
> +        device_cold_reset(dev);
>       }
>   
>       return 0;