From 2278fec1d1064ec1622098153b20a773fb688e78 Mon Sep 17 00:00:00 2001 From: Andreas Sandberg Date: Sat, 23 May 2015 13:46:53 +0100 Subject: dev, arm: Add virtual timers to the generic timer model The generic timer model currently does not support virtual counters. Virtual and physical counters both tick with the same frequency. However, virtual timers allow a hypervisor to set an offset that is subtracted from the counter when it is read. This enables the hypervisor to present a time base that ticks with virtual time in the VM (i.e., doesn't tick when the VM isn't running). Modern Linux kernels generally assume that virtual counters exist and try to use them by default. --- src/dev/arm/RealView.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/dev/arm/RealView.py') diff --git a/src/dev/arm/RealView.py b/src/dev/arm/RealView.py index 2e58c8fa6..2d5ccc3f9 100644 --- a/src/dev/arm/RealView.py +++ b/src/dev/arm/RealView.py @@ -136,9 +136,10 @@ class GenericTimer(SimObject): cxx_header = "dev/arm/generic_timer.hh" system = Param.System(Parent.any, "system") gic = Param.BaseGic(Parent.any, "GIC to use for interrupting") - int_phys = Param.UInt32("Interrupt number used per-cpu to GIC") - # @todo: for now only one timer per CPU is supported, which is the - # normal behaviour when Security and Virt. extensions are disabled. + # @todo: for now only two timers per CPU is supported, which is the + # normal behaviour when security extensions are disabled. + int_phys = Param.UInt32("Physical timer interrupt number") + int_virt = Param.UInt32("Virtual timer interrupt number") class PL031(AmbaIntDevice): type = 'PL031' @@ -457,7 +458,7 @@ class VExpress_EMM(RealView): idreg=0x02250000, pio_addr=0x1C010000) gic = Pl390(dist_addr=0x2C001000, cpu_addr=0x2C002000) local_cpu_timer = CpuLocalTimer(int_num_timer=29, int_num_watchdog=30, pio_addr=0x2C080000) - generic_timer = GenericTimer(int_phys=29) + generic_timer = GenericTimer(int_phys=29, int_virt=27) timer0 = Sp804(int_num0=34, int_num1=34, pio_addr=0x1C110000, clock0='1MHz', clock1='1MHz') timer1 = Sp804(int_num0=35, int_num1=35, pio_addr=0x1C120000, clock0='1MHz', clock1='1MHz') clcd = Pl111(pio_addr=0x1c1f0000, int_num=46) -- cgit v1.2.3