VirtualBox

Changeset 102630 in vbox for trunk/src


Ignore:
Timestamp:
Dec 18, 2023 8:30:13 AM (17 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
160786
Message:

CPUID: Pass through and by default set the ARAT bit so that Windows 11 can use APIC timers and doesn't die in the absence of HPET (see bugref:10567).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp

    r102621 r102630  
    10311031    bool            fNt4LeafLimit;
    10321032    bool            fInvariantTsc;
     1033    bool            fInvariantApic;
    10331034    bool            fForceVme;
    10341035    bool            fNestedHWVirt;
     
    17991800
    18001801    /* Cpuid 6: Digital Thermal Sensor and Power Management Paramenters.
    1801      * Intel: Various stuff.
    1802      * AMD: EAX, EBX, EDX - reserved.
     1802     * Intel: Various thermal and power management related stuff.
     1803     * AMD: EBX, EDX - reserved.
     1804     *      EAX - Bit two is ARAT, indicating that APIC timers run at a constant
     1805     *            rate regardless of processor P-states. Same as Intel.
    18031806     *      ECX - Bit zero is EffFreq, indicating MSR_0000_00e7 and MSR_0000_00e8
    1804      *            present.  Same as intel.
     1807     *            present.  Same as Intel.
    18051808     * VIA: ??
    18061809     *
    1807      * We clear everything here for now.
    1808      */
    1809     cpumR3CpuIdZeroLeaf(pCpum, 6);
     1810     * We clear everything except for the ARAT bit which is important for Windows 11.
     1811     */
     1812    uSubLeaf = 0;
     1813    while ((pCurLeaf = cpumR3CpuIdGetExactLeaf(pCpum, 6, uSubLeaf)) != NULL)
     1814    {
     1815        pCurLeaf->uEbx = pCurLeaf->uEcx = pCurLeaf->uEdx = 0;
     1816        pCurLeaf->uEax &= 0
     1817                       | X86_CPUID_POWER_EAX_ARAT
     1818                       ;
     1819
     1820        /* Since we emulate the APIC timers, we can normally set the ARAT bit
     1821         * regardless of whether the host CPU sets it or not. Intel sets the ARAT
     1822         * bit circa since the Westmere generation, AMD probably only since Zen.
     1823         * See @bugref{10567}.
     1824         */
     1825        if (pConfig->fInvariantApic)
     1826            pCurLeaf->uEax |= X86_CPUID_POWER_EAX_ARAT;
     1827
     1828        uSubLeaf++;
     1829    }
    18101830
    18111831    /* Cpuid 7 + ECX: Structured Extended Feature Flags Enumeration
     
    27102730     */
    27112731    rc = CFGMR3QueryBoolDef(pCpumCfg, "InvariantTsc", &pConfig->fInvariantTsc, true);
     2732    AssertLogRelRCReturn(rc, rc);
     2733
     2734    /** @cfgm{/CPUM/InvariantApic, boolean, true}
     2735     * Set the Always Running APIC Timer (ARAT) flag in lea if true; otherwise
     2736     * pass through the host setting. The Windows 10/11 HAL won't use APIC timers
     2737     * unless the ARAT bit is set. Note that both Intel and AMD set this bit.
     2738     */
     2739    rc = CFGMR3QueryBoolDef(pCpumCfg, "InvariantApic", &pConfig->fInvariantApic, true);
    27122740    AssertLogRelRCReturn(rc, rc);
    27132741
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