diff mbox series

[v2,06/10] ppc/pnv: Add OCC for Power11

Message ID 20240426110023.733309-7-adityag@linux.ibm.com
State New
Headers show
Series Power11 support for QEMU | expand

Commit Message

Aditya Gupta April 26, 2024, 11 a.m. UTC
Power11 core is same as Power10, reuse PNV10_OCC initialisation,
by declaring `PNV11_OCC` as child class of `PNV10_OCC`

Cc: Cédric Le Goater <clg@kaod.org>
Cc: Frédéric Barrat <fbarrat@linux.ibm.com>
Cc: Mahesh J Salgaonkar <mahesh@linux.ibm.com>
Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
Cc: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Aditya Gupta <adityag@linux.ibm.com>
---
 hw/ppc/pnv_occ.c         | 14 ++++++++++++++
 include/hw/ppc/pnv_occ.h |  2 ++
 2 files changed, 16 insertions(+)

Comments

Cédric Le Goater April 26, 2024, 2:33 p.m. UTC | #1
On 4/26/24 13:00, Aditya Gupta wrote:
> Power11 core is same as Power10, reuse PNV10_OCC initialisation,
> by declaring `PNV11_OCC` as child class of `PNV10_OCC`

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

Thanks,

C.



> 
> Cc: Cédric Le Goater <clg@kaod.org>
> Cc: Frédéric Barrat <fbarrat@linux.ibm.com>
> Cc: Mahesh J Salgaonkar <mahesh@linux.ibm.com>
> Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
> Cc: Nicholas Piggin <npiggin@gmail.com>
> Signed-off-by: Aditya Gupta <adityag@linux.ibm.com>
> ---
>   hw/ppc/pnv_occ.c         | 14 ++++++++++++++
>   include/hw/ppc/pnv_occ.h |  2 ++
>   2 files changed, 16 insertions(+)
> 
> diff --git a/hw/ppc/pnv_occ.c b/hw/ppc/pnv_occ.c
> index 48123ceae176..4f510419045e 100644
> --- a/hw/ppc/pnv_occ.c
> +++ b/hw/ppc/pnv_occ.c
> @@ -262,6 +262,19 @@ static const TypeInfo pnv_occ_power10_type_info = {
>       .class_init    = pnv_occ_power10_class_init,
>   };
>   
> +static void pnv_occ_power11_class_init(ObjectClass *klass, void *data)
> +{
> +    DeviceClass *dc = DEVICE_CLASS(klass);
> +
> +    dc->desc = "PowerNV OCC Controller (POWER11)";
> +}
> +
> +static const TypeInfo pnv_occ_power11_type_info = {
> +    .name          = TYPE_PNV11_OCC,
> +    .parent        = TYPE_PNV10_OCC,
> +    .class_init    = pnv_occ_power11_class_init,
> +};
> +
>   static void pnv_occ_realize(DeviceState *dev, Error **errp)
>   {
>       PnvOCC *occ = PNV_OCC(dev);
> @@ -305,6 +318,7 @@ static void pnv_occ_register_types(void)
>       type_register_static(&pnv_occ_power8_type_info);
>       type_register_static(&pnv_occ_power9_type_info);
>       type_register_static(&pnv_occ_power10_type_info);
> +    type_register_static(&pnv_occ_power11_type_info);
>   }
>   
>   type_init(pnv_occ_register_types);
> diff --git a/include/hw/ppc/pnv_occ.h b/include/hw/ppc/pnv_occ.h
> index df321244e3b1..7b5e28f13b4f 100644
> --- a/include/hw/ppc/pnv_occ.h
> +++ b/include/hw/ppc/pnv_occ.h
> @@ -34,6 +34,8 @@ DECLARE_INSTANCE_CHECKER(PnvOCC, PNV9_OCC,
>                            TYPE_PNV9_OCC)
>   #define TYPE_PNV10_OCC TYPE_PNV_OCC "-POWER10"
>   DECLARE_INSTANCE_CHECKER(PnvOCC, PNV10_OCC, TYPE_PNV10_OCC)
> +#define TYPE_PNV11_OCC TYPE_PNV_OCC "-POWER11"
> +DECLARE_INSTANCE_CHECKER(PnvOCC, PNV11_OCC, TYPE_PNV11_OCC)
>   
>   #define PNV_OCC_SENSOR_DATA_BLOCK_OFFSET 0x00580000
>   #define PNV_OCC_SENSOR_DATA_BLOCK_SIZE   0x00025800
Aditya Gupta April 26, 2024, 5:38 p.m. UTC | #2
On Fri, Apr 26, 2024 at 04:33:13PM +0200, Cédric Le Goater wrote:
> On 4/26/24 13:00, Aditya Gupta wrote:
> > Power11 core is same as Power10, reuse PNV10_OCC initialisation,
> > by declaring `PNV11_OCC` as child class of `PNV10_OCC`
> 
> Reviewed-by: Cédric Le Goater <clg@kaod.org>

Thanks Cédric !

- Aditya Gupta

