On Mon, 20 Jul 2020 at 11:59, Pratik Parvati <[email protected]> wrote: > Is it mandatory to define the state of each device? Like, for example, I am > referring hw/arm/versatilepb.c; I see the VMState is defined for sic > (secondary interrupt controller) Whereas VMState is not defined for PL011 > UART device.
The PL011 does have VMState: it is in hw/char/pl011.c, struct "vmstate_pl011". Generally the vmstate struct for each device is in the source file where that device is implemented. The SIC device is implemented in the same versatilepb.c source file that the board model is implemented in because it happens to be a simple device used only by that one board, and so the SIC device's vmstate is also in that source file. (The other reason that the SIC device is in the versatile board's source file is because it's quite old code -- these days we'd probably put it in its own source file in hw/intc, but the coding style back when that file was written over a decade ago was different and devices often got put in the same source file as the board model.) thanks -- PMM
