- Timestamp:
- Jul 28, 2016 9:11:13 PM (8 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR3/GIM.cpp
r62478 r62641 75 75 static FNSSMINTSAVEEXEC gimR3Save; 76 76 static FNSSMINTLOADEXEC gimR3Load; 77 static FNPGMPHYSHANDLER gimR3Mmio2WriteHandler;78 77 79 78 … … 308 307 { 309 308 case GIMPROVIDERID_HYPERV: 310 rc = gimR3HvLoad(pVM, pSSM , uVersion);309 rc = gimR3HvLoad(pVM, pSSM); 311 310 AssertRCReturn(rc, rc); 312 311 break; 313 312 314 313 case GIMPROVIDERID_KVM: 315 rc = gimR3KvmLoad(pVM, pSSM , uVersion);314 rc = gimR3KvmLoad(pVM, pSSM); 316 315 AssertRCReturn(rc, rc); 317 316 break; … … 518 517 } 519 518 519 #if 0 /* ??? */ 520 520 521 521 /** … … 530 530 void *pvUser) 531 531 { 532 RT_NOREF6(pVM, pVCpu, GCPhys, pvPhys, pvBuf, cbBuf); 533 RT_NOREF3(enmAccessType, enmOrigin, pvUser); 534 532 535 /* 533 536 * Ignore writes to the mapped MMIO2 page. … … 538 541 539 542 540 #if 0541 543 /** 542 544 * Unmaps a registered MMIO2 region in the guest address space and removes any … … 679 681 return PGMHandlerPhysicalDeregister(pVM, pRegion->GCPhysPage); 680 682 } 683 681 684 #endif 682 685 -
trunk/src/VBox/VMM/VMMR3/GIMHv.cpp
r62478 r62641 180 180 static void gimR3HvTermHypercallSupport(PVM pVM); 181 181 static int gimR3HvInitDebugSupport(PVM pVM); 182 #if 0 /** @todo currently unused, which is probably very wrong */ 182 183 static void gimR3HvTermDebugSupport(PVM pVM); 184 #endif 183 185 184 186 … … 319 321 Assert((pHv->uBaseFeat & (GIM_HV_BASE_FEAT_HYPERCALL_MSRS | GIM_HV_BASE_FEAT_VP_ID_MSR)) 320 322 == (GIM_HV_BASE_FEAT_HYPERCALL_MSRS | GIM_HV_BASE_FEAT_VP_ID_MSR)); 323 #ifdef VBOX_STRICT 321 324 for (unsigned i = 0; i < RT_ELEMENTS(pHv->aMmio2Regions); i++) 322 325 { 323 PCGIMMMIO2REGION pcCur = &pHv->aMmio2Regions[i]; 324 Assert(!pcCur->fRCMapping); 325 Assert(!pcCur->fMapped); 326 Assert(pcCur->GCPhysPage == NIL_RTGCPHYS); 327 } 326 PCGIMMMIO2REGION pCur = &pHv->aMmio2Regions[i]; 327 Assert(!pCur->fRCMapping); 328 Assert(!pCur->fMapped); 329 Assert(pCur->GCPhysPage == NIL_RTGCPHYS); 330 } 331 #endif 328 332 329 333 /* … … 660 664 * @returns VBox status code. 661 665 * @param pVM The cross context VM structure. 662 * @param pSSM Pointer to the SSMhandle.666 * @param pSSM The saved state handle. 663 667 */ 664 668 VMMR3_INT_DECL(int) gimR3HvSave(PVM pVM, PSSMHANDLE pSSM) 665 669 { 666 PCGIMHV p cHv = &pVM->gim.s.u.Hv;670 PCGIMHV pHv = &pVM->gim.s.u.Hv; 667 671 668 672 /* … … 674 678 * Save per-VM MSRs. 675 679 */ 676 SSMR3PutU64(pSSM, p cHv->u64GuestOsIdMsr);677 SSMR3PutU64(pSSM, p cHv->u64HypercallMsr);678 SSMR3PutU64(pSSM, p cHv->u64TscPageMsr);680 SSMR3PutU64(pSSM, pHv->u64GuestOsIdMsr); 681 SSMR3PutU64(pSSM, pHv->u64HypercallMsr); 682 SSMR3PutU64(pSSM, pHv->u64TscPageMsr); 679 683 680 684 /* 681 685 * Save Hyper-V features / capabilities. 682 686 */ 683 SSMR3PutU32(pSSM, p cHv->uBaseFeat);684 SSMR3PutU32(pSSM, p cHv->uPartFlags);685 SSMR3PutU32(pSSM, p cHv->uPowMgmtFeat);686 SSMR3PutU32(pSSM, p cHv->uMiscFeat);687 SSMR3PutU32(pSSM, p cHv->uHyperHints);688 SSMR3PutU32(pSSM, p cHv->uHyperCaps);687 SSMR3PutU32(pSSM, pHv->uBaseFeat); 688 SSMR3PutU32(pSSM, pHv->uPartFlags); 689 SSMR3PutU32(pSSM, pHv->uPowMgmtFeat); 690 SSMR3PutU32(pSSM, pHv->uMiscFeat); 691 SSMR3PutU32(pSSM, pHv->uHyperHints); 692 SSMR3PutU32(pSSM, pHv->uHyperCaps); 689 693 690 694 /* 691 695 * Save the Hypercall region. 692 696 */ 693 PCGIMMMIO2REGION p cRegion = &pcHv->aMmio2Regions[GIM_HV_HYPERCALL_PAGE_REGION_IDX];694 SSMR3PutU8(pSSM, p cRegion->iRegion);695 SSMR3PutBool(pSSM, p cRegion->fRCMapping);696 SSMR3PutU32(pSSM, p cRegion->cbRegion);697 SSMR3PutGCPhys(pSSM, p cRegion->GCPhysPage);698 SSMR3PutStrZ(pSSM, p cRegion->szDescription);697 PCGIMMMIO2REGION pRegion = &pHv->aMmio2Regions[GIM_HV_HYPERCALL_PAGE_REGION_IDX]; 698 SSMR3PutU8(pSSM, pRegion->iRegion); 699 SSMR3PutBool(pSSM, pRegion->fRCMapping); 700 SSMR3PutU32(pSSM, pRegion->cbRegion); 701 SSMR3PutGCPhys(pSSM, pRegion->GCPhysPage); 702 SSMR3PutStrZ(pSSM, pRegion->szDescription); 699 703 700 704 /* 701 705 * Save the reference TSC region. 702 706 */ 703 p cRegion = &pcHv->aMmio2Regions[GIM_HV_REF_TSC_PAGE_REGION_IDX];704 SSMR3PutU8(pSSM, p cRegion->iRegion);705 SSMR3PutBool(pSSM, p cRegion->fRCMapping);706 SSMR3PutU32(pSSM, p cRegion->cbRegion);707 SSMR3PutGCPhys(pSSM, p cRegion->GCPhysPage);708 SSMR3PutStrZ(pSSM, p cRegion->szDescription);707 pRegion = &pHv->aMmio2Regions[GIM_HV_REF_TSC_PAGE_REGION_IDX]; 708 SSMR3PutU8(pSSM, pRegion->iRegion); 709 SSMR3PutBool(pSSM, pRegion->fRCMapping); 710 SSMR3PutU32(pSSM, pRegion->cbRegion); 711 SSMR3PutGCPhys(pSSM, pRegion->GCPhysPage); 712 SSMR3PutStrZ(pSSM, pRegion->szDescription); 709 713 /* Save the TSC sequence so we can bump it on restore (as the CPU frequency/offset may change). */ 710 714 uint32_t uTscSequence = 0; 711 if ( p cRegion->fMapped712 && MSR_GIM_HV_REF_TSC_IS_ENABLED(p cHv->u64TscPageMsr))713 { 714 PCGIMHVREFTSC p cRefTsc = (PCGIMHVREFTSC)pcRegion->pvPageR3;715 uTscSequence = p cRefTsc->u32TscSequence;715 if ( pRegion->fMapped 716 && MSR_GIM_HV_REF_TSC_IS_ENABLED(pHv->u64TscPageMsr)) 717 { 718 PCGIMHVREFTSC pRefTsc = (PCGIMHVREFTSC)pRegion->pvPageR3; 719 uTscSequence = pRefTsc->u32TscSequence; 716 720 } 717 721 SSMR3PutU32(pSSM, uTscSequence); … … 720 724 * Save debug support data. 721 725 */ 722 SSMR3PutU64(pSSM, p cHv->uDbgPendingBufferMsr);723 SSMR3PutU64(pSSM, p cHv->uDbgSendBufferMsr);724 SSMR3PutU64(pSSM, p cHv->uDbgRecvBufferMsr);725 SSMR3PutU64(pSSM, p cHv->uDbgStatusMsr);726 SSMR3PutU32(pSSM, p cHv->enmDbgReply);727 SSMR3PutU32(pSSM, p cHv->uDbgBootpXId);728 SSMR3PutU32(pSSM, p cHv->DbgGuestIp4Addr.u);726 SSMR3PutU64(pSSM, pHv->uDbgPendingBufferMsr); 727 SSMR3PutU64(pSSM, pHv->uDbgSendBufferMsr); 728 SSMR3PutU64(pSSM, pHv->uDbgRecvBufferMsr); 729 SSMR3PutU64(pSSM, pHv->uDbgStatusMsr); 730 SSMR3PutU32(pSSM, pHv->enmDbgReply); 731 SSMR3PutU32(pSSM, pHv->uDbgBootpXId); 732 SSMR3PutU32(pSSM, pHv->DbgGuestIp4Addr.u); 729 733 730 734 for (VMCPUID i = 0; i < pVM->cCpus; i++) … … 735 739 } 736 740 737 return SSMR3PutU8(pSSM, UINT8_MAX); ;741 return SSMR3PutU8(pSSM, UINT8_MAX); 738 742 } 739 743 … … 744 748 * @returns VBox status code. 745 749 * @param pVM The cross context VM structure. 746 * @param pSSM Pointer to the SSM handle. 747 * @param uSSMVersion The GIM saved-state version. 748 */ 749 VMMR3_INT_DECL(int) gimR3HvLoad(PVM pVM, PSSMHANDLE pSSM, uint32_t uSSMVersion) 750 * @param pSSM The saved state handle. 751 */ 752 VMMR3_INT_DECL(int) gimR3HvLoad(PVM pVM, PSSMHANDLE pSSM) 750 753 { 751 754 /* … … 758 761 && uHvSavedStatVersion != GIM_HV_SAVED_STATE_VERSION_PRE_DEBUG) 759 762 return SSMR3SetLoadError(pSSM, VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION, RT_SRC_POS, 760 N_("Unsupported Hyper-V saved-state version %u (current %u)!"), uHvSavedStatVersion,761 GIM_HV_SAVED_STATE_VERSION);763 N_("Unsupported Hyper-V saved-state version %u (current %u)!"), 764 uHvSavedStatVersion, GIM_HV_SAVED_STATE_VERSION); 762 765 763 766 /* … … 1342 1345 static int gimR3HvInitHypercallSupport(PVM pVM) 1343 1346 { 1344 int rc = VINF_SUCCESS;1345 1347 PGIMHV pHv = &pVM->gim.s.u.Hv; 1346 1348 pHv->pbHypercallIn = (uint8_t *)RTMemAllocZ(GIM_HV_PAGE_SIZE); … … 1393 1395 1394 1396 1397 #if 0 /** @todo currently unused, which is probably very wrong */ 1395 1398 /** 1396 1399 * Terminates Hyper-V guest debug support. … … 1407 1410 } 1408 1411 } 1412 #endif 1409 1413 1410 1414 … … 1864 1868 if (fFlags & ~GIM_HV_DEBUG_POST_OPTIONS_MASK)) 1865 1869 rcHv = GIM_HV_STATUS_INVALID_PARAMETER; 1870 #else 1871 RT_NOREF1(fFlags); 1866 1872 #endif 1867 1873 if (cbWrite > GIM_HV_DEBUG_MAX_DATA_SIZE) -
trunk/src/VBox/VMM/VMMR3/GIMKvm.cpp
r62478 r62641 267 267 * @returns VBox status code. 268 268 * @param pVM The cross context VM structure. 269 * @param pSSM Pointer to the SSMhandle.269 * @param pSSM The saved state handle. 270 270 */ 271 271 VMMR3_INT_DECL(int) gimR3KvmSave(PVM pVM, PSSMHANDLE pSSM) 272 272 { 273 PCGIMKVM p cKvm = &pVM->gim.s.u.Kvm;273 PCGIMKVM pKvm = &pVM->gim.s.u.Kvm; 274 274 275 275 /* … … 283 283 for (uint32_t i = 0; i < pVM->cCpus; i++) 284 284 { 285 PCGIMKVMCPU p cKvmCpu = &pVM->aCpus[i].gim.s.u.KvmCpu;285 PCGIMKVMCPU pKvmCpu = &pVM->aCpus[i].gim.s.u.KvmCpu; 286 286 287 287 /* Guest may alter flags (namely GIM_KVM_SYSTEM_TIME_FLAGS_GUEST_PAUSED bit). So re-read them from guest-memory. */ 288 288 GIMKVMSYSTEMTIME SystemTime; 289 289 RT_ZERO(SystemTime); 290 if (MSR_GIM_KVM_SYSTEM_TIME_IS_ENABLED(p cKvmCpu->u64SystemTimeMsr))290 if (MSR_GIM_KVM_SYSTEM_TIME_IS_ENABLED(pKvmCpu->u64SystemTimeMsr)) 291 291 { 292 int rc = PGMPhysSimpleReadGCPhys(pVM, &SystemTime, p cKvmCpu->GCPhysSystemTime, sizeof(GIMKVMSYSTEMTIME));292 int rc = PGMPhysSimpleReadGCPhys(pVM, &SystemTime, pKvmCpu->GCPhysSystemTime, sizeof(GIMKVMSYSTEMTIME)); 293 293 AssertRCReturn(rc, rc); 294 294 } 295 295 296 SSMR3PutU64(pSSM, p cKvmCpu->u64SystemTimeMsr);297 SSMR3PutU64(pSSM, p cKvmCpu->uTsc);298 SSMR3PutU64(pSSM, p cKvmCpu->uVirtNanoTS);299 SSMR3PutGCPhys(pSSM, p cKvmCpu->GCPhysSystemTime);300 SSMR3PutU32(pSSM, p cKvmCpu->u32SystemTimeVersion);296 SSMR3PutU64(pSSM, pKvmCpu->u64SystemTimeMsr); 297 SSMR3PutU64(pSSM, pKvmCpu->uTsc); 298 SSMR3PutU64(pSSM, pKvmCpu->uVirtNanoTS); 299 SSMR3PutGCPhys(pSSM, pKvmCpu->GCPhysSystemTime); 300 SSMR3PutU32(pSSM, pKvmCpu->u32SystemTimeVersion); 301 301 SSMR3PutU8(pSSM, SystemTime.fFlags); 302 302 } … … 305 305 * Save per-VM data. 306 306 */ 307 SSMR3PutU64(pSSM, p cKvm->u64WallClockMsr);308 return SSMR3PutU32(pSSM, p cKvm->uBaseFeat);307 SSMR3PutU64(pSSM, pKvm->u64WallClockMsr); 308 return SSMR3PutU32(pSSM, pKvm->uBaseFeat); 309 309 } 310 310 … … 315 315 * @returns VBox status code. 316 316 * @param pVM The cross context VM structure. 317 * @param pSSM Pointer to the SSM handle. 318 * @param uSSMVersion The GIM saved-state version. 319 */ 320 VMMR3_INT_DECL(int) gimR3KvmLoad(PVM pVM, PSSMHANDLE pSSM, uint32_t uSSMVersion) 317 * @param pSSM The saved state handle. 318 */ 319 VMMR3_INT_DECL(int) gimR3KvmLoad(PVM pVM, PSSMHANDLE pSSM) 321 320 { 322 321 /* … … 328 327 if (uKvmSavedStatVersion != GIM_KVM_SAVED_STATE_VERSION) 329 328 return SSMR3SetLoadError(pSSM, VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION, RT_SRC_POS, 330 N_("Unsupported KVM saved-state version %u (expected %u)."), uKvmSavedStatVersion,331 GIM_KVM_SAVED_STATE_VERSION);329 N_("Unsupported KVM saved-state version %u (expected %u)."), 330 uKvmSavedStatVersion, GIM_KVM_SAVED_STATE_VERSION); 332 331 333 332 /* … … 345 344 PGIMKVMCPU pKvmCpu = &pVCpu->gim.s.u.KvmCpu; 346 345 347 uint8_t fSystemTimeFlags = 0;348 346 SSMR3GetU64(pSSM, &pKvmCpu->u64SystemTimeMsr); 349 347 SSMR3GetU64(pSSM, &pKvmCpu->uTsc); … … 474 472 * Worker for gimR3KvmEnableWallClock} 475 473 */ 476 static DECLCALLBACK(VBOXSTRICTRC) gimR3KvmEnableWallClockCallback(PVM pVM, PVMCPU pVCpu, void *pvData) 477 { 478 Assert(pvData); 479 PKVMWALLCLOCKINFO pWallClockInfo = (PKVMWALLCLOCKINFO)pvData; 474 static DECLCALLBACK(VBOXSTRICTRC) gimR3KvmEnableWallClockCallback(PVM pVM, PVMCPU pVCpu, void *pvUser) 475 { 476 PKVMWALLCLOCKINFO pWallClockInfo = (PKVMWALLCLOCKINFO)pvUser; AssertPtr(pWallClockInfo); 480 477 RTGCPHYS GCPhysWallClock = pWallClockInfo->GCPhysWallClock; 478 RT_NOREF1(pVCpu); 481 479 482 480 /* … … 495 493 * Ensure the version is incrementally even. 496 494 */ 495 /* faster: uVersion = (uVersion | 1) + 1; */ 497 496 if (!(uVersion & 1)) 498 497 ++uVersion; … … 521 520 rc = PGMPhysSimpleWriteGCPhys(pVM, GCPhysWallClock, &WallClock, sizeof(GIMKVMWALLCLOCK)); 522 521 if (RT_SUCCESS(rc)) 523 {524 522 LogRel(("GIM: KVM: Enabled wall-clock struct. at %#RGp - u32Sec=%u u32Nano=%u uVersion=%#RU32\n", GCPhysWallClock, 525 523 WallClock.u32Sec, WallClock.u32Nano, WallClock.u32Version)); 526 }527 524 else 528 525 LogRel(("GIM: KVM: Failed to write wall-clock struct. at %#RGp. rc=%Rrc\n", GCPhysWallClock, rc)); -
trunk/src/VBox/VMM/include/GIMHvInternal.h
r62478 r62641 1175 1175 VMMR3_INT_DECL(PGIMMMIO2REGION) gimR3HvGetMmio2Regions(PVM pVM, uint32_t *pcRegions); 1176 1176 VMMR3_INT_DECL(int) gimR3HvSave(PVM pVM, PSSMHANDLE pSSM); 1177 VMMR3_INT_DECL(int) gimR3HvLoad(PVM pVM, PSSMHANDLE pSSM , uint32_t uSSMVersion);1177 VMMR3_INT_DECL(int) gimR3HvLoad(PVM pVM, PSSMHANDLE pSSM); 1178 1178 VMMR3_INT_DECL(int) gimR3HvGetDebugSetup(PVM pVM, PGIMDEBUGSETUP pDbgSetup); 1179 1179 -
trunk/src/VBox/VMM/include/GIMKvmInternal.h
r62478 r62641 252 252 VMMR3_INT_DECL(void) gimR3KvmReset(PVM pVM); 253 253 VMMR3_INT_DECL(int) gimR3KvmSave(PVM pVM, PSSMHANDLE pSSM); 254 VMMR3_INT_DECL(int) gimR3KvmLoad(PVM pVM, PSSMHANDLE pSSM , uint32_t uSSMVersion);254 VMMR3_INT_DECL(int) gimR3KvmLoad(PVM pVM, PSSMHANDLE pSSM); 255 255 256 256 VMMR3_INT_DECL(int) gimR3KvmDisableSystemTime(PVM pVM);
Note:
See TracChangeset
for help on using the changeset viewer.