Skip to content

drivers: hv: mshv_vtl: Implement restore partition time IOCTL#117

Merged
hargar19 merged 6 commits intomicrosoft:project/hcl-dev/6.12from
Brian-Perkins:restore_partition_time
Feb 4, 2026
Merged

drivers: hv: mshv_vtl: Implement restore partition time IOCTL#117
hargar19 merged 6 commits intomicrosoft:project/hcl-dev/6.12from
Brian-Perkins:restore_partition_time

Conversation

@hargar19
Copy link
Collaborator

@hargar19 hargar19 commented Feb 4, 2026

Hyper-V supports a restore partition time hypercall that resets the TSC to provided values. This call is typically made by a Windows guest when restoring from hibernate. The paravisor needs to support this call in order to allow the guest to be able to successfully perform the operation. Since the reference time is being changed, clocks need to be updated to maintain consistent forward progress.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements a restore partition time IOCTL for the Hyper-V paravisor driver. This functionality is needed to support Windows guest hibernate/resume operations, where the guest needs to reset the TSC (Time Stamp Counter) to specific values when coming back from hibernation.

Changes:

  • Adds new UAPI structures and IOCTL definitions for partition time restoration
  • Implements the IOCTL handler that uses stop_machine to suspend all CPUs, makes a hypercall to update TSC, and restores clock state
  • Exports Hyper-V clock state save/restore functions for use by the driver

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
include/uapi/linux/mshv.h Adds mshv_partition_time structure and MSHV_RESTORE_PARTITION_TIME IOCTL definition
include/uapi/hyperv/hvgdk_mini.h Adds hv_input_restore_partition_time structure and HVCALL_RESTORE_PARTITION_TIME hypercall constant
drivers/hv/mshv_vtl_main.c Implements the IOCTL handler using stop_machine to safely update TSC and restore clocks
arch/x86/kernel/cpu/mshyperv.c Changes hv_save_sched_clock_state and hv_restore_sched_clock_state from static to non-static
arch/x86/include/asm/mshyperv.h Adds declarations for hv_save_sched_clock_state and hv_restore_sched_clock_state
Comments suppressed due to low confidence (1)

arch/x86/kernel/cpu/mshyperv.c:279

  • The functions hv_save_sched_clock_state and hv_restore_sched_clock_state are made non-static and declared in the header file, but they are not exported with EXPORT_SYMBOL_GPL. If the mshv_vtl driver is built as a module (which it can be, as indicated by MODULE_LICENSE and module_init), it will fail to load due to unresolved symbols. Add EXPORT_SYMBOL_GPL after each function definition to make them available to modules.
void hv_save_sched_clock_state(void)
{
	old_save_sched_clock_state();
	save_hv_clock_tsc_state();
}

void hv_restore_sched_clock_state(void)
{
	restore_hv_clock_tsc_state();
	old_restore_sched_clock_state();
}

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@hargar19 hargar19 merged commit 2d93d01 into microsoft:project/hcl-dev/6.12 Feb 4, 2026
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants