diff mbox

[v2,1/2] x86/io: rename misleading dpci_ prefixed functions to g2m_

Message ID 20170328131226.13347-2-roger.pau@citrix.com (mailing list archive)
State New, archived
Headers show

Commit Message

Roger Pau Monné March 28, 2017, 1:12 p.m. UTC
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 g2m_ prefix in order to avoid this confusion.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Paul Durrant <paul.durrant@citrix.com>
---
 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(-)

Comments

Paul Durrant March 28, 2017, 3:56 p.m. UTC | #1
> -----Original Message-----

> From: Roger Pau Monne

> Sent: 28 March 2017 14:12

> To: xen-devel@lists.xenproject.org

> Cc: Roger Pau Monne <roger.pau@citrix.com>; Jan Beulich

> <jbeulich@suse.com>; Andrew Cooper <Andrew.Cooper3@citrix.com>; Paul

> Durrant <Paul.Durrant@citrix.com>

> Subject: [PATCH v2 1/2] x86/io: rename misleading dpci_ prefixed functions

> to g2m_

> 

> 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 g2m_ prefix in order to avoid this confusion.

> 

> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>


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


> ---

> Cc: Jan Beulich <jbeulich@suse.com>

> Cc: Andrew Cooper <andrew.cooper3@citrix.com>

> Cc: Paul Durrant <paul.durrant@citrix.com>

> ---

>  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..3a2d001 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_g2m_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..3b3a600 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 g2m_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 g2m_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 g2m_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 g2m_portio_ops = {

> +    .accept = g2m_portio_accept,

> +    .read = g2m_portio_read,

> +    .write = g2m_portio_write

>  };

> 

> -void register_dpci_portio_handler(struct domain *d)

> +void register_g2m_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 = &g2m_portio_ops;

>  }

> 

>  /*

> diff --git a/xen/include/asm-x86/hvm/io.h b/xen/include/asm-x86/hvm/io.h

> index d6801c1..5ae9225 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_g2m_portio_handler(struct domain *d);

> 

>  #endif /* __ASM_X86_HVM_IO_H__ */

> 

> --

> 2.10.1 (Apple Git-78)
diff mbox

Patch

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 0282986..3a2d001 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_g2m_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..3b3a600 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 g2m_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 g2m_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 g2m_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 g2m_portio_ops = {
+    .accept = g2m_portio_accept,
+    .read = g2m_portio_read,
+    .write = g2m_portio_write
 };
 
-void register_dpci_portio_handler(struct domain *d)
+void register_g2m_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 = &g2m_portio_ops;
 }
 
 /*
diff --git a/xen/include/asm-x86/hvm/io.h b/xen/include/asm-x86/hvm/io.h
index d6801c1..5ae9225 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_g2m_portio_handler(struct domain *d);
 
 #endif /* __ASM_X86_HVM_IO_H__ */