On Wed, 8 May 2024 at 22:27, Philippe Mathieu-Daudé <phi...@linaro.org> wrote: > > On 8/5/24 19:46, Peter Maydell wrote: > > On Wed, 8 May 2024 at 15:13, Philippe Mathieu-Daudé <phi...@linaro.org> > > wrote: > >> > >> Expose the clock frequency via the QOM 'freq-hz' property, > >> as it might be useful for QTests. > >> > >> HMP example: > >> > >> $ qemu-system-mips -S -monitor stdio -M mipssim > >> (qemu) qom-get /machine/cpu-refclk freq-hz > >> 12000000 > >> > >> Inspired-by: Inès Varhol <ines.var...@telecom-paris.fr> > >> Signed-off-by: Philippe Mathieu-Daudé <phi...@linaro.org> > > > > So I have a couple of thoughts here: > > > > (1) if this is intended for qtests, would exposing the period (i.e. > > QOM equivalent of clock_get() rather than clock_get_hz()) be better? > > A Hz figure has rounding so it's not as accurate. > > Indeed, simpler to compare from QTest perspective. > > > (2) We should document this in clocks.rst; I guess we want to say > > "only intended for use in qtests" (i.e. if you're part of QEMU > > use the existing function interface, not this). > > OK, and we can also only expose this for QTest using: > > if (qtest_enabled()) { > object_property_add(obj, "[qtest-]clock-period", ...); > }
Yes, that seems reasonable. (I don't know if we have any other qtest-only properties but I don't see any reason why we shouldn't have them if we want to expose stuff for tests only.) thanks -- PMM