Changeset 100966 in vbox for trunk/src/VBox/VMM
- Timestamp:
- Aug 24, 2023 11:23:58 PM (17 months ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/IEMAll-armv8.cpp
r99053 r100966 114 114 115 115 116 VMM_INT_DECL(void) IEMTlbInvalidateAllPhysicalAllCpus(PVMCC pVM, VMCPUID idCpuCaller )116 VMM_INT_DECL(void) IEMTlbInvalidateAllPhysicalAllCpus(PVMCC pVM, VMCPUID idCpuCaller, IEMTLBPHYSFLUSHREASON enmReason) 117 117 { 118 RT_NOREF(pVM, idCpuCaller );118 RT_NOREF(pVM, idCpuCaller, enmReason); 119 119 } 120 120 -
trunk/src/VBox/VMM/VMMAll/IEMAll.cpp
r100868 r100966 754 754 * @param idCpuCaller The ID of the calling EMT if available to the caller, 755 755 * otherwise NIL_VMCPUID. 756 * @param enmReason The reason we're called. 756 757 * 757 758 * @remarks Caller holds the PGM lock. 758 759 */ 759 VMM_INT_DECL(void) IEMTlbInvalidateAllPhysicalAllCpus(PVMCC pVM, VMCPUID idCpuCaller )760 VMM_INT_DECL(void) IEMTlbInvalidateAllPhysicalAllCpus(PVMCC pVM, VMCPUID idCpuCaller, IEMTLBPHYSFLUSHREASON enmReason) 760 761 { 761 762 #if defined(IEM_WITH_CODE_TLB) || defined(IEM_WITH_DATA_TLB) … … 763 764 if (pVCpuCaller) 764 765 VMCPU_ASSERT_EMT(pVCpuCaller); 765 Log10(("IEMTlbInvalidateAllPhysicalAllCpus \n"));766 Log10(("IEMTlbInvalidateAllPhysicalAllCpus: %d\n", enmReason)); RT_NOREF(enmReason); 766 767 767 768 VMCC_FOR_EACH_VMCPU(pVM) … … 789 790 790 791 #else 791 RT_NOREF(pVM, idCpuCaller );792 RT_NOREF(pVM, idCpuCaller, enmReason); 792 793 #endif 793 794 } … … 978 979 AssertCompile(PGMIEMGCPHYS2PTR_F_NO_MAPPINGR3 == IEMTLBE_F_NO_MAPPINGR3); 979 980 AssertCompile(PGMIEMGCPHYS2PTR_F_UNASSIGNED == IEMTLBE_F_PG_UNASSIGNED); 981 AssertCompile(PGMIEMGCPHYS2PTR_F_CODE_PAGE == IEMTLBE_F_PG_CODE_PAGE); 980 982 if (RT_LIKELY(pVCpu->iem.s.CodeTlb.uTlbPhysRev > IEMTLB_PHYS_REV_INCR)) 981 983 { /* likely */ } … … 983 985 IEMTlbInvalidateAllPhysicalSlow(pVCpu); 984 986 pTlbe->fFlagsAndPhysRev &= ~( IEMTLBE_F_PHYS_REV 985 | IEMTLBE_F_NO_MAPPINGR3 | IEMTLBE_F_PG_NO_READ | IEMTLBE_F_PG_NO_WRITE | IEMTLBE_F_PG_UNASSIGNED); 987 | IEMTLBE_F_NO_MAPPINGR3 988 | IEMTLBE_F_PG_NO_READ 989 | IEMTLBE_F_PG_NO_WRITE 990 | IEMTLBE_F_PG_UNASSIGNED 991 | IEMTLBE_F_PG_CODE_PAGE); 986 992 int rc = PGMPhysIemGCPhys2PtrNoLock(pVCpu->CTX_SUFF(pVM), pVCpu, pTlbe->GCPhys, &pVCpu->iem.s.CodeTlb.uTlbPhysRev, 987 993 &pTlbe->pbMappingR3, &pTlbe->fFlagsAndPhysRev); … … 6413 6419 AssertCompile(PGMIEMGCPHYS2PTR_F_NO_MAPPINGR3 == IEMTLBE_F_NO_MAPPINGR3); 6414 6420 AssertCompile(PGMIEMGCPHYS2PTR_F_UNASSIGNED == IEMTLBE_F_PG_UNASSIGNED); 6421 AssertCompile(PGMIEMGCPHYS2PTR_F_CODE_PAGE == IEMTLBE_F_PG_CODE_PAGE); 6415 6422 if (RT_LIKELY(pVCpu->iem.s.CodeTlb.uTlbPhysRev > IEMTLB_PHYS_REV_INCR)) 6416 6423 { /* likely */ } … … 6419 6426 pTlbe->pbMappingR3 = NULL; 6420 6427 pTlbe->fFlagsAndPhysRev &= ~( IEMTLBE_F_PHYS_REV 6421 | IEMTLBE_F_NO_MAPPINGR3 | IEMTLBE_F_PG_NO_READ | IEMTLBE_F_PG_NO_WRITE | IEMTLBE_F_PG_UNASSIGNED); 6428 | IEMTLBE_F_NO_MAPPINGR3 6429 | IEMTLBE_F_PG_NO_READ 6430 | IEMTLBE_F_PG_NO_WRITE 6431 | IEMTLBE_F_PG_UNASSIGNED 6432 | IEMTLBE_F_PG_CODE_PAGE); 6422 6433 int rc = PGMPhysIemGCPhys2PtrNoLock(pVCpu->CTX_SUFF(pVM), pVCpu, pTlbe->GCPhys, &pVCpu->iem.s.DataTlb.uTlbPhysRev, 6423 6434 &pbMem, &pTlbe->fFlagsAndPhysRev); … … 6748 6759 AssertCompile(PGMIEMGCPHYS2PTR_F_NO_MAPPINGR3 == IEMTLBE_F_NO_MAPPINGR3); 6749 6760 AssertCompile(PGMIEMGCPHYS2PTR_F_UNASSIGNED == IEMTLBE_F_PG_UNASSIGNED); 6761 AssertCompile(PGMIEMGCPHYS2PTR_F_CODE_PAGE == IEMTLBE_F_PG_CODE_PAGE); 6750 6762 pTlbe->pbMappingR3 = NULL; 6751 6763 pTlbe->fFlagsAndPhysRev &= ~( IEMTLBE_F_PHYS_REV 6752 | IEMTLBE_F_NO_MAPPINGR3 | IEMTLBE_F_PG_NO_READ | IEMTLBE_F_PG_NO_WRITE | IEMTLBE_F_PG_UNASSIGNED); 6764 | IEMTLBE_F_NO_MAPPINGR3 6765 | IEMTLBE_F_PG_NO_READ 6766 | IEMTLBE_F_PG_NO_WRITE 6767 | IEMTLBE_F_PG_UNASSIGNED 6768 | IEMTLBE_F_PG_CODE_PAGE); 6753 6769 int rc = PGMPhysIemGCPhys2PtrNoLock(pVCpu->CTX_SUFF(pVM), pVCpu, pTlbe->GCPhys, &pVCpu->iem.s.DataTlb.uTlbPhysRev, 6754 6770 &pbMem, &pTlbe->fFlagsAndPhysRev); -
trunk/src/VBox/VMM/VMMAll/PGMAllHandler.cpp
r99739 r100966 948 948 pgmPhysInvalidatePageMapTLBEntry(pVM, GCPhysPage); 949 949 if (fFlushIemTlbs) 950 IEMTlbInvalidateAllPhysicalAllCpus(pVM, NIL_VMCPUID );950 IEMTlbInvalidateAllPhysicalAllCpus(pVM, NIL_VMCPUID, IEMTLBPHYSFLUSHREASON_RESET_ALIAS); 951 951 952 952 /* … … 1434 1434 */ 1435 1435 if (fFlushIemTlb) 1436 IEMTlbInvalidateAllPhysicalAllCpus(pVM, NIL_VMCPUID );1436 IEMTlbInvalidateAllPhysicalAllCpus(pVM, NIL_VMCPUID, IEMTLBPHYSFLUSHREASON_HANDLER_RESET); 1437 1437 } 1438 1438 } … … 1790 1790 the guest physical address part of the IEM TLBs. Note, we do 1791 1791 this here as we will not invalid */ 1792 IEMTlbInvalidateAllPhysicalAllCpus(pVM, NIL_VMCPUID );1792 IEMTlbInvalidateAllPhysicalAllCpus(pVM, NIL_VMCPUID, IEMTLBPHYSFLUSHREASON_MMIO2_ALIAS); 1793 1793 } 1794 1794 Assert(PGM_PAGE_IS_ZERO(pPage)); -
trunk/src/VBox/VMM/VMMAll/PGMAllPhys.cpp
r99739 r100966 746 746 } 747 747 748 IEMTlbInvalidateAllPhysicalAllCpus(pVM, NIL_VMCPUID );748 IEMTlbInvalidateAllPhysicalAllCpus(pVM, NIL_VMCPUID, IEMTLBPHYSFLUSHREASON_MISC); 749 749 PGM_UNLOCK(pVM); 750 750 } … … 995 995 PGM_PAGE_SET_PDE_TYPE(pVM, pPage, PGM_PAGE_PDE_TYPE_PT); 996 996 pgmPhysInvalidatePageMapTLBEntry(pVM, GCPhys); 997 IEMTlbInvalidateAllPhysicalAllCpus(pVM, NIL_VMCPUID );997 IEMTlbInvalidateAllPhysicalAllCpus(pVM, NIL_VMCPUID, IEMTLBPHYSFLUSHREASON_ALLOCATED); 998 998 999 999 /* Copy the shared page contents to the replacement page. */ … … 1225 1225 PGM_PAGE_SET_WRITTEN_TO(pVM, pPage); 1226 1226 PGM_PAGE_SET_STATE(pVM, pPage, PGM_PAGE_STATE_ALLOCATED); 1227 if (PGM_PAGE_IS_CODE_PAGE(pPage)) 1228 { 1229 PGM_PAGE_CLEAR_CODE_PAGE(pVM, pPage); 1230 IEMTlbInvalidateAllPhysicalAllCpus(pVM, NIL_VMCPUID, IEMTLBPHYSFLUSHREASON_MADE_WRITABLE); 1231 } 1232 1227 1233 Assert(pVM->pgm.s.cMonitoredPages > 0); 1228 1234 pVM->pgm.s.cMonitoredPages--; … … 3737 3743 { 3738 3744 case PGM_PAGE_STATE_ALLOCATED: 3745 Assert(!PGM_PAGE_IS_CODE_PAGE(pPage)); 3739 3746 *pfTlb |= *puTlbPhysRev; 3740 3747 break; … … 3745 3752 case PGM_PAGE_STATE_SHARED: 3746 3753 case PGM_PAGE_STATE_WRITE_MONITORED: 3747 *pfTlb |= *puTlbPhysRev | PGMIEMGCPHYS2PTR_F_NO_WRITE; 3754 if (!PGM_PAGE_IS_CODE_PAGE(pPage)) 3755 *pfTlb |= *puTlbPhysRev | PGMIEMGCPHYS2PTR_F_NO_WRITE; 3756 else 3757 *pfTlb |= *puTlbPhysRev | PGMIEMGCPHYS2PTR_F_NO_WRITE | PGMIEMGCPHYS2PTR_F_CODE_PAGE; 3748 3758 break; 3749 3759 } … … 3769 3779 */ 3770 3780 if (PGM_PAGE_HAS_ACTIVE_HANDLERS(pPage)) 3771 *pfTlb |= *puTlbPhysRev | PGMIEMGCPHYS2PTR_F_NO_WRITE; 3781 { 3782 if (!PGM_PAGE_IS_CODE_PAGE(pPage)) /* ROM pages end up here */ 3783 *pfTlb |= *puTlbPhysRev | PGMIEMGCPHYS2PTR_F_NO_WRITE; 3784 else 3785 *pfTlb |= *puTlbPhysRev | PGMIEMGCPHYS2PTR_F_NO_WRITE | PGMIEMGCPHYS2PTR_F_CODE_PAGE; 3786 } 3772 3787 else 3773 3788 switch (PGM_PAGE_GET_STATE(pPage)) 3774 3789 { 3775 3790 case PGM_PAGE_STATE_ALLOCATED: 3791 Assert(!PGM_PAGE_IS_CODE_PAGE(pPage)); 3776 3792 *pfTlb |= *puTlbPhysRev; 3777 3793 break; … … 3782 3798 case PGM_PAGE_STATE_SHARED: 3783 3799 case PGM_PAGE_STATE_WRITE_MONITORED: 3784 *pfTlb |= *puTlbPhysRev | PGMIEMGCPHYS2PTR_F_NO_WRITE; 3800 if (!PGM_PAGE_IS_CODE_PAGE(pPage)) 3801 *pfTlb |= *puTlbPhysRev | PGMIEMGCPHYS2PTR_F_NO_WRITE; 3802 else 3803 *pfTlb |= *puTlbPhysRev | PGMIEMGCPHYS2PTR_F_NO_WRITE | PGMIEMGCPHYS2PTR_F_CODE_PAGE; 3785 3804 break; 3786 3805 } -
trunk/src/VBox/VMM/VMMR0/PGMR0.cpp
r99739 r100966 641 641 * invalidate everything. Add a version to the TLB? */ 642 642 pgmPhysInvalidatePageMapTLB(pGVM); 643 IEMTlbInvalidateAllPhysicalAllCpus(pGVM, idCpu );643 IEMTlbInvalidateAllPhysicalAllCpus(pGVM, idCpu, IEMTLBPHYSFLUSHREASON_ALLOCATED_LARGE); 644 644 645 645 STAM_PROFILE_STOP(&pGVM->pgm.s.Stats.StatLargePageSetup, a); -
trunk/src/VBox/VMM/VMMR0/PGMR0SharedPage.cpp
r98103 r100966 135 135 /* Invalidate page map TLB entry for this page too. */ 136 136 pgmPhysInvalidatePageMapTLBEntry(pVM, PageDesc.GCPhys); 137 IEMTlbInvalidateAllPhysicalAllCpus(pVM, NIL_VMCPUID );137 IEMTlbInvalidateAllPhysicalAllCpus(pVM, NIL_VMCPUID, IEMTLBPHYSFLUSHREASON_SHARED); 138 138 pVM->pgm.s.cReusedSharedPages++; 139 139 } -
trunk/src/VBox/VMM/VMMR3/PGMPhys.cpp
r99739 r100966 1405 1405 pVM->pgm.s.cWrittenToPages++; 1406 1406 } 1407 PGM_PAGE_CLEAR_CODE_PAGE(pVM, pPage); /* No callback needed, IEMTlbInvalidateAllPhysicalAllCpus is called below. */ 1407 1408 1408 1409 /* … … 1418 1419 /* Flush physical page map TLB entry. */ 1419 1420 pgmPhysInvalidatePageMapTLBEntry(pVM, GCPhys); 1420 IEMTlbInvalidateAllPhysicalAllCpus(pVM, NIL_VMCPUID ); /// @todo move to the perform step.1421 IEMTlbInvalidateAllPhysicalAllCpus(pVM, NIL_VMCPUID, IEMTLBPHYSFLUSHREASON_FREED); /// @todo move to the perform step. 1421 1422 1422 1423 #ifdef VBOX_WITH_PGM_NEM_MODE … … 2161 2162 * Flush the IEM TLB, just to be sure it really is done. 2162 2163 */ 2163 IEMTlbInvalidateAllPhysicalAllCpus(pVM, NIL_VMCPUID );2164 IEMTlbInvalidateAllPhysicalAllCpus(pVM, NIL_VMCPUID, IEMTLBPHYSFLUSHREASON_ZERO_ALL); 2164 2165 2165 2166 return VINF_SUCCESS; -
trunk/src/VBox/VMM/include/IEMInternal-armv8.h
r100072 r100966 295 295 #define IEMTLBE_F_NO_MAPPINGR3 RT_BIT_64(7) /**< TLB entry: The IEMTLBENTRY::pMappingR3 member is invalid. */ 296 296 #define IEMTLBE_F_PG_UNASSIGNED RT_BIT_64(8) /**< Phys page: Unassigned memory (not RAM, ROM, MMIO2 or MMIO). */ 297 #define IEMTLBE_F_PHYS_REV UINT64_C(0xfffffffffffffe00) /**< Physical revision mask. @sa IEMTLB_PHYS_REV_INCR */ 297 #define IEMTLBE_F_PG_CODE_PAGE RT_BIT_64(9) /**< Phys page: Code page. */ 298 #define IEMTLBE_F_PHYS_REV UINT64_C(0xfffffffffffffc00) /**< Physical revision mask. @sa IEMTLB_PHYS_REV_INCR */ 298 299 /** @} */ 299 300 … … 360 361 /** IEMTLB::uTlbPhysRev increment. 361 362 * @sa IEMTLBE_F_PHYS_REV */ 362 #define IEMTLB_PHYS_REV_INCR RT_BIT_64( 9)363 #define IEMTLB_PHYS_REV_INCR RT_BIT_64(10) 363 364 /** 364 365 * Calculates the TLB tag for a virtual address. -
trunk/src/VBox/VMM/include/IEMInternal.h
r100889 r100966 443 443 #define IEMTLBE_F_NO_MAPPINGR3 RT_BIT_64(7) /**< TLB entry: The IEMTLBENTRY::pMappingR3 member is invalid. */ 444 444 #define IEMTLBE_F_PG_UNASSIGNED RT_BIT_64(8) /**< Phys page: Unassigned memory (not RAM, ROM, MMIO2 or MMIO). */ 445 #define IEMTLBE_F_PHYS_REV UINT64_C(0xfffffffffffffe00) /**< Physical revision mask. @sa IEMTLB_PHYS_REV_INCR */ 445 #define IEMTLBE_F_PG_CODE_PAGE RT_BIT_64(9) /**< Phys page: Code page. */ 446 #define IEMTLBE_F_PHYS_REV UINT64_C(0xfffffffffffffc00) /**< Physical revision mask. @sa IEMTLB_PHYS_REV_INCR */ 446 447 /** @} */ 447 448 … … 512 513 /** IEMTLB::uTlbPhysRev increment. 513 514 * @sa IEMTLBE_F_PHYS_REV */ 514 #define IEMTLB_PHYS_REV_INCR RT_BIT_64( 9)515 #define IEMTLB_PHYS_REV_INCR RT_BIT_64(10) 515 516 /** 516 517 * Calculates the TLB tag for a virtual address. -
trunk/src/VBox/VMM/include/PGMInternal.h
r100965 r100966 659 659 /** 2 - Don't apply the physical handler in HM mode (nested APIC hack). */ 660 660 uint64_t fHandlerPhysNotInHm : 1; 661 /** 3 - Flag indicating that a write monitored page was written to 662 * when set. */ 661 /** 3 - Flag indicating that a write monitored page was written to when set. */ 663 662 uint64_t fWrittenToY : 1; 664 /** 7:4 - Unused. */ 665 uint64_t u2Unused0 : 4; 663 /** 4 - Set when the page is write monitored because it's an IEM TB code 664 * page. Save recompiled code the need to verify opcode bytes. 665 * 666 * IEM fetches this flag as part of the TLB queries. The flag is cleared when 667 * the page is made writable and IEM is informed and will invalidate its 668 * physical TLB layer. 669 * 670 * @note Can possibly be set on ROM pages that are not in the monitored state. */ 671 uint64_t fCodePageY : 1; 672 /** 7:5 - Unused. */ 673 uint64_t u2Unused0 : 3; 666 674 /** 9:8 - Paging structure needed to map the page 667 675 * (PGM_PAGE_PDE_TYPE_*). */ … … 977 985 #define PGM_PAGE_IS_ALLOCATED(a_pPage) ( (a_pPage)->s.uStateY == PGM_PAGE_STATE_ALLOCATED ) 978 986 987 979 988 /** 980 989 * Marks the page as written to (for GMM change monitoring). … … 999 1008 */ 1000 1009 #define PGM_PAGE_IS_WRITTEN_TO(a_pPage) ( (a_pPage)->s.fWrittenToY ) 1010 1011 1012 /** 1013 * Marks the page as an IEM code page (being write monitored or a ROM page). 1014 * @param a_pVM The VM handle, only used for lock ownership assertions. 1015 * @param a_pPage Pointer to the physical guest page tracking structure. 1016 */ 1017 #define PGM_PAGE_SET_CODE_PAGE(a_pVM, a_pPage) \ 1018 do { (a_pPage)->s.fCodePageY = 1; PGM_PAGE_ASSERT_LOCK(a_pVM); } while (0) 1019 1020 /** 1021 * Clears the code page indicator. 1022 * @param a_pVM The VM handle, only used for lock ownership assertions. 1023 * @param a_pPage Pointer to the physical guest page tracking structure. 1024 */ 1025 #define PGM_PAGE_CLEAR_CODE_PAGE(a_pVM, a_pPage) \ 1026 do { (a_pPage)->s.fCodePageY = 0; PGM_PAGE_ASSERT_LOCK(a_pVM); } while (0) 1027 1028 /** 1029 * Checks if the page is an IEM code page (implies write monitored or ROM page). 1030 * @returns true/false. 1031 * @param a_pPage Pointer to the physical guest page tracking structure. 1032 */ 1033 #define PGM_PAGE_IS_CODE_PAGE(a_pPage) ( (a_pPage)->s.fCodePageY ) 1001 1034 1002 1035
Note:
See TracChangeset
for help on using the changeset viewer.