* altp2m_list lock.
*/
if ( p2m != hostp2m )
- __put_gfn(p2m, gfn);
+ p2m_put_gfn(p2m, _gfn(gfn));
p2m_change_type_one(currd, gfn, p2m_ram_logdirty, p2m_ram_rw);
- __put_gfn(hostp2m, gfn);
+ p2m_put_gfn(hostp2m, _gfn(gfn));
goto out;
}
out_put_gfn:
if ( p2m != hostp2m )
- __put_gfn(p2m, gfn);
- __put_gfn(hostp2m, gfn);
+ p2m_put_gfn(p2m, _gfn(gfn));
+ p2m_put_gfn(hostp2m, _gfn(gfn));
out:
/*
* All of these are delayed until we exit, since we might
P2M_ALLOC | P2M_UNSHARE)
/* Will release the p2m_lock for this gfn entry. */
-void __put_gfn(struct p2m_domain *p2m, unsigned long gfn);
+void p2m_put_gfn(struct p2m_domain *p2m, gfn_t gfn);
-#define put_gfn(d, gfn) __put_gfn(p2m_get_hostp2m((d)), (gfn))
+static inline void put_gfn(struct domain *d, unsigned long gfn)
+{
+ if ( !paging_mode_translate(d) )
+ /* Nothing to do in this case */
+ return;
+
+ p2m_put_gfn(p2m_get_hostp2m(d), _gfn(gfn));
+}
/* The intent of the "unlocked" accessor is to have the caller not worry about
* put_gfn. They apply to very specific situations: debug printk's, dumps
direct_mmio_out:
*L0_gpa = (mfn_x(mfn) << PAGE_SHIFT) + (L1_gpa & ~PAGE_MASK);
out:
- __put_gfn(p2m, L1_gpa >> PAGE_SHIFT);
+ p2m_put_gfn(p2m, gaddr_to_gfn(L1_gpa));
return rc;
}
return mfn;
}
-#endif /* CONFIG_HVM */
-
-void __put_gfn(struct p2m_domain *p2m, unsigned long gfn)
+void p2m_put_gfn(struct p2m_domain *p2m, gfn_t gfn)
{
- if ( !p2m || !paging_mode_translate(p2m->domain) )
- /* Nothing to do in this case */
- return;
-
- ASSERT(gfn_locked_by_me(p2m, gfn));
+ ASSERT(gfn_locked_by_me(p2m, gfn_x(gfn)));
- gfn_unlock(p2m, gfn, 0);
+ gfn_unlock(p2m, gfn_x(gfn), 0);
}
-#ifdef CONFIG_HVM
-
/* Atomically look up a GFN and take a reference count on the backing page. */
struct page_info *p2m_get_page_from_gfn(
struct p2m_domain *p2m, gfn_t gfn,
if ( !ret )
ret = rc;
- __put_gfn(p2m, gfn_x(gfn));
+ p2m_put_gfn(p2m, gfn);
}
else
- __put_gfn(p2m, gfn_x(gfn));
+ p2m_put_gfn(p2m, gfn);
}
altp2m_list_unlock(d);
* blow away the m2p entry. */
set_gpfn_from_mfn(mfn, INVALID_M2P_ENTRY);
}
- __put_gfn(p2m, gfn);
+ p2m_put_gfn(p2m, _gfn(gfn));
P2M_PRINTK("OK: mfn=%#lx, gfn=%#lx, p2mfn=%#lx\n",
mfn, gfn, mfn_x(p2mfn));