Changeset 52761 in vbox
- Timestamp:
- Sep 16, 2014 3:49:57 PM (10 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR3/GIM.cpp
r52699 r52761 89 89 * Register the saved state data unit. 90 90 */ 91 int rc; 92 rc = SSMR3RegisterInternal(pVM, "GIM", 0 /* uInstance */, GIM_SSM_VERSION, sizeof(GIM), 93 NULL /* pfnLivePrep */, NULL /* pfnLiveExec */, NULL /* pfnLiveVote*/, 94 NULL /* pfnSavePrep */, gimR3Save, NULL /* pfnSaveDone */, 95 NULL /* pfnLoadPrep */, gimR3Load, NULL /* pfnLoadDone */); 91 int rc = SSMR3RegisterInternal(pVM, "GIM", 0 /* uInstance */, GIM_SAVED_STATE_VERSION, sizeof(GIM), 92 NULL /* pfnLivePrep */, NULL /* pfnLiveExec */, NULL /* pfnLiveVote*/, 93 NULL /* pfnSavePrep */, gimR3Save, NULL /* pfnSaveDone */, 94 NULL /* pfnLoadPrep */, gimR3Load, NULL /* pfnLoadDone */); 96 95 if (RT_FAILURE(rc)) 97 96 return rc; … … 128 127 pVM->gim.s.fEnabled = true; 129 128 pVM->gim.s.u32Version = uVersion; 129 /** @todo r=bird: Because u32Version is saved, it should be translated to the 130 * 'most up-to-date implementation' version number when 0. Otherwise, 131 * we'll have abiguities when loading the state of older VMs. */ 130 132 if (!RTStrCmp(szProvider, "Minimal")) 131 133 { … … 140 142 /** @todo KVM and others. */ 141 143 else 142 { 143 LogRel(("GIM: Provider \"%s\" unknown.\n", szProvider)); 144 rc = VERR_GIM_INVALID_PROVIDER; 145 } 144 rc = VMR3SetError(pVM->pUVM, VERR_GIM_INVALID_PROVIDER, RT_SRC_POS, "Provider \"%s\" unknown.", szProvider); 146 145 } 147 146 return rc; … … 151 150 /** 152 151 * Initializes the remaining bits of the GIM provider. 152 * 153 153 * This is called after initializing HM and most other VMM components. 154 154 * … … 179 179 180 180 /** 181 * Applies relocations to data and code managed by this component. This function 182 * will be called at init and whenever the VMM need to relocate itself inside 183 * the GC. 181 * Applies relocations to data and code managed by this component. 182 * 183 * This function will be called at init and whenever the VMM need to relocate 184 * itself inside the GC. 184 185 * 185 186 * @param pVM Pointer to the VM. … … 235 236 int rc; 236 237 #if 0 238 SSMR3PutU32(pSSM, pVM->cCpus); 237 239 for (VMCPUID i = 0; i < pVM->cCpus; i++) 238 240 { … … 244 246 * Save per-VM data. 245 247 */ 246 rc = SSMR3PutBool(pSSM, pVM->gim.s.fEnabled); 247 AssertRCReturn(rc, rc); 248 rc = SSMR3PutU32(pSSM, pVM->gim.s.enmProviderId); 249 AssertRCReturn(rc, rc); 248 SSMR3PutBool(pSSM, pVM->gim.s.fEnabled); 249 SSMR3PutU32(pSSM, pVM->gim.s.enmProviderId); 250 250 rc = SSMR3PutU32(pSSM, pVM->gim.s.u32Version); 251 251 AssertRCReturn(rc, rc); … … 285 285 if (uPass != SSM_PASS_FINAL) 286 286 return VINF_SUCCESS; 287 if (uVersion != GIM_SAVED_STATE_VERSION) 288 return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION; 289 287 290 288 291 /** @todo Load per-CPU data. */ … … 298 301 * Load per-VM data. 299 302 */ 300 rc = SSMR3GetBool(pSSM, &pVM->gim.s.fEnabled); 303 bool fEnabled; 304 SSMR3GetBool(pSSM, &fEnabled); 305 uint32_t uProviderId; 306 SSMR3GetU32(pSSM, &uProviderId); 307 uint32_t uProviderVersion; 308 rc = SSMR3GetU32(pSSM, &uProviderVersion); 301 309 AssertRCReturn(rc, rc); 302 rc = SSMR3GetU32(pSSM, (uint32_t *)&pVM->gim.s.enmProviderId); 303 AssertRCReturn(rc, rc); 304 rc = SSMR3GetU32(pSSM, &pVM->gim.s.u32Version); 305 AssertRCReturn(rc, rc); 310 311 if ((GIMPROVIDERID)uProviderId != pVM->gim.s.enmProviderId) 312 return SSMR3SetCfgError(pSSM, RT_SRC_POS, N_("Saved GIM provider %u differs from the configured one (%u)."), 313 uProviderId, pVM->gim.s.enmProviderId); 314 #if 0 /** @todo r=bird: Figure out what you mean to do here with the version. */ 315 if (uProviderVersion != pVM->gim.s.u32Version) 316 return SSMR3SetCfgError(pSSM, RT_SRC_POS, N_("Saved GIM provider version %u differs from the configured one (%u)."), 317 uProviderVersion, pVM->gim.s.u32Version); 318 #else 319 pVM->gim.s.u32Version = uProviderVersion; 320 #endif 306 321 307 322 /* -
trunk/src/VBox/VMM/VMMR3/GIMHv.cpp
r52699 r52761 35 35 #include <VBox/version.h> 36 36 37 37 38 /******************************************************************************* 38 39 * Defined Constants And Macros * 39 40 *******************************************************************************/ 40 41 //#define GIMHV_HYPERCALL "GIMHvHypercall" 42 43 /** 44 * GIM Hyper-V saved-state version. 45 */ 46 #define GIM_HV_SAVED_STATE_VERSION UINT32_C(1) 47 48 49 /******************************************************************************* 50 * Global Variables * 51 *******************************************************************************/ 41 52 #ifdef VBOX_WITH_STATISTICS 42 53 # define GIMHV_MSRRANGE(a_uFirst, a_uLast, a_szName) \ … … 360 371 * Save the Hyper-V SSM version. 361 372 */ 362 int rc = SSMR3PutU32(pSSM, GIM_HV_SSM_VERSION); AssertRCReturn(rc, rc);373 SSMR3PutU32(pSSM, GIM_HV_SAVED_STATE_VERSION); 363 374 364 375 /** @todo Save per-VCPU data. */ … … 367 378 * Save per-VM MSRs. 368 379 */ 369 rc = SSMR3PutU64(pSSM, pcHv->u64GuestOsIdMsr); AssertRCReturn(rc, rc);370 rc = SSMR3PutU64(pSSM, pcHv->u64HypercallMsr); AssertRCReturn(rc, rc);371 rc = SSMR3PutU64(pSSM, pcHv->u64TscPageMsr); AssertRCReturn(rc, rc);380 SSMR3PutU64(pSSM, pcHv->u64GuestOsIdMsr); 381 SSMR3PutU64(pSSM, pcHv->u64HypercallMsr); 382 SSMR3PutU64(pSSM, pcHv->u64TscPageMsr); 372 383 373 384 /* 374 385 * Save Hyper-V features / capabilities. 375 386 */ 376 rc = SSMR3PutU32(pSSM, pcHv->uBaseFeat); AssertRCReturn(rc, rc);377 rc = SSMR3PutU32(pSSM, pcHv->uPartFlags); AssertRCReturn(rc, rc);378 rc = SSMR3PutU32(pSSM, pcHv->uPowMgmtFeat); AssertRCReturn(rc, rc);379 rc = SSMR3PutU32(pSSM, pcHv->uMiscFeat); AssertRCReturn(rc, rc);380 rc = SSMR3PutU32(pSSM, pcHv->uHyperHints); AssertRCReturn(rc, rc);381 rc = SSMR3PutU32(pSSM, pcHv->uHyperCaps); AssertRCReturn(rc, rc);387 SSMR3PutU32(pSSM, pcHv->uBaseFeat); 388 SSMR3PutU32(pSSM, pcHv->uPartFlags); 389 SSMR3PutU32(pSSM, pcHv->uPowMgmtFeat); 390 SSMR3PutU32(pSSM, pcHv->uMiscFeat); 391 SSMR3PutU32(pSSM, pcHv->uHyperHints); 392 SSMR3PutU32(pSSM, pcHv->uHyperCaps); 382 393 383 394 /* … … 385 396 */ 386 397 PCGIMMMIO2REGION pcRegion = &pcHv->aMmio2Regions[GIM_HV_HYPERCALL_PAGE_REGION_IDX]; 387 rc = SSMR3PutU8(pSSM, pcRegion->iRegion); AssertRCReturn(rc, rc);388 rc = SSMR3PutBool(pSSM, pcRegion->fRCMapping); AssertRCReturn(rc, rc);389 rc = SSMR3PutU32(pSSM, pcRegion->cbRegion); AssertRCReturn(rc, rc);390 rc = SSMR3PutGCPhys(pSSM, pcRegion->GCPhysPage); AssertRCReturn(rc, rc);391 rc = SSMR3PutStrZ(pSSM, pcRegion->szDescription); AssertRCReturn(rc, rc);398 SSMR3PutU8(pSSM, pcRegion->iRegion); 399 SSMR3PutBool(pSSM, pcRegion->fRCMapping); 400 SSMR3PutU32(pSSM, pcRegion->cbRegion); 401 SSMR3PutGCPhys(pSSM, pcRegion->GCPhysPage); 402 SSMR3PutStrZ(pSSM, pcRegion->szDescription); 392 403 393 404 /* … … 395 406 */ 396 407 pcRegion = &pcHv->aMmio2Regions[GIM_HV_REF_TSC_PAGE_REGION_IDX]; 397 rc = SSMR3PutU8(pSSM, pcRegion->iRegion); AssertRCReturn(rc, rc);398 rc = SSMR3PutBool(pSSM, pcRegion->fRCMapping); AssertRCReturn(rc, rc);399 rc = SSMR3PutU32(pSSM, pcRegion->cbRegion); AssertRCReturn(rc, rc);400 rc = SSMR3PutGCPhys(pSSM, pcRegion->GCPhysPage); AssertRCReturn(rc, rc);401 rc = SSMR3PutStrZ(pSSM, pcRegion->szDescription); AssertRCReturn(rc, rc);408 SSMR3PutU8(pSSM, pcRegion->iRegion); 409 SSMR3PutBool(pSSM, pcRegion->fRCMapping); 410 SSMR3PutU32(pSSM, pcRegion->cbRegion); 411 SSMR3PutGCPhys(pSSM, pcRegion->GCPhysPage); 412 SSMR3PutStrZ(pSSM, pcRegion->szDescription); 402 413 /* Save the TSC sequence so we can bump it on restore (as the CPU frequency/offset may change). */ 403 414 uint32_t uTscSequence = 0; … … 408 419 uTscSequence = pcRefTsc->u32TscSequence; 409 420 } 410 rc = SSMR3PutU32(pSSM, uTscSequence); AssertRCReturn(rc, rc); 411 412 return VINF_SUCCESS; 421 422 return SSMR3PutU32(pSSM, uTscSequence); 413 423 } 414 424 … … 429 439 * Load the Hyper-V SSM version first. 430 440 */ 431 uint32_t uHvSSMVersion; 432 int rc = SSMR3GetU32(pSSM, &uHvSSMVersion); AssertRCReturn(rc, rc); 441 uint32_t uHvSavedStatVersion; 442 int rc = SSMR3GetU32(pSSM, &uHvSavedStatVersion); 443 AssertRCReturn(rc, rc); 444 if (uHvSavedStatVersion != GIM_HV_SAVED_STATE_VERSION) 445 return SSMR3SetLoadError(pSSM, VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION, RT_SRC_POS, 446 N_("Unsupported Hyper-V saved state version %u (expected %u)."), 447 uHvSavedStatVersion, GIM_HV_SAVED_STATE_VERSION); 448 433 449 434 450 /** @todo Load per-VCPU data. */ … … 437 453 * Load per-VM MSRs. 438 454 */ 439 rc = SSMR3GetU64(pSSM, &pHv->u64GuestOsIdMsr); AssertRCReturn(rc, rc);440 rc = SSMR3GetU64(pSSM, &pHv->u64HypercallMsr); AssertRCReturn(rc, rc);441 rc = SSMR3GetU64(pSSM, &pHv->u64TscPageMsr); AssertRCReturn(rc, rc);455 SSMR3GetU64(pSSM, &pHv->u64GuestOsIdMsr); 456 SSMR3GetU64(pSSM, &pHv->u64HypercallMsr); 457 SSMR3GetU64(pSSM, &pHv->u64TscPageMsr); 442 458 443 459 /* 444 460 * Load Hyper-V features / capabilities. 445 461 */ 446 rc = SSMR3GetU32(pSSM, &pHv->uBaseFeat); AssertRCReturn(rc, rc);447 rc = SSMR3GetU32(pSSM, &pHv->uPartFlags); AssertRCReturn(rc, rc);448 rc = SSMR3GetU32(pSSM, &pHv->uPowMgmtFeat); AssertRCReturn(rc, rc);449 rc = SSMR3GetU32(pSSM, &pHv->uMiscFeat); AssertRCReturn(rc, rc);450 rc = SSMR3GetU32(pSSM, &pHv->uHyperHints); AssertRCReturn(rc, rc);451 rc = SSMR3GetU32(pSSM, &pHv->uHyperCaps); AssertRCReturn(rc, rc);462 SSMR3GetU32(pSSM, &pHv->uBaseFeat); 463 SSMR3GetU32(pSSM, &pHv->uPartFlags); 464 SSMR3GetU32(pSSM, &pHv->uPowMgmtFeat); 465 SSMR3GetU32(pSSM, &pHv->uMiscFeat); 466 SSMR3GetU32(pSSM, &pHv->uHyperHints); 467 SSMR3GetU32(pSSM, &pHv->uHyperCaps); 452 468 453 469 /* … … 455 471 */ 456 472 PGIMMMIO2REGION pRegion = &pHv->aMmio2Regions[GIM_HV_HYPERCALL_PAGE_REGION_IDX]; 457 rc = SSMR3GetU8(pSSM, &pRegion->iRegion); AssertRCReturn(rc, rc);458 rc = SSMR3GetBool(pSSM, &pRegion->fRCMapping); AssertRCReturn(rc, rc);459 rc = SSMR3GetU32(pSSM, &pRegion->cbRegion); AssertRCReturn(rc, rc);460 rc = SSMR3GetGCPhys(pSSM, &pRegion->GCPhysPage); AssertRCReturn(rc, rc);461 rc = SSMR3GetStrZ(pSSM, 473 SSMR3GetU8(pSSM, &pRegion->iRegion); 474 SSMR3GetBool(pSSM, &pRegion->fRCMapping); 475 SSMR3GetU32(pSSM, &pRegion->cbRegion); 476 SSMR3GetGCPhys(pSSM, &pRegion->GCPhysPage); 477 rc = SSMR3GetStrZ(pSSM, pRegion->szDescription, sizeof(pRegion->szDescription)); 462 478 AssertRCReturn(rc, rc); 463 479 if (MSR_GIM_HV_HYPERCALL_IS_ENABLED(pHv->u64HypercallMsr)) … … 480 496 uint32_t uTscSequence; 481 497 pRegion = &pHv->aMmio2Regions[GIM_HV_REF_TSC_PAGE_REGION_IDX]; 482 rc = SSMR3GetU8(pSSM, &pRegion->iRegion); AssertRCReturn(rc, rc);483 rc = SSMR3GetBool(pSSM, &pRegion->fRCMapping); AssertRCReturn(rc, rc);484 rc = SSMR3GetU32(pSSM, &pRegion->cbRegion); AssertRCReturn(rc, rc);485 rc = SSMR3GetGCPhys(pSSM, &pRegion->GCPhysPage); AssertRCReturn(rc, rc);486 rc =SSMR3GetStrZ(pSSM, pRegion->szDescription, sizeof(pRegion->szDescription));487 rc = SSMR3GetU32(pSSM, &uTscSequence); AssertRCReturn(rc, rc);498 SSMR3GetU8(pSSM, &pRegion->iRegion); 499 SSMR3GetBool(pSSM, &pRegion->fRCMapping); 500 SSMR3GetU32(pSSM, &pRegion->cbRegion); 501 SSMR3GetGCPhys(pSSM, &pRegion->GCPhysPage); 502 SSMR3GetStrZ(pSSM, pRegion->szDescription, sizeof(pRegion->szDescription)); 503 rc = SSMR3GetU32(pSSM, &uTscSequence); 488 504 AssertRCReturn(rc, rc); 489 505 if (MSR_GIM_HV_REF_TSC_IS_ENABLED(pHv->u64TscPageMsr)) -
trunk/src/VBox/VMM/include/GIMInternal.h
r52247 r52761 32 32 33 33 /** The saved state version. */ 34 #define GIM_S SM_VERSION134 #define GIM_SAVED_STATE_VERSION 1 35 35 36 36 /**
Note:
See TracChangeset
for help on using the changeset viewer.