Changeset 108411 in vbox
- Timestamp:
- Feb 27, 2025 11:46:20 AM (7 weeks ago)
- svn:sync-xref-src-repo-rev:
- 167779
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR3/NEMR3Native-win-armv8.cpp
r108404 r108411 2732 2732 VMMR3_INT_DECL(int) NEMR3Halt(PVM pVM, PVMCPU pVCpu) 2733 2733 { 2734 /* 2735 * Try switch to NEM runloop state. 2736 */ 2737 if (VMCPU_CMPXCHG_STATE(pVCpu, VMCPUSTATE_STARTED_EXEC_NEM, VMCPUSTATE_STARTED_HALTED)) 2738 { /* likely */ } 2739 else 2740 { 2741 VMCPU_CMPXCHG_STATE(pVCpu, VMCPUSTATE_STARTED_EXEC_NEM, VMCPUSTATE_STARTED_EXEC_NEM_CANCELED); 2742 LogFlow(("NEM/%u: returning immediately because canceled\n", pVCpu->idCpu)); 2743 return VINF_SUCCESS; 2744 } 2745 2746 VBOXSTRICTRC rcStrict = VINF_SUCCESS; 2747 2748 /* Ensure that Hyper-V has the whole state. */ 2749 int rc2 = nemHCWinCopyStateToHyperV(pVM, pVCpu); 2750 AssertRCReturn(rc2, rc2); 2751 2752 if ( !VM_FF_IS_ANY_SET(pVM, VM_FF_EMT_RENDEZVOUS | VM_FF_TM_VIRTUAL_SYNC) 2753 && !VMCPU_FF_IS_ANY_SET(pVCpu, VMCPU_FF_HM_TO_R3_MASK)) 2754 { 2755 if (VMCPU_CMPXCHG_STATE(pVCpu, VMCPUSTATE_STARTED_EXEC_NEM_WAIT, VMCPUSTATE_STARTED_EXEC_NEM)) 2756 { 2757 MY_WHV_RUN_VP_EXIT_CONTEXT ExitReason = {0}; 2758 HRESULT hrc = WHvRunVirtualProcessor(pVM->nem.s.hPartition, pVCpu->idCpu, &ExitReason, sizeof(ExitReason)); 2759 VMCPU_CMPXCHG_STATE(pVCpu, VMCPUSTATE_STARTED_EXEC_NEM, VMCPUSTATE_STARTED_EXEC_NEM_WAIT); 2760 TMNotifyEndOfExecution(pVM, pVCpu, ASMReadTSC()); 2761 #ifdef LOG_ENABLED 2762 LogFlow(("NEM/%u: Exit @ @todo Reason=%#x\n", pVCpu->idCpu, ExitReason.ExitReason)); 2763 #endif 2764 if (SUCCEEDED(hrc)) 2765 { 2766 /* 2767 * Deal with the message. 2768 */ 2769 rcStrict = nemR3WinHandleExit(pVM, pVCpu, &ExitReason); 2770 LogFlow(("NEM/%u: breaking: nemHCWinHandleMessage -> %Rrc\n", pVCpu->idCpu, VBOXSTRICTRC_VAL(rcStrict) )); 2771 STAM_REL_COUNTER_INC(&pVCpu->nem.s.StatBreakOnStatus); 2772 } 2773 else 2774 AssertLogRelMsgFailedReturn(("WHvRunVirtualProcessor failed for CPU #%u: %#x (%u)\n", 2775 pVCpu->idCpu, hrc, GetLastError()), 2776 VERR_NEM_IPE_0); 2777 2778 /** @todo Try handle pending flags, not just return to EM loops. Take care 2779 * not to set important RCs here unless we've handled a message. */ 2780 LogFlow(("NEM/%u: breaking: pending FF (%#x / %#RX64)\n", 2781 pVCpu->idCpu, pVM->fGlobalForcedActions, (uint64_t)pVCpu->fLocalForcedActions)); 2782 STAM_REL_COUNTER_INC(&pVCpu->nem.s.StatBreakOnFFPost); 2783 } 2784 else 2785 { 2786 LogFlow(("NEM/%u: breaking: canceled %d (pre exec)\n", pVCpu->idCpu, VMCPU_GET_STATE(pVCpu) )); 2787 STAM_REL_COUNTER_INC(&pVCpu->nem.s.StatBreakOnCancel); 2788 } 2789 } 2790 else 2791 { 2792 LogFlow(("NEM/%u: breaking: pending FF (pre exec)\n", pVCpu->idCpu)); 2793 STAM_REL_COUNTER_INC(&pVCpu->nem.s.StatBreakOnFFPre); 2794 } 2795 2796 if (!VMCPU_CMPXCHG_STATE(pVCpu, VMCPUSTATE_STARTED_HALTED, VMCPUSTATE_STARTED_EXEC_NEM)) 2797 VMCPU_CMPXCHG_STATE(pVCpu, VMCPUSTATE_STARTED_HALTED, VMCPUSTATE_STARTED_EXEC_NEM_CANCELED); 2798 2799 return rcStrict; 2734 Assert(EMGetState(pVCpu) == EMSTATE_WAIT_SIPI); 2735 2736 /* 2737 * Force the vCPU to get out of the SIPI state and into the normal runloop 2738 * as Hyper-V doesn't cause VM exits for PSCI calls so we wouldn't notice when 2739 * when the guest brings APs online. 2740 * Instead we force the EMT to run the vCPU through Hyper-V which manages the state. 2741 */ 2742 RT_NOREF(pVM); 2743 EMSetState(pVCpu, EMSTATE_HALTED); 2744 return VINF_EM_RESCHEDULE; 2800 2745 } 2801 2746
Note:
See TracChangeset
for help on using the changeset viewer.