drivers: hv: mshv_vtl: Implement restore partition time IOCTL#117
Merged
hargar19 merged 6 commits intomicrosoft:project/hcl-dev/6.12from Feb 4, 2026
Merged
Conversation
added 6 commits
January 29, 2026 15:57
There was a problem hiding this comment.
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.
Brian-Perkins
approved these changes
Feb 4, 2026
Brian-Perkins
approved these changes
Feb 4, 2026
benhillis
approved these changes
Feb 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.