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

Re: [Xen-devel] [PATCH v5 07/16] x86/hvm: unify dpci portio intercept with standard portio intercept



On 30/06/15 14:05, Paul Durrant wrote:
> This patch re-works the dpci portio intercepts so that they can be unified
> with standard portio handling thereby removing a substantial amount of
> code duplication.
>
> Signed-off-by: Paul Durrant <paul.durrant@xxxxxxxxxx>
> Cc: Keir Fraser <keir@xxxxxxx>
> Cc: Jan Beulich <jbeulich@xxxxxxxx>
> Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
> ---
>  xen/arch/x86/hvm/hvm.c         |    2 +
>  xen/arch/x86/hvm/intercept.c   |   22 ++--
>  xen/arch/x86/hvm/io.c          |  220 
> ++++++++++++----------------------------
>  xen/include/asm-x86/hvm/io.h   |    5 +
>  xen/include/asm-x86/hvm/vcpu.h |    2 +
>  xen/include/xen/iommu.h        |    1 -
>  6 files changed, 80 insertions(+), 172 deletions(-)
>
> diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
> index 60f8972..6643e0c 100644
> --- a/xen/arch/x86/hvm/hvm.c
> +++ b/xen/arch/x86/hvm/hvm.c
> @@ -1486,6 +1486,8 @@ int hvm_domain_initialise(struct domain *d)
>      else
>          d->arch.hvm_domain.io_bitmap = hvm_io_bitmap;
>  
> +    register_dpci_portio_handler(d);
> +
>      if ( is_pvh_domain(d) )
>      {
>          register_portio_handler(d, 0, 0x10003, handle_pvh_io);
> diff --git a/xen/arch/x86/hvm/intercept.c b/xen/arch/x86/hvm/intercept.c
> index 42050f4..a613865 100644
> --- a/xen/arch/x86/hvm/intercept.c
> +++ b/xen/arch/x86/hvm/intercept.c
> @@ -124,10 +124,7 @@ static int hvm_process_io_intercept(const struct 
> hvm_io_handler *handler,
>  {
>      struct vcpu *curr = current;
>      struct hvm_vcpu_io *vio = &curr->arch.hvm_vcpu.hvm_io;
> -    const struct hvm_io_ops *ops =
> -        (p->type == IOREQ_TYPE_COPY) ?
> -        &mmio_ops :
> -        &portio_ops;
> +    const struct hvm_io_ops *ops = handler->ops;
>      int rc = X86EMUL_OKAY, i, step = p->df ? -p->size : p->size;
>      uint64_t data;
>      uint64_t addr;
> @@ -247,10 +244,6 @@ static int hvm_process_io_intercept(const struct 
> hvm_io_handler *handler,
>  static const struct hvm_io_handler *hvm_find_io_handler(ioreq_t *p)
>  {
>      struct domain *curr_d = current->domain;
> -    const struct hvm_io_ops *ops =
> -        (p->type == IOREQ_TYPE_COPY) ?
> -        &mmio_ops :
> -        &portio_ops;
>      unsigned int i;
>  
>      BUG_ON((p->type != IOREQ_TYPE_PIO) &&
> @@ -260,6 +253,7 @@ static const struct hvm_io_handler 
> *hvm_find_io_handler(ioreq_t *p)
>      {
>          const struct hvm_io_handler *handler =
>              &curr_d->arch.hvm_domain.io_handler[i];
> +        const struct hvm_io_ops *ops = handler->ops;
>  
>          if ( handler->type != p->type )
>              continue;
> @@ -275,13 +269,7 @@ int hvm_io_intercept(ioreq_t *p)
>  {
>      const struct hvm_io_handler *handler;
>  
> -    if ( p->type == IOREQ_TYPE_PIO )
> -    {
> -        int rc = dpci_ioport_intercept(p);
> -        if ( (rc == X86EMUL_OKAY) || (rc == X86EMUL_RETRY) )
> -            return rc;
> -    }
> -    else if ( p->type == IOREQ_TYPE_COPY )
> +    if ( p->type == IOREQ_TYPE_COPY )
>      {
>          int rc = stdvga_intercept_mmio(p);
>          if ( (rc == X86EMUL_OKAY) || (rc == X86EMUL_RETRY) )
> @@ -296,7 +284,7 @@ int hvm_io_intercept(ioreq_t *p)
>      return hvm_process_io_intercept(handler, p);
>  }
>  
> -static struct hvm_io_handler *hvm_next_io_handler(struct domain *d)
> +struct hvm_io_handler *hvm_next_io_handler(struct domain *d)

Instead of introducing this as a static in patch 5, then modifying it
here to export it, introduce it directly as an exported function in 5.

Otherwise, Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>

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


 


Rackspace

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