On Thu, May 06, 2021 at 01:39:41PM -0300, Lucas Mateus Castro (alqotel) wrote: > Changed spapr.c and pnv.c from calls of ppc_spr_t.oea_read to > ppc_spr_t.name as oea_read is not available in !TCG builds. This is correct, but I think we can do it a little more cleanly. This logic is identical to has_spr() in spapr_hcall.c. Can you move has_spr() to the target/ppc logic instead and rename it to, say, ppc_has_spr(). It's simple enough that it could just go inline in target/ppc/cpu.h. Then we can use that in these places as well as the places its used in spapr_hcall.c. > > Signed-off-by: Lucas Mateus Castro (alqotel) > --- > hw/ppc/pnv.c | 2 +- > hw/ppc/spapr.c | 4 ++-- > 2 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c > index 77af846cdf..06849b8802 100644 > --- a/hw/ppc/pnv.c > +++ b/hw/ppc/pnv.c > @@ -199,7 +199,7 @@ static void pnv_dt_core(PnvChip *chip, PnvCore *pc, void *fdt) > _FDT((fdt_setprop_string(fdt, offset, "status", "okay"))); > _FDT((fdt_setprop(fdt, offset, "64-bit", NULL, 0))); > > - if (env->spr_cb[SPR_PURR].oea_read) { > + if (env->spr_cb[SPR_PURR].name) { > _FDT((fdt_setprop(fdt, offset, "ibm,purr", NULL, 0))); > } > > diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c > index b37ceb8ee8..61653cbe2e 100644 > --- a/hw/ppc/spapr.c > +++ b/hw/ppc/spapr.c > @@ -705,10 +705,10 @@ static void spapr_dt_cpu(CPUState *cs, void *fdt, int offset, > _FDT((fdt_setprop_string(fdt, offset, "status", "okay"))); > _FDT((fdt_setprop(fdt, offset, "64-bit", NULL, 0))); > > - if (env->spr_cb[SPR_PURR].oea_read) { > + if (env->spr_cb[SPR_PURR].name) { > _FDT((fdt_setprop_cell(fdt, offset, "ibm,purr", 1))); > } > - if (env->spr_cb[SPR_SPURR].oea_read) { > + if (env->spr_cb[SPR_SPURR].name) { > _FDT((fdt_setprop_cell(fdt, offset, "ibm,spurr", 1))); > } > -- 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