@@ -36,13 +36,6 @@
#include <asm/cpufeature.h>
#include <asm/platform.h>
-/*
- * Unfortunately the hypervisor timer interrupt appears to be buggy in
- * some versions of the model. Disable this to use the physical timer
- * instead.
- */
-#define USE_HYP_TIMER 1
-
uint64_t __read_mostly boot_count;
/* For fine-grained timekeeping, we use the ARM "Generic Timer", a
@@ -68,37 +61,6 @@ unsigned int timer_get_irq(enum timer_ppi ppi)
return muldiv64(ns, 1000 * cpu_khz, SECONDS(1));
}
-/* TODO: On a real system the firmware would have set the frequency in
- the CNTFRQ register. Also we'd need to use devicetree to find
- the RTC. When we've seen some real systems, we can delete this.
-static uint32_t calibrate_timer(void)
-{
- uint32_t sec;
- uint64_t start, end;
- paddr_t rtc_base = 0x1C170000ull;
- volatile uint32_t *rtc;
-
- ASSERT(!local_irq_is_enabled());
- set_fixmap(FIXMAP_MISC, rtc_base >> PAGE_SHIFT, DEV_SHARED);
- rtc = (uint32_t *) FIXMAP_ADDR(FIXMAP_MISC);
-
- printk("Calibrating timer against RTC...");
- // Turn on the RTC
- rtc[3] = 1;
- // Wait for an edge
- sec = rtc[0] + 1;
- do {} while ( rtc[0] != sec );
- // Now time a few seconds
- start = READ_SYSREG64(CNTPCT_EL0);
- do {} while ( rtc[0] < sec + 32 );
- end = READ_SYSREG64(CNTPCT_EL0);
- printk("done.\n");
-
- clear_fixmap(FIXMAP_MISC);
- return (end - start) / 32;
-}
-*/
-
/* Set up the timer on the boot CPU */
int __init init_xen_time(void)
{
@@ -169,22 +131,13 @@ int reprogram_timer(s_time_t timeout)
if ( timeout == 0 )
{
-#if USE_HYP_TIMER
WRITE_SYSREG32(0, CNTHP_CTL_EL2);
-#else
- WRITE_SYSREG32(0, CNTP_CTL_EL0);
-#endif
return 1;
}
deadline = ns_to_ticks(timeout) + boot_count;
-#if USE_HYP_TIMER
WRITE_SYSREG64(deadline, CNTHP_CVAL_EL2);
WRITE_SYSREG32(CNTx_CTL_ENABLE, CNTHP_CTL_EL2);
-#else
- WRITE_SYSREG64(deadline, CNTP_CVAL_EL0);
- WRITE_SYSREG32(CNTx_CTL_ENABLE, CNTP_CTL_EL0);
-#endif
isb();
/* No need to check for timers in the past; the Generic Timer fires
@@ -226,13 +179,8 @@ void __cpuinit init_timer_interrupt(void)
{
/* Sensible defaults */
WRITE_SYSREG64(0, CNTVOFF_EL2); /* No VM-specific offset */
-#if USE_HYP_TIMER
/* Do not let the VMs program the physical timer, only read the physical counter */
WRITE_SYSREG32(CNTHCTL_PA, CNTHCTL_EL2);
-#else
- /* Cannot let VMs access physical counter if we are using it */
- WRITE_SYSREG32(0, CNTHCTL_EL2);
-#endif
WRITE_SYSREG32(0, CNTP_CTL_EL0); /* Physical timer disabled */
WRITE_SYSREG32(0, CNTHP_CTL_EL2); /* Hypervisor's timer disabled */
isb();
The file xen/arm/time.c contains some unused code: - calibrate_timer: firmware already set correctly CNTFRQ. If it's not the case the device tree will containt a property clock-frequency in the timer node - USE_HYP_TIMER: It's set unconditionally to 1. I didn't see any recent model having issue with the hyp timer. I think we can drop it safely. Signed-off-by: Julien Grall <julien.grall@linaro.org> --- xen/arch/arm/time.c | 52 --------------------------------------------------- 1 file changed, 52 deletions(-)