Changeset 51686 in vbox
- Timestamp:
- Jun 23, 2014 5:40:05 AM (10 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 3 edited
-
VMMAll/GIMAllHv.cpp (modified) (1 diff)
-
VMMR3/GIMHv.cpp (modified) (8 diffs)
-
include/GIMHvInternal.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/GIMAllHv.cpp
r51658 r51686 215 215 /* Enable the TSC-page. */ 216 216 RTGCPHYS GCPhysTscPage = MSR_GIM_HV_REF_TSC_GUEST_PFN(uRawValue) << PAGE_SHIFT; 217 int rc = GIMR3HvEnableTscPage(pVM, GCPhysTscPage );217 int rc = GIMR3HvEnableTscPage(pVM, GCPhysTscPage, false /* fUseThisTscSequence */, 0 /* uTscSequence */); 218 218 if (RT_SUCCESS(rc)) 219 219 { -
trunk/src/VBox/VMM/VMMR3/GIMHv.cpp
r51659 r51686 96 96 | GIM_HV_BASE_FEAT_HYPERCALL_MSRS 97 97 | GIM_HV_BASE_FEAT_VP_ID_MSR 98 //| GIM_HV_BASE_FEAT_VIRT_SYS_RESET_MSR98 | GIM_HV_BASE_FEAT_VIRT_SYS_RESET_MSR 99 99 //| GIM_HV_BASE_FEAT_STAT_PAGES_MSR 100 100 | GIM_HV_BASE_FEAT_PART_REF_TSC_MSR … … 248 248 * Unmap MMIO2 pages that the guest may have setup. 249 249 */ 250 LogRel Func(("Resetting Hyper-V MMIO2 regions and MSRs...\n"));250 LogRel(("GIM: HyperV: Resetting Hyper-V MMIO2 regions and MSRs\n")); 251 251 PGIMHV pHv = &pVM->gim.s.u.Hv; 252 252 for (unsigned i = 0; i < RT_ELEMENTS(pHv->aMmio2Regions); i++) … … 313 313 314 314 /* 315 * Save per-VM MMIO2 regions. 316 */ 317 rc = SSMR3PutU32(pSSM, RT_ELEMENTS(pcHv->aMmio2Regions)); 318 for (unsigned i = 0; i < RT_ELEMENTS(pcHv->aMmio2Regions); i++) 319 { 320 /* Save the fields necessary to remap the regions upon load.*/ 321 PCGIMMMIO2REGION pcRegion = &pcHv->aMmio2Regions[i]; 322 rc = SSMR3PutU8(pSSM, pcRegion->iRegion); AssertRCReturn(rc, rc); 323 rc = SSMR3PutBool(pSSM, pcRegion->fRCMapping); AssertRCReturn(rc, rc); 324 rc = SSMR3PutU32(pSSM, pcRegion->cbRegion); AssertRCReturn(rc, rc); 325 rc = SSMR3PutGCPhys(pSSM, pcRegion->GCPhysPage); AssertRCReturn(rc, rc); 326 rc = SSMR3PutStrZ(pSSM, pcRegion->szDescription); AssertRCReturn(rc, rc); 327 } 315 * Save the Hypercall region. 316 */ 317 PCGIMMMIO2REGION pcRegion = &pcHv->aMmio2Regions[GIM_HV_HYPERCALL_PAGE_REGION_IDX]; 318 rc = SSMR3PutU8(pSSM, pcRegion->iRegion); AssertRCReturn(rc, rc); 319 rc = SSMR3PutBool(pSSM, pcRegion->fRCMapping); AssertRCReturn(rc, rc); 320 rc = SSMR3PutU32(pSSM, pcRegion->cbRegion); AssertRCReturn(rc, rc); 321 rc = SSMR3PutGCPhys(pSSM, pcRegion->GCPhysPage); AssertRCReturn(rc, rc); 322 rc = SSMR3PutStrZ(pSSM, pcRegion->szDescription); AssertRCReturn(rc, rc); 323 324 /* 325 * Save the reference TSC region. 326 */ 327 pcRegion = &pcHv->aMmio2Regions[GIM_HV_REF_TSC_PAGE_REGION_IDX]; 328 rc = SSMR3PutU8(pSSM, pcRegion->iRegion); AssertRCReturn(rc, rc); 329 rc = SSMR3PutBool(pSSM, pcRegion->fRCMapping); AssertRCReturn(rc, rc); 330 rc = SSMR3PutU32(pSSM, pcRegion->cbRegion); AssertRCReturn(rc, rc); 331 rc = SSMR3PutGCPhys(pSSM, pcRegion->GCPhysPage); AssertRCReturn(rc, rc); 332 rc = SSMR3PutStrZ(pSSM, pcRegion->szDescription); AssertRCReturn(rc, rc); 333 /* Save the TSC sequence so we can bump it on restore (as the CPU frequency/offset may change). */ 334 uint32_t uTscSequence = 0; 335 if ( pcRegion->fMapped 336 && MSR_GIM_HV_REF_TSC_IS_ENABLED(pcHv->u64TscPageMsr)) 337 { 338 PCGIMHVREFTSC pcRefTsc = (PCGIMHVREFTSC)pcRegion->pvPageR3; 339 uTscSequence = pcRefTsc->u32TscSequence; 340 } 341 rc = SSMR3PutU32(pSSM, uTscSequence); AssertRCReturn(rc, rc); 328 342 329 343 return VINF_SUCCESS; … … 362 376 363 377 /* 364 * Load per-VM MMIO2 regions. 365 */ 366 uint32_t cRegions; 367 rc = SSMR3GetU32(pSSM, &cRegions); 368 if (cRegions != RT_ELEMENTS(pHv->aMmio2Regions)) 369 { 370 LogRelFunc(("MMIO2 region array size mismatch. size=%u expected=%u\n", cRegions, RT_ELEMENTS(pHv->aMmio2Regions))); 371 return VERR_SSM_FIELD_INVALID_VALUE; 372 } 373 374 for (unsigned i = 0; i < RT_ELEMENTS(pHv->aMmio2Regions); i++) 375 { 376 /* The regions would have been registered while constructing the GIM device. */ 377 PGIMMMIO2REGION pRegion = &pHv->aMmio2Regions[i]; 378 rc = SSMR3GetU8(pSSM, &pRegion->iRegion); AssertRCReturn(rc, rc); 379 rc = SSMR3GetBool(pSSM, &pRegion->fRCMapping); AssertRCReturn(rc, rc); 380 rc = SSMR3GetU32(pSSM, &pRegion->cbRegion); AssertRCReturn(rc, rc); 381 rc = SSMR3GetGCPhys(pSSM, &pRegion->GCPhysPage); AssertRCReturn(rc, rc); 382 rc = SSMR3GetStrZ(pSSM, pRegion->szDescription, sizeof(pRegion->szDescription)); 383 AssertRCReturn(rc, rc); 384 } 385 386 /* 387 * Enable the Hypercall-page. 378 * Load and enable the Hypercall region. 388 379 */ 389 380 PGIMMMIO2REGION pRegion = &pHv->aMmio2Regions[GIM_HV_HYPERCALL_PAGE_REGION_IDX]; 381 rc = SSMR3GetU8(pSSM, &pRegion->iRegion); AssertRCReturn(rc, rc); 382 rc = SSMR3GetBool(pSSM, &pRegion->fRCMapping); AssertRCReturn(rc, rc); 383 rc = SSMR3GetU32(pSSM, &pRegion->cbRegion); AssertRCReturn(rc, rc); 384 rc = SSMR3GetGCPhys(pSSM, &pRegion->GCPhysPage); AssertRCReturn(rc, rc); 385 rc = SSMR3GetStrZ(pSSM, pRegion->szDescription, sizeof(pRegion->szDescription)); 386 AssertRCReturn(rc, rc); 390 387 if (MSR_GIM_HV_HYPERCALL_IS_ENABLED(pHv->u64HypercallMsr)) 391 388 { 392 389 Assert(pRegion->GCPhysPage != NIL_RTGCPHYS); 393 if ( pRegion->fRegistered)390 if (RT_LIKELY(pRegion->fRegistered)) 394 391 { 395 392 rc = GIMR3HvEnableHypercallPage(pVM, pRegion->GCPhysPage); … … 403 400 404 401 /* 405 * Enable the TSC-page. 406 */ 402 * Load and enable the reference TSC region. 403 */ 404 uint32_t uTscSequence; 407 405 pRegion = &pHv->aMmio2Regions[GIM_HV_REF_TSC_PAGE_REGION_IDX]; 406 rc = SSMR3GetU8(pSSM, &pRegion->iRegion); AssertRCReturn(rc, rc); 407 rc = SSMR3GetBool(pSSM, &pRegion->fRCMapping); AssertRCReturn(rc, rc); 408 rc = SSMR3GetU32(pSSM, &pRegion->cbRegion); AssertRCReturn(rc, rc); 409 rc = SSMR3GetGCPhys(pSSM, &pRegion->GCPhysPage); AssertRCReturn(rc, rc); 410 rc = SSMR3GetStrZ(pSSM, pRegion->szDescription, sizeof(pRegion->szDescription)); 411 rc = SSMR3GetU32(pSSM, &uTscSequence); AssertRCReturn(rc, rc); 412 AssertRCReturn(rc, rc); 408 413 if (MSR_GIM_HV_REF_TSC_IS_ENABLED(pHv->u64TscPageMsr)) 409 414 { … … 411 416 if (pRegion->fRegistered) 412 417 { 413 rc = GIMR3HvEnableTscPage(pVM, pRegion->GCPhysPage );418 rc = GIMR3HvEnableTscPage(pVM, pRegion->GCPhysPage, true /* fUseThisTscSeq */, uTscSequence); 414 419 if (RT_FAILURE(rc)) 415 420 return SSMR3SetCfgError(pSSM, RT_SRC_POS, N_("Failed to enable the TSC page. GCPhys=%#RGp rc=%Rrc"), … … 428 433 * 429 434 * @returns VBox status code. 430 * @param pVM Pointer to the VM. 431 * @param GCPhysTscPage Where to map the TSC page. 432 */ 433 VMMR3_INT_DECL(int) GIMR3HvEnableTscPage(PVM pVM, RTGCPHYS GCPhysTscPage) 435 * @param pVM Pointer to the VM. 436 * @param GCPhysTscPage Where to map the TSC page. 437 * @param fUseThisTscSequence Whether to set the TSC sequence number to 438 * the one specified in @a uTscSequence. 439 * @param uTscSequence The TSC sequence value to use. Ignored if @a 440 * fUseThisTscSequence is false. 441 */ 442 VMMR3_INT_DECL(int) GIMR3HvEnableTscPage(PVM pVM, RTGCPHYS GCPhysTscPage, bool fUseThisTscSequence, uint32_t uTscSequence) 434 443 { 435 444 PPDMDEVINSR3 pDevIns = pVM->gim.s.pDevInsR3; … … 473 482 474 483 uint64_t const u64TscKHz = TMCpuTicksPerSecond(pVM) / UINT64_C(1000); 475 pRefTsc->u32TscSequence = 1; 484 uint32_t u32TscSeq = 1; 485 if ( fUseThisTscSequence 486 && uTscSequence < UINT32_C(0xfffffffe)) 487 { 488 u32TscSeq = uTscSequence + 1; 489 } 490 pRefTsc->u32TscSequence = u32TscSeq; 476 491 pRefTsc->u64TscScale = ((INT64_C(10000) << 32) / u64TscKHz) << 32; 477 492 -
trunk/src/VBox/VMM/include/GIMHvInternal.h
r51658 r51686 511 511 512 512 VMMR3_INT_DECL(int) GIMR3HvDisableTscPage(PVM pVM); 513 VMMR3_INT_DECL(int) GIMR3HvEnableTscPage(PVM pVM, RTGCPHYS GCPhysTscPage );513 VMMR3_INT_DECL(int) GIMR3HvEnableTscPage(PVM pVM, RTGCPHYS GCPhysTscPage, bool fUseThisTscSequence, uint32_t uTscSequence); 514 514 VMMR3_INT_DECL(int) GIMR3HvDisableHypercallPage(PVM pVM); 515 515 VMMR3_INT_DECL(int) GIMR3HvEnableHypercallPage(PVM pVM, RTGCPHYS GCPhysHypercallPage);
Note:
See TracChangeset
for help on using the changeset viewer.

