qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

hw/clock: What clock rate for virt machines?


From: Philippe Mathieu-Daudé
Subject: hw/clock: What clock rate for virt machines?
Date: Wed, 2 Sep 2020 18:35:41 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0

Hi,

Peter said "'clock' is basically meaningless for virt machines",

I understand and agree. But how to make that explicit/obvious in
the code, when a device expects a clock frequency/period?

Should we use 0/UINT_MAX for this case? Use an explicit definition?

  #define CLOCK_MEANINGLESS_FREQUENCY_HZ UINT_MAX

Or maybe simpler:

  #define CLOCK_MEANINGLESS_VALUE 0

But the special 0 value could be used to describe a stopped clock.

See for example hw/riscv/virt.c, it uses the following (confusing
to me) in virt_machine_init():

   serial_mm_init(system_memory, memmap[VIRT_UART0].base,
       0, qdev_get_gpio_in(DEVICE(mmio_plic), UART0_IRQ), 399193,
       serial_hd(0), DEVICE_LITTLE_ENDIAN);

Thanks,

Phil.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]