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

Re: [Xen-devel] [PATCH v3 03/16] x86: XENMEM_resource_ioreq_server is HVM only



> -----Original Message-----
> From: Wei Liu [mailto:wei.liu2@xxxxxxxxxx]
> Sent: 04 September 2018 17:15
> To: xen-devel@xxxxxxxxxxxxxxxxxxxx
> Cc: Wei Liu <wei.liu2@xxxxxxxxxx>; Paul Durrant <Paul.Durrant@xxxxxxxxxx>;
> Jan Beulich <jbeulich@xxxxxxxx>; Andrew Cooper
> <Andrew.Cooper3@xxxxxxxxxx>
> Subject: [PATCH v3 03/16] x86: XENMEM_resource_ioreq_server is HVM
> only
> 
> Put the entire case branch under CONFIG_HVM.
> 
> Nonetheless check HVM before trying to get ioreq server.
> 
> Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>

Reviewed-by: Paul Durrant <paul.durrant@xxxxxxxxxx>

> ---
> v3:
> 1. put an assert in hvm_get_ioreq_server_frame
> 2. remove redundant assignment of rc
> 
> v2: put entire case branch under CONFIG_HVM
> ---
>  xen/arch/x86/hvm/ioreq.c | 5 ++---
>  xen/arch/x86/mm.c        | 5 +++++
>  2 files changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/xen/arch/x86/hvm/ioreq.c b/xen/arch/x86/hvm/ioreq.c
> index 138ed697cd..fecca58a3d 100644
> --- a/xen/arch/x86/hvm/ioreq.c
> +++ b/xen/arch/x86/hvm/ioreq.c
> @@ -961,12 +961,11 @@ int hvm_get_ioreq_server_frame(struct domain
> *d, ioservid_t id,
>      struct hvm_ioreq_server *s;
>      int rc;
> 
> +    ASSERT(is_hvm_domain(d));
> +
>      if ( id == DEFAULT_IOSERVID )
>          return -EOPNOTSUPP;
> 
> -    if ( !is_hvm_domain(d) )
> -        return -EINVAL;
> -
>      spin_lock_recursive(&d->arch.hvm.ioreq_server.lock);
> 
>      s = get_ioreq_server(d, id);
> diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
> index 409814ce0a..baea2f5e63 100644
> --- a/xen/arch/x86/mm.c
> +++ b/xen/arch/x86/mm.c
> @@ -4381,12 +4381,16 @@ int arch_acquire_resource(struct domain *d,
> unsigned int type,
> 
>      switch ( type )
>      {
> +#ifdef CONFIG_HVM
>      case XENMEM_resource_ioreq_server:
>      {
>          ioservid_t ioservid = id;
>          unsigned int i;
> 
>          rc = -EINVAL;
> +        if ( !is_hvm_domain(d) )
> +            break;
> +
>          if ( id != (unsigned int)ioservid )
>              break;
> 
> @@ -4409,6 +4413,7 @@ int arch_acquire_resource(struct domain *d,
> unsigned int type,
>          *flags |= XENMEM_rsrc_acq_caller_owned;
>          break;
>      }
> +#endif
> 
>      default:
>          rc = -EOPNOTSUPP;
> --
> 2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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