Index: /trunk/include/VBox/hwacc_svm.h
===================================================================
--- /trunk/include/VBox/hwacc_svm.h	(revision 19902)
+++ /trunk/include/VBox/hwacc_svm.h	(revision 19903)
@@ -669,5 +669,4 @@
 #ifdef IN_RING0
 VMMR0DECL(int) SVMR0InvalidatePage(PVM pVM, PVMCPU pVCpu, RTGCPTR GCVirt);
-VMMR0DECL(int) SVMR0InvalidatePhysPage(PVM pVM, PVMCPU pVCpu, RTGCPHYS GCPhys);
 #endif /* IN_RING0 */
 
Index: /trunk/include/VBox/hwaccm.h
===================================================================
--- /trunk/include/VBox/hwaccm.h	(revision 19902)
+++ /trunk/include/VBox/hwaccm.h	(revision 19903)
@@ -81,6 +81,7 @@
 #ifndef IN_RC
 VMMDECL(int)     HWACCMFlushTLB(PVMCPU pVCpu);
-VMMDECL(int)     HWACCMFlushAllTLBs(PVM pVM);
-VMMDECL(int)     HWACCMInvalidatePhysPage(PVMCPU pVCpu, RTGCPHYS GCPhys);
+VMMDECL(int)     HWACCMFlushTLBOnAllVCpus(PVM pVM);
+VMMDECL(int)     HWACCMInvalidatePageOnAllVCpus(PVM pVM, RTGCPTR GCVirt);
+VMMDECL(int)     HWACCMInvalidatePhysPage(PVM pVM, RTGCPHYS GCPhys);
 VMMDECL(bool)    HWACCMIsNestedPagingActive(PVM pVM);
 VMMDECL(PGMMODE) HWACCMGetShwPagingMode(PVM pVM);
@@ -89,5 +90,5 @@
 # define HWACCMFlushTLB(pVCpu)                  do { } while (0)
 # define HWACCMIsNestedPagingActive(pVM)        false
-# define HWACCMFlushAllTLBs(pVM)                do { } while (0)
+# define HWACCMFlushTLBOnAllVCpus(pVM)          do { } while (0)
 #endif
 
Index: /trunk/src/VBox/VMM/PGMInternal.h
===================================================================
--- /trunk/src/VBox/VMM/PGMInternal.h	(revision 19902)
+++ /trunk/src/VBox/VMM/PGMInternal.h	(revision 19903)
@@ -327,6 +327,7 @@
 
 /** @def PGM_INVL_PG
- * Invalidates a page when in GC does nothing in HC.
- *
+ * Invalidates a page.
+ *
+ * @param   pVCpu       The VMCPU handle.
  * @param   GCVirt      The virtual address of the page to invalidate.
  */
@@ -339,7 +340,22 @@
 #endif
 
+/** @def PGM_INVL_PG
+ * Invalidates a page on all VCPUs
+ *
+ * @param   pVM         The VM handle.
+ * @param   GCVirt      The virtual address of the page to invalidate.
+ */
+#ifdef IN_RC
+# define PGM_INVL_ALL_VCPU_PG(pVM, GCVirt)      ASMInvalidatePage((void *)(GCVirt))
+#elif defined(IN_RING0)
+# define PGM_INVL_ALL_VCPU_PG(pVM, GCVirt)      HWACCMInvalidatePageOnAllVCpus(pVM, (RTGCPTR)(GCVirt))
+#else
+# define PGM_INVL_ALL_VCPU_PG(pVM, GCVirt)      HWACCMInvalidatePageOnAllVCpus(pVM, (RTGCPTR)(GCVirt))
+#endif
+
 /** @def PGM_INVL_BIG_PG
- * Invalidates a 4MB page directory entry when in GC does nothing in HC.
- *
+ * Invalidates a 4MB page directory entry.
+ *
+ * @param   pVCpu       The VMCPU handle.
  * @param   GCVirt      The virtual address within the page directory to invalidate.
  */
@@ -354,4 +370,6 @@
 /** @def PGM_INVL_VCPU_TLBS()
  * Invalidates the TLBs of the specified VCPU
+ *
+ * @param   pVCpu       The VMCPU handle.
  */
 #ifdef IN_RC
@@ -365,11 +383,13 @@
 /** @def PGM_INVL_ALL_VCPU_TLBS()
  * Invalidates the TLBs of all VCPUs
+ *
+ * @param   pVM         The VM handle.
  */
 #ifdef IN_RC
 # define PGM_INVL_ALL_VCPU_TLBS(pVM)            ASMReloadCR3()
 #elif defined(IN_RING0)
-# define PGM_INVL_ALL_VCPU_TLBS(pVM)            HWACCMFlushAllTLBs(pVM)
+# define PGM_INVL_ALL_VCPU_TLBS(pVM)            HWACCMFlushTLBOnAllVCpus(pVM)
 #else
