win-pvdrivers
changeset 377:7f4f8d1986e5
Automated merge with ssh://win-pvdrivers@xenbits.xensource.com/win-pvdrivers.hg
author | Andy Grover <andy.grover@oracle.com> |
---|---|
date | Wed Jul 09 11:01:11 2008 -0700 (2008-07-09) |
parents | aceae9864ad8 448011e246d3 |
children | 9ac05494063f |
files |
line diff
1.1 --- a/common.inc Wed Jul 09 11:01:05 2008 -0700 1.2 +++ b/common.inc Wed Jul 09 11:01:11 2008 -0700 1.3 @@ -1,4 +1,4 @@ 1.4 -VERSION=0.9.10.5 1.5 +VERSION=0.9.10.7 1.6 TARGETPATH=..\Target\$(DDK_TARGET_OS) 1.7 MSC_WARNING_LEVEL=/W4 1.8 INCLUDES = ..\common\include;..\common\include\public
2.1 --- a/installer.nsi Wed Jul 09 11:01:05 2008 -0700 2.2 +++ b/installer.nsi Wed Jul 09 11:01:11 2008 -0700 2.3 @@ -3,7 +3,7 @@ 2.4 2.5 !define AppName "Xen PV Drivers" 2.6 !define StartMenu "$SMPROGRAMS\${AppName}" 2.7 -!define Version "0.9.11-pre5" 2.8 +!define Version "0.9.11-pre6" 2.9 #!define Version "$%VERSION%" 2.10 Name "${AppName}" 2.11 InstallDir "$PROGRAMFILES\${AppName}" 2.12 @@ -176,11 +176,6 @@ SectionEnd 2.13 2.14 Section "Install Drivers" installdrivers 2.15 Push "$INSTDIR\drivers" 2.16 - Push "$INSTDIR\drivers\xenpci.inf" 2.17 - Push "PCI\VEN_5853&DEV_0001" 2.18 - Call InstallUpgradeDriver 2.19 - 2.20 - Push "$INSTDIR\drivers" 2.21 Push "$INSTDIR\drivers\xennet.inf" 2.22 Push "XEN\VIF" 2.23 Call InstallUpgradeDriver 2.24 @@ -209,6 +204,11 @@ Section "Install Drivers" installdrivers 2.25 Push "$INSTDIR\drivers\xenstub.inf" 2.26 Push "XEN\VKBD" 2.27 Call InstallUpgradeDriver 2.28 + 2.29 + Push "$INSTDIR\drivers" 2.30 + Push "$INSTDIR\drivers\xenpci.inf" 2.31 + Push "PCI\VEN_5853&DEV_0001" 2.32 + Call InstallUpgradeDriver 2.33 SectionEnd 2.34 2.35 Var arch
3.1 --- a/xenhide/xenhide.c Wed Jul 09 11:01:05 2008 -0700 3.2 +++ b/xenhide/xenhide.c Wed Jul 09 11:01:11 2008 -0700 3.3 @@ -172,12 +172,13 @@ XenHide_IdSuffixMatches(PDEVICE_OBJECT p 3.4 { 3.5 NTSTATUS status; 3.6 ULONG remaining; 3.7 - ULONG string_length; 3.8 + size_t string_length; 3.9 WCHAR ids[512]; 3.10 PWCHAR ptr; 3.11 ULONG ids_length; 3.12 int i; 3.13 3.14 +// KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n")); 3.15 for (i = 0; i < 2; i++) 3.16 { 3.17 if (i == 0) 3.18 @@ -187,26 +188,29 @@ XenHide_IdSuffixMatches(PDEVICE_OBJECT p 3.19 3.20 if (!NT_SUCCESS(status)) 3.21 { 3.22 - //KdPrint((__DRIVER_NAME " i = %d, status = %x, ids_length = %d\n", i, status, ids_length)); 3.23 +// KdPrint((__DRIVER_NAME " i = %d, status = %x, ids_length = %d\n", i, status, ids_length)); 3.24 continue; 3.25 } 3.26 3.27 remaining = ids_length / 2; 3.28 for (ptr = ids; *ptr != 0; ptr += string_length + 1) 3.29 { 3.30 - RtlStringCchLengthW(ptr, remaining, (size_t *)&string_length); 3.31 - remaining -= string_length - 1; 3.32 + RtlStringCchLengthW(ptr, remaining, &string_length); 3.33 + remaining -= (ULONG)string_length + 1; 3.34 if (string_length >= wcslen(matching_id)) 3.35 { 3.36 ptr += string_length - wcslen(matching_id); 3.37 - string_length -= (ULONG)wcslen(matching_id); 3.38 + string_length = (ULONG)wcslen(matching_id); 3.39 } 3.40 - //KdPrint((__DRIVER_NAME " Comparing '%S' and '%S'\n", ptr, matching_id)); 3.41 +// KdPrint((__DRIVER_NAME " Comparing '%S' and '%S'\n", ptr, matching_id)); 3.42 if (wcscmp(ptr, matching_id) == 0) 3.43 - return TRUE; 3.44 + { 3.45 + KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ " (Match)\n")); 3.46 + return TRUE; 3.47 + } 3.48 } 3.49 } 3.50 - //KdPrint((__DRIVER_NAME " No match\n")); 3.51 +// KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ " (No match)\n")); 3.52 return FALSE; 3.53 } 3.54
4.1 --- a/xenpci/amd64/hypercall.asm Wed Jul 09 11:01:05 2008 -0700 4.2 +++ b/xenpci/amd64/hypercall.asm Wed Jul 09 11:01:11 2008 -0700 4.3 @@ -31,4 +31,17 @@ 4.4 pop rdi 4.5 ret 4.6 _hypercall2 endp 4.7 + 4.8 +_hypercall3 proc 4.9 + push rdi 4.10 + push rsi 4.11 + mov rdi, rdx 4.12 + mov rsi, r8 4.13 + mov rdx, r9 4.14 + mov rax, rcx 4.15 + call rax 4.16 + pop rsi 4.17 + pop rdi 4.18 + ret 4.19 +_hypercall3 endp 4.20 END
5.1 --- a/xenpci/gnttbl.c Wed Jul 09 11:01:05 2008 -0700 5.2 +++ b/xenpci/gnttbl.c Wed Jul 09 11:01:11 2008 -0700 5.3 @@ -149,7 +149,6 @@ GntTbl_EndAccess( 5.4 return TRUE; 5.5 } 5.6 5.7 -#if defined(_X86_) 5.8 static unsigned int 5.9 GntTbl_QueryMaxFrames(PXENPCI_DEVICE_DATA xpdd) 5.10 { 5.11 @@ -166,42 +165,58 @@ GntTbl_QueryMaxFrames(PXENPCI_DEVICE_DAT 5.12 } 5.13 return query.max_nr_frames; 5.14 } 5.15 -#endif 5.16 + 5.17 +VOID 5.18 +GntTbl_InitMap(PXENPCI_DEVICE_DATA xpdd) 5.19 +{ 5.20 + int i; 5.21 + ULONG grant_frames; 5.22 + int grant_entries; 5.23 + //KdPrint((__DRIVER_NAME " --> GntTbl_Init\n")); 5.24 + 5.25 + grant_frames = GntTbl_QueryMaxFrames(xpdd); 5.26 + grant_entries = min(NR_GRANT_ENTRIES, (grant_frames * PAGE_SIZE / sizeof(grant_entry_t))); 5.27 + KdPrint((__DRIVER_NAME " grant_entries : %d\n", grant_entries)); 5.28 + 5.29 + if (xpdd->gnttab_list) 5.30 + { 5.31 + if (grant_frames > xpdd->max_grant_frames) 5.32 + { 5.33 + ExFreePoolWithTag(xpdd->gnttab_list, XENPCI_POOL_TAG); 5.34 + MmUnmapIoSpace(xpdd->gnttab_table, PAGE_SIZE * xpdd->max_grant_frames); 5.35 + xpdd->gnttab_list = NULL; 5.36 + } 5.37 + } 5.38 + 5.39 + if (!xpdd->gnttab_list) 5.40 + { 5.41 + xpdd->gnttab_list = ExAllocatePoolWithTag(NonPagedPool, sizeof(grant_ref_t) * grant_entries, XENPCI_POOL_TAG); 5.42 + xpdd->gnttab_table_physical = XenPci_AllocMMIO(xpdd, 5.43 + PAGE_SIZE * grant_frames); 5.44 + xpdd->gnttab_table = MmMapIoSpace(xpdd->gnttab_table_physical, 5.45 + PAGE_SIZE * grant_frames, MmNonCached); 5.46 + if (!xpdd->gnttab_table) 5.47 + { 5.48 + KdPrint((__DRIVER_NAME " Error Mapping Grant Table Shared Memory\n")); 5.49 + // this should be a show stopper... 5.50 + return; 5.51 + } 5.52 + xpdd->max_grant_frames = grant_frames; 5.53 + } 5.54 + RtlZeroMemory(xpdd->gnttab_list, sizeof(grant_ref_t) * grant_entries); 5.55 + for (i = NR_RESERVED_ENTRIES; i < grant_entries; i++) 5.56 + GntTbl_PutRef(xpdd, i); 5.57 + 5.58 + GntTbl_Map(xpdd, 0, grant_frames - 1); 5.59 +} 5.60 5.61 VOID 5.62 GntTbl_Init(PXENPCI_DEVICE_DATA xpdd) 5.63 { 5.64 - int i; 5.65 - int max_grant_frames = NR_GRANT_FRAMES; 5.66 - int max_grant_entries = NR_GRANT_ENTRIES; 5.67 //KdPrint((__DRIVER_NAME " --> GntTbl_Init\n")); 5.68 5.69 KeInitializeSpinLock(&xpdd->grant_lock); 5.70 - 5.71 -#if defined(_X86_) 5.72 - max_grant_frames = GntTbl_QueryMaxFrames(xpdd); 5.73 - max_grant_entries = min(NR_GRANT_ENTRIES,(max_grant_frames * PAGE_SIZE / sizeof(grant_entry_t))); 5.74 - KdPrint((__DRIVER_NAME " max_grant_entries : %d\n",max_grant_entries)); 5.75 -#else 5.76 - #if defined(_AMD64_) 5.77 - KdPrint((__DRIVER_NAME " AMD64 cannot support HYPERVISOR_grant_table_op now\n")); 5.78 - #endif 5.79 -#endif 5.80 - 5.81 - xpdd->gnttab_list = ExAllocatePoolWithTag(NonPagedPool, sizeof(grant_ref_t) * max_grant_entries, XENPCI_POOL_TAG);// Where to free? 5.82 - for (i = NR_RESERVED_ENTRIES; i < max_grant_entries; i++) 5.83 - GntTbl_PutRef(xpdd, i); 5.84 - 5.85 - xpdd->gnttab_table_physical = XenPci_AllocMMIO(xpdd, 5.86 - PAGE_SIZE * max_grant_frames); 5.87 - xpdd->gnttab_table = MmMapIoSpace(xpdd->gnttab_table_physical, 5.88 - PAGE_SIZE * max_grant_frames, MmNonCached); 5.89 - if (!xpdd->gnttab_table) 5.90 - { 5.91 - KdPrint((__DRIVER_NAME " Error Mapping Grant Table Shared Memory\n")); 5.92 - return; 5.93 - } 5.94 - GntTbl_Map(xpdd, 0, max_grant_frames - 1); 5.95 - 5.96 + GntTbl_InitMap(xpdd); 5.97 + 5.98 //KdPrint((__DRIVER_NAME " <-- GntTbl_Init table mapped at %p\n", gnttab_table)); 5.99 }
6.1 --- a/xenpci/hypercall_amd64.h Wed Jul 09 11:01:05 2008 -0700 6.2 +++ b/xenpci/hypercall_amd64.h Wed Jul 09 11:01:11 2008 -0700 6.3 @@ -17,14 +17,15 @@ along with this program; if not, write t 6.4 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 6.5 */ 6.6 6.7 -extern int _hypercall2(VOID *address, int cmd, void *arg); 6.8 +extern int _hypercall2(VOID *address, xen_ulong_t a1, xen_ulong_t a2); 6.9 +extern int _hypercall3(VOID *address, xen_ulong_t a1, xen_ulong_t a2, xen_ulong_t a3); 6.10 6.11 static __inline int 6.12 HYPERVISOR_memory_op(PXENPCI_DEVICE_DATA xpdd, int cmd, void *arg) 6.13 { 6.14 PCHAR memory_op_func = xpdd->hypercall_stubs; 6.15 memory_op_func += __HYPERVISOR_memory_op * 32; 6.16 - return _hypercall2(memory_op_func, cmd, arg); 6.17 + return _hypercall2(memory_op_func, (xen_ulong_t)cmd, (xen_ulong_t)arg); 6.18 } 6.19 6.20 static __inline int 6.21 @@ -32,31 +33,18 @@ HYPERVISOR_xen_version(PXENPCI_DEVICE_DA 6.22 { 6.23 PCHAR xen_version_func = xpdd->hypercall_stubs; 6.24 xen_version_func += __HYPERVISOR_xen_version * 32; 6.25 - return _hypercall2(xen_version_func, cmd, arg); 6.26 + return _hypercall2(xen_version_func, (xen_ulong_t)cmd, (xen_ulong_t)arg); 6.27 } 6.28 6.29 -#if 0 6.30 static __inline int 6.31 HYPERVISOR_grant_table_op(PXENPCI_DEVICE_DATA xpdd, int cmd, void *uop, unsigned int count) 6.32 { 6.33 - ASSERTMSG("grant_table_op not yet supported under AMD64", FALSE); 6.34 -/* 6.35 - char *hypercall_stubs = xpdd->hypercall_stubs; 6.36 - long __res; 6.37 - __asm { 6.38 - mov ebx, cmd 6.39 - mov ecx, uop 6.40 - mov edx, count 6.41 - mov eax, hypercall_stubs 6.42 - add eax, (__HYPERVISOR_grant_table_op * 32) 6.43 - call eax 6.44 - mov [__res], eax 6.45 - } 6.46 - return __res; 6.47 -*/ 6.48 - return -1; 6.49 + PCHAR grant_table_op_func = xpdd->hypercall_stubs; 6.50 + grant_table_op_func += __HYPERVISOR_grant_table_op * 32; 6.51 + return _hypercall3(grant_table_op_func, (xen_ulong_t)cmd, (xen_ulong_t)uop, (xen_ulong_t)count); 6.52 } 6.53 6.54 +#if 0 6.55 static __inline int 6.56 HYPERVISOR_mmu_update(PXENPCI_DEVICE_DATA xpdd, mmu_update_t *req, int count, int *success_count, domid_t domid) 6.57 { 6.58 @@ -79,27 +67,6 @@ HYPERVISOR_mmu_update(PXENPCI_DEVICE_DAT 6.59 */ 6.60 return -1; 6.61 } 6.62 - 6.63 -static __inline int 6.64 -HYPERVISOR_console_io(PXENPCI_DEVICE_DATA xpdd, int cmd, int count, char *string) 6.65 -{ 6.66 - ASSERTMSG("console_io not yet supported under AMD64", FALSE); 6.67 -/* 6.68 - char *hypercall_stubs = xpdd->hypercall_stubs; 6.69 - long __res; 6.70 - __asm { 6.71 - mov ebx, cmd 6.72 - mov ecx, count 6.73 - mov edx, string 6.74 - mov eax, hypercall_stubs 6.75 - add eax, (__HYPERVISOR_console_io * 32) 6.76 - call eax 6.77 - mov [__res], eax 6.78 - } 6.79 - return __res; 6.80 -*/ 6.81 - return -1; 6.82 -} 6.83 #endif 6.84 6.85 static __inline int 6.86 @@ -107,7 +74,7 @@ HYPERVISOR_hvm_op(PXENPCI_DEVICE_DATA xp 6.87 { 6.88 PCHAR hvm_op_func = xpdd->hypercall_stubs; 6.89 hvm_op_func += __HYPERVISOR_hvm_op * 32; 6.90 - return _hypercall2(hvm_op_func, op, arg); 6.91 + return _hypercall2(hvm_op_func, (xen_ulong_t)op, (xen_ulong_t)arg); 6.92 } 6.93 6.94 static __inline int 6.95 @@ -115,7 +82,7 @@ HYPERVISOR_event_channel_op(PXENPCI_DEVI 6.96 { 6.97 PCHAR event_channel_op_func = xpdd->hypercall_stubs; 6.98 event_channel_op_func += __HYPERVISOR_event_channel_op * 32; 6.99 - return _hypercall2(event_channel_op_func, cmd, op); 6.100 + return _hypercall2(event_channel_op_func, (xen_ulong_t)cmd, (xen_ulong_t)op); 6.101 } 6.102 6.103 static __inline int 6.104 @@ -123,7 +90,7 @@ HYPERVISOR_sched_op(PXENPCI_DEVICE_DATA 6.105 { 6.106 PCHAR sched_op_func = xpdd->hypercall_stubs; 6.107 sched_op_func += __HYPERVISOR_sched_op * 32; 6.108 - return _hypercall2(sched_op_func, cmd, arg); 6.109 + return _hypercall2(sched_op_func, (xen_ulong_t)cmd, (xen_ulong_t)arg); 6.110 } 6.111 6.112 static __inline int
7.1 --- a/xenpci/xenpci.h Wed Jul 09 11:01:05 2008 -0700 7.2 +++ b/xenpci/xenpci.h Wed Jul 09 11:01:11 2008 -0700 7.3 @@ -185,6 +185,9 @@ typedef struct { 7.4 grant_entry_t *gnttab_table; 7.5 PHYSICAL_ADDRESS gnttab_table_physical; 7.6 grant_ref_t *gnttab_list; 7.7 + /* this is the maximum number of grant frames we have memory allocated for */ 7.8 + /* after a resume it may not be the actual number of grant frames we have though */ 7.9 + ULONG max_grant_frames; 7.10 7.11 ev_action_t ev_actions[NR_EVENTS]; 7.12 // unsigned long bound_ports[NR_EVENTS/(8*sizeof(unsigned long))]; 7.13 @@ -418,7 +421,8 @@ EvtChn_AllocUnbound(PVOID Context, domid 7.14 7.15 VOID 7.16 GntTbl_Init(PXENPCI_DEVICE_DATA xpdd); 7.17 - 7.18 +VOID 7.19 +GntTbl_InitMap(PXENPCI_DEVICE_DATA xpdd); 7.20 grant_ref_t 7.21 GntTbl_GrantAccess(PVOID Context, domid_t domid, uint32_t, int readonly, grant_ref_t ref); 7.22 BOOLEAN
8.1 --- a/xenpci/xenpci_fdo.c Wed Jul 09 11:01:05 2008 -0700 8.2 +++ b/xenpci/xenpci_fdo.c Wed Jul 09 11:01:11 2008 -0700 8.3 @@ -384,22 +384,17 @@ XenPci_Suspend( 8.4 } 8.5 KdPrint((__DRIVER_NAME " all other processors are spinning\n")); 8.6 8.7 - // make a backup of the grant table - we are going to keep it instead of throwing it away 8.8 - //memcpy(gnttbl_backup, xpdd->gnttab_table, PAGE_SIZE * NR_GRANT_FRAMES); 8.9 - 8.10 KdPrint((__DRIVER_NAME " calling suspend\n")); 8.11 cancelled = hvm_shutdown(Context, SHUTDOWN_suspend); 8.12 KdPrint((__DRIVER_NAME " back from suspend, cancelled = %d\n", cancelled)); 8.13 8.14 XenPci_Init(xpdd); 8.15 8.16 - GntTbl_Map(Context, 0, NR_GRANT_FRAMES - 1); 8.17 + GntTbl_InitMap(Context); 8.18 8.19 /* this enabled interrupts again too */ 8.20 EvtChn_Init(xpdd); 8.21 8.22 - //memcpy(xpdd->gnttab_table, gnttbl_backup, PAGE_SIZE * NR_GRANT_FRAMES); 8.23 - 8.24 for (child = (PXEN_CHILD)xpdd->child_list.Flink; child != (PXEN_CHILD)&xpdd->child_list; child = (PXEN_CHILD)child->entry.Flink) 8.25 { 8.26 child->context->device_state.resume_state = RESUME_STATE_BACKEND_RESUME;