VirtualBox

Changeset 54879 in vbox


Ignore:
Timestamp:
Mar 20, 2015 4:02:54 PM (10 years ago)
Author:
vboxsync
Message:

Started on AESNI config, continue at home...

File:
1 edited

Legend:

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

    r54862 r54879  
    20012001
    20022002
     2003/** @name Instruction Set Extension Options
     2004 * @{  */
     2005/** Configuration option type. */
     2006typedef uint8_t CPUMISAEXTCFG;
     2007/** Default choice of the VMM.   */
     2008#define CPUMISAEXTCFG_DEFAULT               UINT8_C(0)
     2009/** Always disable the extension. */
     2010#define CPUMISAEXTCFG_DISABLED              UINT8_C(1)
     2011/** Enable the extension if it's supported by the host CPU. */
     2012#define CPUMISAEXTCFG_ENABLED_SUPPORTED     UINT8_C(2)
     2013/** Always enable the extension. */
     2014#define CPUMISAEXTCFG_ENABLED_ALWAYS        UINT8_C(3)
     2015/** @} */
     2016
    20032017/**
    20042018 * CPUID Configuration (from CFGM).
     
    20092023typedef struct CPUMCPUIDCONFIG
    20102024{
    2011     bool        fSyntheticCpu;
    2012     bool        fCmpXchg16b;
    2013     bool        fMonitor;
    2014     bool        fMWaitExtensions;
    2015     bool        fSse41;
    2016     bool        fSse42;
    2017     bool        fNt4LeafLimit;
    2018     bool        fInvariantTsc;
    2019     uint32_t    uMaxStdLeaf;
    2020     uint32_t    uMaxExtLeaf;
    2021     uint32_t    uMaxCentaurLeaf;
    2022     uint32_t    uMaxIntelFamilyModelStep;
     2025    bool            fSyntheticCpu;
     2026    bool            fCmpXchg16b;
     2027    bool            fMonitor;
     2028    bool            fMWaitExtensions;
     2029    bool            fSse41;
     2030    bool            fSse42;
     2031    bool            fNt4LeafLimit;
     2032    bool            fInvariantTsc;
     2033    CPUMISAEXTCFG   enmAesNi;
     2034    CPUMISAEXTCFG   enmPClMulQDQ;
     2035    uint32_t        uMaxStdLeaf;
     2036    uint32_t        uMaxExtLeaf;
     2037    uint32_t        uMaxCentaurLeaf;
     2038    uint32_t        uMaxIntelFamilyModelStep;
    20232039    char        szCpuName[128];
    20242040} CPUMCPUIDCONFIG;
     
    31413157
    31423158
    3143 static int cpumR3CpuIdReadConfig(PCPUM pCpum, PCPUMCPUIDCONFIG pConfig, PCFGMNODE pCpumCfg)
     3159static int cpumR3CpuIdReadConfig(PCPUM pCpum, PCPUMCPUIDCONFIG pConfig, PCFGMNODE pCpumCfg, bool fNestedPagingAndFullGuestExec)
    31443160{
    31453161    int rc;
     
    31683184    AssertLogRelRCReturn(rc, rc);
    31693185
    3170     /** @cfgm{/CPUM/CMPXCHG16B, boolean, false}
    3171      * Expose CMPXCHG16B to the guest if supported by the host.
    3172      */
    3173     rc = CFGMR3QueryBoolDef(pCpumCfg, "CMPXCHG16B", &pConfig->fCmpXchg16b, false);
    3174     AssertLogRelRCReturn(rc, rc);
    3175 
    3176     /** @cfgm{/CPUM/MONITOR, boolean, true}
    3177      * Expose MONITOR/MWAIT instructions to the guest.
    3178      */
    3179     rc = CFGMR3QueryBoolDef(pCpumCfg, "MONITOR", &pConfig->fMonitor, true);
    3180     AssertLogRelRCReturn(rc, rc);
    3181 
    3182     /** @cfgm{/CPUM/MWaitExtensions, boolean, false}
    3183      * Expose MWAIT extended features to the guest.  For now we expose just MWAIT
    3184      * break on interrupt feature (bit 1).
    3185      */
    3186     rc = CFGMR3QueryBoolDef(pCpumCfg, "MWaitExtensions", &pConfig->fMWaitExtensions, false);
    3187     AssertLogRelRCReturn(rc, rc);
    3188 
    3189     /** @cfgm{/CPUM/SSE4.1, boolean, true}
    3190      * Expose SSE4.1 to the guest if available.
    3191      */
    3192     rc = CFGMR3QueryBoolDef(pCpumCfg, "SSE4.1", &pConfig->fSse41, true);
    3193     AssertLogRelRCReturn(rc, rc);
    3194 
    3195     /** @cfgm{/CPUM/SSE4.2, boolean, true}
    3196      * Expose SSE4.2 to the guest if available.
    3197      */
    3198     rc = CFGMR3QueryBoolDef(pCpumCfg, "SSE4.2", &pConfig->fSse42, true);
    3199     AssertLogRelRCReturn(rc, rc);
    3200 
    32013186    /** @cfgm{/CPUM/NT4LeafLimit, boolean, false}
    32023187     * Limit the number of standard CPUID leaves to 0..3 to prevent NT4 from
     
    32503235    AssertLogRelRCReturn(rc, rc);
    32513236
     3237
     3238    /*
     3239     * Instruction Set Architecture (ISA) Extensions.
     3240     */
     3241    PCFGMNODE pIsaExts = CFGMR3GetChild(pCpumCfg, "IsaExts");
     3242
     3243    /** @cfgm{/CPUM/CMPXCHG16B, boolean, false}
     3244     * Expose CMPXCHG16B to the guest if supported by the host.
     3245     */
     3246    rc = CFGMR3QueryBoolDef(pCpumCfg, "CMPXCHG16B", &pConfig->fCmpXchg16b, false);
     3247    AssertLogRelRCReturn(rc, rc);
     3248
     3249    /** @cfgm{/CPUM/MONITOR, boolean, true}
     3250     * Expose MONITOR/MWAIT instructions to the guest.
     3251     */
     3252    rc = CFGMR3QueryBoolDef(pCpumCfg, "MONITOR", &pConfig->fMonitor, true);
     3253    AssertLogRelRCReturn(rc, rc);
     3254
     3255    /** @cfgm{/CPUM/MWaitExtensions, boolean, false}
     3256     * Expose MWAIT extended features to the guest.  For now we expose just MWAIT
     3257     * break on interrupt feature (bit 1).
     3258     */
     3259    rc = CFGMR3QueryBoolDef(pCpumCfg, "MWaitExtensions", &pConfig->fMWaitExtensions, false);
     3260    AssertLogRelRCReturn(rc, rc);
     3261
     3262    /** @cfgm{/CPUM/SSE4.1, boolean, true}
     3263     * Expose SSE4.1 to the guest if available.
     3264     */
     3265    rc = CFGMR3QueryBoolDef(pCpumCfg, "SSE4.1", &pConfig->fSse41, true);
     3266    AssertLogRelRCReturn(rc, rc);
     3267
     3268    /** @cfgm{/CPUM/SSE4.2, boolean, true}
     3269     * Expose SSE4.2 to the guest if available.
     3270     */
     3271    rc = CFGMR3QueryBoolDef(pCpumCfg, "SSE4.2", &pConfig->fSse42, true);
     3272    AssertLogRelRCReturn(rc, rc);
     3273
     3274#if 0
     3275    /** @cfgm{/CPUM/IsaExts/AESNI, isaextcfg, depends}
     3276     * Whether to expose the AES instructions to the guest.  For the time being the
     3277     * default is to only do this for VMs with nested paging and AMD-V or
     3278     * unrestricted guest mode.
     3279     */
     3280    rc = cpumR3CpuIdReadIsaExtCfg(pIsaExts, "AESNI", &pConfig->enmAesNi, fNestedPagingAndFullGuestExec);
     3281    AssertLogRelRCReturn(rc, rc);
     3282#endif
     3283
     3284
    32523285    return VINF_SUCCESS;
    32533286}
     
    32703303    CPUMCPUIDCONFIG Config;
    32713304    RT_ZERO(Config);
    3272     int rc = cpumR3CpuIdReadConfig(pCpum, &Config, pCpumCfg);
     3305
     3306    int rc = cpumR3CpuIdReadConfig(pCpum, &Config, pCpumCfg, HMAreNestedPagingAndFullGuestExecEnabled(pVM));
    32733307    AssertRCReturn(rc, rc);
    32743308
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