mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 10:11:27 +01:00
x86/p2m: Switch the two_gfns infrastructure to using gfn_t
Additionally, drop surrounding trailing whitespace. Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Tamas K Lengyel <tamas@tklengyel.com> Reviewed-by: Jan Beulich <jbeulich@suse.com> --- CC: Jan Beulich <JBeulich@suse.com> CC: Wei Liu <wei.liu2@citrix.com> CC: George Dunlap <george.dunlap@eu.citrix.com> CC: Tamas K Lengyel <tamas@tklengyel.com>
This commit is contained in:
1 parent
b7c7416064
commit
91085b0860
2 files changed
+17
-20
No files matched your search
@@ -901,9 +901,8 @@ static int share_pages(struct domain *sd, gfn_t sgfn, shr_handle_t sh,
|
||||
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 */
|
||||
@@ -1027,9 +1026,8 @@ int mem_sharing_add_to_physmap(struct domain *sd, unsigned long sgfn, shr_handle
|
||||
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;
|
||||
|
||||
+13
-14
@@ -516,17 +516,15 @@ static inline unsigned long mfn_to_gfn(struct domain *d, mfn_t mfn)
|
||||
|
||||
/* 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;
|
||||
@@ -544,7 +542,8 @@ do { \
|
||||
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);
|
||||
@@ -556,10 +555,10 @@ do { \
|
||||
#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)
|
||||
@@ -567,8 +566,8 @@ 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 */
|
||||
|
||||