VirtualBox

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


Ignore:
Timestamp:
Sep 16, 2021 10:04:16 PM (3 years ago)
Author:
vboxsync
Message:

VMM/CPUM,++: Moved the nested SVM I/O permission bitmap allocation into CPUMCTX. bugref:10093

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

Legend:

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

    r91289 r91291  
    563563         * Copy the IO permission bitmap into the cache.
    564564         */
    565         Assert(pVCpu->cpum.GstCtx.hwvirt.svm.CTX_SUFF(pvIoBitmap));
    566         rc = PGMPhysSimpleReadGCPhys(pVM, pVCpu->cpum.GstCtx.hwvirt.svm.CTX_SUFF(pvIoBitmap), GCPhysIOBitmap,
    567                                      SVM_IOPM_PAGES * X86_PAGE_4K_SIZE);
     565        AssertCompile(sizeof(pVCpu->cpum.GstCtx.hwvirt.svm.abIoBitmap) == SVM_IOPM_PAGES * X86_PAGE_4K_SIZE);
     566        rc = PGMPhysSimpleReadGCPhys(pVM, pVCpu->cpum.GstCtx.hwvirt.svm.abIoBitmap, GCPhysIOBitmap,
     567                                     sizeof(pVCpu->cpum.GstCtx.hwvirt.svm.abIoBitmap));
    568568        if (RT_FAILURE(rc))
    569569        {
     
    989989
    990990    SVMIOIOEXITINFO IoExitInfo;
    991     void *pvIoBitmap = pVCpu->cpum.GstCtx.hwvirt.svm.CTX_SUFF(pvIoBitmap);
    992     bool const fIntercept = CPUMIsSvmIoInterceptSet(pvIoBitmap, u16Port, enmIoType, cbReg, cAddrSizeBits, iEffSeg, fRep,
    993                                                     fStrIo, &IoExitInfo);
     991    bool const fIntercept = CPUMIsSvmIoInterceptSet(pVCpu->cpum.GstCtx.hwvirt.svm.abMsrBitmap, u16Port, enmIoType, cbReg,
     992                                                    cAddrSizeBits, iEffSeg, fRep, fStrIo, &IoExitInfo);
    994993    if (fIntercept)
    995994    {
  • trunk/src/VBox/VMM/VMMR0/HMSVMR0.cpp

    r91289 r91291  
    49624962            if (CPUMIsGuestSvmCtrlInterceptSet(pVCpu, pCtx, SVM_CTRL_INTERCEPT_IOIO_PROT))
    49634963            {
    4964                 void *pvIoBitmap = pVCpu->cpum.GstCtx.hwvirt.svm.CTX_SUFF(pvIoBitmap);
    49654964                SVMIOIOEXITINFO IoExitInfo;
    49664965                IoExitInfo.u = pVmcbNstGst->ctrl.u64ExitInfo1;
    4967                 bool const fIntercept = hmR0SvmIsIoInterceptSet(pvIoBitmap, &IoExitInfo);
     4966                bool const fIntercept = hmR0SvmIsIoInterceptSet(pVCpu->cpum.GstCtx.hwvirt.svm.abIoBitmap, &IoExitInfo);
    49684967                if (fIntercept)
    49694968                    NST_GST_VMEXIT_CALL_RET(pVCpu, uExitCode, uExitInfo1, uExitInfo2);
  • trunk/src/VBox/VMM/VMMR3/CPUM.cpp

    r91289 r91291  
    10181018{
    10191019    Assert(pVM->cpum.s.GuestFeatures.fSvm);
    1020     for (VMCPUID i = 0; i < pVM->cCpus; i++)
    1021     {
    1022         PVMCPU pVCpu = pVM->apCpusR3[i];
    1023 
    1024         if (pVCpu->cpum.s.Guest.hwvirt.svm.pvIoBitmapR3)
    1025         {
    1026             SUPR3PageFreeEx(pVCpu->cpum.s.Guest.hwvirt.svm.pvIoBitmapR3, SVM_IOPM_PAGES);
    1027             pVCpu->cpum.s.Guest.hwvirt.svm.pvIoBitmapR3 = NULL;
    1028         }
    1029     }
     1020    RT_NOREF(pVM);
    10301021}
    10311022
     
    10511042        AssertCompile(SVM_VMCB_PAGES * X86_PAGE_SIZE == sizeof(pVCpu->cpum.s.Guest.hwvirt.svm.Vmcb));
    10521043        AssertCompile(SVM_MSRPM_PAGES * X86_PAGE_SIZE == sizeof(pVCpu->cpum.s.Guest.hwvirt.svm.abMsrBitmap));
    1053 
    1054         /*
    1055          * Allocate the IOPM (IO Permission bitmap).
    1056          *
    1057          * This need not be physically contiguous pages because we re-use the ring-0
    1058          * allocated IOPM while executing the nested-guest using hardware-assisted SVM
    1059          * because it's identical (we trap all IO accesses).
    1060          *
    1061          * This one is just used for caching the IOPM from guest physical memory in
    1062          * case the guest hypervisor allows direct access to some IO ports.
    1063          */
    1064         Assert(!pVCpu->cpum.s.Guest.hwvirt.svm.pvIoBitmapR3);
    1065         rc = SUPR3PageAllocEx(SVM_IOPM_PAGES, 0 /* fFlags */, &pVCpu->cpum.s.Guest.hwvirt.svm.pvIoBitmapR3,
    1066                               &pVCpu->cpum.s.Guest.hwvirt.svm.pvIoBitmapR0, NULL /* paPages */);
    1067         if (RT_FAILURE(rc))
    1068         {
    1069             Assert(!pVCpu->cpum.s.Guest.hwvirt.svm.pvIoBitmapR3);
    1070             LogRel(("CPUM%u: Failed to alloc %u pages for the nested-guest's IO permission bitmap\n", pVCpu->idCpu,
    1071                     SVM_IOPM_PAGES));
    1072             break;
    1073         }
     1044        AssertCompile(SVM_IOPM_PAGES * X86_PAGE_SIZE == sizeof(pVCpu->cpum.s.Guest.hwvirt.svm.abIoBitmap));
    10741045    }
    10751046
     
    26312602            SSMR3PutMem(pSSM,   &pGstCtx->hwvirt.svm.Vmcb,           sizeof(pGstCtx->hwvirt.svm.Vmcb));
    26322603            SSMR3PutMem(pSSM,   &pGstCtx->hwvirt.svm.abMsrBitmap[0], sizeof(pGstCtx->hwvirt.svm.abMsrBitmap));
    2633             SSMR3PutMem(pSSM,    pGstCtx->hwvirt.svm.pvIoBitmapR3,  SVM_IOPM_PAGES  << X86_PAGE_4K_SHIFT);
     2604            SSMR3PutMem(pSSM,   &pGstCtx->hwvirt.svm.abIoBitmap[0],  sizeof(pGstCtx->hwvirt.svm.abIoBitmap));
    26342605            SSMR3PutU32(pSSM,    pGstCtx->hwvirt.fLocalForcedActions);
    26352606            SSMR3PutBool(pSSM,   pGstCtx->hwvirt.fGif);
     
    29152886                        SSMR3GetStructEx(pSSM, &pGstCtx->hwvirt.svm.HostState, sizeof(pGstCtx->hwvirt.svm.HostState),
    29162887                                         0 /* fFlags */, g_aSvmHwvirtHostState, NULL /* pvUser */);
    2917                         SSMR3GetMem(pSSM,      &pGstCtx->hwvirt.svm.Vmcb,          sizeof(pGstCtx->hwvirt.svm.Vmcb));
     2888                        SSMR3GetMem(pSSM,      &pGstCtx->hwvirt.svm.Vmcb,           sizeof(pGstCtx->hwvirt.svm.Vmcb));
    29182889                        SSMR3GetMem(pSSM,      &pGstCtx->hwvirt.svm.abMsrBitmap[0], sizeof(pGstCtx->hwvirt.svm.abMsrBitmap));
    2919                         SSMR3GetMem(pSSM,       pGstCtx->hwvirt.svm.pvIoBitmapR3,  SVM_IOPM_PAGES  << X86_PAGE_4K_SHIFT);
     2890                        SSMR3GetMem(pSSM,      &pGstCtx->hwvirt.svm.abIoBitmap[0],  sizeof(pGstCtx->hwvirt.svm.abIoBitmap));
    29202891                        SSMR3GetU32(pSSM,      &pGstCtx->hwvirt.fLocalForcedActions);
    29212892                        SSMR3GetBool(pSSM,     &pGstCtx->hwvirt.fGif);
     
    41344105        pHlp->pfnPrintf(pHlp, "  cPauseFilterThreshold      = %RU32\n",     pCtx->hwvirt.svm.cPauseFilterThreshold);
    41354106        pHlp->pfnPrintf(pHlp, "  fInterceptEvents           = %u\n",        pCtx->hwvirt.svm.fInterceptEvents);
    4136         pHlp->pfnPrintf(pHlp, "  pvIoBitmapR3               = %p\n",        pCtx->hwvirt.svm.pvIoBitmapR3);
    4137         pHlp->pfnPrintf(pHlp, "  pvIoBitmapR0               = %RKv\n",      pCtx->hwvirt.svm.pvIoBitmapR0);
    41384107    }
    41394108    else if (fVmx)
  • trunk/src/VBox/VMM/include/CPUMInternal.mac

    r91289 r91291  
    233233    .Guest.hwvirt.svm.Vmcb                  resb        4096
    234234    .Guest.hwvirt.svm.abMsrBitmap           resb        8192
     235    .Guest.hwvirt.svm.abIoBitmap            resb        12288
    235236    .Guest.hwvirt.svm.uMsrHSavePa            resq         1
    236237    .Guest.hwvirt.svm.GCPhysVmcb             resq         1
     
    241242    .Guest.hwvirt.svm.cPauseFilterThreshold  resw         1
    242243    .Guest.hwvirt.svm.fInterceptEvents       resb         1
    243     alignb 8
    244     .Guest.hwvirt.svm.pvIoBitmapR0           RTR0PTR_RES  1
    245     alignb 8
    246     .Guest.hwvirt.svm.pvIoBitmapR3           RTR3PTR_RES  1
    247244
    248245    ;.unnamed_padding.1 resb 0
  • trunk/src/VBox/VMM/testcase/tstVMStruct.h

    r91289 r91291  
    130130    GEN_CHECK_OFF(CPUMCTX, hwvirt.svm.Vmcb);
    131131    GEN_CHECK_OFF(CPUMCTX, hwvirt.svm.abMsrBitmap);
     132    GEN_CHECK_OFF(CPUMCTX, hwvirt.svm.abIoBitmap);
    132133    GEN_CHECK_OFF(CPUMCTX, hwvirt.svm.uMsrHSavePa);
    133134    GEN_CHECK_OFF(CPUMCTX, hwvirt.svm.GCPhysVmcb);
     
    137138    GEN_CHECK_OFF(CPUMCTX, hwvirt.svm.cPauseFilterThreshold);
    138139    GEN_CHECK_OFF(CPUMCTX, hwvirt.svm.fInterceptEvents);
    139     GEN_CHECK_OFF(CPUMCTX, hwvirt.svm.pvIoBitmapR0);
    140     GEN_CHECK_OFF(CPUMCTX, hwvirt.svm.pvIoBitmapR3);
    141140    GEN_CHECK_OFF(CPUMCTX, hwvirt.vmx.GCPhysVmxon);
    142141    GEN_CHECK_OFF(CPUMCTX, hwvirt.vmx.GCPhysVmcs);
  • trunk/src/VBox/VMM/testcase/tstVMStructSize.cpp

    r91290 r91291  
    251251    CHECK_MEMBER_ALIGNMENT(VMCPU, cpum.s.Guest.hwvirt.svm.Vmcb, 4096);
    252252    CHECK_MEMBER_ALIGNMENT(VMCPU, cpum.s.Guest.hwvirt.svm.abMsrBitmap, 4096);
     253    CHECK_MEMBER_ALIGNMENT(VMCPU, cpum.s.Guest.hwvirt.svm.abIoBitmap, 4096);
    253254
    254255    PVM pVM = NULL; NOREF(pVM);
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