On 8/12/20 11:32 AM, Claudio Fontana wrote:
> +static int64_t tcg_get_virtual_clock(void)
> +{
> + if (icount_enabled()) {
> + return icount_get();
> + }
> + return cpu_get_clock();
> +}
> +
> +static int64_t tcg_get_elapsed_ticks(void)
> +{
> + if (icount_enabled()) {
> + return icount_get();
> + }
> + return cpu_get_ticks();
> +}
> +
> +CpusAccel tcg_cpus = {
> + .create_vcpu_thread = tcg_start_vcpu_thread,
> + .kick_vcpu_thread = tcg_kick_vcpu_thread,
> + .get_virtual_clock = tcg_get_virtual_clock,
> + .get_elapsed_ticks = tcg_get_elapsed_ticks,
> +};
I think this variable should be const. Which of course means that the previous
patch needs to add const annotations.
I think you should actually have multiple dispatch variables: with icount and
without, with mttcg and without. That way these methods don't have to check
icount_enabled() or qemu_tcg_mttcg_enabled() at runtime, only at startup.
r~