Changeset 61847 in vbox for trunk/src/VBox/VMM
- Timestamp:
- Jun 23, 2016 12:03:01 PM (9 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/APICAll.cpp
r61807 r61847 598 598 * @param enmDeliveryMode The delivery mode. 599 599 * @param pDestCpuSet The destination CPU set. 600 * @param pfIntrAccepted Where to store whether this interrupt was 601 * accepted by the target APIC(s) or not. 602 * Optional, can be NULL. 600 603 * @param rcRZ The return code if the operation cannot be 601 604 * performed in the current context. 602 605 */ 603 606 static VBOXSTRICTRC apicSendIntr(PVM pVM, PVMCPU pVCpu, uint8_t uVector, XAPICTRIGGERMODE enmTriggerMode, 604 XAPICDELIVERYMODE enmDeliveryMode, PCVMCPUSET pDestCpuSet, int rcRZ) 605 { 606 VBOXSTRICTRC rcStrict = VINF_SUCCESS; 607 VMCPUID const cCpus = pVM->cCpus; 607 XAPICDELIVERYMODE enmDeliveryMode, PCVMCPUSET pDestCpuSet, bool *pfIntrAccepted, int rcRZ) 608 { 609 VBOXSTRICTRC rcStrict = VINF_SUCCESS; 610 VMCPUID const cCpus = pVM->cCpus; 611 bool fAccepted = false; 608 612 switch (enmDeliveryMode) 609 613 { … … 614 618 if ( VMCPUSET_IS_PRESENT(pDestCpuSet, idCpu) 615 619 && apicIsEnabled(&pVM->aCpus[idCpu])) 616 apicPostInterrupt(&pVM->aCpus[idCpu], uVector, enmTriggerMode);620 fAccepted = apicPostInterrupt(&pVM->aCpus[idCpu], uVector, enmTriggerMode); 617 621 } 618 622 break; … … 624 628 if ( idCpu < pVM->cCpus 625 629 && apicIsEnabled(&pVM->aCpus[idCpu])) 626 apicPostInterrupt(&pVM->aCpus[idCpu], uVector, enmTriggerMode);630 fAccepted = apicPostInterrupt(&pVM->aCpus[idCpu], uVector, enmTriggerMode); 627 631 else 628 Log2(("APIC: apicSendIntr: No CPU found for lowest-priority delivery mode!\n"));632 AssertMsgFailed(("APIC: apicSendIntr: No CPU found for lowest-priority delivery mode!\n")); 629 633 break; 630 634 } … … 638 642 Log2(("APIC: apicSendIntr: Raising SMI on VCPU%u\n", idCpu)); 639 643 apicSetInterruptFF(&pVM->aCpus[idCpu], PDMAPICIRQ_SMI); 644 fAccepted = true; 640 645 } 641 646 } … … 652 657 Log2(("APIC: apicSendIntr: Raising NMI on VCPU%u\n", idCpu)); 653 658 apicSetInterruptFF(&pVM->aCpus[idCpu], PDMAPICIRQ_NMI); 659 fAccepted = true; 654 660 } 655 661 } … … 665 671 Log2(("APIC: apicSendIntr: Issuing INIT to VCPU%u\n", idCpu)); 666 672 VMMR3SendInitIpi(pVM, idCpu); 673 fAccepted = true; 667 674 } 668 675 #else 669 676 /* We need to return to ring-3 to deliver the INIT. */ 670 677 rcStrict = rcRZ; 678 fAccepted = true; 671 679 #endif 672 680 break; … … 681 689 Log2(("APIC: apicSendIntr: Issuing SIPI to VCPU%u\n", idCpu)); 682 690 VMMR3SendStartupIpi(pVM, idCpu, uVector); 691 fAccepted = true; 683 692 } 684 693 #else 685 694 /* We need to return to ring-3 to deliver the SIPI. */ 686 695 rcStrict = rcRZ; 696 fAccepted = true; 687 697 Log2(("APIC: apicSendIntr: SIPI issued, returning to RZ. rc=%Rrc\n", rcRZ)); 688 698 #endif … … 697 707 Log2(("APIC: apicSendIntr: Raising EXTINT on VCPU%u\n", idCpu)); 698 708 apicSetInterruptFF(&pVM->aCpus[idCpu], PDMAPICIRQ_EXTINT); 709 fAccepted = true; 699 710 } 700 711 break; … … 735 746 } 736 747 } 748 749 if (pfIntrAccepted) 750 *pfIntrAccepted = fAccepted; 751 737 752 return rcStrict; 738 753 } … … 1006 1021 } 1007 1022 1008 return apicSendIntr(pVCpu->CTX_SUFF(pVM), pVCpu, uVector, enmTriggerMode, enmDeliveryMode, &DestCpuSet, rcRZ); 1023 return apicSendIntr(pVCpu->CTX_SUFF(pVM), pVCpu, uVector, enmTriggerMode, enmDeliveryMode, &DestCpuSet, 1024 NULL /* pfIntrAccepted */, rcRZ); 1009 1025 } 1010 1026 … … 1254 1270 apicSignalNextPendingIntr(pVCpu); 1255 1271 } 1272 else 1273 AssertMsgFailed(("APIC%u: apicSetEoi: Failed to find any ISR bit\n", pVCpu->idCpu)); 1256 1274 1257 1275 return VINF_SUCCESS; … … 2275 2293 uVector)); 2276 2294 2295 bool fIntrAccepted; 2277 2296 VMCPUSET DestCpuSet; 2278 2297 apicGetDestCpuSet(pVM, fDestMask, fBroadcastMask, enmDestMode, enmDeliveryMode, &DestCpuSet); 2279 2298 VBOXSTRICTRC rcStrict = apicSendIntr(pVM, NULL /* pVCpu */, uVector, enmTriggerMode, enmDeliveryMode, &DestCpuSet, 2280 VINF_SUCCESS /* rcRZ */); 2281 return VBOXSTRICTRC_VAL(rcStrict); 2299 &fIntrAccepted, VINF_SUCCESS /* rcRZ */); 2300 if (fIntrAccepted) 2301 return VBOXSTRICTRC_VAL(rcStrict); 2302 return VERR_APIC_INTR_DISCARDED; 2282 2303 } 2283 2304 … … 2379 2400 VMCPUSET_ADD(&DestCpuSet, pVCpu->idCpu); 2380 2401 rcStrict = apicSendIntr(pVCpu->CTX_SUFF(pVM), pVCpu, uVector, enmTriggerMode, enmDeliveryMode, 2381 &DestCpuSet, rcRZ);2402 &DestCpuSet, NULL /* pfIntrAccepted */, rcRZ); 2382 2403 } 2383 2404 break; … … 2392 2413 uint8_t const uVector = XAPIC_LVT_GET_VECTOR(uLvt); 2393 2414 rcStrict = apicSendIntr(pVCpu->CTX_SUFF(pVM), pVCpu, uVector, enmTriggerMode, enmDeliveryMode, &DestCpuSet, 2394 rcRZ);2415 NULL /* pfIntrAccepted */, rcRZ); 2395 2416 break; 2396 2417 } … … 2600 2621 * Don't use this function to try and deliver ExtINT style interrupts. 2601 2622 * 2623 * @returns true if the interrupt was accepted, false otherwise. 2602 2624 * @param pVCpu The cross context virtual CPU structure. 2603 2625 * @param uVector The vector of the interrupt to be posted. … … 2606 2628 * @thread Any. 2607 2629 */ 2608 VMM_INT_DECL( void) apicPostInterrupt(PVMCPU pVCpu, uint8_t uVector, XAPICTRIGGERMODE enmTriggerMode)2630 VMM_INT_DECL(bool) apicPostInterrupt(PVMCPU pVCpu, uint8_t uVector, XAPICTRIGGERMODE enmTriggerMode) 2609 2631 { 2610 2632 Assert(pVCpu); 2611 2633 Assert(uVector > XAPIC_ILLEGAL_VECTOR_END); 2612 2634 2613 PVM pVM = pVCpu->CTX_SUFF(pVM); 2614 PCAPIC pApic = VM_TO_APIC(pVM); 2615 PAPICCPU pApicCpu = VMCPU_TO_APICCPU(pVCpu); 2635 PVM pVM = pVCpu->CTX_SUFF(pVM); 2636 PCAPIC pApic = VM_TO_APIC(pVM); 2637 PAPICCPU pApicCpu = VMCPU_TO_APICCPU(pVCpu); 2638 bool fAccepted = true; 2616 2639 2617 2640 STAM_PROFILE_START(&pApicCpu->StatPostIntr, a); … … 2630 2653 if (!apicTestVectorInReg(&pXApicPage->irr, uVector)) /* PAV */ 2631 2654 { 2632 Log2(("APIC: APICPostInterrupt: SrcCpu=%u TargetCpu=%u uVector=%#x\n", VMMGetCpuId(pVM), pVCpu->idCpu, uVector));2655 Log2(("APIC: apicPostInterrupt: SrcCpu=%u TargetCpu=%u uVector=%#x\n", VMMGetCpuId(pVM), pVCpu->idCpu, uVector)); 2633 2656 if (enmTriggerMode == XAPICTRIGGERMODE_EDGE) 2634 2657 { … … 2641 2664 if (!fAlreadySet) 2642 2665 { 2643 Log2(("APIC: APICPostInterrupt: Setting UPDATE_APIC FF for edge-triggered intr. uVector=%#x\n", uVector));2666 Log2(("APIC: apicPostInterrupt: Setting UPDATE_APIC FF for edge-triggered intr. uVector=%#x\n", uVector)); 2644 2667 apicSetInterruptFF(pVCpu, PDMAPICIRQ_UPDATE_PENDING); 2645 2668 } … … 2656 2679 if (!fAlreadySet) 2657 2680 { 2658 Log2(("APIC: APICPostInterrupt: Setting UPDATE_APIC FF for level-triggered intr. uVector=%#x\n", uVector));2681 Log2(("APIC: apicPostInterrupt: Setting UPDATE_APIC FF for level-triggered intr. uVector=%#x\n", uVector)); 2659 2682 apicSetInterruptFF(pVCpu, PDMAPICIRQ_UPDATE_PENDING); 2660 2683 } … … 2663 2686 else 2664 2687 { 2665 Log2(("APIC: APICPostInterrupt: SrcCpu=%u TargetCpu=%u. Vector %#x Already in IRR, skipping\n", VMMGetCpuId(pVM),2688 Log2(("APIC: apicPostInterrupt: SrcCpu=%u TargetCpu=%u. Vector %#x Already in IRR, skipping\n", VMMGetCpuId(pVM), 2666 2689 pVCpu->idCpu, uVector)); 2667 2690 STAM_COUNTER_INC(&pApicCpu->StatPostIntrAlreadyPending); … … 2669 2692 } 2670 2693 else 2694 { 2695 fAccepted = false; 2671 2696 apicSetError(pVCpu, XAPIC_ESR_RECV_ILLEGAL_VECTOR); 2697 } 2672 2698 2673 2699 STAM_PROFILE_STOP(&pApicCpu->StatPostIntr, a); 2700 return fAccepted; 2674 2701 } 2675 2702 … … 2817 2844 2818 2845 /* Update edge-triggered pending interrupts. */ 2846 PAPICPIB pPib = (PAPICPIB)pApicCpu->CTX_SUFF(pvApicPib); 2819 2847 for (;;) 2820 2848 { … … 2823 2851 break; 2824 2852 2825 PAPICPIB pPib = (PAPICPIB)pApicCpu->CTX_SUFF(pvApicPib);2826 2853 AssertCompile(RT_ELEMENTS(pXApicPage->irr.u) == 2 * RT_ELEMENTS(pPib->aVectorBitmap)); 2827 2828 2854 for (size_t idxPib = 0, idxReg = 0; idxPib < RT_ELEMENTS(pPib->aVectorBitmap); idxPib++, idxReg += 2) 2829 2855 { … … 2845 2871 2846 2872 /* Update level-triggered pending interrupts. */ 2873 pPib = (PAPICPIB)&pApicCpu->ApicPibLevel; 2847 2874 for (;;) 2848 2875 { … … 2851 2878 break; 2852 2879 2853 PAPICPIB pPib = (PAPICPIB)&pApicCpu->ApicPibLevel;2854 2880 AssertCompile(RT_ELEMENTS(pXApicPage->irr.u) == 2 * RT_ELEMENTS(pPib->aVectorBitmap)); 2855 2856 2881 for (size_t idxPib = 0, idxReg = 0; idxPib < RT_ELEMENTS(pPib->aVectorBitmap); idxPib++, idxReg += 2) 2857 2882 { -
trunk/src/VBox/VMM/VMMAll/PDMAll.cpp
r61685 r61847 64 64 * The local APIC has a higher priority than the PIC. 65 65 */ 66 int rc = VERR_NO_DATA; 66 67 if (VMCPU_FF_IS_SET(pVCpu, VMCPU_FF_INTERRUPT_APIC)) 67 68 { … … 71 72 uint32_t uTagSrc; 72 73 uint8_t uVector; 73 intrc = pVM->pdm.s.Apic.CTX_SUFF(pfnGetInterrupt)(pVM->pdm.s.Apic.CTX_SUFF(pDevIns), pVCpu, &uVector, &uTagSrc);74 rc = pVM->pdm.s.Apic.CTX_SUFF(pfnGetInterrupt)(pVM->pdm.s.Apic.CTX_SUFF(pDevIns), pVCpu, &uVector, &uTagSrc); 74 75 if (RT_SUCCESS(rc)) 75 76 { … … 119 120 120 121 pdmUnlock(pVM); 121 return VERR_NO_DATA;122 return rc; 122 123 } 123 124 -
trunk/src/VBox/VMM/VMMR3/APIC.cpp
r61812 r61847 1797 1797 } while(0) 1798 1798 1799 bool const fHasRC = !HMIsEnabled (pVM);1799 bool const fHasRC = !HMIsEnabledNotMacro(pVM); 1800 1800 for (VMCPUID idCpu = 0; idCpu < pVM->cCpus; idCpu++) 1801 1801 { -
trunk/src/VBox/VMM/include/APICInternal.h
r61809 r61847 1442 1442 uint8_t uVector, uint8_t uPolarity, uint8_t uTriggerMode, uint32_t uTagSrc); 1443 1443 1444 VMM_INT_DECL( void) apicPostInterrupt(PVMCPU pVCpu, uint8_t uVector, XAPICTRIGGERMODE enmTriggerMode);1444 VMM_INT_DECL(bool) apicPostInterrupt(PVMCPU pVCpu, uint8_t uVector, XAPICTRIGGERMODE enmTriggerMode); 1445 1445 VMM_INT_DECL(void) apicStartTimer(PVMCPU pVCpu, uint32_t uInitialCount); 1446 1446 VMM_INT_DECL(void) apicStopTimer(PVMCPU pVCpu);
Note:
See TracChangeset
for help on using the changeset viewer.