diff mbox series

[Xen-devel,for-4.12,v2,14/17] xen/arm: domctl: Use typesafe gfn in XEN_DOMCTL_cacheflush

Message ID 20181204202651.8836-15-julien.grall@arm.com
State New
Headers show
Series xen/arm: Implement Set/Way operations | expand

Commit Message

Julien Grall Dec. 4, 2018, 8:26 p.m. UTC
This will make changes in a follow-up patch easier.

Signed-off-by: Julien Grall <julien.grall@arm.com>

---
    Changes in v2:
        - Patch added
---
 xen/arch/arm/domctl.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Stefano Stabellini Dec. 6, 2018, 11:13 p.m. UTC | #1
On Tue, 4 Dec 2018, Julien Grall wrote:
> This will make changes in a follow-up patch easier.
> 
> Signed-off-by: Julien Grall <julien.grall@arm.com>

Acked-by: Stefano Stabellini <sstabellini@kernel.org>

> ---
>     Changes in v2:
>         - Patch added
> ---
>  xen/arch/arm/domctl.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/xen/arch/arm/domctl.c b/xen/arch/arm/domctl.c
> index c10f568aad..20691528a6 100644
> --- a/xen/arch/arm/domctl.c
> +++ b/xen/arch/arm/domctl.c
> @@ -52,16 +52,16 @@ long arch_do_domctl(struct xen_domctl *domctl, struct domain *d,
>      {
>      case XEN_DOMCTL_cacheflush:
>      {
> -        unsigned long s = domctl->u.cacheflush.start_pfn;
> -        unsigned long e = s + domctl->u.cacheflush.nr_pfns;
> +        gfn_t s = _gfn(domctl->u.cacheflush.start_pfn);
> +        gfn_t e = gfn_add(s, domctl->u.cacheflush.nr_pfns);
>  
>          if ( domctl->u.cacheflush.nr_pfns > (1U<<MAX_ORDER) )
>              return -EINVAL;
>  
> -        if ( e < s )
> +        if ( gfn_x(e) < gfn_x(s) )
>              return -EINVAL;
>  
> -        return p2m_cache_flush_range(d, _gfn(s), _gfn(e));
> +        return p2m_cache_flush_range(d, s, e);
>      }
>      case XEN_DOMCTL_bind_pt_irq:
>      {
> -- 
> 2.11.0
>
diff mbox series

Patch

diff --git a/xen/arch/arm/domctl.c b/xen/arch/arm/domctl.c
index c10f568aad..20691528a6 100644
--- a/xen/arch/arm/domctl.c
+++ b/xen/arch/arm/domctl.c
@@ -52,16 +52,16 @@  long arch_do_domctl(struct xen_domctl *domctl, struct domain *d,
     {
     case XEN_DOMCTL_cacheflush:
     {
-        unsigned long s = domctl->u.cacheflush.start_pfn;
-        unsigned long e = s + domctl->u.cacheflush.nr_pfns;
+        gfn_t s = _gfn(domctl->u.cacheflush.start_pfn);
+        gfn_t e = gfn_add(s, domctl->u.cacheflush.nr_pfns);
 
         if ( domctl->u.cacheflush.nr_pfns > (1U<<MAX_ORDER) )
             return -EINVAL;
 
-        if ( e < s )
+        if ( gfn_x(e) < gfn_x(s) )
             return -EINVAL;
 
-        return p2m_cache_flush_range(d, _gfn(s), _gfn(e));
+        return p2m_cache_flush_range(d, s, e);
     }
     case XEN_DOMCTL_bind_pt_irq:
     {