Changeset 10202
- Timestamp:
- 07/04/08 09:25:27 (2 months ago)
- Files:
-
- trunk/Config.kmk (modified) (1 diff)
- trunk/include/VBox/pdmdev.h (modified) (24 diffs)
- trunk/src/VBox/Devices/Bus/DevPCI.cpp (modified) (2 diffs)
- trunk/src/VBox/Devices/PC/DevAPIC.cpp (modified) (6 diffs)
- trunk/src/VBox/Devices/PC/DevPIC.cpp (modified) (3 diffs)
- trunk/src/VBox/VMM/PDM.cpp (modified) (3 diffs)
- trunk/src/VBox/VMM/PDMDevice.cpp (modified) (25 diffs)
- trunk/src/VBox/VMM/PDMInternal.h (modified) (2 diffs)
- trunk/src/VBox/VMM/VMMAll/PDMAll.cpp (modified) (4 diffs)
- trunk/src/VBox/VMM/VMMGC/PDMGCDevice.cpp (modified) (16 diffs)
- trunk/src/VBox/VMM/VMMR0/PDMR0Device.cpp (modified) (16 diffs)
- trunk/src/VBox/VMM/testcase/tstVMStructGC.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/Config.kmk
r10200 r10202 771 771 endif 772 772 ## @todo eliminate these guys. 773 ifdef VBOX_WITH_PDM_LOCK774 DEFS += VBOX_WITH_PDM_LOCK775 endif776 773 ifdef VBOX_WITH_INTERNAL_NETWORKING 777 774 DEFS += VBOX_WITH_INTERNAL_NETWORKING trunk/include/VBox/pdmdev.h
r9898 r10202 532 532 DECLGCCALLBACKMEMBER(void, pfnIoApicSetIrq,(PPDMDEVINS pDevIns, int iIrq, int iLevel)); 533 533 534 #ifdef VBOX_WITH_PDM_LOCK535 534 /** 536 535 * Acquires the PDM lock. … … 549 548 */ 550 549 DECLGCCALLBACKMEMBER(void, pfnUnlock,(PPDMDEVINS pDevIns)); 551 #endif 550 552 551 /** Just a safety precaution. */ 553 552 uint32_t u32TheEnd; … … 590 589 DECLR0CALLBACKMEMBER(void, pfnIoApicSetIrq,(PPDMDEVINS pDevIns, int iIrq, int iLevel)); 591 590 592 #ifdef VBOX_WITH_PDM_LOCK593 591 /** 594 592 * Acquires the PDM lock. … … 607 605 */ 608 606 DECLR0CALLBACKMEMBER(void, pfnUnlock,(PPDMDEVINS pDevIns)); 609 #endif610 607 611 608 /** Just a safety precaution. */ … … 682 679 DECLR3CALLBACKMEMBER(PCPDMPCIHLPR0, pfnGetR0Helpers,(PPDMDEVINS pDevIns)); 683 680 684 #ifdef VBOX_WITH_PDM_LOCK685 681 /** 686 682 * Acquires the PDM lock. … … 699 695 */ 700 696 DECLR3CALLBACKMEMBER(void, pfnUnlock,(PPDMDEVINS pDevIns)); 701 #endif702 697 703 698 /** Just a safety precaution. */ … … 776 771 DECLGCCALLBACKMEMBER(void, pfnClearInterruptFF,(PPDMDEVINS pDevIns)); 777 772 778 #ifdef VBOX_WITH_PDM_LOCK779 773 /** 780 774 * Acquires the PDM lock. … … 793 787 */ 794 788 DECLGCCALLBACKMEMBER(void, pfnUnlock,(PPDMDEVINS pDevIns)); 795 #endif 789 796 790 /** Just a safety precaution. */ 797 791 uint32_t u32TheEnd; … … 829 823 DECLR0CALLBACKMEMBER(void, pfnClearInterruptFF,(PPDMDEVINS pDevIns)); 830 824 831 #ifdef VBOX_WITH_PDM_LOCK832 825 /** 833 826 * Acquires the PDM lock. … … 846 839 */ 847 840 DECLR0CALLBACKMEMBER(void, pfnUnlock,(PPDMDEVINS pDevIns)); 848 #endif849 841 850 842 /** Just a safety precaution. */ … … 882 874 DECLR3CALLBACKMEMBER(void, pfnClearInterruptFF,(PPDMDEVINS pDevIns)); 883 875 884 #ifdef VBOX_WITH_PDM_LOCK885 876 /** 886 877 * Acquires the PDM lock. … … 899 890 */ 900 891 DECLR3CALLBACKMEMBER(void, pfnUnlock,(PPDMDEVINS pDevIns)); 901 #endif902 892 903 893 /** … … 1070 1060 DECLGCCALLBACKMEMBER(void, pfnChangeFeature,(PPDMDEVINS pDevIns, bool fEnabled)); 1071 1061 1072 #ifdef VBOX_WITH_PDM_LOCK1073 1062 /** 1074 1063 * Acquires the PDM lock. … … 1087 1076 */ 1088 1077 DECLGCCALLBACKMEMBER(void, pfnUnlock,(PPDMDEVINS pDevIns)); 1089 #endif 1078 1090 1079 /** Just a safety precaution. */ 1091 1080 uint32_t u32TheEnd; … … 1130 1119 DECLR0CALLBACKMEMBER(void, pfnChangeFeature,(PPDMDEVINS pDevIns, bool fEnabled)); 1131 1120 1132 #ifdef VBOX_WITH_PDM_LOCK1133 1121 /** 1134 1122 * Acquires the PDM lock. … … 1147 1135 */ 1148 1136 DECLR0CALLBACKMEMBER(void, pfnUnlock,(PPDMDEVINS pDevIns)); 1149 #endif1150 1137 1151 1138 /** Just a safety precaution. */ … … 1190 1177 DECLR3CALLBACKMEMBER(void, pfnChangeFeature,(PPDMDEVINS pDevIns, bool fEnabled)); 1191 1178 1192 #ifdef VBOX_WITH_PDM_LOCK1193 1179 /** 1194 1180 * Acquires the PDM lock. … … 1207 1193 */ 1208 1194 DECLR3CALLBACKMEMBER(void, pfnUnlock,(PPDMDEVINS pDevIns)); 1209 #endif1210 1195 1211 1196 /** … … 1298 1283 uint8_t iVector, uint8_t u8Polarity, uint8_t u8TriggerMode)); 1299 1284 1300 #ifdef VBOX_WITH_PDM_LOCK1301 1285 /** 1302 1286 * Acquires the PDM lock. … … 1315 1299 */ 1316 1300 DECLGCCALLBACKMEMBER(void, pfnUnlock,(PPDMDEVINS pDevIns)); 1317 #endif1318 1301 1319 1302 /** Just a safety precaution. */ … … 1354 1337 uint8_t iVector, uint8_t u8Polarity, uint8_t u8TriggerMode)); 1355 1338 1356 #ifdef VBOX_WITH_PDM_LOCK1357 1339 /** 1358 1340 * Acquires the PDM lock. … … 1371 1353 */ 1372 1354 DECLR0CALLBACKMEMBER(void, pfnUnlock,(PPDMDEVINS pDevIns)); 1373 #endif1374 1355 1375 1356 /** Just a safety precaution. */ … … 1409 1390 uint8_t iVector, uint8_t u8Polarity, uint8_t u8TriggerMode)); 1410 1391 1411 #ifdef VBOX_WITH_PDM_LOCK1412 1392 /** 1413 1393 * Acquires the PDM lock. … … 1426 1406 */ 1427 1407 DECLR3CALLBACKMEMBER(void, pfnUnlock,(PPDMDEVINS pDevIns)); 1428 #endif1429 1408 1430 1409 /** trunk/src/VBox/Devices/Bus/DevPCI.cpp
r8155 r10202 66 66 /** @def PCI_UNLOCK 67 67 * Releases the PDM lock. This is a NOP if locking is disabled. */ 68 #ifdef VBOX_WITH_PDM_LOCK 69 # define PCI_LOCK(pDevIns, rc) \ 68 #define PCI_LOCK(pDevIns, rc) \ 70 69 do { \ 71 70 int rc2 = PDMINS2DATA(pDevIns, PCIBus *)->CTXALLSUFF(pPciHlp)->pfnLock((pDevIns), rc); \ … … 73 72 return rc2; \ 74 73 } while (0) 75 # define PCI_UNLOCK(pDevIns) \74 #define PCI_UNLOCK(pDevIns) \ 76 75 PDMINS2DATA(pDevIns, PCIBus *)->CTXALLSUFF(pPciHlp)->pfnUnlock(pDevIns) 77 #else /* !VBOX_WITH_PDM_LOCK */78 # define PCI_LOCK(pThis, rc) do { } while (0)79 # define PCI_UNLOCK(pThis) do { } while (0)80 #endif /* !VBOX_WITH_PDM_LOCK */81 76 82 77 trunk/src/VBox/Devices/PC/DevAPIC.cpp
r8155 r10202 62 62 /** @def IOAPIC_UNLOCK 63 63 * Releases the PDM lock. This is a NOP if locking is disabled. */ 64 #ifdef VBOX_WITH_PDM_LOCK 65 # define APIC_LOCK(pThis, rc) \ 64 #define APIC_LOCK(pThis, rc) \ 66 65 do { \ 67 66 int rc2 = (pThis)->CTXALLSUFF(pApicHlp)->pfnLock((pThis)->CTXSUFF(pDevIns), rc); \ … … 69 68 return rc2; \ 70 69 } while (0) 71 # define APIC_UNLOCK(pThis) \70 #define APIC_UNLOCK(pThis) \ 72 71 (pThis)->CTXALLSUFF(pApicHlp)->pfnUnlock((pThis)->CTXSUFF(pDevIns)) 73 # define IOAPIC_LOCK(pThis, rc) \72 #define IOAPIC_LOCK(pThis, rc) \ 74 73 do { \ 75 74 int rc2 = (pThis)->CTXALLSUFF(pIoApicHlp)->pfnLock((pThis)->CTXSUFF(pDevIns), rc); \ … … 77 76 return rc2; \ 78 77 } while (0) 79 # define IOAPIC_UNLOCK(pThis) (pThis)->CTXALLSUFF(pIoApicHlp)->pfnUnlock((pThis)->CTXSUFF(pDevIns)) 80 #else /* !VBOX_WITH_PDM_LOCK */ 81 # define APIC_LOCK(pThis, rc) do { } while (0) 82 # define APIC_UNLOCK(pThis) do { } while (0) 83 # define IOAPIC_LOCK(pThis, rc) do { } while (0) 84 # define IOAPIC_UNLOCK(pThis) do { } while (0) 85 #endif /* !VBOX_WITH_PDM_LOCK */ 78 #define IOAPIC_UNLOCK(pThis) (pThis)->CTXALLSUFF(pIoApicHlp)->pfnUnlock((pThis)->CTXSUFF(pDevIns)) 86 79 87 80 … … 828 821 { 829 822 APICState *s = PDMINS2DATA(pDevIns, APICState *); 830 # ifdef VBOX_WITH_PDM_LOCK831 823 s->pApicHlpR3->pfnLock(pDevIns, VERR_INTERNAL_ERROR); 832 # endif833 824 #endif /* VBOX */ 834 825 … … 1610 1601 { 1611 1602 APICState *s = PDMINS2DATA(pDevIns, APICState *); 1612 #ifdef VBOX_WITH_PDM_LOCK1613 1603 s->pApicHlpR3->pfnLock(pDevIns, VERR_INTERNAL_ERROR); 1614 #endif1615 1604 apic_reset(s); 1616 1605 /* Clear any pending APIC interrupt action flag. */ … … 1956 1945 { 1957 1946 IOAPICState *s = PDMINS2DATA(pDevIns, IOAPICState *); 1958 #ifdef VBOX_WITH_PDM_LOCK1959 1947 s->pIoApicHlpR3->pfnLock(pDevIns, VERR_INTERNAL_ERROR); 1960 #endif1961 1948 ioapic_reset(s); 1962 1949 IOAPIC_UNLOCK(s); trunk/src/VBox/Devices/PC/DevPIC.cpp
r9387 r10202 38 38 /** @def PIC_UNLOCK 39 39 * Releases the PDM lock. This is a NOP if locking is disabled. */ 40 #ifdef VBOX_WITH_PDM_LOCK 41 # define PIC_LOCK(pThis, rc) \ 40 #define PIC_LOCK(pThis, rc) \ 42 41 do { \ 43 42 int rc2 = (pThis)->CTXALLSUFF(pPicHlp)->pfnLock((pThis)->CTXSUFF(pDevIns), rc); \ … … 45 44 return rc2; \ 46 45 } while (0) 47 # define PIC_UNLOCK(pThis) \46 #define PIC_UNLOCK(pThis) \ 48 47 (pThis)->CTXALLSUFF(pPicHlp)->pfnUnlock((pThis)->CTXSUFF(pDevIns)) 49 #else /* !VBOX_WITH_PDM_LOCK */50 # define PIC_LOCK(pThis, rc) do { } while (0)51 # define PIC_UNLOCK(pThis) do { } while (0)52 #endif /* !VBOX_WITH_PDM_LOCK */53 48 54 49 … … 890 885 unsigned i; 891 886 LogFlow(("picReset:\n")); 892 #ifdef VBOX_WITH_PDM_LOCK893 887 pData->pPicHlpR3->pfnLock(pDevIns, VERR_INTERNAL_ERROR); 894 #endif895 888 896 889 for (i = 0; i < ELEMENTS(pData->aPics); i++) trunk/src/VBox/VMM/PDM.cpp
r9212 r10202 194 194 if (VBOX_SUCCESS(rc)) 195 195 { 196 #ifdef VBOX_WITH_PDM_LOCK197 196 rc = PDMR3CritSectInit(pVM, &pVM->pdm.s.CritSect, "PDM"); 198 197 if (VBOX_SUCCESS(rc)) 199 #endif200 198 rc = pdmR3LdrInitU(pVM->pUVM); 201 199 if (VBOX_SUCCESS(rc)) … … 453 451 pdmR3LdrTermU(pVM->pUVM); 454 452 455 #ifdef VBOX_WITH_PDM_LOCK456 453 /* 457 454 * Destroy the PDM lock. 458 455 */ 459 456 PDMR3CritSectDelete(&pVM->pdm.s.CritSect); 460 #endif461 457 462 458 LogFlow(("PDMR3Term: returns %Vrc\n", VINF_SUCCESS)); … … 1189 1185 PDMR3DECL(int) PDMR3LockCall(PVM pVM) 1190 1186 { 1191 #ifdef VBOX_WITH_PDM_LOCK1192 1187 return PDMR3CritSectEnterEx(&pVM->pdm.s.CritSect, true /* fHostCall */); 1193 #else 1194 return VINF_SUCCESS; 1195 #endif 1196 } 1197 1188 } 1189 trunk/src/VBox/VMM/PDMDevice.cpp
r9293 r10202 220 220 static DECLCALLBACK(void) pdmR3PicHlp_SetInterruptFF(PPDMDEVINS pDevIns); 221 221 static DECLCALLBACK(void) pdmR3PicHlp_ClearInterruptFF(PPDMDEVINS pDevIns); 222 #ifdef VBOX_WITH_PDM_LOCK223 222 static DECLCALLBACK(int) pdmR3PicHlp_Lock(PPDMDEVINS pDevIns, int rc); 224 223 static DECLCALLBACK(void) pdmR3PicHlp_Unlock(PPDMDEVINS pDevIns); 225 #endif226 224 static DECLCALLBACK(PCPDMPICHLPGC) pdmR3PicHlp_GetGCHelpers(PPDMDEVINS pDevIns); 227 225 static DECLCALLBACK(PCPDMPICHLPR0) pdmR3PicHlp_GetR0Helpers(PPDMDEVINS pDevIns); … … 235 233 static DECLCALLBACK(void) pdmR3ApicHlp_ClearInterruptFF(PPDMDEVINS pDevIns); 236 234 static DECLCALLBACK(void) pdmR3ApicHlp_ChangeFeature(PPDMDEVINS pDevIns, bool fEnabled); 237 #ifdef VBOX_WITH_PDM_LOCK238 235 static DECLCALLBACK(int) pdmR3ApicHlp_Lock(PPDMDEVINS pDevIns, int rc); 239 236 static DECLCALLBACK(void) pdmR3ApicHlp_Unlock(PPDMDEVINS pDevIns); 240 #endif241 237 static DECLCALLBACK(PCPDMAPICHLPGC) pdmR3ApicHlp_GetGCHelpers(PPDMDEVINS pDevIns); 242 238 static DECLCALLBACK(PCPDMAPICHLPR0) pdmR3ApicHlp_GetR0Helpers(PPDMDEVINS pDevIns); … … 249 245 static DECLCALLBACK(void) pdmR3IoApicHlp_ApicBusDeliver(PPDMDEVINS pDevIns, uint8_t u8Dest, uint8_t u8DestMode, uint8_t u8DeliveryMode, 250 246 uint8_t iVector, uint8_t u8Polarity, uint8_t u8TriggerMode); 251 #ifdef VBOX_WITH_PDM_LOCK252 247 static DECLCALLBACK(int) pdmR3IoApicHlp_Lock(PPDMDEVINS pDevIns, int rc); 253 248 static DECLCALLBACK(void) pdmR3IoApicHlp_Unlock(PPDMDEVINS pDevIns); 254 #endif255 249 static DECLCALLBACK(PCPDMIOAPICHLPGC) pdmR3IoApicHlp_GetGCHelpers(PPDMDEVINS pDevIns); 256 250 static DECLCALLBACK(PCPDMIOAPICHLPR0) pdmR3IoApicHlp_GetR0Helpers(PPDMDEVINS pDevIns); … … 264 258 static DECLCALLBACK(void) pdmR3PciHlp_IoApicSetIrq(PPDMDEVINS pDevIns, int iIrq, int iLevel); 265 259 static DECLCALLBACK(bool) pdmR3PciHlp_IsMMIO2Base(PPDMDEVINS pDevIns, PPDMDEVINS pOwner, RTGCPHYS GCPhys); 266 #ifdef VBOX_WITH_PDM_LOCK267 260 static DECLCALLBACK(int) pdmR3PciHlp_Lock(PPDMDEVINS pDevIns, int rc); 268 261 static DECLCALLBACK(void) pdmR3PciHlp_Unlock(PPDMDEVINS pDevIns); 269 #endif270 262 static DECLCALLBACK(PCPDMPCIHLPGC) pdmR3PciHlp_GetGCHelpers(PPDMDEVINS pDevIns); 271 263 static DECLCALLBACK(PCPDMPCIHLPR0) pdmR3PciHlp_GetR0Helpers(PPDMDEVINS pDevIns); … … 494 486 pdmR3PicHlp_SetInterruptFF, 495 487 pdmR3PicHlp_ClearInterruptFF, 496 #ifdef VBOX_WITH_PDM_LOCK497 488 pdmR3PicHlp_Lock, 498 489 pdmR3PicHlp_Unlock, 499 #endif500 490 pdmR3PicHlp_GetGCHelpers, 501 491 pdmR3PicHlp_GetR0Helpers, … … 513 503 pdmR3ApicHlp_ClearInterruptFF, 514 504 pdmR3ApicHlp_ChangeFeature, 515 #ifdef VBOX_WITH_PDM_LOCK516 505 pdmR3ApicHlp_Lock, 517 506 pdmR3ApicHlp_Unlock, 518 #endif519 507 pdmR3ApicHlp_GetGCHelpers, 520 508 pdmR3ApicHlp_GetR0Helpers, … … 530 518 PDM_IOAPICHLPR3_VERSION, 531 519 pdmR3IoApicHlp_ApicBusDeliver, 532 #ifdef VBOX_WITH_PDM_LOCK533 520 pdmR3IoApicHlp_Lock, 534 521 pdmR3IoApicHlp_Unlock, 535 #endif536 522 pdmR3IoApicHlp_GetGCHelpers, 537 523 pdmR3IoApicHlp_GetR0Helpers, … … 551 537 pdmR3PciHlp_GetGCHelpers, 552 538 pdmR3PciHlp_GetR0Helpers, 553 #ifdef VBOX_WITH_PDM_LOCK554 539 pdmR3PciHlp_Lock, 555 540 pdmR3PciHlp_Unlock, 556 #endif557 541 PDM_PCIHLPR3_VERSION, /* the end */ 558 542 }; … … 1809 1793 PPDMPCIBUS pBus = pDevIns->Internal.s.pPciBusHC; /** @todo the bus should be associated with the PCI device not the PDM device. */ 1810 1794 Assert(pBus); 1811 #ifdef VBOX_WITH_PDM_LOCK1812 1795 PVM pVM = pDevIns->Internal.s.pVMHC; 1813 1796 pdmLock(pVM); 1814 1797 pBus->pfnSetIrqR3(pBus->pDevInsR3, pPciDev, iIrq, iLevel); 1815 1798 pdmUnlock(pVM); 1816 1817 #else /* !VBOX_WITH_PDM_LOCK */1818 /*1819 * For the convenience of the device we put no thread restriction on this interface.1820 * That means we'll have to check which thread we're in and choose our path.1821 */1822 if (VM_IS_EMT(pDevIns->Internal.s.pVMHC) || VMMR3LockIsOwner(pDevIns->Internal.s.pVMHC))1823 pBus->pfnSetIrqR3(pBus->pDevInsR3, pPciDev, iIrq, iLevel);1824 else1825 {1826 Log(("pdmR3DevHlp_PCISetIrq: caller='%s'/%d: Requesting call in EMT...\n", pDevIns->pDevReg->szDeviceName, pDevIns->iInstance));1827 PVMREQ pReq;1828 int rc = VMR3ReqCallVoid(pDevIns->Internal.s.pVMHC, &pReq, RT_INDEFINITE_WAIT,1829 (PFNRT)pBus->pfnSetIrqR3, 4, pBus->pDevInsR3, pPciDev, iIrq, iLevel);1830 while (rc == VERR_TIMEOUT)1831 rc = VMR3ReqWait(pReq, RT_INDEFINITE_WAIT);1832 AssertReleaseRC(rc);1833 VMR3ReqFree(pReq);1834 }1835 #endif /* !VBOX_WITH_PDM_LOCK */1836 1799 } 1837 1800 else … … 1845 1808 static DECLCALLBACK(void) pdmR3DevHlp_PCISetIrqNoWait(PPDMDEVINS pDevIns, int iIrq, int iLevel) 1846 1809 { 1847 #ifdef VBOX_WITH_PDM_LOCK1848 1810 pdmR3DevHlp_PCISetIrq(pDevIns, iIrq, iLevel); 1849 #else /* !VBOX_WITH_PDM_LOCK */1850 PDMDEV_ASSERT_DEVINS(pDevIns);1851 LogFlow(("pdmR3DevHlp_PCISetIrqNoWait: caller='%s'/%d: iIrq=%d iLevel=%d\n", pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, iIrq, iLevel));1852 1853 /*1854 * Validate input.1855 */1856 /** @todo iIrq and iLevel checks. */1857 1858 /*1859 * Must have a PCI device registered!1860 */1861 PPCIDEVICE pPciDev = pDevIns->Internal.s.pPciDeviceHC;1862 if (pPciDev)1863 {1864 PPDMPCIBUS pBus = pDevIns->Internal.s.pPciBusHC;1865 Assert(pBus);1866 1867 /*1868 * For the convenience of the device we put no thread restriction on this interface.1869 * That means we'll have to check which thread we're in and choose our path.1870 */1871 if (VM_IS_EMT(pDevIns->Internal.s.pVMHC) || VMMR3LockIsOwner(pDevIns->Internal.s.pVMHC))1872 pBus->pfnSetIrqR3(pBus->pDevInsR3, pPciDev, iIrq, iLevel);1873 else1874 {1875 Log(("pdmR3DevHlp_PCISetIrqNoWait: caller='%s'/%d: Queueing call in EMT...\n", pDevIns->pDevReg->szDeviceName, pDevIns->iInstance));1876 int rc = VMR3ReqCallEx(pDevIns->Internal.s.pVMHC, NULL, RT_INDEFINITE_WAIT, VMREQFLAGS_NO_WAIT | VMREQFLAGS_VOID,1877 (PFNRT)pBus->pfnSetIrqR3, 4, pBus->pDevInsR3, pPciDev, iIrq, iLevel);1878 AssertReleaseRC(rc);1879 }1880 }1881 else1882 AssertReleaseMsgFailed(("No PCI device registered!\n"));1883 1884 LogFlow(("pdmR3DevHlp_PCISetIrqNoWait: caller='%s'/%d: returns void\n", pDevIns->pDevReg->szDeviceName, pDevIns->iInstance));1885 #endif /* !VBOX_WITH_PDM_LOCK */1886 1811 } 1887 1812 … … 1899 1824 1900 1825 PVM pVM = pDevIns->Internal.s.pVMHC; 1901 #ifdef VBOX_WITH_PDM_LOCK1902 1826 PDMIsaSetIrq(pVM, iIrq, iLevel); /* (The API takes the lock.) */ 1903 #else /* !VBOX_WITH_PDM_LOCK */1904 if (VM_IS_EMT(pDevIns->Internal.s.pVMHC) || VMMR3LockIsOwner(pDevIns->Internal.s.pVMHC))1905 PDMIsaSetIrq(pVM, iIrq, iLevel);1906 else1907 {1908 Log(("pdmR3DevHlp_ISASetIrq: caller='%s'/%d: Requesting call in EMT...\n", pDevIns->pDevReg->szDeviceName, pDevIns->iInstance));1909 PVMREQ pReq;1910 int rc = VMR3ReqCallVoid(pDevIns->Internal.s.pVMHC, &pReq, RT_INDEFINITE_WAIT,1911 (PFNRT)PDMIsaSetIrq, 3, pVM, iIrq, iLevel);1912 while (rc == VERR_TIMEOUT)1913 rc = VMR3ReqWait(pReq, RT_INDEFINITE_WAIT);1914 AssertReleaseRC(rc);1915 VMR3ReqFree(pReq);1916 }1917 #endif /* !VBOX_WITH_PDM_LOCK */1918 1827 1919 1828 LogFlow(("pdmR3DevHlp_ISASetIrq: caller='%s'/%d: returns void\n", pDevIns->pDevReg->szDeviceName, pDevIns->iInstance)); … … 1924 1833 static DECLCALLBACK(void) pdmR3DevHlp_ISASetIrqNoWait(PPDMDEVINS pDevIns, int iIrq, int iLevel) 1925 1834 { 1926 #ifdef VBOX_WITH_PDM_LOCK1927 1835 pdmR3DevHlp_ISASetIrq(pDevIns, iIrq, iLevel); 1928 #else /* !VBOX_WITH_PDM_LOCK */1929 PDMDEV_ASSERT_DEVINS(pDevIns);1930 LogFlow(("pdmR3DevHlp_ISASetIrqNoWait: caller='%s'/%d: iIrq=%d iLevel=%d\n", pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, iIrq, iLevel));1931 1932 /*1933 * Validate input.1934 */1935 /** @todo iIrq and iLevel checks. */1936 1937 PVM pVM = pDevIns->Internal.s.pVMHC;1938 /*1939 * For the convenience of the device we put no thread restriction on this interface.1940 * That means we'll have to check which thread we're in and choose our path.1941 */1942 if (VM_IS_EMT(pDevIns->Internal.s.pVMHC) || VMMR3LockIsOwner(pDevIns->Internal.s.pVMHC))1943 PDMIsaSetIrq(pVM, iIrq, iLevel);1944 else1945 {1946 Log(("pdmR3DevHlp_ISASetIrqNoWait: caller='%s'/%d: Queueing call in EMT...\n", pDevIns->pDevReg->szDeviceName, pDevIns->iInstance));1947 int rc = VMR3ReqCallEx(pDevIns->Internal.s.pVMHC, NULL, 0, VMREQFLAGS_NO_WAIT | VMREQFLAGS_VOID,1948 (PFNRT)PDMIsaSetIrq, 3, pVM, iIrq, iLevel);1949 AssertReleaseRC(rc);1950 }1951 1952 LogFlow(("pdmR3DevHlp_ISASetIrqNoWait: caller='%s'/%d: returns void\n", pDevIns->pDevReg->szDeviceName, pDevIns->iInstance));1953 #endif /* !VBOX_WITH_PDM_LOCK */1954 1836 } 1955 1837 … … 4104 3986 VM_FF_SET(pVM, VM_FF_INTERRUPT_PIC); 4105 3987 REMR3NotifyInterruptSet(pVM); 4106 #ifdef VBOX_WITH_PDM_LOCK4107 3988 VMR3NotifyFF(pVM, true); 4108 #endif4109 3989 } 4110 3990 … … 4121 4001 4122 4002 4123 #ifdef VBOX_WITH_PDM_LOCK4124 4003 /** @copydoc PDMPICHLPR3::pfnLock */ 4125 4004 static DECLCALLBACK(int) pdmR3PicHlp_Lock(PPDMDEVINS pDevIns, int rc) … … 4136 4015 pdmUnlock(pDevIns->Internal.s.pVMHC); 4137 4016 } 4138 #endif /* VBOX_WITH_PDM_LOCK */4139 4017 4140 4018 … … 4178 4056 VM_FF_SET(pVM, VM_FF_INTERRUPT_APIC); 4179 4057 REMR3NotifyInterruptSet(pVM); 4180 #ifdef VBOX_WITH_PDM_LOCK4181 4058 VMR3NotifyFF(pVM, true); 4182 #endif4183 4059 } 4184 4060 … … 4207 4083 } 4208 4084 4209 #ifdef VBOX_WITH_PDM_LOCK4210 4085 /** @copydoc PDMAPICHLPR3::pfnLock */ 4211 4086 static DECLCALLBACK(int) pdmR3ApicHlp_Lock(PPDMDEVINS pDevIns, int rc) … … 4222 4097 pdmUnlock(pDevIns->Internal.s.pVMHC); 4223 4098 } 4224 #endif /* VBOX_WITH_PDM_LOCK */4225 4099 4226 4100 … … 4261 4135 PDMDEV_ASSERT_DEVINS(pDevIns); 4262 4136 PVM pVM = pDevIns->Internal.s.pVMHC; 4263 #ifndef VBOX_WITH_PDM_LOCK4264 VM_ASSERT_EMT(pVM);4265 #endif4266 4137 LogFlow(("pdmR3IoApicHlp_ApicBusDeliver: caller='%s'/%d: u8Dest=%RX8 u8DestMode=%RX8 u8DeliveryMode=%RX8 iVector=%RX8 u8Polarity=%RX8 u8TriggerMode=%RX8\n", 4267 4138 pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, u8Dest, u8DestMode, u8DeliveryMode, iVector, u8Polarity, u8TriggerMode)); … … 4271 4142 4272 4143 4273 #ifdef VBOX_WITH_PDM_LOCK4274 4144 /** @copydoc PDMIOAPICHLPR3::pfnLock */ 4275 4145 static DECLCALLBACK(int) pdmR3IoApicHlp_Lock(PPDMDEVINS pDevIns, int rc) … … 4286 4156 pdmUnlock(pDevIns->Internal.s.pVMHC); 4287 4157 } 4288 #endif /* VBOX_WITH_PDM_LOCK */4289 4158 4290 4159 … … 4323 4192 { 4324 4193 PDMDEV_ASSERT_DEVINS(pDevIns); 4325 #ifndef VBOX_WITH_PDM_LOCK4326 VM_ASSERT_EMT(pDevIns->Internal.s.pVMHC);4327 #endif4328 4194 Log4(("pdmR3PciHlp_IsaSetIrq: iIrq=%d iLevel=%d\n", iIrq, iLevel)); 4329 4195 PDMIsaSetIrq(pDevIns->Internal.s.pVMHC, iIrq, iLevel); … … 4335 4201 { 4336 4202 PDMDEV_ASSERT_DEVINS(pDevIns); 4337 #ifndef VBOX_WITH_PDM_LOCK4338 VM_ASSERT_EMT(pDevIns->Internal.s.pVMHC);4339 #endif4340 4203 Log4(("pdmR3PciHlp_IsaSetIrq: iIrq=%d iLevel=%d\n", iIrq, iLevel)); 4341 4204 PDMIoApicSetIrq(pDevIns->Internal.s.pVMHC, iIrq, iLevel); … … 4354 4217 4355 4218 4356 #ifdef VBOX_WITH_PDM_LOCK4357 4219 /** @copydoc PDMPCIHLPR3::pfnLock */ 4358 4220 static DECLCALLBACK(int) pdmR3PciHlp_Lock(PPDMDEVINS pDevIns, int rc) … … 4369 4231 pdmUnlock(pDevIns->Internal.s.pVMHC); 4370 4232 } 4371 #endif /* VBOX_WITH_PDM_LOCK */4372 4233 4373 4234 trunk/src/VBox/VMM/PDMInternal.h
r9387 r10202 850 850 /** @} */ 851 851 852 #ifdef VBOX_WITH_PDM_LOCK853 852 /** The PDM lock. 854 853 * This is used to protect everything that deals with interrupts, i.e. 855 854 * the PIC, APIC, IOAPIC and PCI devices pluss some PDM functions. */ 856 855 PDMCRITSECT CritSect; 857 #endif858 859 856 860 857 /** Number of times a critical section leave requesed needed to be queued for ring-3 execution. */ … … 940 937 #endif /* IN_RING3 */ 941 938 942 #ifdef VBOX_WITH_PDM_LOCK943 939 void pdmLock(PVM pVM); 944 940 int pdmLockEx(PVM pVM, int rc); 945 941 void pdmUnlock(PVM pVM); 946 #else947 # define pdmLock(pVM) do {} while (0)948 # define pdmLockEx(pVM, rc) (VINF_SUCCESS)949 # define pdmUnlock(pVM) do {} while (0)950 #endif951 942 952 943 /** @} */ trunk/src/VBox/VMM/VMMAll/PDMAll.cpp
r8155 r10202 83 83 } 84 84 85 #ifndef VBOX_WITH_PDM_LOCK /** @todo Figure out exactly why we can get here without anything being set. (REM) */ 86 /* Shouldn't get here! Noone should call us without cause. */ 87 Assert(VM_FF_ISPENDING(pVM, VM_FF_INTERRUPT_APIC | VM_FF_INTERRUPT_PIC)); 88 #endif 85 /** @todo Figure out exactly why we can get here without anything being set. (REM) */ 86 89 87 pdmUnlock(pVM); 90 88 return VERR_NO_DATA; … … 232 230 233 231 234 #ifdef VBOX_WITH_PDM_LOCK235 232 /** 236 233 * Locks PDM. … … 249 246 # ifdef IN_GC 250 247 rc = VMMGCCallHost(pVM, VMMCALLHOST_PDM_LOCK, 0); 251 # else248 # else 252 249 rc = VMMR0CallHost(pVM, VMMCALLHOST_PDM_LOCK, 0); 253 # endif250 # endif 254 251 } 255 252 #endif … … 281 278 PDMCritSectLeave(&pVM->pdm.s.CritSect); 282 279 } 283 #endif /* VBOX_WITH_PDM_LOCK */ 284 280 trunk/src/VBox/VMM/VMMGC/PDMGCDevice.cpp
r9231 r10202 91 91 static DECLCALLBACK(void) pdmGCPicHlp_SetInterruptFF(PPDMDEVINS pDevIns); 92 92 static DECLCALLBACK(void) pdmGCPicHlp_ClearInterruptFF(PPDMDEVINS pDevIns); 93 #ifdef VBOX_WITH_PDM_LOCK94 93 static DECLCALLBACK(int) pdmGCPicHlp_Lock(PPDMDEVINS pDevIns, int rc); 95 94 static DECLCALLBACK(void) pdmGCPicHlp_Unlock(PPDMDEVINS pDevIns); 96 #endif97 95 /** @} */ 98 96 … … 104 102 static DECLCALLBACK(void) pdmGCApicHlp_ClearInterruptFF(PPDMDEVINS pDevIns); 105 103 static DECLCALLBACK(void) pdmGCApicHlp_ChangeFeature(PPDMDEVINS pDevIns, bool fEnabled); 106 #ifdef VBOX_WITH_PDM_LOCK107 104 static DECLCALLBACK(int) pdmGCApicHlp_Lock(PPDMDEVINS pDevIns, int rc); 108 105 static DECLCALLBACK(void) pdmGCApicHlp_Unlock(PPDMDEVINS pDevIns); 109 #endif110 106 /** @} */ 111 107 … … 116 112 static DECLCALLBACK(void) pdmGCIoApicHlp_ApicBusDeliver(PPDMDEVINS pDevIns, uint8_t u8Dest, uint8_t u8DestMode, uint8_t u8DeliveryMode, 117 113 uint8_t iVector, uint8_t u8Polarity, uint8_t u8TriggerMode); 118 #ifdef VBOX_WITH_PDM_LOCK119 114 static DECLCALLBACK(int) pdmGCIoApicHlp_Lock(PPDMDEVINS pDevIns, int rc); 120 115 static DECLCALLBACK(void) pdmGCIoApicHlp_Unlock(PPDMDEVINS pDevIns); 121 #endif122 116 /** @} */ 123 117 … … 128 122 static DECLCALLBACK(void) pdmGCPciHlp_IsaSetIrq(PPDMDEVINS pDevIns, int iIrq, int iLevel); 129 123 static DECLCALLBACK(void) pdmGCPciHlp_IoApicSetIrq(PPDMDEVINS pDevIns, int iIrq, int iLevel); 130 #ifdef VBOX_WITH_PDM_LOCK131 124 static DECLCALLBACK(int) pdmGCPciHlp_Lock(PPDMDEVINS pDevIns, int rc); 132 125 static DECLCALLBACK(void) pdmGCPciHlp_Unlock(PPDMDEVINS pDevIns); 133 #endif134 126 /** @} */ 135 127 … … 167 159 pdmGCPicHlp_SetInterruptFF, 168 160 pdmGCPicHlp_ClearInterruptFF, 169 #ifdef VBOX_WITH_PDM_LOCK170 161 pdmGCPicHlp_Lock, 171 162 pdmGCPicHlp_Unlock, 172 #endif173 163 PDM_PICHLPGC_VERSION 174 164 }; … … 184 174 pdmGCApicHlp_ClearInterruptFF, 185 175 pdmGCApicHlp_ChangeFeature, 186 #ifdef VBOX_WITH_PDM_LOCK187 176 pdmGCApicHlp_Lock, 188 177 pdmGCApicHlp_Unlock, 189 #endif190 178 PDM_APICHLPGC_VERSION 191 179 }; … … 199 187 PDM_IOAPICHLPGC_VERSION, 200 188 pdmGCIoApicHlp_ApicBusDeliver, 201 #ifdef VBOX_WITH_PDM_LOCK202 189 pdmGCIoApicHlp_Lock, 203 190 pdmGCIoApicHlp_Unlock, 204 #endif205 191 PDM_IOAPICHLPGC_VERSION 206 192 }; … … 215 201 pdmGCPciHlp_IsaSetIrq, 216 202 pdmGCPciHlp_IoApicSetIrq, 217 #ifdef VBOX_WITH_PDM_LOCK218 203 pdmGCPciHlp_Lock, 219 204 pdmGCPciHlp_Unlock, 220 #endif221 205 PDM_PCIHLPGC_VERSION, /* the end */ 222 206 }; … … 388 372 389 373 390 #ifdef VBOX_WITH_PDM_LOCK391 374 /** @copydoc PDMPICHLPGC::pfnLock */ 392 375 static DECLCALLBACK(int) pdmGCPicHlp_Lock(PPDMDEVINS pDevIns, int rc) … … 403 386 pdmUnlock(pDevIns->Internal.s.pVMGC); 404 387 } 405 #endif /* VBOX_WITH_PDM_LOCK */406 388 407 389 … … 440 422 441 423 442 #ifdef VBOX_WITH_PDM_LOCK443 424 /** @copydoc PDMAPICHLPGC::pfnLock */ 444 425 static DECLCALLBACK(int) pdmGCApicHlp_Lock(PPDMDEVINS pDevIns, int rc) … … 455 436 pdmUnlock(pDevIns->Internal.s.pVMGC); 456 437 } 457 #endif /* VBOX_WITH_PDM_LOCK */458 438 459 439 … … 473 453 474 454 475 #ifdef VBOX_WITH_PDM_LOCK476 455 /** @copydoc PDMIOAPICHLPGC::pfnLock */ 477 456 static DECLCALLBACK(int) pdmGCIoApicHlp_Lock(PPDMDEVINS pDevIns, int rc) … … 488 467 pdmUnlock(pDevIns->Internal.s.pVMGC); 489 468 } 490 #endif /* VBOX_WITH_PDM_LOCK */491 469 492 470 … … 511 489 512 490 513 #ifdef VBOX_WITH_PDM_LOCK514 491 /** @copydoc PDMPCIHLPGC::pfnLock */ 515 492 static DECLCALLBACK(int) pdmGCPciHlp_Lock(PPDMDEVINS pDevIns, int rc) … … 526 503 pdmUnlock(pDevIns->Internal.s.pVMGC); 527 504 } 528 #endif /* VBOX_WITH_PDM_LOCK */529 505 530 506 trunk/src/VBox/VMM/VMMR0/PDMR0Device.cpp
r8155 r10202 91 91 static DECLCALLBACK(void) pdmR0PicHlp_SetInterruptFF(PPDMDEVINS pDevIns); 92 92 static DECLCALLBACK(void) pdmR0PicHlp_ClearInterruptFF(PPDMDEVINS pDevIns); 93 #ifdef VBOX_WITH_PDM_LOCK94 93 static DECLCALLBACK(int) pdmR0PicHlp_Lock(PPDMDEVINS pDevIns, int rc); 95 94 static DECLCALLBACK(void) pdmR0PicHlp_Unlock(PPDMDEVINS pDevIns); 96 #endif97 95 /** @} */ 98 96 … … 104 102 static DECLCALLBACK(void) pdmR0ApicHlp_ClearInterruptFF(PPDMDEVINS pDevIns); 105 103 static DECLCALLBACK(void) pdmR0ApicHlp_ChangeFeature(PPDMDEVINS pDevIns, bool fEnabled); 106 #ifdef VBOX_WITH_PDM_LOCK107 104 static DECLCALLBACK(int) pdmR0ApicHlp_Lock(PPDMDEVINS pDevIns, int rc); 108 105 static DECLCALLBACK(void) pdmR0ApicHlp_Unlock(PPDMDEVINS pDevIns); 109 #endif110 106 /** @} */ 111 107 … … 116 112 static DECLCALLBACK(void) pdmR0IoApicHlp_ApicBusDeliver(PPDMDEVINS pDevIns, uint8_t u8Dest, uint8_t u8DestMode, uint8_t u8DeliveryMode, 117 113 uint8_t iVector, uint8_t u8Polarity, uint8_t u8TriggerMode); 118 #ifdef VBOX_WITH_PDM_LOCK119 114 static DECLCALLBACK(int) pdmR0IoApicHlp_Lock(PPDMDEVINS pDevIns, int rc); 120 115 static DECLCALLBACK(void) pdmR0IoApicHlp_Unlock(PPDMDEVINS pDevIns); 121 #endif122 116 /** @} */ 123 117 … … 128 122 static DECLCALLBACK(void) pdmR0PciHlp_IsaSetIrq(PPDMDEVINS pDevIns, int iIrq, int iLevel); 129 123 static DECLCALLBACK(void) pdmR0PciHlp_IoApicSetIrq(PPDMDEVINS pDevIns, int iIrq, int iLevel); 130 #ifdef VBOX_WITH_PDM_LOCK131 124 static DECLCALLBACK(int) pdmR0PciHlp_Lock(PPDMDEVINS pDevIns, int rc); 132 125 static DECLCALLBACK(void) pdmR0PciHlp_Unlock(PPDMDEVINS pDevIns); 133 #endif134 126 /** @} */ 135 127 … … 167 159 pdmR0PicHlp_SetInterruptFF, 168 160 pdmR0PicHlp_ClearInterruptFF, 169 #ifdef VBOX_WITH_PDM_LOCK170 161 pdmR0PicHlp_Lock, 171 162 pdmR0PicHlp_Unlock, 172 #endif173 163 PDM_PICHLPR0_VERSION 174 164 }; … … 184 174 pdmR0ApicHlp_ClearInterruptFF, 185 175 pdmR0ApicHlp_ChangeFeature, 186 #ifdef VBOX_WITH_PDM_LOCK187 176 pdmR0ApicHlp_Lock, 188 177 pdmR0ApicHlp_Unlock, 189 #endif190 178 PDM_APICHLPR0_VERSION 191 179 }; … … 199 187 PDM_IOAPICHLPR0_VERSION, 200 188 pdmR0IoApicHlp_ApicBusDeliver, 201 #ifdef VBOX_WITH_PDM_LOCK202 189 pdmR0IoApicHlp_Lock, 203 190 pdmR0IoApicHlp_Unlock, 204 #endif205 191 PDM_IOAPICHLPR0_VERSION 206 192 }; … … 215 201 pdmR0PciHlp_IsaSetIrq, 216 202 pdmR0PciHlp_IoApicSetIrq, 217 #ifdef VBOX_WITH_PDM_LOCK218 203 pdmR0PciHlp_Lock, 219 204 pdmR0PciHlp_Unlock, 220 #endif221 205 PDM_PCIHLPR0_VERSION, /* the end */ 222 206 }; … … 392 376 393 377 394 #ifdef VBOX_WITH_PDM_LOCK395 378 /** @copydoc PDMPICHLPR0::pfnLock */ 396 379 static DECLCALLBACK(int) pdmR0PicHlp_Lock(PPDMDEVINS pDevIns, int rc) … … 407 390 pdmUnlock(pDevIns->Internal.s.pVMHC); 408 391 } 409 #endif /* VBOX_WITH_PDM_LOCK */410 392 411 393 … … 444 426 445 427 446 #ifdef VBOX_WITH_PDM_LOCK447 428 /** @copydoc PDMAPICHLPR0::pfnLock */ 448 429 static DECLCALLBACK(int) pdmR0ApicHlp_Lock(PPDMDEVINS pDevIns, int rc) … … 459 440 pdmUnlock(pDevIns->Internal.s.pVMHC); 460 441 } 461 #endif /* VBOX_WITH_PDM_LOCK */462 442 463 443 … … 478 458 479 459 480 #ifdef VBOX_WITH_PDM_LOCK481 460 /** @copydoc PDMIOAPICHLPR0::pfnLock */ 482 461 static DECLCALLBACK(int) pdmR0IoApicHlp_Lock(PPDMDEVINS pDevIns, int rc) … … 493 472 pdmUnlock(pDevIns->Internal.s.pVMHC); 494 473 } 495 #endif /* VBOX_WITH_PDM_LOCK */496 474 497 475 … … 517 495 518 496 519 #ifdef VBOX_WITH_PDM_LOCK520 497 /** @copydoc PDMPCIHLPR0::pfnLock */ 521 498 static DECLCALLBACK(int) pdmR0PciHlp_Lock(PPDMDEVINS pDevIns, int rc) … … 532 509 pdmUnlock(pDevIns->Internal.s.pVMHC); 533 510 } 534 #endif /* VBOX_WITH_PDM_LOCK */535 511 536 512 trunk/src/VBox/VMM/testcase/tstVMStructGC.cpp
r9397 r10202 306 306 GEN_CHECK_OFF(PDM, aDrvInsPollers); 307 307 GEN_CHECK_OFF(PDM, pTimerPollers); 308 #ifdef VBOX_WITH_PDM_LOCK309 308 GEN_CHECK_OFF(PDM, CritSect); 310 #endif311 309 GEN_CHECK_OFF(PDM, StatQueuedCritSectLeaves); 312 310 GEN_CHECK_SIZE(PDMDEVINSINT);

