Changeset 68470 in vbox
- Timestamp:
- Aug 18, 2017 2:05:49 PM (8 years ago)
- svn:sync-xref-src-repo-rev:
- 117615
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/vmm/pdmdev.h
r67668 r68470 499 499 500 500 /** 501 * Registration record for MSI .501 * Registration record for MSI/MSI-X emulation. 502 502 */ 503 503 typedef struct PDMMSIREG … … 553 553 554 554 /** 555 * Initialize MSI support in a PCI device. 555 * Initialize MSI or MSI-X emulation support in a PCI device. 556 * 557 * This cannot handle all corner cases of the MSI/MSI-X spec, but for the 558 * vast majority of device emulation it covers everything necessary. It's 559 * fully automatic, taking care of all BAR and config space requirements, 560 * and interrupt delivery is done using PDMDevHlpPCISetIrq and friends. 561 * When MSI/MSI-X is enabled then the iIrq parameter is redefined to take 562 * the vector number (otherwise it has the usual INTA-D meaning for PCI). 563 * 564 * A device not using this can still offer MSI/MSI-X. In this case it's 565 * completely up to the device (in the MSI-X case) to create/register the 566 * necessary MMIO BAR, handle all config space/BAR updating and take care 567 * of delivering the interrupts appropriately. 556 568 * 557 569 * @returns VBox status code. 558 570 * @param pDevIns Device instance of the PCI Bus. 559 571 * @param pPciDev The PCI device structure. 560 * @param pMsiReg MSI registration structure572 * @param pMsiReg MSI emulation registration structure 561 573 * @remarks Caller enters the PDM critical section. 562 574 */ … … 1867 1879 /** Current PDMDEVHLPR3 version number. 1868 1880 * @todo Next major revision should add piBus to pfnPCIBusRegister, and move 1869 * pfnMMIOExReduce up to after pfnMMIOExUnmap. */ 1870 #define PDM_DEVHLPR3_VERSION PDM_VERSION_MAKE_PP(0xffe7, 19, 2) 1881 * pfnMMIOExReduce up to after pfnMMIOExUnmap, and move 1882 * pfnIoApicSendMsi/pfnIoApicSendMsiNoWait up to after pfnISASetIrqNoWait. */ 1883 #define PDM_DEVHLPR3_VERSION PDM_VERSION_MAKE_PP(0xffe7, 19, 3) 1871 1884 //#define PDM_DEVHLPR3_VERSION PDM_VERSION_MAKE_PP(0xffe7, 20, 0) 1872 1885 … … 2678 2691 2679 2692 /** 2680 * Initialize MSI support for the given PCI device. 2693 * Initialize MSI or MSI-X emulation support for the given PCI device. 2694 * 2695 * @see PDMPCIBUSREG::pfnRegisterMsiR3 for details. 2681 2696 * 2682 2697 * @returns VBox status code. … … 2684 2699 * @param pPciDev The PCI device. NULL is an alias for the first 2685 2700 * one registered. 2686 * @param pMsiReg MSI registartion structure.2701 * @param pMsiReg MSI emulation registration structure. 2687 2702 */ 2688 2703 DECLR3CALLBACKMEMBER(int, pfnPCIRegisterMsi,(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, PPDMMSIREG pMsiReg)); … … 2807 2822 * Attaches a driver (chain) to the device. 2808 2823 * 2809 * The first call for a LUN this will serve as a regist artion of the LUN. The pBaseInterface and2824 * The first call for a LUN this will serve as a registration of the LUN. The pBaseInterface and 2810 2825 * the pszDesc string will be registered with that LUN and kept around for PDMR3QueryDeviceLun(). 2811 2826 * … … 3276 3291 DECLR3CALLBACKMEMBER(int, pfnMMIOExReduce,(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t iRegion, RTGCPHYS cbRegion)); 3277 3292 3293 /** 3294 * Send an MSI straight to the I/O APIC. 3295 * 3296 * @param pDevIns PCI device instance. 3297 * @param GCPhys Physical address MSI request was written. 3298 * @param uValue Value written. 3299 * @thread Any thread, but will involve the emulation thread. 3300 */ 3301 DECLR3CALLBACKMEMBER(void, pfnIoApicSendMsi,(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, uint32_t uValue)); 3302 3303 /** 3304 * Send an MSI straight to the I/O APIC, but don't wait for EMT to process 3305 * the request when not called from EMT. 3306 * 3307 * @param pDevIns PCI device instance. 3308 * @param GCPhys Physical address MSI request was written. 3309 * @param uValue Value written. 3310 * @thread Any thread, but will involve the emulation thread. 3311 */ 3312 DECLR3CALLBACKMEMBER(void, pfnIoApicSendMsiNoWait,(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, uint32_t uValue)); 3313 3278 3314 /** Space reserved for future members. 3279 3315 * @{ */ 3280 DECLR3CALLBACKMEMBER(void, pfnReserved2,(void));3281 DECLR3CALLBACKMEMBER(void, pfnReserved3,(void));3282 3316 DECLR3CALLBACKMEMBER(void, pfnReserved4,(void)); 3283 3317 DECLR3CALLBACKMEMBER(void, pfnReserved5,(void)); … … 3710 3744 DECLRCCALLBACKMEMBER(RTTRACEBUF, pfnDBGFTraceBuf,(PPDMDEVINS pDevIns)); 3711 3745 3746 /** 3747 * Send an MSI straight to the I/O APIC. 3748 * 3749 * @param pDevIns PCI device instance. 3750 * @param GCPhys Physical address MSI request was written. 3751 * @param uValue Value written. 3752 * @thread Any thread, but will involve the emulation thread. 3753 */ 3754 DECLRCCALLBACKMEMBER(void, pfnIoApicSendMsi,(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, uint32_t uValue)); 3755 3712 3756 /** Space reserved for future members. 3713 3757 * @{ */ 3714 DECLRCCALLBACKMEMBER(void, pfnReserved1,(void));3715 3758 DECLRCCALLBACKMEMBER(void, pfnReserved2,(void)); 3716 3759 DECLRCCALLBACKMEMBER(void, pfnReserved3,(void)); … … 3732 3775 typedef RCPTRTYPE(const struct PDMDEVHLPRC *) PCPDMDEVHLPRC; 3733 3776 3734 /** Current PDMDEVHLP version number. */ 3735 #define PDM_DEVHLPRC_VERSION PDM_VERSION_MAKE(0xffe6, 5, 0) 3777 /** Current PDMDEVHLP version number. 3778 * @todo Next major revision should move pfnIoApicSendMsi up to after pfnISASetIrq. */ 3779 #define PDM_DEVHLPRC_VERSION PDM_VERSION_MAKE(0xffe6, 5, 1) 3736 3780 3737 3781 … … 3969 4013 DECLR0CALLBACKMEMBER(RTTRACEBUF, pfnDBGFTraceBuf,(PPDMDEVINS pDevIns)); 3970 4014 4015 /** 4016 * Send an MSI straight to the I/O APIC. 4017 * 4018 * @param pDevIns PCI device instance. 4019 * @param GCPhys Physical address MSI request was written. 4020 * @param uValue Value written. 4021 * @thread Any thread, but will involve the emulation thread. 4022 */ 4023 DECLR0CALLBACKMEMBER(void, pfnIoApicSendMsi,(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, uint32_t uValue)); 4024 3971 4025 /** Space reserved for future members. 3972 4026 * @{ */ 3973 DECLR0CALLBACKMEMBER(void, pfnReserved1,(void));3974 4027 DECLR0CALLBACKMEMBER(void, pfnReserved2,(void)); 3975 4028 DECLR0CALLBACKMEMBER(void, pfnReserved3,(void)); … … 3991 4044 typedef R0PTRTYPE(const struct PDMDEVHLPR0 *) PCPDMDEVHLPR0; 3992 4045 3993 /** Current PDMDEVHLP version number. */ 3994 #define PDM_DEVHLPR0_VERSION PDM_VERSION_MAKE(0xffe5, 5, 0) 4046 /** Current PDMDEVHLP version number. 4047 * @todo Next major revision should move pfnIoApicSendMsi up to after pfnISASetIrq. */ 4048 #define PDM_DEVHLPR0_VERSION PDM_VERSION_MAKE(0xffe5, 5, 1) 3995 4049 3996 4050 … … 4780 4834 4781 4835 /** 4782 * Initialize MSI support for the first PCI device.4836 * Initialize MSI or MSI-X emulation support for the first PCI device. 4783 4837 * 4784 4838 * @returns VBox status code. 4785 4839 * @param pDevIns The device instance. 4786 * @param pMsiReg MSI registartion structure.4840 * @param pMsiReg MSI emulation registration structure. 4787 4841 */ 4788 4842 DECLINLINE(int) PDMDevHlpPCIRegisterMsi(PPDMDEVINS pDevIns, PPDMMSIREG pMsiReg) … … 4918 4972 } 4919 4973 4974 /** 4975 * @copydoc PDMDEVHLPR3::pfnIoApicSendMsi 4976 */ 4977 DECLINLINE(void) PDMDevHlpIoApicSendMsi(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, uint32_t uValue) 4978 { 4979 pDevIns->CTX_SUFF(pHlp)->pfnIoApicSendMsi(pDevIns, GCPhys, uValue); 4980 } 4981 4982 /** 4983 * @copydoc PDMDEVHLPR3::pfnIoApicSendMsiNoWait 4984 */ 4985 DECLINLINE(void) PDMDevHlpIoApicSendMsiNoWait(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, uint32_t uValue) 4986 { 4987 pDevIns->CTX_SUFF(pHlp)->pfnIoApicSendMsi(pDevIns, GCPhys, uValue); 4988 } 4989 4920 4990 #ifdef IN_RING3 4921 4991 -
trunk/src/VBox/VMM/VMMR0/PDMR0Device.cpp
r68009 r68470 205 205 pdmUnlock(pVM); 206 206 LogFlow(("pdmR0DevHlp_ISASetIrq: caller=%p/%d: returns void; uTagSrc=%#x\n", pDevIns, pDevIns->iInstance, uTagSrc)); 207 } 208 209 210 /** @interface_method_impl{PDMDEVHLPR0,pfnIoApicSendMsi} */ 211 static DECLCALLBACK(void) pdmR0DevHlp_IoApicSendMsi(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, uint32_t uValue) 212 { 213 PDMDEV_ASSERT_DEVINS(pDevIns); 214 LogFlow(("pdmR0DevHlp_IoApicSendMsi: caller=%p/%d: GCPhys=%RGp uValue=%#x\n", pDevIns, pDevIns->iInstance, GCPhys, uValue)); 215 PVM pVM = pDevIns->Internal.s.pVMR0; 216 217 uint32_t uTagSrc; 218 pDevIns->Internal.s.uLastIrqTag = uTagSrc = pdmCalcIrqTag(pVM, pDevIns->idTracing); 219 VBOXVMM_PDM_IRQ_HILO(VMMGetCpu(pVM), RT_LOWORD(uTagSrc), RT_HIWORD(uTagSrc)); 220 221 if (pVM->pdm.s.IoApic.pDevInsR0) 222 pVM->pdm.s.IoApic.pfnSendMsiR0(pVM->pdm.s.IoApic.pDevInsR0, GCPhys, uValue, uTagSrc); 223 else 224 AssertFatalMsgFailed(("Lazy bastards!")); 225 226 LogFlow(("pdmR0DevHlp_IoApicSendMsi: caller=%p/%d: returns void; uTagSrc=%#x\n", pDevIns, pDevIns->iInstance, uTagSrc)); 207 227 } 208 228 … … 420 440 pdmR0DevHlp_TMTimeVirtGetNano, 421 441 pdmR0DevHlp_DBGFTraceBuf, 422 NULL,442 pdmR0DevHlp_IoApicSendMsi, 423 443 NULL, 424 444 NULL, -
trunk/src/VBox/VMM/VMMR3/PDMDevHlp.cpp
r67668 r68470 1814 1814 { 1815 1815 pdmR3DevHlp_ISASetIrq(pDevIns, iIrq, iLevel); 1816 } 1817 1818 1819 /** @interface_method_impl{PDMDEVHLPR3,pfnIoApicSendMsi} */ 1820 static DECLCALLBACK(void) pdmR3DevHlp_IoApicSendMsi(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, uint32_t uValue) 1821 { 1822 PDMDEV_ASSERT_DEVINS(pDevIns); 1823 LogFlow(("pdmR3DevHlp_IoApicSendMsi: caller='%s'/%d: GCPhys=%RGp uValue=%#x\n", pDevIns->pReg->szName, pDevIns->iInstance, GCPhys, uValue)); 1824 1825 /* 1826 * Validate input. 1827 */ 1828 Assert(GCPhys != 0); 1829 Assert(uValue != 0); 1830 1831 PVM pVM = pDevIns->Internal.s.pVMR3; 1832 1833 /* 1834 * Do the job. 1835 */ 1836 pdmLock(pVM); 1837 uint32_t uTagSrc; 1838 pDevIns->Internal.s.uLastIrqTag = uTagSrc = pdmCalcIrqTag(pVM, pDevIns->idTracing); 1839 VBOXVMM_PDM_IRQ_HILO(VMMGetCpu(pVM), RT_LOWORD(uTagSrc), RT_HIWORD(uTagSrc)); 1840 1841 PDMIoApicSendMsi(pVM, GCPhys, uValue, uTagSrc); /* (The API takes the lock recursively.) */ 1842 1843 pdmUnlock(pVM); 1844 1845 LogFlow(("pdmR3DevHlp_IoApicSendMsi: caller='%s'/%d: returns void\n", pDevIns->pReg->szName, pDevIns->iInstance)); 1846 } 1847 1848 1849 /** @interface_method_impl{PDMDEVHLPR3,pfnIoApicSendMsiNoWait} */ 1850 static DECLCALLBACK(void) pdmR3DevHlp_IoApicSendMsiNoWait(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, uint32_t uValue) 1851 { 1852 pdmR3DevHlp_IoApicSendMsi(pDevIns, GCPhys, uValue); 1816 1853 } 1817 1854 … … 3689 3726 pdmR3DevHlp_VMGetResumeReason, 3690 3727 pdmR3DevHlp_MMIOExReduce, 3691 0,3692 0,3728 pdmR3DevHlp_IoApicSendMsi, 3729 pdmR3DevHlp_IoApicSendMsiNoWait, 3693 3730 0, 3694 3731 0, … … 3946 3983 pdmR3DevHlp_VMGetResumeReason, 3947 3984 pdmR3DevHlp_MMIOExReduce, 3948 0,3949 0,3985 pdmR3DevHlp_IoApicSendMsi, 3986 pdmR3DevHlp_IoApicSendMsiNoWait, 3950 3987 0, 3951 3988 0, -
trunk/src/VBox/VMM/VMMRC/PDMRCDevice.cpp
r65338 r68470 204 204 pdmUnlock(pVM); 205 205 LogFlow(("pdmRCDevHlp_ISASetIrq: caller=%p/%d: returns void; uTagSrc=%#x\n", pDevIns, pDevIns->iInstance, uTagSrc)); 206 } 207 208 209 /** @interface_method_impl{PDMDEVHLPRC,pfnIoApicSendMsi} */ 210 static DECLCALLBACK(void) pdmRCDevHlp_IoApicSendMsi(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, uint32_t uValue) 211 { 212 PDMDEV_ASSERT_DEVINS(pDevIns); 213 LogFlow(("pdmRCDevHlp_IoApicSendMsi: caller=%p/%d: GCPhys=%RGp uValue=%#x\n", pDevIns, pDevIns->iInstance, GCPhys, uValue)); 214 PVM pVM = pDevIns->Internal.s.pVMRC; 215 216 uint32_t uTagSrc; 217 pDevIns->Internal.s.uLastIrqTag = uTagSrc = pdmCalcIrqTag(pVM, pDevIns->idTracing); 218 VBOXVMM_PDM_IRQ_HILO(VMMGetCpu(pVM), RT_LOWORD(uTagSrc), RT_HIWORD(uTagSrc)); 219 220 if (pVM->pdm.s.IoApic.pDevInsRC) 221 pVM->pdm.s.IoApic.pfnSendMsiRC(pVM->pdm.s.IoApic.pDevInsRC, GCPhys, uValue, uTagSrc); 222 else 223 AssertFatalMsgFailed(("Lazy bastards!")); 224 225 LogFlow(("pdmRCDevHlp_IoApicSendMsi: caller=%p/%d: returns void; uTagSrc=%#x\n", pDevIns, pDevIns->iInstance, uTagSrc)); 206 226 } 207 227 … … 405 425 pdmRCDevHlp_TMTimeVirtGetNano, 406 426 pdmRCDevHlp_DBGFTraceBuf, 407 NULL,427 pdmRCDevHlp_IoApicSendMsi, 408 428 NULL, 409 429 NULL, … … 587 607 pVM->pdm.s.IoApic.pfnSendMsiRC(pVM->pdm.s.IoApic.pDevInsRC, GCPhys, uValue, uTagSrc); 588 608 else 589 AssertFatalMsgFailed(("Lazy bastar ts!"));609 AssertFatalMsgFailed(("Lazy bastards!")); 590 610 } 591 611
Note:
See TracChangeset
for help on using the changeset viewer.