|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH] x86/mm: subsume set_gpfn_from_mfn() into guest_physmap_add_entry()
This is what both callers of guest_physmap_add_page() in memory.c want
(for the !paging_mode_translate() case), and it is also what both
callers in gnttab_transfer() need (but have been lacking). The other
(x86-specific) callers are all HVM-only, and hence unaffected by this
change.
Sadly this isn't enough yet to drop Arm's dummy macro, as there's one
more use in page_alloc.c.
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -841,15 +841,19 @@ guest_physmap_add_entry(struct domain *d
* any guest-requested type changes succeed and remove the IOMMU
* entry).
*/
- if ( !need_iommu_pt_sync(d) || t != p2m_ram_rw )
+ if ( t != p2m_ram_rw )
return 0;
for ( i = 0; i < (1UL << page_order); ++i, ++page )
{
- if ( get_page_and_type(page, d, PGT_writable_page) )
+ if ( !need_iommu_pt_sync(d) )
+ /* nothing */;
+ else if ( get_page_and_type(page, d, PGT_writable_page) )
put_page_and_type(page);
else
return -EINVAL;
+
+ set_gpfn_from_mfn(mfn_x(mfn) + i, gfn_x(gfn) + i);
}
return 0;
--- a/xen/common/memory.c
+++ b/xen/common/memory.c
@@ -270,16 +270,10 @@ static void populate_physmap(struct memo
guest_physmap_add_page(d, _gfn(gpfn), mfn, a->extent_order);
- if ( !paging_mode_translate(d) )
- {
- for ( j = 0; j < (1U << a->extent_order); j++ )
- set_gpfn_from_mfn(mfn_x(mfn_add(mfn, j)), gpfn + j);
-
- /* Inform the domain of the new page's machine address. */
- if ( unlikely(__copy_mfn_to_guest_offset(a->extent_list, i,
- mfn)) )
- goto out;
- }
+ if ( !paging_mode_translate(d) &&
+ /* Inform the domain of the new page's machine address. */
+ unlikely(__copy_mfn_to_guest_offset(a->extent_list, i, mfn)) )
+ goto out;
}
}
@@ -755,15 +749,11 @@ static long memory_exchange(XEN_GUEST_HA
guest_physmap_add_page(d, _gfn(gpfn), mfn,
exch.out.extent_order);
- if ( !paging_mode_translate(d) )
- {
- for ( k = 0; k < (1UL << exch.out.extent_order); k++ )
- set_gpfn_from_mfn(mfn_x(mfn_add(mfn, k)), gpfn + k);
- if ( __copy_mfn_to_guest_offset(exch.out.extent_start,
- (i << out_chunk_order) + j,
- mfn) )
- rc = -EFAULT;
- }
+ if ( !paging_mode_translate(d) &&
+ __copy_mfn_to_guest_offset(exch.out.extent_start,
+ (i << out_chunk_order) + j,
+ mfn) )
+ rc = -EFAULT;
}
BUG_ON( !(d->is_dying) && (j != (1UL << out_chunk_order)) );
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |