win-pvdrivers

changeset 694:b0d4d2f2e73a

Balloon down NR_GRANT_FRAMES + 1 to fix a problem on resume from migration
author James Harper <james.harper@bendigoit.com.au>
date Sat Nov 14 14:22:32 2009 +1100 (2009-11-14)
parents d7c20d6438b9
children 272148c83c78
files xenpci/xenpci_fdo.c
line diff
     1.1 --- a/xenpci/xenpci_fdo.c	Sun Nov 08 23:25:27 2009 +1100
     1.2 +++ b/xenpci/xenpci_fdo.c	Sat Nov 14 14:22:32 2009 +1100
     1.3 @@ -629,6 +629,8 @@ XenPci_EvtDeviceD0Entry(WDFDEVICE device
     1.4  {
     1.5    NTSTATUS status = STATUS_SUCCESS;
     1.6    PXENPCI_DEVICE_DATA xpdd = GetXpdd(device);
     1.7 +  ULONG i;
     1.8 +  ULONG ret;
     1.9  
    1.10    FUNCTION_ENTER();
    1.11  
    1.12 @@ -674,6 +676,24 @@ XenPci_EvtDeviceD0Entry(WDFDEVICE device
    1.13      }
    1.14      GntTbl_Init(xpdd);
    1.15      EvtChn_Init(xpdd);
    1.16 +
    1.17 +    for (i = 0; i < NR_GRANT_FRAMES + 1; i++)
    1.18 +    {
    1.19 +      struct xen_memory_reservation reservation;
    1.20 +      ULONG pfn;
    1.21 +      PMDL mdl = AllocatePage();
    1.22 +      pfn = (ULONG)(MmGetMdlPfnArray(mdl)[0]);
    1.23 +      reservation.address_bits = 0;
    1.24 +      reservation.extent_order = 0;
    1.25 +      reservation.domid = DOMID_SELF;
    1.26 +      reservation.nr_extents = 1;
    1.27 +      #pragma warning(disable: 4127) /* conditional expression is constant */
    1.28 +      set_xen_guest_handle(reservation.extent_start, &pfn);
    1.29 +      ret = HYPERVISOR_memory_op(xpdd, XENMEM_decrease_reservation, &reservation);
    1.30 +    }
    1.31 +    
    1.32 +  // use the memory_op(unsigned int op, void *arg) hypercall to adjust memory
    1.33 +  // use XENMEM_increase_reservation and XENMEM_decrease_reservation
    1.34    }
    1.35    else
    1.36    {