> 
> Thanks,
> 
> C.
> 
> 
> 
> > 
> > Cc: Cédric Le Goater <clg@kaod.org>
> > Cc: Frédéric Barrat <fbarrat@linux.ibm.com>
> > Cc: Mahesh J Salgaonkar <mahesh@linux.ibm.com>
> > Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
> > Cc: Nicholas Piggin <npiggin@gmail.com>
> > Signed-off-by: Aditya Gupta <adityag@linux.ibm.com>
> > ---
> >   hw/ppc/pnv_occ.c         | 14 ++++++++++++++
> >   include/hw/ppc/pnv_occ.h |  2 ++
> >   2 files changed, 16 insertions(+)
> > 
> > diff --git a/hw/ppc/pnv_occ.c b/hw/ppc/pnv_occ.c
> > index 48123ceae176..4f510419045e 100644
> > --- a/hw/ppc/pnv_occ.c
> > +++ b/hw/ppc/pnv_occ.c
> > @@ -262,6 +262,19 @@ static const TypeInfo pnv_occ_power10_type_info = {
> >       .class_init    = pnv_occ_power10_class_init,
> >   };
> > +static void pnv_occ_power11_class_init(ObjectClass *klass, void *data)
> > +{
> > +    DeviceClass *dc = DEVICE_CLASS(klass);
> > +
> > +    dc->desc = "PowerNV OCC Controller (POWER11)";
> > +}
> > +
> > +static const TypeInfo pnv_occ_power11_type_info = {
> > +    .name          = TYPE_PNV11_OCC,
> > +    .parent        = TYPE_PNV10_OCC,
> > +    .class_init    = pnv_occ_power11_class_init,
> > +};
> > +
> >   static void pnv_occ_realize(DeviceState *dev, Error **errp)
> >   {
> >       PnvOCC *occ = PNV_OCC(dev);
> > @@ -305,6 +318,7 @@ static void pnv_occ_register_types(void)
> >       type_register_static(&pnv_occ_power8_type_info);
> >       type_register_static(&pnv_occ_power9_type_info);
> >       type_register_static(&pnv_occ_power10_type_info);
> > +    type_register_static(&pnv_occ_power11_type_info);
> >   }
> >   type_init(pnv_occ_register_types);
> > diff --git a/include/hw/ppc/pnv_occ.h b/include/hw/ppc/pnv_occ.h
> > index df321244e3b1..7b5e28f13b4f 100644
> > --- a/include/hw/ppc/pnv_occ.h
> > +++ b/include/hw/ppc/pnv_occ.h
> > @@ -34,6 +34,8 @@ DECLARE_INSTANCE_CHECKER(PnvOCC, PNV9_OCC,
> >                            TYPE_PNV9_OCC)
> >   #define TYPE_PNV10_OCC TYPE_PNV_OCC "-POWER10"
> >   DECLARE_INSTANCE_CHECKER(PnvOCC, PNV10_OCC, TYPE_PNV10_OCC)
> > +#define TYPE_PNV11_OCC TYPE_PNV_OCC "-POWER11"
> > +DECLARE_INSTANCE_CHECKER(PnvOCC, PNV11_OCC, TYPE_PNV11_OCC)
> >   #define PNV_OCC_SENSOR_DATA_BLOCK_OFFSET 0x00580000
> >   #define PNV_OCC_SENSOR_DATA_BLOCK_SIZE   0x00025800
>
diff mbox series

Patch

diff --git a/hw/ppc/pnv_occ.c b/hw/ppc/pnv_occ.c
index 48123ceae176..4f510419045e 100644
--- a/hw/ppc/pnv_occ.c
+++ b/hw/ppc/pnv_occ.c
@@ -262,6 +262,19 @@  static const TypeInfo pnv_occ_power10_type_info = {
     .class_init    = pnv_occ_power10_class_init,
 };
 
+static void pnv_occ_power11_class_init(ObjectClass *klass, void *data)
+{
+    DeviceClass *dc = DEVICE_CLASS(klass);
+
+    dc->desc = "PowerNV OCC Controller (POWER11)";
+}
+
+static const TypeInfo pnv_occ_power11_type_info = {
+    .name          = TYPE_PNV11_OCC,
+    .parent        = TYPE_PNV10_OCC,
+    .class_init    = pnv_occ_power11_class_init,
+};
+
 static void pnv_occ_realize(DeviceState *dev, Error **errp)
 {
     PnvOCC *occ = PNV_OCC(dev);
@@ -305,6 +318,7 @@  static void pnv_occ_register_types(void)
     type_register_static(&pnv_occ_power8_type_info);
     type_register_static(&pnv_occ_power9_type_info);
     type_register_static(&pnv_occ_power10_type_info);
+    type_register_static(&pnv_occ_power11_type_info);
 }
 
 type_init(pnv_occ_register_types);
diff --git a/include/hw/ppc/pnv_occ.h b/include/hw/ppc/pnv_occ.h
index df321244e3b1..7b5e28f13b4f 100644
--- a/include/hw/ppc/pnv_occ.h
+++ b/include/hw/ppc/pnv_occ.h
@@ -34,6 +34,8 @@  DECLARE_INSTANCE_CHECKER(PnvOCC, PNV9_OCC,
                          TYPE_PNV9_OCC)
 #define TYPE_PNV10_OCC TYPE_PNV_OCC "-POWER10"
 DECLARE_INSTANCE_CHECKER(PnvOCC, PNV10_OCC, TYPE_PNV10_OCC)
+#define TYPE_PNV11_OCC TYPE_PNV_OCC "-POWER11"
+DECLARE_INSTANCE_CHECKER(PnvOCC, PNV11_OCC, TYPE_PNV11_OCC)
 
 #define PNV_OCC_SENSOR_DATA_BLOCK_OFFSET 0x00580000
 #define PNV_OCC_SENSOR_DATA_BLOCK_SIZE   0x00025800