VirtualBox

Ignore:
Timestamp:
Mar 11, 2011 2:50:45 PM (14 years ago)
Author:
vboxsync
Message:

SUPDrv,IPRT,++: Enabled the code for supporting up to 256 host CPUs/cores/threads.

Location:
trunk/src/VBox/HostDrivers/Support
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/Support/SUPDrv.c

    r36254 r36262  
    32163216{
    32173217    PSUPGLOBALINFOPAGE  pGip = (PSUPGLOBALINFOPAGE)pvUser1;
    3218 #ifdef SUP_WITH_LOTS_OF_CPUS
    32193218    unsigned            iCpu = pGip->aiCpuFromApicId[ASMGetApicId()];
    3220 #else
    3221     unsigned            iCpu = ASMGetApicId();
    3222 #endif
    3223 
    3224 #ifdef SUP_WITH_LOTS_OF_CPUS
     3219
    32253220    if (RT_LIKELY(iCpu < pGip->cCpus && pGip->aCPUs[iCpu].idCpu == idCpu))
    3226 #else
    3227     if (RT_LIKELY(iCpu < RT_ELEMENTS(pGip->aCPUs)))
    3228 #endif
    32293221        supdrvGipReInitCpu(&pGip->aCPUs[iCpu], *(uint64_t *)pvUser2);
    32303222
     
    48374829     */
    48384830    cCpus = RTMpGetArraySize();
    4839 #ifdef SUP_WITH_LOTS_OF_CPUS
    48404831    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    {
    48474834        SUPR0Printf("VBoxDrv: Too many CPUs (%u) for the GIP (max %u)\n", cCpus, RT_MIN(RTCPUSET_MAX_CPUS, 256));
    4848 #else
    4849         SUPR0Printf("VBoxDrv: Too many CPUs (%u) for the GIP (max %u)\n", cCpus, RT_MIN(RT_ELEMENTS(pGip->aCPUs), 256));
    4850 #endif
    48514835        return VERR_TOO_MANY_CPUS;
    48524836    }
     
    48554839     * Allocate a contiguous set of pages with a default kernel mapping.
    48564840     */
    4857 #ifdef SUP_WITH_LOTS_OF_CPUS
    48584841    rc = RTR0MemObjAllocCont(&pDevExt->GipMemObj, RT_UOFFSETOF(SUPGLOBALINFOPAGE, aCPUs[cCpus]), false /*fExecutable*/);
    4859 #else
    4860     cCpus = RT_ELEMENTS(pGip->aCPUs);
    4861     rc = RTR0MemObjAllocLow(&pDevExt->GipMemObj, PAGE_SIZE, false /*fExecutable*/);
    4862 #endif
    48634842    if (RT_FAILURE(rc))
    48644843    {
     
    50285007static void supdrvGipMpEventOnline(PSUPGLOBALINFOPAGE pGip, RTCPUID idCpu)
    50295008{
    5030 #ifdef SUP_WITH_LOTS_OF_CPUS
    50315009    int         iCpuSet;
    50325010    uint8_t     idApic;
     
    50395017     * Update the globals.
    50405018     */
    5041     ASMAtomicWriteU32(&pGip->cPresentCpus,  RTMpGetPresentCount());
    5042     ASMAtomicWriteU32(&pGip->cOnlineCpus,   RTMpGetOnlineCount());
     5019    ASMAtomicWriteU16(&pGip->cPresentCpus,  RTMpGetPresentCount());
     5020    ASMAtomicWriteU16(&pGip->cOnlineCpus,   RTMpGetOnlineCount());
    50435021    iCpuSet = RTMpCpuIdToSetIndex(idCpu);
    50445022    if (iCpuSet >= 0)
     
    50825060    ASMAtomicWriteU16(&pGip->aiCpuFromApicId[idApic],     i);
    50835061    ASMAtomicWriteU16(&pGip->aiCpuFromCpuSetIdx[iCpuSet], i);
    5084 #endif
    50855062}
    50865063
     
    50965073static void supdrvGipMpEventOffline(PSUPGLOBALINFOPAGE pGip, RTCPUID idCpu)
    50975074{
    5098 #ifdef SUP_WITH_LOTS_OF_CPUS
    50995075    int         iCpuSet;
    51005076    unsigned    i;
     
    51105086    ASMAtomicWriteSize(&pGip->aCPUs[i].enmState, SUPGIPCPUSTATE_OFFLINE);
    51115087    RTCpuSetDelByIndex(&pGip->OnlineCpuSet, iCpuSet);
    5112 #endif
    51135088}
    51145089
     
    53665341    pGip->u32Version            = SUPGLOBALINFOPAGE_VERSION;
    53675342    pGip->u32Mode               = supdrvGipDeterminTscMode(pDevExt);
    5368 #ifdef SUP_WITH_LOTS_OF_CPUS
    53695343    pGip->cCpus                 = (uint16_t)cCpus;
    53705344    pGip->cPages                = (uint16_t)(cbGip / PAGE_SIZE);
    5371 #endif
    53725345    pGip->u32UpdateHz           = uUpdateHz;
    53735346    pGip->u32UpdateIntervalNS   = 1000000000 / uUpdateHz;
    53745347    pGip->u64NanoTSLastUpdateHz = u64NanoTS;
    5375 #ifdef SUP_WITH_LOTS_OF_CPUS
    53765348    RTCpuSetEmpty(&pGip->OnlineCpuSet);
     5349    RTCpuSetEmpty(&pGip->PresentCpuSet);
     5350    RTMpGetSet(&pGip->PossibleCpuSet);
    53775351    pGip->cOnlineCpus           = RTMpGetOnlineCount();
    53785352    pGip->cPresentCpus          = RTMpGetPresentCount();
    5379     RTCpuSetEmpty(&pGip->PresentCpuSet);
    5380     RTMpGetSet(&pGip->PossibleCpuSet);
    53815353    pGip->cPossibleCpus         = RTMpGetCount();
    53825354    pGip->idCpuMax              = RTMpGetMaxCpuId();
     
    53855357    for (i = 0; i < RT_ELEMENTS(pGip->aiCpuFromCpuSetIdx); i++)
    53865358        pGip->aiCpuFromCpuSetIdx[i] = UINT16_MAX;
    5387 #endif
    53885359
    53895360    for (i = 0; i < cCpus; i++)
     
    53935364        pGip->aCPUs[i].u64TSC            = ASMReadTSC();
    53945365
    5395 #ifdef SUP_WITH_LOTS_OF_CPUS
    53965366        pGip->aCPUs[i].enmState          = SUPGIPCPUSTATE_INVALID;
    53975367        pGip->aCPUs[i].idCpu             = NIL_RTCPUID;
    53985368        pGip->aCPUs[i].iCpuSet           = -1;
    53995369        pGip->aCPUs[i].idApic            = UINT8_MAX;
    5400 #endif
    54015370
    54025371        /*
     
    55925561    else
    55935562    {
    5594 #ifdef SUP_WITH_LOTS_OF_CPUS
    55955563        unsigned iCpu = pGip->aiCpuFromApicId[ASMGetApicId()];
    55965564        if (RT_UNLIKELY(iCpu >= pGip->cCpus))
     
    55995567        if (RT_UNLIKELY(pGipCpu->idCpu != idCpu))
    56005568            return;
    5601 #else
    5602         unsigned iCpu = ASMGetApicId();
    5603         if (RT_UNLIKELY(iCpu >= RT_ELEMENTS(pGip->aCPUs)))
    5604             return;
    5605         pGipCpu = &pGip->aCPUs[iCpu];
    5606 #endif
    56075569    }
    56085570
     
    56645626                                  RTCPUID idCpu, uint8_t idApic, uint64_t iTick)
    56655627{
    5666 #ifdef SUP_WITH_LOTS_OF_CPUS
    56675628    unsigned iCpu = pGip->aiCpuFromApicId[idApic];
    56685629
    56695630    if (RT_LIKELY(iCpu < pGip->cCpus))
    5670 #else
    5671     unsigned iCpu = idApic;
    5672 
    5673     if (RT_LIKELY(iCpu < RT_ELEMENTS(pGip->aCPUs)))
    5674 #endif
    56755631    {
    56765632        PSUPGIPCPU pGipCpu = &pGip->aCPUs[iCpu];
    5677 #ifdef SUP_WITH_LOTS_OF_CPUS
    56785633        if (pGipCpu->idCpu == idCpu)
    5679 #endif
    56805634        {
    56815635
  • trunk/src/VBox/HostDrivers/Support/SUPDrvIOC.h

    r36232 r36262  
    190190 *  -# When increment the major number, execute all pending work.
    191191 *
     192 * Skip versions:
     193 *  - 0x0018XXXX - Used by 4.0 for the >= 32/64 CPUs support.
     194 *
    192195 * @todo Pending work on next major version change:
    193196 *          - None.
    194197 */
    195 #define SUPDRV_IOC_VERSION                              0x00160001
     198#define SUPDRV_IOC_VERSION                              0x00170001
    196199
    197200/** SUP_IOCTL_COOKIE. */
  • trunk/src/VBox/HostDrivers/Support/SUPLib.cpp

    r36232 r36262  
    267267        strcpy(CookieReq.u.In.szMagic, SUPCOOKIE_MAGIC);
    268268        CookieReq.u.In.u32ReqVersion = SUPDRV_IOC_VERSION;
    269         const uint32_t uMinVersion = (SUPDRV_IOC_VERSION & 0xffff0000) == 0x00160000
     269        const uint32_t uMinVersion = /*(SUPDRV_IOC_VERSION & 0xffff0000) == 0x00160000
    270270                                   ? 0x00160001
    271                                    : SUPDRV_IOC_VERSION & 0xffff0000;
     271                                   : */ SUPDRV_IOC_VERSION & 0xffff0000;
    272272        CookieReq.u.In.u32MinVersion = uMinVersion;
    273273        rc = suplibOsIOCtl(&g_supLibData, SUP_IOCTL_COOKIE, &CookieReq, SUP_IOCTL_COOKIE_SIZE);
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette