|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v3 2/3] x86/mm: Introduce altp2m_set_entry_by_page_order
On Tue, Apr 9, 2019 at 6:04 AM Alexandru Stefan ISAILA
<aisaila@xxxxxxxxxxxxxxx> wrote:
>
> This patch moves common code from p2m_set_altp2m_mem_access() and
> p2m_change_altp2m_gfn() into one function
>
> Signed-off-by: Alexandru Isaila <aisaila@xxxxxxxxxxxxxxx>
> ---
> xen/arch/x86/mm/mem_access.c | 2 +-
> xen/include/asm-x86/p2m.h | 11 +++++++++++
> 2 files changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/xen/arch/x86/mm/mem_access.c b/xen/arch/x86/mm/mem_access.c
> index bf67ddb15a..6a22512555 100644
> --- a/xen/arch/x86/mm/mem_access.c
> +++ b/xen/arch/x86/mm/mem_access.c
> @@ -279,7 +279,7 @@ int p2m_set_altp2m_mem_access(struct domain *d, struct
> p2m_domain *hp2m,
> gfn_t gfn2 = _gfn(gfn_l & mask);
> mfn_t mfn2 = _mfn(mfn_x(mfn) & mask);
>
> - /* Note: currently it is not safe to remap to a shared entry */
> + /* Note: currently it is not safe to remap to a shared entry */
This looks like an unrelated change. And I guess this comment should
also be fixed as this is the mem_access setting function, not the
remap function.
> if ( t != p2m_ram_rw )
> return -ESRCH;
>
> diff --git a/xen/include/asm-x86/p2m.h b/xen/include/asm-x86/p2m.h
> index 6de1546d76..90a6c135a7 100644
> --- a/xen/include/asm-x86/p2m.h
> +++ b/xen/include/asm-x86/p2m.h
> @@ -467,6 +467,17 @@ static inline mfn_t altp2m_get_gfn_type_access(
> return mfn;
> }
>
> +static inline int altp2m_set_entry_by_page_order(
> + struct p2m_domain *ap2m, unsigned long gfn, mfn_t mfn,
> + unsigned int page_order, p2m_type_t t, p2m_access_t a)
> +{
> + unsigned long mask = ~((1UL << page_order) - 1);
> + gfn_t gfn2 = _gfn(gfn & mask);
> + mfn_t mfn2 = _mfn(mfn_x(mfn) & mask);
> +
> + return ap2m->set_entry(ap2m, gfn2, mfn2, page_order, t, a, 1);
> +}
> +
> /* Syntactic sugar: most callers will use one of these. */
> #define get_gfn(d, g, t) get_gfn_type((d), (g), (t), P2M_ALLOC)
> #define get_gfn_query(d, g, t) get_gfn_type((d), (g), (t), 0)
> --
> 2.17.1
>
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |