[Qemu-devel] [PATCH 02/25] ppc/xics: assign of the CPU 'intc' pointer under the core

Cédric Le Goater posted 25 patches 8 years, 2 months ago
There is a newer version of this series
[Qemu-devel] [PATCH 02/25] ppc/xics: assign of the CPU 'intc' pointer under the core
Posted by Cédric Le Goater 8 years, 2 months ago
The 'intc' pointer of the CPU references the interrupt presenter in
the XICS interrupt mode. When the XIVE interrupt mode is available and
activated, the machine will need to reassign this pointer to reflect
the change.

Moving this assignment under the realize routine of the CPU will ease
the process when the interrupt mode is toggled.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
 hw/intc/xics.c          | 1 -
 hw/ppc/pnv_core.c       | 2 +-
 hw/ppc/spapr_cpu_core.c | 2 +-
 3 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/hw/intc/xics.c b/hw/intc/xics.c
index e4ccdff8f577..0f2e7273bc8f 100644
--- a/hw/intc/xics.c
+++ b/hw/intc/xics.c
@@ -334,7 +334,6 @@ static void icp_realize(DeviceState *dev, Error **errp)
     }
 
     cpu = POWERPC_CPU(obj);
-    cpu->intc = OBJECT(icp);
     icp->cs = CPU(obj);
 
     env = &cpu->env;
diff --git a/hw/ppc/pnv_core.c b/hw/ppc/pnv_core.c
index a066736846f8..90acaac45889 100644
--- a/hw/ppc/pnv_core.c
+++ b/hw/ppc/pnv_core.c
@@ -133,7 +133,7 @@ static void pnv_core_realize_child(Object *child, XICSFabric *xi, Error **errp)
         return;
     }
 
-    icp_create(cs, TYPE_PNV_ICP, xi, &local_err);
+    cpu->intc = icp_create(cs, TYPE_PNV_ICP, xi, &local_err);
     if (local_err) {
         error_propagate(errp, local_err);
         return;
diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c
index f8a520a2fa2d..f7cc74512481 100644
--- a/hw/ppc/spapr_cpu_core.c
+++ b/hw/ppc/spapr_cpu_core.c
@@ -122,7 +122,7 @@ static void spapr_cpu_core_realize_child(Object *child,
         goto error;
     }
 
-    icp_create(cs, spapr->icp_type, XICS_FABRIC(spapr), &local_err);
+    cpu->intc = icp_create(cs, spapr->icp_type, XICS_FABRIC(spapr), &local_err);
     if (local_err) {
         goto error;
     }
-- 
2.13.6


Re: [Qemu-devel] [PATCH 02/25] ppc/xics: assign of the CPU 'intc' pointer under the core
Posted by David Gibson 8 years, 2 months ago
On Thu, Nov 23, 2017 at 02:29:32PM +0100, Cédric Le Goater wrote:
> The 'intc' pointer of the CPU references the interrupt presenter in
> the XICS interrupt mode. When the XIVE interrupt mode is available and
> activated, the machine will need to reassign this pointer to reflect
> the change.
> 
> Moving this assignment under the realize routine of the CPU will ease
> the process when the interrupt mode is toggled.
> 
> Signed-off-by: Cédric Le Goater <clg@kaod.org>

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>

> ---
>  hw/intc/xics.c          | 1 -
>  hw/ppc/pnv_core.c       | 2 +-
>  hw/ppc/spapr_cpu_core.c | 2 +-
>  3 files changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/hw/intc/xics.c b/hw/intc/xics.c
> index e4ccdff8f577..0f2e7273bc8f 100644
> --- a/hw/intc/xics.c
> +++ b/hw/intc/xics.c
> @@ -334,7 +334,6 @@ static void icp_realize(DeviceState *dev, Error **errp)
>      }
>  
>      cpu = POWERPC_CPU(obj);
> -    cpu->intc = OBJECT(icp);
>      icp->cs = CPU(obj);
>  
>      env = &cpu->env;
> diff --git a/hw/ppc/pnv_core.c b/hw/ppc/pnv_core.c
> index a066736846f8..90acaac45889 100644
> --- a/hw/ppc/pnv_core.c
> +++ b/hw/ppc/pnv_core.c
> @@ -133,7 +133,7 @@ static void pnv_core_realize_child(Object *child, XICSFabric *xi, Error **errp)
>          return;
>      }
>  
> -    icp_create(cs, TYPE_PNV_ICP, xi, &local_err);
> +    cpu->intc = icp_create(cs, TYPE_PNV_ICP, xi, &local_err);
>      if (local_err) {
>          error_propagate(errp, local_err);
>          return;
> diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c
> index f8a520a2fa2d..f7cc74512481 100644
> --- a/hw/ppc/spapr_cpu_core.c
> +++ b/hw/ppc/spapr_cpu_core.c
> @@ -122,7 +122,7 @@ static void spapr_cpu_core_realize_child(Object *child,
>          goto error;
>      }
>  
> -    icp_create(cs, spapr->icp_type, XICS_FABRIC(spapr), &local_err);
> +    cpu->intc = icp_create(cs, spapr->icp_type, XICS_FABRIC(spapr), &local_err);
>      if (local_err) {
>          goto error;
>      }

-- 
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
Re: [Qemu-devel] [Qemu-ppc] [PATCH 02/25] ppc/xics: assign of the CPU 'intc' pointer under the core
Posted by Greg Kurz 8 years, 2 months ago
On Thu, 23 Nov 2017 14:29:32 +0100
Cédric Le Goater <clg@kaod.org> wrote:

> The 'intc' pointer of the CPU references the interrupt presenter in
> the XICS interrupt mode. When the XIVE interrupt mode is available and
> activated, the machine will need to reassign this pointer to reflect
> the change.
> 
> Moving this assignment under the realize routine of the CPU will ease
> the process when the interrupt mode is toggled.
> 

No surprise since this was violating CPU internals actually :)

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

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

