[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v3 17/38] arm/p2m: Add HVMOP_altp2m_create_p2m
Hello Sergej, On 16/08/2016 23:16, Sergej Proskurin wrote: Signed-off-by: Sergej Proskurin <proskurin@xxxxxxxxxxxxx> Acked-by: Julien Grall <julien.grall@xxxxxxx> Regards, --- Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx> Cc: Julien Grall <julien.grall@xxxxxxx> --- v2: Cosmetic fixes. v3: Cosmetic fixes. Renamed the function "altp2m_init_next" to "altp2m_init_next_available". Exchanged the check "altp2m_vttbr[idx] == INVALID_VTTBR" for "altp2m_p2m[idx] == NULL" in "altp2m_init_next_available". --- xen/arch/arm/altp2m.c | 23 +++++++++++++++++++++++ xen/arch/arm/hvm.c | 3 ++- xen/include/asm-arm/altp2m.h | 4 ++++ 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/xen/arch/arm/altp2m.c b/xen/arch/arm/altp2m.c index 02a52ec..b5d1951 100644 --- a/xen/arch/arm/altp2m.c +++ b/xen/arch/arm/altp2m.c @@ -122,6 +122,29 @@ int altp2m_init_by_id(struct domain *d, unsigned int idx) return rc; } +int altp2m_init_next_available(struct domain *d, uint16_t *idx) +{ + int rc = -EINVAL; + uint16_t i; + + altp2m_lock(d); + + for ( i = 0; i < MAX_ALTP2M; i++ ) + { + if ( d->arch.altp2m_p2m[i] != NULL ) + continue; + + rc = altp2m_init_helper(d, i); + *idx = i; + + break; + } + + altp2m_unlock(d); + + return rc; +} + int altp2m_init(struct domain *d) { unsigned int i; diff --git a/xen/arch/arm/hvm.c b/xen/arch/arm/hvm.c index c69da36..a504dfd 100644 --- a/xen/arch/arm/hvm.c +++ b/xen/arch/arm/hvm.c @@ -123,7 +123,8 @@ static int do_altp2m_op(XEN_GUEST_HANDLE_PARAM(void) arg) break; case HVMOP_altp2m_create_p2m: - rc = -EOPNOTSUPP; + if ( !(rc = altp2m_init_next_available(d, &a.u.view.view)) ) + rc = __copy_to_guest(arg, &a, 1) ? -EFAULT : 0; break; case HVMOP_altp2m_destroy_p2m: diff --git a/xen/include/asm-arm/altp2m.h b/xen/include/asm-arm/altp2m.h index f604ffd..5701012 100644 --- a/xen/include/asm-arm/altp2m.h +++ b/xen/include/asm-arm/altp2m.h @@ -56,6 +56,10 @@ struct p2m_domain *altp2m_get_altp2m(struct vcpu *v); int altp2m_init_by_id(struct domain *d, unsigned int idx); +/* Find and initialize the next available alternate p2m. */ +int altp2m_init_next_available(struct domain *d, + uint16_t *idx); + /* Flush all the alternate p2m's for a domain. */ void altp2m_flush(struct domain *d); -- Julien Grall _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |