struct two_gfns tg;
struct rmap_iterator ri;
- get_two_gfns(sd, gfn_x(sgfn), &smfn_type, NULL, &smfn,
- cd, gfn_x(cgfn), &cmfn_type, NULL, &cmfn,
- 0, &tg);
+ get_two_gfns(sd, sgfn, &smfn_type, NULL, &smfn,
+ cd, cgfn, &cmfn_type, NULL, &cmfn, 0, &tg);
/* This tricky business is to avoid two callers deadlocking if
* grabbing pages in opposite client/source order */
p2m_access_t a;
struct two_gfns tg;
- get_two_gfns(sd, sgfn, &smfn_type, NULL, &smfn,
- cd, cgfn, &cmfn_type, &a, &cmfn,
- 0, &tg);
+ get_two_gfns(sd, _gfn(sgfn), &smfn_type, NULL, &smfn,
+ cd, _gfn(cgfn), &cmfn_type, &a, &cmfn, 0, &tg);
/* Get the source shared page, check and lock */
ret = XENMEM_SHARING_OP_S_HANDLE_INVALID;
/* Deadlock-avoidance scheme when calling get_gfn on different gfn's */
struct two_gfns {
- struct domain *first_domain;
- unsigned long first_gfn;
- struct domain *second_domain;
- unsigned long second_gfn;
+ struct domain *first_domain, *second_domain;
+ gfn_t first_gfn, second_gfn;
};
/* Returns mfn, type and access for potential caller consumption, but any
* of those can be NULL */
-static inline void get_two_gfns(struct domain *rd, unsigned long rgfn,
- p2m_type_t *rt, p2m_access_t *ra, mfn_t *rmfn, struct domain *ld,
- unsigned long lgfn, p2m_type_t *lt, p2m_access_t *la, mfn_t *lmfn,
+static inline void get_two_gfns(struct domain *rd, gfn_t rgfn,
+ p2m_type_t *rt, p2m_access_t *ra, mfn_t *rmfn, struct domain *ld,
+ gfn_t lgfn, p2m_type_t *lt, p2m_access_t *la, mfn_t *lmfn,
p2m_query_t q, struct two_gfns *rval)
{
mfn_t *first_mfn, *second_mfn, scratch_mfn;
dest ## _t = (source ## t) ?: &scratch_t; \
} while (0)
- if ( (rd->domain_id <= ld->domain_id) || ((rd == ld) && (rgfn <= lgfn)) )
+ if ( (rd->domain_id <= ld->domain_id) ||
+ ((rd == ld) && (gfn_x(rgfn) <= gfn_x(lgfn))) )
{
assign_pointers(first, r);
assign_pointers(second, l);
#undef assign_pointers
/* Now do the gets */
- *first_mfn = get_gfn_type_access(p2m_get_hostp2m(rval->first_domain),
- rval->first_gfn, first_t, first_a, q, NULL);
- *second_mfn = get_gfn_type_access(p2m_get_hostp2m(rval->second_domain),
- rval->second_gfn, second_t, second_a, q, NULL);
+ *first_mfn = get_gfn_type_access(p2m_get_hostp2m(rval->first_domain),
+ gfn_x(rval->first_gfn), first_t, first_a, q, NULL);
+ *second_mfn = get_gfn_type_access(p2m_get_hostp2m(rval->second_domain),
+ gfn_x(rval->second_gfn), second_t, second_a, q, NULL);
}
static inline void put_two_gfns(struct two_gfns *arg)
if ( !arg )
return;
- put_gfn(arg->second_domain, arg->second_gfn);
- put_gfn(arg->first_domain, arg->first_gfn);
+ put_gfn(arg->second_domain, gfn_x(arg->second_gfn));
+ put_gfn(arg->first_domain, gfn_x(arg->first_gfn));
}
/* Init the datastructures for later use by the p2m code */