direct-io.hg

changeset 7445:1e7bbbdff402

Merged.
author emellor@leeni.uk.xensource.com
date Thu Oct 20 12:35:57 2005 +0100 (2005-10-20)
parents 6a7253b1ce8a 4ac2051ec21e
children 6f5b94da963a 840a66f08e3d
files
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/xen/i386/mm/ioremap.c	Thu Oct 20 12:34:50 2005 +0100
     1.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/mm/ioremap.c	Thu Oct 20 12:35:57 2005 +0100
     1.3 @@ -123,9 +123,18 @@ int direct_remap_pfn_range(struct vm_are
     1.4  	return __direct_remap_pfn_range(
     1.5  		vma->vm_mm, address, mfn, size, prot, domid);
     1.6  }
     1.7 -
     1.8  EXPORT_SYMBOL(direct_remap_pfn_range);
     1.9  
    1.10 +int direct_kernel_remap_pfn_range(unsigned long address, 
    1.11 +				  unsigned long mfn,
    1.12 +				  unsigned long size, 
    1.13 +				  pgprot_t prot,
    1.14 +				  domid_t  domid)
    1.15 +{
    1.16 +	return __direct_remap_pfn_range(
    1.17 +		&init_mm, address, mfn, size, prot, domid);
    1.18 +}
    1.19 +EXPORT_SYMBOL(direct_kernel_remap_pfn_range);
    1.20  
    1.21  /* FIXME: This is horribly broken on PAE */ 
    1.22  static int lookup_pte_fn(
     2.1 --- a/linux-2.6-xen-sparse/include/asm-xen/asm-i386/pgtable.h	Thu Oct 20 12:34:50 2005 +0100
     2.2 +++ b/linux-2.6-xen-sparse/include/asm-xen/asm-i386/pgtable.h	Thu Oct 20 12:35:57 2005 +0100
     2.3 @@ -455,6 +455,11 @@ int direct_remap_pfn_range(struct vm_are
     2.4                              unsigned long size, 
     2.5                              pgprot_t prot,
     2.6                              domid_t  domid);
     2.7 +int direct_kernel_remap_pfn_range(unsigned long address, 
     2.8 +				  unsigned long mfn,
     2.9 +				  unsigned long size, 
    2.10 +				  pgprot_t prot,
    2.11 +				  domid_t  domid);
    2.12  int create_lookup_pte_addr(struct mm_struct *mm,
    2.13                             unsigned long address,
    2.14                             unsigned long *ptep);
     3.1 --- a/linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/pgtable.h	Thu Oct 20 12:34:50 2005 +0100
     3.2 +++ b/linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/pgtable.h	Thu Oct 20 12:35:57 2005 +0100
     3.3 @@ -533,6 +533,12 @@ int direct_remap_pfn_range(struct vm_are
     3.4                              pgprot_t prot,
     3.5                              domid_t  domid);
     3.6  
     3.7 +int direct_kernel_remap_pfn_range(unsigned long address, 
     3.8 +				  unsigned long mfn,
     3.9 +				  unsigned long size, 
    3.10 +				  pgprot_t prot,
    3.11 +				  domid_t  domid);
    3.12 +
    3.13  int create_lookup_pte_addr(struct mm_struct *mm,
    3.14                             unsigned long address,
    3.15                             unsigned long *ptep);
     4.1 --- a/tools/ioemu/hw/pckbd.c	Thu Oct 20 12:34:50 2005 +0100
     4.2 +++ b/tools/ioemu/hw/pckbd.c	Thu Oct 20 12:35:57 2005 +0100
     4.3 @@ -29,6 +29,9 @@
     4.4  /* debug PC keyboard : only mouse */
     4.5  //#define DEBUG_MOUSE
     4.6  
     4.7 +/* enable synapatic touchpad device model */
     4.8 +//#define SYNAPTIC
     4.9 +
    4.10  /*	Keyboard Controller Commands */
    4.11  #define KBD_CCMD_READ_MODE	0x20	/* Read mode bits */
    4.12  #define KBD_CCMD_WRITE_MODE	0x60	/* Write mode bits */
    4.13 @@ -117,10 +120,12 @@ typedef struct {
    4.14      int rptr, wptr, count;
    4.15  } KBDQueue;
    4.16  
    4.17 +#ifdef SYNAPTIC
    4.18  typedef struct {
    4.19      int absolute;
    4.20      int high;
    4.21  } TouchPad;
    4.22 +#endif
    4.23  
    4.24  typedef struct KBDState {
    4.25      KBDQueue queue;
    4.26 @@ -142,7 +147,9 @@ typedef struct KBDState {
    4.27      int mouse_dy;
    4.28      int mouse_dz;
    4.29      uint8_t mouse_buttons;
    4.30 +#ifdef SYNAPTIC
    4.31      TouchPad touchpad;
    4.32 +#endif
    4.33  } KBDState;
    4.34  
    4.35  KBDState kbd_state;
    4.36 @@ -399,6 +406,7 @@ static void kbd_mouse_send_packet(KBDSta
    4.37      dx1 = s->mouse_dx;
    4.38      dy1 = s->mouse_dy;
    4.39      dz1 = s->mouse_dz;
    4.40 +#ifdef SYNAPTIC
    4.41      if (s->touchpad.absolute)
    4.42      {
    4.43  	int dz2, dleftnright, dg, df;
    4.44 @@ -444,6 +452,7 @@ static void kbd_mouse_send_packet(KBDSta
    4.45  	kbd_queue(s, dy1 & 0xFF, 1);
    4.46  	return;
    4.47      }
    4.48 +#endif
    4.49      /* XXX: increase range to 8 bits ? */
    4.50      if (dx1 > 127)
    4.51          dx1 = 127;
    4.52 @@ -516,9 +525,11 @@ static void pc_kbd_mouse_event(void *opa
    4.53  
    4.54  static void kbd_write_mouse(KBDState *s, int val)
    4.55  {
    4.56 +#ifdef SYNAPTIC
    4.57  /* variables needed to store synaptics command info */
    4.58  static int rr = 0, ss = 0, tt = 0, uu = 0, res_count = 0, last_com = 0;
    4.59  int spare;
    4.60 +#endif
    4.61  #ifdef DEBUG_MOUSE
    4.62      printf("kbd: write mouse 0x%02x\n", val);
    4.63  #endif
    4.64 @@ -536,7 +547,9 @@ int spare;
    4.65                  return;
    4.66              }
    4.67          }
    4.68 +#ifdef SYNAPTIC
    4.69  	last_com = val;
    4.70 +#endif
    4.71          switch(val) {
    4.72          case AUX_SET_SCALE11:
    4.73              s->mouse_status &= ~MOUSE_STATUS_SCALE21;
    4.74 @@ -568,6 +581,7 @@ int spare;
    4.75              kbd_queue(s, AUX_ACK, 1);
    4.76              break;
    4.77          case AUX_GET_SCALE:
    4.78 +#ifdef SYNAPTIC
    4.79  	    if (res_count == 4)
    4.80  	    {
    4.81  		    /* time for the special stuff */
    4.82 @@ -681,6 +695,7 @@ int spare;
    4.83  		    }
    4.84  	    }
    4.85  	    else
    4.86 +#endif
    4.87  	    {
    4.88  		    /* not a special command, just do the regular stuff */
    4.89              kbd_queue(s, AUX_ACK, 1);
    4.90 @@ -705,14 +720,18 @@ int spare;
    4.91              s->mouse_sample_rate = 100;
    4.92              s->mouse_resolution = 2;
    4.93              s->mouse_status = 0;
    4.94 +#ifdef SYNAPTIC
    4.95         	    s->touchpad.absolute = 0;
    4.96 +#endif
    4.97              kbd_queue(s, AUX_ACK, 1);
    4.98              break;
    4.99          case AUX_RESET:
   4.100              s->mouse_sample_rate = 100;
   4.101              s->mouse_resolution = 2;
   4.102              s->mouse_status = 0;
   4.103 +#ifdef SYNAPTIC
   4.104  	    s->touchpad.absolute = 0;
   4.105 +#endif
   4.106              kbd_queue(s, AUX_ACK, 1);
   4.107              kbd_queue(s, 0xaa, 1);
   4.108              kbd_queue(s, s->mouse_type, 1);
   4.109 @@ -722,6 +741,7 @@ int spare;
   4.110          }
   4.111          break;
   4.112      case AUX_SET_SAMPLE:
   4.113 +#ifdef SYNAPTIC
   4.114  	if (res_count == 4 && val == 0x14)
   4.115  	{
   4.116  		/* time for the special stuff */
   4.117 @@ -729,6 +749,7 @@ int spare;
   4.118  		val = (rr*64) + (ss*16) + (tt*4) + uu;
   4.119  		/* TODO: set the mode byte */
   4.120  	} else
   4.121 +#endif
   4.122          s->mouse_sample_rate = val;
   4.123  #if 0
   4.124          /* detect IMPS/2 or IMEX */
   4.125 @@ -762,6 +783,7 @@ int spare;
   4.126          s->mouse_write_cmd = -1;
   4.127          break;
   4.128      case AUX_SET_RES:
   4.129 +#ifdef SYNAPTIC
   4.130  	if (last_com != AUX_SET_RES)
   4.131  	{
   4.132  		/* if its not 4 in a row, its not a command */
   4.133 @@ -790,6 +812,7 @@ int spare;
   4.134  			uu = val;
   4.135  			break;
   4.136  	}
   4.137 +#endif
   4.138          s->mouse_resolution = val;
   4.139          kbd_queue(s, AUX_ACK, 1);
   4.140          s->mouse_write_cmd = -1;
   4.141 @@ -871,8 +894,10 @@ static void kbd_save(QEMUFile* f, void* 
   4.142      qemu_put_be32s(f, &s->mouse_dy);
   4.143      qemu_put_be32s(f, &s->mouse_dz);
   4.144      qemu_put_8s(f, &s->mouse_buttons);
   4.145 +#ifdef SYNAPTIC
   4.146      qemu_put_be32s(f, &s->touchpad.absolute);
   4.147      qemu_put_be32s(f, &s->touchpad.high);
   4.148 +#endif
   4.149  }
   4.150  
   4.151  static int kbd_load(QEMUFile* f, void* opaque, int version_id)
   4.152 @@ -897,8 +922,10 @@ static int kbd_load(QEMUFile* f, void* o
   4.153      qemu_get_be32s(f, &s->mouse_dy);
   4.154      qemu_get_be32s(f, &s->mouse_dz);
   4.155      qemu_get_8s(f, &s->mouse_buttons);
   4.156 +#ifdef SYNAPTIC
   4.157      qemu_get_be32s(f, &s->touchpad.absolute);
   4.158      qemu_get_be32s(f, &s->touchpad.high);
   4.159 +#endif
   4.160      return 0;
   4.161  }
   4.162  
     5.1 --- a/xen/arch/x86/domain.c	Thu Oct 20 12:34:50 2005 +0100
     5.2 +++ b/xen/arch/x86/domain.c	Thu Oct 20 12:35:57 2005 +0100
     5.3 @@ -226,11 +226,9 @@ struct vcpu *alloc_vcpu_struct(struct do
     5.4  
     5.5      if ( (v->vcpu_id = vcpu_id) != 0 )
     5.6      {
     5.7 -        v->arch.schedule_tail = d->vcpu[0]->arch.schedule_tail;
     5.8 +        v->arch.schedule_tail  = d->vcpu[0]->arch.schedule_tail;
     5.9          v->arch.perdomain_ptes =
    5.10              d->arch.mm_perdomain_pt + (vcpu_id << PDPT_VCPU_SHIFT);
    5.11 -        v->arch.perdomain_ptes[FIRST_RESERVED_GDT_PAGE] =
    5.12 -            l1e_from_page(virt_to_page(gdt_table), PAGE_HYPERVISOR);
    5.13      }
    5.14  
    5.15      return v;
    5.16 @@ -256,6 +254,7 @@ void free_perdomain_pt(struct domain *d)
    5.17  void arch_do_createdomain(struct vcpu *v)
    5.18  {
    5.19      struct domain *d = v->domain;
    5.20 +    int vcpuid;
    5.21  
    5.22      if ( is_idle_task(d) )
    5.23          return;
    5.24 @@ -275,8 +274,20 @@ void arch_do_createdomain(struct vcpu *v
    5.25      set_pfn_from_mfn(virt_to_phys(d->arch.mm_perdomain_pt) >> PAGE_SHIFT,
    5.26              INVALID_M2P_ENTRY);
    5.27      v->arch.perdomain_ptes = d->arch.mm_perdomain_pt;
    5.28 -    v->arch.perdomain_ptes[FIRST_RESERVED_GDT_PAGE] =
    5.29 -        l1e_from_page(virt_to_page(gdt_table), PAGE_HYPERVISOR);
    5.30 +
    5.31 +    /*
    5.32 +     * Map Xen segments into every VCPU's GDT, irrespective of whether every
    5.33 +     * VCPU will actually be used. This avoids an NMI race during context
    5.34 +     * switch: if we take an interrupt after switching CR3 but before switching
    5.35 +     * GDT, and the old VCPU# is invalid in the new domain, we would otherwise
    5.36 +     * try to load CS from an invalid table.
    5.37 +     */
    5.38 +    for ( vcpuid = 0; vcpuid < MAX_VIRT_CPUS; vcpuid++ )
    5.39 +    {
    5.40 +        d->arch.mm_perdomain_pt[
    5.41 +            (vcpuid << PDPT_VCPU_SHIFT) + FIRST_RESERVED_GDT_PAGE] =
    5.42 +            l1e_from_page(virt_to_page(gdt_table), PAGE_HYPERVISOR);
    5.43 +    }
    5.44  
    5.45      v->arch.guest_vtable  = __linear_l2_table;
    5.46      v->arch.shadow_vtable = __shadow_linear_l2_table;
     6.1 --- a/xen/arch/x86/setup.c	Thu Oct 20 12:34:50 2005 +0100
     6.2 +++ b/xen/arch/x86/setup.c	Thu Oct 20 12:35:57 2005 +0100
     6.3 @@ -141,6 +141,7 @@ static void __init do_initcalls(void)
     6.4  static void __init start_of_day(void)
     6.5  {
     6.6      int i;
     6.7 +    unsigned long vgdt;
     6.8  
     6.9      early_cpu_init();
    6.10  
    6.11 @@ -158,10 +159,17 @@ static void __init start_of_day(void)
    6.12  
    6.13      arch_do_createdomain(current);
    6.14      
    6.15 -    /* Map default GDT into their final position in the idle page table. */
    6.16 -    map_pages_to_xen(
    6.17 -        GDT_VIRT_START(current) + FIRST_RESERVED_GDT_BYTE,
    6.18 -        virt_to_phys(gdt_table) >> PAGE_SHIFT, 1, PAGE_HYPERVISOR);
    6.19 +    /*
    6.20 +     * Map default GDT into its final positions in the idle page table. As
    6.21 +     * noted in arch_do_createdomain(), we must map for every possible VCPU#.
    6.22 +     */
    6.23 +    vgdt = GDT_VIRT_START(current) + FIRST_RESERVED_GDT_BYTE;
    6.24 +    for ( i = 0; i < MAX_VIRT_CPUS; i++ )
    6.25 +    {
    6.26 +        map_pages_to_xen(
    6.27 +            vgdt, virt_to_phys(gdt_table) >> PAGE_SHIFT, 1, PAGE_HYPERVISOR);
    6.28 +        vgdt += 1 << PDPT_VCPU_VA_SHIFT;
    6.29 +    }
    6.30  
    6.31      find_smp_config();
    6.32  
     7.1 --- a/xen/include/xen/smp.h	Thu Oct 20 12:34:50 2005 +0100
     7.2 +++ b/xen/include/xen/smp.h	Thu Oct 20 12:35:57 2005 +0100
     7.3 @@ -90,7 +90,7 @@ void smp_prepare_boot_cpu(void);
     7.4  #define smp_processor_id()			0
     7.5  #endif
     7.6  #define hard_smp_processor_id()			0
     7.7 -#define smp_call_function(func,info,retry,wait)	0
     7.8 +#define smp_call_function(func,info,retry,wait)	({ do {} while (0); 0; })
     7.9  #define on_each_cpu(func,info,retry,wait)	({ func(info); 0; })
    7.10  #define num_booting_cpus()			1
    7.11  #define smp_prepare_boot_cpu()			do {} while (0)