Changeset 60593 in vbox for trunk/src/VBox
- Timestamp:
- Apr 20, 2016 11:02:38 AM (9 years ago)
- svn:sync-xref-src-repo-rev:
- 106732
- Location:
- trunk/src/VBox
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/testcase/tstDeviceStructSizeRC.cpp
r60516 r60593 793 793 GEN_CHECK_OFF(APICCPU, StatMsrWriteRC); 794 794 GEN_CHECK_OFF(APICCPU, StatUpdatePendingIntrs); 795 GEN_CHECK_OFF(APICCPU, StatPostInterrupt); 795 GEN_CHECK_OFF(APICCPU, StatPostIntr); 796 GEN_CHECK_OFF(APICCPU, StatPostIntrAlreadyPending); 796 797 #else 797 798 /* PC/DevAPIC.cpp */ -
trunk/src/VBox/VMM/VMMAll/APICAll.cpp
r60573 r60593 58 58 * @param uVector The vector to check if set. 59 59 */ 60 DECLINLINE(bool) apicTestVectorInReg( volatile XAPIC256BITREG *pApicReg, uint8_t uVector)61 { 62 volatile uint8_t *pbBitmap = (volatile uint8_t *)&pApicReg->u[0];60 DECLINLINE(bool) apicTestVectorInReg(const volatile XAPIC256BITREG *pApicReg, uint8_t uVector) 61 { 62 const volatile uint8_t *pbBitmap = (const volatile uint8_t *)&pApicReg->u[0]; 63 63 return ASMBitTest(pbBitmap + XAPIC_REG256_VECTOR_OFF(uVector), XAPIC_REG256_VECTOR_BIT(uVector)); 64 64 } … … 2420 2420 PAPICCPU pApicCpu = VMCPU_TO_APICCPU(pVCpu); 2421 2421 2422 STAM_PROFILE_START(&pApicCpu->StatPostInterrupt, a); 2423 2424 /* Validate the vector. See Intel spec. 10.5.2 "Valid Interrupt Vectors". */ 2422 STAM_PROFILE_START(&pApicCpu->StatPostIntr, a); 2423 2424 /* 2425 * Only post valid interrupt vectors. 2426 * See Intel spec. 10.5.2 "Valid Interrupt Vectors". 2427 */ 2425 2428 if (RT_LIKELY(uVector > XAPIC_ILLEGAL_VECTOR_END)) 2426 2429 { 2427 Log4(("APIC%u: APICPostInterrupt: uVector=%#x\n", pVCpu->idCpu, uVector)); 2428 if (enmTriggerMode == XAPICTRIGGERMODE_EDGE) 2429 { 2430 if (pApic->fPostedIntrsEnabled) 2431 { /** @todo posted-interrupt call to hardware */ } 2430 /* 2431 * If the interrupt is already pending in the vIRR we can skip the 2432 * potential expensive operation of poking the guest EMT out of execution. 2433 */ 2434 PCXAPICPAGE pXApicPage = VMCPU_TO_CXAPICPAGE(pVCpu); 2435 if (!apicTestVectorInReg(&pXApicPage->irr, uVector)) /* PAV */ 2436 { 2437 Log4(("APIC%u: APICPostInterrupt: uVector=%#x\n", pVCpu->idCpu, uVector)); 2438 if (enmTriggerMode == XAPICTRIGGERMODE_EDGE) 2439 { 2440 if (pApic->fPostedIntrsEnabled) 2441 { /** @todo posted-interrupt call to hardware */ } 2442 else 2443 { 2444 Assert(CTX_SUFF(pApicCpu->pvApicPib)); 2445 apicSetVectorInPib(CTX_SUFF(pApicCpu->pvApicPib), uVector); 2446 bool const fAlreadySet = apicSetNotificationBitInPib(CTX_SUFF(pApicCpu->pvApicPib)); 2447 if (!fAlreadySet) 2448 APICSetInterruptFF(pVCpu, PDMAPICIRQ_HARDWARE); 2449 } 2450 } 2432 2451 else 2433 2452 { 2434 Assert(CTX_SUFF(pApicCpu->pvApicPib)); 2435 apicSetVectorInPib(CTX_SUFF(pApicCpu->pvApicPib), uVector); 2436 bool const fAlreadySet = apicSetNotificationBitInPib(CTX_SUFF(pApicCpu->pvApicPib)); 2453 /* 2454 * Level-triggered interrupts requires updating of the TMR and thus cannot be 2455 * delivered asynchronously. 2456 */ 2457 apicSetVectorInPib(&pApicCpu->ApicPibLevel.aVectorBitmap[0], uVector); 2458 bool const fAlreadySet = apicSetNotificationBitInPib(&pApicCpu->ApicPibLevel.aVectorBitmap[0]); 2437 2459 if (!fAlreadySet) 2438 2460 APICSetInterruptFF(pVCpu, PDMAPICIRQ_HARDWARE); … … 2440 2462 } 2441 2463 else 2442 { 2443 /* 2444 * Level-triggered interrupts requires updating of the TMR and thus cannot be 2445 * delivered asynchronously. 2446 */ 2447 apicSetVectorInPib(&pApicCpu->ApicPibLevel.aVectorBitmap[0], uVector); 2448 bool const fAlreadySet = apicSetNotificationBitInPib(&pApicCpu->ApicPibLevel.aVectorBitmap[0]); 2449 if (!fAlreadySet) 2450 APICSetInterruptFF(pVCpu, PDMAPICIRQ_HARDWARE); 2451 } 2464 STAM_COUNTER_INC(&pApicCpu->StatPostIntrAlreadyPending); 2452 2465 } 2453 2466 else 2454 2467 apicSetError(pVCpu, XAPIC_ESR_RECV_ILLEGAL_VECTOR); 2455 2468 2456 STAM_PROFILE_STOP(&pApicCpu->StatPostInt errupt, a);2469 STAM_PROFILE_STOP(&pApicCpu->StatPostIntr, a); 2457 2470 } 2458 2471 … … 2628 2641 2629 2642 PAPICPIB pPib = (PAPICPIB)CTX_SUFF(pApicCpu->pvApicPib); 2630 for (size_t i = 0; i < RT_ELEMENTS(pPib->aVectorBitmap); i++) 2631 { 2632 uint32_t const uFragment = ASMAtomicXchgU32(&pPib->aVectorBitmap[i], 0); 2633 if (uFragment) 2634 { 2635 pXApicPage->irr.u[i].u32Reg |= uFragment; 2636 pXApicPage->tmr.u[i].u32Reg &= ~uFragment; 2643 AssertCompile(RT_ELEMENTS(pXApicPage->irr.u) == 2 * RT_ELEMENTS(pPib->aVectorBitmap)); 2644 2645 for (size_t idxPib = 0, idxReg = 0; idxPib < RT_ELEMENTS(pPib->aVectorBitmap); idxPib++, idxReg += 2) 2646 { 2647 uint64_t const u64Fragment = ASMAtomicXchgU64(&pPib->aVectorBitmap[idxPib], 0); 2648 if (u64Fragment) 2649 { 2650 uint32_t const u32FragmentLo = RT_LO_U32(u64Fragment); 2651 uint32_t const u32FragmentHi = RT_HI_U32(u64Fragment); 2652 2653 pXApicPage->irr.u[idxReg].u32Reg |= u32FragmentLo; 2654 pXApicPage->irr.u[idxReg + 1].u32Reg |= u32FragmentHi; 2655 2656 pXApicPage->tmr.u[idxReg].u32Reg &= ~u32FragmentLo; 2657 pXApicPage->tmr.u[idxReg + 1].u32Reg &= ~u32FragmentHi; 2637 2658 } 2638 2659 } … … 2647 2668 2648 2669 PAPICPIB pPib = (PAPICPIB)&pApicCpu->ApicPibLevel; 2649 for (size_t i = 0; i < RT_ELEMENTS(pPib->aVectorBitmap); i++) 2650 { 2651 uint32_t const uFragment = ASMAtomicXchgU32(&pPib->aVectorBitmap[i], 0); 2652 if (uFragment) 2653 { 2654 pXApicPage->irr.u[i].u32Reg |= uFragment; 2655 pXApicPage->tmr.u[i].u32Reg |= uFragment; 2670 AssertCompile(RT_ELEMENTS(pXApicPage->irr.u) == 2 * RT_ELEMENTS(pPib->aVectorBitmap)); 2671 2672 for (size_t idxPib = 0, idxReg = 0; idxPib < RT_ELEMENTS(pPib->aVectorBitmap); idxPib++, idxReg += 2) 2673 { 2674 uint64_t const u64Fragment = ASMAtomicXchgU64(&pPib->aVectorBitmap[idxPib], 0); 2675 if (u64Fragment) 2676 { 2677 uint32_t const u32FragmentLo = RT_LO_U32(u64Fragment); 2678 uint32_t const u32FragmentHi = RT_HI_U32(u64Fragment); 2679 2680 pXApicPage->irr.u[idxReg].u32Reg |= u32FragmentLo; 2681 pXApicPage->irr.u[idxReg + 1].u32Reg |= u32FragmentHi; 2682 2683 pXApicPage->tmr.u[idxReg].u32Reg |= u32FragmentLo; 2684 pXApicPage->tmr.u[idxReg + 1].u32Reg |= u32FragmentHi; 2656 2685 } 2657 2686 } -
trunk/src/VBox/VMM/VMMR3/APIC.cpp
r60543 r60593 1184 1184 ApicReg.pfnLocalInterruptR3 = APICLocalInterrupt; 1185 1185 ApicReg.pfnGetTimerFreqR3 = APICGetTimerFreq; 1186 if (pApic->fRZEnabled) 1186 1187 /* 1188 * We always require R0 functionality (e.g. APICGetTpr() called by HMR0 VT-x/AMD-V code). 1189 * Hence, 'fRZEnabled' strictly only applies to MMIO and MSR read/write handlers returning 1190 * to ring-3. We still need other handlers like APICGetTpr() in ring-0 for now. 1191 */ 1187 1192 { 1188 1193 ApicReg.pszGetInterruptRC = "APICGetInterrupt"; … … 1264 1269 pApicCpu->pTimerR0 = TMTimerR0Ptr(pApicCpu->pTimerR3); 1265 1270 pApicCpu->pTimerRC = TMTimerRCPtr(pApicCpu->pTimerR3); 1266 #if 01267 rc = PDMR3CritSectInit(pVM, &pApicCpu->TimerCritSect, RT_SRC_POS, pApicCpu->szTimerDesc);1268 AssertRCReturn(rc, rc);1269 TMR3TimerSetCritSect(pApicCpu->pTimerR3, &pApicCpu->TimerCritSect);1270 #endif1271 1271 } 1272 1272 else … … 1332 1332 APIC_PROF_COUNTER(&pApicCpu->StatUpdatePendingIntrs, "Profiling of APICUpdatePendingInterrupts", 1333 1333 "/PROF/CPU%d/APIC/UpdatePendingInterrupts"); 1334 APIC_PROF_COUNTER(&pApicCpu->StatPostInterrupt, "Profiling of APICPostInterrupt", "/PROF/CPU%d/APIC/PostInterrupt"); 1335 } 1334 APIC_PROF_COUNTER(&pApicCpu->StatPostIntr, "Profiling of APICPostInterrupt", "/PROF/CPU%d/APIC/PostInterrupt"); 1335 1336 APIC_REG_COUNTER(&pApicCpu->StatPostIntrAlreadyPending, "Number of times an interrupt is already pending.", 1337 "/Devices/APIC/%u/PostInterruptAlreadyPending"); 1338 } 1339 # undef APIC_PROF_COUNTER 1336 1340 # undef APIC_REG_ACCESS_COUNTER 1337 1341 #endif -
trunk/src/VBox/VMM/include/APICInternal.h
r60542 r60593 473 473 /** Whether this VM has an IO-APIC. */ 474 474 bool fIoApicPresent; 475 /** Whether RZ is enabled or not ( required forMSR handling as well). */475 /** Whether RZ is enabled or not (applies to MSR handling as well). */ 476 476 bool fRZEnabled; 477 477 /** Alignment padding. */ … … 591 591 STAMPROFILE StatUpdatePendingIntrs; 592 592 /** Profiling of APICPostInterrupt(). */ 593 STAMPROFILE StatPostInterrupt; 593 STAMPROFILE StatPostIntr; 594 /** Number of times an interrupt is already pending in 595 * APICPostInterrupts().*/ 596 STAMCOUNTER StatPostIntrAlreadyPending; 594 597 /** @} */ 595 598 #endif
Note:
See TracChangeset
for help on using the changeset viewer.