Skip to content

Commit

Permalink
mshv-ioctls/system: Enable Direct mode stimer
Browse files Browse the repository at this point in the history
Enable direct mode for synthetic timer. This allows synthetic timer interrupts
to work early in the boot without having to wait for VMbus to be initialized.

Signed-off-by: Praveen K Paladugu <[email protected]>
  • Loading branch information
praveen-pk committed Mar 13, 2024
1 parent 9d0c11f commit 5bc70f4
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions mshv-ioctls/src/ioctls/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ pub enum SyntheticProcessorFeature {
AccessSynicRegs,
/// Access to synthetic timers and associated MSRs (HV_X64_MSR_STIMER0_CONFIG through HV_X64_MSR_STIMER3_COUNT).Corresponds to access_synthetic_timer_regs privilege.
AccessSyntheticTimerRegs,
/// Access to Synthetic timers in direct mode
DirectSyntheticTimers,
/// Access to the reference TSC. Corresponds to access_partition_reference_tsc privilege.
AccessPartitionReferenceTsc,
/// Partition has access to frequency regs. corresponds to access_frequency_regs privilege.
Expand Down Expand Up @@ -148,6 +150,12 @@ impl MshvPartitionBuilder {
.__bindgen_anon_1
.set_access_synthetic_timer_regs(1);
},
SyntheticProcessorFeature::DirectSyntheticTimers => unsafe {
self.mshv_partition
.synthetic_processor_features
.__bindgen_anon_1
.set_direct_synthetic_timers(1);
},
SyntheticProcessorFeature::AccessPartitionReferenceTsc => unsafe {
self.mshv_partition
.synthetic_processor_features
Expand Down Expand Up @@ -274,6 +282,7 @@ impl Mshv {
)
.set_synthetic_processor_feature(SyntheticProcessorFeature::AccessSynicRegs)
.set_synthetic_processor_feature(SyntheticProcessorFeature::AccessSyntheticTimerRegs)
.set_synthetic_processor_feature(SyntheticProcessorFeature::DirectSyntheticTimers)
.set_synthetic_processor_feature(SyntheticProcessorFeature::AccessPartitionReferenceTsc)
.set_synthetic_processor_feature(SyntheticProcessorFeature::AccessFrequencyRegs)
.set_synthetic_processor_feature(SyntheticProcessorFeature::AccessIntrCtrlRegs)
Expand Down

0 comments on commit 5bc70f4

Please sign in to comment.