Skip to contentSkip to conversation

ppc/pnv: minor XSCOM fixes

PATCH Applied Cédric Le Goater 3 participants 12 messages Dec 10, 2019 – Dec 11, 2019

lore
Share & tools
lore
#0 lore raw

cover ppc/pnv: minor XSCOM fixes

Hello,

Here are a couple of fixes/cleanups for the PowerNV XSCOM bus.

Thanks,

C.

Cédric Le Goater (2):
ppc/pnv: Loop on the whole hierarchy to populate the DT with the XSCOM
nodes
ppc/pnv: populate the DT with realized XSCOM devices

 hw/ppc/pnv_xscom.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
Signature · 1 line
2.21.0
#1 lore raw

PATCH 1/2 ppc/pnv: Loop on the whole hierarchy to populate the DT with the XSCOM nodes

Some PnvXScomInterface objects lie a bit deeper (PnvPBCQState) than the first layer, so we need to loop on the whole object hierarchy to catch them.

---
 hw/ppc/pnv_xscom.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
hw/ppc/pnv_xscom.c +6 -1
index bed41840845e..006d87e970d9 100644
@@ -326,7 +326,12 @@ int pnv_dt_xscom(PnvChip *chip, void *fdt, int root_offset)
     args.fdt = fdt;
     args.xscom_offset = xscom_offset;
 
-    object_child_foreach(OBJECT(chip), xscom_dt_child, &args);
+    /*
+     * Loop on the whole object hierarchy to catch all
+     * PnvXScomInterface objects which can lie a bit deeper the first
+     * layer.
+     */
+    object_child_foreach_recursive(OBJECT(chip), xscom_dt_child, &args);
     return 0;
 }
 
Signature · 1 line
2.21.0
#2 lore raw

Re: [PATCH 1/2] ppc/pnv: Loop on the whole hierarchy to populate the DT with the XSCOM nodes

Quoted 1 line · On Tue, 10 Dec 2019 14:58:44 +0100 Cédric Le Goater <[email protected]> wrote:

Some PnvXScomInterface objects lie a bit deeper (PnvPBCQState) than

I didn't find any trace of PnvPBCQState in the code... what is it ?

Quoted 13 lines

the first layer, so we need to loop on the whole object hierarchy to catch them.

---
 hw/ppc/pnv_xscom.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
hw/ppc/pnv_xscom.c +0 -0
index bed41840845e..006d87e970d9 100644

hw/ppc/pnv_xscom.c int pnv_dt_xscom(PnvChip *chip, void *fdt, int root_offset) · line 331

Quoted 7 lines
hw/ppc/pnv_xscom.c +3 -1
@@ -326,7 +326,12 @@ int pnv_dt_xscom(PnvChip *chip, void *fdt, int root_offset)
     args.fdt = fdt;
     args.xscom_offset = xscom_offset;
 
-    object_child_foreach(OBJECT(chip), xscom_dt_child, &args);
+    /*
+     * Loop on the whole object hierarchy to catch all
+     * PnvXScomInterface objects which can lie a bit deeper the first

s/deeper the first/deeper than the first/

Quoted 6 lines
hw/ppc/pnv_xscom.c +3 -0
+     * layer.
+     */
+    object_child_foreach_recursive(OBJECT(chip), xscom_dt_child, &args);
     return 0;
 }
 
#3 lore raw

Re: [PATCH 1/2] ppc/pnv: Loop on the whole hierarchy to populate the DT with the XSCOM nodes

Quoted 6 lines · Greg Kurz
Quoted 1 line · On Tue, 10 Dec 2019 14:58:44 +0100 Cédric Le Goater <[email protected]> wrote:

Some PnvXScomInterface objects lie a bit deeper (PnvPBCQState) than

I didn't find any trace of PnvPBCQState in the code... what is it ?

PHB4, which is not merged yet.

C.

Quoted 31 lines
Quoted 14 lines

the first layer, so we need to loop on the whole object hierarchy to catch them.

---
 hw/ppc/pnv_xscom.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
hw/ppc/pnv_xscom.c +0 -0
index bed41840845e..006d87e970d9 100644

hw/ppc/pnv_xscom.c int pnv_dt_xscom(PnvChip *chip, void *fdt, int root_offset) · line 331

Quoted 7 lines
hw/ppc/pnv_xscom.c +3 -1
@@ -326,7 +326,12 @@ int pnv_dt_xscom(PnvChip *chip, void *fdt, int root_offset)
     args.fdt = fdt;
     args.xscom_offset = xscom_offset;
 