-# define PGM_INVL_ALL_VCPU_TLBS(pVM)            HWACCMFlushAllTLBs(pVM)
+# define PGM_INVL_ALL_VCPU_TLBS(pVM)            HWACCMFlushTLBOnAllVCpus(pVM)
 #endif
 
Index: /trunk/src/VBox/VMM/VMMAll/HWACCMAll.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMAll/HWACCMAll.cpp	(revision 19902)
+++ /trunk/src/VBox/VMM/VMMAll/HWACCMAll.cpp	(revision 19903)
@@ -75,5 +75,5 @@
     LogFlow(("HWACCMFlushTLB\n"));
 
-    pVCpu->hwaccm.s.fForceTLBFlush = true;
+    VMCPU_FF_SET(pVCpu, VMCPU_FF_TLB_FLUSH);
     STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatFlushTLBManual);
     return VINF_SUCCESS;
@@ -82,4 +82,18 @@
 #ifndef IN_RC
 /**
+ * Invalidates a guest page on all VCPUs.
+ *
+ * @returns VBox status code.
+ * @param   pVM         The VM to operate on.
+ * @param   GCVirt      Page to invalidate
+ */
+VMMDECL(int) HWACCMInvalidatePageOnAllVCpus(PVM pVM, RTGCPTR GCPtr)
+{
+    /* @todo */
+    HWACCMInvalidatePage(VMMGetCpu(pVM), GCPtr);
+    return VINF_SUCCESS;
+}
+
+/**
  * Flush the TLBs of all VCPUs
  *
@@ -87,5 +101,5 @@
  * @param   pVM       The VM to operate on.
  */
