VirtualBox

Changeset 1047 in vbox


Ignore:
Timestamp:
Feb 23, 2007 4:46:23 PM (18 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
18923
Message:

Added X2 / NG opteron detection for enabling the async tsc gip mode.

File:
1 edited

Legend:

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

    r1027 r1047  
    163163static void     supdrvLdrFree(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage);
    164164static int      supdrvIOCtl_GetPagingMode(PSUPGETPAGINGMODE_OUT pOut);
     165static SUPGIPMODE supdrvGipDeterminTscMode(void);
    165166#ifdef USE_NEW_OS_INTERFACE
    166167static int      supdrvGipCreate(PSUPDRVDEVEXT pDevExt);
     
    40194020    memset(pGip, 0, PAGE_SIZE);
    40204021    pGip->u32Magic          = SUPGLOBALINFOPAGE_MAGIC;
    4021     pGip->u32Mode           = SUPGIPMODE_SYNC_TSC;
     4022    pGip->u32Mode           = supdrvGipDeterminTscMode();
    40224023    pGip->u32UpdateHz       = uUpdateHz;
    40234024    pGip->u32UpdateIntervalNS = 1000000000 / uUpdateHz;
     
    40534054    pDevExt->cGipUsers = 0;
    40544055
    4055     /*
    4056      * Check if we should switch to async TSC mode.
    4057      */
    4058 #if 0
     4056    return 0;
     4057}
     4058
     4059
     4060/**
     4061 * Determin the GIP TSC mode.
     4062 *
     4063 * @returns The most suitable TSC mode.
     4064 */
     4065static SUPGIPMODE supdrvGipDeterminTscMode(void)
     4066{
    40594067    if (supdrvOSGetCPUCount() > 1)
    40604068    {
    4061         ASMCpuId(0,
    4062     }
    4063 #endif
    4064 
    4065     return 0;
     4069        uint32_t uEAX, uEBX, uECX, uEDX;
     4070
     4071        /* Check for "AuthenticAMD" */
     4072        ASMCpuId(0, &uEAX, &uEBX, &uECX, &uEDX);
     4073        if (uEAX >= 1 && uEBX == 0x68747541 && uECX == 0x444d4163 && uEDX == 0x69746e65)
     4074        {
     4075            /* Check for family 15 and the RDTSCP feature - hope that's is sufficient. */
     4076            ASMCpuId(0x80000001, &uEAX, &uEBX, &uECX, &uEDX);
     4077            if (   ((uEAX >> 8) & 0xf) == 0xf && ((uEAX >> 20) & 0x7f) == 0 /* family=15 */
     4078                && (uEDX & BIT(27) /*RDTSCP*/))
     4079            {
     4080                /** @todo when we get the model / family numbers of barcelona and other amd cores with proper TSC,
     4081                 * add the appropriate model checks here. */
     4082                return SUPGIPMODE_ASYNC_TSC;
     4083            }
     4084        }
     4085    }
     4086    return SUPGIPMODE_SYNC_TSC;
    40664087}
    40674088
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