-    object_child_foreach(OBJECT(chip), xscom_dt_child, &args);
+    /*
+     * Loop on the whole object hierarchy to catch all
+     * PnvXScomInterface objects which can lie a bit deeper the first

s/deeper the first/deeper than the first/

Quoted 6 lines
hw/ppc/pnv_xscom.c +3 -0
+     * layer.
+     */
+    object_child_foreach_recursive(OBJECT(chip), xscom_dt_child, &args);
     return 0;
 }
 
#4 lore raw

Re: [PATCH 1/2] ppc/pnv: Loop on the whole hierarchy to populate the DT with the XSCOM nodes

Quoted 9 lines · Cédric Le Goater
Quoted 6 lines · Greg Kurz
Quoted 1 line · On Tue, 10 Dec 2019 14:58:44 +0100 Cédric Le Goater <[email protected]> wrote:

Some PnvXScomInterface objects lie a bit deeper (PnvPBCQState) than

I didn't find any trace of PnvPBCQState in the code... what is it ?

PHB4, which is not merged yet.

In fact, PnvPBCQState is for PHB3. But we have a similar need for PHB4.

C.

#5 lore raw

Re: [PATCH 1/2] ppc/pnv: Loop on the whole hierarchy to populate the DT with the XSCOM nodes

In reply to Greg Kurz
Quoted 23 lines · Greg Kurz
Quoted 1 line · On Tue, 10 Dec 2019 14:58:44 +0100 Cédric Le Goater <[email protected]> wrote:

Some PnvXScomInterface objects lie a bit deeper (PnvPBCQState) than

I didn't find any trace of PnvPBCQState in the code... what is it ?

Quoted 16 lines

the first layer, so we need to loop on the whole object hierarchy to catch them.

---
 hw/ppc/pnv_xscom.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
hw/ppc/pnv_xscom.c +0 -0
index bed41840845e..006d87e970d9 100644
@@ -326,7 +326,12 @@ int pnv_dt_xscom(PnvChip *chip, void *fdt, int root_offset)
     args.fdt = fdt;
     args.xscom_offset = xscom_offset;
 
Quoted 6 lines

hw/ppc/pnv_xscom.c int pnv_dt_xscom(PnvChip *chip, void *fdt, int root_offset) · line 331

Quoted 4 lines
hw/ppc/pnv_xscom.c +3 -1
-    object_child_foreach(OBJECT(chip), xscom_dt_child, &args);
+    /*
+     * Loop on the whole object hierarchy to catch all
+     * PnvXScomInterface objects which can lie a bit deeper the first

s/deeper the first/deeper than the first/

Fixed during commit.

Quoted 8 lines
Quoted 7 lines
hw/ppc/pnv_xscom.c +3 -0
+     * layer.
+     */
+    object_child_foreach_recursive(OBJECT(chip), xscom_dt_child, &args);
     return 0;
 }
 
Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
Reviewed-by on v1 1/2
#6 lore raw

Re: [PATCH 1/2] ppc/pnv: Loop on the whole hierarchy to populate the DT with the XSCOM nodes

In reply to Cédric Le Goater
Quoted 6 lines · On Tue, 10 Dec 2019 14:58:44 +0100 Cédric Le Goater <[email protected]> wrote:

Some PnvXScomInterface objects lie a bit deeper (PnvPBCQState) than the first layer, so we need to loop on the whole object hierarchy to catch them.

---

Quoted 21 lines
 hw/ppc/pnv_xscom.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
hw/ppc/pnv_xscom.c +6 -1
index bed41840845e..006d87e970d9 100644
@@ -326,7 +326,12 @@ int pnv_dt_xscom(PnvChip *chip, void *fdt, int root_offset)
     args.fdt = fdt;
     args.xscom_offset = xscom_offset;
 
-    object_child_foreach(OBJECT(chip), xscom_dt_child, &args);
+    /*
+     * Loop on the whole object hierarchy to catch all
+     * PnvXScomInterface objects which can lie a bit deeper the first
+     * layer.
+     */
+    object_child_foreach_recursive(OBJECT(chip), xscom_dt_child, &args);
     return 0;
 }
 
#7 lore raw

PATCH 2/2 ppc/pnv: populate the DT with realized XSCOM devices

In reply to Cédric Le Goater

Some devices could be initialized in the instance_init handler but not realized for configuration reasons. Nodes should not be added in the DT for such devices.

---
 hw/ppc/pnv_xscom.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
hw/ppc/pnv_xscom.c +4 -1
index 006d87e970d9..6d3745a49e50 100644
@@ -272,7 +272,10 @@ static int xscom_dt_child(Object *child, void *opaque)
         PnvXScomInterface *xd = PNV_XSCOM_INTERFACE(child);
         PnvXScomInterfaceClass *xc = PNV_XSCOM_INTERFACE_GET_CLASS(xd);
 
