VirtualBox

Changeset 32935 in vbox for trunk/src/VBox/Devices/Bus


Ignore:
Timestamp:
Oct 6, 2010 9:28:42 AM (14 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
66421
Message:

PDM, VMM, PCI: reworked MSI API: now MSIs delivered via IOAPIC API, not with MMIO access, LSI logic now can work in MSI mode

Location:
trunk/src/VBox/Devices/Bus
Files:
3 edited

Legend:

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

    r32860 r32935  
    528528static void ich9pciSetIrqInternal(PPCIGLOBALS pGlobals, uint8_t uDevFn, PPCIDEVICE pPciDev, int iIrq, int iLevel)
    529529{
    530     if (MSIIsEnabled(pPciDev))
     530    if (MsiIsEnabled(pPciDev))
    531531    {
    532532        Log2(("Raise a MSI interrupt: %d\n", iIrq));
    533533        /* We only trigger MSI on level up, as technically it's matching flip-flop best (maybe even assert that level == PDM_IRQ_LEVEL_FLIP_FLOP) */
    534534        if ((iLevel & PDM_IRQ_LEVEL_HIGH) != 0)
    535             MSINotify(pGlobals->aPciBus.CTX_SUFF(pDevIns), pPciDev, iIrq);
     535        {
     536            PPDMDEVINS pDevIns = pGlobals->aPciBus.CTX_SUFF(pDevIns);
     537            MsiNotify(pDevIns, pGlobals->aPciBus.CTX_SUFF(pPciHlp), pPciDev, iIrq);
     538        }
    536539        return;
    537540    }
     
    786789static DECLCALLBACK(int) ich9pciRegisterMsi(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev, PPDMMSIREG pMsiReg)
    787790{
    788     return MSIInit(pPciDev, pMsiReg);
     791    return MsiInit(pPciDev, pMsiReg);
    789792}
    790793
     
    16861689       )
    16871690    {
    1688         return MSIPciConfigRead(aDev->Int.s.CTX_SUFF(pBus)->CTX_SUFF(pDevIns), aDev, u32Address, len);
     1691        return MsiPciConfigRead(aDev->Int.s.CTX_SUFF(pBus)->CTX_SUFF(pDevIns), aDev, u32Address, len);
    16891692    }
    16901693
     
    17231726       )
    17241727    {
    1725         MSIPciConfigWrite(aDev->Int.s.CTX_SUFF(pBus)->CTX_SUFF(pDevIns), aDev, u32Address, val, len);
     1728        MsiPciConfigWrite(aDev->Int.s.CTX_SUFF(pBus)->CTX_SUFF(pDevIns),
     1729                          aDev->Int.s.CTX_SUFF(pBus)->CTX_SUFF(pPciHlp),
     1730                          aDev, u32Address, val, len);
    17261731        return;
    17271732    }
  • trunk/src/VBox/Devices/Bus/MsiCommon.cpp

    r32862 r32935  
    9292
    9393
    94 void     MSIPciConfigWrite(PPDMDEVINS pDevIns, PPCIDEVICE pDev, uint32_t u32Address, uint32_t val, unsigned len)
     94void     MsiPciConfigWrite(PPDMDEVINS pDevIns, PCPDMPCIHLP pPciHlp, PPCIDEVICE pDev, uint32_t u32Address, uint32_t val, unsigned len)
    9595{
    9696    int32_t iOff = u32Address - pDev->Int.s.u8MsiCapOffset;
     
    113113                /* don't change read-only bits: 1-3,7 */
    114114                val &= UINT32_C(~0x8e);
    115                 pDev->config[uAddr] &= ~val;
     115                pDev->config[uAddr] = val;
    116116                break;
    117117            case VBOX_MSI_CAP_MESSAGE_CONTROL + 1:
     
    149149                                /* To ensure that we're no longer masked */
    150150                                pDev->config[uAddr] &= ~iBit;
    151                                 MSINotify(pDevIns, pDev, maskUpdated*8 + iBitNum);
     151                                MsiNotify(pDevIns, pPciHlp, pDev, maskUpdated*8 + iBitNum);
    152152                            }
    153153                        }
     
    162162}
    163163
    164 uint32_t MSIPciConfigRead (PPDMDEVINS pDevIns, PPCIDEVICE pDev, uint32_t u32Address, unsigned len)
     164uint32_t MsiPciConfigRead (PPDMDEVINS pDevIns, PPCIDEVICE pDev, uint32_t u32Address, unsigned len)
    165165{
    166166    int32_t iOff = u32Address - pDev->Int.s.u8MsiCapOffset;
     
    172172    {
    173173        case 1:
    174             rv = PCIDevGetByte(pDev, u32Address);
     174            rv = PCIDevGetByte(pDev,  u32Address);
    175175            break;
    176176        case 2:
    177             rv = PCIDevGetWord(pDev, u32Address);
     177            rv = PCIDevGetWord(pDev,  u32Address);
    178178            break;
    179179        case 4:
     
    190190
    191191
    192 int MSIInit(PPCIDEVICE pDev, PPDMMSIREG pMsiReg)
     192int MsiInit(PPCIDEVICE pDev, PPDMMSIREG pMsiReg)
    193193{
    194194    uint16_t   cVectors    = pMsiReg->cVectors;
     
    225225
    226226
    227 bool     MSIIsEnabled(PPCIDEVICE pDev)
     227bool     MsiIsEnabled(PPCIDEVICE pDev)
    228228{
    229229    return PCIIsMsiCapable(pDev) && msiIsEnabled(pDev);
    230230}
    231231
    232 void MSINotify(PPDMDEVINS pDevIns, PPCIDEVICE pDev, int iVector)
     232void MsiNotify(PPDMDEVINS pDevIns, PCPDMPCIHLP pPciHlp, PPCIDEVICE pDev, int iVector)
    233233{
    234234    Log2(("MSINotify: %d\n", iVector));
     
    250250    *upPending &= ~(1<<iVector);
    251251
    252     PDMDevHlpPhysWrite(pDevIns, GCAddr, &u32Value, sizeof(u32Value));
    253 }
     252    Assert(pPciHlp->pfnIoApicSendMsi != NULL);
     253    pPciHlp->pfnIoApicSendMsi(pDevIns, GCAddr, u32Value);
     254}
  • trunk/src/VBox/Devices/Bus/MsiCommon.h

    r32860 r32935  
    1515 */
    1616
     17/* Maybe belongs to types.h */
     18#ifdef IN_RING3
     19typedef PCPDMPCIHLPR3 PCPDMPCIHLP;
     20#endif
     21
     22#ifdef IN_RING0
     23typedef PCPDMPCIHLPR0 PCPDMPCIHLP;
     24#endif
     25
     26#ifdef IN_RC
     27typedef PCPDMPCIHLPRC PCPDMPCIHLP;
     28#endif
     29
    1730/* Init MSI support in the device. */
    18 int      MSIInit(PPCIDEVICE pDev, PPDMMSIREG pMsiReg);
     31int      MsiInit(PPCIDEVICE pDev, PPDMMSIREG pMsiReg);
    1932
    2033/* If MSI is enabled, so that MSINotify() shall be used for notifications.  */
    21 bool     MSIIsEnabled(PPCIDEVICE pDev);
     34bool     MsiIsEnabled(PPCIDEVICE pDev);
     35
    2236/* Device notification (aka interrupt). */
    23 void     MSINotify(PPDMDEVINS pDevIns, PPCIDEVICE pDev, int iVector);
     37void     MsiNotify(PPDMDEVINS pDevIns, PCPDMPCIHLP pPciHlp, PPCIDEVICE pDev, int iVector);
    2438
    2539/* PCI config space accessors for MSI registers */
    26 void     MSIPciConfigWrite(PPDMDEVINS pDevIns, PPCIDEVICE pDev, uint32_t u32Address, uint32_t val, unsigned len);
    27 uint32_t MSIPciConfigRead (PPDMDEVINS pDevIns, PPCIDEVICE pDev, uint32_t u32Address, unsigned len);
     40void     MsiPciConfigWrite(PPDMDEVINS pDevIns, PCPDMPCIHLP pPciHlp, PPCIDEVICE pDev, uint32_t u32Address, uint32_t val, unsigned len);
     41uint32_t MsiPciConfigRead (PPDMDEVINS pDevIns, PPCIDEVICE pDev, uint32_t u32Address, unsigned len);
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