This helps avoid qdev_get_machine() calls. Signed-off-by: Nicholas Piggin <npig...@gmail.com> --- include/hw/ppc/pnv_chip.h | 2 ++ hw/ppc/pnv.c | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/include/hw/ppc/pnv_chip.h b/include/hw/ppc/pnv_chip.h index 4eaa7d3999..decfbc0ff7 100644 --- a/include/hw/ppc/pnv_chip.h +++ b/include/hw/ppc/pnv_chip.h @@ -23,6 +23,8 @@ struct PnvChip { SysBusDevice parent_obj; /*< public >*/ + PnvMachineState *pnv_machine; + uint32_t chip_id; uint64_t ram_start; uint64_t ram_size; diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c index 7878fed43c..3bcf11984c 100644 --- a/hw/ppc/pnv.c +++ b/hw/ppc/pnv.c @@ -2202,6 +2202,7 @@ static void pnv_chip_core_realize(PnvChip *chip, Error **errp) return; } + chip->pnv_machine = pnv; chip->cores = g_new0(PnvCore *, chip->nr_cores); for (i = 0, core_hwid = 0; (core_hwid < sizeof(chip->cores_mask) * 8) @@ -2614,7 +2615,7 @@ static void pnv_cpu_do_nmi(PnvChip *chip, PowerPCCPU *cpu, void *opaque) static void pnv_nmi(NMIState *n, int cpu_index, Error **errp) { - PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine()); + PnvMachineState *pnv = PNV_MACHINE(n); int i; for (i = 0; i < pnv->num_chips; i++) { -- 2.45.1