@@ -716,18 +716,18 @@ int map_ldt_shadow_page(unsigned int off)
}
-static int get_page_from_pagenr(unsigned long page_nr, struct domain *d)
+static bool get_page_from_mfn(mfn_t mfn, struct domain *d)
{
- struct page_info *page = mfn_to_page(page_nr);
+ struct page_info *page = mfn_to_page(mfn_x(mfn));
- if ( unlikely(!mfn_valid(_mfn(page_nr))) || unlikely(!get_page(page, d)) )
+ if ( unlikely(!mfn_valid(mfn)) || unlikely(!get_page(page, d)) )
{
gdprintk(XENLOG_WARNING,
- "Could not get page ref for mfn %"PRI_mfn"\n", page_nr);
- return 0;
+ "Could not get page ref for mfn %"PRI_mfn"\n", mfn_x(mfn));
+ return false;
}
- return 1;
+ return true;
}
@@ -741,7 +741,7 @@ static int get_page_and_type_from_pagenr(unsigned long page_nr,
int rc;
if ( likely(partial >= 0) &&
- unlikely(!get_page_from_pagenr(page_nr, d)) )
+ unlikely(!get_page_from_mfn(_mfn(page_nr), d)) )
return -EINVAL;
rc = (preemptible ?
@@ -795,7 +795,7 @@ get_##level##_linear_pagetable( \
if ( (pfn = level##e_get_pfn(pde)) != pde_pfn ) \
{ \
/* Make sure the mapped frame belongs to the correct domain. */ \
- if ( unlikely(!get_page_from_pagenr(pfn, d)) ) \
+ if ( unlikely(!get_page_from_mfn(_mfn(pfn), d)) ) \
return 0; \
\
/* \
@@ -3001,7 +3001,7 @@ int new_guest_cr3(unsigned long mfn)
}
rc = paging_mode_refcounts(d)
- ? (get_page_from_pagenr(mfn, d) ? 0 : -EINVAL)
+ ? (get_page_from_mfn(_mfn(mfn), d) ? 0 : -EINVAL)
: get_page_and_type_from_pagenr(mfn, PGT_root_page_table, d, 0, 1);
switch ( rc )
{
@@ -3924,7 +3924,7 @@ long do_mmu_update(
xsm_checked = xsm_needed;
}
- if ( unlikely(!get_page_from_pagenr(mfn, pg_owner)) )
+ if ( unlikely(!get_page_from_mfn(_mfn(mfn), pg_owner)) )
{
gdprintk(XENLOG_WARNING,
"Could not get page for mach->phys update\n");
@@ -4138,7 +4138,7 @@ static int create_grant_va_mapping(
return GNTST_general_error;
}
- if ( !get_page_from_pagenr(gl1mfn, current->domain) )
+ if ( !get_page_from_mfn(_mfn(gl1mfn), current->domain) )
{
guest_unmap_l1e(pl1e);
return GNTST_general_error;
@@ -4188,7 +4188,7 @@ static int replace_grant_va_mapping(
return GNTST_general_error;
}
- if ( !get_page_from_pagenr(gl1mfn, current->domain) )
+ if ( !get_page_from_mfn(_mfn(gl1mfn), current->domain) )
{
rc = GNTST_general_error;
goto out;
@@ -4357,7 +4357,7 @@ int replace_grant_host_mapping(
return GNTST_general_error;
}
- if ( !get_page_from_pagenr(gl1mfn, current->domain) )
+ if ( !get_page_from_mfn(_mfn(gl1mfn), current->domain) )
{
guest_unmap_l1e(pl1e);
return GNTST_general_error;
@@ -4528,7 +4528,7 @@ static int __do_update_va_mapping(
rc = -EINVAL;
pl1e = guest_map_l1e(va, &gl1mfn);
- if ( unlikely(!pl1e || !get_page_from_pagenr(gl1mfn, d)) )
+ if ( unlikely(!pl1e || !get_page_from_mfn(_mfn(gl1mfn), d)) )
goto out;
gl1pg = mfn_to_page(gl1mfn);
@@ -4900,7 +4900,7 @@ int xenmem_add_to_physmap_one(
put_gfn(d, gfn);
return -ENOMEM;
}
- if ( !get_page_from_pagenr(idx, d) )
+ if ( !get_page_from_mfn(_mfn(idx), d) )
break;
mfn = idx;
page = mfn_to_page(mfn);
@@ -5440,7 +5440,7 @@ int ptwr_do_page_fault(struct vcpu *v, unsigned long addr,
/* We are looking only for read-only mappings of p.t. pages. */
if ( ((l1e_get_flags(pte) & (_PAGE_PRESENT|_PAGE_RW)) != _PAGE_PRESENT) ||
rangeset_contains_singleton(mmio_ro_ranges, l1e_get_pfn(pte)) ||
- !get_page_from_pagenr(l1e_get_pfn(pte), d) )
+ !get_page_from_mfn(_mfn(l1e_get_pfn(pte)), d) )
goto bail;
page = l1e_get_page(pte);
'pagenr' is actually an mfn. Rename the function to use consistent terminology, switching it to use a typesafe mfn_t and boolean return type. No functional change. Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> --- CC: Jan Beulich <JBeulich@suse.com> CC: George Dunlap <george.dunlap@eu.citrix.com> CC: Wei Liu <wei.liu2@citrix.com> --- xen/arch/x86/mm.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-)