win-pvdrivers

changeset 835:e5651aba4e03

Multiple fixups.
Rename gnttab to gnttbl
Restore syscall msr's after suspend (workaround bug in xen)
Allocate gnttab from main memory instead of mmio to avoid leaving holes that crash hibernate
author James Harper <james.harper@bendigoit.com.au>
date Thu Jan 27 18:20:13 2011 +1100 (2011-01-27)
parents 985d93aa2d46
children 260fec91f553
files xenpci/gnttbl.c xenpci/hypercall.h xenpci/xenbus.c xenpci/xenpci.h xenpci/xenpci_fdo.c xenpci/xenpci_pdo.c
line diff
     1.1 --- a/xenpci/gnttbl.c	Wed Jan 26 12:13:47 2011 +1100
     1.2 +++ b/xenpci/gnttbl.c	Thu Jan 27 18:20:13 2011 +1100
     1.3 @@ -27,12 +27,12 @@ GntTbl_PutRef(PVOID Context, grant_ref_t
     1.4    UNREFERENCED_PARAMETER(tag);
     1.5    
     1.6  #if DBG
     1.7 -  if (xpdd->gnttab_tag[ref] != tag)
     1.8 -    KdPrint((__DRIVER_NAME "     Grant Entry %d for %.4s doesn't match %.4s\n", ref, (PUCHAR)&tag, (PUCHAR)&xpdd->gnttab_tag[ref]));
     1.9 -  ASSERT(xpdd->gnttab_tag[ref] == tag);
    1.10 -  xpdd->gnttab_tag[ref] = 0;
    1.11 +  if (xpdd->gnttbl_tag[ref] != tag)
    1.12 +    KdPrint((__DRIVER_NAME "     Grant Entry %d for %.4s doesn't match %.4s\n", ref, (PUCHAR)&tag, (PUCHAR)&xpdd->gnttbl_tag[ref]));
    1.13 +  ASSERT(xpdd->gnttbl_tag[ref] == tag);
    1.14 +  xpdd->gnttbl_tag[ref] = 0;
    1.15  #endif
    1.16 -  stack_push(xpdd->gnttab_ss, (PVOID)ref);
    1.17 +  stack_push(xpdd->gnttbl_ss, (PVOID)ref);
    1.18  }
    1.19  
    1.20  grant_ref_t
    1.21 @@ -44,17 +44,17 @@ GntTbl_GetRef(PVOID Context, ULONG tag)
    1.22  
    1.23    UNREFERENCED_PARAMETER(tag);
    1.24  
    1.25 -  if (!stack_pop(xpdd->gnttab_ss, &ptr_ref))
    1.26 +  if (!stack_pop(xpdd->gnttbl_ss, &ptr_ref))
    1.27    {
    1.28      KdPrint((__DRIVER_NAME "     No free grant refs\n"));
    1.29      return INVALID_GRANT_REF;
    1.30    }
    1.31    ref = (grant_ref_t)(ULONG_PTR)ptr_ref;
    1.32  #if DBG
    1.33 -  if (xpdd->gnttab_tag[ref])
    1.34 -    KdPrint((__DRIVER_NAME "     Grant Entry %d for %.4s in use by %.4s\n", ref, (PUCHAR)&tag, (PUCHAR)&xpdd->gnttab_tag[ref]));
    1.35 -  ASSERT(!xpdd->gnttab_tag[ref]);
    1.36 -  xpdd->gnttab_tag[ref] = tag;
    1.37 +  if (xpdd->gnttbl_tag[ref])
    1.38 +    KdPrint((__DRIVER_NAME "     Grant Entry %d for %.4s in use by %.4s\n", ref, (PUCHAR)&tag, (PUCHAR)&xpdd->gnttbl_tag[ref]));
    1.39 +  ASSERT(!xpdd->gnttbl_tag[ref]);
    1.40 +  xpdd->gnttbl_tag[ref] = tag;
    1.41  #endif
    1.42  
    1.43    return ref;
    1.44 @@ -73,8 +73,7 @@ GntTbl_Map(PVOID Context, unsigned int s
    1.45      xatp.domid = DOMID_SELF;
    1.46      xatp.idx = i;
    1.47      xatp.space = XENMAPSPACE_grant_table;
    1.48 -    //xatp.gpfn = (xen_pfn_t)(xpdd->gnttab_table_physical.QuadPart >> PAGE_SHIFT) + i;
    1.49 -    xatp.gpfn = (xen_pfn_t)MmGetMdlPfnArray(xpdd->gnttab_mdl)[i];
    1.50 +    xatp.gpfn = (xen_pfn_t)MmGetMdlPfnArray(xpdd->gnttbl_mdl)[i];
    1.51      if (HYPERVISOR_memory_op(xpdd, XENMEM_add_to_physmap, &xatp))
    1.52      {
    1.53        KdPrint((__DRIVER_NAME "     *** ERROR MAPPING FRAME %d ***\n", i));
    1.54 @@ -103,24 +102,24 @@ GntTbl_GrantAccess(
    1.55    if (ref == INVALID_GRANT_REF)
    1.56      return ref;
    1.57  
    1.58 -  ASSERT(xpdd->gnttab_tag[ref] == tag);
    1.59 +  ASSERT(xpdd->gnttbl_tag[ref] == tag);
    1.60    
    1.61 -  xpdd->gnttab_table[ref].frame = frame;
    1.62 -  xpdd->gnttab_table[ref].domid = domid;
    1.63 +  xpdd->gnttbl_table[ref].frame = frame;
    1.64 +  xpdd->gnttbl_table[ref].domid = domid;
    1.65  
    1.66 -  if (xpdd->gnttab_table[ref].flags)
    1.67 +  if (xpdd->gnttbl_table[ref].flags)
    1.68    {
    1.69  #if DBG
    1.70 -    KdPrint((__DRIVER_NAME "     Grant Entry %d for %.4s still in use by %.4s\n", ref, (PUCHAR)&tag, (PUCHAR)&xpdd->gnttab_tag[ref]));
    1.71 +    KdPrint((__DRIVER_NAME "     Grant Entry %d for %.4s still in use by %.4s\n", ref, (PUCHAR)&tag, (PUCHAR)&xpdd->gnttbl_tag[ref]));
    1.72  #else
    1.73      KdPrint((__DRIVER_NAME "     Grant Entry %d for %.4s still in use\n", ref, (PUCHAR)&tag));
    1.74  #endif
    1.75    }
    1.76 -  ASSERT(!xpdd->gnttab_table[ref].flags);
    1.77 +  ASSERT(!xpdd->gnttbl_table[ref].flags);
    1.78  
    1.79    KeMemoryBarrier();
    1.80    readonly *= GTF_readonly;
    1.81 -  xpdd->gnttab_table[ref].flags = GTF_permit_access | (uint16_t)readonly;
    1.82 +  xpdd->gnttbl_table[ref].flags = GTF_permit_access | (uint16_t)readonly;
    1.83  
    1.84    return ref;
    1.85  }
    1.86 @@ -136,9 +135,9 @@ GntTbl_EndAccess(
    1.87    unsigned short flags, nflags;
    1.88  
    1.89    ASSERT(ref != INVALID_GRANT_REF);
    1.90 -  ASSERT(xpdd->gnttab_tag[ref] == tag);
    1.91 +  ASSERT(xpdd->gnttbl_tag[ref] == tag);
    1.92    
    1.93 -  nflags = xpdd->gnttab_table[ref].flags;
    1.94 +  nflags = xpdd->gnttbl_table[ref].flags;
    1.95    do {
    1.96      if ((flags = nflags) & (GTF_reading|GTF_writing))
    1.97      {
    1.98 @@ -146,7 +145,7 @@ GntTbl_EndAccess(
    1.99        return FALSE;
   1.100      }
   1.101    } while ((nflags = InterlockedCompareExchange16(
   1.102 -    (volatile SHORT *)&xpdd->gnttab_table[ref].flags, 0, flags)) != flags);
   1.103 +    (volatile SHORT *)&xpdd->gnttbl_table[ref].flags, 0, flags)) != flags);
   1.104  
   1.105    if (!keepref)
   1.106      GntTbl_PutRef(Context, ref, tag);
   1.107 @@ -186,18 +185,19 @@ GntTbl_Init(PXENPCI_DEVICE_DATA xpdd)
   1.108    grant_entries = min(NR_GRANT_ENTRIES, (xpdd->grant_frames * PAGE_SIZE / sizeof(grant_entry_t)));
   1.109    KdPrint((__DRIVER_NAME "     grant_entries = %d\n", grant_entries));
   1.110    #if DBG
   1.111 -  xpdd->gnttab_tag = ExAllocatePoolWithTag(NonPagedPool, grant_entries * sizeof(ULONG), XENPCI_POOL_TAG);
   1.112 -  RtlZeroMemory(xpdd->gnttab_tag, grant_entries * sizeof(ULONG));
   1.113 +  xpdd->gnttbl_tag = ExAllocatePoolWithTag(NonPagedPool, grant_entries * sizeof(ULONG), XENPCI_POOL_TAG);
   1.114 +  RtlZeroMemory(xpdd->gnttbl_tag, grant_entries * sizeof(ULONG));
   1.115    #endif
   1.116 -  xpdd->gnttab_table_copy = ExAllocatePoolWithTag(NonPagedPool, xpdd->grant_frames * PAGE_SIZE, XENPCI_POOL_TAG);
   1.117 -  ASSERT(xpdd->gnttab_table_copy); // lazy
   1.118 -  xpdd->gnttab_table = ExAllocatePoolWithTag(NonPagedPool, xpdd->grant_frames * PAGE_SIZE, XENPCI_POOL_TAG);
   1.119 -  ASSERT(xpdd->gnttab_table); // lazy
   1.120 +  xpdd->gnttbl_table_copy = ExAllocatePoolWithTag(NonPagedPool, xpdd->grant_frames * PAGE_SIZE, XENPCI_POOL_TAG);
   1.121 +  ASSERT(xpdd->gnttbl_table_copy); // lazy
   1.122 +  xpdd->gnttbl_table = ExAllocatePoolWithTag(NonPagedPool, xpdd->grant_frames * PAGE_SIZE, XENPCI_POOL_TAG);
   1.123 +  ASSERT(xpdd->gnttbl_table); // lazy
   1.124    /* dom0 crashes if we allocate the wrong amount of memory here! */
   1.125 -  xpdd->gnttab_mdl = IoAllocateMdl(xpdd->gnttab_table, xpdd->grant_frames * PAGE_SIZE, FALSE, FALSE, NULL);
   1.126 -  ASSERT(xpdd->gnttab_mdl); // lazy
   1.127 -  MmBuildMdlForNonPagedPool(xpdd->gnttab_mdl);
   1.128 +  xpdd->gnttbl_mdl = IoAllocateMdl(xpdd->gnttbl_table, xpdd->grant_frames * PAGE_SIZE, FALSE, FALSE, NULL);
   1.129 +  ASSERT(xpdd->gnttbl_mdl); // lazy
   1.130 +  MmBuildMdlForNonPagedPool(xpdd->gnttbl_mdl);
   1.131  
   1.132 +  /* make some holes for the grant pages to fill in */
   1.133    for (i = 0; i < (int)xpdd->grant_frames; i++)
   1.134    {
   1.135      struct xen_memory_reservation reservation;
   1.136 @@ -209,7 +209,7 @@ GntTbl_Init(PXENPCI_DEVICE_DATA xpdd)
   1.137      reservation.domid = DOMID_SELF;
   1.138      reservation.nr_extents = 1;
   1.139      #pragma warning(disable: 4127) /* conditional expression is constant */
   1.140 -    pfn = (xen_pfn_t)MmGetMdlPfnArray(xpdd->gnttab_mdl)[i];
   1.141 +    pfn = (xen_pfn_t)MmGetMdlPfnArray(xpdd->gnttbl_mdl)[i];
   1.142      KdPrint((__DRIVER_NAME "     pfn = %x\n", (ULONG)pfn));
   1.143      set_xen_guest_handle(reservation.extent_start, &pfn);
   1.144      
   1.145 @@ -218,25 +218,14 @@ GntTbl_Init(PXENPCI_DEVICE_DATA xpdd)
   1.146      KdPrint((__DRIVER_NAME "     decreased %d pages for grant table frame %d\n", ret, i));
   1.147    }
   1.148  
   1.149 -#if 0
   1.150 -  xpdd->gnttab_table_physical = XenPci_AllocMMIO(xpdd, PAGE_SIZE * xpdd->grant_frames);
   1.151 -  xpdd->gnttab_table = MmMapIoSpace(xpdd->gnttab_table_physical, PAGE_SIZE * xpdd->grant_frames, MmNonCached);
   1.152 -  if (!xpdd->gnttab_table)
   1.153 -  {
   1.154 -    KdPrint((__DRIVER_NAME "     Error Mapping Grant Table Shared Memory\n"));
   1.155 -    // this should be a show stopper...
   1.156 -    return;
   1.157 -  }
   1.158 -#endif
   1.159 -
   1.160 -  stack_new(&xpdd->gnttab_ss, grant_entries);
   1.161 +  stack_new(&xpdd->gnttbl_ss, grant_entries);
   1.162    
   1.163    for (i = NR_RESERVED_ENTRIES; i < grant_entries; i++)
   1.164 -    stack_push(xpdd->gnttab_ss, (PVOID)i);
   1.165 +    stack_push(xpdd->gnttbl_ss, (PVOID)i);
   1.166    
   1.167    GntTbl_Map(xpdd, 0, xpdd->grant_frames - 1);
   1.168  
   1.169 -  RtlZeroMemory(xpdd->gnttab_table, PAGE_SIZE * xpdd->grant_frames);
   1.170 +  RtlZeroMemory(xpdd->gnttbl_table, PAGE_SIZE * xpdd->grant_frames);
   1.171    
   1.172    FUNCTION_EXIT();
   1.173  }
   1.174 @@ -244,7 +233,7 @@ GntTbl_Init(PXENPCI_DEVICE_DATA xpdd)
   1.175  VOID
   1.176  GntTbl_Suspend(PXENPCI_DEVICE_DATA xpdd)
   1.177  {
   1.178 -  memcpy(xpdd->gnttab_table_copy, xpdd->gnttab_table, xpdd->grant_frames * PAGE_SIZE);
   1.179 +  memcpy(xpdd->gnttbl_table_copy, xpdd->gnttbl_table, xpdd->grant_frames * PAGE_SIZE);
   1.180  }
   1.181  
   1.182  VOID
   1.183 @@ -252,15 +241,35 @@ GntTbl_Resume(PXENPCI_DEVICE_DATA xpdd)
   1.184  {
   1.185    ULONG new_grant_frames;
   1.186    ULONG result;
   1.187 -  
   1.188 +  int i;  
   1.189    FUNCTION_ENTER();
   1.190    
   1.191 +  for (i = 0; i < (int)xpdd->grant_frames; i++)
   1.192 +  {
   1.193 +    struct xen_memory_reservation reservation;
   1.194 +    xen_pfn_t pfn;
   1.195 +    ULONG ret;
   1.196 +    
   1.197 +    reservation.address_bits = 0;
   1.198 +    reservation.extent_order = 0;
   1.199 +    reservation.domid = DOMID_SELF;
   1.200 +    reservation.nr_extents = 1;
   1.201 +    #pragma warning(disable: 4127) /* conditional expression is constant */
   1.202 +    pfn = (xen_pfn_t)MmGetMdlPfnArray(xpdd->gnttbl_mdl)[i];
   1.203 +    KdPrint((__DRIVER_NAME "     pfn = %x\n", (ULONG)pfn));
   1.204 +    set_xen_guest_handle(reservation.extent_start, &pfn);
   1.205 +    
   1.206 +    KdPrint((__DRIVER_NAME "     Calling HYPERVISOR_memory_op - pfn = %x\n", (ULONG)pfn));
   1.207 +    ret = HYPERVISOR_memory_op(xpdd, XENMEM_decrease_reservation, &reservation);
   1.208 +    KdPrint((__DRIVER_NAME "     decreased %d pages for grant table frame %d\n", ret, i));
   1.209 +  }
   1.210 +
   1.211    new_grant_frames = GntTbl_QueryMaxFrames(xpdd);
   1.212    KdPrint((__DRIVER_NAME "     new_grant_frames = %d\n", new_grant_frames));
   1.213    ASSERT(new_grant_frames >= xpdd->grant_frames); // lazy
   1.214    result = GntTbl_Map(xpdd, 0, xpdd->grant_frames - 1);
   1.215    KdPrint((__DRIVER_NAME "     GntTbl_Map result = %d\n", result));
   1.216 -  memcpy(xpdd->gnttab_table, xpdd->gnttab_table_copy, xpdd->grant_frames * PAGE_SIZE);
   1.217 +  memcpy(xpdd->gnttbl_table, xpdd->gnttbl_table_copy, xpdd->grant_frames * PAGE_SIZE);
   1.218    
   1.219    FUNCTION_EXIT();
   1.220  }
     2.1 --- a/xenpci/hypercall.h	Wed Jan 26 12:13:47 2011 +1100
     2.2 +++ b/xenpci/hypercall.h	Thu Jan 27 18:20:13 2011 +1100
     2.3 @@ -55,7 +55,6 @@ hvm_set_parameter(PXENPCI_DEVICE_DATA xp
     2.4    a.domid = DOMID_SELF;
     2.5    a.index = hvm_param;
     2.6    a.value = value;
     2.7 -  //a.value = via;
     2.8    retval = HYPERVISOR_hvm_op(xpdd, HVMOP_set_param, &a);
     2.9    KdPrint((__DRIVER_NAME " HYPERVISOR_hvm_op retval = %d\n", retval));
    2.10    FUNCTION_EXIT();
     3.1 --- a/xenpci/xenbus.c	Wed Jan 26 12:13:47 2011 +1100
     3.2 +++ b/xenpci/xenbus.c	Thu Jan 27 18:20:13 2011 +1100
     3.3 @@ -571,10 +571,11 @@ XenBus_Resume(PXENPCI_DEVICE_DATA xpdd)
     3.4    {
     3.5      if (xpdd->XenBus_WatchEntries[i].Active)
     3.6      {
     3.7 -      //KdPrint((__DRIVER_NAME "     Adding watch for path = %s\n", xpdd->XenBus_WatchEntries[i].Path));
     3.8 +      KdPrint((__DRIVER_NAME "     Adding watch for path = %s\n", xpdd->XenBus_WatchEntries[i].Path));
     3.9        XenBus_SendAddWatch(xpdd, XBT_NIL, xpdd->XenBus_WatchEntries[i].Path, i);
    3.10      }
    3.11    }
    3.12 +
    3.13    FUNCTION_EXIT();
    3.14    
    3.15    return STATUS_SUCCESS;
    3.16 @@ -665,7 +666,7 @@ XenBus_RemWatch(
    3.17    if (i == MAX_WATCH_ENTRIES)
    3.18    {
    3.19      ExReleaseFastMutex(&xpdd->xb_watch_mutex);
    3.20 -    KdPrint((__DRIVER_NAME "     Watch not set - can't remove\n"));
    3.21 +    KdPrint((__DRIVER_NAME "     Watch not set for %s - can't remove\n", Path));
    3.22      return NULL;
    3.23    }
    3.24  
     4.1 --- a/xenpci/xenpci.h	Wed Jan 26 12:13:47 2011 +1100
     4.2 +++ b/xenpci/xenpci.h	Thu Jan 27 18:20:13 2011 +1100
     4.3 @@ -151,17 +151,13 @@ typedef struct {
     4.4    evtchn_port_t xen_store_evtchn;
     4.5  
     4.6    /* grant related */
     4.7 -  struct stack_state *gnttab_ss;
     4.8 -  grant_entry_t *gnttab_table;
     4.9 -  PMDL gnttab_mdl;
    4.10 -  grant_entry_t *gnttab_table_copy;
    4.11 +  struct stack_state *gnttbl_ss;
    4.12 +  grant_entry_t *gnttbl_table;
    4.13 +  PMDL gnttbl_mdl;
    4.14 +  grant_entry_t *gnttbl_table_copy;
    4.15    #if DBG
    4.16 -  PULONG gnttab_tag;
    4.17 +  PULONG gnttbl_tag;
    4.18    #endif
    4.19 -  //PHYSICAL_ADDRESS gnttab_table_physical;
    4.20 -  //grant_ref_t *gnttab_list;
    4.21 -  //int gnttab_list_free;
    4.22 -  //KSPIN_LOCK grant_lock;
    4.23    ULONG grant_frames;
    4.24  
    4.25    ev_action_t ev_actions[NR_EVENTS];
     5.1 --- a/xenpci/xenpci_fdo.c	Wed Jan 26 12:13:47 2011 +1100
     5.2 +++ b/xenpci/xenpci_fdo.c	Thu Jan 27 18:20:13 2011 +1100
     5.3 @@ -409,12 +409,34 @@ XenPci_Suspend0(PVOID context)
     5.4  {
     5.5    PXENPCI_DEVICE_DATA xpdd = context;
     5.6    ULONG cancelled;
     5.7 +  ULONGLONG sysenter_cs, sysenter_esp, sysenter_eip;
     5.8    
     5.9    FUNCTION_ENTER();
    5.10  
    5.11    GntTbl_Suspend(xpdd);
    5.12 +
    5.13 +  sysenter_cs = __readmsr(0x174);
    5.14 +  sysenter_esp = __readmsr(0x175);
    5.15 +  sysenter_eip = __readmsr(0x176);
    5.16    
    5.17    cancelled = hvm_shutdown(xpdd, SHUTDOWN_suspend);
    5.18 +
    5.19 +  if (__readmsr(0x174) != sysenter_cs)
    5.20 +  {
    5.21 +    KdPrint((__DRIVER_NAME "     sysenter_cs not restored. Fixing.\n"));
    5.22 +    __writemsr(0x174, sysenter_cs);
    5.23 +  }
    5.24 +  if (__readmsr(0x175) != sysenter_esp)
    5.25 +  {
    5.26 +    KdPrint((__DRIVER_NAME "     sysenter_esp not restored. Fixing.\n"));
    5.27 +    __writemsr(0x175, sysenter_esp);
    5.28 +  }
    5.29 +  if (__readmsr(0x176) != sysenter_eip)
    5.30 +  {
    5.31 +      KdPrint((__DRIVER_NAME "     sysenter_eip not restored. Fixing.\n"));
    5.32 +    __writemsr(0x176, sysenter_eip);
    5.33 +  }
    5.34 +
    5.35    KdPrint((__DRIVER_NAME "     back from suspend, cancelled = %d\n", cancelled));
    5.36  
    5.37    if (qemu_hide_flags_value)
    5.38 @@ -485,7 +507,6 @@ XenPci_SuspendResume(WDFWORKITEM workite
    5.39        KdPrint((__DRIVER_NAME "     Suspending child\n"));
    5.40        XenPci_Pdo_Suspend(child_device);
    5.41      }
    5.42 -    KdPrint((__DRIVER_NAME "     WdfChildListRetrieveNextDevice = %08x, STATUS_NO_MORE_ENTRIES = %08x\n", status, STATUS_NO_MORE_ENTRIES));
    5.43      WdfChildListEndIteration(child_list, &child_iterator);
    5.44  
    5.45      XenBus_Suspend(xpdd);
    5.46 @@ -503,7 +524,6 @@ XenPci_SuspendResume(WDFWORKITEM workite
    5.47        KdPrint((__DRIVER_NAME "     Resuming child\n"));
    5.48        XenPci_Pdo_Resume(child_device);
    5.49      }
    5.50 -    KdPrint((__DRIVER_NAME "     WdfChildListRetrieveNextDevice = %08x, STATUS_NO_MORE_ENTRIES = %08x\n", status, STATUS_NO_MORE_ENTRIES));
    5.51      WdfChildListEndIteration(child_list, &child_iterator);
    5.52  
    5.53      xpdd->suspend_state = SUSPEND_STATE_NONE;
    5.54 @@ -736,29 +756,6 @@ XenPci_EvtDeviceD0Entry(WDFDEVICE device
    5.55      GntTbl_Init(xpdd);
    5.56      EvtChn_Init(xpdd);
    5.57  
    5.58 -    /* need to give some memory back to xen to balance the books */
    5.59 -#if 0
    5.60 -    for (i = 0; i < NR_GRANT_FRAMES + 1; i++)
    5.61 -    {
    5.62 -      struct xen_memory_reservation reservation;
    5.63 -      xen_pfn_t pfn;
    5.64 -      PMDL mdl = AllocatePage();
    5.65 -      pfn = (xen_pfn_t)(MmGetMdlPfnArray(mdl)[0]);
    5.66 -      reservation.address_bits = 0;
    5.67 -      reservation.extent_order = 0;
    5.68 -      reservation.domid = DOMID_SELF;
    5.69 -      reservation.nr_extents = 1;
    5.70 -      #pragma warning(disable: 4127) /* conditional expression is constant */
    5.71 -      set_xen_guest_handle(reservation.extent_start, &pfn);
    5.72 -      
    5.73 -      KdPrint((__DRIVER_NAME "     Calling HYPERVISOR_memory_op - pfn = %x\n", (ULONG)pfn));
    5.74 -      ret = HYPERVISOR_memory_op(xpdd, XENMEM_decrease_reservation, &reservation);
    5.75 -      KdPrint((__DRIVER_NAME "     decreased %d pages\n", ret));
    5.76 -      *(PUCHAR*)MmGetMdlVirtualAddress(mdl) = (UCHAR)0x42;
    5.77 -      KdPrint((__DRIVER_NAME "     touched decreased page\n"));
    5.78 -    }
    5.79 -#endif
    5.80 -    
    5.81    // use the memory_op(unsigned int op, void *arg) hypercall to adjust memory
    5.82    // use XENMEM_increase_reservation and XENMEM_decrease_reservation
    5.83    }
     6.1 --- a/xenpci/xenpci_pdo.c	Wed Jan 26 12:13:47 2011 +1100
     6.2 +++ b/xenpci/xenpci_pdo.c	Thu Jan 27 18:20:13 2011 +1100
     6.3 @@ -671,7 +671,6 @@ XenPci_XenConfigDeviceSpecifyBuffers(WDF
     6.4    in_ptr = src;
     6.5    while((type = GET_XEN_INIT_REQ(&in_ptr, (PVOID)&setting, (PVOID)&value, (PVOID)&value2)) != XEN_INIT_TYPE_END)
     6.6    {
     6.7 -//KdPrint((__DRIVER_NAME "     in_ptr = %p, type = %d\n", in_ptr, type));
     6.8      ADD_XEN_INIT_REQ(&xppdd->requested_resources_ptr, type, setting, value, value2);
     6.9  
    6.10      switch (type)
    6.11 @@ -1531,7 +1530,7 @@ XenPci_Pdo_Suspend(WDFDEVICE device)
    6.12      }
    6.13  
    6.14      RtlStringCbPrintfA(path, ARRAY_SIZE(path), "%s/state", xppdd->backend_path);
    6.15 -    XenBus_RemWatch(xpdd, XBT_NIL, path, XenPci_BackendStateHandler, xppdd);  
    6.16 +    XenBus_RemWatch(xpdd, XBT_NIL, path, XenPci_BackendStateHandler, device);  
    6.17    }
    6.18    else
    6.19    {