[2/2] ppc/pnv: populate the DT with realized XSCOM devices
diff mbox series

Message ID 20191210135845.19773-3-clg@kaod.org
State New
Headers show
Series
  • ppc/pnv: minor XSCOM fixes
Related show

Commit Message

Cédric Le Goater Dec. 10, 2019, 1:58 p.m. UTC
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.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
 hw/ppc/pnv_xscom.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Greg Kurz Dec. 10, 2019, 4:53 p.m. UTC | #1
On Tue, 10 Dec 2019 14:58:45 +0100
Cédric Le Goater <clg@kaod.org> 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 ?

> Signed-off-by: Cédric Le Goater <clg@kaod.org>
> ---
>  hw/ppc/pnv_xscom.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/ppc/pnv_xscom.c b/hw/ppc/pnv_xscom.c
> index 006d87e970d9..6d3745a49e50 100644
> --- a/hw/ppc/pnv_xscom.c
> +++ b/hw/ppc/pnv_xscom.c
> @@ -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)));
>          }
>      }
Cédric Le Goater Dec. 10, 2019, 5:08 p.m. UTC | #2
On 10/12/2019 17:53, Greg Kurz wrote:
> On Tue, 10 Dec 2019 14:58:45 +0100
> Cédric Le Goater <clg@kaod.org> 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. 


> 
>> Signed-off-by: Cédric Le Goater <clg@kaod.org>
>> ---
>>  hw/ppc/pnv_xscom.c | 5 ++++-
>>  1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/hw/ppc/pnv_xscom.c b/hw/ppc/pnv_xscom.c
>> index 006d87e970d9..6d3745a49e50 100644
>> --- a/hw/ppc/pnv_xscom.c
>> +++ b/hw/ppc/pnv_xscom.c
>> @@ -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)));
>>          }
>>      }
>
Greg Kurz Dec. 10, 2019, 9:24 p.m. UTC | #3
On Tue, 10 Dec 2019 14:58:45 +0100
Cédric Le Goater <clg@kaod.org> 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.
> 
> Signed-off-by: Cédric Le Goater <clg@kaod.org>
> ---

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

>  hw/ppc/pnv_xscom.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/ppc/pnv_xscom.c b/hw/ppc/pnv_xscom.c
> index 006d87e970d9..6d3745a49e50 100644
> --- a/hw/ppc/pnv_xscom.c
> +++ b/hw/ppc/pnv_xscom.c
> @@ -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)));
>          }
>      }

Patch
diff mbox series

diff --git a/hw/ppc/pnv_xscom.c b/hw/ppc/pnv_xscom.c
index 006d87e970d9..6d3745a49e50 100644
--- a/hw/ppc/pnv_xscom.c
+++ b/hw/ppc/pnv_xscom.c
@@ -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)));
         }
     }