VirtualBox

Changeset 64115 in vbox for trunk/src/VBox/VMM/include


Ignore:
Timestamp:
Sep 30, 2016 8:14:27 PM (9 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
111072
Message:

PDM,IOM,PGM: Morphed the MMIO2 API into a mixed MMIO2 and pre-registered MMIO API that is able to deal with really large (<= 64GB) MMIO ranges. Limited testing, so back out at first sign of trouble.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/include/PGMInternal.h

    r63640 r64115  
    15391539/** Ad hoc RAM range for an MMIO mapping. */
    15401540#define PGM_RAM_RANGE_FLAGS_AD_HOC_MMIO     RT_BIT(22)
    1541 /** Ad hoc RAM range for an MMIO2 mapping. */
    1542 #define PGM_RAM_RANGE_FLAGS_AD_HOC_MMIO  RT_BIT(23)
     1541/** Ad hoc RAM range for an MMIO2 or pre-registered MMIO mapping. */
     1542#define PGM_RAM_RANGE_FLAGS_AD_HOC_MMIO_EX  RT_BIT(23)
    15431543/** @} */
    15441544
     
    15481548 */
    15491549#define PGM_RAM_RANGE_IS_AD_HOC(pRam) \
    1550     (!!( (pRam)->fFlags & (PGM_RAM_RANGE_FLAGS_AD_HOC_ROM | PGM_RAM_RANGE_FLAGS_AD_HOC_MMIO | PGM_RAM_RANGE_FLAGS_AD_HOC_MMIO2) ) )
     1550    (!!( (pRam)->fFlags & (PGM_RAM_RANGE_FLAGS_AD_HOC_ROM | PGM_RAM_RANGE_FLAGS_AD_HOC_MMIO | PGM_RAM_RANGE_FLAGS_AD_HOC_MMIO_EX) ) )
    15511551
    15521552/** The number of entries in the RAM range TLBs (there is one for each
     
    16881688
    16891689/**
    1690  * A registered MMIO2 (= Device RAM) range.
    1691  *
    1692  * There are a few reason why we need to keep track of these
    1693  * registrations.  One of them is the deregistration & cleanup stuff,
    1694  * while another is that the PGMRAMRANGE associated with such a region may
    1695  * have to be removed from the ram range list.
    1696  *
    1697  * Overlapping with a RAM range has to be 100% or none at all.  The pages
    1698  * in the existing RAM range must not be ROM nor MMIO.  A guru meditation
    1699  * will be raised if a partial overlap or an overlap of ROM pages is
    1700  * encountered.  On an overlap we will free all the existing RAM pages and
    1701  * put in the ram range pages instead.
    1702  */
    1703 typedef struct PGMMMIO2RANGE
     1690 * A registered MMIO2 (= Device RAM) or pre-registered MMIO range.
     1691 *
     1692 * There are a few reason why we need to keep track of these registrations.  One
     1693 * of them is the deregistration & cleanup stuff, while another is that the
     1694 * PGMRAMRANGE associated with such a region may have to be removed from the ram
     1695 * range list.
     1696 *
     1697 * Overlapping with a RAM range has to be 100% or none at all.  The pages in the
     1698 * existing RAM range must not be ROM nor MMIO.  A guru meditation will be
     1699 * raised if a partial overlap or an overlap of ROM pages is encountered.  On an
     1700 * overlap we will free all the existing RAM pages and put in the ram range
     1701 * pages instead.
     1702 */
     1703typedef struct PGMREGMMIORANGE
    17041704{
    17051705    /** The owner of the range. (a device) */
    17061706    PPDMDEVINSR3                        pDevInsR3;
    1707     /** Pointer to the ring-3 mapping of the allocation. */
     1707    /** Pointer to the ring-3 mapping of the allocation, if MMIO2. */
    17081708    RTR3PTR                             pvR3;
    17091709    /** Pointer to the next range - R3. */
    1710     R3PTRTYPE(struct PGMMMIO2RANGE *)   pNextR3;
     1710    R3PTRTYPE(struct PGMREGMMIORANGE *) pNextR3;
     1711    /** Whether this is MMIO2 or plain MMIO. */
     1712    bool                                fMmio2;
    17111713    /** Whether it's mapped or not. */
    17121714    bool                                fMapped;
     
    17221724    uint8_t                             idMmio2;
    17231725    /** Alignment padding for putting the ram range on a PGMPAGE alignment boundary. */
    1724     uint8_t                             abAlignment[HC_ARCH_BITS == 32 ? 11 : 11];
    1725     /** Live save per page tracking data. */
     1726    uint8_t                             abAlignment[HC_ARCH_BITS == 32 ? 6 : 2];
     1727    /** Pointer to the physical handler for MMIO. */
     1728    R3PTRTYPE(PPGMPHYSHANDLER)          pPhysHandlerR3;
     1729    /** Live save per page tracking data for MMIO2. */
    17261730    R3PTRTYPE(PPGMLIVESAVEMMIO2PAGE)    paLSPages;
    17271731    /** The associated RAM range. */
    17281732    PGMRAMRANGE                         RamRange;
    1729 } PGMMMIO2RANGE;
    1730 /** Pointer to a MMIO2 range. */
    1731 typedef PGMMMIO2RANGE *PPGMMMIO2RANGE;
     1733} PGMREGMMIORANGE;
     1734AssertCompileMemberAlignment(PGMREGMMIORANGE, RamRange, 16);
     1735/** Pointer to a MMIO2 or pre-registered MMIO range. */
     1736typedef PGMREGMMIORANGE *PPGMREGMMIORANGE;
    17321737
    17331738/** @name Internal MMIO2 constants.
     
    17361741#define PGM_MMIO2_MAX_RANGES                        8
    17371742/** The maximum number of pages in a MMIO2 range. */
    1738 #define PGM_MMIO2_MAX_PAGE_COUNT                    UINT32_C(0x00ffffff)
     1743#define PGM_MMIO2_MAX_PAGE_COUNT                    UINT32_C(0x01000000)
    17391744/** Makes a MMIO2 page ID out of a MMIO2 range ID and page index number. */
    17401745#define PGM_MMIO2_PAGEID_MAKE(a_idMmio2, a_iPage)   ( ((uint32_t)(a_idMmio2) << 24) | (uint32_t)(a_iPage) )
     
    33083313    /** Pointer to the list of MMIO2 ranges - for R3.
    33093314     * Registration order. */
    3310     R3PTRTYPE(PPGMMMIO2RANGE)       pMmio2RangesR3;
     3315    R3PTRTYPE(PPGMREGMMIORANGE)     pRegMmioRangesR3;
    33113316    /** Pointer to SHW+GST mode data (function pointers).
    33123317     * The index into this table is made up from */
     
    33143319    RTR3PTR                         R3PtrAlignment0;
    33153320    /** MMIO2 lookup array for ring-3.  Indexed by idMmio2 minus 1. */
    3316     R3PTRTYPE(PPGMMMIO2RANGE)       apMmio2RangesR3[PGM_MMIO2_MAX_RANGES];
     3321    R3PTRTYPE(PPGMREGMMIORANGE)     apMmio2RangesR3[PGM_MMIO2_MAX_RANGES];
    33173322
    33183323    /** RAM range TLB for R0. */
     
    33343339    R0PTRTYPE(PPGMROMRANGE)         pRomRangesR0;
    33353340    RTR0PTR                         R0PtrAlignment0;
    3336     /** MMIO2 lookup array for ring-3.  Indexed by idMmio2 minus 1. */
    3337     R0PTRTYPE(PPGMMMIO2RANGE)       apMmio2RangesR0[PGM_MMIO2_MAX_RANGES];
     3341    /** MMIO2 lookup array for ring-0.  Indexed by idMmio2 minus 1. */
     3342    R0PTRTYPE(PPGMREGMMIORANGE)     apMmio2RangesR0[PGM_MMIO2_MAX_RANGES];
    33383343
    33393344    /** RAM range TLB for RC. */
     
    41394144DECLCALLBACK(void) pgmR3MapInfo(PVM pVM, PCDBGFINFOHLP pHlp, const char *pszArgs);
    41404145
     4146int             pgmHandlerPhysicalExCreate(PVM pVM, PGMPHYSHANDLERTYPE hType, RTR3PTR pvUserR3, RTR0PTR pvUserR0,
     4147                                           RTRCPTR pvUserRC, R3PTRTYPE(const char *) pszDesc, PPGMPHYSHANDLER *ppPhysHandler);
     4148int             pgmHandlerPhysicalExRegister(PVM pVM, PPGMPHYSHANDLER pPhysHandler, RTGCPHYS GCPhys, RTGCPHYS GCPhysLast);
     4149int             pgmHandlerPhysicalExDeregister(PVM pVM, PPGMPHYSHANDLER pPhysHandler);
     4150int             pgmHandlerPhysicalExDestroy(PVM pVM, PPGMPHYSHANDLER pHandler);
    41414151void            pgmR3HandlerPhysicalUpdateAll(PVM pVM);
    41424152bool            pgmHandlerPhysicalIsAll(PVM pVM, RTGCPHYS GCPhys);
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette