ia64/xen-unstable

changeset 7659:781b6dd73e4c

This patch change the vmx mmio handler to static.

Signed-off-by: Yunhong Jiang <yunhong.jiang@intel.com>
Signed-off-by: Xin Li <xin.b.li@intel.com>
author kaf24@firebug.cl.cam.ac.uk
date Mon Nov 07 16:35:46 2005 +0100 (2005-11-07)
parents a05e55c919c1
children 9bb7a75f120f
files xen/arch/x86/vmx_intercept.c xen/arch/x86/vmx_vlapic.c xen/include/asm-x86/vmx_intercept.h xen/include/asm-x86/vmx_vlapic.h
line diff
     1.1 --- a/xen/arch/x86/vmx_intercept.c	Mon Nov 07 15:06:27 2005 +0100
     1.2 +++ b/xen/arch/x86/vmx_intercept.c	Mon Nov 07 16:35:46 2005 +0100
     1.3 @@ -33,13 +33,13 @@
     1.4  
     1.5  #ifdef CONFIG_VMX
     1.6  
     1.7 -struct vmx_mmio_handler vmx_mmio_handers[VMX_MMIO_HANDLER_NR] =
     1.8 +extern struct vmx_mmio_handler vlapic_mmio_handler;
     1.9 +
    1.10 +#define VMX_MMIO_HANDLER_NR 1
    1.11 +
    1.12 +struct vmx_mmio_handler *vmx_mmio_handlers[VMX_MMIO_HANDLER_NR] =
    1.13  {
    1.14 -    {
    1.15 -        .check_handler = vlapic_range,
    1.16 -        .read_handler  = vlapic_read,
    1.17 -        .write_handler = vlapic_write
    1.18 -    }
    1.19 +    &vlapic_mmio_handler
    1.20  };
    1.21  
    1.22  static inline void vmx_mmio_access(struct vcpu *v,
    1.23 @@ -134,16 +134,16 @@ int vmx_mmio_intercept(ioreq_t *p)
    1.24  {
    1.25      struct vcpu *v = current;
    1.26      int i;
    1.27 -    struct vmx_mmio_handler *handler = vmx_mmio_handers;
    1.28  
    1.29      /* XXX currently only APIC use intercept */
    1.30      if ( !vmx_apic_support(v->domain) )
    1.31          return 0;
    1.32  
    1.33      for ( i = 0; i < VMX_MMIO_HANDLER_NR; i++ ) {
    1.34 -        if ( handler[i].check_handler(v, p->addr) ) {
    1.35 +        if ( vmx_mmio_handlers[i]->check_handler(v, p->addr) ) {
    1.36              vmx_mmio_access(v, p,
    1.37 -              handler[i].read_handler, handler[i].write_handler);
    1.38 +                            vmx_mmio_handlers[i]->read_handler,
    1.39 +                            vmx_mmio_handlers[i]->write_handler);
    1.40              return 1;
    1.41          }
    1.42      }
     2.1 --- a/xen/arch/x86/vmx_vlapic.c	Mon Nov 07 15:06:27 2005 +0100
     2.2 +++ b/xen/arch/x86/vmx_vlapic.c	Mon Nov 07 16:35:46 2005 +0100
     2.3 @@ -543,8 +543,8 @@ void vlapic_read_aligned(struct vlapic *
     2.4      }
     2.5  }
     2.6  
     2.7 -unsigned long vlapic_read(struct vcpu *v, unsigned long address,
     2.8 -            unsigned long len)
     2.9 +static unsigned long vlapic_read(struct vcpu *v, unsigned long address,
    2.10 +                                 unsigned long len)
    2.11  {
    2.12      unsigned int alignment;
    2.13      unsigned int tmp;
    2.14 @@ -585,8 +585,8 @@ unsigned long vlapic_read(struct vcpu *v
    2.15      return result;
    2.16  }
    2.17  
    2.18 -unsigned long vlapic_write(struct vcpu *v, unsigned long address,
    2.19 -                  unsigned long len, unsigned long val)
    2.20 +static void vlapic_write(struct vcpu *v, unsigned long address,
    2.21 +                         unsigned long len, unsigned long val)
    2.22  {
    2.23      struct vlapic *vlapic = VLAPIC(v);
    2.24      unsigned int offset = address - vlapic->base_address;
    2.25 @@ -758,10 +758,9 @@ unsigned long vlapic_write(struct vcpu *
    2.26          printk("Local APIC Write to read-only register\n");
    2.27          break;
    2.28      }
    2.29 -    return 1;
    2.30  }
    2.31  
    2.32 -int vlapic_range(struct vcpu *v, unsigned long addr)
    2.33 +static int vlapic_range(struct vcpu *v, unsigned long addr)
    2.34  {
    2.35      struct vlapic *vlapic = VLAPIC(v);
    2.36  
    2.37 @@ -773,6 +772,12 @@ int vlapic_range(struct vcpu *v, unsigne
    2.38      return 0;
    2.39  }
    2.40  
    2.41 +struct vmx_mmio_handler vlapic_mmio_handler = {
    2.42 +    .check_handler = vlapic_range,
    2.43 +    .read_handler = vlapic_read,
    2.44 +    .write_handler = vlapic_write
    2.45 +};
    2.46 +
    2.47  void vlapic_msr_set(struct vlapic *vlapic, uint64_t value)
    2.48  {
    2.49      /* When apic disabled */
     3.1 --- a/xen/include/asm-x86/vmx_intercept.h	Mon Nov 07 15:06:27 2005 +0100
     3.2 +++ b/xen/include/asm-x86/vmx_intercept.h	Mon Nov 07 16:35:46 2005 +0100
     3.3 @@ -18,10 +18,10 @@ typedef unsigned long (*vmx_mmio_read_t)
     3.4                                           unsigned long addr,
     3.5                                           unsigned long length);
     3.6  
     3.7 -typedef unsigned long (*vmx_mmio_write_t)(struct vcpu *v,
     3.8 -                                         unsigned long addr,
     3.9 -                                         unsigned long length,
    3.10 -                                         unsigned long val);
    3.11 +typedef void (*vmx_mmio_write_t)(struct vcpu *v,
    3.12 +                                 unsigned long addr,
    3.13 +                                 unsigned long length,
    3.14 +                                 unsigned long val);
    3.15  
    3.16  typedef int (*vmx_mmio_check_t)(struct vcpu *v, unsigned long addr);
    3.17  
    3.18 @@ -43,10 +43,6 @@ struct vmx_mmio_handler {
    3.19      vmx_mmio_write_t write_handler;
    3.20  };
    3.21  
    3.22 -#define VMX_MMIO_HANDLER_NR 1
    3.23 -
    3.24 -extern struct vmx_mmio_handler vmx_mmio_handers[VMX_MMIO_HANDLER_NR];
    3.25 -
    3.26  /* global io interception point in HV */
    3.27  extern int vmx_io_intercept(ioreq_t *p, int type);
    3.28  extern int register_io_handler(unsigned long addr, unsigned long size,
     4.1 --- a/xen/include/asm-x86/vmx_vlapic.h	Mon Nov 07 15:06:27 2005 +0100
     4.2 +++ b/xen/include/asm-x86/vmx_vlapic.h	Mon Nov 07 16:35:46 2005 +0100
     4.3 @@ -225,14 +225,6 @@ extern int vlapic_init(struct vcpu *vc);
     4.4  
     4.5  extern void vlapic_msr_set(struct vlapic *vlapic, uint64_t value);
     4.6  
     4.7 -int vlapic_range(struct vcpu *v, unsigned long addr);
     4.8 -
     4.9 -unsigned long vlapic_write(struct vcpu *v, unsigned long address,
    4.10 -                           unsigned long len, unsigned long val);
    4.11 -
    4.12 -unsigned long vlapic_read(struct vcpu *v, unsigned long address,
    4.13 -                          unsigned long len);
    4.14 -
    4.15  int vlapic_accept_pic_intr(struct vcpu *v);
    4.16  
    4.17  struct vlapic* apic_round_robin(struct domain *d,