On Mon, Apr 01, 2019 at 10:56:30AM +0800, Like Xu wrote: > On 2019/3/29 17:27, Alex Bennée wrote: [...] > > > @@ -1713,6 +1717,9 @@ static void cortex_a9_initfn(Object *obj) > > > #ifndef CONFIG_USER_ONLY > > > static uint64_t a15_l2ctlr_read(CPUARMState *env, const ARMCPRegInfo > > > *ri) > > > { > > > + MachineState *ms = MACHINE(qdev_get_machine()); > > > > How expensive is qdev_get_machine? This could potentially be a > > performance issue if this register is read a lot. > > It may not bother us cause the MachineState object would be feteched from > qemu QOM at its first requested time and save it as static variable for > incoming requests.
We already have a current_machine variable declared in include/hw/boards.h. We normally avoid using it and use MACHINE(qdev_get_machine()) instead, but I never understood why. -- Eduardo