VirtualBox

Ignore:
Timestamp:
May 15, 2018 4:11:35 AM (7 years ago)
Author:
vboxsync
Message:

VMM: VBOX_WITH_NESTED_HWVIRT_SVM.

File:
1 edited

Legend:

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

    r72178 r72208  
    5959        } while (0)
    6060
    61 # ifdef VBOX_WITH_NESTED_HWVIRT
     61# ifdef VBOX_WITH_NESTED_HWVIRT_SVM
    6262#  define HMSVM_NESTED_EXITCODE_STAM_COUNTER_INC(u64ExitCode) do { \
    6363        STAM_COUNTER_INC(&pVCpu->hm.s.StatExitAll); \
     
    7070#else
    7171# define HMSVM_EXITCODE_STAM_COUNTER_INC(u64ExitCode)           do { } while (0)
    72 # ifdef VBOX_WITH_NESTED_HWVIRT
     72# ifdef VBOX_WITH_NESTED_HWVIRT_SVM
    7373#  define HMSVM_NESTED_EXITCODE_STAM_COUNTER_INC(u64ExitCode)   do { } while (0)
    7474# endif
     
    8383 * \#VMEXIT intercepts that maybe caused during delivering of another
    8484 * event in the guest. */
    85 #ifdef VBOX_WITH_NESTED_HWVIRT
     85#ifdef VBOX_WITH_NESTED_HWVIRT_SVM
    8686# define HMSVM_CHECK_EXIT_DUE_TO_EVENT_DELIVERY() \
    8787    do \
     
    139139
    140140/** Assert that we're not executing a nested-guest. */
    141 #ifdef VBOX_WITH_NESTED_HWVIRT
     141#ifdef VBOX_WITH_NESTED_HWVIRT_SVM
    142142# define HMSVM_ASSERT_NOT_IN_NESTED_GUEST(a_pCtx)       Assert(!CPUMIsGuestInSvmNestedHwVirtMode((a_pCtx)))
    143143#else
     
    146146
    147147/** Assert that we're executing a nested-guest. */
    148 #ifdef VBOX_WITH_NESTED_HWVIRT
     148#ifdef VBOX_WITH_NESTED_HWVIRT_SVM
    149149# define HMSVM_ASSERT_IN_NESTED_GUEST(a_pCtx)           Assert(CPUMIsGuestInSvmNestedHwVirtMode((a_pCtx)))
    150150#else
     
    370370static FNSVMEXITHANDLER hmR0SvmExitXcptAC;
    371371static FNSVMEXITHANDLER hmR0SvmExitXcptBP;
    372 #if defined(HMSVM_ALWAYS_TRAP_ALL_XCPTS) || defined(VBOX_WITH_NESTED_HWVIRT)
     372#if defined(HMSVM_ALWAYS_TRAP_ALL_XCPTS) || defined(VBOX_WITH_NESTED_HWVIRT_SVM)
    373373static FNSVMEXITHANDLER hmR0SvmExitXcptGeneric;
    374374#endif
    375 #ifdef VBOX_WITH_NESTED_HWVIRT
     375#ifdef VBOX_WITH_NESTED_HWVIRT_SVM
    376376static FNSVMEXITHANDLER hmR0SvmExitXcptPFNested;
    377377static FNSVMEXITHANDLER hmR0SvmExitClgi;
     
    387387
    388388static int hmR0SvmHandleExit(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PSVMTRANSIENT pSvmTransient);
    389 #ifdef VBOX_WITH_NESTED_HWVIRT
     389#ifdef VBOX_WITH_NESTED_HWVIRT_SVM
    390390static int hmR0SvmHandleExitNested(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient);
    391391#endif
     
    757757{
    758758    PVM pVM = pVCpu->CTX_SUFF(pVM);
    759 #ifdef VBOX_WITH_NESTED_HWVIRT
     759#ifdef VBOX_WITH_NESTED_HWVIRT_SVM
    760760    if (CPUMIsGuestInSvmNestedHwVirtMode(pCtx))
    761761    {
     
    780780{
    781781    PVM pVM = pVCpu->CTX_SUFF(pVM);
    782 #ifdef VBOX_WITH_NESTED_HWVIRT
     782#ifdef VBOX_WITH_NESTED_HWVIRT_SVM
    783783    if (CPUMIsGuestInSvmNestedHwVirtMode(pCtx))
    784784    {
     
    803803{
    804804    PVM pVM = pVCpu->CTX_SUFF(pVM);
    805 #ifdef VBOX_WITH_NESTED_HWVIRT
     805#ifdef VBOX_WITH_NESTED_HWVIRT_SVM
    806806    if (CPUMIsGuestInSvmNestedHwVirtMode(pCtx))
    807807    {
     
    847847        if (!fInNestedGuestMode)
    848848            *pbMsrBitmap &= ~RT_BIT(uMsrpmBit);
    849 #ifdef VBOX_WITH_NESTED_HWVIRT
     849#ifdef VBOX_WITH_NESTED_HWVIRT_SVM
    850850        else
    851851        {
     
    867867        if (!fInNestedGuestMode)
    868868            *pbMsrBitmap &= ~RT_BIT(uMsrpmBit + 1);
    869 #ifdef VBOX_WITH_NESTED_HWVIRT
     869#ifdef VBOX_WITH_NESTED_HWVIRT_SVM
    870870        else
    871871        {
     
    903903    bool const fUseLbrVirt           = fLbrVirt; /** @todo CFGM, IEM implementation etc. */
    904904
    905 #ifdef VBOX_WITH_NESTED_HWVIRT
     905#ifdef VBOX_WITH_NESTED_HWVIRT_SVM
    906906    bool const fVirtVmsaveVmload     = RT_BOOL(pVM->hm.s.svm.u32Features & X86_CPUID_SVM_FEATURE_EDX_VIRT_VMSAVE_VMLOAD);
    907907    bool const fUseVirtVmsaveVmload  = fVirtVmsaveVmload && pVM->hm.s.svm.fVirtVmsaveVmload && pVM->hm.s.fNestedPaging;
     
    953953#endif
    954954
    955 #ifdef VBOX_WITH_NESTED_HWVIRT
     955#ifdef VBOX_WITH_NESTED_HWVIRT_SVM
    956956    /* Virtualized VMSAVE/VMLOAD. */
    957957    pVmcbCtrl->LbrVirt.n.u1VirtVmsaveVmload = fUseVirtVmsaveVmload;
     
    10871087DECLINLINE(PSVMVMCB) hmR0SvmGetCurrentVmcb(PVMCPU pVCpu, PCPUMCTX pCtx)
    10881088{
    1089 #ifdef VBOX_WITH_NESTED_HWVIRT
     1089#ifdef VBOX_WITH_NESTED_HWVIRT_SVM
    10901090    if (CPUMIsGuestInSvmNestedHwVirtMode(pCtx))
    10911091        return pCtx->hwvirt.svm.CTX_SUFF(pVmcb);
     
    11061106DECLINLINE(PSVMNESTEDVMCBCACHE) hmR0SvmGetNestedVmcbCache(PVMCPU pVCpu, PCPUMCTX pCtx)
    11071107{
    1108 #ifdef VBOX_WITH_NESTED_HWVIRT
     1108#ifdef VBOX_WITH_NESTED_HWVIRT_SVM
    11091109    Assert(pCtx->hwvirt.svm.fHMCachedVmcb); RT_NOREF(pCtx);
    11101110    return &pVCpu->hm.s.svm.NstGstVmcbCache;
     
    11651165static void hmR0SvmFlushTaggedTlb(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMVMCB pVmcb, PHMGLOBALCPUINFO pHostCpu)
    11661166{
    1167 #ifndef VBOX_WITH_NESTED_HWVIRT
     1167#ifndef VBOX_WITH_NESTED_HWVIRT_SVM
    11681168    RT_NOREF(pCtx);
    11691169#endif
     
    11841184    if (   pVCpu->hm.s.idLastCpu   != pHostCpu->idCpu
    11851185        || pVCpu->hm.s.cTlbFlushes != pHostCpu->cTlbFlushes
    1186 #ifdef VBOX_WITH_NESTED_HWVIRT
     1186#ifdef VBOX_WITH_NESTED_HWVIRT_SVM
    11871187        || CPUMIsGuestInSvmNestedHwVirtMode(pCtx)
    11881188#endif
     
    14111411    {
    14121412        bool fRemove = true;
    1413 #ifdef VBOX_WITH_NESTED_HWVIRT
     1413#ifdef VBOX_WITH_NESTED_HWVIRT_SVM
    14141414        /* Only remove the intercept if the nested-guest is also not intercepting it! */
    14151415        if (CPUMIsGuestInSvmNestedHwVirtMode(pCtx))
     
    14671467    {
    14681468        bool fRemove = true;
    1469 #ifdef VBOX_WITH_NESTED_HWVIRT
     1469#ifdef VBOX_WITH_NESTED_HWVIRT_SVM
    14701470        /* Only remove the control intercept if the nested-guest is also not intercepting it! */
    14711471        if (CPUMIsGuestInSvmNestedHwVirtMode(pCtx))
     
    19891989
    19901990
    1991 #ifdef VBOX_WITH_NESTED_HWVIRT
     1991#ifdef VBOX_WITH_NESTED_HWVIRT_SVM
    19921992/**
    19931993 * Loads the nested-guest APIC state (currently just the TPR).
     
    21462146
    21472147
    2148 #ifdef VBOX_WITH_NESTED_HWVIRT
     2148#ifdef VBOX_WITH_NESTED_HWVIRT_SVM
    21492149/**
    21502150 * Merges guest and nested-guest intercepts for executing the nested-guest using
     
    24062406    pVmcb->guest.u64RAX    = pCtx->rax;
    24072407
    2408 #ifdef VBOX_WITH_NESTED_HWVIRT
     2408#ifdef VBOX_WITH_NESTED_HWVIRT_SVM
    24092409    if (pVmcb->ctrl.IntCtrl.n.u1VGifEnable)
    24102410    {
     
    24492449
    24502450
    2451 #ifdef VBOX_WITH_NESTED_HWVIRT
     2451#ifdef VBOX_WITH_NESTED_HWVIRT_SVM
    24522452/**
    24532453 * Merges the guest and nested-guest MSR permission bitmap.
     
    26282628    pVmcbNstGst->guest.u64RAX    = pCtx->rax;
    26292629
    2630 #ifdef VBOX_WITH_NESTED_HWVIRT
     2630#ifdef VBOX_WITH_NESTED_HWVIRT_SVM
    26312631    Assert(!pVmcbNstGst->ctrl.IntCtrl.n.u1VGifEnable);            /* Nested VGIF not supported yet. */
    26322632#endif
     
    26602660    return rc;
    26612661}
    2662 #endif /* VBOX_WITH_NESTED_HWVIRT */
     2662#endif /* VBOX_WITH_NESTED_HWVIRT_SVM */
    26632663
    26642664
     
    27312731
    27322732    PCSVMVMCBCTRL pVmcbCtrl = &pVmcb->ctrl;
    2733 #ifdef VBOX_WITH_NESTED_HWVIRT
     2733#ifdef VBOX_WITH_NESTED_HWVIRT_SVM
    27342734    if (!CPUMIsGuestInSvmNestedHwVirtMode(pMixedCtx))
    27352735    {
     
    34953495     * VINTR intercept all being set.
    34963496     */
    3497 #ifdef VBOX_WITH_NESTED_HWVIRT
     3497#ifdef VBOX_WITH_NESTED_HWVIRT_SVM
    34983498    /*
    34993499     * Currently we don't overlay interupt windows and if there's any V_IRQ pending
     
    35473547}
    35483548
    3549 #ifdef VBOX_WITH_NESTED_HWVIRT
     3549#ifdef VBOX_WITH_NESTED_HWVIRT_SVM
    35503550/**
    35513551 * Evaluates the event to be delivered to the nested-guest and sets it as the
     
    36793679    Assert(pVmcb);
    36803680
    3681 #ifdef VBOX_WITH_NESTED_HWVIRT
     3681#ifdef VBOX_WITH_NESTED_HWVIRT_SVM
    36823682    bool const fGif       = pCtx->hwvirt.fGif;
    36833683#else
     
    40994099
    41004100
    4101 #ifdef VBOX_WITH_NESTED_HWVIRT
     4101#ifdef VBOX_WITH_NESTED_HWVIRT_SVM
    41024102/**
    41034103 * Does the preparations before executing nested-guest code in AMD-V.
     
    41204120    HMSVM_ASSERT_IN_NESTED_GUEST(pCtx);
    41214121
    4122 #ifdef VBOX_WITH_NESTED_HWVIRT_ONLY_IN_IEM
     4122#ifdef VBOX_WITH_NESTED_HWVIRT_SVM_ONLY_IN_IEM
    41234123    Log2(("hmR0SvmPreRunGuest: Rescheduling to IEM due to nested-hwvirt or forced IEM exec -> VINF_EM_RESCHEDULE_REM\n"));
    41244124    return VINF_EM_RESCHEDULE_REM;
     
    44684468
    44694469
    4470 #ifdef VBOX_WITH_NESTED_HWVIRT
     4470#ifdef VBOX_WITH_NESTED_HWVIRT_SVM
    44714471/**
    44724472 * Undoes the TSC offset applied for an SVM nested-guest and returns the TSC
     
    47904790}
    47914791
    4792 #ifdef VBOX_WITH_NESTED_HWVIRT
     4792#ifdef VBOX_WITH_NESTED_HWVIRT_SVM
    47934793/**
    47944794 * Runs the nested-guest code using AMD-V.
     
    48994899    uint32_t cLoops = 0;
    49004900    int      rc;
    4901 #ifdef VBOX_WITH_NESTED_HWVIRT
     4901#ifdef VBOX_WITH_NESTED_HWVIRT_SVM
    49024902    if (!CPUMIsGuestInSvmNestedHwVirtMode(pCtx))
    49034903#endif
     
    49084908            rc = hmR0SvmRunGuestCodeStep(pVM, pVCpu, pCtx, &cLoops);
    49094909    }
    4910 #ifdef VBOX_WITH_NESTED_HWVIRT
     4910#ifdef VBOX_WITH_NESTED_HWVIRT_SVM
    49114911    else
    49124912    {
     
    49374937
    49384938
    4939 #ifdef VBOX_WITH_NESTED_HWVIRT
     4939#ifdef VBOX_WITH_NESTED_HWVIRT_SVM
    49404940/**
    49414941 * Determines whether an IOIO intercept is active for the nested-guest or not.
     
    55545554                }
    55555555
    5556 #ifdef VBOX_WITH_NESTED_HWVIRT
     5556#ifdef VBOX_WITH_NESTED_HWVIRT_SVM
    55575557                case SVM_EXIT_CLGI:     return hmR0SvmExitClgi(pVCpu, pCtx, pSvmTransient);
    55585558                case SVM_EXIT_STGI:     return hmR0SvmExitStgi(pVCpu, pCtx, pSvmTransient);
     
    61216121
    61226122
    6123 #ifdef VBOX_WITH_NESTED_HWVIRT
     6123#ifdef VBOX_WITH_NESTED_HWVIRT_SVM
    61246124/**
    61256125 * Gets the length of the current instruction if the CPU supports the NRIP_SAVE
     
    75447544
    75457545
    7546 #if defined(HMSVM_ALWAYS_TRAP_ALL_XCPTS) || defined(VBOX_WITH_NESTED_HWVIRT)
     7546#if defined(HMSVM_ALWAYS_TRAP_ALL_XCPTS) || defined(VBOX_WITH_NESTED_HWVIRT_SVM)
    75477547/**
    75487548 * \#VMEXIT handler for generic exceptions. Conditional \#VMEXIT.
     
    75887588#endif
    75897589
    7590 #ifdef VBOX_WITH_NESTED_HWVIRT
     7590#ifdef VBOX_WITH_NESTED_HWVIRT_SVM
    75917591/**
    75927592 * \#VMEXIT handler for #PF occuring while in nested-guest execution
     
    78247824}
    78257825
    7826 #endif /* VBOX_WITH_NESTED_HWVIRT */
     7826#endif /* VBOX_WITH_NESTED_HWVIRT_SVM */
    78277827
    78287828
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