VirtualBox

Changeset 81938 in vbox for trunk/include


Ignore:
Timestamp:
Nov 18, 2019 12:14:05 PM (5 years ago)
Author:
vboxsync
Message:

DevIoApic,PDM: Refactored the IOAPIC registration to be done directly for each context. Converted CFGM calls. Use default device prefix for statistics. bugref:9218

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/vmm/pdmdev.h

    r81928 r81938  
    14361436
    14371437/**
    1438  * I/O APIC registration structure.
     1438 * I/O APIC registration structure (all contexts).
    14391439 */
    14401440typedef struct PDMIOAPICREG
     
    14541454     *          Actually, as per 2018-07-21 this isn't true (bird).
    14551455     */
    1456     DECLR3CALLBACKMEMBER(void, pfnSetIrqR3,(PPDMDEVINS pDevIns, int iIrq, int iLevel, uint32_t uTagSrc));
    1457 
    1458     /** The name of the RC SetIrq entry point. */
    1459     const char         *pszSetIrqRC;
    1460 
    1461     /** The name of the R0 SetIrq entry point. */
    1462     const char         *pszSetIrqR0;
     1456    DECLCALLBACKMEMBER(void, pfnSetIrq)(PPDMDEVINS pDevIns, int iIrq, int iLevel, uint32_t uTagSrc);
    14631457
    14641458    /**
     
    14731467     *          Actually, as per 2018-07-21 this isn't true (bird).
    14741468     */
    1475     DECLR3CALLBACKMEMBER(void, pfnSendMsiR3,(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, uint32_t uValue, uint32_t uTagSrc));
    1476 
    1477     /** The name of the RC SendMsi entry point. */
    1478     const char         *pszSendMsiRC;
    1479 
    1480     /** The name of the R0 SendMsi entry point. */
    1481     const char         *pszSendMsiR0;
     1469    DECLCALLBACKMEMBER(void, pfnSendMsi)(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, uint32_t uValue, uint32_t uTagSrc);
    14821470
    14831471    /**
     
    14941482     *          Actually, as per 2018-07-21 this isn't true (bird).
    14951483     */
    1496     DECLR3CALLBACKMEMBER(int, pfnSetEoiR3,(PPDMDEVINS pDevIns, uint8_t u8Vector));
    1497 
    1498     /** The name of the RC SetEoi entry point. */
    1499     const char         *pszSetEoiRC;
    1500 
    1501     /** The name of the R0 SetEoi entry point. */
    1502     const char         *pszSetEoiR0;
     1484    DECLCALLBACKMEMBER(int, pfnSetEoi)(PPDMDEVINS pDevIns, uint8_t u8Vector);
     1485
     1486    /** Just a safety precaution. */
     1487    uint32_t                u32TheEnd;
    15031488} PDMIOAPICREG;
    15041489/** Pointer to an APIC registration structure. */
     
    15061491
    15071492/** Current PDMAPICREG version number. */
    1508 #define PDM_IOAPICREG_VERSION                   PDM_VERSION_MAKE(0xfff2, 5, 0)
    1509 
    1510 
    1511 /**
    1512  * IOAPIC RC helpers.
    1513  */
    1514 typedef struct PDMIOAPICHLPRC
    1515 {
    1516     /** Structure version. PDM_IOAPICHLPRC_VERSION defines the current version. */
     1493#define PDM_IOAPICREG_VERSION                   PDM_VERSION_MAKE(0xfff2, 6, 0)
     1494
     1495
     1496/**
     1497 * IOAPIC helpers, same in all contexts.
     1498 */
     1499typedef struct PDMIOAPICHLP
     1500{
     1501    /** Structure version. PDM_IOAPICHLP_VERSION defines the current version. */
    15171502    uint32_t                u32Version;
    15181503
     
    15321517     * @param   uTagSrc         The IRQ tag and source (for tracing).
    15331518     */
    1534     DECLRCCALLBACKMEMBER(int, pfnApicBusDeliver,(PPDMDEVINS pDevIns, uint8_t u8Dest, uint8_t u8DestMode, uint8_t u8DeliveryMode,
    1535                                                   uint8_t uVector, uint8_t u8Polarity, uint8_t u8TriggerMode, uint32_t uTagSrc));
     1519    DECLCALLBACKMEMBER(int, pfnApicBusDeliver)(PPDMDEVINS pDevIns, uint8_t u8Dest, uint8_t u8DestMode, uint8_t u8DeliveryMode,
     1520                                               uint8_t uVector, uint8_t u8Polarity, uint8_t u8TriggerMode, uint32_t uTagSrc);
    15361521
    15371522    /**
     
    15431528     * @param   rc              What to return if we fail to acquire the lock.
    15441529     */
    1545     DECLRCCALLBACKMEMBER(int,   pfnLock,(PPDMDEVINS pDevIns, int rc));
     1530    DECLCALLBACKMEMBER(int,   pfnLock)(PPDMDEVINS pDevIns, int rc);
    15461531
    15471532    /**
     
    15501535     * @param   pDevIns         The IOAPIC device instance.
    15511536     */
    1552     DECLRCCALLBACKMEMBER(void,  pfnUnlock,(PPDMDEVINS pDevIns));
     1537    DECLCALLBACKMEMBER(void,  pfnUnlock)(PPDMDEVINS pDevIns);
    15531538
    15541539    /** Just a safety precaution. */
    15551540    uint32_t                u32TheEnd;
    1556 } PDMIOAPICHLPRC;
    1557 /** Pointer to IOAPIC RC helpers. */
    1558 typedef RCPTRTYPE(PDMIOAPICHLPRC *) PPDMIOAPICHLPRC;
     1541} PDMIOAPICHLP;
     1542/** Pointer to IOAPIC helpers. */
     1543typedef PDMIOAPICHLP * PPDMIOAPICHLP;
    15591544/** Pointer to const IOAPIC helpers. */
    1560 typedef RCPTRTYPE(const PDMIOAPICHLPRC *) PCPDMIOAPICHLPRC;
    1561 
    1562 /** Current PDMIOAPICHLPRC version number. */
    1563 #define PDM_IOAPICHLPRC_VERSION                 PDM_VERSION_MAKE(0xfff1, 2, 0)
    1564 
    1565 
    1566 /**
    1567  * IOAPIC R0 helpers.
    1568  */
    1569 typedef struct PDMIOAPICHLPR0
    1570 {
    1571     /** Structure version. PDM_IOAPICHLPR0_VERSION defines the current version. */
    1572     uint32_t                u32Version;
    1573 
    1574     /**
    1575      * Private interface between the IOAPIC and APIC.
    1576      *
    1577      * See comments about this hack on PDMAPICREG::pfnBusDeliverR3.
    1578      *
    1579      * @returns status code.
    1580      * @param   pDevIns         Device instance of the IOAPIC.
    1581      * @param   u8Dest          See APIC implementation.
    1582      * @param   u8DestMode      See APIC implementation.
    1583      * @param   u8DeliveryMode  See APIC implementation.
    1584      * @param   uVector         See APIC implementation.
    1585      * @param   u8Polarity      See APIC implementation.
    1586      * @param   u8TriggerMode   See APIC implementation.
    1587      * @param   uTagSrc         The IRQ tag and source (for tracing).
    1588      */
    1589     DECLR0CALLBACKMEMBER(int, pfnApicBusDeliver,(PPDMDEVINS pDevIns, uint8_t u8Dest, uint8_t u8DestMode, uint8_t u8DeliveryMode,
    1590                                                   uint8_t uVector, uint8_t u8Polarity, uint8_t u8TriggerMode, uint32_t uTagSrc));
    1591 
    1592     /**
    1593      * Acquires the PDM lock.
    1594      *
    1595      * @returns VINF_SUCCESS on success.
    1596      * @returns rc if we failed to acquire the lock.
    1597      * @param   pDevIns         The IOAPIC device instance.
    1598      * @param   rc              What to return if we fail to acquire the lock.
    1599      */
    1600     DECLR0CALLBACKMEMBER(int,   pfnLock,(PPDMDEVINS pDevIns, int rc));
    1601 
    1602     /**
    1603      * Releases the PDM lock.
    1604      *
    1605      * @param   pDevIns         The IOAPIC device instance.
    1606      */
    1607     DECLR0CALLBACKMEMBER(void,  pfnUnlock,(PPDMDEVINS pDevIns));
    1608 
    1609     /** Just a safety precaution. */
    1610     uint32_t                u32TheEnd;
    1611 } PDMIOAPICHLPR0;
    1612 /** Pointer to IOAPIC R0 helpers. */
    1613 typedef R0PTRTYPE(PDMIOAPICHLPR0 *) PPDMIOAPICHLPR0;
    1614 /** Pointer to const IOAPIC helpers. */
    1615 typedef R0PTRTYPE(const PDMIOAPICHLPR0 *) PCPDMIOAPICHLPR0;
    1616 
    1617 /** Current PDMIOAPICHLPR0 version number. */
    1618 #define PDM_IOAPICHLPR0_VERSION                 PDM_VERSION_MAKE(0xfff0, 2, 0)
    1619 
    1620 /**
    1621  * IOAPIC R3 helpers.
    1622  */
    1623 typedef struct PDMIOAPICHLPR3
    1624 {
    1625     /** Structure version. PDM_IOAPICHLPR3_VERSION defines the current version. */
    1626     uint32_t                u32Version;
    1627 
    1628     /**
    1629      * Private interface between the IOAPIC and APIC.
    1630      *
    1631      * See comments about this hack on PDMAPICREG::pfnBusDeliverR3.
    1632      *
    1633      * @returns status code
    1634      * @param   pDevIns         Device instance of the IOAPIC.
    1635      * @param   u8Dest          See APIC implementation.
    1636      * @param   u8DestMode      See APIC implementation.
    1637      * @param   u8DeliveryMode  See APIC implementation.
    1638      * @param   uVector         See APIC implementation.
    1639      * @param   u8Polarity      See APIC implementation.
    1640      * @param   u8TriggerMode   See APIC implementation.
    1641      * @param   uTagSrc         The IRQ tag and source (for tracing).
    1642      */
    1643     DECLR3CALLBACKMEMBER(int, pfnApicBusDeliver,(PPDMDEVINS pDevIns, uint8_t u8Dest, uint8_t u8DestMode, uint8_t u8DeliveryMode,
    1644                                                   uint8_t uVector, uint8_t u8Polarity, uint8_t u8TriggerMode, uint32_t uTagSrc));
    1645 
    1646     /**
    1647      * Acquires the PDM lock.
    1648      *
    1649      * @returns VINF_SUCCESS on success.
    1650      * @returns Fatal error on failure.
    1651      * @param   pDevIns         The IOAPIC device instance.
    1652      * @param   rc              Dummy for making the interface identical to the GC and R0 versions.
    1653      */
    1654     DECLR3CALLBACKMEMBER(int,   pfnLock,(PPDMDEVINS pDevIns, int rc));
    1655 
    1656     /**
    1657      * Releases the PDM lock.
    1658      *
    1659      * @param   pDevIns         The IOAPIC device instance.
    1660      */
    1661     DECLR3CALLBACKMEMBER(void,  pfnUnlock,(PPDMDEVINS pDevIns));
    1662 
    1663     /**
    1664      * Gets the address of the RC IOAPIC helpers.
    1665      *
    1666      * This should be called at both construction and relocation time
    1667      * to obtain the correct address of the RC helpers.
    1668      *
    1669      * @returns RC pointer to the IOAPIC helpers.
    1670      * @param   pDevIns         Device instance of the IOAPIC.
    1671      */
    1672     DECLR3CALLBACKMEMBER(PCPDMIOAPICHLPRC, pfnGetRCHelpers,(PPDMDEVINS pDevIns));
    1673 
    1674     /**
    1675      * Gets the address of the R0 IOAPIC helpers.
    1676      *
    1677      * This should be called at both construction and relocation time
    1678      * to obtain the correct address of the R0 helpers.
    1679      *
    1680      * @returns R0 pointer to the IOAPIC helpers.
    1681      * @param   pDevIns         Device instance of the IOAPIC.
    1682      */
    1683     DECLR3CALLBACKMEMBER(PCPDMIOAPICHLPR0, pfnGetR0Helpers,(PPDMDEVINS pDevIns));
    1684 
    1685     /** Just a safety precaution. */
    1686     uint32_t                u32TheEnd;
    1687 } PDMIOAPICHLPR3;
    1688 /** Pointer to IOAPIC R3 helpers. */
    1689 typedef R3PTRTYPE(PDMIOAPICHLPR3 *) PPDMIOAPICHLPR3;
    1690 /** Pointer to const IOAPIC helpers. */
    1691 typedef R3PTRTYPE(const PDMIOAPICHLPR3 *) PCPDMIOAPICHLPR3;
    1692 
    1693 /** Current PDMIOAPICHLPR3 version number. */
    1694 #define PDM_IOAPICHLPR3_VERSION                 PDM_VERSION_MAKE(0xffef, 2, 0)
     1545typedef const PDMIOAPICHLP * PCPDMIOAPICHLP;
     1546
     1547/** Current PDMIOAPICHLP version number. */
     1548#define PDM_IOAPICHLP_VERSION                   PDM_VERSION_MAKE(0xfff0, 2, 0)
    16951549
    16961550
     
    21441998
    21451999/** Current PDMDEVHLPR3 version number. */
    2146 #define PDM_DEVHLPR3_VERSION                    PDM_VERSION_MAKE_PP(0xffe7, 35, 0)
     2000#define PDM_DEVHLPR3_VERSION                    PDM_VERSION_MAKE_PP(0xffe7, 36, 0)
    21472001
    21482002/**
     
    39193773     * @param   pDevIns             The device instance.
    39203774     * @param   pIoApicReg          Pointer to a I/O APIC registration structure.
    3921      * @param   ppIoApicHlpR3       Where to store the pointer to the IOAPIC
     3775     * @param   ppIoApicHlp         Where to store the pointer to the IOAPIC
    39223776     *                              helpers.
    39233777     */
    3924     DECLR3CALLBACKMEMBER(int, pfnIOAPICRegister,(PPDMDEVINS pDevIns, PPDMIOAPICREG pIoApicReg, PCPDMIOAPICHLPR3 *ppIoApicHlpR3));
     3778    DECLR3CALLBACKMEMBER(int, pfnIoApicRegister,(PPDMDEVINS pDevIns, PPDMIOAPICREG pIoApicReg, PCPDMIOAPICHLP *ppIoApicHlp));
    39253779
    39263780    /**
     
    48234677
    48244678    /**
    4825      * Sets up the PIC for the raw-mode context.
     4679     * Sets up the PIC for the ring-0 context.
    48264680     *
    48274681     * This must be called after ring-3 has registered the PIC using
     
    48324686     * @param   pPicReg     The PIC registration information for ring-0,
    48334687     *                      considered volatile and copied.
    4834      * @param   ppPicHlp    Where to return the raw-mode PIC helpers.
    4835      */
    4836     DECLRCCALLBACKMEMBER(int, pfnPCISetUpContext,(PPDMDEVINS pDevIns, PPDMPICREG pPicReg, PCPDMPICHLP *ppPicHlp));
     4688     * @param   ppPicHlp    Where to return the ring-0 PIC helpers.
     4689     */
     4690    DECLR0CALLBACKMEMBER(int, pfnPICSetUpContext,(PPDMDEVINS pDevIns, PPDMPICREG pPicReg, PCPDMPICHLP *ppPicHlp));
     4691
     4692    /**
     4693     * Sets up the IOAPIC for the ring-0 context.
     4694     *
     4695     * This must be called after ring-3 has registered the PIC using
     4696     * PDMDevHlpIoApicRegister().
     4697     *
     4698     * @returns VBox status code.
     4699     * @param   pDevIns     The device instance.
     4700     * @param   pIoApicReg  The PIC registration information for ring-0,
     4701     *                      considered volatile and copied.
     4702     * @param   ppIoApicHlp Where to return the ring-0 IOAPIC helpers.
     4703     */
     4704    DECLR0CALLBACKMEMBER(int, pfnIoApicSetUpContext,(PPDMDEVINS pDevIns, PPDMIOAPICREG pIoApicReg, PCPDMIOAPICHLP *ppIoApicHlp));
    48374705
    48384706    /** Space reserved for future members.
     
    48594727
    48604728/** Current PDMDEVHLP version number. */
    4861 #define PDM_DEVHLPRC_VERSION                    PDM_VERSION_MAKE(0xffe6, 11, 0)
     4729#define PDM_DEVHLPRC_VERSION                    PDM_VERSION_MAKE(0xffe6, 12, 0)
    48624730
    48634731
     
    53155183    DECLR0CALLBACKMEMBER(int, pfnPICSetUpContext,(PPDMDEVINS pDevIns, PPDMPICREG pPicReg, PCPDMPICHLP *ppPicHlp));
    53165184
     5185    /**
     5186     * Sets up the IOAPIC for the ring-0 context.
     5187     *
     5188     * This must be called after ring-3 has registered the PIC using
     5189     * PDMDevHlpIoApicRegister().
     5190     *
     5191     * @returns VBox status code.
     5192     * @param   pDevIns     The device instance.
     5193     * @param   pIoApicReg  The PIC registration information for ring-0,
     5194     *                      considered volatile and copied.
     5195     * @param   ppIoApicHlp Where to return the ring-0 IOAPIC helpers.
     5196     */
     5197    DECLR0CALLBACKMEMBER(int, pfnIoApicSetUpContext,(PPDMDEVINS pDevIns, PPDMIOAPICREG pIoApicReg, PCPDMIOAPICHLP *ppIoApicHlp));
     5198
    53175199    /** Space reserved for future members.
    53185200     * @{ */
     
    53385220
    53395221/** Current PDMDEVHLP version number. */
    5340 #define PDM_DEVHLPR0_VERSION                    PDM_VERSION_MAKE(0xffe5, 12, 0)
     5222#define PDM_DEVHLPR0_VERSION                    PDM_VERSION_MAKE(0xffe5, 13, 0)
    53415223
    53425224
     
    78257707
    78267708/**
    7827  * @copydoc PDMDEVHLPR3::pfnIOAPICRegister
    7828  */
    7829 DECLINLINE(int) PDMDevHlpIOAPICRegister(PPDMDEVINS pDevIns, PPDMIOAPICREG pIoApicReg, PCPDMIOAPICHLPR3 *ppIoApicHlpR3)
    7830 {
    7831     return pDevIns->pHlpR3->pfnIOAPICRegister(pDevIns, pIoApicReg, ppIoApicHlpR3);
     7709 * @copydoc PDMDEVHLPR3::pfnIoApicRegister
     7710 */
     7711DECLINLINE(int) PDMDevHlpIoApicRegister(PPDMDEVINS pDevIns, PPDMIOAPICREG pIoApicReg, PCPDMIOAPICHLP *ppIoApicHlp)
     7712{
     7713    return pDevIns->pHlpR3->pfnIoApicRegister(pDevIns, pIoApicReg, ppIoApicHlp);
    78327714}
    78337715
     
    79707852{
    79717853    return pDevIns->CTX_SUFF(pHlp)->pfnPICSetUpContext(pDevIns, pPicReg, ppPicHlp);
     7854}
     7855
     7856/**
     7857 * @copydoc PDMDEVHLPR0::pfnIoApicSetUpContext
     7858 */
     7859DECLINLINE(int) PDMDevHlpIoApicSetUpContext(PPDMDEVINS pDevIns, PPDMIOAPICREG pIoApicReg, PCPDMIOAPICHLP *ppIoApicHlp)
     7860{
     7861    return pDevIns->CTX_SUFF(pHlp)->pfnIoApicSetUpContext(pDevIns, pIoApicReg, ppIoApicHlp);
    79727862}
    79737863
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