VirtualBox

Changeset 64596 in vbox for trunk/include/VBox


Ignore:
Timestamp:
Nov 8, 2016 3:03:18 PM (8 years ago)
Author:
vboxsync
Message:

VMM/APIC, PDM: Clean up PDM APIC helper interface, call VMM directly instead.

Location:
trunk/include/VBox/vmm
Files:
2 edited

Legend:

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

    r62476 r64596  
    4949VMM_INT_DECL(bool)      PDMHasIoApic(PVM pVM);
    5050VMM_INT_DECL(int)       PDMIoApicSetIrq(PVM pVM, uint8_t u8Irq, uint8_t u8Level, uint32_t uTagSrc);
     51VMM_INT_DECL(int)       PDMIoApicBroadcastEoi(PVM pVM, uint8_t uVector);
    5152VMM_INT_DECL(int)       PDMIoApicSendMsi(PVM pVM, RTGCPHYS GCAddr, uint32_t uValue, uint32_t uTagSrc);
    5253VMM_INT_DECL(bool)      PDMHasApic(PVM pVM);
  • trunk/include/VBox/vmm/pdmdev.h

    r64406 r64596  
    13851385
    13861386/**
    1387  * APIC RC helpers.
    1388  */
    1389 typedef struct PDMAPICHLPRC
    1390 {
    1391     /** Structure version. PDM_APICHLPRC_VERSION defines the current version. */
    1392     uint32_t                u32Version;
    1393 
    1394     /**
    1395      * Set the interrupt force action flag.
    1396      *
    1397      * @param   pDevIns         Device instance of the APIC.
    1398      * @param   enmType         IRQ type.
    1399      * @param   idCpu           Virtual CPU to set flag upon.
    1400      */
    1401     DECLRCCALLBACKMEMBER(void, pfnSetInterruptFF,(PPDMDEVINS pDevIns, PDMAPICIRQ enmType, VMCPUID idCpu));
    1402 
    1403     /**
    1404      * Clear the interrupt force action flag.
    1405      *
    1406      * @param   pDevIns         Device instance of the APIC.
    1407      * @param   enmType         IRQ type.
    1408      * @param   idCpu           Virtual CPU to clear flag upon.
    1409      */
    1410     DECLRCCALLBACKMEMBER(void, pfnClearInterruptFF,(PPDMDEVINS pDevIns, PDMAPICIRQ enmType, VMCPUID idCpu));
    1411 
    1412     /**
    1413      * Broadcasts an EOI for an interrupt vector to the I/O APICs.
    1414      *
    1415      * @returns VBox status code.
    1416      * @param   pDevIns         The APIC device instance.
    1417      * @param   u8Vector        The interrupt vector.
    1418      */
    1419     DECLRCCALLBACKMEMBER(int, pfnBusBroadcastEoi,(PPDMDEVINS pDevIns, uint8_t u8Vector));
    1420 
    1421     /**
    1422      * Calculates an IRQ tag for a timer, IPI or similar event.
    1423      *
    1424      * @returns The IRQ tag.
    1425      * @param   pDevIns         Device instance of the APIC.
    1426      * @param   u8Level         PDM_IRQ_LEVEL_HIGH or PDM_IRQ_LEVEL_FLIP_FLOP.
    1427      */
    1428     DECLRCCALLBACKMEMBER(uint32_t, pfnCalcIrqTag,(PPDMDEVINS pDevIns, uint8_t u8Level));
    1429 
    1430     /**
    1431      * Acquires the PDM lock.
    1432      *
    1433      * @returns VINF_SUCCESS on success.
    1434      * @returns rc if we failed to acquire the lock.
    1435      * @param   pDevIns         The APIC device instance.
    1436      * @param   rc              What to return if we fail to acquire the lock.
    1437      */
    1438     DECLRCCALLBACKMEMBER(int,   pfnLock,(PPDMDEVINS pDevIns, int rc));
    1439 
    1440     /**
    1441      * Releases the PDM lock.
    1442      *
    1443      * @param   pDevIns         The APIC device instance.
    1444      */
    1445     DECLRCCALLBACKMEMBER(void,  pfnUnlock,(PPDMDEVINS pDevIns));
    1446 
    1447     /**
    1448      * Get the virtual CPU id corresponding to the current EMT.
    1449      *
    1450      * @param   pDevIns         The APIC device instance.
    1451      */
    1452     DECLRCCALLBACKMEMBER(VMCPUID, pfnGetCpuId,(PPDMDEVINS pDevIns));
    1453 
    1454     /** Just a safety precaution. */
    1455     uint32_t                u32TheEnd;
    1456 } PDMAPICHLPRC;
    1457 /** Pointer to APIC GC helpers. */
    1458 typedef RCPTRTYPE(PDMAPICHLPRC *) PPDMAPICHLPRC;
    1459 /** Pointer to const APIC helpers. */
    1460 typedef RCPTRTYPE(const PDMAPICHLPRC *) PCPDMAPICHLPRC;
    1461 
    1462 /** Current PDMAPICHLPRC version number. */
    1463 #define PDM_APICHLPRC_VERSION                   PDM_VERSION_MAKE(0xfff5, 5, 0)
    1464 
    1465 
    1466 /**
    1467  * APIC R0 helpers.
    1468  */
    1469 typedef struct PDMAPICHLPR0
    1470 {
    1471     /** Structure version. PDM_APICHLPR0_VERSION defines the current version. */
    1472     uint32_t                u32Version;
    1473 
    1474     /**
    1475      * Set the interrupt force action flag.
    1476      *
    1477      * @param   pDevIns         Device instance of the APIC.
    1478      * @param   enmType         IRQ type.
    1479      * @param   idCpu           Virtual CPU to set flag upon.
    1480      */
    1481     DECLR0CALLBACKMEMBER(void, pfnSetInterruptFF,(PPDMDEVINS pDevIns, PDMAPICIRQ enmType, VMCPUID idCpu));
    1482 
    1483     /**
    1484      * Clear the interrupt force action flag.
    1485      *
    1486      * @param   pDevIns         Device instance of the APIC.
    1487      * @param   enmType         IRQ type.
    1488      * @param   idCpu           Virtual CPU to clear flag upon.
    1489      */
    1490     DECLR0CALLBACKMEMBER(void, pfnClearInterruptFF,(PPDMDEVINS pDevIns, PDMAPICIRQ enmType, VMCPUID idCpu));
    1491 
    1492     /**
    1493      * Broadcasts an EOI for an interrupt vector to the I/O APICs.
    1494      *
    1495      * @returns VBox status code.
    1496      * @param   pDevIns         The APIC device instance.
    1497      * @param   u8Vector        The interrupt vector.
    1498      */
    1499     DECLR0CALLBACKMEMBER(int, pfnBusBroadcastEoi,(PPDMDEVINS pDevIns, uint8_t u8Vector));
    1500 
    1501     /**
    1502      * Calculates an IRQ tag for a timer, IPI or similar event.
    1503      *
    1504      * @returns The IRQ tag.
    1505      * @param   pDevIns         Device instance of the APIC.
    1506      * @param   u8Level         PDM_IRQ_LEVEL_HIGH or PDM_IRQ_LEVEL_FLIP_FLOP.
    1507      */
    1508     DECLR0CALLBACKMEMBER(uint32_t, pfnCalcIrqTag,(PPDMDEVINS pDevIns, uint8_t u8Level));
    1509 
    1510     /**
    1511      * Acquires the PDM lock.
    1512      *
    1513      * @returns VINF_SUCCESS on success.
    1514      * @returns rc if we failed to acquire the lock.
    1515      * @param   pDevIns         The APIC device instance.
    1516      * @param   rc              What to return if we fail to acquire the lock.
    1517      */
    1518     DECLR0CALLBACKMEMBER(int,   pfnLock,(PPDMDEVINS pDevIns, int rc));
    1519 
    1520     /**
    1521      * Releases the PDM lock.
    1522      *
    1523      * @param   pDevIns         The APIC device instance.
    1524      */
    1525     DECLR0CALLBACKMEMBER(void,  pfnUnlock,(PPDMDEVINS pDevIns));
    1526 
    1527     /**
    1528      * Get the virtual CPU id corresponding to the current EMT.
    1529      *
    1530      * @param   pDevIns         The APIC device instance.
    1531      */
    1532     DECLR0CALLBACKMEMBER(VMCPUID, pfnGetCpuId,(PPDMDEVINS pDevIns));
    1533 
    1534     /** Just a safety precaution. */
    1535     uint32_t                u32TheEnd;
    1536 } PDMAPICHLPR0;
    1537 /** Pointer to APIC GC helpers. */
    1538 typedef RCPTRTYPE(PDMAPICHLPR0 *) PPDMAPICHLPR0;
    1539 /** Pointer to const APIC helpers. */
    1540 typedef R0PTRTYPE(const PDMAPICHLPR0 *) PCPDMAPICHLPR0;
    1541 
    1542 /** Current PDMAPICHLPR0 version number. */
    1543 #define PDM_APICHLPR0_VERSION                   PDM_VERSION_MAKE(0xfff4, 5, 0)
    1544 
    1545 /**
    1546  * APIC R3 helpers.
    1547  */
    1548 typedef struct PDMAPICHLPR3
    1549 {
    1550     /** Structure version. PDM_APICHLPR3_VERSION defines the current version. */
    1551     uint32_t                u32Version;
    1552 
    1553     /**
    1554      * Set the interrupt force action flag.
    1555      *
    1556      * @param   pDevIns         Device instance of the APIC.
    1557      * @param   enmType         IRQ type.
    1558      * @param   idCpu           Virtual CPU to set flag upon.
    1559      */
    1560     DECLR3CALLBACKMEMBER(void, pfnSetInterruptFF,(PPDMDEVINS pDevIns, PDMAPICIRQ enmType, VMCPUID idCpu));
    1561 
    1562     /**
    1563      * Clear the interrupt force action flag.
    1564      *
    1565      * @param   pDevIns         Device instance of the APIC.
    1566      * @param   enmType         IRQ type.
    1567      * @param   idCpu           Virtual CPU to clear flag upon.
    1568      */
    1569     DECLR3CALLBACKMEMBER(void, pfnClearInterruptFF,(PPDMDEVINS pDevIns, PDMAPICIRQ enmType, VMCPUID idCpu));
    1570 
    1571     /**
    1572      * Broadcasts an EOI for an interrupt vector to the I/O APICs.
    1573      *
    1574      * @returns VBox status code.
    1575      * @param   pDevIns         The APIC device instance.
    1576      * @param   u8Vector        The interrupt vector.
    1577      */
    1578     DECLR3CALLBACKMEMBER(int, pfnBusBroadcastEoi,(PPDMDEVINS pDevIns, uint8_t u8Vector));
    1579 
    1580     /**
    1581      * Calculates an IRQ tag for a timer, IPI or similar event.
    1582      *
    1583      * @returns The IRQ tag.
    1584      * @param   pDevIns         Device instance of the APIC.
    1585      * @param   u8Level         PDM_IRQ_LEVEL_HIGH or PDM_IRQ_LEVEL_FLIP_FLOP.
    1586      */
    1587     DECLR3CALLBACKMEMBER(uint32_t, pfnCalcIrqTag,(PPDMDEVINS pDevIns, uint8_t u8Level));
    1588 
    1589     /**
    1590      * Modifies APIC-related bits in the CPUID feature mask and preps MSRs.
    1591      *
    1592      * @param   pDevIns         Device instance of the APIC.
    1593      * @param   enmMode         Max supported APIC mode.
    1594      */
    1595     DECLR3CALLBACKMEMBER(void, pfnSetFeatureLevel,(PPDMDEVINS pDevIns, PDMAPICMODE enmMode));
    1596 
    1597     /**
    1598      * Get the virtual CPU id corresponding to the current EMT.
    1599      *
    1600      * @param   pDevIns         The APIC device instance.
    1601      */
    1602     DECLR3CALLBACKMEMBER(VMCPUID, pfnGetCpuId,(PPDMDEVINS pDevIns));
    1603 
    1604     /**
    1605      * Sends Startup IPI to given virtual CPU.
    1606      *
    1607      * @param   pDevIns         The APIC device instance.
    1608      * @param   idCpu           Virtual CPU to perform Startup IPI on.
    1609      * @param   uVector         Startup IPI vector.
    1610      */
    1611     DECLR3CALLBACKMEMBER(void,    pfnSendStartupIpi,(PPDMDEVINS pDevIns, VMCPUID idCpu, uint32_t uVector));
    1612 
    1613     /**
    1614      * Sends INIT IPI to given virtual CPU, should result in reset and
    1615      * halting till Startup IPI.
    1616      *
    1617      * @param   pDevIns         The APIC device instance.
    1618      * @param   idCpu           Virtual CPU to perform INIT IPI on.
    1619      */
    1620     DECLR3CALLBACKMEMBER(void,    pfnSendInitIpi,(PPDMDEVINS pDevIns, VMCPUID idCpu));
    1621 
    1622     /**
    1623      * Gets the address of the RC APIC helpers.
    1624      *
    1625      * This should be called at both construction and relocation time
    1626      * to obtain the correct address of the RC helpers.
    1627      *
    1628      * @returns GC pointer to the APIC helpers.
    1629      * @param   pDevIns         Device instance of the APIC.
    1630      */
    1631     DECLR3CALLBACKMEMBER(PCPDMAPICHLPRC, pfnGetRCHelpers,(PPDMDEVINS pDevIns));
    1632 
    1633     /**
    1634      * Gets the address of the R0 APIC helpers.
    1635      *
    1636      * This should be called at both construction and relocation time
    1637      * to obtain the correct address of the R0 helpers.
    1638      *
    1639      * @returns R0 pointer to the APIC helpers.
    1640      * @param   pDevIns         Device instance of the APIC.
    1641      */
    1642     DECLR3CALLBACKMEMBER(PCPDMAPICHLPR0, pfnGetR0Helpers,(PPDMDEVINS pDevIns));
    1643 
    1644     /**
    1645      * Get the critical section used to synchronize the PICs, PCI and stuff.
    1646      *
    1647      * @returns Ring-3 pointer to the critical section.
    1648      * @param   pDevIns         The APIC device instance.
    1649      */
    1650     DECLR3CALLBACKMEMBER(R3PTRTYPE(PPDMCRITSECT), pfnGetR3CritSect,(PPDMDEVINS pDevIns));
    1651 
    1652     /**
    1653      * Get the critical section used to synchronize the PICs, PCI and stuff.
    1654      *
    1655      * @returns Raw-mode context pointer to the critical section.
    1656      * @param   pDevIns         The APIC device instance.
    1657      */
    1658     DECLR3CALLBACKMEMBER(RCPTRTYPE(PPDMCRITSECT), pfnGetRCCritSect,(PPDMDEVINS pDevIns));
    1659 
    1660     /**
    1661      * Get the critical section used to synchronize the PICs, PCI and stuff.
    1662      *
    1663      * @returns Ring-0 pointer to the critical section.
    1664      * @param   pDevIns         The APIC device instance.
    1665      */
    1666     DECLR3CALLBACKMEMBER(R0PTRTYPE(PPDMCRITSECT), pfnGetR0CritSect,(PPDMDEVINS pDevIns));
    1667 
    1668     /** Just a safety precaution. */
    1669     uint32_t                u32TheEnd;
    1670 } PDMAPICHLPR3;
    1671 /** Pointer to APIC helpers. */
    1672 typedef R3PTRTYPE(PDMAPICHLPR3 *) PPDMAPICHLPR3;
    1673 /** Pointer to const APIC helpers. */
    1674 typedef R3PTRTYPE(const PDMAPICHLPR3 *) PCPDMAPICHLPR3;
    1675 
    1676 /** Current PDMAPICHLP version number. */
    1677 #define PDM_APICHLPR3_VERSION                   PDM_VERSION_MAKE(0xfff3, 4, 0)
    1678 
    1679 
    1680 /**
    16811387 * I/O APIC registration structure.
    16821388 */
     
    34843190     * @param   pDevIns             The device instance.
    34853191     * @param   pApicReg            Pointer to a APIC registration structure.
    3486      * @param   ppApicHlpR3         Where to store the pointer to the APIC helpers.
    3487      */
    3488     DECLR3CALLBACKMEMBER(int, pfnAPICRegister,(PPDMDEVINS pDevIns, PPDMAPICREG pApicReg, PCPDMAPICHLPR3 *ppApicHlpR3));
     3192     */
     3193    DECLR3CALLBACKMEMBER(int, pfnAPICRegister,(PPDMDEVINS pDevIns, PPDMAPICREG pApicReg));
    34893194
    34903195    /**
     
    55145219 * @copydoc PDMDEVHLPR3::pfnAPICRegister
    55155220 */
    5516 DECLINLINE(int) PDMDevHlpAPICRegister(PPDMDEVINS pDevIns, PPDMAPICREG pApicReg, PCPDMAPICHLPR3 *ppApicHlpR3)
    5517 {
    5518     return pDevIns->pHlpR3->pfnAPICRegister(pDevIns, pApicReg, ppApicHlpR3);
     5221DECLINLINE(int) PDMDevHlpAPICRegister(PPDMDEVINS pDevIns, PPDMAPICREG pApicReg)
     5222{
     5223    return pDevIns->pHlpR3->pfnAPICRegister(pDevIns, pApicReg);
    55195224}
    55205225
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