[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v2 Altp2m cleanup v3 1/3] altp2m cleanup work



>>> On 19.08.16 at 19:22, <paul.c.lai@xxxxxxxxx> wrote:
> @@ -5213,12 +5213,25 @@ static int do_altp2m_op(
>          return -EFAULT;
>  
>      if ( a.pad1 || a.pad2 ||
> -         (a.version != HVMOP_ALTP2M_INTERFACE_VERSION) ||
> -         (a.cmd < HVMOP_altp2m_get_domain_state) ||
> -         (a.cmd > HVMOP_altp2m_change_gfn) )
> +        (a.version != HVMOP_ALTP2M_INTERFACE_VERSION) )
>          return -EINVAL;
>  
> -    d = (a.cmd != HVMOP_altp2m_vcpu_enable_notify) ?
> +    switch( a.cmd )

Missing blank.

> +    {
> +    case HVMOP_altp2m_get_domain_state:
> +    case HVMOP_altp2m_set_domain_state:
> +    case HVMOP_altp2m_vcpu_enable_notify:
> +    case HVMOP_altp2m_create_p2m:
> +    case HVMOP_altp2m_destroy_p2m:
> +    case HVMOP_altp2m_switch_p2m:
> +    case HVMOP_altp2m_set_mem_access:
> +    case HVMOP_altp2m_change_gfn:
> +        break;
> +    default:
> +        return -ENOSYS;
> +    }
> +
> +    d = ( a.cmd != HVMOP_altp2m_vcpu_enable_notify ) ?
>          rcu_lock_domain_by_any_id(a.domain) : rcu_lock_current_domain();
>  
>      if ( d == NULL )
> @@ -5335,6 +5348,8 @@ static int do_altp2m_op(
>              rc = p2m_change_altp2m_gfn(d, a.u.change_gfn.view,
>                      _gfn(a.u.change_gfn.old_gfn),
>                      _gfn(a.u.change_gfn.new_gfn));
> +    default:
> +        return -EINVAL;
>      }

Together with the earlier switch() this is dead code. So if anything,
ASSERT_UNREACHABLE() please.

>  /* emulates #VE */
> -bool_t altp2m_vcpu_emulate_ve(struct vcpu *v);
> +static inline bool_t altp2m_vcpu_emulate_ve(struct vcpu *v)
> +{
> +    if ( hvm_funcs.altp2m_vcpu_emulate_ve )
> +        return hvm_funcs.altp2m_vcpu_emulate_ve(v);
> +    return 0;
> +}

Since you already touch this, plain "bool" and "false" please.

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.