Message ID | 20190514123125.29086-3-julien.grall@arm.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | xen/arm: Provide a generic function to update Xen PT | expand |
On Tue, 14 May 2019, Julien Grall wrote: > create_xen_entries() is doing more than creating entries. It can also > modify and remove entries. > > Rename the function to make clear what the function is actually doing. > > Signed-off-by: Julien Grall <julien.grall@arm.com> > Reviewed-by: Andrii Anisov <andrii_anisov@epam.com> Acked-by: Stefano Stabellini <sstabellini@kernel.org> > --- > Changes in v2: > - Add Andrii's reviewed-by > --- > xen/arch/arm/mm.c | 19 +++++++++---------- > 1 file changed, 9 insertions(+), 10 deletions(-) > > diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c > index b408de7c75..36e22fc9ad 100644 > --- a/xen/arch/arm/mm.c > +++ b/xen/arch/arm/mm.c > @@ -970,11 +970,11 @@ enum xenmap_operation { > > static DEFINE_SPINLOCK(xen_pt_lock); > > -static int create_xen_entries(enum xenmap_operation op, > - unsigned long virt, > - mfn_t mfn, > - unsigned long nr_mfns, > - unsigned int flags) > +static int xen_pt_update(enum xenmap_operation op, > + unsigned long virt, > + mfn_t mfn, > + unsigned long nr_mfns, > + unsigned int flags) > { > int rc = 0; > unsigned long addr = virt, addr_end = addr + nr_mfns * PAGE_SIZE; > @@ -1067,25 +1067,24 @@ int map_pages_to_xen(unsigned long virt, > unsigned long nr_mfns, > unsigned int flags) > { > - return create_xen_entries(INSERT, virt, mfn, nr_mfns, flags); > + return xen_pt_update(INSERT, virt, mfn, nr_mfns, flags); > } > > int populate_pt_range(unsigned long virt, unsigned long nr_mfns) > { > - return create_xen_entries(RESERVE, virt, INVALID_MFN, nr_mfns, 0); > + return xen_pt_update(RESERVE, virt, INVALID_MFN, nr_mfns, 0); > } > > int destroy_xen_mappings(unsigned long v, unsigned long e) > { > ASSERT(v <= e); > - return create_xen_entries(REMOVE, v, INVALID_MFN, (e - v) >> PAGE_SHIFT, 0); > + return xen_pt_update(REMOVE, v, INVALID_MFN, (e - v) >> PAGE_SHIFT, 0); > } > > int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int flags) > { > ASSERT(s <= e); > - return create_xen_entries(MODIFY, s, INVALID_MFN, (e - s) >> PAGE_SHIFT, > - flags); > + return xen_pt_update(MODIFY, s, INVALID_MFN, (e - s) >> PAGE_SHIFT, flags); > } > > enum mg { mg_clear, mg_ro, mg_rw, mg_rx }; > -- > 2.11.0 >
diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index b408de7c75..36e22fc9ad 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -970,11 +970,11 @@ enum xenmap_operation { static DEFINE_SPINLOCK(xen_pt_lock); -static int create_xen_entries(enum xenmap_operation op, - unsigned long virt, - mfn_t mfn, - unsigned long nr_mfns, - unsigned int flags) +static int xen_pt_update(enum xenmap_operation op, + unsigned long virt, + mfn_t mfn, + unsigned long nr_mfns, + unsigned int flags) { int rc = 0; unsigned long addr = virt, addr_end = addr + nr_mfns * PAGE_SIZE; @@ -1067,25 +1067,24 @@ int map_pages_to_xen(unsigned long virt, unsigned long nr_mfns, unsigned int flags) { - return create_xen_entries(INSERT, virt, mfn, nr_mfns, flags); + return xen_pt_update(INSERT, virt, mfn, nr_mfns, flags); } int populate_pt_range(unsigned long virt, unsigned long nr_mfns) { - return create_xen_entries(RESERVE, virt, INVALID_MFN, nr_mfns, 0); + return xen_pt_update(RESERVE, virt, INVALID_MFN, nr_mfns, 0); } int destroy_xen_mappings(unsigned long v, unsigned long e) { ASSERT(v <= e); - return create_xen_entries(REMOVE, v, INVALID_MFN, (e - v) >> PAGE_SHIFT, 0); + return xen_pt_update(REMOVE, v, INVALID_MFN, (e - v) >> PAGE_SHIFT, 0); } int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int flags) { ASSERT(s <= e); - return create_xen_entries(MODIFY, s, INVALID_MFN, (e - s) >> PAGE_SHIFT, - flags); + return xen_pt_update(MODIFY, s, INVALID_MFN, (e - s) >> PAGE_SHIFT, flags); } enum mg { mg_clear, mg_ro, mg_rw, mg_rx };