qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

arm: Move system_clock_scale to armv7m_systick.h

The system_clock_scale global is used only by the armv7m systick
device; move the extern declaration to the armv7m_systick.h header,
and expand the comment to explain what it is and that it should
ideally be replaced with a different approach.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-id: 20190516163857.6430-2-peter.maydell@linaro.org

+22 -4
-4
include/hw/arm/arm.h
··· 167 167 const struct arm_boot_info *info, 168 168 hwaddr mvbar_addr); 169 169 170 - /* Multiplication factor to convert from system clock ticks to qemu timer 171 - ticks. */ 172 - extern int system_clock_scale; 173 - 174 170 #endif /* HW_ARM_H */
+22
include/hw/timer/armv7m_systick.h
··· 31 31 qemu_irq irq; 32 32 } SysTickState; 33 33 34 + /* 35 + * Multiplication factor to convert from system clock ticks to qemu timer 36 + * ticks. This should be set (by board code, usually) to a value 37 + * equal to NANOSECONDS_PER_SECOND / frq, where frq is the clock frequency 38 + * in Hz of the CPU. 39 + * 40 + * This value is used by the systick device when it is running in 41 + * its "use the CPU clock" mode (ie when SYST_CSR.CLKSOURCE == 1) to 42 + * set how fast the timer should tick. 43 + * 44 + * TODO: we should refactor this so that rather than using a global 45 + * we use a device property or something similar. This is complicated 46 + * because (a) the property would need to be plumbed through from the 47 + * board code down through various layers to the systick device 48 + * and (b) the property needs to be modifiable after realize, because 49 + * the stellaris board uses this to implement the behaviour where the 50 + * guest can reprogram the PLL registers to downclock the CPU, and the 51 + * systick device needs to react accordingly. Possibly this should 52 + * be deferred until we have a good API for modelling clock trees. 53 + */ 54 + extern int system_clock_scale; 55 + 34 56 #endif