Skip to content

Commit 198e24a

Browse files
kelleymhtyhicks
authored andcommitted
arm64: hyperv: Add Hyper-V clocksource/clockevent support
Add architecture specific definitions and functions needed by the architecture independent Hyper-V clocksource driver. Update the Hyper-V clocksource driver to be initialized on ARM64. Signed-off-by: Michael Kelley <mikelley@microsoft.com> Reviewed-by: Sunil Muthuswamy <sunilmut@microsoft.com>
1 parent e0015a0 commit 198e24a

2 files changed

Lines changed: 26 additions & 0 deletions

File tree

arch/arm64/include/asm/mshyperv.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include <linux/types.h>
2222
#include <linux/arm-smccc.h>
2323
#include <asm/hyperv-tlfs.h>
24+
#include <clocksource/arm_arch_timer.h>
2425

2526
/*
2627
* Declare calls to get and set Hyper-V VP register values on ARM64, which
@@ -41,6 +42,17 @@ static inline u64 hv_get_register(unsigned int reg)
4142
return hv_get_vpreg(reg);
4243
}
4344

45+
/* Define the interrupt ID used by STIMER0 Direct Mode interrupts. This
46+
* value can't come from ACPI tables because it is needed before the
47+
* Linux ACPI subsystem is initialized.
48+
*/
49+
#define HYPERV_STIMER0_VECTOR 31
50+
51+
static inline u64 hv_get_raw_timer(void)
52+
{
53+
return arch_timer_read_counter();
54+
}
55+
4456
/* SMCCC hypercall parameters */
4557
#define HV_SMCCC_FUNC_NUMBER 1
4658
#define HV_FUNC_ID ARM_SMCCC_CALL_VAL( \

drivers/clocksource/hyperv_timer.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -566,3 +566,17 @@ void __init hv_init_clocksource(void)
566566
hv_setup_sched_clock(read_hv_sched_clock_msr);
567567
}
568568
EXPORT_SYMBOL_GPL(hv_init_clocksource);
569+
570+
/* Initialize everything on ARM64 */
571+
static int __init hyperv_timer_init(struct acpi_table_header *table)
572+
{
573+
if (!hv_is_hyperv_initialized())
574+
return -EINVAL;
575+
576+
hv_init_clocksource();
577+
if (hv_stimer_alloc(true))
578+
return -EINVAL;
579+
580+
return 0;
581+
}
582+
TIMER_ACPI_DECLARE(hyperv, ACPI_SIG_GTDT, hyperv_timer_init);

0 commit comments

Comments
 (0)