Changeset 107171 in vbox for trunk/src/VBox/VMM/VMMR3
- Timestamp:
- Nov 28, 2024 10:38:10 AM (7 weeks ago)
- Location:
- trunk/src/VBox/VMM/VMMR3
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR3/GMM.cpp
r106061 r107171 50 50 GMMOCPOLICY enmPolicy, GMMPRIORITY enmPriority) 51 51 { 52 #if defined(VBOX_WITH_R0_MODULES) && !defined(VBOX_WITH_MINIMAL_R0) 52 53 if (!SUPR3IsDriverless()) 53 54 { … … 62 63 return VMMR3CallR0(pVM, VMMR0_DO_GMM_INITIAL_RESERVATION, 0, &Req.Hdr); 63 64 } 65 #else 66 RT_NOREF(pVM, cBasePages, cShadowPages, cFixedPages, enmPolicy, enmPriority); 67 #endif 64 68 return VINF_SUCCESS; 65 69 } … … 71 75 GMMR3DECL(int) GMMR3UpdateReservation(PVM pVM, uint64_t cBasePages, uint32_t cShadowPages, uint32_t cFixedPages) 72 76 { 77 #if defined(VBOX_WITH_R0_MODULES) && !defined(VBOX_WITH_MINIMAL_R0) 73 78 if (!SUPR3IsDriverless()) 74 79 { … … 81 86 return VMMR3CallR0(pVM, VMMR0_DO_GMM_UPDATE_RESERVATION, 0, &Req.Hdr); 82 87 } 88 #else 89 RT_NOREF(pVM, cBasePages, cShadowPages, cFixedPages); 90 #endif 83 91 return VINF_SUCCESS; 84 92 } … … 269 277 } 270 278 279 #if defined(VBOX_WITH_R0_MODULES) && !defined(VBOX_WITH_MINIMAL_R0) 271 280 272 281 /** … … 432 441 433 442 434 # if defined(VBOX_STRICT) && HC_ARCH_BITS == 64443 # if defined(VBOX_STRICT) && HC_ARCH_BITS == 64 435 444 /** 436 445 * @see GMMR0FindDuplicatePage … … 450 459 return false; 451 460 } 452 #endif /* VBOX_STRICT && HC_ARCH_BITS == 64 */ 453 461 # endif /* VBOX_STRICT && HC_ARCH_BITS == 64 */ 462 463 #endif /* defined(VBOX_WITH_R0_MODULES) && !defined(VBOX_WITH_MINIMAL_R0) */ 464 -
trunk/src/VBox/VMM/VMMR3/PGM-armv8.cpp
r106670 r107171 72 72 73 73 /********************************************************************************************************************************* 74 * Structures and Typedefs *75 *********************************************************************************************************************************/76 77 78 /*********************************************************************************************************************************79 74 * Internal Functions * 80 75 *********************************************************************************************************************************/ … … 101 96 { 102 97 AssertFatal(!PDMCritSectIsInitialized(&pVM->pgm.s.CritSectX)); 98 #ifndef VBOX_WITH_ONLY_PGM_NEM_MODE 103 99 pVM->pgm.s.fNemMode = true; 100 #endif 104 101 } 105 102 … … 113 110 VMMR3_INT_DECL(bool) PGMR3IsNemModeEnabled(PVM pVM) 114 111 { 115 return pVM->pgm.s.fNemMode; 112 RT_NOREF(pVM); 113 return PGM_IS_IN_NEM_MODE(pVM); 116 114 } 117 115 … … 126 124 { 127 125 LogFlow(("PGMR3Init:\n")); 128 PCFGMNODE pCfgPGM = CFGMR3GetChild(CFGMR3GetRoot(pVM), "/PGM");129 int rc;130 126 131 127 /* … … 136 132 AssertCompileMemberAlignment(PGM, CritSectX, sizeof(uintptr_t)); 137 133 138 /*139 * If we're in driveless mode we have to use the simplified memory mode.140 */141 134 bool const fDriverless = SUPR3IsDriverless(); 142 AssertReturn(fDriverless, VERR_NOT_SUPPORTED);143 if (!pVM->pgm.s.fNemMode)144 pVM->pgm.s.fNemMode = true;145 135 146 136 /* … … 148 138 */ 149 139 /*pVM->pgm.s.fRestoreRomPagesAtReset = false;*/ 140 141 /* We always use the simplified memory mode on arm. */ 142 #ifndef VBOX_WITH_ONLY_PGM_NEM_MODE 143 pVM->pgm.s.fNemMode = true; 144 #endif 150 145 151 146 for (unsigned i = 0; i < RT_ELEMENTS(pVM->pgm.s.aHandyPages); i++) … … 168 163 for (size_t i = 0; i < RT_ELEMENTS(pVM->pgm.s.aPhysHandlerTypes); i++) 169 164 { 165 #if defined(VBOX_WITH_R0_MODULES) && !defined(VBOX_WITH_MINIMAL_R0) 170 166 if (fDriverless) 167 #endif 171 168 pVM->pgm.s.aPhysHandlerTypes[i].hType = i | (RTRandU64() & ~(uint64_t)PGMPHYSHANDLERTYPE_IDX_MASK); 172 169 pVM->pgm.s.aPhysHandlerTypes[i].enmKind = PGMPHYSHANDLERKIND_INVALID; … … 183 180 #endif 184 181 185 rc = CFGMR3QueryBoolDef(CFGMR3GetRoot(pVM), "RamPreAlloc", &pVM->pgm.s.fRamPreAlloc, 182 /* 183 * Read the configuration. 184 */ 185 PCFGMNODE const pCfgPGM = CFGMR3GetChild(CFGMR3GetRoot(pVM), "/PGM"); 186 187 int rc = CFGMR3QueryBoolDef(CFGMR3GetRoot(pVM), "RamPreAlloc", &pVM->pgm.s.fRamPreAlloc, 186 188 #ifdef VBOX_WITH_PREALLOC_RAM_BY_DEFAULT 187 189 true … … 252 254 */ 253 255 RT_ZERO(pVM->pgm.s.abZeroPg); /* paranoia */ 256 #ifndef VBOX_WITH_ONLY_PGM_NEM_MODE 254 257 if (fDriverless) 255 258 pVM->pgm.s.HCPhysZeroPg = _4G - GUEST_PAGE_SIZE * 2 /* fake to avoid PGM_PAGE_INIT_ZERO assertion */; 256 259 AssertRelease(pVM->pgm.s.HCPhysZeroPg != NIL_RTHCPHYS); 257 260 AssertRelease(pVM->pgm.s.HCPhysZeroPg != 0); 261 #endif 258 262 259 263 /* … … 262 266 */ 263 267 ASMMemFill32(pVM->pgm.s.abMmioPg, sizeof(pVM->pgm.s.abMmioPg), 0xfeedface); 268 #ifndef VBOX_WITH_ONLY_PGM_NEM_MODE 264 269 if (fDriverless) 265 270 pVM->pgm.s.HCPhysMmioPg = _4G - GUEST_PAGE_SIZE * 3 /* fake to avoid PGM_PAGE_INIT_ZERO assertion */; … … 267 272 AssertRelease(pVM->pgm.s.HCPhysMmioPg != 0); 268 273 pVM->pgm.s.HCPhysInvMmioPg = pVM->pgm.s.HCPhysMmioPg; 274 #endif 269 275 270 276 /* … … 282 288 AssertLogRelMsgStmt(cAccessHandlers >= 32, ("cAccessHandlers=%#x, min 32\n", cAccessHandlers), cAccessHandlers = 32); 283 289 AssertLogRelMsgStmt(cAccessHandlers <= _64K, ("cAccessHandlers=%#x, max 65536\n", cAccessHandlers), cAccessHandlers = _64K); 290 #if defined(VBOX_WITH_R0_MODULES) && !defined(VBOX_WITH_MINIMAL_R0) 284 291 if (!fDriverless) 285 292 { … … 291 298 } 292 299 else 300 #endif 293 301 { 294 302 uint32_t cbTreeAndBitmap = 0; … … 331 339 332 340 /** 333 * Ring-3 init finalizing .341 * Ring-3 init finalizing (not required here). 334 342 * 335 343 * @returns VBox status code. … … 338 346 VMMR3DECL(int) PGMR3InitFinalize(PVM pVM) 339 347 { 340 /* 341 * Allocate memory if we're supposed to do that. 342 */ 348 RT_NOREF(pVM); 343 349 int rc = VINF_SUCCESS; 350 #ifndef VBOX_WITH_ONLY_PGM_NEM_MODE 344 351 if (pVM->pgm.s.fRamPreAlloc) 345 352 rc = pgmR3PhysRamPreAllocate(pVM); 353 #endif 346 354 347 355 //pgmLogState(pVM); 348 LogRel(("PGM: PGMR3InitFinalize : 4 MB PSE mask %RGp -> %Rrc\n", pVM->pgm.s.GCPhys4MBPSEMask, rc));356 LogRel(("PGM: PGMR3InitFinalize done: %Rrc\n", rc)); 349 357 return rc; 350 358 } … … 511 519 VMMDECL(bool) PGMHasDirtyPages(PVM pVM) 512 520 { 521 #ifndef VBOX_WITH_ONLY_PGM_NEM_MODE 513 522 return pVM->pgm.s.CTX_SUFF(pPool)->cDirtyPages != 0; 523 #else 524 RT_NOREF(pVM); 525 return false; 526 #endif 514 527 } 515 528 … … 730 743 731 744 CPUMMODE enmCpuMode = CPUMGetGuestMode(pVCpu); 732 return 733 734 745 return enmCpuMode == CPUMMODE_ARMV8_AARCH64 746 ? PGMMODE_VMSA_V8_64 747 : PGMMODE_VMSA_V8_32; 735 748 } 736 749 … … 1000 1013 return pgmGstPtWalk(pVCpu, GCPtr, pWalk, pGstWalk); /** @todo Always do full walk for now. */ 1001 1014 } 1015 -
trunk/src/VBox/VMM/VMMR3/PGM.cpp
r106061 r107171 737 737 { 738 738 AssertFatal(!PDMCritSectIsInitialized(&pVM->pgm.s.CritSectX)); 739 # ifndef VBOX_WITH_ONLY_PGM_NEM_MODE 739 740 if (!pVM->pgm.s.fNemMode) 740 741 { … … 742 743 pVM->pgm.s.fNemMode = true; 743 744 } 745 # endif 744 746 } 745 747 … … 753 755 VMMR3_INT_DECL(bool) PGMR3IsNemModeEnabled(PVM pVM) 754 756 { 755 return pVM->pgm.s.fNemMode; 757 RT_NOREF(pVM); 758 return PGM_IS_IN_NEM_MODE(pVM); 756 759 } 757 760 … … 784 787 { 785 788 #ifdef VBOX_WITH_PGM_NEM_MODE 786 if (!pVM->pgm.s.fNemMode) 789 # ifndef VBOX_WITH_ONLY_PGM_NEM_MODE 790 if (!PGM_IS_IN_NEM_MODE(pVM)) 787 791 { 788 792 LogRel(("PGM: Enabling NEM mode (driverless)\n")); 789 793 pVM->pgm.s.fNemMode = true; 790 794 } 795 # endif 791 796 #else 792 797 return VMR3SetError(pVM->pUVM, VERR_SUP_DRIVERLESS, RT_SRC_POS, … … 954 959 */ 955 960 RT_ZERO(pVM->pgm.s.abZeroPg); /* paranoia */ 961 #ifndef VBOX_WITH_ONLY_PGM_NEM_MODE 956 962 if (fDriverless) 957 963 pVM->pgm.s.HCPhysZeroPg = _4G - GUEST_PAGE_SIZE * 2 /* fake to avoid PGM_PAGE_INIT_ZERO assertion */; … … 959 965 AssertRelease(pVM->pgm.s.HCPhysZeroPg != 0); 960 966 Log(("HCPhysZeroPg=%RHp abZeroPg=%p\n", pVM->pgm.s.HCPhysZeroPg, pVM->pgm.s.abZeroPg)); 967 #endif 961 968 962 969 /* … … 965 972 */ 966 973 ASMMemFill32(pVM->pgm.s.abMmioPg, sizeof(pVM->pgm.s.abMmioPg), 0xfeedface); 974 #ifndef VBOX_WITH_ONLY_PGM_NEM_MODE 967 975 if (fDriverless) 968 976 pVM->pgm.s.HCPhysMmioPg = _4G - GUEST_PAGE_SIZE * 3 /* fake to avoid PGM_PAGE_INIT_ZERO assertion */; … … 971 979 pVM->pgm.s.HCPhysInvMmioPg = pVM->pgm.s.HCPhysMmioPg; 972 980 Log(("HCPhysInvMmioPg=%RHp abMmioPg=%p\n", pVM->pgm.s.HCPhysMmioPg, pVM->pgm.s.abMmioPg)); 981 #endif VBOX_WITH_ONLY_PGM_NEM_MODE 982 973 983 974 984 /* … … 986 996 AssertLogRelMsgStmt(cAccessHandlers >= 32, ("cAccessHandlers=%#x, min 32\n", cAccessHandlers), cAccessHandlers = 32); 987 997 AssertLogRelMsgStmt(cAccessHandlers <= _64K, ("cAccessHandlers=%#x, max 65536\n", cAccessHandlers), cAccessHandlers = _64K); 998 #if defined(VBOX_WITH_R0_MODULES) && !defined(VBOX_WITH_MINIMAL_R0) 988 999 if (!fDriverless) 989 1000 { … … 995 1006 } 996 1007 else 1008 #endif 997 1009 { 998 1010 uint32_t cbTreeAndBitmap = 0; … … 1772 1784 */ 1773 1785 int rc = VINF_SUCCESS; 1786 #ifndef VBOX_WITH_ONLY_PGM_NEM_MODE 1774 1787 if (pVM->pgm.s.fRamPreAlloc) 1775 1788 rc = pgmR3PhysRamPreAllocate(pVM); 1789 #endif 1776 1790 1777 1791 //pgmLogState(pVM); … … 2338 2352 } 2339 2353 2354 #ifndef VBOX_WITH_ONLY_PGM_NEM_MODE 2340 2355 Assert(pVCpu->pgm.s.pShwPageCR3R3 == NULL); 2356 #endif 2341 2357 return rc; 2342 2358 } … … 2358 2374 AssertRCSuccessReturn(rc, VERR_IPE_UNEXPECTED_INFO_STATUS); 2359 2375 2376 #ifndef VBOX_WITH_ONLY_PGM_NEM_MODE 2360 2377 Assert(pVCpu->pgm.s.pShwPageCR3R3 != NULL || pVCpu->pgm.s.enmShadowMode == PGMMODE_NONE); 2378 #endif 2361 2379 AssertMsg( pVCpu->pgm.s.enmShadowMode >= PGMMODE_NESTED_32BIT 2362 2380 || CPUMGetHyperCR3(pVCpu) == PGMGetHyperCR3(pVCpu), -
trunk/src/VBox/VMM/VMMR3/PGMDbg.cpp
r106382 r107171 1289 1289 } 1290 1290 1291 #ifndef VBOX_WITH_ONLY_PGM_NEM_MODE 1291 1292 1292 1293 /** … … 2214 2215 } 2215 2216 2217 #endif /* !VBOX_WITH_ONLY_PGM_NEM_MODE */ 2218 2216 2219 2217 2220 /** … … 2237 2240 AssertReturn(fFlags & DBGFPGDMP_FLAGS_SHADOW, VERR_INVALID_PARAMETER); 2238 2241 2242 #ifndef VBOX_WITH_ONLY_PGM_NEM_MODE 2239 2243 PGMR3DUMPHIERARCHYSTATE State; 2240 2244 pgmR3DumpHierarchyInitState(&State, pVM, fFlags, u64FirstAddr, u64LastAddr, pHlp); … … 2243 2247 PGM_UNLOCK(pVM); 2244 2248 return rc; 2249 #else 2250 RT_NOREF(pVM, cr3, fFlags, u64FirstAddr, u64LastAddr, cMaxDepth, pHlp); 2251 return VINF_SUCCESS; 2252 #endif 2245 2253 } 2246 2254 -
trunk/src/VBox/VMM/VMMR3/PGMPhys.cpp
r106590 r107171 1595 1595 PGMPAGETYPE enmNewType) 1596 1596 { 1597 RT_NOREF(enmNewType, pcPendingPages); 1598 1597 1599 /* 1598 1600 * Assert sanity. … … 1625 1627 return VMSetError(pVM, VERR_PGM_PHYS_INVALID_PAGE_ID, RT_SRC_POS, "GCPhys=%RGp idPage=%#x", GCPhys, pPage); 1626 1628 } 1627 #if def VBOX_WITH_NATIVE_NEM1629 #if defined(VBOX_WITH_NATIVE_NEM) && !defined(VBOX_WITH_ONLY_PGM_NEM_MODE) 1628 1630 const RTHCPHYS HCPhysPrev = PGM_PAGE_GET_HCPHYS(pPage); 1629 1631 #endif … … 1658 1660 IEMTlbInvalidateAllPhysicalAllCpus(pVM, NIL_VMCPUID, IEMTLBPHYSFLUSHREASON_FREED); /// @todo move to the perform step. 1659 1661 1660 #ifdef VBOX_WITH_PGM_NEM_MODE 1662 #ifndef VBOX_WITH_ONLY_PGM_NEM_MODE 1663 # ifdef VBOX_WITH_PGM_NEM_MODE 1661 1664 /* 1662 1665 * Skip the rest if we're doing a bulk free in NEM memory mode. … … 1665 1668 return VINF_SUCCESS; 1666 1669 AssertLogRelReturn(!pVM->pgm.s.fNemMode, VERR_PGM_NOT_SUPPORTED_FOR_NEM_MODE); 1667 # endif1668 1669 # ifdef VBOX_WITH_NATIVE_NEM1670 # endif 1671 1672 # ifdef VBOX_WITH_NATIVE_NEM 1670 1673 /* Notify NEM. */ 1671 1674 /** @todo Remove this one? */ … … 1677 1680 PGM_PAGE_SET_NEM_STATE(pPage, u2State); 1678 1681 } 1679 #else 1680 RT_NOREF(enmNewType); 1681 #endif 1682 # endif 1682 1683 1683 1684 /* … … 1722 1723 } 1723 1724 return rc; 1724 } 1725 1726 1727 /** 1728 * Frees a range of pages, replacing them with ZERO pages of the specified type. 1725 1726 #else /* VBOX_WITH_ONLY_PGM_NEM_MODE */ 1727 Assert(!pReq); RT_NOREF(pReq); 1728 return VINF_SUCCESS; 1729 #endif /* VBOX_WITH_ONLY_PGM_NEM_MODE */ 1730 } 1731 1732 1733 /** 1734 * Frees a range of pages, replacing them with MMIO ZERO pages. 1729 1735 * 1730 1736 * @returns VBox status code. … … 1739 1745 { 1740 1746 PGM_LOCK_ASSERT_OWNER(pVM); 1747 /** @todo pvMmio2 is always NULL. */ 1741 1748 1742 1749 #ifdef VBOX_WITH_PGM_NEM_MODE … … 1745 1752 * we just unmap it and let NEM do any unlocking of it. 1746 1753 */ 1754 # ifndef VBOX_WITH_ONLY_PGM_NEM_MODE 1747 1755 if (pVM->pgm.s.fNemMode) 1756 # endif 1748 1757 { 1749 1758 Assert(VM_IS_NEM_ENABLED(pVM) || VM_IS_EXEC_ENGINE_IEM(pVM)); … … 1777 1786 RT_NOREF(pvMmio2); 1778 1787 #endif /* !VBOX_WITH_PGM_NEM_MODE */ 1788 #ifndef VBOX_WITH_ONLY_PGM_NEM_MODE 1779 1789 1780 1790 /* … … 1787 1797 AssertLogRelRCReturn(rc, rc); 1788 1798 1789 # ifdef VBOX_WITH_NATIVE_NEM1799 # ifdef VBOX_WITH_NATIVE_NEM 1790 1800 /* Tell NEM up-front. */ 1791 1801 uint8_t u2State = UINT8_MAX; … … 1797 1807 AssertLogRelRCReturnStmt(rc, GMMR3FreePagesCleanup(pReq), rc); 1798 1808 } 1799 # endif1809 # endif 1800 1810 1801 1811 /* Iterate the pages. */ … … 1808 1818 1809 1819 PGM_PAGE_SET_TYPE(pVM, pPageDst, PGMPAGETYPE_MMIO); 1810 # ifdef VBOX_WITH_NATIVE_NEM1820 # ifdef VBOX_WITH_NATIVE_NEM 1811 1821 if (u2State != UINT8_MAX) 1812 1822 PGM_PAGE_SET_NEM_STATE(pPageDst, u2State); 1813 # endif1823 # endif 1814 1824 1815 1825 GCPhys += GUEST_PAGE_SIZE; … … 1826 1836 1827 1837 return rc; 1838 #endif /* !VBOX_WITH_ONLY_PGM_NEM_MODE */ 1828 1839 } 1829 1840 … … 1837 1848 PGMPHYSALLOCATERAMRANGEREQ AllocRangeReq; 1838 1849 AllocRangeReq.idNewRange = UINT32_MAX / 4; 1839 if (SUPR3IsDriverless()) 1840 rc = pgmPhysRamRangeAllocCommon(pVM, cGuestPages, fFlags, &AllocRangeReq.idNewRange); 1841 else 1850 #if defined(VBOX_WITH_R0_MODULES) && !defined(VBOX_WITH_MINIMAL_R0) 1851 if (!SUPR3IsDriverless()) 1842 1852 { 1843 1853 AllocRangeReq.Hdr.u32Magic = SUPVMMR0REQHDR_MAGIC; … … 1848 1858 rc = VMMR3CallR0Emt(pVM, pVCpu, VMMR0_DO_PGM_PHYS_ALLOCATE_RAM_RANGE, 0 /*u64Arg*/, &AllocRangeReq.Hdr); 1849 1859 } 1860 else 1861 #endif 1862 rc = pgmPhysRamRangeAllocCommon(pVM, cGuestPages, fFlags, &AllocRangeReq.idNewRange); 1850 1863 if (RT_SUCCESS(rc)) 1851 1864 { … … 1857 1870 } 1858 1871 1872 RT_NOREF(pVCpu); 1859 1873 *ppRamRange = NULL; 1860 1874 return rc; … … 1890 1904 uint32_t const cPages = pNew->cb >> GUEST_PAGE_SHIFT; 1891 1905 #ifdef VBOX_WITH_PGM_NEM_MODE 1892 if (!pVM->pgm.s.fNemMode) 1893 #endif 1906 if (PGM_IS_IN_NEM_MODE(pVM)) 1894 1907 { 1895 1908 RTGCPHYS iPage = cPages; … … 1901 1914 pVM->pgm.s.cAllPages += cPages; 1902 1915 } 1903 #ifdef VBOX_WITH_PGM_NEM_MODE1904 1916 else 1905 { 1917 #endif 1918 { 1919 #ifndef VBOX_WITH_ONLY_PGM_NEM_MODE 1906 1920 int rc = SUPR3PageAlloc(RT_ALIGN_Z(pNew->cb, HOST_PAGE_SIZE) >> HOST_PAGE_SHIFT, 1907 1921 pVM->pgm.s.fUseLargePages ? SUP_PAGE_ALLOC_F_LARGE_PAGES : 0, (void **)&pNew->pbR3); … … 1917 1931 pVM->pgm.s.cPrivatePages += cPages; 1918 1932 pVM->pgm.s.cAllPages += cPages; 1919 } 1920 #endif 1933 #endif 1934 } 1921 1935 1922 1936 /* … … 2092 2106 2093 2107 2108 #ifndef VBOX_WITH_ONLY_PGM_NEM_MODE 2094 2109 /** 2095 2110 * Worker called by PGMR3InitFinalize if we're configured to pre-allocate RAM. … … 2106 2121 Assert(pVM->pgm.s.fRamPreAlloc); 2107 2122 Log(("pgmR3PhysRamPreAllocate: enter\n")); 2108 #ifdef VBOX_WITH_PGM_NEM_MODE 2109 AssertLogRelReturn(!pVM->pgm.s.fNemMode, VERR_PGM_NOT_SUPPORTED_FOR_NEM_MODE); 2110 #endif 2123 # ifdef VBOX_WITH_PGM_NEM_MODE 2124 if (VM_IS_NEM_ENABLED(pVM)) 2125 { 2126 LogRel(("PGM: Pre-alloc ignored in NEM mode.\n")); 2127 return VINF_SUCCESS; 2128 } 2129 # endif 2111 2130 2112 2131 /* … … 2168 2187 return VINF_SUCCESS; 2169 2188 } 2189 #endif /* !VBOX_WITH_ONLY_PGM_NEM_MODE */ 2170 2190 2171 2191 … … 2248 2268 PGM_LOCK_ASSERT_OWNER(pVM); 2249 2269 2270 #if defined(VBOX_WITH_R0_MODULES) && !defined(VBOX_WITH_MINIMAL_R0) 2250 2271 /* Reset the memory balloon. */ 2251 int rc = GMMR3BalloonedPages(pVM, GMMBALLOONACTION_RESET, 0); 2252 AssertRC(rc); 2272 int rc1 = GMMR3BalloonedPages(pVM, GMMBALLOONACTION_RESET, 0); 2273 AssertRC(rc1); 2274 #endif 2253 2275 2254 2276 #ifdef VBOX_WITH_PAGE_SHARING 2255 2277 /* Clear all registered shared modules. */ 2256 2278 pgmR3PhysAssertSharedPageChecksums(pVM); 2257 rc= GMMR3ResetSharedModules(pVM);2258 AssertRC(rc );2279 int rc2 = GMMR3ResetSharedModules(pVM); 2280 AssertRC(rc2); 2259 2281 #endif 2260 2282 /* Reset counters. */ … … 2301 2323 AssertMsg(((RTGCPHYS)iPage << GUEST_PAGE_SHIFT) == pRam->cb, ("%RGp %RGp\n", (RTGCPHYS)iPage << GUEST_PAGE_SHIFT, pRam->cb)); 2302 2324 2325 #ifndef VBOX_WITH_ONLY_PGM_NEM_MODE 2303 2326 if ( !pVM->pgm.s.fRamPreAlloc 2304 # ifdef VBOX_WITH_PGM_NEM_MODE2327 # ifdef VBOX_WITH_PGM_NEM_MODE 2305 2328 && !pVM->pgm.s.fNemMode 2306 # endif2329 # endif 2307 2330 && pVM->pgm.s.fZeroRamPagesOnReset) 2308 2331 { … … 2354 2377 } 2355 2378 else 2379 #endif /* !VBOX_WITH_ONLY_PGM_NEM_MODE */ 2380 2356 2381 { 2357 2382 /* Zero the memory. */ … … 2438 2463 int pgmR3PhysRamTerm(PVM pVM) 2439 2464 { 2465 int rc; 2440 2466 PGM_LOCK_ASSERT_OWNER(pVM); 2441 2467 2468 #if defined(VBOX_WITH_R0_MODULES) && !defined(VBOX_WITH_MINIMAL_R0) 2442 2469 /* Reset the memory balloon. */ 2443 intrc = GMMR3BalloonedPages(pVM, GMMBALLOONACTION_RESET, 0);2470 rc = GMMR3BalloonedPages(pVM, GMMBALLOONACTION_RESET, 0); 2444 2471 AssertRC(rc); 2472 #endif 2445 2473 2446 2474 #ifdef VBOX_WITH_PAGE_SHARING 2475 2447 2476 /* 2448 2477 * Clear all registered shared modules. … … 3280 3309 * and maybe a ring-0 mapping address for it all. 3281 3310 */ 3282 if (SUPR3IsDriverless()) 3283 rc = pgmPhysMmio2RegisterWorker(pVM, cGuestPages, idMmio2, cChunks, pDevIns, iSubDev, iRegion, fFlags); 3284 else 3311 #if defined(VBOX_WITH_R0_MODULES) && !defined(VBOX_WITH_MINIMAL_R0) 3312 if (!SUPR3IsDriverless()) 3285 3313 { 3286 3314 PGMPHYSMMIO2REGISTERREQ Mmio2RegReq; … … 3297 3325 rc = VMMR3CallR0Emt(pVM, pVCpu, VMMR0_DO_PGM_PHYS_MMIO2_REGISTER, 0 /*u64Arg*/, &Mmio2RegReq.Hdr); 3298 3326 } 3327 else 3328 #endif 3329 rc = pgmPhysMmio2RegisterWorker(pVM, cGuestPages, idMmio2, cChunks, pDevIns, iSubDev, iRegion, fFlags); 3299 3330 if (RT_SUCCESS(rc)) 3300 3331 { … … 3451 3482 const char * const pszDesc = pVM->pgm.s.apMmio2RamRanges[idx] ? pVM->pgm.s.apMmio2RamRanges[idx]->pszDesc : NULL; 3452 3483 int rc2; 3453 if (SUPR3IsDriverless()) 3454 { 3455 Assert(PGM_IS_IN_NEM_MODE(pVM)); 3456 rc2 = pgmPhysMmio2DeregisterWorker(pVM, idx, cChunks, pDevIns); 3457 AssertLogRelMsgStmt(RT_SUCCESS(rc2), 3458 ("pgmPhysMmio2DeregisterWorker: rc=%Rrc idx=%#x cChunks=%#x %s\n", 3459 rc2, idx, cChunks, pszDesc), 3460 rc = RT_SUCCESS(rc) ? rc2 : rc); 3461 } 3462 else 3484 #if defined(VBOX_WITH_R0_MODULES) && !defined(VBOX_WITH_MINIMAL_R0) 3485 if (!SUPR3IsDriverless()) 3463 3486 { 3464 3487 PGMPHYSMMIO2DEREGISTERREQ Mmio2DeregReq; … … 3475 3498 pgmPhysInvalidRamRangeTlbs(pVM); /* Ensure no stale pointers in the ring-3 RAM range TLB. */ 3476 3499 } 3500 else 3501 #endif 3502 { 3503 Assert(PGM_IS_IN_NEM_MODE(pVM)); 3504 rc2 = pgmPhysMmio2DeregisterWorker(pVM, idx, cChunks, pDevIns); 3505 AssertLogRelMsgStmt(RT_SUCCESS(rc2), 3506 ("pgmPhysMmio2DeregisterWorker: rc=%Rrc idx=%#x cChunks=%#x %s\n", 3507 rc2, idx, cChunks, pszDesc), 3508 rc = RT_SUCCESS(rc) ? rc2 : rc); 3509 } 3477 3510 if (RT_FAILURE(rc2)) 3478 3511 { … … 3614 3647 Assert(PGM_PAGE_IS_MMIO(pPageDst)); 3615 3648 3616 RTHCPHYS const HCPhys = PGM_PAGE_GET_HCPHYS(pPageSrc); 3649 RTHCPHYS const HCPhys = PGM_PAGE_GET_HCPHYS(pPageSrc); RT_NOREF_PV(HCPhys); 3617 3650 uint32_t const idPage = PGM_PAGE_GET_PAGEID(pPageSrc); 3618 3651 PGM_PAGE_SET_PAGEID(pVM, pPageDst, idPage); … … 4699 4732 #endif 4700 4733 { 4734 #ifndef VBOX_WITH_ONLY_PGM_NEM_MODE 4701 4735 rc = GMMR3AllocatePagesPrepare(pVM, &pReq, cGuestPages, GMMACCOUNT_BASE); 4702 4736 AssertRCReturn(rc, rc); … … 4716 4750 return rc; 4717 4751 } 4752 #endif 4718 4753 } 4719 4754 … … 4732 4767 * Note! We don't clean up the ROM range here on failure, VM destruction does that. 4733 4768 */ 4734 if (SUPR3IsDriverless()) 4735 rc = pgmPhysRomRangeAllocCommon(pVM, cGuestPages, idRomRange, fFlags); 4736 else 4769 #if defined(VBOX_WITH_R0_MODULES) && !defined(VBOX_WITH_MINIMAL_R0) 4770 if (!SUPR3IsDriverless()) 4737 4771 { 4738 4772 PGMPHYSROMALLOCATERANGEREQ RomRangeReq; … … 4745 4779 rc = VMMR3CallR0Emt(pVM, pVCpu, VMMR0_DO_PGM_PHYS_ROM_ALLOCATE_RANGE, 0 /*u64Arg*/, &RomRangeReq.Hdr); 4746 4780 } 4781 else 4782 #endif 4783 rc = pgmPhysRomRangeAllocCommon(pVM, cGuestPages, idRomRange, fFlags); 4747 4784 } 4748 4785 if (RT_SUCCESS(rc)) … … 4779 4816 #endif 4780 4817 { 4818 #ifndef VBOX_WITH_ONLY_PGM_NEM_MODE 4781 4819 Assert(!pRamRange->pbR3); Assert(!pvRam); 4782 4820 for (uint32_t iPage = 0; iPage < cGuestPages; iPage++, pRamPage++, pRomPage++) … … 4790 4828 pRomPage->Virgin = *pRamPage; 4791 4829 } 4830 #endif 4792 4831 } 4793 4832 … … 4822 4861 #endif 4823 4862 { 4863 #ifndef VBOX_WITH_ONLY_PGM_NEM_MODE 4824 4864 for (uint32_t iPage = 0; iPage < cGuestPages; iPage++, pRamPage++, pRomPage++) 4825 4865 { … … 4836 4876 pVM->pgm.s.cZeroPages -= cGuestPages; 4837 4877 pVM->pgm.s.cPrivatePages += cGuestPages; 4878 #endif 4838 4879 } 4839 4880 pRamRange = pOverlappingRange; … … 5001 5042 #endif 5002 5043 { 5044 #ifndef VBOX_WITH_ONLY_PGM_NEM_MODE 5003 5045 for (uint32_t iPage = 0; iPage < cGuestPages; iPage++, pRamPage++) 5004 5046 PGM_PAGE_INIT_ZERO(pRamPage, pVM, PGMPAGETYPE_RAM); 5005 5047 pVM->pgm.s.cZeroPages += cGuestPages; 5006 5048 pVM->pgm.s.cPrivatePages -= cGuestPages; 5049 #endif 5007 5050 } 5008 5051 } … … 5023 5066 #endif 5024 5067 { 5068 #ifndef VBOX_WITH_ONLY_PGM_NEM_MODE 5025 5069 GMMR3FreeAllocatedPages(pVM, pReq); 5026 5070 GMMR3AllocatePagesCleanup(pReq); 5071 #endif 5027 5072 } 5028 5073 … … 5116 5161 RT_BZERO(pRom->pbR3Alternate, pRom->cb); 5117 5162 } 5163 # ifndef VBOX_WITH_ONLY_PGM_NEM_MODE 5118 5164 else 5119 #endif 5165 # endif 5166 #endif 5167 #ifndef VBOX_WITH_ONLY_PGM_NEM_MODE 5120 5168 if (!pVM->pgm.s.fRamPreAlloc) 5121 5169 { … … 5161 5209 AssertRCReturn(rc, rc); 5162 5210 } 5211 #endif 5163 5212 } 5164 5213 … … 5398 5447 unsigned cPages = paUser[1]; 5399 5448 RTGCPHYS *paPhysPage = (RTGCPHYS *)paUser[2]; 5400 uint32_t cPendingPages = 0; 5401 PGMMFREEPAGESREQ pReq; 5402 int rc; 5449 int rc = VINF_SUCCESS; 5403 5450 5404 5451 Log(("pgmR3PhysChangeMemBalloonRendezvous: %s %x pages\n", (fInflate) ? "inflate" : "deflate", cPages)); … … 5411 5458 5412 5459 /* Replace pages with ZERO pages. */ 5460 uint32_t cPendingPages = 0; 5461 PGMMFREEPAGESREQ pReq = NULL; 5413 5462 rc = GMMR3FreePagesPrepare(pVM, &pReq, PGMPHYS_FREE_PAGE_BATCH_SIZE, GMMACCOUNT_BASE); 5414 5463 if (RT_FAILURE(rc)) … … 5477 5526 } 5478 5527 5528 #if defined(VBOX_WITH_R0_MODULES) && !defined(VBOX_WITH_MINIMAL_R0) 5479 5529 /* Notify GMM about the balloon change. */ 5480 5530 rc = GMMR3BalloonedPages(pVM, (fInflate) ? GMMBALLOONACTION_INFLATE : GMMBALLOONACTION_DEFLATE, cPages); … … 5489 5539 pVM->pgm.s.cBalloonedPages += cPages; 5490 5540 } 5541 #endif 5491 5542 5492 5543 PGM_UNLOCK(pVM); … … 5700 5751 uint64_t cBalloonPages = 0; 5701 5752 uint64_t cSharedPages = 0; 5753 #if defined(VBOX_WITH_R0_MODULES) && !defined(VBOX_WITH_MINIMAL_R0) 5702 5754 if (!SUPR3IsDriverless()) 5703 5755 { … … 5705 5757 AssertRCReturn(rc, rc); 5706 5758 } 5759 #endif 5707 5760 5708 5761 if (pcbAllocMem) -
trunk/src/VBox/VMM/VMMR3/PGMSavedState.cpp
r106061 r107171 3222 3222 rc = pgmR3LoadMemoryOld(pVM, pSSM, uVersion); 3223 3223 3224 #if defined(VBOX_WITH_R0_MODULES) && !defined(VBOX_WITH_MINIMAL_R0) 3224 3225 /* Refresh balloon accounting. */ 3225 3226 if (pVM->pgm.s.cBalloonedPages) … … 3229 3230 AssertRCReturn(rc, rc); 3230 3231 } 3232 #endif 3231 3233 return rc; 3232 3234 }
Note:
See TracChangeset
for help on using the changeset viewer.