-VMMDECL(int) HWACCMFlushAllTLBs(PVM pVM)
+VMMDECL(int) HWACCMFlushTLBOnAllVCpus(PVM pVM)
 {
     if (pVM->cCPUs == 1)
@@ -153,22 +167,24 @@
  *
  * @returns VBox status code.
- * @param   pVCpu       The VMCPU to operate on.
+ * @param   pVM         The VM to operate on.
  * @param   GCPhys      Page to invalidate
  */
-VMMDECL(int) HWACCMInvalidatePhysPage(PVMCPU pVCpu, RTGCPHYS GCPhys)
-{
-    PVM pVM = pVCpu->CTX_SUFF(pVM);
-
+VMMDECL(int) HWACCMInvalidatePhysPage(PVM pVM, RTGCPHYS GCPhys)
+{
     if (!HWACCMIsNestedPagingActive(pVM))
         return VINF_SUCCESS;
 
+    PVMCPU pVCpu = VMMGetCpu(pVM);
 #ifdef IN_RING0
     if (pVM->hwaccm.s.vmx.fSupported)
+    {
+        /* @todo for all vcpus */
         return VMXR0InvalidatePhysPage(pVM, pVCpu, GCPhys);
+    }
 
     Assert(pVM->hwaccm.s.svm.fSupported);
-    SVMR0InvalidatePhysPage(pVM, pVCpu, GCPhys);
+    HWACCMFlushTLBOnAllVCpus(pVM);
 #else
-    HWACCMFlushTLB(pVCpu);
+    HWACCMFlushTLBOnAllVCpus(pVM);
 #endif
     return VINF_SUCCESS;
Index: /trunk/src/VBox/VMM/VMMAll/PGMAllHandler.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMAll/PGMAllHandler.cpp	(revision 19902)
+++ /trunk/src/VBox/VMM/VMMAll/PGMAllHandler.cpp	(revision 19903)
@@ -169,5 +169,5 @@
         pVM->pgm.s.fPhysCacheFlushPending = true;
         pgmUnlock(pVM);
-        HWACCMFlushAllTLBs(pVM);
+        HWACCMFlushTLBOnAllVCpus(pVM);
 #ifndef IN_RING3
         REMNotifyHandlerPhysicalRegister(pVM, enmType, GCPhys, GCPhysLast - GCPhys + 1, !!pfnHandlerR3);
@@ -271,5 +271,5 @@
         pgmHandlerPhysicalDeregisterNotifyREM(pVM, pCur);
         pgmUnlock(pVM);
-        HWACCMFlushAllTLBs(pVM);
+        HWACCMFlushTLBOnAllVCpus(pVM);
         MMHyperFree(pVM, pCur);
         return VINF_SUCCESS;
@@ -417,5 +417,5 @@
         PGM_INVL_VCPU_TLBS(VMMGetCpu0(pVM));
 # else
-    HWACCMFlushAllTLBs(pVM);
+    HWACCMFlushTLBOnAllVCpus(pVM);
 # endif
     pVM->pgm.s.fPhysCacheFlushPending = true;
@@ -553,5 +553,5 @@
 #endif
                     pgmUnlock(pVM);
-                    HWACCMFlushAllTLBs(pVM);
+                    HWACCMFlushTLBOnAllVCpus(pVM);
                     Log(("PGMHandlerPhysicalModify: GCPhysCurrent=%RGp -> GCPhys=%RGp GCPhysLast=%RGp\n",
                          GCPhysCurrent, GCPhys, GCPhysLast));
@@ -848,5 +848,5 @@
                     rc = pgmHandlerPhysicalSetRamFlagsAndFlushShadowPTs(pVM, pCur, pRam);
                     pVM->pgm.s.fPhysCacheFlushPending = true;
-                    HWACCMFlushAllTLBs(pVM);
+                    HWACCMFlushTLBOnAllVCpus(pVM);
                 }
 
@@ -920,5 +920,5 @@
             PGM_PAGE_SET_HNDL_PHYS_STATE(pPage, PGM_PAGE_HNDL_PHYS_STATE_DISABLED);
 #ifndef IN_RC
-            HWACCMInvalidatePhysPage(VMMGetCpu(pVM), GCPhysPage);
+            HWACCMInvalidatePhysPage(pVM, GCPhysPage);
 #endif
             return VINF_SUCCESS;
@@ -1037,5 +1037,5 @@
 
 #ifndef IN_RC
-            HWACCMInvalidatePhysPage(VMMGetCpu(pVM), GCPhysPage);
+            HWACCMInvalidatePhysPage(pVM, GCPhysPage);
 #endif
             return VINF_SUCCESS;
Index: /trunk/src/VBox/VMM/VMMAll/PGMAllPool.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMAll/PGMAllPool.cpp	(revision 19902)
+++ /trunk/src/VBox/VMM/VMMAll/PGMAllPool.cpp	(revision 19903)
@@ -1297,6 +1297,7 @@
      */
     int rc = pgmPoolFlushPage(pPool, pPage);
+    /* This flush was initiated by us and not the guest, so explicitly flush the TLB. */
     if (rc == VINF_SUCCESS)
-        PGM_INVL_VCPU_TLBS(VMMGetCpu(pVM)); /* see PT handler. */
+        PGM_INVL_ALL_VCPU_TLBS(pVM);
     return rc;
 }
@@ -3963,4 +3964,6 @@
 static int pgmPoolMakeMoreFreePages(PPGMPOOL pPool, PGMPOOLKIND enmKind, uint16_t iUser)
 {
+    PVM pVM = pPool->CTX_SUFF(pVM);
+
     LogFlow(("pgmPoolMakeMoreFreePages: iUser=%#x\n", iUser));
 
@@ -3978,7 +3981,7 @@
         STAM_PROFILE_ADV_SUSPEND(&pPool->StatAlloc, a);
 #ifdef IN_RING3
-        int rc = PGMR3PoolGrow(pPool->pVMR3);
+        int rc = PGMR3PoolGrow(pVM);
 #else
-        int rc = CTXALLMID(VMM, CallHost)(pPool->CTX_SUFF(pVM), VMMCALLHOST_PGM_POOL_GROW, 0);
+        int rc = CTXALLMID(VMM, CallHost)(pVM, VMMCALLHOST_PGM_POOL_GROW, 0);
 #endif
         if (RT_FAILURE(rc))
Index: /trunk/src/VBox/VMM/VMMAll/PGMAllShw.h
===================================================================
--- /trunk/src/VBox/VMM/VMMAll/PGMAllShw.h	(revision 19902)
+++ /trunk/src/VBox/VMM/VMMAll/PGMAllShw.h	(revision 19903)
@@ -363,7 +363,7 @@
                 Assert(pPT->a[iPTE].n.u1Present);
 # if PGM_SHW_TYPE == PGM_TYPE_EPT
-                HWACCMInvalidatePhysPage(pVCpu, (RTGCPHYS)GCPtr);
+                HWACCMInvalidatePhysPage(pVM, (RTGCPHYS)GCPtr);
 # else
-                PGM_INVL_PG(pVCpu, GCPtr);
+                PGM_INVL_ALL_VCPU_PG(pVM, GCPtr);
 # endif
             }
Index: /trunk/src/VBox/VMM/VMMR0/HWSVMR0.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMR0/HWSVMR0.cpp	(revision 19902)
+++ /trunk/src/VBox/VMM/VMMR0/HWSVMR0.cpp	(revision 19903)
@@ -2352,4 +2352,5 @@
 
 
+#if 0 /* obsolete, but left here for clarification. */
 /**
  * Invalidates a guest page by physical address
@@ -2368,4 +2369,5 @@
     return VINF_SUCCESS;
 }
+#endif
 
 #if HC_ARCH_BITS == 32 && defined(VBOX_ENABLE_64_BITS_GUESTS) && !defined(VBOX_WITH_HYBRID_32BIT_KERNEL)
