Lines Matching refs:gmfn
484 void oos_audit_hash_is_present(struct domain *d, mfn_t gmfn) in oos_audit_hash_is_present() argument
490 ASSERT(mfn_is_out_of_sync(gmfn)); in oos_audit_hash_is_present()
495 idx = mfn_x(gmfn) % SHADOW_OOS_PAGES; in oos_audit_hash_is_present()
496 if ( mfn_x(oos[idx]) != mfn_x(gmfn) ) in oos_audit_hash_is_present()
499 if ( mfn_x(oos[idx]) == mfn_x(gmfn) ) in oos_audit_hash_is_present()
503 SHADOW_ERROR("gmfn %lx marked OOS but not in hash table\n", mfn_x(gmfn)); in oos_audit_hash_is_present()
509 static inline void _sh_resync_l1(struct vcpu *v, mfn_t gmfn, mfn_t snpmfn) in _sh_resync_l1() argument
511 struct page_info *pg = mfn_to_page(gmfn); in _sh_resync_l1()
513 ASSERT(mfn_valid(gmfn)); in _sh_resync_l1()
518 SHADOW_INTERNAL_NAME(sh_resync_l1, 2)(v, gmfn, snpmfn); in _sh_resync_l1()
520 SHADOW_INTERNAL_NAME(sh_resync_l1, 3)(v, gmfn, snpmfn); in _sh_resync_l1()
522 SHADOW_INTERNAL_NAME(sh_resync_l1, 4)(v, gmfn, snpmfn); in _sh_resync_l1()
532 static inline int oos_fixup_flush_gmfn(struct vcpu *v, mfn_t gmfn, in oos_fixup_flush_gmfn() argument
541 sh_remove_write_access_from_sl1p(d, gmfn, in oos_fixup_flush_gmfn()
552 void oos_fixup_add(struct domain *d, mfn_t gmfn, in oos_fixup_add() argument
566 idx = mfn_x(gmfn) % SHADOW_OOS_PAGES; in oos_fixup_add()
567 if ( mfn_x(oos[idx]) != mfn_x(gmfn) ) in oos_fixup_add()
569 if ( mfn_x(oos[idx]) == mfn_x(gmfn) ) in oos_fixup_add()
587 sh_remove_write_access_from_sl1p(d, gmfn, in oos_fixup_add()
607 SHADOW_ERROR("gmfn %lx was OOS but not in hash table\n", mfn_x(gmfn)); in oos_fixup_add()
611 static int oos_remove_write_access(struct vcpu *v, mfn_t gmfn, in oos_remove_write_access() argument
617 ftlb |= oos_fixup_flush_gmfn(v, gmfn, fixup); in oos_remove_write_access()
619 switch ( sh_remove_write_access(d, gmfn, 0, 0) ) in oos_remove_write_access()
635 sh_remove_shadows(d, gmfn, 0 /* Be thorough */, 1 /* Must succeed */); in oos_remove_write_access()
646 static inline void trace_resync(int event, mfn_t gmfn) in trace_resync() argument
651 unsigned long gfn = mfn_to_gfn(current->domain, gmfn); in trace_resync()
657 static void _sh_resync(struct vcpu *v, mfn_t gmfn, in _sh_resync() argument
660 struct page_info *pg = mfn_to_page(gmfn); in _sh_resync()
663 ASSERT(mfn_is_out_of_sync(gmfn)); in _sh_resync()
665 ASSERT(!(mfn_to_page(gmfn)->shadow_flags & SHF_page_type_mask in _sh_resync()
667 ASSERT(!sh_page_has_multiple_shadows(mfn_to_page(gmfn))); in _sh_resync()
669 SHADOW_PRINTK("%pv gmfn=%"PRI_mfn"\n", v, mfn_x(gmfn)); in _sh_resync()
672 if ( oos_remove_write_access(v, gmfn, fixup) ) in _sh_resync()
682 _sh_resync_l1(v, gmfn, snp); in _sh_resync()
687 trace_resync(TRC_SHADOW_RESYNC_FULL, gmfn); in _sh_resync()
692 static void oos_hash_add(struct vcpu *v, mfn_t gmfn) in oos_hash_add() argument
704 idx = mfn_x(gmfn) % SHADOW_OOS_PAGES; in oos_hash_add()
711 SWAP(oos[idx], gmfn); in oos_hash_add()
722 oos[idx] = gmfn; in oos_hash_add()
736 static void oos_hash_remove(struct domain *d, mfn_t gmfn) in oos_hash_remove() argument
742 SHADOW_PRINTK("d%d gmfn %lx\n", d->domain_id, mfn_x(gmfn)); in oos_hash_remove()
747 idx = mfn_x(gmfn) % SHADOW_OOS_PAGES; in oos_hash_remove()
748 if ( mfn_x(oos[idx]) != mfn_x(gmfn) ) in oos_hash_remove()
750 if ( mfn_x(oos[idx]) == mfn_x(gmfn) ) in oos_hash_remove()
757 SHADOW_ERROR("gmfn %lx was OOS but not in hash table\n", mfn_x(gmfn)); in oos_hash_remove()
761 mfn_t oos_snapshot_lookup(struct domain *d, mfn_t gmfn) in oos_snapshot_lookup() argument
772 idx = mfn_x(gmfn) % SHADOW_OOS_PAGES; in oos_snapshot_lookup()
773 if ( mfn_x(oos[idx]) != mfn_x(gmfn) ) in oos_snapshot_lookup()
775 if ( mfn_x(oos[idx]) == mfn_x(gmfn) ) in oos_snapshot_lookup()
781 SHADOW_ERROR("gmfn %lx was OOS but not in hash table\n", mfn_x(gmfn)); in oos_snapshot_lookup()
786 void sh_resync(struct domain *d, mfn_t gmfn) in sh_resync() argument
799 idx = mfn_x(gmfn) % SHADOW_OOS_PAGES; in sh_resync()
800 if ( mfn_x(oos[idx]) != mfn_x(gmfn) ) in sh_resync()
803 if ( mfn_x(oos[idx]) == mfn_x(gmfn) ) in sh_resync()
805 _sh_resync(v, gmfn, &oos_fixup[idx], oos_snapshot[idx]); in sh_resync()
811 SHADOW_ERROR("gmfn %lx was OOS but not in hash table\n", mfn_x(gmfn)); in sh_resync()
900 int sh_unsync(struct vcpu *v, mfn_t gmfn) in sh_unsync() argument
906 SHADOW_PRINTK("%pv gmfn=%"PRI_mfn"\n", v, mfn_x(gmfn)); in sh_unsync()
908 pg = mfn_to_page(gmfn); in sh_unsync()
921 oos_hash_add(v, gmfn); in sh_unsync()
936 void shadow_promote(struct domain *d, mfn_t gmfn, unsigned int type) in shadow_promote() argument
938 struct page_info *page = mfn_to_page(gmfn); in shadow_promote()
940 ASSERT(mfn_valid(gmfn)); in shadow_promote()
945 sh_resync(d, gmfn); in shadow_promote()
962 void shadow_demote(struct domain *d, mfn_t gmfn, u32 type) in shadow_demote() argument
964 struct page_info *page = mfn_to_page(gmfn); in shadow_demote()
977 oos_hash_remove(d, gmfn); in shadow_demote()
991 sh_validate_guest_entry(struct vcpu *v, mfn_t gmfn, void *entry, u32 size) in sh_validate_guest_entry() argument
994 struct page_info *page = mfn_to_page(gmfn); in sh_validate_guest_entry()
996 paging_mark_dirty(v->domain, gmfn); in sh_validate_guest_entry()
1016 (v, gmfn, entry, size); in sh_validate_guest_entry()
1019 (v, gmfn, entry, size); in sh_validate_guest_entry()
1023 (v, gmfn, entry, size); in sh_validate_guest_entry()
1026 (v, gmfn, entry, size); in sh_validate_guest_entry()
1029 (v, gmfn, entry, size); in sh_validate_guest_entry()
1033 (v, gmfn, entry, size); in sh_validate_guest_entry()
1036 (v, gmfn, entry, size); in sh_validate_guest_entry()
1039 (v, gmfn, entry, size); in sh_validate_guest_entry()
1042 (v, gmfn, entry, size); in sh_validate_guest_entry()
1045 (v, gmfn, entry, size); in sh_validate_guest_entry()
1054 sh_validate_guest_pt_write(struct vcpu *v, mfn_t gmfn, in sh_validate_guest_pt_write() argument
1064 rc = sh_validate_guest_entry(v, gmfn, entry, size); in sh_validate_guest_pt_write()
1075 sh_remove_shadows(d, gmfn, 0, 0); in sh_validate_guest_pt_write()
2271 static inline void trace_shadow_wrmap_bf(mfn_t gmfn) in trace_shadow_wrmap_bf() argument
2276 unsigned long gfn = mfn_to_gfn(current->domain, gmfn); in trace_shadow_wrmap_bf()
2288 int sh_remove_write_access(struct domain *d, mfn_t gmfn, in sh_remove_write_access() argument
2320 struct page_info *pg = mfn_to_page(gmfn); in sh_remove_write_access()
2335 if ( (sh_mfn_is_a_page_table(gmfn) in sh_remove_write_access()
2338 && !mfn_oos_may_write(gmfn) in sh_remove_write_access()
2354 mfn_x(gmfn), mfn_to_page(gmfn)->u.inuse.type_info); in sh_remove_write_access()
2368 curr, (_a), gmfn) ) \ in sh_remove_write_access()
2384 if ((gfn = mfn_to_gfn(d, gmfn)) < 0x38000 ) in sh_remove_write_access()
2402 if ((gfn = mfn_to_gfn(d, gmfn)) < 0x38000 ) in sh_remove_write_access()
2430 gfn = mfn_to_gfn(d, gmfn); in sh_remove_write_access()
2475 callbacks[shtype](d, last_smfn, gmfn); in sh_remove_write_access()
2487 trace_shadow_wrmap_bf(gmfn); in sh_remove_write_access()
2492 hash_domain_foreach(d, callback_mask, callbacks, gmfn); in sh_remove_write_access()
2496 if ( (mfn_to_page(gmfn)->u.inuse.type_info & PGT_count_mask) != 0 ) in sh_remove_write_access()
2502 "%lu special-use mappings of it\n", mfn_x(gmfn), in sh_remove_write_access()
2503 (mfn_to_page(gmfn)->u.inuse.type_info&PGT_count_mask)); in sh_remove_write_access()
2512 int sh_remove_write_access_from_sl1p(struct domain *d, mfn_t gmfn, in sh_remove_write_access_from_sl1p() argument
2518 ASSERT(mfn_valid(gmfn)); in sh_remove_write_access_from_sl1p()
2524 (d, gmfn, smfn, off); in sh_remove_write_access_from_sl1p()
2529 (d, gmfn, smfn, off); in sh_remove_write_access_from_sl1p()
2533 (d, gmfn, smfn, off); in sh_remove_write_access_from_sl1p()
2543 static int sh_remove_all_mappings(struct domain *d, mfn_t gmfn, gfn_t gfn) in sh_remove_all_mappings() argument
2545 struct page_info *page = mfn_to_page(gmfn); in sh_remove_all_mappings()
2590 hash_domain_foreach(d, callback_mask, callbacks, gmfn); in sh_remove_all_mappings()
2610 "c=%lx t=%lx x=%d i=%d\n", mfn_x(gmfn), gfn_x(gfn), in sh_remove_all_mappings()
2681 void sh_remove_shadows(struct domain *d, mfn_t gmfn, int fast, int all) in sh_remove_shadows() argument
2690 struct page_info *pg = mfn_to_page(gmfn); in sh_remove_shadows()
2736 ASSERT(mfn_valid(gmfn)); in sh_remove_shadows()
2743 SHADOW_PRINTK("d%d gmfn=%"PRI_mfn"\n", d->domain_id, mfn_x(gmfn)); in sh_remove_shadows()
2764 smfn = shadow_hash_lookup(d, mfn_x(gmfn), t); \ in sh_remove_shadows()
2769 mfn_x(gmfn), (uint32_t)pg->shadow_flags, t); \ in sh_remove_shadows()
2800 mfn_x(gmfn), pg->shadow_flags); in sh_remove_shadows()
2812 sh_remove_all_shadows_and_parents(struct domain *d, mfn_t gmfn) in sh_remove_all_shadows_and_parents() argument
2816 sh_remove_shadows(d, gmfn, 0, 1); in sh_remove_all_shadows_and_parents()