VirtualBox

Changeset 81733 in vbox for trunk/src/VBox/VMM


Ignore:
Timestamp:
Nov 7, 2019 4:43:30 AM (5 years ago)
Author:
vboxsync
Message:

VMM: Nested VMX: bugref:9180 Detect VMX-preemption timer erratum and don't passthrough the feature to guests
if the erratum is detected.

Location:
trunk/src/VBox/VMM
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/HMVMXAll.cpp

    r81002 r81733  
    546546
    547547/**
     548 * Checks if the CPU is subject to the "VMX-Preemption Timer Does Not Count Down at
     549 * the Rate Specified" erratum.
     550 *
     551 * Errata names and related steppings:
     552 *      - BA86   - D0.
     553 *      - AAX65  - C2.
     554 *      - AAU65  - C2, K0.
     555 *      - AAO95  - B1.
     556 *      - AAT59  - C2.
     557 *      - AAK139 - D0.
     558 *      - AAM126 - C0, C1, D0.
     559 *      - AAN92  - B1.
     560 *      - AAJ124 - C0, D0.
     561 *      - AAP86  - B1.
     562 *
     563 * Steppings: B1, C0, C1, C2, D0, K0.
     564 *
     565 * @returns @c true if subject to it, @c false if not.
     566 */
     567VMM_INT_DECL(bool) HMIsSubjectToVmxPreemptTimerErratum(void)
     568{
     569    uint32_t u = ASMCpuId_EAX(1);
     570    u &= ~(RT_BIT_32(14) | RT_BIT_32(15) | RT_BIT_32(28) | RT_BIT_32(29) | RT_BIT_32(30) | RT_BIT_32(31));
     571    if (   u == 0x000206E6 /* 323344.pdf - BA86   - D0 - Xeon Processor 7500 Series */
     572        || u == 0x00020652 /* 323056.pdf - AAX65  - C2 - Xeon Processor L3406 */
     573                           /* 322814.pdf - AAT59  - C2 - CoreTM i7-600, i5-500, i5-400 and i3-300 Mobile Processor Series */
     574                           /* 322911.pdf - AAU65  - C2 - CoreTM i5-600, i3-500 Desktop Processor Series and Intel Pentium Processor G6950 */
     575        || u == 0x00020655 /* 322911.pdf - AAU65  - K0 - CoreTM i5-600, i3-500 Desktop Processor Series and Intel Pentium Processor G6950 */
     576        || u == 0x000106E5 /* 322373.pdf - AAO95  - B1 - Xeon Processor 3400 Series */
     577                           /* 322166.pdf - AAN92  - B1 - CoreTM i7-800 and i5-700 Desktop Processor Series */
     578                           /* 320767.pdf - AAP86  - B1 - Core i7-900 Mobile Processor Extreme Edition Series, Intel Core i7-800 and i7-700 Mobile Processor Series */
     579        || u == 0x000106A0 /* 321333.pdf - AAM126 - C0 - Xeon Processor 3500 Series Specification */
     580        || u == 0x000106A1 /* 321333.pdf - AAM126 - C1 - Xeon Processor 3500 Series Specification */
     581        || u == 0x000106A4 /* 320836.pdf - AAJ124 - C0 - Core i7-900 Desktop Processor Extreme Edition Series and Intel Core i7-900 Desktop Processor Series */
     582        || u == 0x000106A5 /* 321333.pdf - AAM126 - D0 - Xeon Processor 3500 Series Specification */
     583                           /* 321324.pdf - AAK139 - D0 - Xeon Processor 5500 Series Specification */
     584                           /* 320836.pdf - AAJ124 - D0 - Core i7-900 Desktop Processor Extreme Edition Series and Intel Core i7-900 Desktop Processor Series */
     585        )
     586        return true;
     587    return false;
     588}
     589
     590
     591/**
    548592 * Checks if the guest is in a suitable state for hardware-assisted VMX execution.
    549593 *
  • trunk/src/VBox/VMM/VMMR0/HMR0.cpp

    r80911 r81733  
    292292
    293293/**
    294  * Checks if the CPU is subject to the "VMX-Preemption Timer Does Not Count
    295  * Down at the Rate Specified" erratum.
    296  *
    297  * Errata names and related steppings:
    298  *      - BA86   - D0.
    299  *      - AAX65  - C2.
    300  *      - AAU65  - C2, K0.
    301  *      - AAO95  - B1.
    302  *      - AAT59  - C2.
    303  *      - AAK139 - D0.
    304  *      - AAM126 - C0, C1, D0.
    305  *      - AAN92  - B1.
    306  *      - AAJ124 - C0, D0.
    307  *      - AAP86  - B1.
    308  *
    309  * Steppings: B1, C0, C1, C2, D0, K0.
    310  *
    311  * @returns true if subject to it, false if not.
    312  */
    313 static bool hmR0InitIntelIsSubjectToVmxPreemptTimerErratum(void)
    314 {
    315     uint32_t u = ASMCpuId_EAX(1);
    316     u &= ~(RT_BIT_32(14) | RT_BIT_32(15) | RT_BIT_32(28) | RT_BIT_32(29) | RT_BIT_32(30) | RT_BIT_32(31));
    317     if (   u == UINT32_C(0x000206E6) /* 323344.pdf - BA86   - D0 - Intel Xeon Processor 7500 Series */
    318         || u == UINT32_C(0x00020652) /* 323056.pdf - AAX65  - C2 - Intel Xeon Processor L3406 */
    319                                      /* 322814.pdf - AAT59  - C2 - Intel CoreTM i7-600, i5-500, i5-400 and i3-300 Mobile Processor Series */
    320                                      /* 322911.pdf - AAU65  - C2 - Intel CoreTM i5-600, i3-500 Desktop Processor Series and Intel Pentium Processor G6950 */
    321         || u == UINT32_C(0x00020655) /* 322911.pdf - AAU65  - K0 - Intel CoreTM i5-600, i3-500 Desktop Processor Series and Intel Pentium Processor G6950 */
    322         || u == UINT32_C(0x000106E5) /* 322373.pdf - AAO95  - B1 - Intel Xeon Processor 3400 Series */
    323                                      /* 322166.pdf - AAN92  - B1 - Intel CoreTM i7-800 and i5-700 Desktop Processor Series */
    324                                      /* 320767.pdf - AAP86  - B1 - Intel Core i7-900 Mobile Processor Extreme Edition Series, Intel Core i7-800 and i7-700 Mobile Processor Series */
    325         || u == UINT32_C(0x000106A0) /* 321333.pdf - AAM126 - C0 - Intel Xeon Processor 3500 Series Specification */
    326         || u == UINT32_C(0x000106A1) /* 321333.pdf - AAM126 - C1 - Intel Xeon Processor 3500 Series Specification */
    327         || u == UINT32_C(0x000106A4) /* 320836.pdf - AAJ124 - C0 - Intel Core i7-900 Desktop Processor Extreme Edition Series and Intel Core i7-900 Desktop Processor Series */
    328         || u == UINT32_C(0x000106A5) /* 321333.pdf - AAM126 - D0 - Intel Xeon Processor 3500 Series Specification */
    329                                      /* 321324.pdf - AAK139 - D0 - Intel Xeon Processor 5500 Series Specification */
    330                                      /* 320836.pdf - AAJ124 - D0 - Intel Core i7-900 Desktop Processor Extreme Edition Series and Intel Core i7-900 Desktop Processor Series */
    331         )
    332         return true;
    333     return false;
    334 }
    335 
    336 
    337 /**
    338294 * Intel specific initialization code.
    339295 *
     
    487443                g_HmR0.hwvirt.u.vmx.fUsePreemptTimer   = true;
    488444                g_HmR0.hwvirt.u.vmx.cPreemptTimerShift = RT_BF_GET(uVmxMiscMsr, VMX_BF_MISC_PREEMPT_TIMER_TSC);
    489                 if (hmR0InitIntelIsSubjectToVmxPreemptTimerErratum())
     445                if (HMIsSubjectToVmxPreemptTimerErratum())
    490446                    g_HmR0.hwvirt.u.vmx.cPreemptTimerShift = 0; /* This is about right most of the time here. */
    491447            }
  • trunk/src/VBox/VMM/VMMR3/CPUM.cpp

    r81605 r81733  
    19961996    pGuestFeat->fVmxVmwriteAll            = (pBaseFeat->fVmxVmwriteAll            & EmuFeat.fVmxVmwriteAll           );
    19971997    pGuestFeat->fVmxEntryInjectSoftInt    = (pBaseFeat->fVmxEntryInjectSoftInt    & EmuFeat.fVmxEntryInjectSoftInt   );
     1998
     1999    if (HMIsSubjectToVmxPreemptTimerErratum())
     2000    {
     2001        Log(("CPUM: VMX-preemption timer erratum detected. Cannot expose VMX-preemption timer feature to guests."));
     2002        pGuestFeat->fVmxPreemptTimer = 0;
     2003    }
    19982004
    19992005    /* Paranoia. */
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