[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH v3 14/17] xen: add domain pointer to fill_ro_mpt() and zap_ro_mpt() functions



In order to be able to sync L4 page table modifications with XPTI we
need the domain pointer in fill_ro_mpt() and zap_ro_mpt().

Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
---
 xen/arch/x86/domain.c          | 6 +++---
 xen/arch/x86/mm.c              | 8 ++++----
 xen/arch/x86/mm/shadow/multi.c | 4 ++--
 xen/include/asm-x86/mm.h       | 4 ++--
 4 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index 8d6dc73881..0a6a94d2e1 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -1002,7 +1002,7 @@ int arch_set_info_guest(
                 {
                     if ( (page->u.inuse.type_info & PGT_type_mask) ==
                          PGT_l4_page_table )
-                        done = !fill_ro_mpt(_mfn(page_to_mfn(page)));
+                        done = !fill_ro_mpt(d, _mfn(page_to_mfn(page)));
 
                     page_unlock(page);
                 }
@@ -1078,7 +1078,7 @@ int arch_set_info_guest(
         case 0:
             if ( !compat && !VM_ASSIST(d, m2p_strict) &&
                  !paging_mode_refcounts(d) )
-                fill_ro_mpt(_mfn(cr3_gfn));
+                fill_ro_mpt(d, _mfn(cr3_gfn));
             break;
         default:
             if ( cr3_page == current->arch.old_guest_table )
@@ -1118,7 +1118,7 @@ int arch_set_info_guest(
                     break;
                 case 0:
                     if ( VM_ASSIST(d, m2p_strict) )
-                        zap_ro_mpt(_mfn(cr3_gfn));
+                        zap_ro_mpt(d, _mfn(cr3_gfn));
                     break;
                 }
             }
diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index f615204dbb..16b004abe6 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -1611,7 +1611,7 @@ void init_xen_l4_slots(l4_pgentry_t *l4t, mfn_t l4mfn,
     }
 }
 
-bool fill_ro_mpt(mfn_t mfn)
+bool fill_ro_mpt(const struct domain *d, mfn_t mfn)
 {
     l4_pgentry_t *l4tab = map_domain_page(mfn);
     bool ret = false;
@@ -1627,7 +1627,7 @@ bool fill_ro_mpt(mfn_t mfn)
     return ret;
 }
 
-void zap_ro_mpt(mfn_t mfn)
+void zap_ro_mpt(const struct domain *d, mfn_t mfn)
 {
     l4_pgentry_t *l4tab = map_domain_page(mfn);
 
@@ -2891,7 +2891,7 @@ int new_guest_cr3(mfn_t mfn)
     pv_destroy_ldt(curr); /* Unconditional TLB flush later. */
 
     if ( !VM_ASSIST(d, m2p_strict) && !paging_mode_refcounts(d) )
-        fill_ro_mpt(mfn);
+        fill_ro_mpt(d, mfn);
     curr->arch.guest_table = pagetable_from_mfn(mfn);
     update_cr3(curr);
 
@@ -3270,7 +3270,7 @@ long do_mmuext_op(
                 }
 
                 if ( VM_ASSIST(currd, m2p_strict) )
-                    zap_ro_mpt(_mfn(op.arg1.mfn));
+                    zap_ro_mpt(currd, _mfn(op.arg1.mfn));
             }
 
             curr->arch.guest_table_user = pagetable_from_pfn(op.arg1.mfn);
diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c
index 2d42959f53..170163fbcf 100644
--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -4168,10 +4168,10 @@ sh_update_cr3(struct vcpu *v, int do_locking)
         mfn_t smfn = pagetable_get_mfn(v->arch.shadow_table[0]);
 
         if ( !(v->arch.flags & TF_kernel_mode) && VM_ASSIST(d, m2p_strict) )
-            zap_ro_mpt(smfn);
+            zap_ro_mpt(d, smfn);
         else if ( (v->arch.flags & TF_kernel_mode) &&
                   !VM_ASSIST(d, m2p_strict) )
-            fill_ro_mpt(smfn);
+            fill_ro_mpt(d, smfn);
     }
 #else
 #error This should never happen
diff --git a/xen/include/asm-x86/mm.h b/xen/include/asm-x86/mm.h
index 3013c266fe..446d8584c0 100644
--- a/xen/include/asm-x86/mm.h
+++ b/xen/include/asm-x86/mm.h
@@ -344,8 +344,8 @@ int free_page_type(struct page_info *page, unsigned long 
type,
 void init_xen_pae_l2_slots(l2_pgentry_t *l2t, const struct domain *d);
 void init_xen_l4_slots(l4_pgentry_t *l4t, mfn_t l4mfn,
                        const struct domain *d, mfn_t sl4mfn, bool ro_mpt);
-bool fill_ro_mpt(mfn_t mfn);
-void zap_ro_mpt(mfn_t mfn);
+bool fill_ro_mpt(const struct domain *d, mfn_t mfn);
+void zap_ro_mpt(const struct domain *d, mfn_t mfn);
 
 bool is_iomem_page(mfn_t mfn);
 
-- 
2.13.6


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.