Changeset 97736 in vbox for trunk/src/VBox/VMM/VMMAll
- Timestamp:
- Dec 3, 2022 2:00:54 AM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/PGMAllHandler.cpp
r97198 r97736 34 34 #include <VBox/vmm/dbgf.h> 35 35 #include <VBox/vmm/pgm.h> 36 #include <VBox/vmm/iem.h> 36 37 #include <VBox/vmm/iom.h> 37 38 #include <VBox/vmm/mm.h> … … 736 737 * reset where pgmR3PhysRamReset doesn't have the 737 738 * handler structure handy.) 738 */ 739 void pgmHandlerPhysicalResetAliasedPage(PVMCC pVM, PPGMPAGE pPage, RTGCPHYS GCPhysPage, PPGMRAMRANGE pRam, bool fDoAccounting) 739 * @param fFlushIemTlbs Whether to perform IEM TLB flushing or not. This 740 * can be cleared only if the caller does the flushing 741 * after calling this function. 742 */ 743 void pgmHandlerPhysicalResetAliasedPage(PVMCC pVM, PPGMPAGE pPage, RTGCPHYS GCPhysPage, PPGMRAMRANGE pRam, 744 bool fDoAccounting, bool fFlushIemTlbs) 740 745 { 741 746 Assert( PGM_PAGE_GET_TYPE(pPage) == PGMPAGETYPE_MMIO2_ALIAS_MMIO … … 763 768 PGM_PAGE_SET_HNDL_PHYS_STATE_ONLY(pPage, PGM_PAGE_HNDL_PHYS_STATE_ALL); 764 769 765 /* Flush its TLB entry. */ 770 /* 771 * Flush its TLB entry. 772 */ 766 773 pgmPhysInvalidatePageMapTLBEntry(pVM, GCPhysPage); 767 /* Not calling IEMTlbInvalidateAllPhysicalAllCpus here as aliased pages are handled like MMIO by the IEM TLB. */ 774 if (fFlushIemTlbs) 775 IEMTlbInvalidateAllPhysicalAllCpus(pVM, NIL_VMCPUID); 768 776 769 777 /* … … 834 842 { 835 843 Assert(pCur->cAliasedPages > 0); 836 pgmHandlerPhysicalResetAliasedPage(pVM, pPage, GCPhys, pRamHint, false /*fDoAccounting*/ );844 pgmHandlerPhysicalResetAliasedPage(pVM, pPage, GCPhys, pRamHint, false /*fDoAccounting*/, true /*fFlushIemTlbs*/); 837 845 pCur->cAliasedPages--; 838 846 fNemNotifiedAlready = true; … … 1223 1231 if (pCur->cAliasedPages) 1224 1232 { 1225 PPGMPAGE pPage = &pRam->aPages[(pCur->Key - pRam->GCPhys) >> GUEST_PAGE_SHIFT]; 1226 RTGCPHYS GCPhysPage = pCur->Key; 1227 uint32_t cLeft = pCur->cPages; 1233 PPGMPAGE pPage = &pRam->aPages[(pCur->Key - pRam->GCPhys) >> GUEST_PAGE_SHIFT]; 1234 RTGCPHYS GCPhysPage = pCur->Key; 1235 uint32_t cLeft = pCur->cPages; 1236 bool fFlushIemTlb = false; 1228 1237 while (cLeft-- > 0) 1229 1238 { … … 1231 1240 || PGM_PAGE_GET_TYPE(pPage) == PGMPAGETYPE_SPECIAL_ALIAS_MMIO) 1232 1241 { 1242 fFlushIemTlb |= PGM_PAGE_GET_TYPE(pPage) == PGMPAGETYPE_MMIO2_ALIAS_MMIO; 1233 1243 Assert(pCur->cAliasedPages > 0); 1234 pgmHandlerPhysicalResetAliasedPage(pVM, pPage, GCPhysPage, pRam, false /*fDoAccounting*/); 1244 pgmHandlerPhysicalResetAliasedPage(pVM, pPage, GCPhysPage, pRam, 1245 false /*fDoAccounting*/, false /*fFlushIemTlbs*/); 1235 1246 --pCur->cAliasedPages; 1236 1247 #ifndef VBOX_STRICT … … 1244 1255 } 1245 1256 Assert(pCur->cAliasedPages == 0); 1257 1258 /* 1259 * Flush IEM TLBs in case they contain any references to aliased pages. 1260 * This is only necessary for MMIO2 aliases. 1261 */ 1262 if (fFlushIemTlb) 1263 IEMTlbInvalidateAllPhysicalAllCpus(pVM, NIL_VMCPUID); 1246 1264 } 1247 1265 } … … 1592 1610 Log(("PGMHandlerPhysicalPageAliasMmio2: GCPhysPage=%RGp (%R[pgmpage]; %RHp -> %RHp\n", 1593 1611 GCPhysPage, pPage, PGM_PAGE_GET_HCPHYS(pPage), PGM_PAGE_GET_HCPHYS(pPageRemap))); 1594 pgmHandlerPhysicalResetAliasedPage(pVM, pPage, GCPhysPage, pRam, false /*fDoAccounting*/); 1612 pgmHandlerPhysicalResetAliasedPage(pVM, pPage, GCPhysPage, pRam, 1613 false /*fDoAccounting*/, false /*fFlushIemTlbs*/); 1595 1614 pCur->cAliasedPages--; 1615 1616 /* Since this may be present in the TLB and now be wrong, invalid 1617 the guest physical address part of the IEM TLBs. Note, we do 1618 this here as we will not invalid */ 1619 IEMTlbInvalidateAllPhysicalAllCpus(pVM, NIL_VMCPUID); 1596 1620 } 1597 1621 Assert(PGM_PAGE_IS_ZERO(pPage)); … … 1611 1635 Assert(pCur->cAliasedPages <= pCur->cPages); 1612 1636 1613 /* Flush its TLB entry. */ 1637 /* 1638 * Flush its TLB entry. 1639 * 1640 * Not calling IEMTlbInvalidateAllPhysicalAllCpus here to conserve 1641 * all the other IEM TLB entires. When this one is kicked out and 1642 * reloaded, it will be using the MMIO2 alias, but till then we'll 1643 * continue doing MMIO. 1644 */ 1614 1645 pgmPhysInvalidatePageMapTLBEntry(pVM, GCPhysPage); 1615 /* Not calling IEMTlbInvalidateAllPhysicalAllCpus here as aliased pages are handled like MMIO by the IEM TLB. */ 1646 /** @todo Do some preformance checks of calling 1647 * IEMTlbInvalidateAllPhysicalAllCpus when in IEM mode, to see if it 1648 * actually makes sense or not. Screen updates are typically massive 1649 * and important when this kind of aliasing is used, so it may pay of... */ 1616 1650 1617 1651 #ifdef VBOX_WITH_NATIVE_NEM … … 1735 1769 Assert(pCur->cAliasedPages <= pCur->cPages); 1736 1770 1737 /* Flush its TLB entry. */ 1771 /* 1772 * Flush its TLB entry. 1773 * 1774 * Not calling IEMTlbInvalidateAllPhysicalAllCpus here as special 1775 * aliased MMIO pages are handled like MMIO by the IEM TLB. 1776 */ 1738 1777 pgmPhysInvalidatePageMapTLBEntry(pVM, GCPhysPage); 1739 /* Not calling IEMTlbInvalidateAllPhysicalAllCpus here as aliased pages are handled like MMIO by the IEM TLB. */1740 1778 1741 1779 #ifdef VBOX_WITH_NATIVE_NEM
Note:
See TracChangeset
for help on using the changeset viewer.