VirtualBox

Changeset 83237 in vbox


Ignore:
Timestamp:
Mar 10, 2020 9:28:52 AM (5 years ago)
Author:
vboxsync
Message:

Devices/Bus/DevIommuAmd: bugref:9654 Bits.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Bus/DevIommuAmd.cpp

    r83185 r83237  
    129129/** UnitID: HyperTransport Unit ID. */
    130130#define IOMMU_BF_RANGE_UNIT_ID_SHIFT                0
    131 #define IOMMU_BF_RANGE_UNIT_ID_MASK                 UINT32_C(0x0000000f)
     131#define IOMMU_BF_RANGE_UNIT_ID_MASK                 UINT32_C(0x0000001f)
    132132/** Bits 6:5 reserved. */
    133 #define IOMMU_BF_RANGE_RSVD_6_5_SHIFT               5
    134 #define IOMMU_BF_RANGE_RSVD_6_5_MASK                UINT32_C(0x00000060)
     133#define IOMMU_BF_RANGE_RSVD_5_6_SHIFT               5
     134#define IOMMU_BF_RANGE_RSVD_5_6_MASK                UINT32_C(0x00000060)
    135135/** RngValid: Range valid. */
    136136#define IOMMU_BF_RANGE_VALID_SHIFT                  7
     
    146146#define IOMMU_BF_RANGE_LAST_DEVICE_MASK             UINT32_C(0xff000000)
    147147RT_BF_ASSERT_COMPILE_CHECKS(IOMMU_BF_RANGE_, UINT32_C(0), UINT32_MAX,
    148                             (UNIT_ID, RSVD_6_15, VALID, BUS_NUMBER, FIRST_DEVICE, LAST_DEVICE));
     148                            (UNIT_ID, RSVD_5_6, VALID, BUS_NUMBER, FIRST_DEVICE, LAST_DEVICE));
    149149/** @} */
    150150
     
    156156/** MsiNum: MSI message number. */
    157157#define IOMMU_BF_MISCINFO_0_MSI_NUM_SHIFT           0
    158 #define IOMMU_BF_MISCINFO_0_MSI_NUM_MASK            UINT32_C(0x0000000f)
     158#define IOMMU_BF_MISCINFO_0_MSI_NUM_MASK            UINT32_C(0x0000001f)
    159159/** GvaSize: Guest Virtual Address Size. */
    160160#define IOMMU_BF_MISCINFO_0_GVA_SIZE_SHIFT          5
     
    176176#define IOMMU_BF_MISCINFO_0_MSI_NUM_PPR_MASK        UINT32_C(0xf8000000)
    177177RT_BF_ASSERT_COMPILE_CHECKS(IOMMU_BF_MISCINFO_0_, UINT32_C(0), UINT32_MAX,
    178                             (MSI_NUM, GVA_SIZE, PA_SIZE, VA_SIZE, HTS_ATS_RESV, RSVD_23_26, MSI_NUM_PPR));
     178                            (MSI_NUM, GVA_SIZE, PA_SIZE, VA_SIZE, HT_ATS_RESV, RSVD_23_26, MSI_NUM_PPR));
    179179/** @} */
    180180
     
    186186/** MsiNumGA: MSI message number for guest vAPIC. */
    187187#define IOMMU_BF_MISCINFO_1_MSI_NUM_GA_SHIFT        0
    188 #define IOMMU_BF_MISCINFO_1_MSI_NUM_GA_MASK         UINT32_C(0x0000000f)
     188#define IOMMU_BF_MISCINFO_1_MSI_NUM_GA_MASK         UINT32_C(0x0000001f)
    189189/** Bits 31:5 reserved. */
    190190#define IOMMU_BF_MISCINFO_1_RSVD_5_31_SHIFT         5
    191191#define IOMMU_BF_MISCINFO_1_RSVD_5_31_MASK          UINT32_C(0xffffffe0)
    192192RT_BF_ASSERT_COMPILE_CHECKS(IOMMU_BF_MISCINFO_1_, UINT32_C(0), UINT32_MAX,
    193                             (NUM_GA, RSVD_5_31));
     193                            (MSI_NUM_GA, RSVD_5_31));
    194194/** @} */
    195195
     
    229229        uint32_t    u3Mode : 3;                       /**< Bits 11:9    - Mode: Paging mode. */
    230230        uint32_t    u20PageTableRootPtrLo : 20;       /**< Bits 31:12   - Page Table Root Pointer (Lo). */
    231         uint32_t    u40PageTableRootPtrHi : 40;       /**< Bits 51:32   - Page Table Root Pointer (Hi). */
     231        uint32_t    u20PageTableRootPtrHi : 20;       /**< Bits 51:32   - Page Table Root Pointer (Hi). */
    232232        uint32_t    u1Ppr : 1;                        /**< Bit  52      - PPR: Peripheral Page Request. */
    233233        uint32_t    u1Grpr : 1;                       /**< Bit  53      - GRPR: Guest PPR Response with PASID. */
     
    375375    struct
    376376    {
    377         RT_GCC_EXTENSION uint64_t    u1Store;               /**< Bit 0       - S: Completion Store. */
    378         RT_GCC_EXTENSION uint64_t    u1Interrupt;           /**< Bit 1       - I: Completion Interrupt. */
    379         RT_GCC_EXTENSION uint64_t    u1Flush;               /**< Bit 2       - F: Flush Queue. */
    380         RT_GCC_EXTENSION uint64_t    u48StoreAddr : 48;     /**< Bits 51:3   - Store Address. */
    381         RT_GCC_EXTENSION uint64_t    u8Rsvd0 : 8;           /**< Bits 59:52  - Reserved. */
    382         RT_GCC_EXTENSION uint64_t    u4OpCode : 4;          /**< Bits 63:60  - OpCode (Command). */
    383         uint64_t                     u64StoreData;          /**< Bits 127:64 - Store Data. */
     377        uint32_t    u1Store : 1;           /**< Bit 0       - S: Completion Store. */
     378        uint32_t    u1Interrupt : 1;       /**< Bit 1       - I: Completion Interrupt. */
     379        uint32_t    u1Flush : 1;           /**< Bit 2       - F: Flush Queue. */
     380        uint32_t    u29StoreAddrLo : 29;   /**< Bits 31:3   - Store Address (Lo). */
     381        uint32_t    u20StoreAddrHi : 20;   /**< Bits 51:32  - Store Address (Hi). */
     382        uint32_t    u8Rsvd0 : 8;           /**< Bits 59:52  - Reserved. */
     383        uint32_t    u4OpCode : 4;          /**< Bits 63:60  - OpCode (Command). */
     384        uint64_t    u64StoreData;          /**< Bits 127:64 - Store Data. */
    384385    } n;
    385386    /** The 64-bit unsigned integer view. */
    386     uint64_t    au64[2];
     387    uint32_t    au64[2];
    387388} CMD_COMPLETION_WAIT_T;
    388389AssertCompileSize(CMD_COMPLETION_WAIT_T, 16);
     
    489490        uint16_t    u16DeviceId;            /**< Bits 15:0    - Device ID. */
    490491        uint16_t    u16Rsvd0;               /**< Bits 31:16   - Reserved. */
    491         uint32_t    u20Pasid;               /**< Bits 51:32   - PASID: Process Address-Space ID. */
    492         uint32_t    u8Rsvd0;                /**< Bits 59:52   - Reserved. */
    493         uint32_t    u4OpCode;               /**< Bits 63:60   - Op Code (Command). */
     492        uint32_t    u20Pasid : 20;          /**< Bits 51:32   - PASID: Process Address-Space ID. */
     493        uint32_t    u8Rsvd0 : 8;            /**< Bits 59:52   - Reserved. */
     494        uint32_t    u4OpCode : 4;           /**< Bits 63:60   - Op Code (Command). */
    494495        uint32_t    u2Rsvd0 : 2;            /**< Bits 65:64   - Reserved. */
    495496        uint32_t    u1GuestOrNested : 1;    /**< Bit  66      - GN: Guest (GPA) or Nested (GVA). */
    496497        uint32_t    u29Rsvd0 : 29;          /**< Bits 95:67   - Reserved. */
    497         uint16_t    u16CompletionTag;       /**< Bits 111:96  - Completion Tag. */
    498         uint16_t    u16Rsvd0;               /**< Bits 127:112 - Reserved. */
     498        uint32_t    u16CompletionTag : 16;  /**< Bits 111:96  - Completion Tag. */
     499        uint32_t    u16Rsvd1 : 16;          /**< Bits 127:112 - Reserved. */
    499500    } n;
    500501    /** The 64-bit unsigned integer view. */
     
    557558        uint16_t    u1Rsvd0 : 1;            /**< Bit  52     - Reserved. */
    558559        uint16_t    u1ReadWrite : 1;        /**< Bit  53     - RW: Read/Write. */
    559         uint16_t    u1Rsvd0 : 1;            /**< Bit  54     - Reserved. */
     560        uint16_t    u1Rsvd1 : 1;            /**< Bit  54     - Reserved. */
    560561        uint16_t    u1RsvdZero : 1;         /**< Bit  55     - RZ: Reserved bit not Zero or invalid level encoding. */
    561562        uint16_t    u1Translation : 1;      /**< Bit  56     - TN: Translation. */
     
    768769
    769770
     771/**
     772 * The IOMMU device state.
     773 */
     774typedef struct IOMMU
     775{
     776
     777} IOMMU;
     778/** Pointer to the IOMMU device state. */
     779typedef struct IOMMU *PIOMMU;
     780
     781/**
     782 * The ring-3 IOMMU device state.
     783 */
     784typedef struct IOMMUR3
     785{
     786} IOMMUR3;
     787/** Pointer to the ring-3 IOMMU device state. */
     788typedef IOMMUR3 *PIOMMUR3;
     789
     790/**
     791 * The ring-0 IOMMU device state.
     792 */
     793typedef struct IOMMUR0
     794{
     795    uint64_t        uUnused;
     796} IOMMUR0;
     797/** Pointer to the ring-0 IOMMU device state. */
     798typedef IOMMUR0 *PIOMMUR0;
     799
     800/**
     801 * The raw-mode IOMMU device state.
     802 */
     803typedef struct IOMMURC
     804{
     805    uint64_t        uUnused;
     806} IOMMURC;
     807/** Pointer to the raw-mode IOMMU device state. */
     808typedef IOMMURC *PIOMMURC;
     809
     810/** The IOMMU device state for the current context. */
     811typedef CTX_SUFF(IOMMU) IOMMUCC;
     812/** Pointer to the IOMMU device state for the current context. */
     813typedef CTX_SUFF(PIOMMU) PIOMMUCC;
     814
     815
    770816#ifndef VBOX_DEVICE_STRUCT_TESTCASE
     817
     818# ifdef IN_RING3
     819/**
     820 * @interface_method_impl{PDMDEVREG,pfnDestruct}
     821 */
     822static DECLCALLBACK(int) iommuR3Destruct(PPDMDEVINS pDevIns)
     823{
     824    return VINF_SUCCESS;
     825}
     826
     827
     828/**
     829 * @interface_method_impl{PDMDEVREG,pfnConstruct}
     830 */
     831static DECLCALLBACK(int) iommuR3Construct(PPDMDEVINS pDevIns, int iInstance, PCFGMNODE pCfg)
     832{
     833    PDMDEV_CHECK_VERSIONS_RETURN(pDevIns);
     834    PIOMMU          pThis   = PDMDEVINS_2_DATA(pDevIns, PIOMMU);
     835    PIOMMUCC        pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PIOMMUCC);
     836    PCPDMDEVHLPR3   pHlp    = pDevIns->pHlpR3;
     837    int             rc;
     838    LogFlowFunc(("\n"));
     839
     840    /*
     841     * Validate and read the configuration.
     842     */
     843    //PDMDEV_VALIDATE_CONFIG_RETURN(pDevIns, "", "");
     844    return VINF_SUCCESS;
     845}
     846
     847# else  /* !IN_RING3 */
     848
     849/**
     850 * @callback_method_impl{PDMDEVREGR0,pfnConstruct}
     851 */
     852static DECLCALLBACK(int) iommuRZConstruct(PPDMDEVINS pDevIns)
     853{
     854    PDMDEV_CHECK_VERSIONS_RETURN(pDevIns);
     855    return VINF_SUCCESS;
     856}
     857
     858# endif /* !IN_RING3 */
     859
    771860/**
    772861 * The device registration structure.
     
    777866    /* .uReserved0 = */             0,
    778867    /* .szName = */                 "iommu",
    779     /* .fFlags = */                 /** @todo IOMMU: figure out flags. */,
    780     /* .fClass = */                 PDM_DEVREG_CLASS_ARCH, /** @todo IOMMU: We want to be instantiated
    781                                                                before PDM_DEVREG_CLASS_BUS_PCI? Maybe doesn't matter? */
     868    /* .fFlags = */                 PDM_DEVREG_FLAGS_DEFAULT_BITS | PDM_DEVREG_FLAGS_RZ | PDM_DEVREG_FLAGS_NEW_STYLE,
     869    /* .fClass = */                 PDM_DEVREG_CLASS_BUS_PCI, /** @todo IOMMU: We want to be instantiated
     870                                                                   before PDM_DEVREG_CLASS_BUS_PCI? Maybe doesn't matter? */
    782871    /* .cMaxInstances = */          ~0U,
    783872    /* .uSharedVersion = */         42,
    784     /* .cbInstanceShared = */       sizeof(),   /** @todo IOMMU: compute. */
    785     /* .cbInstanceCC = */           sizeof(),   /** @todo IOMMU: compute. */
    786     /* .cbInstanceRC = */           sizeof(),   /** @todo IOMMU: compute. */
     873    /* .cbInstanceShared = */       sizeof(IOMMU),
     874    /* .cbInstanceCC = */           sizeof(IOMMUCC),
     875    /* .cbInstanceRC = */           sizeof(IOMMURC),
    787876    /* .cMaxPciDevices = */         1,
    788877    /* .cMaxMsixVectors = */        0,
     
    844933
    845934#endif /* !VBOX_DEVICE_STRUCT_TESTCASE */
     935
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