VirtualBox

Changeset 60459 in vbox


Ignore:
Timestamp:
Apr 12, 2016 2:31:58 PM (9 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
106548
Message:

VMM/APIC: Don't forget to update level-triggered interrupts from the LevelPib to IRR and update TMR
for both level and edge-triggered interrupts.

Location:
trunk/src/VBox/VMM
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/APICAll.cpp

    r60456 r60459  
    158158 * @param   idxFragment     The index of the 32-bit fragment in @a
    159159 *                          pApicReg.
    160  * @param   u32Fragment     The 32-bit vector fragment.
     160 * @param   u32Fragment     The 32-bit vector fragment to OR.
    161161 */
    162162DECLINLINE(void) apicOrVectorsToReg(volatile XAPIC256BITREG *pApicReg, size_t idxFragment, uint32_t u32Fragment)
     
    164164    Assert(idxFragment < RT_ELEMENTS(pApicReg->u));
    165165    ASMAtomicOrU32(&pApicReg->u[idxFragment].u32Reg, u32Fragment);
     166}
     167
     168
     169/**
     170 * Atomically AND's a fragment (32 vectors) into an APIC
     171 * 256-bit sparse register.
     172 *
     173 * @param   pApicReg        The APIC 256-bit spare register.
     174 * @param   idxFragment     The index of the 32-bit fragment in @a
     175 *                          pApicReg.
     176 * @param   u32Fragment     The 32-bit vector fragment to AND.
     177 */
     178DECLINLINE(void) apicAndVectorsToReg(volatile XAPIC256BITREG *pApicReg, size_t idxFragment, uint32_t u32Fragment)
     179{
     180    Assert(idxFragment < RT_ELEMENTS(pApicReg->u));
     181    ASMAtomicAndU32(&pApicReg->u[idxFragment].u32Reg, u32Fragment);
    166182}
    167183
     
    12901306{
    12911307    Assert(pApicCpu);
    1292     Assert(TMTimerIsLockOwner(CTX_SUFF(pApicCpu->pTimer)));
     1308    Assert(TMTimerIsLockOwner(pApicCpu->CTX_SUFF(pTimer)));
    12931309
    12941310    if (   pApicCpu->uHintedTimerInitialCount != uInitialCount
     
    23972413
    23982414/**
    2399  * Updates pending interrupts from the pending interrupt bitmap to the IRR.
     2415 * Updates pending interrupts from the pending-interrupt bitmaps to the IRR.
    24002416 *
    24012417 * @param   pVCpu               The cross context virtual CPU structure.
     
    24072423    PAPICCPU   pApicCpu   = VMCPU_TO_APICCPU(pVCpu);
    24082424    PXAPICPAGE pXApicPage = VMCPU_TO_XAPICPAGE(pVCpu);
     2425
     2426    /* Update edge-triggered pending interrupts. */
    24092427    for (;;)
    24102428    {
     
    24182436            uint32_t const uFragment = ASMAtomicXchgU32(&pPib->aVectorBitmap[i], 0);
    24192437            if (uFragment)
     2438            {
     2439                apicOrVectorsToReg(&pXApicPage->irr,  i,  uFragment);
     2440                apicAndVectorsToReg(&pXApicPage->tmr, i, ~uFragment);
     2441            }
     2442        }
     2443    }
     2444
     2445    /* Update level-triggered pending interrupts. */
     2446    for (;;)
     2447    {
     2448        bool const fAlreadySet = apicClearNotificationBitInPib(&pApicCpu->ApicPibLevel);
     2449        if (!fAlreadySet)
     2450            break;
     2451
     2452        PAPICPIB pPib = (PAPICPIB)&pApicCpu->ApicPibLevel;
     2453        for (size_t i = 0; i < RT_ELEMENTS(pPib->aVectorBitmap); i++)
     2454        {
     2455            uint32_t const uFragment = ASMAtomicXchgU32(&pPib->aVectorBitmap[i], 0);
     2456            if (uFragment)
     2457            {
    24202458                apicOrVectorsToReg(&pXApicPage->irr, i, uFragment);
     2459                apicOrVectorsToReg(&pXApicPage->tmr, i, uFragment);
     2460            }
    24212461        }
    24222462    }
  • trunk/src/VBox/VMM/VMMR3/APIC.cpp

    r60456 r60459  
    384384    VMCPU_ASSERT_EMT_OR_NOT_RUNNING(pVCpu);
    385385
     386    LogFlow(("APIC%u: APICR3Reset\n", pVCpu->idCpu));
     387
    386388#ifdef RT_STRICT
    387389    /* Verify that the initial APIC ID reported via CPUID matches our VMCPU ID assumption. */
     
    429431{
    430432    VMCPU_ASSERT_EMT(pVCpu);
     433    LogFlow(("APIC%u: APICR3InitIpi\n", pVCpu->idCpu));
    431434    apicR3InitIpi(pVCpu);
    432435}
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette