VirtualBox

Changeset 88521 in vbox


Ignore:
Timestamp:
Apr 15, 2021 10:56:57 AM (3 years ago)
Author:
vboxsync
Message:

Intel IOMMU: bugref:9967 Updates to adjust for changes in Oct 2020 and Apr 2021 Intel VT-d specs.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/iommu-intel.h

    r88518 r88521  
    775775#define VTD_BF_CAP_REG_FL5LP_SHIFT                              60
    776776#define VTD_BF_CAP_REG_FL5LP_MASK                               UINT64_C(0x1000000000000000)
    777 /** R: Reserved (bits 63:61). */
    778 #define VTD_BF_CAP_REG_RSVD_63_61_SHIFT                         61
    779 #define VTD_BF_CAP_REG_RSVD_63_61_MASK                          UINT64_C(0xe000000000000000)
     777/** R: Reserved (bit 61). */
     778#define VTD_BF_CAP_REG_RSVD_61_SHIFT                            61
     779#define VTD_BF_CAP_REG_RSVD_61_MASK                             UINT64_C(0x2000000000000000)
     780/** ESIRTPS: Enhanced Set Interrupt Root Table Pointer Support. */
     781#define VTD_BF_CAP_REG_ESIRTPS_SHIFT                            62
     782#define VTD_BF_CAP_REG_ESIRTPS_MASK                             UINT64_C(0x4000000000000000)
     783/** : Enhanced Set Root Table Pointer Support. */
     784#define VTD_BF_CAP_REG_ESRTPS_SHIFT                             63
     785#define VTD_BF_CAP_REG_ESRTPS_MASK                              UINT64_C(0x8000000000000000)
    780786RT_BF_ASSERT_COMPILE_CHECKS(VTD_BF_CAP_REG_, UINT64_C(0), UINT64_MAX,
    781787                            (ND, AFL, RWBF, PLMR, PHMR, CM, SAGAW, RSVD_15_13, MGAW, ZLR, RSVD_23, FRO, SLLPS, RSVD_38, PSI, NFR,
    782                              MAMV, DWD, DRD, FL1GP, RSVD_58_57, PI, FL5LP, RSVD_63_61));
     788                             MAMV, DWD, DRD, FL1GP, RSVD_58_57, PI, FL5LP, RSVD_61, ESIRTPS, ESRTPS));
    783789
    784790/** RW: Read/write mask. */
     
    889895#define VTD_BF_ECAP_REG_RPS_SHIFT                               49
    890896#define VTD_BF_ECAP_REG_RPS_MASK                                UINT64_C(0x0002000000000000)
    891 /** R: Reserved (bits 63:50). */
    892 #define VTD_BF_ECAP_REG_RSVD_63_50_SHIFT                        50
    893 #define VTD_BF_ECAP_REG_RSVD_63_50_MASK                         UINT64_C(0xfffc000000000000)
     897/** R: Reserved (bits 51:50). */
     898#define VTD_BF_ECAP_REG_RSVD_51_50_SHIFT                        50
     899#define VTD_BF_ECAP_REG_RSVD_51_50_MASK                         UINT64_C(0x000c000000000000)
     900/** ADMS: Abort DMA Mode Support. */
     901#define VTD_BF_ECAP_REG_ADMS_SHIFT                              52
     902#define VTD_BF_ECAP_REG_ADMS_MASK                               UINT64_C(0x0010000000000000)
     903/** RPRIVS: RID_PRIV Support. */
     904#define VTD_BF_ECAP_REG_RPRIVS_SHIFT                            53
     905#define VTD_BF_ECAP_REG_RPRIVS_MASK                             UINT64_C(0x0020000000000000)
     906/** R: Reserved (bits 63:54). */
     907#define VTD_BF_ECAP_REG_RSVD_63_54_SHIFT                        54
     908#define VTD_BF_ECAP_REG_RSVD_63_54_MASK                         UINT64_C(0xffc0000000000000)
    894909RT_BF_ASSERT_COMPILE_CHECKS(VTD_BF_ECAP_REG_, UINT64_C(0), UINT64_MAX,
    895910                            (C, QI, DT, IR, EIM, RSVD_5, PT, SC, IRO, RSVD_19_18, MHMV, RSVD_24, MTS, NEST, RSVD_27, RSVD_28,
    896911                             PRS, ERS, SRS, RSVD_32, NWFS, EAFS, PSS, PASID, DIT, PDS, SMTS, VCS, SLADS, SLTS, FLTS, SMPWCS, RPS,
    897                              RSVD_63_50));
     912                             RSVD_51_50, ADMS, RPRIVS, RSVD_63_54));
    898913
    899914/** RW: Read/write mask. */
  • trunk/src/VBox/Devices/Bus/DevIommuIntel.cpp

    r88515 r88521  
    868868    uint8_t const fSlts  = 1;                    /* Second-Level translation support. */
    869869    uint8_t const fPt    = 1;                    /* Pass-Through support. */
     870    uint8_t const fSmts  = fFlts & fSlts & fPt;  /* Scalable mode translation support.*/
    870871    uint8_t const fNest  = 0;                    /* Nested translation support. */
    871     uint8_t const fSmts  = fFlts & fSlts & fPt;  /* Scalable mode translation support.*/
    872872
    873873    /* CAP_REG */
     
    886886                                X86_PAGE_1G_SHIFT : X86_PAGE_2M_SHIFT) - X86_PAGE_4K_SHIFT;
    887887        uint8_t const fNd     = 2;                              /* Number of domains (0=16, 1=64, 2=256, 3=1K, 4=4K, 5=16K, 6=64K,
    888                                                                   7=Reserved). */
     888                                                                   7=Reserved). */
    889889        uint8_t const fPsi    = 1;                              /* Page selective invalidation. */
    890890        uint8_t const uMgaw   = cGstPhysAddrBits - 1;           /* Maximum guest address width. */
     
    892892        uint16_t const offFro = DMAR_MMIO_OFF_FRCD_LO_REG >> 4; /* MMIO offset of FRCD registers. */
    893893
    894         pThis->fCap = RT_BF_MAKE(VTD_BF_CAP_REG_ND,     fNd)
    895                     | RT_BF_MAKE(VTD_BF_CAP_REG_AFL,    0)      /* Advanced fault logging not supported. */
    896                     | RT_BF_MAKE(VTD_BF_CAP_REG_RWBF,   0)      /* Software need not flush write-buffers. */
    897                     | RT_BF_MAKE(VTD_BF_CAP_REG_PLMR,   0)      /* Protected Low-Memory Region not supported. */
    898                     | RT_BF_MAKE(VTD_BF_CAP_REG_PHMR,   0)      /* Protected High-Memory Region not supported. */
    899                     | RT_BF_MAKE(VTD_BF_CAP_REG_CM,     1)      /** @todo Figure out if required when we impl. caching. */
    900                     | RT_BF_MAKE(VTD_BF_CAP_REG_SAGAW,  fSlts & uSagaw)
    901                     | RT_BF_MAKE(VTD_BF_CAP_REG_MGAW,   uMgaw)
    902                     | RT_BF_MAKE(VTD_BF_CAP_REG_ZLR,    1)      /** @todo Figure out if/how to support zero-length reads. */
    903                     | RT_BF_MAKE(VTD_BF_CAP_REG_FRO,    offFro)
    904                     | RT_BF_MAKE(VTD_BF_CAP_REG_SLLPS,  fSlts & fSllps)
    905                     | RT_BF_MAKE(VTD_BF_CAP_REG_PSI,    fPsi)
    906                     | RT_BF_MAKE(VTD_BF_CAP_REG_NFR,    DMAR_FRCD_REG_COUNT - 1)
    907                     | RT_BF_MAKE(VTD_BF_CAP_REG_MAMV,   fPsi & fMamv)
    908                     | RT_BF_MAKE(VTD_BF_CAP_REG_DWD,    1)
    909                     | RT_BF_MAKE(VTD_BF_CAP_REG_FL1GP,  fFlts & fFl1gp)
    910                     | RT_BF_MAKE(VTD_BF_CAP_REG_PI,     0)      /* Posted Interrupts not supported. */
    911                     | RT_BF_MAKE(VTD_BF_CAP_REG_FL5LP,  fFlts & fFl5lp);
     894        pThis->fCap = RT_BF_MAKE(VTD_BF_CAP_REG_ND,      fNd)
     895                    | RT_BF_MAKE(VTD_BF_CAP_REG_AFL,     0)     /* Advanced fault logging not supported. */
     896                    | RT_BF_MAKE(VTD_BF_CAP_REG_RWBF,    0)     /* Software need not flush write-buffers. */
     897                    | RT_BF_MAKE(VTD_BF_CAP_REG_PLMR,    0)     /* Protected Low-Memory Region not supported. */
     898                    | RT_BF_MAKE(VTD_BF_CAP_REG_PHMR,    0)     /* Protected High-Memory Region not supported. */
     899                    | RT_BF_MAKE(VTD_BF_CAP_REG_CM,      1)     /** @todo Figure out if required when we impl. caching. */
     900                    | RT_BF_MAKE(VTD_BF_CAP_REG_SAGAW,   fSlts & uSagaw)
     901                    | RT_BF_MAKE(VTD_BF_CAP_REG_MGAW,    uMgaw)
     902                    | RT_BF_MAKE(VTD_BF_CAP_REG_ZLR,     1)     /** @todo Figure out if/how to support zero-length reads. */
     903                    | RT_BF_MAKE(VTD_BF_CAP_REG_FRO,     offFro)
     904                    | RT_BF_MAKE(VTD_BF_CAP_REG_SLLPS,   fSlts & fSllps)
     905                    | RT_BF_MAKE(VTD_BF_CAP_REG_PSI,     fPsi)
     906                    | RT_BF_MAKE(VTD_BF_CAP_REG_NFR,     DMAR_FRCD_REG_COUNT - 1)
     907                    | RT_BF_MAKE(VTD_BF_CAP_REG_MAMV,    fPsi & fMamv)
     908                    | RT_BF_MAKE(VTD_BF_CAP_REG_DWD,     1)
     909                    | RT_BF_MAKE(VTD_BF_CAP_REG_FL1GP,   fFlts & fFl1gp)
     910                    | RT_BF_MAKE(VTD_BF_CAP_REG_PI,      0)     /* Posted Interrupts not supported. */
     911                    | RT_BF_MAKE(VTD_BF_CAP_REG_FL5LP,   fFlts & fFl5lp)
     912                    | RT_BF_MAKE(VTD_BF_CAP_REG_ESIRTPS, 0)     /* Whether we invalidate interrupt cache on SIRTP flow. */
     913                    | RT_BF_MAKE(VTD_BF_CAP_REG_ESRTPS,  0);    /* Whether we invalidate translation cache on SRTP flow. */
    912914        dmarRegWriteRaw64(pThis, VTD_MMIO_OFF_CAP_REG, pThis->fCap);
    913915    }
     
    921923        uint8_t const  fSrs   = 1;                              /* Supervisor request support. */
    922924        uint8_t const  fEim   = 1;                              /* Extended interrupt mode.*/
     925        uint8_t const  fAdms  = 1;                              /* Abort DMA mode support. */
    923926
    924927        pThis->fExtCap = RT_BF_MAKE(VTD_BF_ECAP_REG_C,      0)  /* Accesses don't snoop CPU cache. */
     
    937940                       | RT_BF_MAKE(VTD_BF_ECAP_REG_SRS,    fSmts & fSrs)
    938941                       | RT_BF_MAKE(VTD_BF_ECAP_REG_NWFS,   0)  /* 0 as DT not supported. */
    939                        | RT_BF_MAKE(VTD_BF_ECAP_REG_EAFS,   0)  /* 0 as PASID not supported. */
     942                       | RT_BF_MAKE(VTD_BF_ECAP_REG_EAFS,   0)  /** @todo figure out if EAFS is required? */
    940943                       | RT_BF_MAKE(VTD_BF_ECAP_REG_PSS,    0)  /* 0 as PASID not supported. */
    941944                       | RT_BF_MAKE(VTD_BF_ECAP_REG_PASID,  0)  /* PASID support. */
     
    948951                       | RT_BF_MAKE(VTD_BF_ECAP_REG_FLTS,   fFlts)
    949952                       | RT_BF_MAKE(VTD_BF_ECAP_REG_SMPWCS, 0)  /* 0 as PASID not supported. */
    950                        | RT_BF_MAKE(VTD_BF_ECAP_REG_RPS,    0); /* 0 as PASID not supported. */
     953                       | RT_BF_MAKE(VTD_BF_ECAP_REG_RPS,    0)  /* We don't support RID_PASID field in SM context entry. */
     954                       | RT_BF_MAKE(VTD_BF_ECAP_REG_ADMS,   fAdms)
     955                       | RT_BF_MAKE(VTD_BF_ECAP_REG_RPRIVS, 0); /** @todo figure out if we should/can support this? */
    951956        dmarRegWriteRaw64(pThis, VTD_MMIO_OFF_ECAP_REG, pThis->fExtCap);
    952957    }
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