VirtualBox

Ignore:
Timestamp:
May 28, 2013 2:38:48 PM (12 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
86045
Message:

VMM: Started HMSVMR0 work. Unify the AMD-V erratum 170 verification code between R0 and R3. General HM tidying.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR0/HWSVMR0.cpp

    r45965 r46297  
    178178
    179179/**
     180 * Does global AMD-V initialization (called during module initialization).
     181 *
     182 * @returns VBox status code.
     183 */
     184VMMR0DECL(int) SVMR0GlobalInit(void)
     185{
     186    return VINF_SUCCESS;
     187}
     188
     189
     190/**
     191 * Does global VT-x termination (called during module termination).
     192 */
     193VMMR0DECL(void) SVMR0GlobalTerm(void)
     194{
     195}
     196
     197
     198/**
    180199 * Does Ring-0 per VM AMD-V init.
    181200 *
     
    199218    ASMMemFill32(pVM->hm.s.svm.pvIOBitmap, 3 << PAGE_SHIFT, 0xffffffff);
    200219
    201     /*
    202      * Erratum 170 which requires a forced TLB flush for each world switch:
    203      * See http://www.amd.com/us-en/assets/content_type/white_papers_and_tech_docs/33610.pdf
    204      *
    205      * All BH-G1/2 and DH-G1/2 models include a fix:
    206      * Athlon X2:   0x6b 1/2
    207      *              0x68 1/2
    208      * Athlon 64:   0x7f 1
    209      *              0x6f 2
    210      * Sempron:     0x7f 1/2
    211      *              0x6f 2
    212      *              0x6c 2
    213      *              0x7c 2
    214      * Turion 64:   0x68 2
    215      */
    216     uint32_t u32Dummy;
    217     uint32_t u32Version, u32Family, u32Model, u32Stepping, u32BaseFamily;
    218     ASMCpuId(1, &u32Version, &u32Dummy, &u32Dummy, &u32Dummy);
    219     u32BaseFamily = (u32Version >> 8) & 0xf;
    220     u32Family     = u32BaseFamily + (u32BaseFamily == 0xf ? ((u32Version >> 20) & 0x7f) : 0);
    221     u32Model      = ((u32Version >> 4) & 0xf);
    222     u32Model      = u32Model | ((u32BaseFamily == 0xf ? (u32Version >> 16) & 0x0f : 0) << 4);
    223     u32Stepping   = u32Version & 0xf;
    224     if (    u32Family == 0xf
    225         &&  !((u32Model == 0x68 || u32Model == 0x6b || u32Model == 0x7f) &&  u32Stepping >= 1)
    226         &&  !((u32Model == 0x6f || u32Model == 0x6c || u32Model == 0x7c) &&  u32Stepping >= 2))
     220    /* Check for an AMD CPU erratum which requires us to flush the TLB before every world-switch. */
     221    uint32_t u32Family;
     222    uint32_t u32Model;
     223    uint32_t u32Stepping;
     224    if (HMAmdIsSubjectToErratum170(&u32Family, &u32Model, &u32Stepping))
    227225    {
    228226        Log(("SVMR0InitVM: AMD cpu with erratum 170 family %x model %x stepping %x\n", u32Family, u32Model, u32Stepping));
Note: See TracChangeset for help on using the changeset viewer.

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