@@ -1955,9 +1955,9 @@ int hvm_hap_nested_page_fault(paddr_t gp
* 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;
}
@@ -1979,8 +1979,8 @@ int hvm_hap_nested_page_fault(paddr_t gp
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
@@ -509,9 +509,16 @@ static inline mfn_t __nonnull(3) get_gfn
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
@@ -149,7 +149,7 @@ static int nestedhap_walk_L0_p2m(
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;
}
@@ -333,21 +333,13 @@ mfn_t p2m_get_gfn_type_access(struct p2m
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,
@@ -2201,7 +2193,7 @@ int p2m_altp2m_propagate_change(struct d
else
{
/* At least 2 altp2m's impacted, so reset everything */
- __put_gfn(p2m, gfn_x(gfn));
+ p2m_put_gfn(p2m, gfn);
for ( i = 0; i < MAX_ALTP2M; i++ )
{
@@ -2225,7 +2217,7 @@ int p2m_altp2m_propagate_change(struct d
ret = rc;
}
- __put_gfn(p2m, gfn_x(gfn));
+ p2m_put_gfn(p2m, gfn);
}
altp2m_list_unlock(d);
@@ -2310,7 +2302,7 @@ void audit_p2m(struct domain *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));