On 07/02/2018 12:03 PM, Cédric Le Goater wrote: >> --- a/hw/ppc/spapr_vio.c >> +++ b/hw/ppc/spapr_vio.c >> @@ -436,6 +436,9 @@ static void spapr_vio_busdev_reset(DeviceState *qdev) >> } >> } >> >> +/* TODO : poor VIO device indexing ... */ >> +static uint32_t vio_index; > > I think we could also use (dev->reg & 0xff) as an index for > the VIO devices. > > The unit address of the virtual IOA is simply allocated using > an increment of bus->next_reg, next_reg being initialized at > 0x71000000. > > I did not see any restrictions in the PAPR specs or in QEMU > that would break the above.
That was until I discovered this macro : #define DEFINE_SPAPR_PROPERTIES(type, field) \ DEFINE_PROP_UINT32("reg", type, field.reg, -1) so 'reg' could have any value. We can not use it ... C.