-        if (xc->dt_xscom) {
+        /*
+         * Only "realized" devices should be configured in the DT
+         */
+        if (xc->dt_xscom && DEVICE(child)->realized) {
             _FDT((xc->dt_xscom(xd, args->fdt, args->xscom_offset)));
         }
     }
Signature · 1 line
2.21.0
#8 lore raw

Re: [PATCH 2/2] ppc/pnv: populate the DT with realized XSCOM devices

Quoted 4 lines · On Tue, 10 Dec 2019 14:58:45 +0100 Cédric Le Goater <[email protected]> wrote:

Some devices could be initialized in the instance_init handler but not realized for configuration reasons. Nodes should not be added in the DT for such devices.

Do you have examples of such devices to share ?

Quoted 21 lines
---
 hw/ppc/pnv_xscom.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
hw/ppc/pnv_xscom.c +4 -1
index 006d87e970d9..6d3745a49e50 100644
@@ -272,7 +272,10 @@ static int xscom_dt_child(Object *child, void *opaque)
         PnvXScomInterface *xd = PNV_XSCOM_INTERFACE(child);
         PnvXScomInterfaceClass *xc = PNV_XSCOM_INTERFACE_GET_CLASS(xd);
 
-        if (xc->dt_xscom) {
+        /*
+         * Only "realized" devices should be configured in the DT
+         */
+        if (xc->dt_xscom && DEVICE(child)->realized) {
             _FDT((xc->dt_xscom(xd, args->fdt, args->xscom_offset)));
         }
     }
#9 lore raw

Re: [PATCH 2/2] ppc/pnv: populate the DT with realized XSCOM devices

Quoted 9 lines · Greg Kurz
Quoted 4 lines · On Tue, 10 Dec 2019 14:58:45 +0100 Cédric Le Goater <[email protected]> wrote:

Some devices could be initialized in the instance_init handler but not realized for configuration reasons. Nodes should not be added in the DT for such devices.

Do you have examples of such devices to share ?

PHB4 again.

C.

Quoted 23 lines
Quoted 22 lines
---
 hw/ppc/pnv_xscom.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
hw/ppc/pnv_xscom.c +4 -1
index 006d87e970d9..6d3745a49e50 100644
@@ -272,7 +272,10 @@ static int xscom_dt_child(Object *child, void *opaque)
         PnvXScomInterface *xd = PNV_XSCOM_INTERFACE(child);
         PnvXScomInterfaceClass *xc = PNV_XSCOM_INTERFACE_GET_CLASS(xd);
 
-        if (xc->dt_xscom) {
+        /*
+         * Only "realized" devices should be configured in the DT
+         */
+        if (xc->dt_xscom && DEVICE(child)->realized) {
             _FDT((xc->dt_xscom(xd, args->fdt, args->xscom_offset)));
         }
     }
Reviewed-by on v1 2/2
#10 lore raw

Re: [PATCH 2/2] ppc/pnv: populate the DT with realized XSCOM devices

In reply to Cédric Le Goater
Quoted 6 lines · On Tue, 10 Dec 2019 14:58:45 +0100 Cédric Le Goater <[email protected]> wrote:

Some devices could be initialized in the instance_init handler but not realized for configuration reasons. Nodes should not be added in the DT for such devices.

---

Quoted 19 lines
 hw/ppc/pnv_xscom.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
hw/ppc/pnv_xscom.c +4 -1
index 006d87e970d9..6d3745a49e50 100644
@@ -272,7 +272,10 @@ static int xscom_dt_child(Object *child, void *opaque)
         PnvXScomInterface *xd = PNV_XSCOM_INTERFACE(child);
         PnvXScomInterfaceClass *xc = PNV_XSCOM_INTERFACE_GET_CLASS(xd);
 
-        if (xc->dt_xscom) {
+        /*
+         * Only "realized" devices should be configured in the DT
+         */
+        if (xc->dt_xscom && DEVICE(child)->realized) {
             _FDT((xc->dt_xscom(xd, args->fdt, args->xscom_offset)));
         }
     }
Applied
#11 lore raw
In reply to Cédric Le Goater
Quoted 3 lines · Cédric Le Goater

Hello,

Here are a couple of fixes/cleanups for the PowerNV XSCOM bus.

Applied to ppc-for-5.0, thanks.

Quoted 13 lines

Thanks,

C.

Cédric Le Goater (2):
ppc/pnv: Loop on the whole hierarchy to populate the DT with the XSCOM
nodes
ppc/pnv: populate the DT with realized XSCOM devices

 hw/ppc/pnv_xscom.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson