>> May be we should introduce a helper such as : >> >> int pnv_chip_cpu_foreach(PnvChip *chip, >> int (*doit)(PnvChip *chip, PowerPCCPU *cpu, void *opaque), void >> *opaque) >> { >> int i, j; >> int ret = 0; >> >> for (i = 0; i < chip->nr_cores; i++) { >> PnvCore *pc = chip->cores[i]; >> CPUCore *cc = CPU_CORE(pc); >> >> for (j = 0; j < cc->nr_threads; j++) { >> PowerPCCPU *cpu = pc->threads[j]; >> ret = doit(chip, cpu, opaque); >> if (ret) { >> break; >> } >> } >> } >> return ret; >> } > > What I'd actually like to work towards is just having the interrupt > controllers themselves advertize TYPE_INTERRUPT_STATS_PROVIDER and not > needing anything specific at the machine level to locate them, just > let the generic code in hmp_info_pic handle it.
OK. It would good to at least loop on the chips, so that the output of the possible TYPE_INTERRUPT_STATS_PROVIDER (IC, PSIHB, PHB, NPU) are ordered. C.