Changeset 36262 in vbox for trunk/src/VBox/HostDrivers/Support
- Timestamp:
- Mar 11, 2011 2:50:45 PM (14 years ago)
- Location:
- trunk/src/VBox/HostDrivers/Support
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/Support/SUPDrv.c
r36254 r36262 3216 3216 { 3217 3217 PSUPGLOBALINFOPAGE pGip = (PSUPGLOBALINFOPAGE)pvUser1; 3218 #ifdef SUP_WITH_LOTS_OF_CPUS3219 3218 unsigned iCpu = pGip->aiCpuFromApicId[ASMGetApicId()]; 3220 #else 3221 unsigned iCpu = ASMGetApicId(); 3222 #endif 3223 3224 #ifdef SUP_WITH_LOTS_OF_CPUS 3219 3225 3220 if (RT_LIKELY(iCpu < pGip->cCpus && pGip->aCPUs[iCpu].idCpu == idCpu)) 3226 #else3227 if (RT_LIKELY(iCpu < RT_ELEMENTS(pGip->aCPUs)))3228 #endif3229 3221 supdrvGipReInitCpu(&pGip->aCPUs[iCpu], *(uint64_t *)pvUser2); 3230 3222 … … 4837 4829 */ 4838 4830 cCpus = RTMpGetArraySize(); 4839 #ifdef SUP_WITH_LOTS_OF_CPUS4840 4831 if ( cCpus > RTCPUSET_MAX_CPUS 4841 || cCpus > 256 /*uint8_t is used for the mappings*/) 4842 #else 4843 if (cCpus > RT_ELEMENTS(pGip->aCPUs)) 4844 #endif 4845 { 4846 #ifdef SUP_WITH_LOTS_OF_CPUS 4832 || cCpus > 256 /*ApicId is used for the mappings*/) 4833 { 4847 4834 SUPR0Printf("VBoxDrv: Too many CPUs (%u) for the GIP (max %u)\n", cCpus, RT_MIN(RTCPUSET_MAX_CPUS, 256)); 4848 #else4849 SUPR0Printf("VBoxDrv: Too many CPUs (%u) for the GIP (max %u)\n", cCpus, RT_MIN(RT_ELEMENTS(pGip->aCPUs), 256));4850 #endif4851 4835 return VERR_TOO_MANY_CPUS; 4852 4836 } … … 4855 4839 * Allocate a contiguous set of pages with a default kernel mapping. 4856 4840 */ 4857 #ifdef SUP_WITH_LOTS_OF_CPUS4858 4841 rc = RTR0MemObjAllocCont(&pDevExt->GipMemObj, RT_UOFFSETOF(SUPGLOBALINFOPAGE, aCPUs[cCpus]), false /*fExecutable*/); 4859 #else4860 cCpus = RT_ELEMENTS(pGip->aCPUs);4861 rc = RTR0MemObjAllocLow(&pDevExt->GipMemObj, PAGE_SIZE, false /*fExecutable*/);4862 #endif4863 4842 if (RT_FAILURE(rc)) 4864 4843 { … … 5028 5007 static void supdrvGipMpEventOnline(PSUPGLOBALINFOPAGE pGip, RTCPUID idCpu) 5029 5008 { 5030 #ifdef SUP_WITH_LOTS_OF_CPUS5031 5009 int iCpuSet; 5032 5010 uint8_t idApic; … … 5039 5017 * Update the globals. 5040 5018 */ 5041 ASMAtomicWriteU 32(&pGip->cPresentCpus, RTMpGetPresentCount());5042 ASMAtomicWriteU 32(&pGip->cOnlineCpus, RTMpGetOnlineCount());5019 ASMAtomicWriteU16(&pGip->cPresentCpus, RTMpGetPresentCount()); 5020 ASMAtomicWriteU16(&pGip->cOnlineCpus, RTMpGetOnlineCount()); 5043 5021 iCpuSet = RTMpCpuIdToSetIndex(idCpu); 5044 5022 if (iCpuSet >= 0) … … 5082 5060 ASMAtomicWriteU16(&pGip->aiCpuFromApicId[idApic], i); 5083 5061 ASMAtomicWriteU16(&pGip->aiCpuFromCpuSetIdx[iCpuSet], i); 5084 #endif5085 5062 } 5086 5063 … … 5096 5073 static void supdrvGipMpEventOffline(PSUPGLOBALINFOPAGE pGip, RTCPUID idCpu) 5097 5074 { 5098 #ifdef SUP_WITH_LOTS_OF_CPUS5099 5075 int iCpuSet; 5100 5076 unsigned i; … … 5110 5086 ASMAtomicWriteSize(&pGip->aCPUs[i].enmState, SUPGIPCPUSTATE_OFFLINE); 5111 5087 RTCpuSetDelByIndex(&pGip->OnlineCpuSet, iCpuSet); 5112 #endif5113 5088 } 5114 5089 … … 5366 5341 pGip->u32Version = SUPGLOBALINFOPAGE_VERSION; 5367 5342 pGip->u32Mode = supdrvGipDeterminTscMode(pDevExt); 5368 #ifdef SUP_WITH_LOTS_OF_CPUS5369 5343 pGip->cCpus = (uint16_t)cCpus; 5370 5344 pGip->cPages = (uint16_t)(cbGip / PAGE_SIZE); 5371 #endif5372 5345 pGip->u32UpdateHz = uUpdateHz; 5373 5346 pGip->u32UpdateIntervalNS = 1000000000 / uUpdateHz; 5374 5347 pGip->u64NanoTSLastUpdateHz = u64NanoTS; 5375 #ifdef SUP_WITH_LOTS_OF_CPUS5376 5348 RTCpuSetEmpty(&pGip->OnlineCpuSet); 5349 RTCpuSetEmpty(&pGip->PresentCpuSet); 5350 RTMpGetSet(&pGip->PossibleCpuSet); 5377 5351 pGip->cOnlineCpus = RTMpGetOnlineCount(); 5378 5352 pGip->cPresentCpus = RTMpGetPresentCount(); 5379 RTCpuSetEmpty(&pGip->PresentCpuSet);5380 RTMpGetSet(&pGip->PossibleCpuSet);5381 5353 pGip->cPossibleCpus = RTMpGetCount(); 5382 5354 pGip->idCpuMax = RTMpGetMaxCpuId(); … … 5385 5357 for (i = 0; i < RT_ELEMENTS(pGip->aiCpuFromCpuSetIdx); i++) 5386 5358 pGip->aiCpuFromCpuSetIdx[i] = UINT16_MAX; 5387 #endif5388 5359 5389 5360 for (i = 0; i < cCpus; i++) … … 5393 5364 pGip->aCPUs[i].u64TSC = ASMReadTSC(); 5394 5365 5395 #ifdef SUP_WITH_LOTS_OF_CPUS5396 5366 pGip->aCPUs[i].enmState = SUPGIPCPUSTATE_INVALID; 5397 5367 pGip->aCPUs[i].idCpu = NIL_RTCPUID; 5398 5368 pGip->aCPUs[i].iCpuSet = -1; 5399 5369 pGip->aCPUs[i].idApic = UINT8_MAX; 5400 #endif5401 5370 5402 5371 /* … … 5592 5561 else 5593 5562 { 5594 #ifdef SUP_WITH_LOTS_OF_CPUS5595 5563 unsigned iCpu = pGip->aiCpuFromApicId[ASMGetApicId()]; 5596 5564 if (RT_UNLIKELY(iCpu >= pGip->cCpus)) … … 5599 5567 if (RT_UNLIKELY(pGipCpu->idCpu != idCpu)) 5600 5568 return; 5601 #else5602 unsigned iCpu = ASMGetApicId();5603 if (RT_UNLIKELY(iCpu >= RT_ELEMENTS(pGip->aCPUs)))5604 return;5605 pGipCpu = &pGip->aCPUs[iCpu];5606 #endif5607 5569 } 5608 5570 … … 5664 5626 RTCPUID idCpu, uint8_t idApic, uint64_t iTick) 5665 5627 { 5666 #ifdef SUP_WITH_LOTS_OF_CPUS5667 5628 unsigned iCpu = pGip->aiCpuFromApicId[idApic]; 5668 5629 5669 5630 if (RT_LIKELY(iCpu < pGip->cCpus)) 5670 #else5671 unsigned iCpu = idApic;5672 5673 if (RT_LIKELY(iCpu < RT_ELEMENTS(pGip->aCPUs)))5674 #endif5675 5631 { 5676 5632 PSUPGIPCPU pGipCpu = &pGip->aCPUs[iCpu]; 5677 #ifdef SUP_WITH_LOTS_OF_CPUS5678 5633 if (pGipCpu->idCpu == idCpu) 5679 #endif5680 5634 { 5681 5635 -
trunk/src/VBox/HostDrivers/Support/SUPDrvIOC.h
r36232 r36262 190 190 * -# When increment the major number, execute all pending work. 191 191 * 192 * Skip versions: 193 * - 0x0018XXXX - Used by 4.0 for the >= 32/64 CPUs support. 194 * 192 195 * @todo Pending work on next major version change: 193 196 * - None. 194 197 */ 195 #define SUPDRV_IOC_VERSION 0x001 60001198 #define SUPDRV_IOC_VERSION 0x00170001 196 199 197 200 /** SUP_IOCTL_COOKIE. */ -
trunk/src/VBox/HostDrivers/Support/SUPLib.cpp
r36232 r36262 267 267 strcpy(CookieReq.u.In.szMagic, SUPCOOKIE_MAGIC); 268 268 CookieReq.u.In.u32ReqVersion = SUPDRV_IOC_VERSION; 269 const uint32_t uMinVersion = (SUPDRV_IOC_VERSION & 0xffff0000) == 0x00160000269 const uint32_t uMinVersion = /*(SUPDRV_IOC_VERSION & 0xffff0000) == 0x00160000 270 270 ? 0x00160001 271 : SUPDRV_IOC_VERSION & 0xffff0000;271 : */ SUPDRV_IOC_VERSION & 0xffff0000; 272 272 CookieReq.u.In.u32MinVersion = uMinVersion; 273 273 rc = suplibOsIOCtl(&g_supLibData, SUP_IOCTL_COOKIE, &CookieReq, SUP_IOCTL_COOKIE_SIZE);
Note:
See TracChangeset
for help on using the changeset viewer.