Changeset 100101 in vbox
- Timestamp:
- Jun 7, 2023 5:52:38 PM (18 months ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/vmm/vmm.h
r98103 r100101 559 559 VMMR3_INT_DECL(void) VMMR3YieldStop(PVM pVM); 560 560 VMMR3_INT_DECL(void) VMMR3YieldResume(PVM pVM); 561 #if defined(VBOX_VMM_TARGET_ARMV8) 562 VMMR3_INT_DECL(void) VMMR3CpuOn(PVM pVM, VMCPUID idCpu, RTGCPHYS GCPhysExecAddr, uint64_t u64CtxId); 563 #else 561 564 VMMR3_INT_DECL(void) VMMR3SendStartupIpi(PVM pVM, VMCPUID idCpu, uint32_t uVector); 562 565 VMMR3_INT_DECL(void) VMMR3SendInitIpi(PVM pVM, VMCPUID idCpu); 566 #endif 563 567 VMMR3DECL(int) VMMR3RegisterPatchMemory(PVM pVM, RTGCPTR pPatchMem, unsigned cbPatchMem); 564 568 VMMR3DECL(int) VMMR3DeregisterPatchMemory(PVM pVM, RTGCPTR pPatchMem, unsigned cbPatchMem); -
trunk/src/VBox/VMM/VMMR3/VMM.cpp
r99576 r100101 146 146 #include <iprt/assert.h> 147 147 #include <iprt/alloc.h> 148 #if defined(VBOX_VMM_TARGET_ARMV8) 149 # include <iprt/armv8.h> 150 #endif 148 151 #include <iprt/asm.h> 149 152 #include <iprt/time.h> … … 1292 1295 1293 1296 1294 /** 1295 * VCPU worker for VMMR3SendStartupIpi. 1296 * 1297 * @param pVM The cross context VM structure. 1298 * @param idCpu Virtual CPU to perform SIPI on. 1299 * @param uVector The SIPI vector. 1300 */ 1301 static DECLCALLBACK(int) vmmR3SendStarupIpi(PVM pVM, VMCPUID idCpu, uint32_t uVector) 1297 #if defined(VBOX_VMM_TARGET_ARMV8) 1298 /** 1299 * VCPU worker for VMMR3CpuOn. 1300 * 1301 * @param pVM The cross context VM structure. 1302 * @param idCpu Virtual CPU to perform SIPI on. 1303 * @param GCPhysExecAddr The guest physical address to start executing at. 1304 * @param u64CtxId The context ID passed in x0/w0. 1305 */ 1306 static DECLCALLBACK(int) vmmR3CpuOn(PVM pVM, VMCPUID idCpu, RTGCPHYS GCPhysExecAddr, uint64_t u64CtxId) 1302 1307 { 1303 1308 PVMCPU pVCpu = VMMGetCpuById(pVM, idCpu); 1304 1309 VMCPU_ASSERT_EMT(pVCpu); 1305 1310 1306 /*1307 * In the INIT state, the target CPU is only responsive to an SIPI.1308 * This is also true for when when the CPU is in VMX non-root mode.1309 *1310 * See AMD spec. 16.5 "Interprocessor Interrupts (IPI)".1311 * See Intel spec. 26.6.2 "Activity State".1312 */1313 1311 if (EMGetState(pVCpu) != EMSTATE_WAIT_SIPI) 1314 1312 return VINF_SUCCESS; 1315 1313 1316 #if defined(VBOX_VMM_TARGET_ARMV8)1317 AssertReleaseFailed(); /** @todo */1318 #else1319 1314 PCPUMCTX pCtx = CPUMQueryGuestCtxPtr(pVCpu); 1320 # ifdef VBOX_WITH_NESTED_HWVIRT_VMX 1321 if (CPUMIsGuestInVmxRootMode(pCtx)) 1322 { 1323 /* If the CPU is in VMX non-root mode we must cause a VM-exit. */ 1324 if (CPUMIsGuestInVmxNonRootMode(pCtx)) 1325 return VBOXSTRICTRC_TODO(IEMExecVmxVmexitStartupIpi(pVCpu, uVector)); 1326 1327 /* If the CPU is in VMX root mode (and not in VMX non-root mode) SIPIs are blocked. */ 1328 return VINF_SUCCESS; 1329 } 1330 # endif 1331 1332 pCtx->cs.Sel = uVector << 8; 1333 pCtx->cs.ValidSel = uVector << 8; 1334 pCtx->cs.fFlags = CPUMSELREG_FLAGS_VALID; 1335 pCtx->cs.u64Base = uVector << 12; 1336 pCtx->cs.u32Limit = UINT32_C(0x0000ffff); 1337 pCtx->rip = 0; 1338 #endif 1339 1340 Log(("vmmR3SendSipi for VCPU %d with vector %x\n", idCpu, uVector)); 1315 1316 pCtx->aGRegs[ARMV8_AARCH64_REG_X0].x = u64CtxId; 1317 pCtx->Pc.u64 = GCPhysExecAddr; 1318 1319 Log(("vmmR3CpuOn for VCPU %d with GCPhysExecAddr=%RGp u64CtxId=%#RX64\n", idCpu, GCPhysExecAddr, u64CtxId)); 1341 1320 1342 1321 # if 1 /* If we keep the EMSTATE_WAIT_SIPI method, then move this to EM.cpp. */ … … 1352 1331 1353 1332 /** 1333 * Sends a Startup IPI to the virtual CPU by setting CS:EIP into 1334 * vector-dependent state and unhalting processor. 1335 * 1336 * @param pVM The cross context VM structure. 1337 * @param idCpu Virtual CPU to perform SIPI on. 1338 * @param GCPhysExecAddr The guest physical address to start executing at. 1339 * @param u64CtxId The context ID passed in x0/w0. 1340 */ 1341 VMMR3_INT_DECL(void) VMMR3CpuOn(PVM pVM, VMCPUID idCpu, RTGCPHYS GCPhysExecAddr, uint64_t u64CtxId) 1342 { 1343 AssertReturnVoid(idCpu < pVM->cCpus); 1344 1345 int rc = VMR3ReqCallNoWait(pVM, idCpu, (PFNRT)vmmR3CpuOn, 4, pVM, idCpu, GCPhysExecAddr, u64CtxId); 1346 AssertRC(rc); 1347 } 1348 #else 1349 /** 1350 * VCPU worker for VMMR3SendStartupIpi. 1351 * 1352 * @param pVM The cross context VM structure. 1353 * @param idCpu Virtual CPU to perform SIPI on. 1354 * @param uVector The SIPI vector. 1355 */ 1356 static DECLCALLBACK(int) vmmR3SendStartupIpi(PVM pVM, VMCPUID idCpu, uint32_t uVector) 1357 { 1358 PVMCPU pVCpu = VMMGetCpuById(pVM, idCpu); 1359 VMCPU_ASSERT_EMT(pVCpu); 1360 1361 /* 1362 * In the INIT state, the target CPU is only responsive to an SIPI. 1363 * This is also true for when when the CPU is in VMX non-root mode. 1364 * 1365 * See AMD spec. 16.5 "Interprocessor Interrupts (IPI)". 1366 * See Intel spec. 26.6.2 "Activity State". 1367 */ 1368 if (EMGetState(pVCpu) != EMSTATE_WAIT_SIPI) 1369 return VINF_SUCCESS; 1370 1371 PCPUMCTX pCtx = CPUMQueryGuestCtxPtr(pVCpu); 1372 # ifdef VBOX_WITH_NESTED_HWVIRT_VMX 1373 if (CPUMIsGuestInVmxRootMode(pCtx)) 1374 { 1375 /* If the CPU is in VMX non-root mode we must cause a VM-exit. */ 1376 if (CPUMIsGuestInVmxNonRootMode(pCtx)) 1377 return VBOXSTRICTRC_TODO(IEMExecVmxVmexitStartupIpi(pVCpu, uVector)); 1378 1379 /* If the CPU is in VMX root mode (and not in VMX non-root mode) SIPIs are blocked. */ 1380 return VINF_SUCCESS; 1381 } 1382 # endif 1383 1384 pCtx->cs.Sel = uVector << 8; 1385 pCtx->cs.ValidSel = uVector << 8; 1386 pCtx->cs.fFlags = CPUMSELREG_FLAGS_VALID; 1387 pCtx->cs.u64Base = uVector << 12; 1388 pCtx->cs.u32Limit = UINT32_C(0x0000ffff); 1389 pCtx->rip = 0; 1390 1391 Log(("vmmR3SendSipi for VCPU %d with vector %x\n", idCpu, uVector)); 1392 1393 # if 1 /* If we keep the EMSTATE_WAIT_SIPI method, then move this to EM.cpp. */ 1394 EMSetState(pVCpu, EMSTATE_HALTED); 1395 return VINF_EM_RESCHEDULE; 1396 # else /* And if we go the VMCPU::enmState way it can stay here. */ 1397 VMCPU_ASSERT_STATE(pVCpu, VMCPUSTATE_STOPPED); 1398 VMCPU_SET_STATE(pVCpu, VMCPUSTATE_STARTED); 1399 return VINF_SUCCESS; 1400 # endif 1401 } 1402 1403 1404 /** 1354 1405 * VCPU worker for VMMR3SendInitIpi. 1355 1406 * … … 1406 1457 AssertReturnVoid(idCpu < pVM->cCpus); 1407 1458 1408 int rc = VMR3ReqCallNoWait(pVM, idCpu, (PFNRT)vmmR3SendStar upIpi, 3, pVM, idCpu, uVector);1459 int rc = VMR3ReqCallNoWait(pVM, idCpu, (PFNRT)vmmR3SendStartupIpi, 3, pVM, idCpu, uVector); 1409 1460 AssertRC(rc); 1410 1461 } … … 1424 1475 AssertRC(rc); 1425 1476 } 1477 #endif 1426 1478 1427 1479
Note:
See TracChangeset
for help on using the changeset viewer.