Message ID | 20240526122612.473476-2-npiggin@gmail.com |
---|---|
State | New |
Headers | show |
Series | ppc/pnv: Better big-core model, lpar-per-core, PC unit | expand |
On 5/26/24 14:26, Nicholas Piggin wrote: > This helps move core state from CPU to core structures. > > Signed-off-by: Nicholas Piggin <npiggin@gmail.com> > --- > include/hw/ppc/pnv_core.h | 1 + > hw/ppc/pnv_core.c | 3 +++ > 2 files changed, 4 insertions(+) > > diff --git a/include/hw/ppc/pnv_core.h b/include/hw/ppc/pnv_core.h > index c6d62fd145..30c1e5b1a3 100644 > --- a/include/hw/ppc/pnv_core.h > +++ b/include/hw/ppc/pnv_core.h > @@ -54,6 +54,7 @@ struct PnvCoreClass { > #define PNV_CORE_TYPE_NAME(cpu_model) cpu_model PNV_CORE_TYPE_SUFFIX > > typedef struct PnvCPUState { > + PnvCore *core; > Object *intc; > } PnvCPUState; > > diff --git a/hw/ppc/pnv_core.c b/hw/ppc/pnv_core.c > index f40ab721d6..7b0ea7812b 100644 > --- a/hw/ppc/pnv_core.c > +++ b/hw/ppc/pnv_core.c > @@ -225,6 +225,7 @@ static const MemoryRegionOps pnv_core_power10_xscom_ops = { > static void pnv_core_cpu_realize(PnvCore *pc, PowerPCCPU *cpu, Error **errp, > int thread_index) > { > + PnvCPUState *pnv_cpu = pnv_cpu_state(cpu); > CPUPPCState *env = &cpu->env; > int core_hwid; > ppc_spr_t *pir = &env->spr_cb[SPR_PIR]; > @@ -232,6 +233,8 @@ static void pnv_core_cpu_realize(PnvCore *pc, PowerPCCPU *cpu, Error **errp, > Error *local_err = NULL; > PnvChipClass *pcc = PNV_CHIP_GET_CLASS(pc->chip); > > + pnv_cpu->core = pc; I would do the assignment in pnv_core_realize() after cpu->machine_data is allocated. it's minor. Reviewed-by: Cédric Le Goater <clg@redhat.com> Thanks, C. > if (!qdev_realize(DEVICE(cpu), NULL, errp)) { > return; > }
On 5/26/24 17:56, Nicholas Piggin wrote: > This helps move core state from CPU to core structures. > > Signed-off-by: Nicholas Piggin <npiggin@gmail.com> > --- > include/hw/ppc/pnv_core.h | 1 + > hw/ppc/pnv_core.c | 3 +++ > 2 files changed, 4 insertions(+) > > diff --git a/include/hw/ppc/pnv_core.h b/include/hw/ppc/pnv_core.h > index c6d62fd145..30c1e5b1a3 100644 > --- a/include/hw/ppc/pnv_core.h > +++ b/include/hw/ppc/pnv_core.h > @@ -54,6 +54,7 @@ struct PnvCoreClass { > #define PNV_CORE_TYPE_NAME(cpu_model) cpu_model PNV_CORE_TYPE_SUFFIX > > typedef struct PnvCPUState { > + PnvCore *core; Naming it *pc might be more intuitive with the most of its usage, although I see few usage as "pnv_core" as well. Reviewed-by: Harsh Prateek Bora <harshpb@linux.ibm.com> > Object *intc; > } PnvCPUState; > > diff --git a/hw/ppc/pnv_core.c b/hw/ppc/pnv_core.c > index f40ab721d6..7b0ea7812b 100644 > --- a/hw/ppc/pnv_core.c > +++ b/hw/ppc/pnv_core.c > @@ -225,6 +225,7 @@ static const MemoryRegionOps pnv_core_power10_xscom_ops = { > static void pnv_core_cpu_realize(PnvCore *pc, PowerPCCPU *cpu, Error **errp, > int thread_index) > { > + PnvCPUState *pnv_cpu = pnv_cpu_state(cpu); > CPUPPCState *env = &cpu->env; > int core_hwid; > ppc_spr_t *pir = &env->spr_cb[SPR_PIR]; > @@ -232,6 +233,8 @@ static void pnv_core_cpu_realize(PnvCore *pc, PowerPCCPU *cpu, Error **errp, > Error *local_err = NULL; > PnvChipClass *pcc = PNV_CHIP_GET_CLASS(pc->chip); > > + pnv_cpu->core = pc; > + > if (!qdev_realize(DEVICE(cpu), NULL, errp)) { > return; > }
diff --git a/include/hw/ppc/pnv_core.h b/include/hw/ppc/pnv_core.h index c6d62fd145..30c1e5b1a3 100644 --- a/include/hw/ppc/pnv_core.h +++ b/include/hw/ppc/pnv_core.h @@ -54,6 +54,7 @@ struct PnvCoreClass { #define PNV_CORE_TYPE_NAME(cpu_model) cpu_model PNV_CORE_TYPE_SUFFIX typedef struct PnvCPUState { + PnvCore *core; Object *intc; } PnvCPUState; diff --git a/hw/ppc/pnv_core.c b/hw/ppc/pnv_core.c index f40ab721d6..7b0ea7812b 100644 --- a/hw/ppc/pnv_core.c +++ b/hw/ppc/pnv_core.c @@ -225,6 +225,7 @@ static const MemoryRegionOps pnv_core_power10_xscom_ops = { static void pnv_core_cpu_realize(PnvCore *pc, PowerPCCPU *cpu, Error **errp, int thread_index) { + PnvCPUState *pnv_cpu = pnv_cpu_state(cpu); CPUPPCState *env = &cpu->env; int core_hwid; ppc_spr_t *pir = &env->spr_cb[SPR_PIR]; @@ -232,6 +233,8 @@ static void pnv_core_cpu_realize(PnvCore *pc, PowerPCCPU *cpu, Error **errp, Error *local_err = NULL; PnvChipClass *pcc = PNV_CHIP_GET_CLASS(pc->chip); + pnv_cpu->core = pc; + if (!qdev_realize(DEVICE(cpu), NULL, errp)) { return; }
This helps move core state from CPU to core structures. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> --- include/hw/ppc/pnv_core.h | 1 + hw/ppc/pnv_core.c | 3 +++ 2 files changed, 4 insertions(+)