[PATCH 3/3] ppc/pnv: Remove PHB4 version property

Cédric Le Goater posted 3 patches 4 years ago
[PATCH 3/3] ppc/pnv: Remove PHB4 version property
Posted by Cédric Le Goater 4 years ago
and grab the PHB version from the PEC class directly when needed.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
 hw/pci-host/pnv_phb4.c     | 9 +--------
 hw/pci-host/pnv_phb4_pec.c | 3 ---
 2 files changed, 1 insertion(+), 11 deletions(-)

diff --git a/hw/pci-host/pnv_phb4.c b/hw/pci-host/pnv_phb4.c
index c688976caec9..a78add75b043 100644
--- a/hw/pci-host/pnv_phb4.c
+++ b/hw/pci-host/pnv_phb4.c
@@ -672,7 +672,7 @@ static uint64_t pnv_phb4_reg_read(void *opaque, hwaddr off, unsigned size)
 
     switch (off) {
     case PHB_VERSION:
-        return phb->version;
+        return PNV_PHB4_PEC_GET_CLASS(phb->pec)->version;
 
         /* Read-only */
     case PHB_PHB4_GEN_CAP:
@@ -1575,7 +1575,6 @@ static void pnv_phb4_realize(DeviceState *dev, Error **errp)
     if (!phb->pec) {
         PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine());
         PnvChip *chip = pnv_get_chip(pnv, phb->chip_id);
-        PnvPhb4PecClass *pecc;
         BusState *s;
 
         if (!chip) {
@@ -1589,11 +1588,6 @@ static void pnv_phb4_realize(DeviceState *dev, Error **errp)
             return;
         }
 
-        /* All other phb properties are already set */
-        pecc = PNV_PHB4_PEC_GET_CLASS(phb->pec);
-        object_property_set_int(OBJECT(phb), "version", pecc->version,
-                                &error_fatal);
-
         /*
          * Reparent user created devices to the chip to build
          * correctly the device tree.
@@ -1688,7 +1682,6 @@ static void pnv_phb4_xive_notify(XiveNotifier *xf, uint32_t srcno)
 static Property pnv_phb4_properties[] = {
         DEFINE_PROP_UINT32("index", PnvPHB4, phb_id, 0),
         DEFINE_PROP_UINT32("chip-id", PnvPHB4, chip_id, 0),
-        DEFINE_PROP_UINT64("version", PnvPHB4, version, 0),
         DEFINE_PROP_LINK("pec", PnvPHB4, pec, TYPE_PNV_PHB4_PEC,
                          PnvPhb4PecState *),
         DEFINE_PROP_END_OF_LIST(),
diff --git a/hw/pci-host/pnv_phb4_pec.c b/hw/pci-host/pnv_phb4_pec.c
index a3c4b4ef850c..40d89fda56e5 100644
--- a/hw/pci-host/pnv_phb4_pec.c
+++ b/hw/pci-host/pnv_phb4_pec.c
@@ -117,7 +117,6 @@ static void pnv_pec_default_phb_realize(PnvPhb4PecState *pec,
                                         Error **errp)
 {
     PnvPHB4 *phb = PNV_PHB4(qdev_new(TYPE_PNV_PHB4));
-    PnvPhb4PecClass *pecc = PNV_PHB4_PEC_GET_CLASS(pec);
     int phb_id = pnv_phb4_pec_get_phb_id(pec, stack_no);
 
     object_property_set_link(OBJECT(phb), "pec", OBJECT(pec),
@@ -126,8 +125,6 @@ static void pnv_pec_default_phb_realize(PnvPhb4PecState *pec,
                             &error_fatal);
     object_property_set_int(OBJECT(phb), "index", phb_id,
                             &error_fatal);
-    object_property_set_int(OBJECT(phb), "version", pecc->version,
-                            &error_fatal);
 
     if (!sysbus_realize(SYS_BUS_DEVICE(phb), errp)) {
         return;
-- 
2.31.1


Re: [PATCH 3/3] ppc/pnv: Remove PHB4 version property
Posted by Daniel Henrique Barboza 4 years ago

On 1/17/22 09:27, Cédric Le Goater wrote:
> and grab the PHB version from the PEC class directly when needed.

I guess we want a capital "A" when starting the commit msg

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


This change also makes pnv-phb4s a little closer with pnv-phb3s, given that we don't
have a "Version" attribute exposed in the QOM for pnv-phb3s as well.


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

>   hw/pci-host/pnv_phb4.c     | 9 +--------
>   hw/pci-host/pnv_phb4_pec.c | 3 ---
>   2 files changed, 1 insertion(+), 11 deletions(-)
> 
> diff --git a/hw/pci-host/pnv_phb4.c b/hw/pci-host/pnv_phb4.c
> index c688976caec9..a78add75b043 100644
> --- a/hw/pci-host/pnv_phb4.c
> +++ b/hw/pci-host/pnv_phb4.c
> @@ -672,7 +672,7 @@ static uint64_t pnv_phb4_reg_read(void *opaque, hwaddr off, unsigned size)
>   
>       switch (off) {
>       case PHB_VERSION:
> -        return phb->version;
> +        return PNV_PHB4_PEC_GET_CLASS(phb->pec)->version;
>   
>           /* Read-only */
>       case PHB_PHB4_GEN_CAP:
> @@ -1575,7 +1575,6 @@ static void pnv_phb4_realize(DeviceState *dev, Error **errp)
>       if (!phb->pec) {
>           PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine());
>           PnvChip *chip = pnv_get_chip(pnv, phb->chip_id);
> -        PnvPhb4PecClass *pecc;
>           BusState *s;
>   
>           if (!chip) {
> @@ -1589,11 +1588,6 @@ static void pnv_phb4_realize(DeviceState *dev, Error **errp)
>               return;
>           }
>   
> -        /* All other phb properties are already set */
> -        pecc = PNV_PHB4_PEC_GET_CLASS(phb->pec);
> -        object_property_set_int(OBJECT(phb), "version", pecc->version,
> -                                &error_fatal);
> -
>           /*
>            * Reparent user created devices to the chip to build
>            * correctly the device tree.
> @@ -1688,7 +1682,6 @@ static void pnv_phb4_xive_notify(XiveNotifier *xf, uint32_t srcno)
>   static Property pnv_phb4_properties[] = {
>           DEFINE_PROP_UINT32("index", PnvPHB4, phb_id, 0),
>           DEFINE_PROP_UINT32("chip-id", PnvPHB4, chip_id, 0),
> -        DEFINE_PROP_UINT64("version", PnvPHB4, version, 0),
>           DEFINE_PROP_LINK("pec", PnvPHB4, pec, TYPE_PNV_PHB4_PEC,
>                            PnvPhb4PecState *),
>           DEFINE_PROP_END_OF_LIST(),
> diff --git a/hw/pci-host/pnv_phb4_pec.c b/hw/pci-host/pnv_phb4_pec.c
> index a3c4b4ef850c..40d89fda56e5 100644
> --- a/hw/pci-host/pnv_phb4_pec.c
> +++ b/hw/pci-host/pnv_phb4_pec.c
> @@ -117,7 +117,6 @@ static void pnv_pec_default_phb_realize(PnvPhb4PecState *pec,
>                                           Error **errp)
>   {
>       PnvPHB4 *phb = PNV_PHB4(qdev_new(TYPE_PNV_PHB4));
> -    PnvPhb4PecClass *pecc = PNV_PHB4_PEC_GET_CLASS(pec);
>       int phb_id = pnv_phb4_pec_get_phb_id(pec, stack_no);
>   
>       object_property_set_link(OBJECT(phb), "pec", OBJECT(pec),
> @@ -126,8 +125,6 @@ static void pnv_pec_default_phb_realize(PnvPhb4PecState *pec,
>                               &error_fatal);
>       object_property_set_int(OBJECT(phb), "index", phb_id,
>                               &error_fatal);
> -    object_property_set_int(OBJECT(phb), "version", pecc->version,
> -                            &error_fatal);
>   
>       if (!sysbus_realize(SYS_BUS_DEVICE(phb), errp)) {
>           return;

Re: [PATCH 3/3] ppc/pnv: Remove PHB4 version property
Posted by Cédric Le Goater 4 years ago
On 1/17/22 20:50, Daniel Henrique Barboza wrote:
> 
> 
> On 1/17/22 09:27, Cédric Le Goater wrote:
>> and grab the PHB version from the PEC class directly when needed.
> 
> I guess we want a capital "A" when starting the commit msg

I just removed the 'and'.

Thanks,

C.


> 
>>
>> Signed-off-by: Cédric Le Goater <clg@kaod.org>
>> ---
> 
> 
> This change also makes pnv-phb4s a little closer with pnv-phb3s, given that we don't
> have a "Version" attribute exposed in the QOM for pnv-phb3s as well.
> 
> 
> Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
> 
>>   hw/pci-host/pnv_phb4.c     | 9 +--------
>>   hw/pci-host/pnv_phb4_pec.c | 3 ---
>>   2 files changed, 1 insertion(+), 11 deletions(-)
>>
>> diff --git a/hw/pci-host/pnv_phb4.c b/hw/pci-host/pnv_phb4.c
>> index c688976caec9..a78add75b043 100644
>> --- a/hw/pci-host/pnv_phb4.c
>> +++ b/hw/pci-host/pnv_phb4.c
>> @@ -672,7 +672,7 @@ static uint64_t pnv_phb4_reg_read(void *opaque, hwaddr off, unsigned size)
>>       switch (off) {
>>       case PHB_VERSION:
>> -        return phb->version;
>> +        return PNV_PHB4_PEC_GET_CLASS(phb->pec)->version;
>>           /* Read-only */
>>       case PHB_PHB4_GEN_CAP:
>> @@ -1575,7 +1575,6 @@ static void pnv_phb4_realize(DeviceState *dev, Error **errp)
>>       if (!phb->pec) {
>>           PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine());
>>           PnvChip *chip = pnv_get_chip(pnv, phb->chip_id);
>> -        PnvPhb4PecClass *pecc;
>>           BusState *s;
>>           if (!chip) {
>> @@ -1589,11 +1588,6 @@ static void pnv_phb4_realize(DeviceState *dev, Error **errp)
>>               return;
>>           }
>> -        /* All other phb properties are already set */
>> -        pecc = PNV_PHB4_PEC_GET_CLASS(phb->pec);
>> -        object_property_set_int(OBJECT(phb), "version", pecc->version,
>> -                                &error_fatal);
>> -
>>           /*
>>            * Reparent user created devices to the chip to build
>>            * correctly the device tree.
>> @@ -1688,7 +1682,6 @@ static void pnv_phb4_xive_notify(XiveNotifier *xf, uint32_t srcno)
>>   static Property pnv_phb4_properties[] = {
>>           DEFINE_PROP_UINT32("index", PnvPHB4, phb_id, 0),
>>           DEFINE_PROP_UINT32("chip-id", PnvPHB4, chip_id, 0),
>> -        DEFINE_PROP_UINT64("version", PnvPHB4, version, 0),
>>           DEFINE_PROP_LINK("pec", PnvPHB4, pec, TYPE_PNV_PHB4_PEC,
>>                            PnvPhb4PecState *),
>>           DEFINE_PROP_END_OF_LIST(),
>> diff --git a/hw/pci-host/pnv_phb4_pec.c b/hw/pci-host/pnv_phb4_pec.c
>> index a3c4b4ef850c..40d89fda56e5 100644
>> --- a/hw/pci-host/pnv_phb4_pec.c
>> +++ b/hw/pci-host/pnv_phb4_pec.c
>> @@ -117,7 +117,6 @@ static void pnv_pec_default_phb_realize(PnvPhb4PecState *pec,
>>                                           Error **errp)
>>   {
>>       PnvPHB4 *phb = PNV_PHB4(qdev_new(TYPE_PNV_PHB4));
>> -    PnvPhb4PecClass *pecc = PNV_PHB4_PEC_GET_CLASS(pec);
>>       int phb_id = pnv_phb4_pec_get_phb_id(pec, stack_no);
>>       object_property_set_link(OBJECT(phb), "pec", OBJECT(pec),
>> @@ -126,8 +125,6 @@ static void pnv_pec_default_phb_realize(PnvPhb4PecState *pec,
>>                               &error_fatal);
>>       object_property_set_int(OBJECT(phb), "index", phb_id,
>>                               &error_fatal);
>> -    object_property_set_int(OBJECT(phb), "version", pecc->version,
>> -                            &error_fatal);
>>       if (!sysbus_realize(SYS_BUS_DEVICE(phb), errp)) {
>>           return;