diff mbox series

[for-8.0,6/7] hw/intc/xics: Convert TYPE_ICS to 3-phase reset

Message ID 20221125115240.3005559-7-peter.maydell@linaro.org
State New
Headers show
Series virtio, pci, xics: 3-phase reset conversions | expand

Commit Message

Peter Maydell Nov. 25, 2022, 11:52 a.m. UTC
Convert the TYPE_ICS class to 3-phase reset; this will allow us
to convert the TYPE_PHB3_MSI class which inherits from it.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 hw/intc/xics.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

Comments

Cédric Le Goater Nov. 25, 2022, 12:25 p.m. UTC | #1
On 11/25/22 12:52, Peter Maydell wrote:
> Convert the TYPE_ICS class to 3-phase reset; this will allow us
> to convert the TYPE_PHB3_MSI class which inherits from it.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


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

Thanks,

C.

> ---
>   hw/intc/xics.c | 9 +++++----
>   1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/hw/intc/xics.c b/hw/intc/xics.c
> index dd130467ccc..c7f8abd71e4 100644
> --- a/hw/intc/xics.c
> +++ b/hw/intc/xics.c
> @@ -564,9 +564,9 @@ static void ics_reset_irq(ICSIRQState *irq)
>       irq->saved_priority = 0xff;
>   }
>   
> -static void ics_reset(DeviceState *dev)
> +static void ics_reset_hold(Object *obj)
>   {
> -    ICSState *ics = ICS(dev);
> +    ICSState *ics = ICS(obj);
>       g_autofree uint8_t *flags = g_malloc(ics->nr_irqs);
>       int i;
>   
> @@ -584,7 +584,7 @@ static void ics_reset(DeviceState *dev)
>       if (kvm_irqchip_in_kernel()) {
>           Error *local_err = NULL;
>   
> -        ics_set_kvm_state(ICS(dev), &local_err);
> +        ics_set_kvm_state(ics, &local_err);
>           if (local_err) {
>               error_report_err(local_err);
>           }
> @@ -688,16 +688,17 @@ static Property ics_properties[] = {
>   static void ics_class_init(ObjectClass *klass, void *data)
>   {
>       DeviceClass *dc = DEVICE_CLASS(klass);
> +    ResettableClass *rc = RESETTABLE_CLASS(klass);
>   
>       dc->realize = ics_realize;
>       device_class_set_props(dc, ics_properties);
> -    dc->reset = ics_reset;
>       dc->vmsd = &vmstate_ics;
>       /*
>        * Reason: part of XICS interrupt controller, needs to be wired up,
>        * e.g. by spapr_irq_init().
>        */
>       dc->user_creatable = false;
> +    rc->phases.hold = ics_reset_hold;
>   }
>   
>   static const TypeInfo ics_info = {
Greg Kurz Nov. 25, 2022, 1:48 p.m. UTC | #2
On Fri, 25 Nov 2022 11:52:39 +0000
Peter Maydell <peter.maydell@linaro.org> wrote:

> Convert the TYPE_ICS class to 3-phase reset; this will allow us
> to convert the TYPE_PHB3_MSI class which inherits from it.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---

Reviewed-by: Greg Kurz <groug@kaod.org>

>  hw/intc/xics.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/hw/intc/xics.c b/hw/intc/xics.c
> index dd130467ccc..c7f8abd71e4 100644
> --- a/hw/intc/xics.c
> +++ b/hw/intc/xics.c
> @@ -564,9 +564,9 @@ static void ics_reset_irq(ICSIRQState *irq)
>      irq->saved_priority = 0xff;
>  }
>  
> -static void ics_reset(DeviceState *dev)
> +static void ics_reset_hold(Object *obj)
>  {
> -    ICSState *ics = ICS(dev);
> +    ICSState *ics = ICS(obj);
>      g_autofree uint8_t *flags = g_malloc(ics->nr_irqs);
>      int i;
>  
> @@ -584,7 +584,7 @@ static void ics_reset(DeviceState *dev)
>      if (kvm_irqchip_in_kernel()) {
>          Error *local_err = NULL;
>  
> -        ics_set_kvm_state(ICS(dev), &local_err);
> +        ics_set_kvm_state(ics, &local_err);


>          if (local_err) {
>              error_report_err(local_err);
>          }
> @@ -688,16 +688,17 @@ static Property ics_properties[] = {
>  static void ics_class_init(ObjectClass *klass, void *data)
>  {
>      DeviceClass *dc = DEVICE_CLASS(klass);
> +    ResettableClass *rc = RESETTABLE_CLASS(klass);
>  
>      dc->realize = ics_realize;
>      device_class_set_props(dc, ics_properties);
> -    dc->reset = ics_reset;
>      dc->vmsd = &vmstate_ics;
>      /*
>       * Reason: part of XICS interrupt controller, needs to be wired up,
>       * e.g. by spapr_irq_init().
>       */
>      dc->user_creatable = false;
> +    rc->phases.hold = ics_reset_hold;
>  }
>  
>  static const TypeInfo ics_info = {
Philippe Mathieu-Daudé Nov. 30, 2022, 10:22 a.m. UTC | #3
On 25/11/22 12:52, Peter Maydell wrote:
> Convert the TYPE_ICS class to 3-phase reset; this will allow us
> to convert the TYPE_PHB3_MSI class which inherits from it.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>   hw/intc/xics.c | 9 +++++----
>   1 file changed, 5 insertions(+), 4 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
diff mbox series

Patch

diff --git a/hw/intc/xics.c b/hw/intc/xics.c
index dd130467ccc..c7f8abd71e4 100644
--- a/hw/intc/xics.c
+++ b/hw/intc/xics.c
@@ -564,9 +564,9 @@  static void ics_reset_irq(ICSIRQState *irq)
     irq->saved_priority = 0xff;
 }
 
-static void ics_reset(DeviceState *dev)
+static void ics_reset_hold(Object *obj)
 {
-    ICSState *ics = ICS(dev);
+    ICSState *ics = ICS(obj);
     g_autofree uint8_t *flags = g_malloc(ics->nr_irqs);
     int i;
 
@@ -584,7 +584,7 @@  static void ics_reset(DeviceState *dev)
     if (kvm_irqchip_in_kernel()) {
         Error *local_err = NULL;
 
-        ics_set_kvm_state(ICS(dev), &local_err);
+        ics_set_kvm_state(ics, &local_err);
         if (local_err) {
             error_report_err(local_err);
         }
@@ -688,16 +688,17 @@  static Property ics_properties[] = {
 static void ics_class_init(ObjectClass *klass, void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
+    ResettableClass *rc = RESETTABLE_CLASS(klass);
 
     dc->realize = ics_realize;
     device_class_set_props(dc, ics_properties);
-    dc->reset = ics_reset;
     dc->vmsd = &vmstate_ics;
     /*
      * Reason: part of XICS interrupt controller, needs to be wired up,
      * e.g. by spapr_irq_init().
      */
     dc->user_creatable = false;
+    rc->phases.hold = ics_reset_hold;
 }
 
 static const TypeInfo ics_info = {