Message ID | 20221109161444.3397405-3-peter.maydell@linaro.org |
---|---|
State | Superseded |
Headers | show |
Series | arm: Convert Arm GIC, ITS, SMMU devices to 3-phase reset | expand |
On 11/10/22 03:14, Peter Maydell wrote: > Convert the TYPE_ARM_SMMUV3 device to 3-phase reset. The legacy > reset method doesn't do anything that's invalid in the hold phase, so > the conversion only requires changing it to a hold phase method, and > using the 3-phase versions of the "save the parent reset method and > chain to it" code. > > Signed-off-by: Peter Maydell<peter.maydell@linaro.org> > --- > include/hw/arm/smmuv3.h | 2 +- > hw/arm/smmuv3.c | 12 ++++++++---- > 2 files changed, 9 insertions(+), 5 deletions(-) Reviewed-by: Richard Henderson <richard.henderson@linaro.org> r~
Hi Peter, On 11/9/22 17:14, Peter Maydell wrote: > Convert the TYPE_ARM_SMMUV3 device to 3-phase reset. The legacy > reset method doesn't do anything that's invalid in the hold phase, so > the conversion only requires changing it to a hold phase method, and > using the 3-phase versions of the "save the parent reset method and > chain to it" code. > > Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Eric Auger <eric.auger@redhat.com> Eric > --- > include/hw/arm/smmuv3.h | 2 +- > hw/arm/smmuv3.c | 12 ++++++++---- > 2 files changed, 9 insertions(+), 5 deletions(-) > > diff --git a/include/hw/arm/smmuv3.h b/include/hw/arm/smmuv3.h > index c641e60735e..f1921fdf9e7 100644 > --- a/include/hw/arm/smmuv3.h > +++ b/include/hw/arm/smmuv3.h > @@ -77,7 +77,7 @@ struct SMMUv3Class { > /*< public >*/ > > DeviceRealize parent_realize; > - DeviceReset parent_reset; > + ResettablePhases parent_phases; > }; > > #define TYPE_ARM_SMMUV3 "arm-smmuv3" > diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c > index daa80e9c7b6..955b89c8d59 100644 > --- a/hw/arm/smmuv3.c > +++ b/hw/arm/smmuv3.c > @@ -1431,12 +1431,14 @@ static void smmu_init_irq(SMMUv3State *s, SysBusDevice *dev) > } > } > > -static void smmu_reset(DeviceState *dev) > +static void smmu_reset_hold(Object *obj) > { > - SMMUv3State *s = ARM_SMMUV3(dev); > + SMMUv3State *s = ARM_SMMUV3(obj); > SMMUv3Class *c = ARM_SMMUV3_GET_CLASS(s); > > - c->parent_reset(dev); > + if (c->parent_phases.hold) { > + c->parent_phases.hold(obj); > + } > > smmuv3_init_regs(s); > } > @@ -1520,10 +1522,12 @@ static void smmuv3_instance_init(Object *obj) > static void smmuv3_class_init(ObjectClass *klass, void *data) > { > DeviceClass *dc = DEVICE_CLASS(klass); > + ResettableClass *rc = RESETTABLE_CLASS(klass); > SMMUv3Class *c = ARM_SMMUV3_CLASS(klass); > > dc->vmsd = &vmstate_smmuv3; > - device_class_set_parent_reset(dc, smmu_reset, &c->parent_reset); > + resettable_class_set_parent_phases(rc, NULL, smmu_reset_hold, NULL, > + &c->parent_phases); > c->parent_realize = dc->realize; > dc->realize = smmu_realize; > }
On 9/11/22 17:14, Peter Maydell wrote: > Convert the TYPE_ARM_SMMUV3 device to 3-phase reset. The legacy > reset method doesn't do anything that's invalid in the hold phase, so > the conversion only requires changing it to a hold phase method, and > using the 3-phase versions of the "save the parent reset method and > chain to it" code. > > Signed-off-by: Peter Maydell <peter.maydell@linaro.org> > --- > include/hw/arm/smmuv3.h | 2 +- > hw/arm/smmuv3.c | 12 ++++++++---- > 2 files changed, 9 insertions(+), 5 deletions(-) Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
diff --git a/include/hw/arm/smmuv3.h b/include/hw/arm/smmuv3.h index c641e60735e..f1921fdf9e7 100644 --- a/include/hw/arm/smmuv3.h +++ b/include/hw/arm/smmuv3.h @@ -77,7 +77,7 @@ struct SMMUv3Class { /*< public >*/ DeviceRealize parent_realize; - DeviceReset parent_reset; + ResettablePhases parent_phases; }; #define TYPE_ARM_SMMUV3 "arm-smmuv3" diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c index daa80e9c7b6..955b89c8d59 100644 --- a/hw/arm/smmuv3.c +++ b/hw/arm/smmuv3.c @@ -1431,12 +1431,14 @@ static void smmu_init_irq(SMMUv3State *s, SysBusDevice *dev) } } -static void smmu_reset(DeviceState *dev) +static void smmu_reset_hold(Object *obj) { - SMMUv3State *s = ARM_SMMUV3(dev); + SMMUv3State *s = ARM_SMMUV3(obj); SMMUv3Class *c = ARM_SMMUV3_GET_CLASS(s); - c->parent_reset(dev); + if (c->parent_phases.hold) { + c->parent_phases.hold(obj); + } smmuv3_init_regs(s); } @@ -1520,10 +1522,12 @@ static void smmuv3_instance_init(Object *obj) static void smmuv3_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); + ResettableClass *rc = RESETTABLE_CLASS(klass); SMMUv3Class *c = ARM_SMMUV3_CLASS(klass); dc->vmsd = &vmstate_smmuv3; - device_class_set_parent_reset(dc, smmu_reset, &c->parent_reset); + resettable_class_set_parent_phases(rc, NULL, smmu_reset_hold, NULL, + &c->parent_phases); c->parent_realize = dc->realize; dc->realize = smmu_realize; }
Convert the TYPE_ARM_SMMUV3 device to 3-phase reset. The legacy reset method doesn't do anything that's invalid in the hold phase, so the conversion only requires changing it to a hold phase method, and using the 3-phase versions of the "save the parent reset method and chain to it" code. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> --- include/hw/arm/smmuv3.h | 2 +- hw/arm/smmuv3.c | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-)