* [Qemu-devel] system_clock_scale unset in hw/intc/armv7m_nvic.c
@ 2017-01-13 12:35 James Hanley
2017-01-13 12:43 ` [Qemu-devel] [Qemu-discuss] " Peter Maydell
0 siblings, 1 reply; 2+ messages in thread
From: James Hanley @ 2017-01-13 12:35 UTC (permalink / raw)
To: qemu-discuss, qemu-arm, qemu-devel
How should system_clock_scale be set in hw/intc/armv7m_nvic.c - there is no
API for the global, and I've defaulted the global to SYSTICK_SCALE which
seems to work, but is not obvious. This was needed as this value was set
to zero and the arm firmware was selecting the external clock source
causing zero to be returned from systick_scale() and the interrupt to run
continuously.
diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c
index 06d8db6..c15841e 100644
--- a/hw/intc/armv7m_nvic.c
+++ b/hw/intc/armv7m_nvic.c
@@ -70,7 +70,7 @@ static const uint8_t nvic_id[] = {
#define SYSTICK_CLKSOURCE (1 << 2)
#define SYSTICK_COUNTFLAG (1 << 16)
-int system_clock_scale;
+int system_clock_scale = SYSTICK_SCALE;
/* Conversion factor from qemu timer to SysTick frequencies. */
static inline int64_t systick_scale(nvic_state *s)
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [Qemu-discuss] system_clock_scale unset in hw/intc/armv7m_nvic.c
2017-01-13 12:35 [Qemu-devel] system_clock_scale unset in hw/intc/armv7m_nvic.c James Hanley
@ 2017-01-13 12:43 ` Peter Maydell
0 siblings, 0 replies; 2+ messages in thread
From: Peter Maydell @ 2017-01-13 12:43 UTC (permalink / raw)
To: James Hanley; +Cc: qemu-discuss, qemu-arm, QEMU Developers
On 13 January 2017 at 12:35, James Hanley <jhanley@dgtlrift.com> wrote:
> How should system_clock_scale be set in hw/intc/armv7m_nvic.c - there is no
> API for the global, and I've defaulted the global to SYSTICK_SCALE which
> seems to work, but is not obvious. This was needed as this value was set to
> zero and the arm firmware was selecting the external clock source causing
> zero to be returned from systick_scale() and the interrupt to run
> continuously.
If I recall correctly, this is an external-to-the-CPU thing
(wired up by the SoC or the board), which suggests that it
ought to be a property on the CPU object (or perhaps on a
currently-nonexistent container object which has the CPU
and the NVIC and the other M profile devices).
As the code stands today, I think the answer is that the
board has to set the global -- this is what stellaris.c does.
thanks
-- PMM
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-01-13 12:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-13 12:35 [Qemu-devel] system_clock_scale unset in hw/intc/armv7m_nvic.c James Hanley
2017-01-13 12:43 ` [Qemu-devel] [Qemu-discuss] " Peter Maydell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).