Changeset 80346 in vbox for trunk/src/VBox/VMM/VMMR0/PDMR0Device.cpp
- Timestamp:
- Aug 19, 2019 7:36:29 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR0/PDMR0Device.cpp
r80334 r80346 60 60 * Internal Functions * 61 61 *********************************************************************************************************************************/ 62 static bool pdmR0IsaSetIrq(P VMCC pVM, int iIrq, int iLevel, uint32_t uTagSrc);62 static bool pdmR0IsaSetIrq(PGVM pGVM, int iIrq, int iLevel, uint32_t uTagSrc); 63 63 64 64 … … 132 132 LogFlow(("pdmR0DevHlp_PCISetIrq: caller=%p/%d: pPciDev=%p:{%#x} iIrq=%d iLevel=%d\n", 133 133 pDevIns, pDevIns->iInstance, pPciDev, pPciDev->uDevFn, iIrq, iLevel)); 134 P VMCC pVM= pDevIns->Internal.s.pVMR0;134 PGVM pGVM = pDevIns->Internal.s.pVMR0; 135 135 PPDMPCIBUS pPciBus = pPciDev->Int.s.pPdmBusR0; 136 136 137 pdmLock(p VM);137 pdmLock(pGVM); 138 138 uint32_t uTagSrc; 139 139 if (iLevel & PDM_IRQ_LEVEL_HIGH) 140 140 { 141 pDevIns->Internal.s.uLastIrqTag = uTagSrc = pdmCalcIrqTag(p VM, pDevIns->idTracing);141 pDevIns->Internal.s.uLastIrqTag = uTagSrc = pdmCalcIrqTag(pGVM, pDevIns->idTracing); 142 142 if (iLevel == PDM_IRQ_LEVEL_HIGH) 143 VBOXVMM_PDM_IRQ_HIGH(VMMGetCpu(p VM), RT_LOWORD(uTagSrc), RT_HIWORD(uTagSrc));143 VBOXVMM_PDM_IRQ_HIGH(VMMGetCpu(pGVM), RT_LOWORD(uTagSrc), RT_HIWORD(uTagSrc)); 144 144 else 145 VBOXVMM_PDM_IRQ_HILO(VMMGetCpu(p VM), RT_LOWORD(uTagSrc), RT_HIWORD(uTagSrc));145 VBOXVMM_PDM_IRQ_HILO(VMMGetCpu(pGVM), RT_LOWORD(uTagSrc), RT_HIWORD(uTagSrc)); 146 146 } 147 147 else … … 153 153 pPciBus->pfnSetIrqR0(pPciBus->pDevInsR0, pPciDev, iIrq, iLevel, uTagSrc); 154 154 155 pdmUnlock(p VM);155 pdmUnlock(pGVM); 156 156 157 157 if (iLevel == PDM_IRQ_LEVEL_LOW) 158 VBOXVMM_PDM_IRQ_LOW(VMMGetCpu(p VM), RT_LOWORD(uTagSrc), RT_HIWORD(uTagSrc));158 VBOXVMM_PDM_IRQ_LOW(VMMGetCpu(pGVM), RT_LOWORD(uTagSrc), RT_HIWORD(uTagSrc)); 159 159 } 160 160 else 161 161 { 162 pdmUnlock(p VM);162 pdmUnlock(pGVM); 163 163 164 164 /* queue for ring-3 execution. */ 165 PPDMDEVHLPTASK pTask = (PPDMDEVHLPTASK)PDMQueueAlloc(p VM->pdm.s.pDevHlpQueueR0);165 PPDMDEVHLPTASK pTask = (PPDMDEVHLPTASK)PDMQueueAlloc(pGVM->pdm.s.pDevHlpQueueR0); 166 166 AssertReturnVoid(pTask); 167 167 … … 171 171 pTask->u.PciSetIRQ.iLevel = iLevel; 172 172 pTask->u.PciSetIRQ.uTagSrc = uTagSrc; 173 pTask->u.PciSetIRQ.pPciDevR3 = MMHyperR0ToR3(p VM, pPciDev);174 175 PDMQueueInsertEx(p VM->pdm.s.pDevHlpQueueR0, &pTask->Core, 0);173 pTask->u.PciSetIRQ.pPciDevR3 = MMHyperR0ToR3(pGVM, pPciDev); 174 175 PDMQueueInsertEx(pGVM->pdm.s.pDevHlpQueueR0, &pTask->Core, 0); 176 176 } 177 177 … … 185 185 PDMDEV_ASSERT_DEVINS(pDevIns); 186 186 LogFlow(("pdmR0DevHlp_ISASetIrq: caller=%p/%d: iIrq=%d iLevel=%d\n", pDevIns, pDevIns->iInstance, iIrq, iLevel)); 187 P VMCC pVM = pDevIns->Internal.s.pVMR0;188 189 pdmLock(p VM);187 PGVM pGVM = pDevIns->Internal.s.pVMR0; 188 189 pdmLock(pGVM); 190 190 uint32_t uTagSrc; 191 191 if (iLevel & PDM_IRQ_LEVEL_HIGH) 192 192 { 193 pDevIns->Internal.s.uLastIrqTag = uTagSrc = pdmCalcIrqTag(p VM, pDevIns->idTracing);193 pDevIns->Internal.s.uLastIrqTag = uTagSrc = pdmCalcIrqTag(pGVM, pDevIns->idTracing); 194 194 if (iLevel == PDM_IRQ_LEVEL_HIGH) 195 VBOXVMM_PDM_IRQ_HIGH(VMMGetCpu(p VM), RT_LOWORD(uTagSrc), RT_HIWORD(uTagSrc));195 VBOXVMM_PDM_IRQ_HIGH(VMMGetCpu(pGVM), RT_LOWORD(uTagSrc), RT_HIWORD(uTagSrc)); 196 196 else 197 VBOXVMM_PDM_IRQ_HILO(VMMGetCpu(p VM), RT_LOWORD(uTagSrc), RT_HIWORD(uTagSrc));197 VBOXVMM_PDM_IRQ_HILO(VMMGetCpu(pGVM), RT_LOWORD(uTagSrc), RT_HIWORD(uTagSrc)); 198 198 } 199 199 else 200 200 uTagSrc = pDevIns->Internal.s.uLastIrqTag; 201 201 202 bool fRc = pdmR0IsaSetIrq(p VM, iIrq, iLevel, uTagSrc);202 bool fRc = pdmR0IsaSetIrq(pGVM, iIrq, iLevel, uTagSrc); 203 203 204 204 if (iLevel == PDM_IRQ_LEVEL_LOW && fRc) 205 VBOXVMM_PDM_IRQ_LOW(VMMGetCpu(p VM), RT_LOWORD(uTagSrc), RT_HIWORD(uTagSrc));206 pdmUnlock(p VM);205 VBOXVMM_PDM_IRQ_LOW(VMMGetCpu(pGVM), RT_LOWORD(uTagSrc), RT_HIWORD(uTagSrc)); 206 pdmUnlock(pGVM); 207 207 LogFlow(("pdmR0DevHlp_ISASetIrq: caller=%p/%d: returns void; uTagSrc=%#x\n", pDevIns, pDevIns->iInstance, uTagSrc)); 208 208 } … … 214 214 PDMDEV_ASSERT_DEVINS(pDevIns); 215 215 LogFlow(("pdmR0DevHlp_IoApicSendMsi: caller=%p/%d: GCPhys=%RGp uValue=%#x\n", pDevIns, pDevIns->iInstance, GCPhys, uValue)); 216 P VMCC pVM = pDevIns->Internal.s.pVMR0;216 PGVM pGVM = pDevIns->Internal.s.pVMR0; 217 217 218 218 uint32_t uTagSrc; 219 pDevIns->Internal.s.uLastIrqTag = uTagSrc = pdmCalcIrqTag(p VM, pDevIns->idTracing);220 VBOXVMM_PDM_IRQ_HILO(VMMGetCpu(p VM), RT_LOWORD(uTagSrc), RT_HIWORD(uTagSrc));221 222 if (p VM->pdm.s.IoApic.pDevInsR0)223 p VM->pdm.s.IoApic.pfnSendMsiR0(pVM->pdm.s.IoApic.pDevInsR0, GCPhys, uValue, uTagSrc);219 pDevIns->Internal.s.uLastIrqTag = uTagSrc = pdmCalcIrqTag(pGVM, pDevIns->idTracing); 220 VBOXVMM_PDM_IRQ_HILO(VMMGetCpu(pGVM), RT_LOWORD(uTagSrc), RT_HIWORD(uTagSrc)); 221 222 if (pGVM->pdm.s.IoApic.pDevInsR0) 223 pGVM->pdm.s.IoApic.pfnSendMsiR0(pGVM->pdm.s.IoApic.pDevInsR0, GCPhys, uValue, uTagSrc); 224 224 else 225 225 AssertFatalMsgFailed(("Lazy bastards!")); … … 518 518 { 519 519 PDMDEV_ASSERT_DEVINS(pDevIns); 520 P VMCC pVM = pDevIns->Internal.s.pVMR0;520 PGVM pGVM = pDevIns->Internal.s.pVMR0; 521 521 LogFlow(("pdmR0IoApicHlp_ApicBusDeliver: caller=%p/%d: u8Dest=%RX8 u8DestMode=%RX8 u8DeliveryMode=%RX8 uVector=%RX8 u8Polarity=%RX8 u8TriggerMode=%RX8 uTagSrc=%#x\n", 522 522 pDevIns, pDevIns->iInstance, u8Dest, u8DestMode, u8DeliveryMode, uVector, u8Polarity, u8TriggerMode, uTagSrc)); 523 return APICBusDeliver(p VM, u8Dest, u8DestMode, u8DeliveryMode, uVector, u8Polarity, u8TriggerMode, uTagSrc);523 return APICBusDeliver(pGVM, u8Dest, u8DestMode, u8DeliveryMode, uVector, u8Polarity, u8TriggerMode, uTagSrc); 524 524 } 525 525 … … 567 567 PDMDEV_ASSERT_DEVINS(pDevIns); 568 568 Log4(("pdmR0PciHlp_IsaSetIrq: iIrq=%d iLevel=%d uTagSrc=%#x\n", iIrq, iLevel, uTagSrc)); 569 P VMCC pVM = pDevIns->Internal.s.pVMR0;570 571 pdmLock(p VM);572 pdmR0IsaSetIrq(p VM, iIrq, iLevel, uTagSrc);573 pdmUnlock(p VM);569 PGVM pGVM = pDevIns->Internal.s.pVMR0; 570 571 pdmLock(pGVM); 572 pdmR0IsaSetIrq(pGVM, iIrq, iLevel, uTagSrc); 573 pdmUnlock(pGVM); 574 574 } 575 575 … … 580 580 PDMDEV_ASSERT_DEVINS(pDevIns); 581 581 Log4(("pdmR0PciHlp_IoApicSetIrq: iIrq=%d iLevel=%d uTagSrc=%#x\n", iIrq, iLevel, uTagSrc)); 582 P VMCC pVM = pDevIns->Internal.s.pVMR0;583 584 if (p VM->pdm.s.IoApic.pDevInsR0)585 p VM->pdm.s.IoApic.pfnSetIrqR0(pVM->pdm.s.IoApic.pDevInsR0, iIrq, iLevel, uTagSrc);586 else if (p VM->pdm.s.IoApic.pDevInsR3)582 PGVM pGVM = pDevIns->Internal.s.pVMR0; 583 584 if (pGVM->pdm.s.IoApic.pDevInsR0) 585 pGVM->pdm.s.IoApic.pfnSetIrqR0(pGVM->pdm.s.IoApic.pDevInsR0, iIrq, iLevel, uTagSrc); 586 else if (pGVM->pdm.s.IoApic.pDevInsR3) 587 587 { 588 588 /* queue for ring-3 execution. */ 589 PPDMDEVHLPTASK pTask = (PPDMDEVHLPTASK)PDMQueueAlloc(p VM->pdm.s.pDevHlpQueueR0);589 PPDMDEVHLPTASK pTask = (PPDMDEVHLPTASK)PDMQueueAlloc(pGVM->pdm.s.pDevHlpQueueR0); 590 590 if (pTask) 591 591 { … … 596 596 pTask->u.IoApicSetIRQ.uTagSrc = uTagSrc; 597 597 598 PDMQueueInsertEx(p VM->pdm.s.pDevHlpQueueR0, &pTask->Core, 0);598 PDMQueueInsertEx(pGVM->pdm.s.pDevHlpQueueR0, &pTask->Core, 0); 599 599 } 600 600 else … … 609 609 PDMDEV_ASSERT_DEVINS(pDevIns); 610 610 Log4(("pdmR0PciHlp_IoApicSendMsi: GCPhys=%p uValue=%d uTagSrc=%#x\n", GCPhys, uValue, uTagSrc)); 611 P VMCC pVM = pDevIns->Internal.s.pVMR0;612 if (p VM->pdm.s.IoApic.pDevInsR0)613 p VM->pdm.s.IoApic.pfnSendMsiR0(pVM->pdm.s.IoApic.pDevInsR0, GCPhys, uValue, uTagSrc);611 PGVM pGVM = pDevIns->Internal.s.pVMR0; 612 if (pGVM->pdm.s.IoApic.pDevInsR0) 613 pGVM->pdm.s.IoApic.pfnSendMsiR0(pGVM->pdm.s.IoApic.pDevInsR0, GCPhys, uValue, uTagSrc); 614 614 else 615 615 AssertFatalMsgFailed(("Lazy bastards!")); … … 784 784 * 785 785 * @returns true if delivered, false if postponed. 786 * @param p VM The cross contextVM structure.786 * @param pGVM The global (ring-0) VM structure. 787 787 * @param iIrq The irq. 788 788 * @param iLevel The new level. … … 791 791 * @remarks The caller holds the PDM lock. 792 792 */ 793 static bool pdmR0IsaSetIrq(P VMCC pVM, int iIrq, int iLevel, uint32_t uTagSrc)794 { 795 if (RT_LIKELY( ( p VM->pdm.s.IoApic.pDevInsR0796 || !p VM->pdm.s.IoApic.pDevInsR3)797 && ( p VM->pdm.s.Pic.pDevInsR0798 || !p VM->pdm.s.Pic.pDevInsR3)))793 static bool pdmR0IsaSetIrq(PGVM pGVM, int iIrq, int iLevel, uint32_t uTagSrc) 794 { 795 if (RT_LIKELY( ( pGVM->pdm.s.IoApic.pDevInsR0 796 || !pGVM->pdm.s.IoApic.pDevInsR3) 797 && ( pGVM->pdm.s.Pic.pDevInsR0 798 || !pGVM->pdm.s.Pic.pDevInsR3))) 799 799 { 800 if (p VM->pdm.s.Pic.pDevInsR0)801 p VM->pdm.s.Pic.pfnSetIrqR0(pVM->pdm.s.Pic.pDevInsR0, iIrq, iLevel, uTagSrc);802 if (p VM->pdm.s.IoApic.pDevInsR0)803 p VM->pdm.s.IoApic.pfnSetIrqR0(pVM->pdm.s.IoApic.pDevInsR0, iIrq, iLevel, uTagSrc);800 if (pGVM->pdm.s.Pic.pDevInsR0) 801 pGVM->pdm.s.Pic.pfnSetIrqR0(pGVM->pdm.s.Pic.pDevInsR0, iIrq, iLevel, uTagSrc); 802 if (pGVM->pdm.s.IoApic.pDevInsR0) 803 pGVM->pdm.s.IoApic.pfnSetIrqR0(pGVM->pdm.s.IoApic.pDevInsR0, iIrq, iLevel, uTagSrc); 804 804 return true; 805 805 } 806 806 807 807 /* queue for ring-3 execution. */ 808 PPDMDEVHLPTASK pTask = (PPDMDEVHLPTASK)PDMQueueAlloc(p VM->pdm.s.pDevHlpQueueR0);808 PPDMDEVHLPTASK pTask = (PPDMDEVHLPTASK)PDMQueueAlloc(pGVM->pdm.s.pDevHlpQueueR0); 809 809 AssertReturn(pTask, false); 810 810 … … 815 815 pTask->u.IsaSetIRQ.uTagSrc = uTagSrc; 816 816 817 PDMQueueInsertEx(p VM->pdm.s.pDevHlpQueueR0, &pTask->Core, 0);817 PDMQueueInsertEx(pGVM->pdm.s.pDevHlpQueueR0, &pTask->Core, 0); 818 818 return false; 819 819 } … … 825 825 * @returns See PFNPDMDEVREQHANDLERR0. 826 826 * @param pGVM The global (ring-0) VM structure. (For validation.) 827 * @param pVM The cross context VM structure. (For validation.)828 827 * @param pReq Pointer to the request buffer. 829 828 */ 830 VMMR0_INT_DECL(int) PDMR0DeviceCallReqHandler(PGVM pGVM, P VMCC pVM, PPDMDEVICECALLREQHANDLERREQ pReq)829 VMMR0_INT_DECL(int) PDMR0DeviceCallReqHandler(PGVM pGVM, PPDMDEVICECALLREQHANDLERREQ pReq) 831 830 { 832 831 /* 833 832 * Validate input and make the call. 834 833 */ 835 int rc = GVMMR0ValidateGVM andVM(pGVM, pVM);834 int rc = GVMMR0ValidateGVM(pGVM); 836 835 if (RT_SUCCESS(rc)) 837 836 { … … 841 840 PPDMDEVINS pDevIns = pReq->pDevInsR0; 842 841 AssertPtrReturn(pDevIns, VERR_INVALID_POINTER); 843 AssertReturn(pDevIns->Internal.s.pVMR0 == p VM, VERR_INVALID_PARAMETER);842 AssertReturn(pDevIns->Internal.s.pVMR0 == pGVM, VERR_INVALID_PARAMETER); 844 843 845 844 PFNPDMDEVREQHANDLERR0 pfnReqHandlerR0 = pReq->pfnReqHandlerR0;
Note:
See TracChangeset
for help on using the changeset viewer.