Lines Matching +full:no +full:- +full:tick +full:- +full:in +full:- +full:suspend

1 // SPDX-License-Identifier: GPL-2.0
5 * provided by the Hyper-V hypervisor to guest VMs, as described
6 * in the Hyper-V Top Level Functional Spec (TLFS). This driver
26 #include <asm/hyperv-tlfs.h>
35 * mechanism is used when running on older versions of Hyper-V
36 * that don't support Direct Mode. While Hyper-V provides
40 * message, stimer interrupts can be enabled earlier in the
43 * However, for legacy versions of Hyper-V when Direct Mode
50 static int stimer0_irq = -1;
63 ce->event_handler(ce); in hv_stimer0_isr()
69 * per-cpu interrupts, which also implies Direct Mode.
127 * hv_stimer_init - Per-cpu initialization of the clockevent
137 ce->name = "Hyper-V clockevent"; in hv_stimer_init()
138 ce->features = CLOCK_EVT_FEAT_ONESHOT; in hv_stimer_init()
139 ce->cpumask = cpumask_of(cpu); in hv_stimer_init()
140 ce->rating = 1000; in hv_stimer_init()
141 ce->set_state_shutdown = hv_ce_shutdown; in hv_stimer_init()
142 ce->set_state_oneshot = hv_ce_set_oneshot; in hv_stimer_init()
143 ce->set_next_event = hv_ce_set_next_event; in hv_stimer_init()
153 * hv_stimer_cleanup - Per-cpu cleanup of the clockevent
163 * In the legacy case where Direct Mode is not enabled in hv_stimer_cleanup()
165 * relatively early in the CPU offlining process. We in hv_stimer_cleanup()
166 * must unbind the stimer-based clockevent device so in hv_stimer_cleanup()
168 * are no longer needed in the offlining process. Note in hv_stimer_cleanup()
174 * there are no other clockevent devices to fallback to. in hv_stimer_cleanup()
189 * they don't support per-cpu IRQs (such as x86/x64).
199 /* Called only on architectures with per-cpu IRQs (i.e., not x86/x64) */
207 pr_err("Can't register Hyper-V stimer0 GSI. Error %d", ret); in hv_setup_stimer0_irq()
213 "Hyper-V stimer0", &stimer0_evt); in hv_setup_stimer0_irq()
215 pr_err("Can't request Hyper-V stimer0 IRQ %d. Error %d", in hv_setup_stimer0_irq()
218 stimer0_irq = -1; in hv_setup_stimer0_irq()
225 if (stimer0_irq == -1) { in hv_remove_stimer0_irq()
230 stimer0_irq = -1; in hv_remove_stimer0_irq()
234 /* hv_stimer_alloc - Global initialization of the clockevent and stimer0 */
241 * Hyper-V on x86. In that case, return as error as Linux will use a in hv_stimer_alloc()
245 return -EINVAL; in hv_stimer_alloc()
249 return -ENOMEM; in hv_stimer_alloc()
270 * Since we are in Direct Mode, stimer initialization in hv_stimer_alloc()
271 * can be done now with a CPUHP value in the same range in hv_stimer_alloc()
291 * hv_stimer_legacy_init -- Called from the VMbus driver to handle
293 * must be initialized late in the CPU onlining process.
304 * not ideal, but the value passed in is always the same and in hv_stimer_legacy_init()
306 * clocksource driver just to set the sint in the legacy case. in hv_stimer_legacy_init()
314 * hv_stimer_legacy_cleanup -- Called from the VMbus driver to
316 * stimer must be cleaned up early in the CPU offlining
349 stimer0_irq = -1; in hv_stimer_global_cleanup()
358 * Code and definitions for the Hyper-V clocksources. Two
359 * clocksources are defined: one that reads the Hyper-V defined MSR, and
360 * the other that uses the TSC reference page feature as defined in the
362 * Hyper-V and 32-bit x86. The TSC reference page version is preferred.
393 return (read_hv_clock_tsc() - hv_sched_clock_offset) * in read_hv_sched_clock_tsc()
413 /* Re-enable the TSC page */ in resume_hv_clock_tsc()
434 .suspend= suspend_hv_clock_tsc,
447 * Read the partition counter to get the current tick count. This count in read_hv_clock_msr()
448 * is set to 0 when the partition is created and is incremented in in read_hv_clock_msr()
461 return (read_hv_clock_msr() - hv_sched_clock_offset) * in read_hv_sched_clock_msr()
482 * The Hyper-V sched clock read function returns nanoseconds, not in hv_setup_sched_clock()
483 * the normal 100ns units of the Hyper-V synthetic clock. in hv_setup_sched_clock()
509 * If Hyper-V offers TSC_INVARIANT, then the virtualized TSC correctly in hv_init_tsc_clocksource()
512 * Hyper-V Reference TSC rating, causing the generic TSC to be used. in hv_init_tsc_clocksource()
513 * TSC_INVARIANT is not offered on ARM64, so the Hyper-V Reference in hv_init_tsc_clocksource()
515 * While the Hyper-V MSR clocksource won't be used since the in hv_init_tsc_clocksource()
528 * The Hyper-V TLFS specifies to preserve the value of reserved in hv_init_tsc_clocksource()
529 * bits in registers. So read the existing value, preserve the in hv_init_tsc_clocksource()
530 * low order 12 bits, and add in the guest physical address in hv_init_tsc_clocksource()
553 * Hyper-V on x86. In that case we won't have a Hyper-V in hv_init_clocksource()