VirtualBox

Changeset 107570 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Jan 9, 2025 9:23:18 AM (10 days ago)
Author:
vboxsync
Message:

VMM/CPUM: Report the host CPU microcode revision number to the guest when on an amd64 host. jiraref:VBP-947

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

Legend:

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

    r107569 r107570  
    284284    RT_NOREF_PV(pVCpu); RT_NOREF_PV(idMsr);
    285285    /** @todo fake microcode update. */
    286     *puValue = pRange->uValue;
     286    PVM const pVM = pVCpu->CTX_SUFF(pVM);
     287    if (pVM->cpum.s.GuestInfo.uMicrocodeRevision != UINT32_MAX)
     288        *puValue = RT_MAKE_U64(RT_LO_U32(pRange->uValue), pVM->cpum.s.GuestInfo.uMicrocodeRevision);
     289    else
     290        *puValue = pRange->uValue;
    287291    return VINF_SUCCESS;
    288292}
     
    43794383    RT_NOREF_PV(pVCpu); RT_NOREF_PV(idMsr);
    43804384    /** @todo Fake AMD microcode patching.  */
    4381     *puValue = pRange->uValue;
     4385    PVM const pVM = pVCpu->CTX_SUFF(pVM);
     4386    if (pVM->cpum.s.GuestInfo.uMicrocodeRevision != UINT32_MAX)
     4387        *puValue = RT_MAKE_U64(pVM->cpum.s.GuestInfo.uMicrocodeRevision, RT_HI_U32(pRange->uValue));
     4388    else
     4389        *puValue = pRange->uValue;
    43824390    return VINF_SUCCESS;
    43834391}
  • trunk/src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp

    r106574 r107570  
    33963396#endif
    33973397
     3398    /** @cfgm{/CPUM/GuestMicrocodeRev,32-bit}
     3399     * CPU microcode revision number to use.  If UINT32_MAX we use the host
     3400     * revision of the host CPU for the host-cpu profile and the database entry if a
     3401     * specific one is selected (amd64 host only). */
     3402    rc = CFGMR3QueryU32Def(pCpumCfg, "GuestMicrocodeRevision", &pCpum->GuestInfo.uMicrocodeRevision, UINT32_MAX);
     3403    AssertLogRelRCReturn(rc, rc);
     3404#if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
     3405    if (   pCpum->GuestInfo.uMicrocodeRevision == UINT32_MAX
     3406        && strcmp(Config.szCpuName, "host") == 0)
     3407    {
     3408        rc = SUPR3QueryMicrocodeRev(&pCpum->GuestInfo.uMicrocodeRevision);
     3409        if (RT_FAILURE(rc))
     3410            pCpum->GuestInfo.uMicrocodeRevision = UINT32_MAX;
     3411    }
     3412#endif
     3413
    33983414    /** @cfgm{/CPUM/MSRs/[Name]/[First|Last|Type|Value|...],}
    33993415     * Overrides the guest MSRs.
  • trunk/src/VBox/VMM/include/CPUMInternal.h

    r107220 r107570  
    106106 * @{ */
    107107/** The current saved state version.
    108  *  @todo When bumping to next version, add CPUMCTX::enmHwVirt to the saved
    109  *        state. */
     108 *  @todo When bumping to next version, add CPUMCTX::enmHwVirt and
     109 *        uMicrocodeRevision to the saved state. */
    110110#define CPUM_SAVED_STATE_VERSION                CPUM_SAVED_STATE_VERSION_HWVIRT_VMX_4
    111111/** The saved state version with u32RestoreProcCtls2 for Nested Microsoft
     
    190190    uint64_t                    uScalableBusFreq;
    191191
     192    /** The microcode revision.
     193     * UINT32_MAX if the one from the CPU database entry is to be used.
     194     * @see /CPUM/GuestMicrocodeRevision in CFGM. */
     195    uint32_t                    uMicrocodeRevision;
     196    uint32_t                    uPadding;
     197
    192198    /** Pointer to the MSR ranges (for compatibility with old hyper heap code). */
    193199    R3PTRTYPE(PCPUMMSRRANGE)    paMsrRangesR3;
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