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

Re: [Xen-devel] [PATCH 1/2] x86/io: rename misleading dpci_ prefixed functions to hvm_



> -----Original Message-----
> From: Roger Pau Monne
> Sent: 27 March 2017 16:35
> To: xen-devel@xxxxxxxxxxxxxxxxxxxx
> Cc: Roger Pau Monne <roger.pau@xxxxxxxxxx>; Jan Beulich
> <jbeulich@xxxxxxxx>; Andrew Cooper <Andrew.Cooper3@xxxxxxxxxx>; Paul
> Durrant <Paul.Durrant@xxxxxxxxxx>
> Subject: [PATCH 1/2] x86/io: rename misleading dpci_ prefixed functions to
> hvm_
> 
> The dpci_ prefix used on those IO handlers is misleading, there's nothing PCI
> specific in them, they simply map a guest IO port into a machine (physical) IO
> port. They don't specifically trap the PCI IO port range in any way
> (0xcf8/0xcfc).
> 
> Rename them to use the hvm_ prefix in order to avoid this confusion.

Actually, I wonder whether a prefix of 'g2m' would be better since  'hvm' 
sounds pretty generic.

  Paul

> 
> Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
> ---
> Cc: Jan Beulich <jbeulich@xxxxxxxx>
> Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
> Cc: Paul Durrant <paul.durrant@xxxxxxxxxx>
> ---
>  xen/arch/x86/hvm/hvm.c       |  2 +-
>  xen/arch/x86/hvm/io.c        | 28 ++++++++++++----------------
>  xen/include/asm-x86/hvm/io.h |  6 +++++-
>  3 files changed, 18 insertions(+), 18 deletions(-)
> 
> diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
> index 0282986..f9d4234 100644
> --- a/xen/arch/x86/hvm/hvm.c
> +++ b/xen/arch/x86/hvm/hvm.c
> @@ -641,7 +641,7 @@ int hvm_domain_initialise(struct domain *d)
>      else
>          d->arch.hvm_domain.io_bitmap = hvm_io_bitmap;
> 
> -    register_dpci_portio_handler(d);
> +    register_hvm_portio_handler(d);
> 
>      hvm_ioreq_init(d);
> 
> diff --git a/xen/arch/x86/hvm/io.c b/xen/arch/x86/hvm/io.c
> index 2770ff4..cb567f1 100644
> --- a/xen/arch/x86/hvm/io.c
> +++ b/xen/arch/x86/hvm/io.c
> @@ -167,8 +167,8 @@ bool handle_pio(uint16_t port, unsigned int size, int
> dir)
>      return true;
>  }
> 
> -static bool_t dpci_portio_accept(const struct hvm_io_handler *handler,
> -                                 const ioreq_t *p)
> +static bool_t hvm_portio_accept(const struct hvm_io_handler *handler,
> +                                const ioreq_t *p)
>  {
>      struct vcpu *curr = current;
>      const struct domain_iommu *dio = dom_iommu(curr->domain);
> @@ -190,10 +190,8 @@ static bool_t dpci_portio_accept(const struct
> hvm_io_handler *handler,
>      return 0;
>  }
> 
> -static int dpci_portio_read(const struct hvm_io_handler *handler,
> -                            uint64_t addr,
> -                            uint32_t size,
> -                            uint64_t *data)
> +static int hvm_portio_read(const struct hvm_io_handler *handler,
> +                           uint64_t addr, uint32_t size, uint64_t *data)
>  {
>      struct hvm_vcpu_io *vio = &current->arch.hvm_vcpu.hvm_io;
>      const struct g2m_ioport *g2m_ioport = vio->g2m_ioport;
> @@ -217,10 +215,8 @@ static int dpci_portio_read(const struct
> hvm_io_handler *handler,
>      return X86EMUL_OKAY;
>  }
> 
> -static int dpci_portio_write(const struct hvm_io_handler *handler,
> -                             uint64_t addr,
> -                             uint32_t size,
> -                             uint64_t data)
> +static int hvm_portio_write(const struct hvm_io_handler *handler,
> +                            uint64_t addr, uint32_t size, uint64_t data)
>  {
>      struct hvm_vcpu_io *vio = &current->arch.hvm_vcpu.hvm_io;
>      const struct g2m_ioport *g2m_ioport = vio->g2m_ioport;
> @@ -244,13 +240,13 @@ static int dpci_portio_write(const struct
> hvm_io_handler *handler,
>      return X86EMUL_OKAY;
>  }
> 
> -static const struct hvm_io_ops dpci_portio_ops = {
> -    .accept = dpci_portio_accept,
> -    .read = dpci_portio_read,
> -    .write = dpci_portio_write
> +static const struct hvm_io_ops hvm_portio_ops = {
> +    .accept = hvm_portio_accept,
> +    .read = hvm_portio_read,
> +    .write = hvm_portio_write
>  };
> 
> -void register_dpci_portio_handler(struct domain *d)
> +void register_hvm_portio_handler(struct domain *d)
>  {
>      struct hvm_io_handler *handler = hvm_next_io_handler(d);
> 
> @@ -258,7 +254,7 @@ void register_dpci_portio_handler(struct domain *d)
>          return;
> 
>      handler->type = IOREQ_TYPE_PIO;
> -    handler->ops = &dpci_portio_ops;
> +    handler->ops = &hvm_portio_ops;
>  }
> 
>  /*
> diff --git a/xen/include/asm-x86/hvm/io.h b/xen/include/asm-x86/hvm/io.h
> index d6801c1..4b0546a 100644
> --- a/xen/include/asm-x86/hvm/io.h
> +++ b/xen/include/asm-x86/hvm/io.h
> @@ -148,7 +148,11 @@ void stdvga_deinit(struct domain *d);
> 
>  extern void hvm_dpci_msi_eoi(struct domain *d, int vector);
> 
> -void register_dpci_portio_handler(struct domain *d);
> +/*
> + * HVM port IO handler that performs forwarding of guest IO ports into
> machine
> + * IO ports.
> + */
> +void register_hvm_portio_handler(struct domain *d);
> 
>  #endif /* __ASM_X86_HVM_IO_H__ */
> 
> --
> 2.10.1 (Apple Git-78)

_______________________________________________
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®.