File tree Expand file tree Collapse file tree
src/hyperlight_host/src/hypervisor/virtual_machine Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -729,6 +729,22 @@ impl VirtualMachine for WhpVm {
729729 WHvResetPartition ( self . partition )
730730 . map_err ( |e| RegisterError :: ResetPartition ( e. into ( ) ) ) ?;
731731
732+ // WHvResetPartition resets the VMCB but may not update the
733+ // hypervisor's internal register-change tracking used for
734+ // TLB flush decisions on AMD SVM. Explicitly re-announce
735+ // the post-reset CR0 (PG=0) via the WHP API so that the
736+ // subsequent restore_sregs() write of CR0 with PG=1 is
737+ // detected as a paging-mode change, triggering
738+ // SVM_TLB_FLUSH_CURRENT_ASID on the next VMRUN.
739+ let post_reset_sregs = self . sregs ( ) ?;
740+ self . set_registers ( & [ (
741+ WHvX64RegisterCr0 ,
742+ Align16 ( WHV_REGISTER_VALUE {
743+ Reg64 : post_reset_sregs. cr0 ,
744+ } ) ,
745+ ) ] )
746+ . map_err ( |e| RegisterError :: ResetPartition ( e. into ( ) ) ) ?;
747+
732748 // WHvResetPartition resets LAPIC to power-on defaults.
733749 // Re-initialize it when LAPIC emulation is active.
734750 #[ cfg( feature = "hw-interrupts" ) ]
You can’t perform that action at this time.
0 commit comments