>  hw/intc/xics.c          | 1 -
>  hw/ppc/pnv_core.c       | 2 +-
>  hw/ppc/spapr_cpu_core.c | 2 +-
>  3 files changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/hw/intc/xics.c b/hw/intc/xics.c
> index e4ccdff8f577..0f2e7273bc8f 100644
> --- a/hw/intc/xics.c
> +++ b/hw/intc/xics.c
> @@ -334,7 +334,6 @@ static void icp_realize(DeviceState *dev, Error **errp)
>      }
>  
>      cpu = POWERPC_CPU(obj);
> -    cpu->intc = OBJECT(icp);
>      icp->cs = CPU(obj);
>  
>      env = &cpu->env;
> diff --git a/hw/ppc/pnv_core.c b/hw/ppc/pnv_core.c
> index a066736846f8..90acaac45889 100644
> --- a/hw/ppc/pnv_core.c
> +++ b/hw/ppc/pnv_core.c
> @@ -133,7 +133,7 @@ static void pnv_core_realize_child(Object *child, XICSFabric *xi, Error **errp)
>          return;
>      }
>  
> -    icp_create(cs, TYPE_PNV_ICP, xi, &local_err);
> +    cpu->intc = icp_create(cs, TYPE_PNV_ICP, xi, &local_err);
>      if (local_err) {
>          error_propagate(errp, local_err);
>          return;
> diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c
> index f8a520a2fa2d..f7cc74512481 100644
> --- a/hw/ppc/spapr_cpu_core.c
> +++ b/hw/ppc/spapr_cpu_core.c
> @@ -122,7 +122,7 @@ static void spapr_cpu_core_realize_child(Object *child,
>          goto error;
>      }
>  
> -    icp_create(cs, spapr->icp_type, XICS_FABRIC(spapr), &local_err);
> +    cpu->intc = icp_create(cs, spapr->icp_type, XICS_FABRIC(spapr), &local_err);
>      if (local_err) {
>          goto error;
>      }